From 3b862fe489a3320882f91ab56781fc5dc400c3d1 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Fri, 17 Feb 2012 11:26:02 -0800 Subject: changed the document dirtying logic to be done in the feature that edits the document. Signed-off-by: Ananya Sen --- js/mediators/element-mediator.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'js/mediators/element-mediator.js') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 95aec2a3..e1eadda9 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -101,7 +101,10 @@ exports.ElementMediator = Montage.create(NJComponent, { { el.elementModel.controller["set3DProperties"](el, [p3d], 0, true); } - if(!noEvent) NJevent("elementAdded", el); + if(!noEvent) { + this.application.ninja.documentController.activeDocument.dirtyFlag = true; + NJevent("elementAdded", el); + } } }, @@ -127,6 +130,7 @@ exports.ElementMediator = Montage.create(NJComponent, { _removeElement: { value: function(el, rules) { ElementController.removeElement(el, rules); + this.application.ninja.documentController.activeDocument.dirtyFlag = true; NJevent("elementDeleted", el); } }, -- cgit v1.2.3 From 2ef2ad33ff3f6ee1afd1e2a5c3189278f8fd46f4 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Fri, 17 Feb 2012 11:35:49 -0800 Subject: mark document on setting color, properties and stroke. Signed-off-by: Ananya Sen --- js/mediators/element-mediator.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'js/mediators/element-mediator.js') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index e1eadda9..ad01fe2d 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -189,6 +189,8 @@ exports.ElementMediator = Montage.create(NJComponent, { NJUtils.makeElementModel(el, "Canvas", "block", true); } + this.application.ninja.documentController.activeDocument.dirtyFlag = true; + return el.elementModel.controller["setShapeProperty"](el, prop, value); } }, @@ -256,6 +258,8 @@ exports.ElementMediator = Montage.create(NJComponent, { item.elementModel.controller["setAttribute"](item, att, value); + this.application.ninja.documentController.activeDocument.dirtyFlag = true; + NJevent("attribute" + eventType, {type : "setAttribute", source: source, data: {"els": el, "prop": att, "value": value}, redraw: null}); } }, @@ -328,6 +332,8 @@ exports.ElementMediator = Montage.create(NJComponent, { el.elementModel.controller["setProperty"](el, p, value[i]); } + this.application.ninja.documentController.activeDocument.dirtyFlag = true; + NJevent("element" + eventType, {type : "setProperty", source: source, data: {"els": els, "prop": p, "value": value}, redraw: null}); } }, @@ -387,6 +393,8 @@ exports.ElementMediator = Montage.create(NJComponent, { el.elementModel.controller["setProperties"](el, props, i); } + this.application.ninja.documentController.activeDocument.dirtyFlag = true; + NJevent("element" + eventType, {type : "setProperties", source: source, data: {"els": els, "prop": props, "value": props}, redraw: null}); } }, @@ -459,6 +467,8 @@ exports.ElementMediator = Montage.create(NJComponent, { el.elementModel.controller["set3DProperties"](el, props, i, update3DModel); } + this.application.ninja.documentController.activeDocument.dirtyFlag = true; + NJevent("element" + eventType, {type : "set3DProperties", source: source, data: {"els": els, "prop": "matrix", "value": props}, redraw: null}); } }, @@ -543,6 +553,8 @@ exports.ElementMediator = Montage.create(NJComponent, { el.elementModel.controller["setColor"](el, value, isFill); } + this.application.ninja.documentController.activeDocument.dirtyFlag = true; + NJevent("element" + eventType, {type : "setColor", source: source, data: {"els": els, "prop": "color", "value": value, "isFill": isFill}, redraw: null}); } }, @@ -624,6 +636,8 @@ exports.ElementMediator = Montage.create(NJComponent, { el.elementModel.controller["setStroke"](el, value); } + this.application.ninja.documentController.activeDocument.dirtyFlag = true; + NJevent("element" + eventType, {type : "setStroke", source: source, data: {"els": els, "prop": "stroke", "value": value}, redraw: null}); } }, @@ -698,6 +712,8 @@ exports.ElementMediator = Montage.create(NJComponent, { } else { + this.application.ninja.documentController.activeDocument.dirtyFlag = true; + NJevent("elementChange", {type : "setMatrix", source: null, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null}); } } -- cgit v1.2.3 From a7e3ef9f80d5e29515c9f8dd5374c89b9d2496de Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Fri, 17 Feb 2012 12:39:12 -0800 Subject: use method to update dirtyFlag Signed-off-by: Ananya Sen --- js/mediators/element-mediator.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'js/mediators/element-mediator.js') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index ad01fe2d..559cb44c 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -102,7 +102,7 @@ exports.ElementMediator = Montage.create(NJComponent, { el.elementModel.controller["set3DProperties"](el, [p3d], 0, true); } if(!noEvent) { - this.application.ninja.documentController.activeDocument.dirtyFlag = true; + this.application.ninja.documentController.activeDocument.markDocumentEditted(); NJevent("elementAdded", el); } } @@ -130,7 +130,7 @@ exports.ElementMediator = Montage.create(NJComponent, { _removeElement: { value: function(el, rules) { ElementController.removeElement(el, rules); - this.application.ninja.documentController.activeDocument.dirtyFlag = true; + this.application.ninja.documentController.activeDocument.markDocumentEditted(); NJevent("elementDeleted", el); } }, @@ -189,7 +189,7 @@ exports.ElementMediator = Montage.create(NJComponent, { NJUtils.makeElementModel(el, "Canvas", "block", true); } - this.application.ninja.documentController.activeDocument.dirtyFlag = true; + this.application.ninja.documentController.activeDocument.markDocumentEditted(); return el.elementModel.controller["setShapeProperty"](el, prop, value); } @@ -258,7 +258,7 @@ exports.ElementMediator = Montage.create(NJComponent, { item.elementModel.controller["setAttribute"](item, att, value); - this.application.ninja.documentController.activeDocument.dirtyFlag = true; + this.application.ninja.documentController.activeDocument.markDocumentEditted(); NJevent("attribute" + eventType, {type : "setAttribute", source: source, data: {"els": el, "prop": att, "value": value}, redraw: null}); } @@ -332,7 +332,7 @@ exports.ElementMediator = Montage.create(NJComponent, { el.elementModel.controller["setProperty"](el, p, value[i]); } - this.application.ninja.documentController.activeDocument.dirtyFlag = true; + this.application.ninja.documentController.activeDocument.markDocumentEditted(); NJevent("element" + eventType, {type : "setProperty", source: source, data: {"els": els, "prop": p, "value": value}, redraw: null}); } @@ -393,7 +393,7 @@ exports.ElementMediator = Montage.create(NJComponent, { el.elementModel.controller["setProperties"](el, props, i); } - this.application.ninja.documentController.activeDocument.dirtyFlag = true; + this.application.ninja.documentController.activeDocument.markDocumentEditted(); NJevent("element" + eventType, {type : "setProperties", source: source, data: {"els": els, "prop": props, "value": props}, redraw: null}); } @@ -467,7 +467,7 @@ exports.ElementMediator = Montage.create(NJComponent, { el.elementModel.controller["set3DProperties"](el, props, i, update3DModel); } - this.application.ninja.documentController.activeDocument.dirtyFlag = true; + this.application.ninja.documentController.activeDocument.markDocumentEditted(); NJevent("element" + eventType, {type : "set3DProperties", source: source, data: {"els": els, "prop": "matrix", "value": props}, redraw: null}); } @@ -553,7 +553,7 @@ exports.ElementMediator = Montage.create(NJComponent, { el.elementModel.controller["setColor"](el, value, isFill); } - this.application.ninja.documentController.activeDocument.dirtyFlag = true; + this.application.ninja.documentController.activeDocument.markDocumentEditted(); NJevent("element" + eventType, {type : "setColor", source: source, data: {"els": els, "prop": "color", "value": value, "isFill": isFill}, redraw: null}); } @@ -636,7 +636,7 @@ exports.ElementMediator = Montage.create(NJComponent, { el.elementModel.controller["setStroke"](el, value); } - this.application.ninja.documentController.activeDocument.dirtyFlag = true; + this.application.ninja.documentController.activeDocument.markDocumentEditted(); NJevent("element" + eventType, {type : "setStroke", source: source, data: {"els": els, "prop": "stroke", "value": value}, redraw: null}); } @@ -712,7 +712,7 @@ exports.ElementMediator = Montage.create(NJComponent, { } else { - this.application.ninja.documentController.activeDocument.dirtyFlag = true; + this.application.ninja.documentController.activeDocument.markDocumentEditted(); NJevent("elementChange", {type : "setMatrix", source: null, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null}); } -- cgit v1.2.3 From 96178309ddcdb54c0c451b69ea6fb8cdf76fcf62 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Fri, 17 Feb 2012 12:54:07 -0800 Subject: renamed methods to use better words Signed-off-by: Ananya Sen --- js/mediators/element-mediator.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'js/mediators/element-mediator.js') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 559cb44c..7dad7aca 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -102,7 +102,7 @@ exports.ElementMediator = Montage.create(NJComponent, { el.elementModel.controller["set3DProperties"](el, [p3d], 0, true); } if(!noEvent) { - this.application.ninja.documentController.activeDocument.markDocumentEditted(); + this.application.ninja.documentController.activeDocument.markEdited(); NJevent("elementAdded", el); } } @@ -130,7 +130,7 @@ exports.ElementMediator = Montage.create(NJComponent, { _removeElement: { value: function(el, rules) { ElementController.removeElement(el, rules); - this.application.ninja.documentController.activeDocument.markDocumentEditted(); + this.application.ninja.documentController.activeDocument.markEdited(); NJevent("elementDeleted", el); } }, @@ -189,7 +189,7 @@ exports.ElementMediator = Montage.create(NJComponent, { NJUtils.makeElementModel(el, "Canvas", "block", true); } - this.application.ninja.documentController.activeDocument.markDocumentEditted(); + this.application.ninja.documentController.activeDocument.markEdited(); return el.elementModel.controller["setShapeProperty"](el, prop, value); } @@ -258,7 +258,7 @@ exports.ElementMediator = Montage.create(NJComponent, { item.elementModel.controller["setAttribute"](item, att, value); - this.application.ninja.documentController.activeDocument.markDocumentEditted(); + this.application.ninja.documentController.activeDocument.markEdited(); NJevent("attribute" + eventType, {type : "setAttribute", source: source, data: {"els": el, "prop": att, "value": value}, redraw: null}); } @@ -332,7 +332,7 @@ exports.ElementMediator = Montage.create(NJComponent, { el.elementModel.controller["setProperty"](el, p, value[i]); } - this.application.ninja.documentController.activeDocument.markDocumentEditted(); + this.application.ninja.documentController.activeDocument.markEdited(); NJevent("element" + eventType, {type : "setProperty", source: source, data: {"els": els, "prop": p, "value": value}, redraw: null}); } @@ -393,7 +393,7 @@ exports.ElementMediator = Montage.create(NJComponent, { el.elementModel.controller["setProperties"](el, props, i); } - this.application.ninja.documentController.activeDocument.markDocumentEditted(); + this.application.ninja.documentController.activeDocument.markEdited(); NJevent("element" + eventType, {type : "setProperties", source: source, data: {"els": els, "prop": props, "value": props}, redraw: null}); } @@ -467,7 +467,7 @@ exports.ElementMediator = Montage.create(NJComponent, { el.elementModel.controller["set3DProperties"](el, props, i, update3DModel); } - this.application.ninja.documentController.activeDocument.markDocumentEditted(); + this.application.ninja.documentController.activeDocument.markEdited(); NJevent("element" + eventType, {type : "set3DProperties", source: source, data: {"els": els, "prop": "matrix", "value": props}, redraw: null}); } @@ -553,7 +553,7 @@ exports.ElementMediator = Montage.create(NJComponent, { el.elementModel.controller["setColor"](el, value, isFill); } - this.application.ninja.documentController.activeDocument.markDocumentEditted(); + this.application.ninja.documentController.activeDocument.markEdited(); NJevent("element" + eventType, {type : "setColor", source: source, data: {"els": els, "prop": "color", "value": value, "isFill": isFill}, redraw: null}); } @@ -636,7 +636,7 @@ exports.ElementMediator = Montage.create(NJComponent, { el.elementModel.controller["setStroke"](el, value); } - this.application.ninja.documentController.activeDocument.markDocumentEditted(); + this.application.ninja.documentController.activeDocument.markEdited(); NJevent("element" + eventType, {type : "setStroke", source: source, data: {"els": els, "prop": "stroke", "value": value}, redraw: null}); } @@ -712,7 +712,7 @@ exports.ElementMediator = Montage.create(NJComponent, { } else { - this.application.ninja.documentController.activeDocument.markDocumentEditted(); + this.application.ninja.documentController.activeDocument.markEdited(); NJevent("elementChange", {type : "setMatrix", source: null, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null}); } -- cgit v1.2.3 From c2a5918480adae0124e1dc2531c019562f1e3e60 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Sat, 18 Feb 2012 18:42:43 -0800 Subject: doc.markEdited() removed from element-mediator, for style changes, as per teams suggestion Signed-off-by: Ananya Sen --- js/mediators/element-mediator.js | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'js/mediators/element-mediator.js') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 7dad7aca..6088aeab 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -189,8 +189,6 @@ exports.ElementMediator = Montage.create(NJComponent, { NJUtils.makeElementModel(el, "Canvas", "block", true); } - this.application.ninja.documentController.activeDocument.markEdited(); - return el.elementModel.controller["setShapeProperty"](el, prop, value); } }, @@ -258,8 +256,6 @@ exports.ElementMediator = Montage.create(NJComponent, { item.elementModel.controller["setAttribute"](item, att, value); - this.application.ninja.documentController.activeDocument.markEdited(); - NJevent("attribute" + eventType, {type : "setAttribute", source: source, data: {"els": el, "prop": att, "value": value}, redraw: null}); } }, @@ -332,8 +328,6 @@ exports.ElementMediator = Montage.create(NJComponent, { el.elementModel.controller["setProperty"](el, p, value[i]); } - this.application.ninja.documentController.activeDocument.markEdited(); - NJevent("element" + eventType, {type : "setProperty", source: source, data: {"els": els, "prop": p, "value": value}, redraw: null}); } }, @@ -393,8 +387,6 @@ exports.ElementMediator = Montage.create(NJComponent, { el.elementModel.controller["setProperties"](el, props, i); } - this.application.ninja.documentController.activeDocument.markEdited(); - NJevent("element" + eventType, {type : "setProperties", source: source, data: {"els": els, "prop": props, "value": props}, redraw: null}); } }, @@ -467,8 +459,6 @@ exports.ElementMediator = Montage.create(NJComponent, { el.elementModel.controller["set3DProperties"](el, props, i, update3DModel); } - this.application.ninja.documentController.activeDocument.markEdited(); - NJevent("element" + eventType, {type : "set3DProperties", source: source, data: {"els": els, "prop": "matrix", "value": props}, redraw: null}); } }, @@ -553,8 +543,6 @@ exports.ElementMediator = Montage.create(NJComponent, { el.elementModel.controller["setColor"](el, value, isFill); } - this.application.ninja.documentController.activeDocument.markEdited(); - NJevent("element" + eventType, {type : "setColor", source: source, data: {"els": els, "prop": "color", "value": value, "isFill": isFill}, redraw: null}); } }, @@ -636,8 +624,6 @@ exports.ElementMediator = Montage.create(NJComponent, { el.elementModel.controller["setStroke"](el, value); } - this.application.ninja.documentController.activeDocument.markEdited(); - NJevent("element" + eventType, {type : "setStroke", source: source, data: {"els": els, "prop": "stroke", "value": value}, redraw: null}); } }, @@ -712,8 +698,6 @@ exports.ElementMediator = Montage.create(NJComponent, { } else { - this.application.ninja.documentController.activeDocument.markEdited(); - NJevent("elementChange", {type : "setMatrix", source: null, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null}); } } -- cgit v1.2.3 From 1b1a51370feffc1abbd1ad558cbf4d5d8163ef6f Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Mon, 20 Feb 2012 22:23:28 -0800 Subject: cleanup Signed-off-by: Valerio Virgillito --- js/mediators/element-mediator.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'js/mediators/element-mediator.js') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 95aec2a3..8481f557 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -28,13 +28,7 @@ exports.ElementMediator = Montage.create(NJComponent, { // TODO use the specific controller to be able to subclass the functionality handleElementAdding: { value: function(event) { - /* - var cmd = ElementControllerCommands.addElementCommand(event.detail.el, event.detail.data); - NJevent("sendToUndo", cmd); - cmd.execute(); - */ this.addElement(event.detail.el, event.detail.data); - } }, @@ -97,8 +91,7 @@ exports.ElementMediator = Montage.create(NJComponent, { value: function(el, rules, noEvent) { ElementController.addElement(el, rules); var p3d = this.get3DProperties(el); - if(p3d) - { + if(p3d) { el.elementModel.controller["set3DProperties"](el, [p3d], 0, true); } if(!noEvent) NJevent("elementAdded", el); -- cgit v1.2.3 From b1daf0b285a4a96bfd0086709c20e3682d75551a Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 21 Feb 2012 14:32:17 -0800 Subject: fixing the dirty flag and removing sass changes Signed-off-by: Valerio Virgillito --- js/mediators/element-mediator.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/mediators/element-mediator.js') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 6088aeab..95a72c89 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -102,7 +102,7 @@ exports.ElementMediator = Montage.create(NJComponent, { el.elementModel.controller["set3DProperties"](el, [p3d], 0, true); } if(!noEvent) { - this.application.ninja.documentController.activeDocument.markEdited(); + this.application.ninja.documentController.activeDocument.needsSave = true; NJevent("elementAdded", el); } } @@ -130,7 +130,7 @@ exports.ElementMediator = Montage.create(NJComponent, { _removeElement: { value: function(el, rules) { ElementController.removeElement(el, rules); - this.application.ninja.documentController.activeDocument.markEdited(); + this.application.ninja.documentController.activeDocument.needsSave = true; NJevent("elementDeleted", el); } }, -- cgit v1.2.3