summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Owens <doctormo@gmail.com>2014-01-21 15:21:10 +0000
committerMartin Owens <doctormo@gmail.com>2014-01-21 15:21:10 +0000
commit29e005620b05165ffd5ad21c2a9751adac89d34a (patch)
treec1c212cb5327fdc8f0dc10e4cfd5a1f38bfce4ed /src
parentRevert last commit (breaks changing document units). (diff)
downloadinkscape-29e005620b05165ffd5ad21c2a9751adac89d34a.tar.gz
inkscape-29e005620b05165ffd5ad21c2a9751adac89d34a.zip
Move dragging undo block from tools-base to canvas. Regarding bug #168695
(bzr r12967)
Diffstat (limited to 'src')
-rw-r--r--src/display/sp-canvas.cpp5
-rw-r--r--src/display/sp-canvas.h1
-rw-r--r--src/selection-chemistry.cpp5
-rw-r--r--src/ui/tools/tool-base.cpp7
-rw-r--r--src/ui/tools/tool-base.h1
5 files changed, 9 insertions, 10 deletions
diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp
index 455f628bc..ff58cf453 100644
--- a/src/display/sp-canvas.cpp
+++ b/src/display/sp-canvas.cpp
@@ -1545,6 +1545,11 @@ int SPCanvasImpl::emitEvent(SPCanvas *canvas, GdkEvent *event)
default:
break;
}
+ // Block Undo and Redo while we drag /anything/
+ if(event->type == GDK_BUTTON_PRESS)
+ canvas->is_dragging = true;
+ else if(event->type == GDK_BUTTON_RELEASE)
+ canvas->is_dragging = false;
// Choose where we send the event
diff --git a/src/display/sp-canvas.h b/src/display/sp-canvas.h
index b570b739e..72ae4b6bc 100644
--- a/src/display/sp-canvas.h
+++ b/src/display/sp-canvas.h
@@ -124,6 +124,7 @@ struct SPCanvas {
SPCanvasItem *root;
+ bool is_dragging;
double dx0;
double dy0;
int x0;
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index 1957b9297..3082a2fe4 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -56,6 +56,7 @@ SPCycleType SP_CYCLING = SP_CYCLE_FOCUS;
#include "sp-polyline.h"
#include "sp-line.h"
#include "text-editing.h"
+#include "display/sp-canvas.h"
#include "ui/tools/text-tool.h"
#include "ui/tools/connector-tool.h"
#include "sp-path.h"
@@ -1084,7 +1085,7 @@ void
sp_undo(SPDesktop *desktop, SPDocument *)
{
// No re/undo while dragging, too dangerous.
- if(desktop->getEventContext()->is_dragging) return;
+ if(desktop->getCanvas()->is_dragging) return;
if (!DocumentUndo::undo(sp_desktop_document(desktop))) {
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Nothing to undo."));
@@ -1095,7 +1096,7 @@ void
sp_redo(SPDesktop *desktop, SPDocument *)
{
// No re/undo while dragging, too dangerous.
- if(desktop->getEventContext()->is_dragging) return;
+ if(desktop->getCanvas()->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 3b51147e0..cc028724a 100644
--- a/src/ui/tools/tool-base.cpp
+++ b/src/ui/tools/tool-base.cpp
@@ -98,7 +98,6 @@ 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,14 +978,8 @@ 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) {
- 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 ab8bd8caa..43edc4bd7 100644
--- a/src/ui/tools/tool-base.h
+++ b/src/ui/tools/tool-base.h
@@ -118,7 +118,6 @@ 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