aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnanya Sen2012-02-17 12:39:12 -0800
committerAnanya Sen2012-02-17 12:39:12 -0800
commita7e3ef9f80d5e29515c9f8dd5374c89b9d2496de (patch)
tree2591ad36881f60b6ba1acc4c2ca11672fd4531f0
parent2ef2ad33ff3f6ee1afd1e2a5c3189278f8fd46f4 (diff)
downloadninja-a7e3ef9f80d5e29515c9f8dd5374c89b9d2496de.tar.gz
use method to update dirtyFlag
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
-rwxr-xr-xjs/document/text-document.js12
-rwxr-xr-xjs/mediators/element-mediator.js20
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.js4
3 files changed, 24 insertions, 12 deletions
diff --git a/js/document/text-document.js b/js/document/text-document.js
index 6f8efaad..f74742ad 100755
--- a/js/document/text-document.js
+++ b/js/document/text-document.js
@@ -191,5 +191,17 @@ var TextDocument = exports.TextDocument = Montage.create(Montage, {
191 value: function() { 191 value: function() {
192 // Have the XHR here? 192 // Have the XHR here?
193 } 193 }
194 },
195
196 markDocumentEditted:{
197 value: function() {
198 this.dirtyFlag = true;
199 }
200 },
201
202 markDocumentUneditted:{
203 value: function() {
204 this.dirtyFlag = false;
205 }
194 } 206 }
195}); \ No newline at end of file 207}); \ No newline at end of file
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, {
102 el.elementModel.controller["set3DProperties"](el, [p3d], 0, true); 102 el.elementModel.controller["set3DProperties"](el, [p3d], 0, true);
103 } 103 }
104 if(!noEvent) { 104 if(!noEvent) {
105 this.application.ninja.documentController.activeDocument.dirtyFlag = true; 105 this.application.ninja.documentController.activeDocument.markDocumentEditted();
106 NJevent("elementAdded", el); 106 NJevent("elementAdded", el);
107 } 107 }
108 } 108 }
@@ -130,7 +130,7 @@ exports.ElementMediator = Montage.create(NJComponent, {
130 _removeElement: { 130 _removeElement: {
131 value: function(el, rules) { 131 value: function(el, rules) {
132 ElementController.removeElement(el, rules); 132 ElementController.removeElement(el, rules);
133 this.application.ninja.documentController.activeDocument.dirtyFlag = true; 133 this.application.ninja.documentController.activeDocument.markDocumentEditted();
134 NJevent("elementDeleted", el); 134 NJevent("elementDeleted", el);
135 } 135 }
136 }, 136 },
@@ -189,7 +189,7 @@ exports.ElementMediator = Montage.create(NJComponent, {
189 NJUtils.makeElementModel(el, "Canvas", "block", true); 189 NJUtils.makeElementModel(el, "Canvas", "block", true);
190 } 190 }
191 191
192 this.application.ninja.documentController.activeDocument.dirtyFlag = true; 192 this.application.ninja.documentController.activeDocument.markDocumentEditted();
193 193
194 return el.elementModel.controller["setShapeProperty"](el, prop, value); 194 return el.elementModel.controller["setShapeProperty"](el, prop, value);
195 } 195 }
@@ -258,7 +258,7 @@ exports.ElementMediator = Montage.create(NJComponent, {
258 258
259 item.elementModel.controller["setAttribute"](item, att, value); 259 item.elementModel.controller["setAttribute"](item, att, value);
260 260
261 this.application.ninja.documentController.activeDocument.dirtyFlag = true; 261 this.application.ninja.documentController.activeDocument.markDocumentEditted();
262 262
263 NJevent("attribute" + eventType, {type : "setAttribute", source: source, data: {"els": el, "prop": att, "value": value}, redraw: null}); 263 NJevent("attribute" + eventType, {type : "setAttribute", source: source, data: {"els": el, "prop": att, "value": value}, redraw: null});
264 } 264 }
@@ -332,7 +332,7 @@ exports.ElementMediator = Montage.create(NJComponent, {
332 el.elementModel.controller["setProperty"](el, p, value[i]); 332 el.elementModel.controller["setProperty"](el, p, value[i]);
333 } 333 }
334 334
335 this.application.ninja.documentController.activeDocument.dirtyFlag = true; 335 this.application.ninja.documentController.activeDocument.markDocumentEditted();
336 336
337 NJevent("element" + eventType, {type : "setProperty", source: source, data: {"els": els, "prop": p, "value": value}, redraw: null}); 337 NJevent("element" + eventType, {type : "setProperty", source: source, data: {"els": els, "prop": p, "value": value}, redraw: null});
338 } 338 }
@@ -393,7 +393,7 @@ exports.ElementMediator = Montage.create(NJComponent, {
393 el.elementModel.controller["setProperties"](el, props, i); 393 el.elementModel.controller["setProperties"](el, props, i);
394 } 394 }
395 395
396 this.application.ninja.documentController.activeDocument.dirtyFlag = true; 396 this.application.ninja.documentController.activeDocument.markDocumentEditted();
397 397
398 NJevent("element" + eventType, {type : "setProperties", source: source, data: {"els": els, "prop": props, "value": props}, redraw: null}); 398 NJevent("element" + eventType, {type : "setProperties", source: source, data: {"els": els, "prop": props, "value": props}, redraw: null});
399 } 399 }
@@ -467,7 +467,7 @@ exports.ElementMediator = Montage.create(NJComponent, {
467 el.elementModel.controller["set3DProperties"](el, props, i, update3DModel); 467 el.elementModel.controller["set3DProperties"](el, props, i, update3DModel);
468 } 468 }
469 469
470 this.application.ninja.documentController.activeDocument.dirtyFlag = true; 470 this.application.ninja.documentController.activeDocument.markDocumentEditted();
471 471
472 NJevent("element" + eventType, {type : "set3DProperties", source: source, data: {"els": els, "prop": "matrix", "value": props}, redraw: null}); 472 NJevent("element" + eventType, {type : "set3DProperties", source: source, data: {"els": els, "prop": "matrix", "value": props}, redraw: null});
473 } 473 }
@@ -553,7 +553,7 @@ exports.ElementMediator = Montage.create(NJComponent, {
553 el.elementModel.controller["setColor"](el, value, isFill); 553 el.elementModel.controller["setColor"](el, value, isFill);
554 } 554 }
555 555
556 this.application.ninja.documentController.activeDocument.dirtyFlag = true; 556 this.application.ninja.documentController.activeDocument.markDocumentEditted();
557 557
558 NJevent("element" + eventType, {type : "setColor", source: source, data: {"els": els, "prop": "color", "value": value, "isFill": isFill}, redraw: null}); 558 NJevent("element" + eventType, {type : "setColor", source: source, data: {"els": els, "prop": "color", "value": value, "isFill": isFill}, redraw: null});
559 } 559 }
@@ -636,7 +636,7 @@ exports.ElementMediator = Montage.create(NJComponent, {
636 el.elementModel.controller["setStroke"](el, value); 636 el.elementModel.controller["setStroke"](el, value);
637 } 637 }
638 638
639 this.application.ninja.documentController.activeDocument.dirtyFlag = true; 639 this.application.ninja.documentController.activeDocument.markDocumentEditted();
640 640
641 NJevent("element" + eventType, {type : "setStroke", source: source, data: {"els": els, "prop": "stroke", "value": value}, redraw: null}); 641 NJevent("element" + eventType, {type : "setStroke", source: source, data: {"els": els, "prop": "stroke", "value": value}, redraw: null});
642 } 642 }
@@ -712,7 +712,7 @@ exports.ElementMediator = Montage.create(NJComponent, {
712 } 712 }
713 else 713 else
714 { 714 {
715 this.application.ninja.documentController.activeDocument.dirtyFlag = true; 715 this.application.ninja.documentController.activeDocument.markDocumentEditted();
716 716
717 NJevent("elementChange", {type : "setMatrix", source: null, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null}); 717 NJevent("elementChange", {type : "setMatrix", source: null, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null});
718 } 718 }
diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js
index cd19f361..7ee41fb4 100755
--- a/js/stage/stage-view.reel/stage-view.js
+++ b/js/stage/stage-view.reel/stage-view.js
@@ -98,9 +98,9 @@ exports.StageView = Montage.create(Component, {
98 onChange: function(){ 98 onChange: function(){
99 var historySize = doc.editor.historySize(); 99 var historySize = doc.editor.historySize();
100 if(historySize.undo>0){ 100 if(historySize.undo>0){
101 doc.dirtyFlag=true; 101 doc.markDocumentEditted();
102 }else if(historySize.undo===0 && historySize.redo>0){ 102 }else if(historySize.undo===0 && historySize.redo>0){
103 doc.dirtyFlag=false; 103 doc.markDocumentUneditted();
104 } 104 }
105 }, 105 },
106 onCursorActivity: function() { 106 onCursorActivity: function() {