summaryrefslogtreecommitdiffstats
path: root/src/ui/tools
diff options
context:
space:
mode:
authorLiam P. White <inkscapebronyat-signgmaildotcom>2014-03-12 15:13:08 +0000
committerLiam P. White <inkscapebronyat-signgmaildotcom>2014-03-12 15:13:08 +0000
commit309112136c71cbb4f62fb850c6f6f12e32a67a8e (patch)
tree58e867ed84ddbc721113b948d4b6365cef02338a /src/ui/tools
parentReverted swatches (diff)
parentChange stroke-dasharray and stroke-dashoffset handling to match other propert... (diff)
downloadinkscape-309112136c71cbb4f62fb850c6f6f12e32a67a8e.tar.gz
inkscape-309112136c71cbb4f62fb850c6f6f12e32a67a8e.zip
Updated to trunk
(bzr r13090.1.24)
Diffstat (limited to 'src/ui/tools')
-rw-r--r--src/ui/tools/spray-tool.cpp4
-rw-r--r--src/ui/tools/tool-base.cpp28
-rw-r--r--src/ui/tools/tool-base.h4
3 files changed, 27 insertions, 9 deletions
diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp
index e43b6575e..08d3119a1 100644
--- a/src/ui/tools/spray-tool.cpp
+++ b/src/ui/tools/spray-tool.cpp
@@ -82,7 +82,7 @@ using namespace std;
// Disabled in 0.91 because of Bug #1274831 (crash, spraying an object
// with the mode: spray object in single path)
// Please enable again when working on 1.0
-//#define ENABLE_SPRAY_MODE_SINGLE_PATH
+#define ENABLE_SPRAY_MODE_SINGLE_PATH
#include "tool-factory.h"
@@ -140,7 +140,7 @@ static void sp_spray_scale_rel(Geom::Point c, SPDesktop */*desktop*/, SPItem *it
}
SprayTool::SprayTool()
- : ToolBase(cursor_spray_xpm, 4, 4)
+ : ToolBase(cursor_spray_xpm, 4, 4, false)
, pressure(TC_DEFAULT_PRESSURE)
, dragging(false)
, usepressure(0)
diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp
index 45b519fb4..752053be1 100644
--- a/src/ui/tools/tool-base.cpp
+++ b/src/ui/tools/tool-base.cpp
@@ -90,7 +90,7 @@ SPDesktop const& ToolBase::getDesktop() const {
return *desktop;
}
-ToolBase::ToolBase(gchar const *const *cursor_shape, gint hot_x, gint hot_y)
+ToolBase::ToolBase(gchar const *const *cursor_shape, gint hot_x, gint hot_y, bool uses_snap)
: pref_observer(NULL)
, cursor(NULL)
, xp(0)
@@ -106,6 +106,7 @@ ToolBase::ToolBase(gchar const *const *cursor_shape, gint hot_x, gint hot_y)
, _delayed_snap_event(NULL)
, _dse_callback_in_process(false)
, desktop(NULL)
+ , _uses_snap(uses_snap)
, cursor_shape(cursor_shape)
, hot_x(hot_x)
, hot_y(hot_y)
@@ -384,7 +385,9 @@ bool ToolBase::root_handler(GdkEvent* event) {
case 1:
if (this->space_panning) {
// When starting panning, make sure there are no snap events pending because these might disable the panning again
- sp_event_context_discard_delayed_snap_event(this);
+ if (_uses_snap) {
+ sp_event_context_discard_delayed_snap_event(this);
+ }
panning = 1;
sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
@@ -402,7 +405,9 @@ bool ToolBase::root_handler(GdkEvent* event) {
zoom_rb = 2;
} else {
// When starting panning, make sure there are no snap events pending because these might disable the panning again
- sp_event_context_discard_delayed_snap_event(this);
+ if (_uses_snap) {
+ sp_event_context_discard_delayed_snap_event(this);
+ }
panning = 2;
sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
@@ -418,7 +423,9 @@ bool ToolBase::root_handler(GdkEvent* event) {
case 3:
if ((event->button.state & GDK_SHIFT_MASK) || (event->button.state & GDK_CONTROL_MASK)) {
// When starting panning, make sure there are no snap events pending because these might disable the panning again
- sp_event_context_discard_delayed_snap_event(this);
+ if (_uses_snap) {
+ sp_event_context_discard_delayed_snap_event(this);
+ }
panning = 3;
sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
@@ -946,6 +953,10 @@ void sp_event_context_read(ToolBase *ec, gchar const *key) {
gint sp_event_context_root_handler(ToolBase * event_context,
GdkEvent * event)
{
+ if (!event_context->_uses_snap) {
+ return sp_event_context_virtual_root_handler(event_context, event);
+ }
+
switch (event->type) {
case GDK_MOTION_NOTIFY:
sp_event_context_snap_delay_handler(event_context, NULL, NULL,
@@ -995,7 +1006,12 @@ gint sp_event_context_virtual_root_handler(ToolBase * event_context, GdkEvent *
* Calls virtual item_handler(), the item event handling function.
*/
gint sp_event_context_item_handler(ToolBase * event_context,
- SPItem * item, GdkEvent * event) {
+ SPItem * item, GdkEvent * event)
+{
+ if (!event_context->_uses_snap) {
+ return sp_event_context_virtual_item_handler(event_context, item, event);
+ }
+
switch (event->type) {
case GDK_MOTION_NOTIFY:
sp_event_context_snap_delay_handler(event_context, (gpointer) item, NULL, (GdkEventMotion *) event, DelayedSnapEvent::EVENTCONTEXT_ITEM_HANDLER);
@@ -1232,7 +1248,7 @@ void sp_event_context_snap_delay_handler(ToolBase *ec,
static guint32 prev_time;
static boost::optional<Geom::Point> prev_pos;
- if (ec->_dse_callback_in_process) {
+ if (!ec->_uses_snap || ec->_dse_callback_in_process) {
return;
}
diff --git a/src/ui/tools/tool-base.h b/src/ui/tools/tool-base.h
index eb8908f3e..def6e3d91 100644
--- a/src/ui/tools/tool-base.h
+++ b/src/ui/tools/tool-base.h
@@ -113,7 +113,7 @@ public:
void enableGrDrag (bool enable=true);
bool deleteSelectedDrag(bool just_one);
- ToolBase(gchar const *const *cursor_shape, gint hot_x, gint hot_y);
+ ToolBase(gchar const *const *cursor_shape, gint hot_x, gint hot_y, bool uses_snap = true);
virtual ~ToolBase();
@@ -181,6 +181,7 @@ public:
void sp_event_context_update_cursor();
SPDesktop *desktop;
+ bool _uses_snap; // TODO: make protected or private
protected:
/// An xpm containing the shape of the tool's cursor.
@@ -188,6 +189,7 @@ protected:
/// The cursor's hot spot
gint hot_x, hot_y;
+ /// Whether the tool should receive delayed snap events
bool sp_event_context_knot_mouseover() const;