diff options
author | Valerio Virgillito | 2012-05-17 21:11:33 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-05-17 21:11:33 -0700 |
commit | eff40602cac6821f8272177c24b6bf3de399f8b1 (patch) | |
tree | f89541dce6fdbe38db9f701b6ba6353034f4eeec | |
parent | bac01dd8771d91dc227c970b3d29e72d8f079692 (diff) | |
download | ninja-eff40602cac6821f8272177c24b6bf3de399f8b1.tar.gz |
multiple documents - enable opening multiple documents and initial switching
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
-rwxr-xr-x | js/controllers/document-controller.js | 71 | ||||
-rwxr-xr-x | js/document/document-html.js | 2 |
2 files changed, 35 insertions, 38 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index cf46e73e..50874725 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -454,58 +454,57 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
454 | // Open document callback | 454 | // Open document callback |
455 | _onOpenDocument: { | 455 | _onOpenDocument: { |
456 | value: function(doc){ | 456 | value: function(doc){ |
457 | 457 | var currentDocument; | |
458 | if(this.activeDocument) { | 458 | if(this.activeDocument) { |
459 | // There is a document currently opened | 459 | // There is a document currently opened |
460 | 460 | currentDocument = this.activeDocument; | |
461 | |||
462 | 461 | ||
463 | //this.application.ninja.stage.stageView.showCodeViewBar(false); | 462 | //this.application.ninja.stage.stageView.showCodeViewBar(false); |
464 | //this.application.ninja.stage.stageView.restoreAllPanels(); | 463 | //this.application.ninja.stage.stageView.restoreAllPanels(); |
465 | 464 | ||
466 | // | 465 | //this.activeDocument.saveAppState(); |
467 | /* | ||
468 | if(this.activeDocument.currentView === "design"){ | ||
469 | this.activeDocument.saveAppState(); | ||
470 | this.activeDocument.container.parentNode.style["display"] = "none"; | ||
471 | this.application.ninja.stage.hideCanvas(true); | ||
472 | this.application.ninja.stage.stageView.hideRulers(); | ||
473 | } | ||
474 | 466 | ||
475 | this.activeDocument.container.style["display"] = "none"; | 467 | // TODO: Do we need this? |
476 | */ | 468 | //this.application.ninja.stage.hideCanvas(true); |
477 | 469 | //this.application.ninja.stage.stageView.hideRulers(); | |
478 | /* | 470 | |
479 | this.activeDocument.container.style["display"] = "block"; | 471 | //this.activeDocument.restoreAppState(); |
480 | if(this.activeDocument.currentView === "design"){ | ||
481 | this.activeDocument.container.parentNode.style["display"] = "block"; | ||
482 | this.activeDocument.restoreAppState(); | ||
483 | }else{ | ||
484 | //hide the iframe when switching to code view | ||
485 | document.getElementById("iframeContainer").style.display = "none"; | ||
486 | } | ||
487 | |||
488 | */ | ||
489 | // hide current document | ||
490 | } else { | 472 | } else { |
491 | // There is no document opened | 473 | // There is no document opened |
492 | 474 | ||
493 | // Set the active document | 475 | // Show the rulers |
494 | this.activeDocument = doc; | 476 | // TODO: Move this indo design view |
477 | this.application.ninja.stage.stageView.showRulers(); | ||
495 | 478 | ||
496 | // Show the canvas | 479 | // Show the canvas |
497 | this.application.ninja.stage.hideCanvas(false); | 480 | this.application.ninja.stage.hideCanvas(false); |
481 | } | ||
498 | 482 | ||
499 | // Show the rulers | ||
500 | // TODO: Move this indo design view | ||
501 | this.application.ninja.stage.stageView.showRulers(); | ||
502 | 483 | ||
503 | // Initialize the documentRoot styles | 484 | // Set the active document |
504 | this.initializeRootStyles(doc.documentRoot); | 485 | this.activeDocument = doc; |
505 | // Flag to stop stylesheet dirty event | 486 | |
506 | this._hackInitialStyles = false; | 487 | // Initialize the documentRoot styles |
488 | this.initializeRootStyles(doc.documentRoot); | ||
489 | // Flag to stop stylesheet dirty event | ||
490 | this._hackInitialStyles = false; | ||
491 | |||
492 | this.switchDocuments(currentDocument, doc); | ||
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 | } | ||
500 | }, | ||
501 | |||
502 | switchDocuments: { | ||
503 | value: function(current, newDocument) { | ||
504 | newDocument.model.views.design.iframe.style.opacity = 1; | ||
507 | 505 | ||
508 | NJevent("onOpenDocument", doc); | 506 | if(current) { |
507 | current.model.views.design.hide(); | ||
509 | } | 508 | } |
510 | } | 509 | } |
511 | }, | 510 | }, |
diff --git a/js/document/document-html.js b/js/document/document-html.js index 56d9db02..c77ed7bc 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js | |||
@@ -119,8 +119,6 @@ exports.HtmlDocument = Montage.create(Component, { | |||
119 | this._observer = null; | 119 | this._observer = null; |
120 | //Making callback after view is loaded | 120 | //Making callback after view is loaded |
121 | this.loaded.callback.call(this.loaded.context, this); | 121 | this.loaded.callback.call(this.loaded.context, this); |
122 | //Setting opacity to be viewable after load | ||
123 | this.model.views.design.iframe.style.opacity = 1; | ||
124 | } | 122 | } |
125 | }, | 123 | }, |
126 | //////////////////////////////////////////////////////////////////// | 124 | //////////////////////////////////////////////////////////////////// |