aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnanya Sen2012-02-15 16:09:14 -0800
committerAnanya Sen2012-02-15 16:09:14 -0800
commit4937b39fb0cf542f57cdadc7d1e2ed9798f7ef87 (patch)
treeceb195e70be2e233068bdc2e6113505548b93df8
parent56d2a8d11a73cd04c7f1bc20d1ded52b9c1242f2 (diff)
downloadninja-4937b39fb0cf542f57cdadc7d1e2ed9798f7ef87.tar.gz
fixes to document tabbing
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
-rw-r--r--js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js2
-rwxr-xr-xjs/controllers/document-controller.js32
-rwxr-xr-xjs/ninja.reel/ninja.html4
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.js1
4 files changed, 22 insertions, 17 deletions
diff --git a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js
index 6b0d92f7..edc24a2c 100644
--- a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js
+++ b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js
@@ -794,7 +794,7 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
794 794
795 handleOkButtonAction : { 795 handleOkButtonAction : {
796 value: function(evt){ 796 value: function(evt){
797 console.log("$$$ File Picker : selected "+ this.selectedItems.toString()); 797 //console.log("$$$ File Picker : selected "+ this.selectedItems.toString());
798 var success = true; 798 var success = true;
799 if(!!this.pickerModel.callback && (this.selectedItems.length > 0)){//call the callback if it is available 799 if(!!this.pickerModel.callback && (this.selectedItems.length > 0)){//call the callback if it is available
800 try{ 800 try{
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index f397ace7..b1a22c1b 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -34,17 +34,17 @@ DocumentController = exports.DocumentController = Montage.create(Component, {
34 return this._activeDocument; 34 return this._activeDocument;
35 }, 35 },
36 set: function(doc) { 36 set: function(doc) {
37 if(this._activeDocument) this._activeDocument.isActive = false; 37 if(!!this._activeDocument) this._activeDocument.isActive = false;
38
39 if(this._documents.indexOf(doc) === -1) this._documents.push(doc);
40 38
41 this._activeDocument = doc; 39 this._activeDocument = doc;
42 this._activeDocument.isActive = true; 40 if(!!this._activeDocument){
43 41
44 if(!!this._activeDocument.editor){ 42 if(this._documents.indexOf(doc) === -1) this._documents.push(doc);
45 this._activeDocument.editor.focus(); 43 this._activeDocument.isActive = true;
44 if(!!this._activeDocument.editor){
45 this._activeDocument.editor.focus();
46 }
46 } 47 }
47
48 } 48 }
49 }, 49 },
50 50
@@ -184,7 +184,7 @@ DocumentController = exports.DocumentController = Montage.create(Component, {
184 switch (doc.extension) { 184 switch (doc.extension) {
185 case 'html': case 'html': 185 case 'html': case 'html':
186 //Open in designer view 186 //Open in designer view
187 Montage.create(HTMLDocument).initialize(doc, Uuid.generate(), this._createIframeElement(), this._onOpenDocument); 187 Montage.create(HTMLDocument).initialize(doc, Uuid.generate(), this._createIframeElement(), this._onOpenDocument.bind(this));
188 break; 188 break;
189 default: 189 default:
190 //Open in code view 190 //Open in code view
@@ -250,7 +250,6 @@ DocumentController = exports.DocumentController = Montage.create(Component, {
250 } 250 }
251 251
252 var doc = this._findDocumentByUUID(id); 252 var doc = this._findDocumentByUUID(id);
253 this._removeDocumentView(doc.container);
254 253
255 var closeDocumentIndex = this._findIndexByUUID(id); 254 var closeDocumentIndex = this._findIndexByUUID(id);
256 this._documents.splice(this._findIndexByUUID(id), 1); 255 this._documents.splice(this._findIndexByUUID(id), 1);
@@ -263,8 +262,11 @@ DocumentController = exports.DocumentController = Montage.create(Component, {
263 nextDocumentIndex = closeDocumentIndex - 1; 262 nextDocumentIndex = closeDocumentIndex - 1;
264 } 263 }
265 this.application.ninja.stage.stageView.switchDocument(this._documents[nextDocumentIndex]); 264 this.application.ninja.stage.stageView.switchDocument(this._documents[nextDocumentIndex]);
265 this._removeDocumentView(doc.container);
266 }else if(this._documents.length === 0){ 266 }else if(this._documents.length === 0){
267 //if there are no documents to switch to then just show the iframeContainer 267 this.activeDocument = null;
268 this._removeDocumentView(doc.container);
269 this.application.ninja.stage.stageView.hideRulers();
268 document.getElementById("iframeContainer").style.display="block"; 270 document.getElementById("iframeContainer").style.display="block";
269 } 271 }
270 } 272 }
@@ -275,11 +277,15 @@ DocumentController = exports.DocumentController = Montage.create(Component, {
275 _onOpenDocument: { 277 _onOpenDocument: {
276 value: function(doc){ 278 value: function(doc){
277 //var data = DocumentManager.activeDocument; 279 //var data = DocumentManager.activeDocument;
278 //DocumentManager._hideCurrentDocument();
279 280
280 //stageManagerModule.stageManager.toggleCanvas(); 281 this._hideCurrentDocument();
282 this.application.ninja.stage.stageView.hideOtherDocuments(doc.uuid);
283
284 this.application.ninja.stage.hideCanvas(false);
285
286 this.activeDocument = doc;
281 287
282 DocumentController.activeDocument = doc; 288 this._showCurrentDocument();
283 289
284 NJevent("onOpenDocument", doc); 290 NJevent("onOpenDocument", doc);
285// appDelegateModule.MyAppDelegate.onSetActiveDocument(); 291// appDelegateModule.MyAppDelegate.onSetActiveDocument();
diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html
index 9a1a6b97..2d00d8dc 100755
--- a/js/ninja.reel/ninja.html
+++ b/js/ninja.reel/ninja.html
@@ -348,10 +348,10 @@
348 <div id="openDocumentsTabComponent"></div> 348 <div id="openDocumentsTabComponent"></div>
349 </section> 349 </section>
350 350
351 <section id="rulerTop"></section> 351 <section id="rulerTop" style="display:none;"></section>
352 352
353 <section id="mainContent"> 353 <section id="mainContent">
354 <section id="rulerLeft"></section> 354 <section id="rulerLeft" style="display:none;"></section>
355 <section id="stageAndScenesContainer"></section> 355 <section id="stageAndScenesContainer"></section>
356 </section> 356 </section>
357 357
diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js
index 31ace49c..2144af84 100755
--- a/js/stage/stage-view.reel/stage-view.js
+++ b/js/stage/stage-view.reel/stage-view.js
@@ -187,7 +187,6 @@ exports.StageView = Montage.create(Component, {
187 }, 187 },
188 hideOtherDocuments:{ 188 hideOtherDocuments:{
189 value:function(docUuid){ 189 value:function(docUuid){
190 //use CodeMirror toTextArea() to remove editor and save content into textarea
191 this.application.ninja.documentController._documents.forEach(function(aDoc){ 190 this.application.ninja.documentController._documents.forEach(function(aDoc){
192 if(aDoc.currentView === "design"){ 191 if(aDoc.currentView === "design"){
193 aDoc.container.parentNode.style["display"] = "none"; 192 aDoc.container.parentNode.style["display"] = "none";