summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 27dff7a)
raw | patch | inline | side by side (parent: 27dff7a)
author | Jon A. Cruz <jon@joncruz.org> | |
Sat, 3 Jul 2010 22:58:53 +0000 (15:58 -0700) | ||
committer | Jon A. Cruz <jon@joncruz.org> | |
Sat, 3 Jul 2010 22:58:53 +0000 (15:58 -0700) |
src/gradient-drag.cpp | patch | blob | history | |
src/gradient-drag.h | patch | blob | history |
diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp
index c9a982e42e92d9d454e1a3cd9518cf9b1116ffc8..55348616e465d0f22211b199d9e26ec50e0aab3a 100644 (file)
--- 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<GrDragger *>(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 460d1396e7139ca6af742a36adc88dd176c9139c..3eb6256716400851f7f8381354cb145ff03373a2 100644 (file)
--- a/src/gradient-drag.h
+++ b/src/gradient-drag.h
#define __GRADIENT_DRAG_H__
/*
- * On-canvas gradient dragging
+ * On-canvas gradient dragging
*
* Authors:
* bulia byak <bulia@users.sf.net>
void updateKnotShape();
void updateTip();
-
+
void select();
void deselect();
bool isSelected();
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);
void selected_reverse_vector ();
-private:
+private:
void deselect_all();
void addLine (SPItem *item, Geom::Point p1, Geom::Point p2, guint32 rgba);