summaryrefslogtreecommitdiffstats
path: root/src/nodepath.cpp
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2008-07-11 15:35:35 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2008-07-11 15:35:35 +0000
commit1e986f9a76a424f12525f59aeff425f426a2a14f (patch)
tree7423988b6aa8a937882d7851f33e62686b2f92bd /src/nodepath.cpp
parentSwitched three verbs/icons over to standard names and thus themed loading (diff)
downloadinkscape-1e986f9a76a424f12525f59aeff425f426a2a14f.tar.gz
inkscape-1e986f9a76a424f12525f59aeff425f426a2a14f.zip
apply patch by Stefaan, fixes bug #168589
(bzr r6258)
Diffstat (limited to 'src/nodepath.cpp')
-rw-r--r--src/nodepath.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/nodepath.cpp b/src/nodepath.cpp
index b712539ab..8bd7787e1 100644
--- a/src/nodepath.cpp
+++ b/src/nodepath.cpp
@@ -885,17 +885,23 @@ static Inkscape::NodePath::Node *sp_nodepath_node_break(Inkscape::NodePath::Node
Inkscape::NodePath::SubPath *newsubpath = sp_nodepath_subpath_new(np);
// duplicate the break node as start of the new subpath
- Inkscape::NodePath::Node *newnode = sp_nodepath_node_new(newsubpath, NULL, (Inkscape::NodePath::NodeType)node->type, NR_MOVETO, &node->pos, &node->pos, &node->n.pos);
-
- while (node->n.other) { // copy the remaining nodes into the new subpath
- Inkscape::NodePath::Node *n = node->n.other;
- Inkscape::NodePath::Node *nn = sp_nodepath_node_new(newsubpath, NULL, (Inkscape::NodePath::NodeType)n->type, (NRPathcode)n->code, &n->p.pos, &n->pos, &n->n.pos);
- if (n->selected) {
- sp_nodepath_node_select(nn, TRUE, TRUE); //preserve selection
- }
- sp_nodepath_node_destroy(n); // remove the point on the original subpath
+ Inkscape::NodePath::Node *newnode = sp_nodepath_node_new(newsubpath, NULL, (Inkscape::NodePath::NodeType)node->type, NR_MOVETO, &node->pos, &node->pos, &node->n.pos);
+
+ // attach rest of curve to new node
+ g_assert(node->n.other);
+ newnode->n.other = node->n.other; node->n.other = NULL;
+ newnode->n.other->p.other = newnode;
+ newsubpath->last = sp->last;
+ sp->last = node;
+ node = newnode;
+ while (node->n.other) {
+ node = node->n.other;
+ node->subpath = newsubpath;
+ sp->nodes = g_list_remove(sp->nodes, node);
+ newsubpath->nodes = g_list_prepend(newsubpath->nodes, node);
}
+
return newnode;
}
}
@@ -1985,13 +1991,15 @@ void sp_node_selected_break(Inkscape::NodePath::Path *nodepath)
{
if (!nodepath) return;
+ GList *tempin = g_list_copy(nodepath->selected);
GList *temp = NULL;
- for (GList *l = nodepath->selected; l != NULL; l = l->next) {
+ for (GList *l = tempin; l != NULL; l = l->next) {
Inkscape::NodePath::Node *n = (Inkscape::NodePath::Node *) l->data;
Inkscape::NodePath::Node *nn = sp_nodepath_node_break(n);
if (nn == NULL) continue; // no break, no new node
temp = g_list_prepend(temp, nn);
}
+ g_list_free(tempin);
if (temp) {
sp_nodepath_deselect(nodepath);