From e00ac80a336aaafb2aa544b72e949351fe78456a Mon Sep 17 00:00:00 2001 From: John Smith Date: Sun, 1 Apr 2012 10:59:30 +0900 Subject: Fix for 627728 : Make newly added gradient stop active (bzr r11135) --- src/gradient-context.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/gradient-context.cpp') diff --git a/src/gradient-context.cpp b/src/gradient-context.cpp index 0543f8061..110ae0b8b 100644 --- a/src/gradient-context.cpp +++ b/src/gradient-context.cpp @@ -382,6 +382,8 @@ sp_gradient_context_add_stops_between_selected_stops (SPGradientContext *rc) // now actually create the new stops GSList *i = these_stops; GSList *j = next_stops; + GSList *new_stops = NULL; + for (; i != NULL && j != NULL; i = i->next, j = j->next) { SPStop *this_stop = (SPStop *) i->data; SPStop *next_stop = (SPStop *) j->data; @@ -389,7 +391,8 @@ sp_gradient_context_add_stops_between_selected_stops (SPGradientContext *rc) SPObject *parent = this_stop->parent; if (SP_IS_GRADIENT (parent)) { doc = parent->document; - sp_vector_add_stop (SP_GRADIENT (parent), this_stop, next_stop, offset); + SPStop *new_stop = sp_vector_add_stop (SP_GRADIENT (parent), this_stop, next_stop, offset); + new_stops = g_slist_prepend (new_stops, new_stop); SP_GRADIENT(parent)->ensureVector(); } } @@ -399,12 +402,17 @@ sp_gradient_context_add_stops_between_selected_stops (SPGradientContext *rc) drag->updateDraggers(); // so that it does not automatically update draggers in idle loop, as this would deselect drag->local_change = true; - // select all the old selected and new created draggers - drag->selectByCoords(coords); + + // select the newly created stops + for (GSList *s = new_stops; s != NULL; s = s->next) { + drag->selectByStop((SPStop *)s->data); + } + } g_slist_free (these_stops); g_slist_free (next_stops); + g_slist_free (new_stops); } double sqr(double x) {return x*x;} -- cgit v1.2.3