diff options
| author | Martin Owens <doctormo@gmail.com> | 2014-01-20 01:30:15 +0000 |
|---|---|---|
| committer | Martin Owens <doctormo@gmail.com> | 2014-01-20 01:30:15 +0000 |
| commit | cca2c219973a60fb6535836559aa42ec2b9cb630 (patch) | |
| tree | 0499397b36d3892b8b5bb98c483a782e1ed5fdc8 /src | |
| parent | Allow undo methods to survive a non-sensitive call. (diff) | |
| download | inkscape-cca2c219973a60fb6535836559aa42ec2b9cb630.tar.gz inkscape-cca2c219973a60fb6535836559aa42ec2b9cb630.zip | |
Revert changes from r12959 and r12955, impliment new stratedgy to fix bug #168695
Fixed bugs:
- https://launchpad.net/bugs/168695
(bzr r12960)
Diffstat (limited to 'src')
| -rw-r--r-- | src/document-undo.cpp | 8 | ||||
| -rw-r--r-- | src/selection-chemistry.cpp | 6 | ||||
| -rw-r--r-- | src/ui/tools/tool-base.cpp | 16 | ||||
| -rw-r--r-- | src/ui/tools/tool-base.h | 3 |
4 files changed, 18 insertions, 15 deletions
diff --git a/src/document-undo.cpp b/src/document-undo.cpp index 4a4156a70..39c8a04a0 100644 --- a/src/document-undo.cpp +++ b/src/document-undo.cpp @@ -155,7 +155,7 @@ void Inkscape::DocumentUndo::maybeDone(SPDocument *doc, const gchar *key, const { g_assert (doc != NULL); g_assert (doc->priv != NULL); - g_return_if_fail(doc->priv->sensitive); + g_assert (doc->priv->sensitive); if ( key && !*key ) { g_warning("Blank undo key specified."); } @@ -204,7 +204,7 @@ void Inkscape::DocumentUndo::cancel(SPDocument *doc) { g_assert (doc != NULL); g_assert (doc->priv != NULL); - g_return_if_fail(doc->priv->sensitive); + g_assert (doc->priv->sensitive); sp_repr_rollback (doc->rdoc); @@ -242,7 +242,7 @@ gboolean Inkscape::DocumentUndo::undo(SPDocument *doc) g_assert (doc != NULL); g_assert (doc->priv != NULL); - g_return_val_if_fail (doc->priv->sensitive, FALSE); + g_assert (doc->priv->sensitive); doc->priv->sensitive = FALSE; doc->priv->seeking = true; @@ -287,7 +287,7 @@ gboolean Inkscape::DocumentUndo::redo(SPDocument *doc) g_assert (doc != NULL); g_assert (doc->priv != NULL); - g_return_val_if_fail(doc->priv->sensitive, FALSE); + g_assert (doc->priv->sensitive); doc->priv->sensitive = FALSE; doc->priv->seeking = true; diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index f9649d62f..1957b9297 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -1083,6 +1083,9 @@ void sp_selection_lower_to_bottom(Inkscape::Selection *selection, SPDesktop *des void sp_undo(SPDesktop *desktop, SPDocument *) { + // No re/undo while dragging, too dangerous. + if(desktop->getEventContext()->is_dragging) return; + if (!DocumentUndo::undo(sp_desktop_document(desktop))) { desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Nothing to undo.")); } @@ -1091,6 +1094,9 @@ sp_undo(SPDesktop *desktop, SPDocument *) void sp_redo(SPDesktop *desktop, SPDocument *) { + // No re/undo while dragging, too dangerous. + if(desktop->getEventContext()->is_dragging) return; + if (!DocumentUndo::redo(sp_desktop_document(desktop))) { desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Nothing to redo.")); } diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index f8868ec0e..3b51147e0 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -57,7 +57,6 @@ #include "shape-editor.h" #include "sp-guide.h" #include "color.h" -#include "document-undo.h" // globals for temporary switching to selector by space static bool selector_toggled = FALSE; @@ -99,6 +98,7 @@ ToolBase::ToolBase() { this->hot_x = 0; this->yp = 0; this->within_tolerance = false; + this->is_dragging = false; this->tolerance = 0; //this->key = 0; this->item_to_select = 0; @@ -979,18 +979,14 @@ gint sp_event_context_root_handler(ToolBase * event_context, gint sp_event_context_virtual_root_handler(ToolBase * event_context, GdkEvent * event) { gint ret = false; if (event_context) { - // We want to disable undo while we drag anything - SPDocument *document = sp_desktop_document(event_context->desktop); - if (event->type == GDK_BUTTON_PRESS) { - event_context->undo_sensitive = DocumentUndo::getUndoSensitive(document); - DocumentUndo::setUndoSensitive(document, false); - } else if (event->type == GDK_BUTTON_RELEASE) { - DocumentUndo::setUndoSensitive(document, event_context->undo_sensitive); - } + if(event->type == GDK_BUTTON_PRESS) + event_context->is_dragging = true; ret = event_context->root_handler(event); - set_event_location(event_context->desktop, event); + + if(event->type == GDK_BUTTON_RELEASE) + event_context->is_dragging = false; } return ret; } diff --git a/src/ui/tools/tool-base.h b/src/ui/tools/tool-base.h index 068bc6402..ab8bd8caa 100644 --- a/src/ui/tools/tool-base.h +++ b/src/ui/tools/tool-base.h @@ -118,8 +118,9 @@ public: gint xp, yp; ///< where drag started gint tolerance; + bool is_dragging; // Is a tool currently dragging something + bool within_tolerance; ///< are we still within tolerance of origin - bool undo_sensitive; /// Was undo previously sensitive before drag SPItem *item_to_select; ///< the item where mouse_press occurred, to ///< be selected if this is a click not drag |
