aboutsummaryrefslogtreecommitdiff
path: root/js/stage
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-02-06 16:33:24 -0800
committerJose Antonio Marquez2012-02-06 16:33:24 -0800
commit989b433e8d11919b70845abc04f4e9359680aee3 (patch)
tree25eaa938e8418996f4efcb65e84342516610dee9 /js/stage
parenta9e6f4aa38cbba79d903a7935fc2ccc701ff60b8 (diff)
parent729bc48212d7244539c99ca206be673eed011115 (diff)
downloadninja-989b433e8d11919b70845abc04f4e9359680aee3.tar.gz
Merge branch 'refs/heads/AnanyaFileIO' into FileIO
Diffstat (limited to 'js/stage')
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.js29
-rwxr-xr-xjs/stage/stage.reel/stage.js15
2 files changed, 34 insertions, 10 deletions
diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js
index 6f20b87b..f8817b13 100755
--- a/js/stage/stage-view.reel/stage-view.js
+++ b/js/stage/stage-view.reel/stage-view.js
@@ -76,10 +76,7 @@ exports.StageView = Montage.create(Component, {
76 // Temporary function to create a Codemirror text view 76 // Temporary function to create a Codemirror text view
77 createTextView: { 77 createTextView: {
78 value: function(doc) { 78 value: function(doc) {
79 //save current document 79 this.application.ninja.documentController.activeDocument.save(true /*remove the codemirror div after saving*/);
80 if(this.application.ninja.documentController.activeDocument.currentView === "code"){
81 this.application.ninja.documentController.activeDocument.save(true);
82 }
83 this.application.ninja.documentController._hideCurrentDocument(); 80 this.application.ninja.documentController._hideCurrentDocument();
84 this.hideOtherDocuments(doc.uuid); 81 this.hideOtherDocuments(doc.uuid);
85 var type; 82 var type;
@@ -100,7 +97,14 @@ exports.StageView = Montage.create(Component, {
100 doc.editor = CodeMirror.fromTextArea(doc.textArea, { 97 doc.editor = CodeMirror.fromTextArea(doc.textArea, {
101 lineNumbers: true, 98 lineNumbers: true,
102 mode: type, 99 mode: type,
103 onChange: function(){doc.dirtyFlag=true;}, 100 onChange: function(){
101 var historySize = doc.editor.historySize();
102 if((historySize.undo===0 && historySize.redo===0) || (historySize.undo>0)){
103 doc.dirtyFlag=true;
104 }else if(historySize.undo===0 && historySize.redo>0){
105 doc.dirtyFlag=false;
106 }
107 },
104 onCursorActivity: function() { 108 onCursorActivity: function() {
105 //documentController._codeEditor.editor.setLineClass(documentController._codeEditor.hline, null); 109 //documentController._codeEditor.editor.setLineClass(documentController._codeEditor.hline, null);
106 //documentController._codeEditor.hline = documentController._codeEditor.editor.setLineClass(documentController._codeEditor.editor.getCursor().line, "activeline"); 110 //documentController._codeEditor.hline = documentController._codeEditor.editor.setLineClass(documentController._codeEditor.editor.getCursor().line, "activeline");
@@ -118,13 +122,16 @@ exports.StageView = Montage.create(Component, {
118 122
119 switchDocument:{ 123 switchDocument:{
120 value: function(doc){ 124 value: function(doc){
125 this.application.ninja.documentController.activeDocument.save(true /*remove the codemirror div after saving*/);
121 126
122 //if dirty SAVE codemirror into textarea 127 this.application.ninja.documentController._hideCurrentDocument();
123 if(this.application.ninja.documentController.activeDocument.currentView === "code"){ 128
124 this.application.ninja.documentController.activeDocument.save(true); 129
130 if(this.application.ninja.documentController.activeDocument.currentView === "design"){
131 console.log("scrollLeft: "+ this.application.ninja.stage._iframeContainer.scrollLeft);
132 console.log("scrollTop: "+ this.application.ninja.stage._iframeContainer.scrollTop);
125 } 133 }
126 134
127 this.application.ninja.documentController._hideCurrentDocument();
128 135
129 this.application.ninja.documentController.activeDocument = doc; 136 this.application.ninja.documentController.activeDocument = doc;
130 137
@@ -148,7 +155,7 @@ exports.StageView = Montage.create(Component, {
148 doc.editor = CodeMirror.fromTextArea(doc.textArea, { 155 doc.editor = CodeMirror.fromTextArea(doc.textArea, {
149 lineNumbers: true, 156 lineNumbers: true,
150 mode: type, 157 mode: type,
151 onChange: function(){doc.dirtyFlag=true;}, 158 onChange: function(){doc.dirtyFlag=true;console.log("undo stack:",doc.editor.historySize());},
152 onCursorActivity: function() { 159 onCursorActivity: function() {
153 //documentController._codeEditor.editor.setLineClass(documentController._codeEditor.hline, null); 160 //documentController._codeEditor.editor.setLineClass(documentController._codeEditor.hline, null);
154 //documentController._codeEditor.hline = documentController._codeEditor.editor.setLineClass(documentController._codeEditor.editor.getCursor().line, "activeline"); 161 //documentController._codeEditor.hline = documentController._codeEditor.editor.setLineClass(documentController._codeEditor.editor.getCursor().line, "activeline");
@@ -160,6 +167,8 @@ exports.StageView = Montage.create(Component, {
160 167
161 if(this.application.ninja.documentController.activeDocument.documentType === "htm" || this.application.ninja.documentController.activeDocument.documentType === "html") { 168 if(this.application.ninja.documentController.activeDocument.documentType === "htm" || this.application.ninja.documentController.activeDocument.documentType === "html") {
162 this.application.ninja.stage._scrollFlag = true; // TODO HACK to prevent type error on Hide/Show Iframe 169 this.application.ninja.stage._scrollFlag = true; // TODO HACK to prevent type error on Hide/Show Iframe
170
171
163 // TODO dispatch event here 172 // TODO dispatch event here
164 // appDelegateModule.MyAppDelegate.onSetActiveDocument(); 173 // appDelegateModule.MyAppDelegate.onSetActiveDocument();
165 } 174 }
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js
index 9e2df5a2..4364b45d 100755
--- a/js/stage/stage.reel/stage.js
+++ b/js/stage/stage.reel/stage.js
@@ -876,5 +876,20 @@ exports.Stage = Montage.create(Component, {
876 876
877 this.stageDeps.snapManager.updateWorkingPlaneFromView(); 877 this.stageDeps.snapManager.updateWorkingPlaneFromView();
878 } 878 }
879 },
880
881 saveStageScroll:{
882 value: function(){
883 this.savedLeftScroll = this._iframeContainer.scrollLeft;
884 this.savedTopScroll = this._iframeContainer.scrollTop;
885 }
886 },
887 applySavedScroll:{
888 value: function(){
889 this._iframeContainer.scrollLeft = this.savedLeftScroll;
890 this._scrollLeft = this.savedLeftScroll;
891 this._iframeContainer.scrollTop = this.savedTopScroll;
892 this._scrollTop = this.savedTopScroll;
893 }
879 } 894 }
880}); \ No newline at end of file 895}); \ No newline at end of file