summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/document-private.h57
-rw-r--r--src/document-undo.cpp298
-rw-r--r--src/document-undo.h4
-rw-r--r--src/document.cpp1
-rw-r--r--src/selection-chemistry.cpp31
-rw-r--r--src/selection-chemistry.h6
-rw-r--r--src/ui/tools/eraser-tool.cpp29
7 files changed, 243 insertions, 183 deletions
diff --git a/src/document-private.h b/src/document-private.h
index eaed0020e..6ec535b87 100644
--- a/src/document-private.h
+++ b/src/document-private.h
@@ -37,43 +37,44 @@ class Event;
}
struct SPDocumentPrivate {
- typedef std::map<GQuark, SPDocument::IDChangedSignal> IDChangedSignalMap;
- typedef std::map<GQuark, SPDocument::ResourcesChangedSignal> ResourcesChangedSignalMap;
+ typedef std::map<GQuark, SPDocument::IDChangedSignal> IDChangedSignalMap;
+ typedef std::map<GQuark, SPDocument::ResourcesChangedSignal> ResourcesChangedSignalMap;
- std::map<std::string, SPObject *> iddef;
- std::map<Inkscape::XML::Node *, SPObject *> reprdef;
+ std::map<std::string, SPObject *> iddef;
+ std::map<Inkscape::XML::Node *, SPObject *> reprdef;
- unsigned long serial;
+ unsigned long serial;
- /** Dictionary of signals for id changes */
- IDChangedSignalMap id_changed_signals;
+ /** Dictionary of signals for id changes */
+ IDChangedSignalMap id_changed_signals;
- /* Resources */
- std::map<std::string, std::set<SPObject *> > resources;
- ResourcesChangedSignalMap resources_changed_signals;
+ /* Resources */
+ std::map<std::string, std::set<SPObject *> > resources;
+ ResourcesChangedSignalMap resources_changed_signals;
- sigc::signal<void> destroySignal;
- SPDocument::ModifiedSignal modified_signal;
- SPDocument::URISetSignal uri_set_signal;
- SPDocument::ResizedSignal resized_signal;
- SPDocument::ReconstructionStart _reconstruction_start_signal;
- SPDocument::ReconstructionFinish _reconstruction_finish_signal;
- SPDocument::CommitSignal commit_signal;
+ sigc::signal<void> destroySignal;
+ SPDocument::ModifiedSignal modified_signal;
+ SPDocument::URISetSignal uri_set_signal;
+ SPDocument::ResizedSignal resized_signal;
+ SPDocument::ReconstructionStart _reconstruction_start_signal;
+ SPDocument::ReconstructionFinish _reconstruction_finish_signal;
+ SPDocument::CommitSignal commit_signal;
- /* Undo/Redo state */
- bool sensitive; /* If we save actions to undo stack */
- Inkscape::XML::Event * partial; /* partial undo log when interrupted */
- int history_size;
- std::vector<Inkscape::Event *> undo; /* Undo stack of reprs */
- std::vector<Inkscape::Event *> redo; /* Redo stack of reprs */
+ /* Undo/Redo state */
+ bool sensitive; /* If we save actions to undo stack */
+ bool join_undo; /* If we group actions to one undo stack */
+ Inkscape::XML::Event * partial; /* partial undo log when interrupted */
+ int history_size;
+ std::vector<Inkscape::Event *> undo; /* Undo stack of reprs */
+ std::vector<Inkscape::Event *> redo; /* Redo stack of reprs */
- /* Undo listener */
- Inkscape::CompositeUndoStackObserver undoStackObservers;
+ /* Undo listener */
+ Inkscape::CompositeUndoStackObserver undoStackObservers;
- // XXX only for testing!
- Inkscape::ConsoleOutputUndoObserver console_output_undo_observer;
+ // XXX only for testing!
+ Inkscape::ConsoleOutputUndoObserver console_output_undo_observer;
- bool seeking;
+ bool seeking;
sigc::connection selChangeConnection;
sigc::connection desktopActivatedConnection;
};
diff --git a/src/document-undo.cpp b/src/document-undo.cpp
index 7e6fe5df1..1707fb6fa 100644
--- a/src/document-undo.cpp
+++ b/src/document-undo.cpp
@@ -62,22 +62,22 @@
void Inkscape::DocumentUndo::setUndoSensitive(SPDocument *doc, bool sensitive)
{
- g_assert (doc != NULL);
- g_assert (doc->priv != NULL);
-
- if ( sensitive == doc->priv->sensitive )
- return;
-
- if (sensitive) {
- sp_repr_begin_transaction (doc->rdoc);
- } else {
- doc->priv->partial = sp_repr_coalesce_log (
- doc->priv->partial,
- sp_repr_commit_undoable (doc->rdoc)
- );
- }
-
- doc->priv->sensitive = sensitive;
+ g_assert (doc != NULL);
+ g_assert (doc->priv != NULL);
+
+ if ( sensitive == doc->priv->sensitive )
+ return;
+
+ if (sensitive) {
+ sp_repr_begin_transaction (doc->rdoc);
+ } else {
+ doc->priv->partial = sp_repr_coalesce_log (
+ doc->priv->partial,
+ sp_repr_commit_undoable (doc->rdoc)
+ );
+ }
+
+ doc->priv->sensitive = sensitive;
}
/*TODO: Throughout the inkscape code tree set/get_undo_sensitive are used for
@@ -88,15 +88,49 @@ void Inkscape::DocumentUndo::setUndoSensitive(SPDocument *doc, bool sensitive)
*/
bool Inkscape::DocumentUndo::getUndoSensitive(SPDocument const *document) {
- g_assert(document != NULL);
- g_assert(document->priv != NULL);
+ g_assert(document != NULL);
+ g_assert(document->priv != NULL);
+
+ return document->priv->sensitive;
+}
+
+void Inkscape::DocumentUndo::setUndoJoined(SPDocument *doc, bool join_undo)
+{
+ g_assert (doc != NULL);
+ g_assert (doc->priv != NULL);
+ if (join_undo) {
+ doc->collectOrphans();
+ doc->ensureUpToDate();
+ DocumentUndo::clearRedo(doc);
+ Inkscape::XML::Event *log = sp_repr_coalesce_log (doc->priv->partial, sp_repr_commit_undoable (doc->rdoc));
+ doc->priv->partial = NULL;
+ if (!log) {
+ sp_repr_begin_transaction (doc->rdoc);
+ doc->priv->join_undo = join_undo;
+ return;
+ }
+ doc->virgin = FALSE;
+ doc->setModifiedSinceSave();
+ sp_repr_begin_transaction (doc->rdoc);
+ doc->priv->commit_signal.emit();
+ }
+ doc->priv->join_undo = join_undo;
+}
- return document->priv->sensitive;
+bool Inkscape::DocumentUndo::getUndoJoined(SPDocument *doc)
+{
+ g_assert (doc != NULL);
+ g_assert (doc->priv != NULL);
+ return doc->priv->join_undo;
}
void Inkscape::DocumentUndo::done(SPDocument *doc, const unsigned int event_type, Glib::ustring const &event_description)
{
- maybeDone(doc, NULL, event_type, event_description);
+ if (!getUndoJoined(doc)) {
+ maybeDone(doc, NULL, event_type, event_description);
+ } else {
+ sp_repr_commit_undoable (doc->rdoc);
+ }
}
void Inkscape::DocumentUndo::resetKey( SPDocument *doc )
@@ -139,82 +173,81 @@ public:
void Inkscape::DocumentUndo::maybeDone(SPDocument *doc, const gchar *key, const unsigned int event_type,
Glib::ustring const &event_description)
{
- g_assert (doc != NULL);
- g_assert (doc->priv != NULL);
- //g_assert (doc->priv->sensitive);
- if ( key && !*key ) {
- g_warning("Blank undo key specified.");
- }
+ g_assert (doc != NULL);
+ g_assert (doc->priv != NULL);
+ g_assert (doc->priv->sensitive);
+ if ( key && !*key ) {
+ g_warning("Blank undo key specified.");
+ }
- Inkscape::Debug::EventTracker<CommitEvent> tracker(doc, key, event_type);
+ Inkscape::Debug::EventTracker<CommitEvent> tracker(doc, key, event_type);
- doc->collectOrphans();
+ doc->collectOrphans();
- doc->ensureUpToDate();
+ doc->ensureUpToDate();
- DocumentUndo::clearRedo(doc);
+ DocumentUndo::clearRedo(doc);
- Inkscape::XML::Event *log = sp_repr_coalesce_log (doc->priv->partial, sp_repr_commit_undoable (doc->rdoc));
- doc->priv->partial = NULL;
+ Inkscape::XML::Event *log = sp_repr_coalesce_log (doc->priv->partial, sp_repr_commit_undoable (doc->rdoc));
+ doc->priv->partial = NULL;
- if (!log) {
- sp_repr_begin_transaction (doc->rdoc);
- return;
- }
+ if (!log) {
+ sp_repr_begin_transaction (doc->rdoc);
+ return;
+ }
- if (key && !doc->actionkey.empty() && (doc->actionkey == key) && !doc->priv->undo.empty()) {
- (doc->priv->undo.back())->event =
- sp_repr_coalesce_log ((doc->priv->undo.back())->event, log);
- } else {
- Inkscape::Event *event = new Inkscape::Event(log, event_type, event_description);
- doc->priv->undo.push_back(event);
- doc->priv->history_size++;
- doc->priv->undoStackObservers.notifyUndoCommitEvent(event);
- }
+ if (key && !doc->actionkey.empty() && (doc->actionkey == key) && !doc->priv->undo.empty()) {
+ (doc->priv->undo.back())->event = sp_repr_coalesce_log ((doc->priv->undo.back())->event, log);
+ } else {
+ Inkscape::Event *event = new Inkscape::Event(log, event_type, event_description);
+ doc->priv->undo.push_back(event);
+ doc->priv->history_size++;
+ doc->priv->undoStackObservers.notifyUndoCommitEvent(event);
+ }
- if ( key ) {
- doc->actionkey = key;
- } else {
- doc->actionkey.clear();
- }
+ if ( key ) {
+ doc->actionkey = key;
+ } else {
+ doc->actionkey.clear();
+ }
- doc->virgin = FALSE;
- doc->setModifiedSinceSave();
+ doc->virgin = FALSE;
+ doc->setModifiedSinceSave();
- sp_repr_begin_transaction (doc->rdoc);
+ sp_repr_begin_transaction (doc->rdoc);
- doc->priv->commit_signal.emit();
+ doc->priv->commit_signal.emit();
}
void Inkscape::DocumentUndo::cancel(SPDocument *doc)
{
- g_assert (doc != NULL);
- g_assert (doc->priv != NULL);
- g_assert (doc->priv->sensitive);
+ g_assert (doc != NULL);
+ g_assert (doc->priv != NULL);
+ g_assert (doc->priv->sensitive);
- sp_repr_rollback (doc->rdoc);
+ sp_repr_rollback (doc->rdoc);
- if (doc->priv->partial) {
- sp_repr_undo_log (doc->priv->partial);
- sp_repr_free_log (doc->priv->partial);
- doc->priv->partial = NULL;
- }
+ if (doc->priv->partial) {
+ sp_repr_undo_log (doc->priv->partial);
+ sp_repr_free_log (doc->priv->partial);
+ doc->priv->partial = NULL;
+ }
- sp_repr_begin_transaction (doc->rdoc);
+ sp_repr_begin_transaction (doc->rdoc);
}
static void finish_incomplete_transaction(SPDocument &doc) {
- SPDocumentPrivate &priv=*doc.priv;
- Inkscape::XML::Event *log=sp_repr_commit_undoable(doc.rdoc);
- if (log || priv.partial) {
- g_warning ("Incomplete undo transaction:");
- priv.partial = sp_repr_coalesce_log(priv.partial, log);
- sp_repr_debug_print_log(priv.partial);
+ SPDocumentPrivate &priv=*doc.priv;
+ Inkscape::XML::Event *log=sp_repr_commit_undoable(doc.rdoc);
+ if (log || priv.partial) {
+ g_warning ("Incomplete undo transaction:");
+ priv.partial = sp_repr_coalesce_log(priv.partial, log);
+ sp_repr_debug_print_log(priv.partial);
Inkscape::Event *event = new Inkscape::Event(priv.partial);
- priv.undo.push_back(event);
+ priv.undo.push_back(event);
priv.undoStackObservers.notifyUndoCommitEvent(event);
- priv.partial = NULL;
- }
+ priv.partial = NULL;
+ }
}
static void perform_document_update(SPDocument &doc) {
@@ -238,100 +271,101 @@ static void perform_document_update(SPDocument &doc) {
gboolean Inkscape::DocumentUndo::undo(SPDocument *doc)
{
- using Inkscape::Debug::EventTracker;
- using Inkscape::Debug::SimpleEvent;
+ using Inkscape::Debug::EventTracker;
+ using Inkscape::Debug::SimpleEvent;
- gboolean ret;
+ gboolean ret;
- EventTracker<SimpleEvent<Inkscape::Debug::Event::DOCUMENT> > tracker("undo");
+ EventTracker<SimpleEvent<Inkscape::Debug::Event::DOCUMENT> > tracker("undo");
- g_assert (doc != NULL);
- g_assert (doc->priv != NULL);
- g_assert (doc->priv->sensitive);
+ g_assert (doc != NULL);
+ g_assert (doc->priv != NULL);
+ g_assert (doc->priv->sensitive);
- doc->priv->sensitive = FALSE;
- doc->priv->seeking = true;
+ doc->priv->sensitive = FALSE;
+ doc->priv->seeking = true;
- doc->actionkey.clear();
+ doc->actionkey.clear();
- finish_incomplete_transaction(*doc);
+ finish_incomplete_transaction(*doc);
- if (! doc->priv->undo.empty()) {
- Inkscape::Event *log = doc->priv->undo.back();
- doc->priv->undo.pop_back();
- sp_repr_undo_log (log->event);
- perform_document_update(*doc);
+ if (! doc->priv->undo.empty()) {
+ Inkscape::Event *log = doc->priv->undo.back();
+ doc->priv->undo.pop_back();
+ sp_repr_undo_log (log->event);
+ perform_document_update(*doc);
- doc->priv->redo.push_back(log);
+ doc->priv->redo.push_back(log);
- doc->setModifiedSinceSave();
- doc->priv->undoStackObservers.notifyUndoEvent(log);
+ doc->setModifiedSinceSave();
+ doc->priv->undoStackObservers.notifyUndoEvent(log);
- ret = TRUE;
- } else {
- ret = FALSE;
- }
+ ret = TRUE;
+ } else {
+ ret = FALSE;
+ }
- sp_repr_begin_transaction (doc->rdoc);
+ sp_repr_begin_transaction (doc->rdoc);
- doc->priv->sensitive = TRUE;
- doc->priv->seeking = false;
+ doc->priv->sensitive = TRUE;
+ doc->priv->seeking = false;
- if (ret)
- INKSCAPE.external_change();
+ if (ret)
+ INKSCAPE.external_change();
- return ret;
+ return ret;
}
gboolean Inkscape::DocumentUndo::redo(SPDocument *doc)
{
- using Inkscape::Debug::EventTracker;
- using Inkscape::Debug::SimpleEvent;
+ using Inkscape::Debug::EventTracker;
+ using Inkscape::Debug::SimpleEvent;
- gboolean ret;
+ gboolean ret;
- EventTracker<SimpleEvent<Inkscape::Debug::Event::DOCUMENT> > tracker("redo");
+ EventTracker<SimpleEvent<Inkscape::Debug::Event::DOCUMENT> > tracker("redo");
- g_assert (doc != NULL);
- g_assert (doc->priv != NULL);
- g_assert (doc->priv->sensitive);
+ g_assert (doc != NULL);
+ g_assert (doc->priv != NULL);
+ g_assert (doc->priv->sensitive);
- doc->priv->sensitive = FALSE;
- doc->priv->seeking = true;
+ doc->priv->sensitive = FALSE;
+ doc->priv->seeking = true;
- doc->actionkey.clear();
+ doc->actionkey.clear();
- finish_incomplete_transaction(*doc);
+ finish_incomplete_transaction(*doc);
- if (! doc->priv->redo.empty()) {
- Inkscape::Event *log = doc->priv->redo.back();
- doc->priv->redo.pop_back();
- sp_repr_replay_log (log->event);
- doc->priv->undo.push_back(log);
+ if (! doc->priv->redo.empty()) {
+ Inkscape::Event *log = doc->priv->redo.back();
+ doc->priv->redo.pop_back();
+ sp_repr_replay_log (log->event);
+ doc->priv->undo.push_back(log);
- doc->setModifiedSinceSave();
- doc->priv->undoStackObservers.notifyRedoEvent(log);
+ doc->setModifiedSinceSave();
+ doc->priv->undoStackObservers.notifyRedoEvent(log);
- ret = TRUE;
- } else {
- ret = FALSE;
- }
+ ret = TRUE;
+ } else {
+ ret = FALSE;
+ }
- sp_repr_begin_transaction (doc->rdoc);
+ sp_repr_begin_transaction (doc->rdoc);
- doc->priv->sensitive = TRUE;
- doc->priv->seeking = false;
+ doc->priv->sensitive = TRUE;
+ doc->priv->seeking = false;
- if (ret)
- INKSCAPE.external_change();
+ if (ret)
+ INKSCAPE.external_change();
- return ret;
+ return ret;
}
void Inkscape::DocumentUndo::clearUndo(SPDocument *doc)
{
if (! doc->priv->undo.empty())
doc->priv->undoStackObservers.notifyClearUndoEvent();
+
while (! doc->priv->undo.empty()) {
Inkscape::Event *e = doc->priv->undo.back();
doc->priv->undo.pop_back();
@@ -342,8 +376,8 @@ void Inkscape::DocumentUndo::clearUndo(SPDocument *doc)
void Inkscape::DocumentUndo::clearRedo(SPDocument *doc)
{
- if (!doc->priv->redo.empty())
- doc->priv->undoStackObservers.notifyClearRedoEvent();
+ if (!doc->priv->redo.empty())
+ doc->priv->undoStackObservers.notifyClearRedoEvent();
while (! doc->priv->redo.empty()) {
Inkscape::Event *e = doc->priv->redo.back();
diff --git a/src/document-undo.h b/src/document-undo.h
index 85b44d562..b80b176d3 100644
--- a/src/document-undo.h
+++ b/src/document-undo.h
@@ -33,6 +33,10 @@ public:
static bool getUndoSensitive(SPDocument const *document);
+ static void setUndoJoined(SPDocument *doc, bool join_undo);
+
+ static bool getUndoJoined(SPDocument *doc);
+
static void clearUndo(SPDocument *document);
static void clearRedo(SPDocument *document);
diff --git a/src/document.cpp b/src/document.cpp
index 7086fc0be..87f13f749 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -121,6 +121,7 @@ SPDocument::SPDocument() :
p->serial = next_serial++;
p->sensitive = false;
+ p->join_undo = false;
p->partial = NULL;
p->history_size = 0;
p->seeking = false;
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index 7d32477a1..2c93c5496 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -1031,7 +1031,7 @@ sp_selection_raise(Inkscape::Selection *selection, SPDesktop *desktop)
C_("Undo action", "Raise"));
}
-void sp_selection_raise_to_top(Inkscape::Selection *selection, SPDesktop *desktop)
+void sp_selection_raise_to_top(Inkscape::Selection *selection, SPDesktop *desktop, bool skip_undo)
{
SPDocument *document = selection->layers()->getDocument();
@@ -1055,9 +1055,10 @@ void sp_selection_raise_to_top(Inkscape::Selection *selection, SPDesktop *deskto
Inkscape::XML::Node *repr =(*l);
repr->setPosition(-1);
}
-
- DocumentUndo::done(document, SP_VERB_SELECTION_TO_FRONT,
- _("Raise to top"));
+ if (!skip_undo) {
+ DocumentUndo::done(document, SP_VERB_SELECTION_TO_FRONT,
+ _("Raise to top"));
+ }
}
void sp_selection_lower(Inkscape::Selection *selection, SPDesktop *desktop)
@@ -1115,7 +1116,7 @@ void sp_selection_lower(Inkscape::Selection *selection, SPDesktop *desktop)
C_("Undo action", "Lower"));
}
-void sp_selection_lower_to_bottom(Inkscape::Selection *selection, SPDesktop *desktop)
+void sp_selection_lower_to_bottom(Inkscape::Selection *selection, SPDesktop *desktop, bool skip_undo)
{
SPDocument *document = selection->layers()->getDocument();
@@ -1149,9 +1150,10 @@ void sp_selection_lower_to_bottom(Inkscape::Selection *selection, SPDesktop *des
}
repr->setPosition(minpos);
}
-
- DocumentUndo::done(document, SP_VERB_SELECTION_TO_BACK,
- _("Lower to bottom"));
+ if (!skip_undo) {
+ DocumentUndo::done(document, SP_VERB_SELECTION_TO_BACK,
+ _("Lower to bottom"));
+ }
}
void
@@ -3859,7 +3861,7 @@ void sp_selection_set_clipgroup(SPDesktop *desktop)
* If \a apply_clip_path parameter is true, clipPath is created, otherwise mask
*
*/
-void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_to_layer)
+void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_to_layer, bool skip_undo)
{
if (desktop == NULL) {
return;
@@ -4021,11 +4023,12 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_
}
selection->addList(items_to_select);
-
- if (apply_clip_path) {
- DocumentUndo::done(doc, SP_VERB_OBJECT_SET_CLIPPATH, _("Set clipping path"));
- } else {
- DocumentUndo::done(doc, SP_VERB_OBJECT_SET_MASK, _("Set mask"));
+ if (!skip_undo) {
+ if (apply_clip_path) {
+ DocumentUndo::done(doc, SP_VERB_OBJECT_SET_CLIPPATH, _("Set clipping path"));
+ } else {
+ DocumentUndo::done(doc, SP_VERB_OBJECT_SET_MASK, _("Set mask"));
+ }
}
}
diff --git a/src/selection-chemistry.h b/src/selection-chemistry.h
index 82b91c617..31c160bf9 100644
--- a/src/selection-chemistry.h
+++ b/src/selection-chemistry.h
@@ -79,9 +79,9 @@ void sp_selection_ungroup(Inkscape::Selection *selection, SPDesktop *desktop);
void sp_selection_ungroup_pop_selection(Inkscape::Selection *selection, SPDesktop *desktop);
void sp_selection_raise(Inkscape::Selection *selection, SPDesktop *desktop);
-void sp_selection_raise_to_top(Inkscape::Selection *selection, SPDesktop *desktop);
+void sp_selection_raise_to_top(Inkscape::Selection *selection, SPDesktop *desktop, bool skip_undo = false);
void sp_selection_lower(Inkscape::Selection *selection, SPDesktop *desktop);
-void sp_selection_lower_to_bottom(Inkscape::Selection *selection, SPDesktop *desktop);
+void sp_selection_lower_to_bottom(Inkscape::Selection *selection, SPDesktop *desktop, bool skip_undo = false);
SPCSSAttr *take_style_from_item (SPObject *object);
@@ -157,7 +157,7 @@ void sp_document_get_export_hints (SPDocument * doc, Glib::ustring &filename, fl
void sp_selection_create_bitmap_copy (SPDesktop *desktop);
void sp_selection_set_clipgroup(SPDesktop *desktop);
-void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_to_layer);
+void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_to_layer, bool skip_undo = false);
void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path);
bool fit_canvas_to_selection(SPDesktop *, bool with_margins = false);
diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp
index b62f68a5f..60b8c2792 100644
--- a/src/ui/tools/eraser-tool.cpp
+++ b/src/ui/tools/eraser-tool.cpp
@@ -644,6 +644,8 @@ void EraserTool::clear_current() {
void EraserTool::set_to_accumulated() {
bool workDone = false;
SPDocument *document = this->desktop->doc();
+ bool saved = DocumentUndo::getUndoSensitive(document);
+ DocumentUndo::setUndoSensitive(document, false);
if (!this->accumulated->is_empty()) {
if (!this->repr) {
/* Create object */
@@ -721,7 +723,9 @@ void EraserTool::set_to_accumulated() {
Inkscape::GC::release(dup); // parent takes over
selection->set(dup);
if (!this->nowidth) {
- sp_selected_path_union(selection, desktop);
+ DocumentUndo::setUndoSensitive(document, saved);
+ sp_selected_path_union_skip_undo(selection, desktop);
+ DocumentUndo::setUndoSensitive(document, false);
}
selection->add(item);
if(item->style->fill_rule.value == SP_WIND_RULE_EVENODD){
@@ -731,13 +735,16 @@ void EraserTool::set_to_accumulated() {
sp_repr_css_attr_unref(css);
css = 0;
}
+ DocumentUndo::setUndoSensitive(document, saved);
if (this->nowidth) {
- sp_selected_path_cut(selection, desktop);
+ sp_selected_path_cut_skip_undo(selection, desktop);
} else {
- sp_selected_path_diff(selection, desktop);
+ sp_selected_path_diff_skip_undo(selection, desktop);
}
+ DocumentUndo::setUndoSensitive(document, saved);
workDone = true; // TODO set this only if something was cut.
bool break_apart = prefs->getBool("/tools/eraser/break_apart", false);
+ DocumentUndo::setUndoSensitive(document, saved);
if(!break_apart){
sp_selected_path_combine(desktop, true);
} else {
@@ -745,6 +752,7 @@ void EraserTool::set_to_accumulated() {
sp_selected_path_break_apart(desktop, true);
}
}
+ DocumentUndo::setUndoSensitive(document, saved);
if ( !selection->isEmpty() ) {
// If the item was not completely erased, track the new remainder.
std::vector<SPItem*> nowSel(selection->itemList());
@@ -777,7 +785,9 @@ void EraserTool::set_to_accumulated() {
this->repr->parent()->appendChild(dup);
Inkscape::GC::release(dup); // parent takes over
selection->set(dup);
- sp_selected_path_union(selection, this->desktop);
+ DocumentUndo::setUndoSensitive(document, saved);
+ sp_selected_path_union_skip_undo(selection, this->desktop);
+ DocumentUndo::setUndoSensitive(document, false);
sp_selection_raise_to_top(selection, this->desktop);
if (bbox && bbox->intersects(*eraserBbox)) {
SPClipPath *clip_path = item->clip_ref->getObject();
@@ -800,14 +810,19 @@ void EraserTool::set_to_accumulated() {
sp_object_unref(rect);
sp_selection_raise_to_top(selection, this->desktop);
selection->add(dup_clip);
- sp_selected_path_diff(selection, this->desktop);
+ DocumentUndo::setUndoSensitive(document, saved);
+ sp_selected_path_diff_skip_undo(selection, this->desktop);
+ DocumentUndo::setUndoSensitive(document, saved);
SPItem * clip = SP_ITEM(selection->itemList()[0]);
+ DocumentUndo::setUndoSensitive(document, false);
}
}
}
} else {
selection->add(rect);
- sp_selected_path_diff(selection, this->desktop);
+ DocumentUndo::setUndoSensitive(document, saved);
+ sp_selected_path_diff_skip_undo(selection, this->desktop);
+ DocumentUndo::setUndoSensitive(document, false);
}
sp_selection_raise_to_top(selection, this->desktop);
selection->add(item);
@@ -863,6 +878,8 @@ void EraserTool::set_to_accumulated() {
this->repr = 0;
}
}
+ document->setModifiedSinceSave();
+ DocumentUndo::setUndoSensitive(document, saved);
if ( workDone ) {
DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_ERASER, _("Draw eraser stroke"));
} else {