summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b883766)
raw | patch | inline | side by side (parent: b883766)
| author | buliabyak <buliabyak@users.sourceforge.net> | |
| Fri, 5 Jan 2007 13:46:30 +0000 (13:46 +0000) | ||
| committer | buliabyak <buliabyak@users.sourceforge.net> | |
| Fri, 5 Jan 2007 13:46:30 +0000 (13:46 +0000) |
| src/node-context.cpp | patch | blob | history | |
| src/node-context.h | patch | blob | history | |
| src/nodepath.cpp | patch | blob | history | |
| src/nodepath.h | patch | blob | history |
diff --git a/src/node-context.cpp b/src/node-context.cpp
index 2b30d067b66449620c84e5ba5baaaf83e0c8f410..a4a51f676a6636f55596882cfbb356ef803dd37c 100644 (file)
--- a/src/node-context.cpp
+++ b/src/node-context.cpp
}
if (nc->nodepath) {
+ nc->grab_node = -1;
sp_nodepath_destroy(nc->nodepath);
nc->nodepath = NULL;
}
Inkscape::Selection *selection = sp_desktop_selection(ec->desktop);
SPItem *item = selection->singleItem();
+ nc->grab_node = -1;
nc->nodepath = NULL;
ec->shape_knot_holder = NULL;
@@ -223,6 +225,7 @@ sp_node_context_selection_changed(Inkscape::Selection *selection, gpointer data)
if (nc->nodepath) {
old_repr = nc->nodepath->repr;
+ nc->grab_node = -1;
sp_nodepath_destroy(nc->nodepath);
nc->nodepath = NULL;
}
@@ -240,6 +243,7 @@ sp_node_context_selection_changed(Inkscape::Selection *selection, gpointer data)
SPItem *item = selection->singleItem();
SPDesktop *desktop = selection->desktop();
+ nc->grab_node = -1;
nc->nodepath = NULL;
ec->shape_knot_holder = NULL;
if (item) {
g_assert(desktop);
if (nc->nodepath) {
+ nc->grab_node = -1;
sp_nodepath_destroy(nc->nodepath);
nc->nodepath = NULL;
}
@@ -395,7 +400,7 @@ sp_node_context_is_over_stroke (SPNodeContext *nc, SPItem *item, NR::Point event
nc->curvepoint_event[NR::Y] = (gint) event_p [NR::Y];
nc->hit = true;
nc->grab_t = position.assume().t;
- nc->grab_node = sp_nodepath_get_node_by_index(position.assume().piece);
+ nc->grab_node = position.assume().piece;
}
return close;
switch (nc->current_state) {
case SP_NODE_CONTEXT_NODE_DRAGGING:
{
+ if (nc->grab_node == -1) // don't know which segment to drag
+ break;
+
// We round off the extra precision in the motion coordinates provided
// by some input devices (like tablets). As we'll store the coordinates
// as integers in curvepoint_event we need to do this rounding before
diff --git a/src/node-context.h b/src/node-context.h
index d5067a66a751dbbdeddff6448ef34ec97682f20a..fae95cf433ee33a133c213eadcc87f53757911be 100644 (file)
--- a/src/node-context.h
+++ b/src/node-context.h
Inkscape::MessageContext *_node_message_context;
double grab_t;
- Inkscape::NodePath::Node * grab_node;
+ int grab_node; // number of node grabbed by sp_node_context_is_over_stroke
bool hit;
NR::Point curvepoint_event; // int coords from event
NR::Point curvepoint_doc; // same, in doc coords
diff --git a/src/nodepath.cpp b/src/nodepath.cpp
index e58a8b31da3056c9494ff62163559b3d6bc2f186..8371c8241825d00a153c1305b2de858b44c75a0a 100644 (file)
--- a/src/nodepath.cpp
+++ b/src/nodepath.cpp
@@ -1608,8 +1608,10 @@ sp_nodepath_add_node_near_point(Inkscape::NodePath::Path *nodepath, NR::Point p)
* cf. app/vectors/gimpbezierstroke.c, gimp_bezier_stroke_point_move_relative()
*/
void
-sp_nodepath_curve_drag(Inkscape::NodePath::Node * e, double t, NR::Point delta)
+sp_nodepath_curve_drag(int node, double t, NR::Point delta)
{
+ Inkscape::NodePath::Node *e = sp_nodepath_get_node_by_index(node);
+
//fixme: e and e->p can be NULL, so check for those before proceeding
g_return_if_fail(e != NULL);
g_return_if_fail(&e->p != NULL);
diff --git a/src/nodepath.h b/src/nodepath.h
index 0216af730952a00c19527a35e89ffdacda4acf07..b675863d50d24d9903c0978fd454b8f23d44e3ab 100644 (file)
--- a/src/nodepath.h
+++ b/src/nodepath.h
@@ -263,7 +263,7 @@ void sp_nodepath_selected_align(Inkscape::NodePath::Path *nodepath, NR::Dim2 axi
void sp_nodepath_selected_distribute(Inkscape::NodePath::Path *nodepath, NR::Dim2 axis);
void sp_nodepath_select_segment_near_point(Inkscape::NodePath::Path *nodepath, NR::Point p, bool toggle);
void sp_nodepath_add_node_near_point(Inkscape::NodePath::Path *nodepath, NR::Point p);
-void sp_nodepath_curve_drag(Inkscape::NodePath::Node * e, double t, NR::Point delta);
+void sp_nodepath_curve_drag(int node, double t, NR::Point delta);
Inkscape::NodePath::Node * sp_nodepath_get_node_by_index(int index);
/* possibly private functions */