From: Jon A. Cruz Date: Sat, 3 Jul 2010 22:58:53 +0000 (-0700) Subject: Suppress gradient handles when editing objects with solid fills. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=04e314226e1393ac8b529d2eedec9e7120e23860;p=inkscape.git Suppress gradient handles when editing objects with solid fills. --- diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index c9a982e42..55348616e 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -1624,41 +1624,43 @@ GrDrag::grabKnot (SPItem *item, gint point_type, gint point_i, bool fill_or_stro Regenerates the draggers list from the current selection; is called when selection is changed or modified, also when a radial dragger needs to update positions of other draggers in the gradient */ -void -GrDrag::updateDraggers () +void GrDrag::updateDraggers () { while (selected) { selected = g_list_remove(selected, selected->data); } // delete old draggers for (GList const* i = this->draggers; i != NULL; i = i->next) { - delete ((GrDragger *) i->data); + delete static_cast(i->data); } - g_list_free (this->draggers); + g_list_free(this->draggers); this->draggers = NULL; - g_return_if_fail (this->selection != NULL); + g_return_if_fail(this->selection != NULL); for (GSList const* i = this->selection->itemList(); i != NULL; i = i->next) { - SPItem *item = SP_ITEM(i->data); - SPStyle *style = SP_OBJECT_STYLE (item); + SPStyle *style = item->style; if (style && (style->fill.isPaintserver())) { - SPObject *server = SP_OBJECT_STYLE_FILL_SERVER (item); - if (SP_IS_LINEARGRADIENT (server)) { - addDraggersLinear (SP_LINEARGRADIENT (server), item, true); - } else if (SP_IS_RADIALGRADIENT (server)) { - addDraggersRadial (SP_RADIALGRADIENT (server), item, true); + SPPaintServer *server = style->getFillPaintServer(); + if ( server && server->isSolid() ) { + // Suppress "gradientness" of solid paint + } else if ( SP_IS_LINEARGRADIENT(server) ) { + addDraggersLinear( SP_LINEARGRADIENT(server), item, true ); + } else if ( SP_IS_RADIALGRADIENT(server) ) { + addDraggersRadial( SP_RADIALGRADIENT(server), item, true ); } } if (style && (style->stroke.isPaintserver())) { - SPObject *server = SP_OBJECT_STYLE_STROKE_SERVER (item); - if (SP_IS_LINEARGRADIENT (server)) { - addDraggersLinear (SP_LINEARGRADIENT (server), item, false); - } else if (SP_IS_RADIALGRADIENT (server)) { - addDraggersRadial (SP_RADIALGRADIENT (server), item, false); + SPPaintServer *server = style->getStrokePaintServer(); + if ( server && server->isSolid() ) { + // Suppress "gradientness" of solid paint + } else if ( SP_IS_LINEARGRADIENT(server) ) { + addDraggersLinear( SP_LINEARGRADIENT(server), item, false ); + } else if ( SP_IS_RADIALGRADIENT(server) ) { + addDraggersRadial( SP_RADIALGRADIENT(server), item, false ); } } } diff --git a/src/gradient-drag.h b/src/gradient-drag.h index 460d1396e..3eb625671 100644 --- a/src/gradient-drag.h +++ b/src/gradient-drag.h @@ -2,7 +2,7 @@ #define __GRADIENT_DRAG_H__ /* - * On-canvas gradient dragging + * On-canvas gradient dragging * * Authors: * bulia byak @@ -78,7 +78,7 @@ struct GrDragger { void updateKnotShape(); void updateTip(); - + void select(); void deselect(); bool isSelected(); @@ -131,9 +131,9 @@ public: // FIXME: make more of this private! void deleteSelected (bool just_one = false); guint32 getColor(); - - bool keep_selection; - + + bool keep_selection; + GrDragger *getDraggerFor (SPItem *item, gint point_type, gint point_i, bool fill_or_stroke); void grabKnot (GrDragger *dragger, gint x, gint y, guint32 etime); @@ -165,7 +165,7 @@ public: // FIXME: make more of this private! void selected_reverse_vector (); -private: +private: void deselect_all(); void addLine (SPItem *item, Geom::Point p1, Geom::Point p2, guint32 rgba);