From 07298cb4e8c9ccfcbfd0717e25b86a97930ddf35 Mon Sep 17 00:00:00 2001 From: johanengelen Date: Sun, 1 Apr 2007 16:39:58 +0000 Subject: [PATCH] when the gradient just has start and end stops if you delete one it will now color the object the remaining stop's color. --- src/gradient-drag.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index 32dfe4d71..5801489fe 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -1745,11 +1745,31 @@ GrDrag::deleteSelected (bool just_one) else { // delete the gradient from the object. set fill to unset FIXME: set to fill of unselected node? SPCSSAttr *css = sp_repr_css_attr_new (); - if (stopinfo->draggable->fill_or_stroke) { - sp_repr_css_unset_property (css, "fill"); + + // stopinfo->spstop is the selected stop + Inkscape::XML::Node *unselectedrepr = SP_OBJECT_REPR(stopinfo->vector)->firstChild(); + if (unselectedrepr == SP_OBJECT_REPR(stopinfo->spstop) ) { + unselectedrepr = unselectedrepr->next(); + } + + if (unselectedrepr == NULL) { + if (stopinfo->draggable->fill_or_stroke) { + sp_repr_css_unset_property (css, "fill"); + } else { + sp_repr_css_unset_property (css, "stroke"); + } } else { - sp_repr_css_unset_property (css, "stroke"); + SPCSSAttr *stopcss = sp_repr_css_attr(unselectedrepr, "style"); + if (stopinfo->draggable->fill_or_stroke) { + sp_repr_css_set_property(css, "fill", sp_repr_css_property(stopcss, "stop-color", "inkscape:unset")); + sp_repr_css_set_property(css, "fill-opacity", sp_repr_css_property(stopcss, "stop-opacity", "1")); + } else { + sp_repr_css_set_property(css, "stroke", sp_repr_css_property(stopcss, "stop-color", "inkscape:unset")); + sp_repr_css_set_property(css, "stroke-opacity", sp_repr_css_property(stopcss, "stop-opacity", "1")); + } + sp_repr_css_attr_unref (stopcss); } + sp_repr_css_change (SP_OBJECT_REPR (stopinfo->draggable->item), css, "style"); sp_repr_css_attr_unref (css); } -- 2.30.2