summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 68434bf)
raw | patch | inline | side by side (parent: 68434bf)
author | dvlierop2 <dvlierop2@users.sourceforge.net> | |
Mon, 23 Feb 2009 21:25:08 +0000 (21:25 +0000) | ||
committer | dvlierop2 <dvlierop2@users.sourceforge.net> | |
Mon, 23 Feb 2009 21:25:08 +0000 (21:25 +0000) |
src/gradient-drag.cpp | patch | blob | history | |
src/node-context.cpp | patch | blob | history | |
src/widgets/toolbox.cpp | patch | blob | history |
diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp
index 76bed32cf5c1e3a953489a030e2f68e9958ad347..6d8815938af690f41a91d1aecc85c80cd9ae5f16 100644 (file)
--- a/src/gradient-drag.cpp
+++ b/src/gradient-drag.cpp
@@ -541,8 +541,9 @@ gr_knot_moved_handler(SPKnot *knot, Geom::Point const &ppointer, guint state, gp
Geom::Point p = ppointer;
- // FIXME: take from prefs
- double snap_dist = SNAP_DIST / dragger->parent->desktop->current_zoom();
+ SPDesktop *desktop = dragger->parent->desktop;
+ SnapManager &m = desktop->namedview->snap_manager;
+ double snap_dist = m.snapprefs.getObjectTolerance() / dragger->parent->desktop->current_zoom();
if (state & GDK_SHIFT_MASK) {
// with Shift; unsnap if we carry more than one draggable
@@ -595,14 +596,12 @@ gr_knot_moved_handler(SPKnot *knot, Geom::Point const &ppointer, guint state, gp
if (!((state & GDK_SHIFT_MASK) || ((state & GDK_CONTROL_MASK) && (state & GDK_MOD1_MASK)))) {
// Try snapping to the grid or guides
- SPDesktop *desktop = dragger->parent->desktop;
- SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop);
Inkscape::SnappedPoint s = m.freeSnap(Inkscape::SnapPreferences::SNAPPOINT_NODE, to_2geom(p), Inkscape::SNAPSOURCE_HANDLE);
if (s.getSnapped()) {
p = s.getPoint();
sp_knot_moveto (knot, p);
- } else {
+ } else if (m.snapprefs.getSnapEnabledGlobally() && m.snapprefs.getSnapModeNode() && !(m.snapprefs.getSnapPostponedGlobally())) {
bool was_snapped = false;
double dist = NR_HUGE;
// No snapping so far, let's see if we need to snap to any of the levels
diff --git a/src/node-context.cpp b/src/node-context.cpp
index ec86a4c8096a82311172a5a2d5bc7eae2ed647f8..4a36c5d615eef273386dd3088e7000fad33ac6af 100644 (file)
--- a/src/node-context.cpp
+++ b/src/node-context.cpp
node_context->rightalt = FALSE;
node_context->leftctrl = FALSE;
node_context->rightctrl = FALSE;
-
+
new (&node_context->sel_changed_connection) sigc::connection();
node_context->flash_tempitem = NULL;
static void
sp_node_context_dispose(GObject *object)
{
- SPNodeContext *nc = SP_NODE_CONTEXT(object);
+ SPNodeContext *nc = SP_NODE_CONTEXT(object);
SPEventContext *ec = SP_EVENT_CONTEXT(object);
+ sp_canvas_set_snap_delay_active(ec->desktop->canvas, false);
+
ec->enableGrDrag(false);
nc->sel_changed_connection.disconnect();
nc->_node_message_context = new Inkscape::MessageContext((ec->desktop)->messageStack());
ec->shape_editor->update_statusbar();
+
+ sp_canvas_set_snap_delay_active(ec->desktop->canvas, true);
}
static void
@@ -195,7 +199,7 @@ sp_node_context_flash_path(SPEventContext *event_context, SPItem *item, guint ti
} else {
g_print ("-----> sp_node_context_flash_path(): TODO: generate the helper path!!\n");
}
-
+
if (canvasitem) {
nc->flash_tempitem = desktop->add_temporary_canvasitem (canvasitem, timeout);
}
@@ -214,7 +218,7 @@ sp_node_context_selection_changed(Inkscape::Selection *selection, gpointer data)
// TODO: update ShapeEditorsCollective instead
ec->shape_editor->unset_item(SH_NODEPATH);
ec->shape_editor->unset_item(SH_KNOTHOLDER);
- SPItem *item = selection->singleItem();
+ SPItem *item = selection->singleItem();
ec->shape_editor->set_item(item, SH_NODEPATH);
ec->shape_editor->set_item(item, SH_KNOTHOLDER);
ec->shape_editor->update_statusbar();
// The path went away while dragging; throw away any further motion
// events until the mouse pointer is released.
-
+
if (se->hits_curve() && !se->has_nodepath()) {
break;
}
ret = TRUE;
break;
}
- }
+ }
if (event->type == GDK_BUTTON_RELEASE) {
event_context->xp = event_context->yp = 0;
if (event->button.button == 1) {
index e3dcbcc14a9ebfd3bd63ea2d879633c7e74f32e7..3049d53e7f9dee784f33a96fccdddc04ae8b07a6 100644 (file)
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
Inkscape::IconSize secondarySize = prefToSize("/toolbox/secondary", 1);
{
- InkToggleAction* act = ink_toggle_action_new("ToggleSnapGlobal",
+ InkToggleAction* act = ink_toggle_action_new("ToggleSnapGlobal",
_("Snap"), _("Enable snapping"), INKSCAPE_ICON_SNAP, secondarySize,
SP_ATTR_INKSCAPE_SNAP_GLOBAL);
{
InkToggleAction* act = ink_toggle_action_new("ToggleSnapFromNode",
- _("Nodes"), _("Snap nodes"), INKSCAPE_ICON_SNAP_NODES, secondarySize, SP_ATTR_INKSCAPE_SNAP_NODES);
+ _("Nodes"), _("Snap nodes or handles"), INKSCAPE_ICON_SNAP_NODES, secondarySize, SP_ATTR_INKSCAPE_SNAP_NODES);
gtk_action_group_add_action( mainActions->gobj(), GTK_ACTION( act ) );
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(toggle_snap_callback), toolbox );