summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2016-05-06 23:37:50 +0000
committerjabiertxof <info@marker.es>2016-05-06 23:37:50 +0000
commit72610e6bbd79b3a3e9a980980ebc2f533ea8056d (patch)
treeeb91ba3376b50e094ac456d15245c39c0e4a2bc4 /src
parentupdate to trunk (diff)
downloadinkscape-72610e6bbd79b3a3e9a980980ebc2f533ea8056d.tar.gz
inkscape-72610e6bbd79b3a3e9a980980ebc2f533ea8056d.zip
working on undo
(bzr r14865.1.4)
Diffstat (limited to 'src')
-rw-r--r--src/document-undo.cpp23
-rw-r--r--src/document-undo.h4
-rw-r--r--src/ui/tools/eraser-tool.cpp21
3 files changed, 16 insertions, 32 deletions
diff --git a/src/document-undo.cpp b/src/document-undo.cpp
index f6bcf3ab2..7e6fe5df1 100644
--- a/src/document-undo.cpp
+++ b/src/document-undo.cpp
@@ -141,7 +141,7 @@ void Inkscape::DocumentUndo::maybeDone(SPDocument *doc, const gchar *key, const
{
g_assert (doc != NULL);
g_assert (doc->priv != NULL);
- g_assert (doc->priv->sensitive);
+ //g_assert (doc->priv->sensitive);
if ( key && !*key ) {
g_warning("Blank undo key specified.");
}
@@ -328,35 +328,28 @@ gboolean Inkscape::DocumentUndo::redo(SPDocument *doc)
return ret;
}
-void Inkscape::DocumentUndo::clearUndo(SPDocument *doc, size_t limit)
+void Inkscape::DocumentUndo::clearUndo(SPDocument *doc)
{
if (! doc->priv->undo.empty())
doc->priv->undoStackObservers.notifyClearUndoEvent();
- if (limit == 0) {
- limit = doc->priv->undo.size();
- }
- while (! doc->priv->undo.empty() && limit > 0) {
+ while (! doc->priv->undo.empty()) {
Inkscape::Event *e = doc->priv->undo.back();
doc->priv->undo.pop_back();
delete e;
doc->priv->history_size--;
- limit--;
}
}
-void Inkscape::DocumentUndo::clearRedo(SPDocument *doc, size_t limit)
+void Inkscape::DocumentUndo::clearRedo(SPDocument *doc)
{
- if (!doc->priv->redo.empty())
- doc->priv->undoStackObservers.notifyClearRedoEvent();
- if (limit == 0) {
- limit = doc->priv->undo.size();
- }
- while (! doc->priv->redo.empty() && limit > 0) {
+ if (!doc->priv->redo.empty())
+ doc->priv->undoStackObservers.notifyClearRedoEvent();
+
+ while (! doc->priv->redo.empty()) {
Inkscape::Event *e = doc->priv->redo.back();
doc->priv->redo.pop_back();
delete e;
doc->priv->history_size--;
- limit--;
}
}
diff --git a/src/document-undo.h b/src/document-undo.h
index 559036458..85b44d562 100644
--- a/src/document-undo.h
+++ b/src/document-undo.h
@@ -33,9 +33,9 @@ public:
static bool getUndoSensitive(SPDocument const *document);
- static void clearUndo(SPDocument *document, size_t limit = 0);
+ static void clearUndo(SPDocument *document);
- static void clearRedo(SPDocument *document, size_t limit = 0);
+ static void clearRedo(SPDocument *document);
static void done(SPDocument *document, unsigned int event_type, Glib::ustring const &event_description);
diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp
index f1c7306b4..b62f68a5f 100644
--- a/src/ui/tools/eraser-tool.cpp
+++ b/src/ui/tools/eraser-tool.cpp
@@ -721,7 +721,7 @@ void EraserTool::set_to_accumulated() {
Inkscape::GC::release(dup); // parent takes over
selection->set(dup);
if (!this->nowidth) {
- sp_selected_path_union_skip_undo(selection, desktop);
+ sp_selected_path_union(selection, desktop);
}
selection->add(item);
if(item->style->fill_rule.value == SP_WIND_RULE_EVENODD){
@@ -732,9 +732,9 @@ void EraserTool::set_to_accumulated() {
css = 0;
}
if (this->nowidth) {
- sp_selected_path_cut_skip_undo(selection, desktop);
+ sp_selected_path_cut(selection, desktop);
} else {
- sp_selected_path_diff_skip_undo(selection, desktop);
+ sp_selected_path_diff(selection, desktop);
}
workDone = true; // TODO set this only if something was cut.
bool break_apart = prefs->getBool("/tools/eraser/break_apart", false);
@@ -761,7 +761,6 @@ void EraserTool::set_to_accumulated() {
remainingItems.clear();
for (std::vector<SPItem*>::const_iterator i = toWorkOn.begin(); i != toWorkOn.end(); ++i){
selection->clear();
- size_t n_undo = 0;
SPItem *item = *i;
Geom::OptRect bbox = item->desktopVisualBounds();
Inkscape::XML::Document *xml_doc = this->desktop->doc()->getReprDoc();
@@ -778,9 +777,8 @@ void EraserTool::set_to_accumulated() {
this->repr->parent()->appendChild(dup);
Inkscape::GC::release(dup); // parent takes over
selection->set(dup);
- sp_selected_path_union_skip_undo(selection, this->desktop);
+ sp_selected_path_union(selection, this->desktop);
sp_selection_raise_to_top(selection, this->desktop);
- n_undo++;
if (bbox && bbox->intersects(*eraserBbox)) {
SPClipPath *clip_path = item->clip_ref->getObject();
if (clip_path) {
@@ -801,25 +799,19 @@ void EraserTool::set_to_accumulated() {
rect->deleteObject(true);
sp_object_unref(rect);
sp_selection_raise_to_top(selection, this->desktop);
- n_undo++;
selection->add(dup_clip);
- sp_selected_path_diff_skip_undo(selection, this->desktop);
- n_undo++;
+ sp_selected_path_diff(selection, this->desktop);
SPItem * clip = SP_ITEM(selection->itemList()[0]);
}
}
}
} else {
selection->add(rect);
- sp_selected_path_diff_skip_undo(selection, this->desktop);
- n_undo++;
+ sp_selected_path_diff(selection, this->desktop);
}
sp_selection_raise_to_top(selection, this->desktop);
- n_undo++;
selection->add(item);
sp_selection_set_mask(this->desktop, true, false);
- n_undo++;
- DocumentUndo::clearUndo(document, n_undo);
} else {
SPItem *erase_clip = selection->singleItem();
if (erase_clip) {
@@ -871,7 +863,6 @@ void EraserTool::set_to_accumulated() {
this->repr = 0;
}
}
-
if ( workDone ) {
DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_ERASER, _("Draw eraser stroke"));
} else {