From: buliabyak Date: Fri, 12 Oct 2007 05:41:16 +0000 (+0000) Subject: scroll desktop to selected handle after Tab/Shift-Tab; allow Ins to work even if... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9694f8d50089f18953d85b6923d736c6b334fa05;p=inkscape.git scroll desktop to selected handle after Tab/Shift-Tab; allow Ins to work even if a single dragger is selected --- diff --git a/src/gradient-context.cpp b/src/gradient-context.cpp index 93cf79214..e8a280c40 100644 --- a/src/gradient-context.cpp +++ b/src/gradient-context.cpp @@ -206,7 +206,9 @@ sp_gradient_context_select_next (SPEventContext *event_context) GrDrag *drag = event_context->_grdrag; g_assert (drag); - drag->select_next(); + GrDragger *d = drag->select_next(); + + event_context->desktop->scroll_to_point(&(d->point), 1.0); } void @@ -215,7 +217,9 @@ sp_gradient_context_select_prev (SPEventContext *event_context) GrDrag *drag = event_context->_grdrag; g_assert (drag); - drag->select_prev(); + GrDragger *d = drag->select_prev(); + + event_context->desktop->scroll_to_point(&(d->point), 1.0); } // FIXME: make global function in libnr or somewhere. @@ -355,6 +359,22 @@ sp_gradient_context_add_stops_between_selected_stops (SPGradientContext *rc) std::vector coords = sp_gradient_context_get_stop_intervals (drag, &these_stops, &next_stops); + if (g_slist_length(these_stops) == 0 && drag->numSelected() == 1) { + // if a single stop is selected, add between that stop and the next one + GrDragger *dragger = (GrDragger *) drag->selected->data; + for (GSList const* j = dragger->draggables; j != NULL; j = j->next) { + GrDraggable *d = (GrDraggable *) j->data; + SPGradient *gradient = sp_item_gradient (d->item, d->fill_or_stroke); + SPGradient *vector = sp_gradient_get_forked_vector_if_necessary (gradient, false); + SPStop *this_stop = sp_get_stop_i (vector, d->point_i); + SPStop *next_stop = sp_next_stop (this_stop); + if (this_stop && next_stop) { + these_stops = g_slist_prepend (these_stops, this_stop); + next_stops = g_slist_prepend (next_stops, next_stop); + } + } + } + // now actually create the new stops GSList *i = these_stops; GSList *j = next_stops;