summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 677e6cf)
raw | patch | inline | side by side (parent: 677e6cf)
author | dvlierop2 <dvlierop2@users.sourceforge.net> | |
Sat, 18 Jul 2009 12:56:25 +0000 (12:56 +0000) | ||
committer | dvlierop2 <dvlierop2@users.sourceforge.net> | |
Sat, 18 Jul 2009 12:56:25 +0000 (12:56 +0000) |
20 files changed:
diff --git a/src/arc-context.cpp b/src/arc-context.cpp
index d47e22b1a68156cd06b2c8c86ef925e855f38b14..dcb326bcd3e718635f3d8617845c9e762c49eea8 100644 (file)
--- a/src/arc-context.cpp
+++ b/src/arc-context.cpp
if (event->button.button == 1 && !event_context->space_panning) {
dragging = true;
- sp_event_context_snap_window_open(event_context);
ac->center = Inkscape::setup_for_drag_start(desktop, event_context, event);
/* Snap center */
event_context->xp = event_context->yp = 0;
if (event->button.button == 1 && !event_context->space_panning) {
dragging = false;
- sp_event_context_snap_window_closed(event_context, false); //button release will also occur on a double-click; in that case suppress warnings
+ sp_event_context_discard_delayed_snap_event(event_context);
if (!event_context->within_tolerance) {
// we've been dragging, finish the arc
sp_arc_finish(ac);
case GDK_Escape:
if (dragging) {
dragging = false;
- sp_event_context_snap_window_closed(event_context);
+ sp_event_context_discard_delayed_snap_event(event_context);
// if drawing, cancel, otherwise pass it up for deselecting
sp_arc_cancel(ac);
ret = TRUE;
sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate),
event->button.time);
dragging = false;
- sp_event_context_snap_window_closed(event_context);
+ sp_event_context_discard_delayed_snap_event(event_context);
if (!event_context->within_tolerance) {
// we've been dragging, finish the arc
sp_arc_finish(ac);
diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp
index d1b6d62fc64ddf9dbee7503ce558b17ead4a3d95..fd72e406bd5da6ed29d760cef73ff407e80eccd9 100644 (file)
--- a/src/box3d-context.cpp
+++ b/src/box3d-context.cpp
@@ -276,7 +276,6 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven
event_context->item_to_select = sp_event_context_find_item (desktop, button_w, event->button.state & GDK_MOD1_MASK, event->button.state & GDK_CONTROL_MASK);
dragging = true;
- sp_event_context_snap_window_open(event_context);
/* */
Geom::Point button_dt(desktop->w2d(button_w));
@@ -373,7 +372,7 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven
event_context->xp = event_context->yp = 0;
if ( event->button.button == 1 && !event_context->space_panning) {
dragging = false;
- sp_event_context_snap_window_closed(event_context, false); //button release will also occur on a double-click; in that case suppress warnings
+ sp_event_context_discard_delayed_snap_event(event_context);
if (!event_context->within_tolerance) {
// we've been dragging, finish the box
@@ -508,7 +507,7 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven
sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate),
event->button.time);
dragging = false;
- sp_event_context_snap_window_closed(event_context);
+ sp_event_context_discard_delayed_snap_event(event_context);
if (!event_context->within_tolerance) {
// we've been dragging, finish the box
sp_box3d_finish(bc);
index c8754972a931039407319df2df8a7cd39f8eae28..2131bdced797be78964e0e798c769ba9535f06d7 100644 (file)
@@ -409,7 +409,7 @@ sp_connector_context_item_handler(SPEventContext *event_context, SPItem *item, G
{
spcc_reset_colors(cc);
cc->state = SP_CONNECTOR_CONTEXT_IDLE;
- sp_event_context_snap_window_closed(event_context);
+ sp_event_context_discard_delayed_snap_event(event_context);
}
if (cc->state != SP_CONNECTOR_CONTEXT_IDLE) {
// Doing simething else like rerouting.
@@ -532,8 +532,6 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const
// Test whether we clicked on a connection point
cc->sid = conn_pt_handle_test(cc, p);
- sp_event_context_snap_window_open(event_context);
-
if (!cc->sid) {
// This is the first point, so just snap it to the grid
// as there's no other points to go off.
@@ -560,7 +558,7 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const
}
cc_set_active_conn(cc, cc->newconn);
cc->state = SP_CONNECTOR_CONTEXT_IDLE;
- sp_event_context_snap_window_closed(event_context);
+ sp_event_context_discard_delayed_snap_event(event_context);
ret = TRUE;
break;
}
@@ -579,7 +577,7 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const
cc_connector_rerouting_finish(cc, &p);
cc->state = SP_CONNECTOR_CONTEXT_IDLE;
- sp_event_context_snap_window_closed(event_context);
+ sp_event_context_discard_delayed_snap_event(event_context);
// Don't set ret to TRUE, so we drop through to the
// parent handler which will open the context menu.
@@ -587,7 +585,7 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const
else if (cc->npoints != 0) {
spcc_connector_finish(cc);
cc->state = SP_CONNECTOR_CONTEXT_IDLE;
- sp_event_context_snap_window_closed(event_context);
+ sp_event_context_discard_delayed_snap_event(event_context);
ret = TRUE;
}
}
@@ -719,7 +717,7 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con
}
cc_set_active_conn(cc, cc->newconn);
cc->state = SP_CONNECTOR_CONTEXT_IDLE;
- sp_event_context_snap_window_closed(event_context);
+ sp_event_context_discard_delayed_snap_event(event_context);
break;
}
case SP_CONNECTOR_CONTEXT_REROUTING:
@@ -729,7 +727,7 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con
sp_document_ensure_up_to_date(doc);
cc->state = SP_CONNECTOR_CONTEXT_IDLE;
- sp_event_context_snap_window_closed(event_context);
+ sp_event_context_discard_delayed_snap_event(event_context);
return TRUE;
break;
}
if (cc->npoints != 0) {
spcc_connector_finish(cc);
cc->state = SP_CONNECTOR_CONTEXT_IDLE;
- sp_event_context_snap_window_closed(SP_EVENT_CONTEXT(cc));
+ sp_event_context_discard_delayed_snap_event(SP_EVENT_CONTEXT(cc));
ret = TRUE;
}
break;
sp_document_undo(doc);
cc->state = SP_CONNECTOR_CONTEXT_IDLE;
- sp_event_context_snap_window_closed(SP_EVENT_CONTEXT(cc));
+ sp_event_context_discard_delayed_snap_event(SP_EVENT_CONTEXT(cc));
desktop->messageStack()->flash( Inkscape::NORMAL_MESSAGE,
_("Connector endpoint drag cancelled."));
ret = TRUE;
else if (cc->npoints != 0) {
// if drawing, cancel, otherwise pass it up for deselecting
cc->state = SP_CONNECTOR_CONTEXT_STOP;
- sp_event_context_snap_window_closed(SP_EVENT_CONTEXT(cc));
+ sp_event_context_discard_delayed_snap_event(SP_EVENT_CONTEXT(cc));
spcc_reset_colors(cc);
ret = TRUE;
}
cc->clickedhandle = cc->active_handle;
cc_clear_active_conn(cc);
cc->state = SP_CONNECTOR_CONTEXT_REROUTING;
- sp_event_context_snap_window_open(SP_EVENT_CONTEXT(cc));
// Disconnect from attached shape
unsigned ind = (cc->active_handle == cc->endpt_handle[0]) ? 0 : 1;
diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp
index d8fb9d8d5155bfaae2ece3f5da575dd7a980f88d..1fae9367ce22fc9d3442f452047160d06695e09f 100644 (file)
--- a/src/desktop-events.cpp
+++ b/src/desktop-events.cpp
static bool dragging = false;
static SPCanvasItem *guide = NULL;
static Geom::Point normal;
- static bool snap_window_temporarily_open = false;
int wx, wy;
SPDesktop *desktop = dtw->desktop;
if (event->button.button == 1) {
dragging = true;
- // FIXME: The snap delay mechanism won't work here, because it has been implemented
- // for the event context. Dragging guides off the ruler will send event to the ruler
- // and not to the context, which bypasses sp_event_context_snap_delay_handler
- // The snap manager will not notice the difference, so it'll check if the snap delay
- // has been activated (This check is only needed for catching coding errors, i.e.
- // to warn if the snap window has not been implemented properly in some context)
- if (desktop->event_context->_snap_window_open == false) {
- // A dt_ruler_event might be emitted when dragging a guide off the rulers
- // while drawing a Bezier curve. In such a situation, we're already in that
- // specific context and the snap delay is already active. We should not set
- // the snap delay to active again, because that will trigger a similar warning
- // to the one above
- sp_event_context_snap_window_open(desktop->event_context);
- snap_window_temporarily_open = true;
- }
+ // FIXME: The snap delay mechanism won't work here, because it has been implemented for the event context. Dragging
+ // guides off the ruler will send event to the ruler and not to the context, which bypasses sp_event_context_snap_delay_handler
Geom::Point const event_w(sp_canvas_window_to_world(dtw->canvas, event_win));
Geom::Point const event_dt(desktop->w2d(event_w));
@@ -186,11 +172,7 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge
dragging = false;
- // See the comments in GDK_BUTTON_PRESS
- if (snap_window_temporarily_open) {
- sp_event_context_snap_window_closed(desktop->event_context);
- snap_window_temporarily_open = false;
- }
+ sp_event_context_discard_delayed_snap_event(desktop->event_context);
gtk_object_destroy(GTK_OBJECT(guide));
guide = NULL;
@@ -209,7 +191,7 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge
// A dt_ruler_event might be emitted when dragging a guide of the rulers
// while drawing a Bezier curve. In such a situation, we're already in that
// specific context and the snap delay is already active. We should interfere
- // with that context and we should therefore leave the snap delay status
+ // with that context and we should therefore leave the snap delay status
// as it is. So although it might have been set to active above on
// GDK_BUTTON_PRESS, we should not set it back to inactive here. That must be
// done by the context.
// // drag origin to that location so that constrained movement is more intuitive
// Min distance from anchor to initiate rotation, measured in screenpixels
-#define tol 40.0
+#define tol 40.0
gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data)
{
case GDK_2BUTTON_PRESS:
if (event->button.button == 1) {
drag_type = SP_DRAG_NONE;
- sp_event_context_snap_window_closed(desktop->event_context);
+ sp_event_context_discard_delayed_snap_event(desktop->event_context);
sp_canvas_item_ungrab(item, event->button.time);
Inkscape::UI::Dialogs::GuidelinePropertiesDialog::showDialog(guide, desktop);
ret = TRUE;
break;
case GDK_BUTTON_PRESS:
if (event->button.button == 1) {
- sp_event_context_snap_window_open(desktop->event_context);
Geom::Point const event_w(event->button.x, event->button.y);
Geom::Point const event_dt(desktop->w2d(event_w));
desktop->setPosition (from_2geom(event_dt));
}
drag_type = SP_DRAG_NONE;
- sp_event_context_snap_window_closed(desktop->event_context);
+ sp_event_context_discard_delayed_snap_event(desktop->event_context);
sp_canvas_item_ungrab(item, event->button.time);
ret=TRUE;
}
diff --git a/src/event-context.cpp b/src/event-context.cpp
index b1cfac518ba87c801cf3aee994161ac1b33af4cb..753d0679aea0a84e8e65d1ac41aee1b43de46575 100644 (file)
--- a/src/event-context.cpp
+++ b/src/event-context.cpp
@@ -374,7 +374,9 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
switch (event->button.button) {
case 1:
if (event_context->space_panning) {
- panning = 1;
+ // 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(event_context);
+ panning = 1;
sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
GDK_KEY_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK,
NULL, event->button.time-1);
@@ -385,7 +387,9 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
if (event->button.state == GDK_SHIFT_MASK) {
zoom_rb = 2;
} else {
- panning = 2;
+ // 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(event_context);
+ panning = 2;
sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK,
NULL, event->button.time-1);
@@ -395,7 +399,9 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
case 3:
if (event->button.state & GDK_SHIFT_MASK
|| event->button.state & GDK_CONTROL_MASK) {
- panning = 3;
+ // 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(event_context);
+ panning = 3;
sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK,
NULL, event->button.time);
@@ -415,7 +421,7 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
|| (panning == 3 && !(event->motion.state & GDK_BUTTON3_MASK))
) {
/* Gdk seems to lose button release for us sometimes :-( */
- panning = 0;
+ panning = 0;
sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate),
event->button.time);
ret = TRUE;
// Make sure no delayed snapping events are carried over after switching contexts
// (this is only an additional safety measure against sloppy coding, because each
- // context should take care of this by itself. It might be hard to get each and every
- // context perfect though)
- sp_event_context_snap_window_closed(ec, false);
+ // context should take care of this by itself.
+ sp_event_context_discard_delayed_snap_event(ec);
if (((SPEventContextClass *) G_OBJECT_GET_CLASS(ec))->activate)
((SPEventContextClass *) G_OBJECT_GET_CLASS(ec))->activate(ec);
gint
sp_event_context_root_handler(SPEventContext * event_context, GdkEvent * event)
{
- //std::cout << "sp_event_context_root_handler" << std::endl;
- switch (event->type) {
+ switch (event->type) {
case GDK_MOTION_NOTIFY:
sp_event_context_snap_delay_handler(event_context, NULL, NULL, (GdkEventMotion *)event, DelayedSnapEvent::EVENTCONTEXT_ROOT_HANDLER);
break;
gint
sp_event_context_virtual_root_handler(SPEventContext * event_context, GdkEvent * event)
{
- //std::cout << "sp_event_context_virtual_root_handler -> postponed: " << event_context->desktop->namedview->snap_manager.snapprefs.getSnapPostponedGlobally() << std::endl;
-
gint ret = ((SPEventContextClass *) G_OBJECT_GET_CLASS(event_context))->root_handler(event_context, event);
set_event_location(event_context->desktop, event);
return ret;
@@ -942,7 +944,6 @@ sp_event_context_virtual_root_handler(SPEventContext * event_context, GdkEvent *
gint
sp_event_context_item_handler(SPEventContext * event_context, SPItem * item, GdkEvent * event)
{
- //std::cout << "sp_event_context_item_handler" << std::endl;
switch (event->type) {
case GDK_MOTION_NOTIFY:
sp_event_context_snap_delay_handler(event_context, item, NULL, (GdkEventMotion *)event, DelayedSnapEvent::EVENTCONTEXT_ITEM_HANDLER);
@@ -1185,17 +1186,14 @@ void sp_event_context_snap_delay_handler(SPEventContext *ec, SPItem* const item,
// Make sure that we don't send any pending snap events to a context if we know in advance
// that we're not going to snap any way (e.g. while scrolling with middle mouse button)
// Any motion event might affect the state of the context, leading to unexpected behavior
- delete ec->_delayed_snap_event;
- ec->_delayed_snap_event = NULL;
- }
-
- if (ec->_snap_window_open && !c1 && !c2 && ec->desktop && ec->desktop->namedview->snap_manager.snapprefs.getSnapEnabledGlobally()) {
- // Snap when speed drops below e.g. 0.02 px/msec, or when no motion events have occurred for some period.
+ sp_event_context_discard_delayed_snap_event(ec);
+ } else if (ec->desktop && ec->desktop->namedview->snap_manager.snapprefs.getSnapEnabledGlobally()) {
+ // Snap when speed drops below e.g. 0.02 px/msec, or when no motion events have occurred for some period.
// i.e. snap when we're at stand still. A speed threshold enforces snapping for tablets, which might never
// be fully at stand still and might keep spitting out motion events.
- ec->desktop->namedview->snap_manager.snapprefs.setSnapPostponedGlobally(true); // put snapping on hold
+ ec->desktop->namedview->snap_manager.snapprefs.setSnapPostponedGlobally(true); // put snapping on hold
- Geom::Point event_pos(event->x, event->y);
+ Geom::Point event_pos(event->x, event->y);
guint32 event_t = gdk_event_get_time ( (GdkEvent *) event );
if (prev_pos) {
@@ -1232,7 +1230,7 @@ void sp_event_context_snap_delay_handler(SPEventContext *ec, SPItem* const item,
prev_pos = event_pos;
prev_time = event_t;
- }
+ }
}
gboolean sp_event_context_snap_watchdog_callback(gpointer data)
return FALSE; //Kills the timer and stops it from executing this callback over and over again.
}
-void sp_event_context_snap_window_open(SPEventContext *ec, bool show_debug_warnings)
+void sp_event_context_discard_delayed_snap_event(SPEventContext *ec)
{
- // Only when ec->_snap_window_open has been set, Inkscape will know that snapping is active
- // and will delay any snapping events (but only when asked to through the preferences)
-
- // When snapping is being delayed, then that will also mean that at some point the last event
- // might be re-triggered. This should only occur when Inkscape is still in the same tool or context,
- // and even more specifically, the tool should even be in the same state. If for example snapping is being delayed while
- // creating a rectangle, then the rect-context will be active and it will be in the "dragging" state
- // (see the static boolean variable "dragging" in the sp_rect_context_root_handler). The procedure is
- // as follows: call sp_event_context_snap_window_open(*, TRUE) when entering the "dragging" state, which will delay
- // snapping from that moment on, and call sp_event_context_snap_window_open(*, FALSE) when leaving the "dragging"
- // state. This last call will also make sure that any pending snap events will be canceled.
-
- //std::cout << "sp_event_context_snap_window_open" << std::endl;
- if (!ec) {
- if (show_debug_warnings) {
- g_warning("sp_event_context_snap_window_open() has been called without providing an event context!");
- }
- return;
- }
-
- if (ec->_snap_window_open == true && show_debug_warnings) {
- g_warning("Snap window was already open! This is a bug, please report it.");
- }
-
- ec->_snap_window_open = true;
-}
-
-void sp_event_context_snap_window_closed(SPEventContext *ec, bool show_debug_warnings)
-{
- //std::cout << "sp_event_context_snap_window_closed" << std::endl;
- if (!ec) {
- if (show_debug_warnings) {
- g_warning("sp_event_context_snap_window_closed() has been called without providing an event context!");
- }
- return;
- }
-
- if (ec->_snap_window_open == false && show_debug_warnings) {
- g_warning("Snap window was already closed! This is a bug, please report it.");
- }
-
- ec->_snap_window_open = false;
-
delete ec->_delayed_snap_event;
ec->_delayed_snap_event = NULL;
}
diff --git a/src/event-context.h b/src/event-context.h
index 638ac56f744ca2907a1ad317f0b010ea227005ee..5285bdb877938362f21e4c628ebd1184fdf5b83a 100644 (file)
--- a/src/event-context.h
+++ b/src/event-context.h
}
gboolean sp_event_context_snap_watchdog_callback(gpointer data);
-void sp_event_context_snap_window_open(SPEventContext *ec, bool show_debug_warnings = true);
-void sp_event_context_snap_window_closed(SPEventContext *ec, bool show_debug_warnings = true);
+void sp_event_context_discard_delayed_snap_event(SPEventContext *ec);
class DelayedSnapEvent
{
bool space_panning;
- bool _snap_window_open;
DelayedSnapEvent *_delayed_snap_event;
};
index b4eeda2905dde99800d7be3e2f392454fc372758..fc5c1af446593c0db42626003aab45e8d9ec11bc 100644 (file)
--- a/src/gradient-context.cpp
+++ b/src/gradient-context.cpp
@@ -556,7 +556,6 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event)
if (!(event->button.state & GDK_CONTROL_MASK))
event_context->item_to_select = sp_event_context_find_item (desktop, button_w, event->button.state & GDK_MOD1_MASK, TRUE);
- sp_event_context_snap_window_open(event_context, false);
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop);
m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, button_dt, Inkscape::SNAPSOURCE_HANDLE);
diff --git a/src/knot.cpp b/src/knot.cpp
index 1ac5d887b95fd1cba8d1bb02fbff48174069b6a9..b17e41b243bf9b640365be12de1f755cd5f9b7f4 100644 (file)
--- a/src/knot.cpp
+++ b/src/knot.cpp
*/
static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot)
{
- static bool snap_delay_temporarily_active = false;
-
g_assert(knot != NULL);
g_assert(SP_IS_KNOT(knot));
@@ -317,11 +315,7 @@ static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot
if (event->button.button == 1 && !knot->desktop->event_context->space_panning) {
Geom::Point const p = knot->desktop->w2d(Geom::Point(event->button.x, event->button.y));
sp_knot_start_dragging(knot, p, (gint) event->button.x, (gint) event->button.y, event->button.time);
- if (knot->desktop->event_context->_snap_window_open == false) {
- sp_event_context_snap_window_open(knot->desktop->event_context);
- snap_delay_temporarily_active = true;
- }
- consumed = TRUE;
+ consumed = TRUE;
}
break;
case GDK_BUTTON_RELEASE:
@@ -331,13 +325,7 @@ static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot
sp_event_context_snap_watchdog_callback(knot->desktop->event_context->_delayed_snap_event);
}
- // now we can safely close the snapping window
- if (snap_delay_temporarily_active) {
- if (knot->desktop->event_context->_snap_window_open == true) {
- sp_event_context_snap_window_closed(knot->desktop->event_context);
- }
- snap_delay_temporarily_active = false;
- }
+ sp_event_context_discard_delayed_snap_event(knot->desktop->event_context);
knot->pressure = 0;
if (transform_escaped) {
@@ -446,10 +434,7 @@ static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot
}
grabbed = FALSE;
moved = FALSE;
- if (snap_delay_temporarily_active) {
- sp_event_context_snap_window_closed(knot->desktop->event_context);
- snap_delay_temporarily_active = false;
- }
+ sp_event_context_discard_delayed_snap_event(knot->desktop->event_context);
break;
default:
consumed = FALSE;
diff --git a/src/knotholder.cpp b/src/knotholder.cpp
index 773b9249c513a7a804a19116f56cddd3f545d4ff..55a171414e58ee59144961b62c4cfd3e1f0734e9 100644 (file)
--- a/src/knotholder.cpp
+++ b/src/knotholder.cpp
{
if (this->dragging == false) {
this->dragging = true;
- //sp_event_context_snap_window_open(desktop->canvas);
}
// this was a local change and the knotholder does not need to be recreated:
KnotHolder::knot_ungrabbed_handler(SPKnot */*knot*/)
{
this->dragging = false;
- //sp_event_context_snap_window_closed(desktop->canvas);
if (this->released) {
this->released(this->item);
diff --git a/src/node-context.cpp b/src/node-context.cpp
index 6ad7b85d429b8762cee096ba267a233608b12cc6..a0fb78ba19cd737a7e1c273d79de5b86b37bbc78 100644 (file)
--- a/src/node-context.cpp
+++ b/src/node-context.cpp
nc->remove_flash_counter--;
}
- sp_event_context_snap_window_open(event_context, false); // Just put the snap window open, bluntly. Will be closed when we have left the context
-
gint ret = FALSE;
switch (event->type) {
case GDK_BUTTON_PRESS:
diff --git a/src/nodepath.cpp b/src/nodepath.cpp
index 8a47b658bffa08ef31f77500baa2ecb18e260f38..f9a615583fa438c8689eaec09dfeabe9a88dc656 100644 (file)
--- a/src/nodepath.cpp
+++ b/src/nodepath.cpp
}
n->is_dragging = true;
- //sp_event_context_snap_window_open(n->subpath->nodepath->desktop->canvas);
// Reconstruct and store the location of the mouse pointer at the time when we started dragging (needed for snapping)
n->subpath->nodepath->drag_origin_mouse = knot->grabbed_rel_pos + knot->drag_origin;
n->dragging_out = NULL;
n->is_dragging = false;
- //sp_event_context_snap_window_closed(n->subpath->nodepath->desktop->canvas);
n->subpath->nodepath->drag_origin_mouse = Geom::Point(NR_HUGE, NR_HUGE);
sp_canvas_end_forced_full_redraws(n->subpath->nodepath->desktop->canvas);
diff --git a/src/pen-context.cpp b/src/pen-context.cpp
index 261c7d4cf69276e37348c3f1eea0b20391c0c487..4c9627071b4f420686161e9e2ba65a4893640810 100644 (file)
--- a/src/pen-context.cpp
+++ b/src/pen-context.cpp
{
SPPenContext *pc = SP_PEN_CONTEXT(ec);
- sp_event_context_snap_window_closed(ec, false); //TODO: Detailed implementation of the snap window; now it's simply always open
+ sp_event_context_discard_delayed_snap_event(ec);
if (pc->npoints != 0) {
pen_cancel (pc);
{
SPPenContext *const pc = SP_PEN_CONTEXT(ec);
- sp_event_context_snap_window_open(ec, false); //TODO: Detailed implementation of the snap window; now it's simply always open
-
gint ret = FALSE;
switch (event->type) {
diff --git a/src/pencil-context.cpp b/src/pencil-context.cpp
index 4b87e86b55a0e7c517c85abb039b2d67169ddfd8..31b7441d4779770cc399b851308b77534e70bc36 100644 (file)
--- a/src/pencil-context.cpp
+++ b/src/pencil-context.cpp
@@ -255,7 +255,6 @@ pencil_handle_button_press(SPPencilContext *const pc, GdkEventButton const &beve
/* Set first point of sequence */
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop);
- sp_event_context_snap_window_open(event_context);
if (anchor) {
p = anchor->dp;
@@ -349,7 +348,7 @@ pencil_handle_motion_notify(SPPencilContext *const pc, GdkEventMotion const &mev
/* We may be idle or already freehand */
if ( mevent.state & GDK_BUTTON1_MASK && pc->is_drawing ) {
if (pc->state == SP_PENCIL_CONTEXT_IDLE) {
- sp_event_context_snap_window_closed(event_context);
+ sp_event_context_discard_delayed_snap_event(event_context);
}
pc->state = SP_PENCIL_CONTEXT_FREEHAND;
@@ -417,7 +416,6 @@ pencil_handle_button_release(SPPencilContext *const pc, GdkEventButton const &re
/* Releasing button in idle mode means single click */
/* We have already set up start point/anchor in button_press */
pc->state = SP_PENCIL_CONTEXT_ADDLINE;
- //sp_event_context_snap_window_open(dt->canvas);
ret = TRUE;
break;
case SP_PENCIL_CONTEXT_ADDLINE:
@@ -431,7 +429,7 @@ pencil_handle_button_release(SPPencilContext *const pc, GdkEventButton const &re
spdc_set_endpoint(pc, p);
spdc_finish_endpoint(pc);
pc->state = SP_PENCIL_CONTEXT_IDLE;
- sp_event_context_snap_window_closed(event_context);
+ sp_event_context_discard_delayed_snap_event(event_context);
ret = TRUE;
break;
case SP_PENCIL_CONTEXT_FREEHAND:
@@ -445,7 +443,6 @@ pencil_handle_button_release(SPPencilContext *const pc, GdkEventButton const &re
}
pc->state = SP_PENCIL_CONTEXT_SKETCH;
- //sp_event_context_snap_window_open(dt->canvas);
} else {
/* Finish segment now */
/// \todo fixme: Clean up what follows (Lauris)
@@ -465,7 +462,6 @@ pencil_handle_button_release(SPPencilContext *const pc, GdkEventButton const &re
pc->green_anchor = sp_draw_anchor_destroy(pc->green_anchor);
}
pc->state = SP_PENCIL_CONTEXT_IDLE;
- // sp_event_context_snap_window_closed(dt->canvas);
// reset sketch mode too
pc->sketch_n = 0;
}
pc->is_drawing = false;
pc->state = SP_PENCIL_CONTEXT_IDLE;
- sp_event_context_snap_window_closed(SP_EVENT_CONTEXT(pc));
+ sp_event_context_discard_delayed_snap_event(SP_EVENT_CONTEXT(pc));
pc->red_curve->reset();
sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), NULL);
@@ -589,7 +585,7 @@ pencil_handle_key_release(SPPencilContext *const pc, guint const keyval, guint c
pc->green_anchor = sp_draw_anchor_destroy(pc->green_anchor);
}
pc->state = SP_PENCIL_CONTEXT_IDLE;
- sp_event_context_snap_window_closed(SP_EVENT_CONTEXT(pc));
+ sp_event_context_discard_delayed_snap_event(SP_EVENT_CONTEXT(pc));
pc->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Finishing freehand sketch"));
ret = TRUE;
}
diff --git a/src/rect-context.cpp b/src/rect-context.cpp
index 51b5f2e859c7f33b45bd487706d7a095c5baa122..ef5881378fd0fd7b17fcafdfdc1ebacfc958426d 100644 (file)
--- a/src/rect-context.cpp
+++ b/src/rect-context.cpp
@@ -258,7 +258,6 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent
event_context->item_to_select = sp_event_context_find_item (desktop, button_w, event->button.state & GDK_MOD1_MASK, TRUE);
dragging = true;
- sp_event_context_snap_window_open(event_context);
/* Position center */
Geom::Point button_dt(desktop->w2d(button_w));
@@ -307,7 +306,7 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent
event_context->xp = event_context->yp = 0;
if (event->button.button == 1 && !event_context->space_panning) {
dragging = false;
- sp_event_context_snap_window_closed(event_context, false); //button release will also occur on a double-click; in that case suppress warnings
+ sp_event_context_discard_delayed_snap_event(event_context);
if (!event_context->within_tolerance) {
// we've been dragging, finish the rect
@@ -375,7 +374,7 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent
case GDK_Escape:
if (dragging) {
dragging = false;
- sp_event_context_snap_window_closed(event_context);
+ sp_event_context_discard_delayed_snap_event(event_context);
// if drawing, cancel, otherwise pass it up for deselecting
sp_rect_cancel(rc);
ret = TRUE;
@@ -387,7 +386,7 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent
sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate),
event->button.time);
dragging = false;
- sp_event_context_snap_window_closed(event_context);
+ sp_event_context_discard_delayed_snap_event(event_context);
if (!event_context->within_tolerance) {
// we've been dragging, finish the rect
sp_rect_finish(rc);
diff --git a/src/select-context.cpp b/src/select-context.cpp
index aed594feeaaece89eeb7ee3644b1527b093001f0..a5f5202ae5771ff0dddad8125168efff921a2121 100644 (file)
--- a/src/select-context.cpp
+++ b/src/select-context.cpp
seltrans->ungrab();
sc->moved = FALSE;
sc->dragging = FALSE;
- sp_event_context_snap_window_closed(event_context);
+ sp_event_context_discard_delayed_snap_event(event_context);
drag_escaped = 1;
if (sc->item) {
@@ -324,7 +324,6 @@ sp_select_context_item_handler(SPEventContext *event_context, SPItem *item, GdkE
// pass the event to root handler which will perform rubberband, shift-click, ctrl-click, ctrl-drag
} else {
sc->dragging = TRUE;
- sp_event_context_snap_window_open(event_context);
sc->moved = FALSE;
sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5);
desktop->setCurrentLayer(reinterpret_cast<SPObject *>(clicked_item));
sp_desktop_selection(desktop)->clear();
sc->dragging = false;
- sp_event_context_snap_window_closed(event_context);
+ sp_event_context_discard_delayed_snap_event(event_context);
sp_canvas_end_forced_full_redraws(desktop->canvas);
} else { // switch tool
if (sc->button_press_ctrl || (sc->button_press_alt && !sc->button_press_shift && !selection->isEmpty())) {
// if it's not click and ctrl or alt was pressed (the latter with some selection
// but not with shift) we want to drag rather than rubberband
- if (sc->dragging == FALSE) {
- sp_event_context_snap_window_open(event_context);
- }
sc->dragging = TRUE;
sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5);
ret = TRUE;
} else {
sc->dragging = FALSE;
- sp_event_context_snap_window_closed(event_context);
+ sp_event_context_discard_delayed_snap_event(event_context);
sp_canvas_end_forced_full_redraws(desktop->canvas);
}
} else {
}
}
sc->dragging = FALSE;
- sp_event_context_snap_window_closed(event_context);
+ sp_event_context_discard_delayed_snap_event(event_context);
sp_canvas_end_forced_full_redraws(desktop->canvas);
if (sc->item) {
diff --git a/src/seltrans.cpp b/src/seltrans.cpp
index 3bd5f611ae37e345265ca546f6c6b9ec9c5a07a2..c3c84114994288e97eda05842674d7866fd945d1 100644 (file)
--- a/src/seltrans.cpp
+++ b/src/seltrans.cpp
@@ -376,8 +376,6 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s
}
}
- //sp_event_context_snap_window_open(_desktop->event_context);
-
if ((x != -1) && (y != -1)) {
sp_canvas_item_show(_norm);
sp_canvas_item_show(_grip);
_grabbed = false;
_show_handles = true;
- //sp_event_context_snap_window_closed(_desktop->event_context);
-
_desktop->snapindicator->remove_snapsource();
Inkscape::Selection *selection = sp_desktop_selection(_desktop);
diff --git a/src/snap.cpp b/src/snap.cpp
index 91d5d64ec4dec853b1c67b2f9e365b7d9595e53e..4d5dad55a53b2289341c9457e7cf12549846a983 100644 (file)
--- a/src/snap.cpp
+++ b/src/snap.cpp
@@ -206,13 +206,6 @@ Inkscape::SnappedPoint SnapManager::freeSnap(Inkscape::SnapPreferences::PointTyp
bool first_point,
Geom::OptRect const &bbox_to_snap) const
{
- if (_desktop->event_context && _desktop->event_context->_snap_window_open == false) {
- g_warning("The current tool tries to snap, but it hasn't yet opened the snap window. Please report this!");
- // When the context goes into dragging-mode, then Inkscape should call this: sp_event_context_snap_window_open(event_context);
- }
-
- //std::cout << "SnapManager::freeSnap -> postponed: " << snapprefs.getSnapPostponedGlobally() << std::endl;
-
if (!someSnapperMightSnap()) {
return Inkscape::SnappedPoint(p, source_type, Inkscape::SNAPTARGET_UNDEFINED, NR_HUGE, 0, false, false);
}
@@ -371,12 +364,7 @@ Inkscape::SnappedPoint SnapManager::constrainedSnap(Inkscape::SnapPreferences::P
bool first_point,
Geom::OptRect const &bbox_to_snap) const
{
- if (_desktop->event_context && _desktop->event_context->_snap_window_open == false) {
- g_warning("The current tool tries to snap, but it hasn't yet opened the snap window. Please report this!");
- // When the context goes into dragging-mode, then Inkscape should call this: sp_event_context_snap_window_open(event_context);
- }
-
- if (!someSnapperMightSnap()) {
+ if (!someSnapperMightSnap()) {
return Inkscape::SnappedPoint(p, source_type, Inkscape::SNAPTARGET_UNDEFINED, NR_HUGE, 0, false, false);
}
@@ -419,11 +407,6 @@ Inkscape::SnappedPoint SnapManager::constrainedSnap(Inkscape::SnapPreferences::P
*/
void SnapManager::guideFreeSnap(Geom::Point &p, Geom::Point const &guide_normal) const
{
- if (_desktop->event_context && _desktop->event_context->_snap_window_open == false) {
- g_warning("The current tool tries to snap, but it hasn't yet opened the snap window. Please report this!");
- // When the context goes into dragging-mode, then Inkscape should call this: sp_event_context_snap_window_open(event_context);
- }
-
if (!snapprefs.getSnapEnabledGlobally() || snapprefs.getSnapPostponedGlobally()) {
return;
}
@@ -465,12 +448,7 @@ void SnapManager::guideFreeSnap(Geom::Point &p, Geom::Point const &guide_normal)
void SnapManager::guideConstrainedSnap(Geom::Point &p, SPGuide const &guideline) const
{
- if (_desktop->event_context && _desktop->event_context->_snap_window_open == false) {
- g_warning("The current tool tries to snap, but it hasn't yet opened the snap window. Please report this!");
- // When the context goes into dragging-mode, then Inkscape should call this: sp_event_context_snap_window_open(event_context);
- }
-
- if (!snapprefs.getSnapEnabledGlobally() || snapprefs.getSnapPostponedGlobally()) {
+ if (!snapprefs.getSnapEnabledGlobally() || snapprefs.getSnapPostponedGlobally()) {
return;
}
diff --git a/src/spiral-context.cpp b/src/spiral-context.cpp
index 2f65b0ba9f3ea4c1f255a5a38c8aaa44d58f62a9..5c7c43c83808f325d5ada1ccbb1424b33ab6f392 100644 (file)
--- a/src/spiral-context.cpp
+++ b/src/spiral-context.cpp
if (event->button.button == 1 && !event_context->space_panning) {
dragging = TRUE;
- sp_event_context_snap_window_open(event_context);
sc->center = Inkscape::setup_for_drag_start(desktop, event_context, event);
SnapManager &m = desktop->namedview->snap_manager;
event_context->xp = event_context->yp = 0;
if (event->button.button == 1 && !event_context->space_panning) {
dragging = FALSE;
- sp_event_context_snap_window_closed(event_context, false); //button release will also occur on a double-click; in that case suppress warnings
+ sp_event_context_discard_delayed_snap_event(event_context);
if (!event_context->within_tolerance) {
// we've been dragging, finish the spiral
sp_spiral_finish(sc);
case GDK_Escape:
if (dragging) {
dragging = false;
- sp_event_context_snap_window_closed(event_context);
+ sp_event_context_discard_delayed_snap_event(event_context);
// if drawing, cancel, otherwise pass it up for deselecting
sp_spiral_cancel(sc);
ret = TRUE;
sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate),
event->button.time);
dragging = false;
- sp_event_context_snap_window_closed(event_context);
+ sp_event_context_discard_delayed_snap_event(event_context);
if (!event_context->within_tolerance) {
// we've been dragging, finish the spiral
sp_spiral_finish(sc);
diff --git a/src/star-context.cpp b/src/star-context.cpp
index f0c64e875e0277a8bb77ec8a831dc9df42095550..80d378f27f69ecb3495826cbc8a079d14a205e04 100644 (file)
--- a/src/star-context.cpp
+++ b/src/star-context.cpp
@@ -236,7 +236,6 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent
if (event->button.button == 1 && !event_context->space_panning) {
dragging = TRUE;
- sp_event_context_snap_window_open(event_context);
sc->center = Inkscape::setup_for_drag_start(desktop, event_context, event);
@@ -283,7 +282,7 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent
event_context->xp = event_context->yp = 0;
if (event->button.button == 1 && !event_context->space_panning) {
dragging = FALSE;
- sp_event_context_snap_window_closed(event_context, false); //button release will also occur on a double-click; in that case suppress warnings
+ sp_event_context_discard_delayed_snap_event(event_context);
if (!event_context->within_tolerance) {
// we've been dragging, finish the star
sp_star_finish (sc);
@@ -336,7 +335,7 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent
case GDK_Escape:
if (dragging) {
dragging = false;
- sp_event_context_snap_window_closed(event_context);
+ sp_event_context_discard_delayed_snap_event(event_context);
// if drawing, cancel, otherwise pass it up for deselecting
sp_star_cancel(sc);
ret = TRUE;
@@ -347,7 +346,7 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent
sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate),
event->button.time);
dragging = false;
- sp_event_context_snap_window_closed(event_context);
+ sp_event_context_discard_delayed_snap_event(event_context);
if (!event_context->within_tolerance) {
// we've been dragging, finish the star
sp_star_finish(sc);
diff --git a/src/text-context.cpp b/src/text-context.cpp
index 538e13e433e1a57e4c5325c40bd96f0821c65446..c1986972a9957ac43f7e811fe81c35909c9b49c0 100644 (file)
--- a/src/text-context.cpp
+++ b/src/text-context.cpp
@@ -352,7 +352,6 @@ sp_text_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEve
sp_text_context_update_cursor(tc);
sp_text_context_update_text_selection(tc);
tc->dragging = 1;
- sp_event_context_snap_window_open(event_context);
}
ret = TRUE;
}
@@ -369,7 +368,6 @@ sp_text_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEve
sp_text_context_update_cursor(tc);
sp_text_context_update_text_selection(tc);
tc->dragging = 2;
- sp_event_context_snap_window_open(event_context);
ret = TRUE;
}
}
@@ -381,14 +379,13 @@ sp_text_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEve
sp_text_context_update_cursor(tc);
sp_text_context_update_text_selection(tc);
tc->dragging = 3;
- sp_event_context_snap_window_open(event_context);
ret = TRUE;
}
break;
case GDK_BUTTON_RELEASE:
if (event->button.button == 1 && tc->dragging && !event_context->space_panning) {
tc->dragging = 0;
- sp_event_context_snap_window_closed(event_context, false); //button release will also occur on a double-click; in that case suppress warnings
+ sp_event_context_discard_delayed_snap_event(event_context);
ret = TRUE;
}
break;