diff options
author | Eric Guzman | 2012-05-22 15:57:23 -0700 |
---|---|---|
committer | Eric Guzman | 2012-05-22 15:57:23 -0700 |
commit | ad3b4595d7377e5bf75bcb8ad81007859b0a8a02 (patch) | |
tree | ecb7fe289824a625b1dc422a97c2236826081ec3 /js/stage | |
parent | 0eb95ff2dbba1fe7213eed2e0140b4d07bda3dd5 (diff) | |
parent | 2b207ef8b2594927f8cd6cd63a8483d205cb86c4 (diff) | |
download | ninja-ad3b4595d7377e5bf75bcb8ad81007859b0a8a02.tar.gz |
Merge branch 'dom-architecture' of github.com:Motorola-Mobility/ninja-internal into CSSPanelUpdates
Conflicts:
js/controllers/styles-controller.js
Diffstat (limited to 'js/stage')
-rwxr-xr-x | js/stage/stage-view.reel/stage-view.js | 132 | ||||
-rwxr-xr-x | js/stage/stage.reel/stage.js | 71 |
2 files changed, 53 insertions, 150 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..69cfa7ba 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js | |||
@@ -468,26 +468,19 @@ exports.Stage = Montage.create(Component, { | |||
468 | */ | 468 | */ |
469 | handleScroll: { | 469 | handleScroll: { |
470 | value: function() { | 470 | value: function() { |
471 | // TODO: Remove marker for old template: NINJA-STAGE-REWORK | ||
472 | if(this.application.ninja.currentDocument.documentRoot.id === "UserContent") { | ||
473 | this._scrollLeft = this._iframeContainer.scrollLeft; | ||
474 | this._scrollTop = this._iframeContainer.scrollTop; | ||
475 | 471 | ||
476 | this.userContentLeft = this._documentOffsetLeft - this._scrollLeft + this._userContentBorder; | 472 | this._scrollLeft = this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft; |
477 | this.userContentTop = this._documentOffsetTop - this._scrollTop + this._userContentBorder; | 473 | this._scrollTop = this.application.ninja.currentDocument.model.views.design.document.body.scrollTop; |
478 | } else { | ||
479 | this._scrollLeft = this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft; | ||
480 | this._scrollTop = this.application.ninja.currentDocument.model.views.design.document.body.scrollTop; | ||
481 | 474 | ||
482 | this.userContentLeft = this._documentOffsetLeft - this._scrollLeft; | 475 | this.userContentLeft = this._documentOffsetLeft - this._scrollLeft; |
483 | this.userContentTop = this._documentOffsetTop - this._scrollTop; | 476 | this.userContentTop = this._documentOffsetTop - this._scrollTop; |
477 | |||
478 | // TODO - scroll events are not dependable. We may need to use a timer to simulate | ||
479 | // scrollBegin and scrollEnd. For now, the Pan Tool will keep track of the stage's scroll values | ||
480 | // on mouse down. | ||
481 | // this._maxHorizontalScroll = this.application.ninja.currentDocument.documentRoot.scrollWidth - this._canvas.width - 11; | ||
482 | // this._maxVerticalScroll = this.application.ninja.currentDocument.documentRoot.scrollHeight - this._canvas.height - 11; | ||
484 | 483 | ||
485 | // TODO - scroll events are not dependable. We may need to use a timer to simulate | ||
486 | // scrollBegin and scrollEnd. For now, the Pan Tool will keep track of the stage's scroll values | ||
487 | // on mouse down. | ||
488 | // this._maxHorizontalScroll = this.application.ninja.currentDocument.documentRoot.scrollWidth - this._canvas.width - 11; | ||
489 | // this._maxVerticalScroll = this.application.ninja.currentDocument.documentRoot.scrollHeight - this._canvas.height - 11; | ||
490 | } | ||
491 | 484 | ||
492 | // Need to clear the snap cache and set up the drag plane | 485 | // Need to clear the snap cache and set up the drag plane |
493 | //snapManager.setupDragPlaneFromPlane( workingPlane ); | 486 | //snapManager.setupDragPlaneFromPlane( workingPlane ); |
@@ -1012,5 +1005,47 @@ exports.Stage = Montage.create(Component, { | |||
1012 | this._iframeContainer.scrollTop = this.application.ninja.documentController.activeDocument.savedTopScroll; | 1005 | this._iframeContainer.scrollTop = this.application.ninja.documentController.activeDocument.savedTopScroll; |
1013 | this._scrollTop = this.application.ninja.documentController.activeDocument.savedTopScroll; | 1006 | this._scrollTop = this.application.ninja.documentController.activeDocument.savedTopScroll; |
1014 | } | 1007 | } |
1015 | } | 1008 | }, |
1009 | |||
1010 | showRulers:{ | ||
1011 | value:function(){ | ||
1012 | this.application.ninja.rulerTop.style.display = "block"; | ||
1013 | this.application.ninja.rulerLeft.style.display = "block"; | ||
1014 | } | ||
1015 | }, | ||
1016 | hideRulers:{ | ||
1017 | value:function(){ | ||
1018 | this.application.ninja.rulerTop.style.display = "none"; | ||
1019 | this.application.ninja.rulerLeft.style.display = "none"; | ||
1020 | } | ||
1021 | }, | ||
1022 | showCodeViewBar:{ | ||
1023 | value:function(isCodeView){ | ||
1024 | if(isCodeView === true) { | ||
1025 | this.application.ninja.editorViewOptions.element.style.display = "block"; | ||
1026 | this.application.ninja.documentBar.element.style.display = "none"; | ||
1027 | } else { | ||
1028 | this.application.ninja.documentBar.element.style.display = "block"; | ||
1029 | this.application.ninja.editorViewOptions.element.style.display = "none"; | ||
1030 | } | ||
1031 | } | ||