aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
authorValerio Virgillito2012-05-18 00:21:56 -0700
committerValerio Virgillito2012-05-18 00:21:56 -0700
commit7a94696e19b14e15261df516e2ba75e693b1313d (patch)
treeccb3cdff79be3ae5221779787bfbdcc5ca3d8e77 /js/controllers
parentf227015e14b505dbd3fc4b030ca17cb6c50c5d88 (diff)
downloadninja-7a94696e19b14e15261df516e2ba75e693b1313d.tar.gz
enabling basic document switching
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/controllers')
-rwxr-xr-xjs/controllers/document-controller.js37
-rwxr-xr-xjs/controllers/selection-controller.js4
2 files changed, 18 insertions, 23 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 50874725..fc1f2c0f 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -459,16 +459,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
459 // There is a document currently opened 459 // There is a document currently opened
460 currentDocument = this.activeDocument; 460 currentDocument = this.activeDocument;
461 461
462 //this.application.ninja.stage.stageView.showCodeViewBar(false);
463 //this.application.ninja.stage.stageView.restoreAllPanels(); 462 //this.application.ninja.stage.stageView.restoreAllPanels();
464
465 //this.activeDocument.saveAppState();
466
467 // TODO: Do we need this?
468 //this.application.ninja.stage.hideCanvas(true);
469 //this.application.ninja.stage.stageView.hideRulers();
470
471 //this.activeDocument.restoreAppState();
472 } else { 463 } else {
473 // There is no document opened 464 // There is no document opened
474 465
@@ -480,7 +471,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
480 this.application.ninja.stage.hideCanvas(false); 471 this.application.ninja.stage.hideCanvas(false);
481 } 472 }
482 473
483
484 // Set the active document 474 // Set the active document
485 this.activeDocument = doc; 475 this.activeDocument = doc;
486 476
@@ -489,22 +479,27 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
489 // Flag to stop stylesheet dirty event 479 // Flag to stop stylesheet dirty event
490 this._hackInitialStyles = false; 480 this._hackInitialStyles = false;
491 481
492 this.switchDocuments(currentDocument, doc); 482 this.switchDocuments(currentDocument, doc, true);
493
494 NJevent("onOpenDocument", doc);
495
496 //Setting opacity to be viewable after load
497 //doc.model.views.design.iframe.style.opacity = 1;
498
499 } 483 }
500 }, 484 },
501 485
502 switchDocuments: { 486 switchDocuments: {
503 value: function(current, newDocument) { 487 value: function(currentDocument, newDocument, didCreate) {
504 newDocument.model.views.design.iframe.style.opacity = 1; 488
489 if(currentDocument) {
490 currentDocument.serializeDocument();
505 491
506 if(current) { 492 currentDocument.model.views.design.hide();
507 current.model.views.design.hide(); 493 }
494
495 if(didCreate) {
496 newDocument.model.views.design.iframe.style.opacity = 1;
497 NJevent("onOpenDocument", newDocument);
498 } else {
499 this.activeDocument = newDocument;
500 newDocument.model.views.design.show();
501 newDocument.deserializeDocument();
502 NJevent("switchDocument");
508 } 503 }
509 } 504 }
510 }, 505 },
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js
index 6e40abb5..1092615a 100755
--- a/js/controllers/selection-controller.js
+++ b/js/controllers/selection-controller.js
@@ -81,10 +81,10 @@ exports.SelectionController = Montage.create(Component, {
81 81
82 handleSwitchDocument: { 82 handleSwitchDocument: {
83 value: function() { 83 value: function() {
84 if(this.application.ninja.documentController.activeDocument.currentView === "design"){ 84// if(this.application.ninja.documentController.activeDocument.currentView === "design"){
85 this._isDocument = this.application.ninja.selectedElements.length === 0; 85 this._isDocument = this.application.ninja.selectedElements.length === 0;
86 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); 86 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} );
87 } 87// }
88 } 88 }
89 }, 89 },
90 90