From ee54342b5f4fdd41c46543d6402e649e4b3d57cb Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 22 May 2012 17:58:23 -0700 Subject: - don't redraw stage for code document - fixes a switching bug - fix for ctrl+S for code document - disallow opening the panels while in code document Signed-off-by: Ananya Sen --- js/controllers/document-controller.js | 5 +++++ js/helper-classes/3D/view-utils.js | 4 ++-- js/mediators/keyboard-mediator.js | 2 +- js/panels/Splitter.js | 7 +++++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index d99fadbb..91f4753d 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -524,6 +524,11 @@ var DocumentController = exports.DocumentController = Montage.create(Component, this.application.ninja.stage.hideCanvas(true); this.application.ninja.stage.hideRulers(); } + }else if(!currentDocument && newDocument.currentView === "code"){ + this.application.ninja.stage.showCodeViewBar(true); + this.application.ninja.stage.collapseAllPanels(); + this.application.ninja.stage.hideCanvas(true); + this.application.ninja.stage.hideRulers(); } this.application.ninja.stage.clearAllCanvas(); diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index 0080bf90..0a4fe0ac 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js @@ -1005,9 +1005,9 @@ exports.ViewUtils = Montage.create(Component, { this.popViewportObj(); if (elt === this.application.ninja.currentDocument.documentRoot) break; - if (elt === this.application.ninja.currentDocument.documentRoot.parentNode) break; + if (this.application.ninja.currentDocument.documentRoot && elt === this.application.ninja.currentDocument.documentRoot.parentNode) break; elt = elt.offsetParent; - if (elt === this.application.ninja.currentDocument.documentRoot.parentNode) break; + if (this.application.ninja.currentDocument.documentRoot && elt === this.application.ninja.currentDocument.documentRoot.parentNode) break; } return mat; diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js index 23a2ce75..2f55edb4 100755 --- a/js/mediators/keyboard-mediator.js +++ b/js/mediators/keyboard-mediator.js @@ -88,7 +88,7 @@ exports.KeyboardMediator = Montage.create(Component, { //keyboard controls for html design view // TODO - New template mode doesn't set currentView yet. - if((!!this.application.ninja.currentDocument)){// && (this.application.ninja.currentDocument.model.currentView === "design")){ + if((!!this.application.ninja.currentDocument) && (this.application.ninja.currentDocument.model.currentView === "design")){ // Don't do anything if an input or other control is focused if(document.activeElement.nodeName !== "BODY") { diff --git a/js/panels/Splitter.js b/js/panels/Splitter.js index 0640abb2..8675d314 100755 --- a/js/panels/Splitter.js +++ b/js/panels/Splitter.js @@ -111,8 +111,9 @@ exports.Splitter = Montage.create(Component, { } else { this.panel.removeEventListener("webkitTransitionEnd", this, false); } - - this.application.ninja.stage.resizeCanvases = true; + if(this.application.ninja.currentDocument.currentView === "design"){ + this.application.ninja.stage.resizeCanvases = true; + } } }, @@ -149,6 +150,7 @@ exports.Splitter = Montage.create(Component, { this.panel.addEventListener("webkitTransitionEnd", this, false); } this._collapsed = true; + this.disabled = true; this.needsDraw = true; } } @@ -169,6 +171,7 @@ exports.Splitter = Montage.create(Component, { } else { this.panel.addEventListener("webkitTransitionEnd", this, false); } + this.disabled = false; this.needsDraw = true; } } -- cgit v1.2.3 From 108764dbdaa0c040de9146c2d722b6e53830cd54 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 23 May 2012 13:27:14 -0700 Subject: improve the closing of documents. Signed-off-by: Valerio Virgillito --- js/controllers/document-controller.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 7758f346..dadfaf05 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -393,14 +393,20 @@ var DocumentController = exports.DocumentController = Montage.create(Component, onCloseFile: { value: function(doc) { + var previousFocusedDocument; - this._documents.splice(this._documents.indexOf(doc), 1); + this._documents.splice(this._documents.indexOf(doc), 1); - this._activeDocument = null; - - this.application.ninja.stage.hideRulers(); + if(this._documents.length > 0) { + previousFocusedDocument = this._documents[this._documents.length - 1]; + this._activeDocument = previousFocusedDocument; + this.switchDocuments(this.activeDocument, previousFocusedDocument, true); + } else { + this._activeDocument = null; + this.application.ninja.stage.hideRulers(); - this.application.ninja.stage.hideCanvas(true); + this.application.ninja.stage.hideCanvas(true); + } //TODO: Use references for those instead of calling getElementById if(this._documents.length === 0){ -- cgit v1.2.3 From 26d4cbf0f5c65f60051273f1648a0e8005d8c78a Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 23 May 2012 13:40:56 -0700 Subject: - removed redundant change - fixed js error on click of splitters when no documents are open Signed-off-by: Ananya Sen --- js/helper-classes/3D/view-utils.js | 4 ++-- js/panels/Splitter.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index 0a4fe0ac..0080bf90 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js @@ -1005,9 +1005,9 @@ exports.ViewUtils = Montage.create(Component, { this.popViewportObj(); if (elt === this.application.ninja.currentDocument.documentRoot) break; - if (this.application.ninja.currentDocument.documentRoot && elt === this.application.ninja.currentDocument.documentRoot.parentNode) break; + if (elt === this.application.ninja.currentDocument.documentRoot.parentNode) break; elt = elt.offsetParent; - if (this.application.ninja.currentDocument.documentRoot && elt === this.application.ninja.currentDocument.documentRoot.parentNode) break; + if (elt === this.application.ninja.currentDocument.documentRoot.parentNode) break; } return mat; diff --git a/js/panels/Splitter.js b/js/panels/Splitter.js index 8675d314..f0fb1a45 100755 --- a/js/panels/Splitter.js +++ b/js/panels/Splitter.js @@ -111,7 +111,7 @@ exports.Splitter = Montage.create(Component, { } else { this.panel.removeEventListener("webkitTransitionEnd", this, false); } - if(this.application.ninja.currentDocument.currentView === "design"){ + if(this.application.ninja.currentDocument && this.application.ninja.currentDocument.currentView === "design"){ this.application.ninja.stage.resizeCanvases = true; } } -- cgit v1.2.3 From d5b36812ba84e49aa8b597eea9f75bf36ddcb571 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 23 May 2012 15:24:25 -0700 Subject: fixing the styles manager to open code view files and closing the last document. Signed-off-by: Valerio Virgillito --- js/controllers/document-controller.js | 15 ++++++--------- js/controllers/styles-controller.js | 2 +- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 3e15511d..aa037bd4 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -399,10 +399,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component, if(this._documents.length > 0) { previousFocusedDocument = this._documents[this._documents.length - 1]; - this._activeDocument = previousFocusedDocument; - this.switchDocuments(this.activeDocument, previousFocusedDocument, true); + this.activeDocument = previousFocusedDocument; + this.switchDocuments(this.activeDocument, previousFocusedDocument, false); } else { - this._activeDocument = null; + this.activeDocument = null; this.application.ninja.stage.hideRulers(); this.application.ninja.stage.hideCanvas(true); @@ -524,13 +524,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component, this.application.ninja.stage.restoreAllPanels(); this.application.ninja.stage.hideCanvas(false); this.application.ninja.stage.showRulers(); - } else if(currentDocument.currentView === "design" && newDocument.currentView === "code") { - this.application.ninja.stage.showCodeViewBar(true); - this.application.ninja.stage.collapseAllPanels(); - this.application.ninja.stage.hideCanvas(true); - this.application.ninja.stage.hideRulers(); } - }else if(!currentDocument && newDocument.currentView === "code"){ + } + + if(newDocument.currentView === "code") { this.application.ninja.stage.showCodeViewBar(true); this.application.ninja.stage.collapseAllPanels(); this.application.ninja.stage.hideCanvas(true); diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index dcbe0eaf..8ceb9774 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js @@ -81,7 +81,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { set : function(document) { ///// If the document is null set default stylesheets to null - if(!document) { + if(!document || document.currentView === "code") { this._activeDocument = null; this._stageStylesheet = null; this.defaultStylesheet = null; -- cgit v1.2.3 From 0ca1910df1c78116139664bf39a95cf0ec7c8dc8 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 23 May 2012 15:35:15 -0700 Subject: adding document views checks for the timeline and breadcrumb Signed-off-by: Valerio Virgillito --- js/components/layout/bread-crumb.reel/bread-crumb.js | 2 +- js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js index d2a6b1e4..aaefd923 100755 --- a/js/components/layout/bread-crumb.reel/bread-crumb.js +++ b/js/components/layout/bread-crumb.reel/bread-crumb.js @@ -21,7 +21,7 @@ exports.Breadcrumb = Montage.create(Component, { handleCloseDocument: { value: function(){ - if(!this.application.ninja.documentController.activeDocument) { + if(!this.application.ninja.documentController.activeDocument && this.application.ninja.currentDocument.currentView !== "code") { this.disabled = true; this.application.ninja.currentSelectedContainer = (this.application.ninja.currentDocument ? this.application.ninja.currentDocument.documentRoot : null); } diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 80133edf..2c02e544 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -596,7 +596,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { // That's all we need to do for a brand new file. // But what if we're opening an existing document? - if (!this.application.ninja.documentController.creatingNewFile) { + if (!this.application.ninja.documentController.creatingNewFile && this.application.ninja.currentDocument.currentView !== "code") { // Opening an existing document. If it has DOM elements we need to restore their timeline info if (this.application.ninja.currentDocument.documentRoot.children[0]) { // Yes, it has DOM elements. Loop through them and create a new object for each. -- cgit v1.2.3