diff options
author | Armen Kesablyan | 2012-05-23 14:34:58 -0700 |
---|---|---|
committer | Armen Kesablyan | 2012-05-23 14:34:58 -0700 |
commit | c21db7f1e4a0582777bdb5366df5d023a915b779 (patch) | |
tree | c4d29cb4686101d4a480ae836d20187879cf5400 /js/stage/stage-view.reel/stage-view.js | |
parent | 3ed95247e9ea4b0a7833401ed6809647b7c4acbf (diff) | |
parent | 1a7e347810401e6262d9d7bad1c3583e6773993b (diff) | |
download | ninja-c21db7f1e4a0582777bdb5366df5d023a915b779.tar.gz |
Merge branch 'refs/heads/dom-architecture' into binding
Conflicts:
js/data/panels-data.js
Signed-off-by: Armen Kesablyan <armen@motorola.com>
Diffstat (limited to 'js/stage/stage-view.reel/stage-view.js')
-rwxr-xr-x | js/stage/stage-view.reel/stage-view.js | 154 |
1 files changed, 0 insertions, 154 deletions
diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js index ba94fadf..2c129ee2 100755 --- a/js/stage/stage-view.reel/stage-view.js +++ b/js/stage/stage-view.reel/stage-view.js | |||
@@ -33,107 +33,10 @@ 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:{ |
114 | value: function(doc){ | 39 | value: function(doc){ |
115 | this.application.ninja.documentController._hideCurrentDocument(); | ||
116 | this.application.ninja.documentController.activeDocument = doc; | ||
117 | |||
118 | if(this.application.ninja.documentController.activeDocument.currentView === "design") { | ||
119 | this.application.ninja.currentDocument = this.application.ninja.documentController.activeDocument; | ||
120 | } | ||
121 | |||
122 | this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe | ||
123 | |||
124 | |||
125 | // this.application.ninja.documentController._showCurrentDocument(); | ||
126 | // Inline function below | ||
127 | if(this.activeDocument) { | ||
128 | this.activeDocument.container.style["display"] = "block"; | ||
129 | if(this.activeDocument.currentView === "design"){ | ||
130 | this.activeDocument.container.parentNode.style["display"] = "block"; | ||
131 | this.activeDocument.restoreAppState(); | ||
132 | } else { | ||
133 | //hide the iframe when switching to code view | ||
134 | document.getElementById("iframeContainer").style.display = "none"; | ||
135 | } | ||
136 | } | ||
137 | 40 | ||
138 | 41 | ||
139 | //focus editor | 42 | //focus editor |
@@ -155,62 +58,5 @@ exports.StageView = Montage.create(Component, { | |||
155 | 58 | ||
156 | NJevent("switchDocument"); | 59 | NJevent("switchDocument"); |
157 | } | 60 | } |
158 | }, | ||
159 | |||
160 | /** | ||
161 | * Public method | ||
162 | * Switches between different views of a design document, like HTML design view, HTML code view | ||
163 | */ | ||
164 | switchDesignDocViews: { | ||
165 | value: function() { | ||
166 | //TODO | ||
167 | } | ||
168 | }, | ||
169 | |||
170 | showRulers:{ | ||
171 | value:function(){ | ||
172 | this.application.ninja.rulerTop.style.display = "block"; | ||
173 | this.application.ninja.rulerLeft.style.display = "block"; | ||
174 | } | ||
175 | }, | ||
176 | hideRulers:{ | ||
177 | value:function(){ | ||
178 | this.application.ninja.rulerTop.style.display = "none"; | ||
179 | this.application.ninja.rulerLeft.style.display = "none"; | ||
180 | } | ||
181 | }, | ||
182 | showCodeViewBar:{ | ||
183 | value:function(isCodeView){ | ||
184 | if(isCodeView === true) { | ||
185 | this.application.ninja.editorViewOptions.element.style.display = "block"; | ||
186 | this.application.ninja.documentBar.element.style.display = "none"; | ||
187 | } else { | ||
188 | this.application.ninja.documentBar.element.style.display = "block"; | ||
189 | this.application.ninja.editorViewOptions.element.style.display = "none"; | ||
190 | } | ||
191 | } | ||
192 | }, | ||
193 | |||
194 | collapseAllPanels:{ | ||
195 | value:function(){ | ||
196 | this.application.ninja.panelSplitter.collapse(); | ||
197 | this.application.ninja.timelineSplitter.collapse(); | ||
198 | this.application.ninja.toolsSplitter.collapse(); | ||
199 | this.application.ninja.optionsSplitter.collapse(); | ||
200 | } | ||
201 | }, | ||
202 | restoreAllPanels:{ | ||
203 | value:function(){ | ||
204 | this.application.ninja.panelSplitter.restore(); | ||
205 | this.application.ninja.timelineSplitter.restore(); | ||
206 | this.application.ninja.toolsSplitter.restore(); | ||
207 | this.application.ninja.optionsSplitter.restore(); | ||
208 | } | ||
209 | }, | ||
210 | |||
211 | applyTheme:{ | ||
212 | value:function(themeClass){ | ||
213 | this.element.className = "codeViewContainer "+themeClass; | ||
214 | } | ||
215 | } | 61 | } |
216 | }); \ No newline at end of file | 62 | }); \ No newline at end of file |