Code

Gradient nodes progress...
[inkscape.git] / src / gradient-drag.h
index 365da9b9253beb43b7a6221aa23daca0f2c94754..72e9ce0dd5a31d30d6b87f4ad8becf0306edaf03 100644 (file)
@@ -27,21 +27,22 @@ class Point;
 
 /**
 This class represents a single draggable point of a gradient. It remembers the item
-which has the gradient, whether it's fill or stroke, and the point number (from the
-GrPoint enum).
+which has the gradient, whether it's fill or stroke, the point type (from the
+GrPointType enum), and the point number (needed if more than 2 stops are present).
 */
 struct GrDraggable {
-       GrDraggable(SPItem *item, guint point_num, bool fill_or_stroke);
+       GrDraggable(SPItem *item, guint point_type, guint point_i, bool fill_or_stroke);
        ~GrDraggable();
 
        SPItem *item;
-       guint point_num;
+       guint point_type;
+       guint point_i;  // the stop number of this point ( = 0 for all types except POINT_LG_MID)
        bool fill_or_stroke;
 
        bool mayMerge (GrDraggable *da2);
 
     inline int equals (GrDraggable *other) {
-               return ((item == other->item) && (point_num == other->point_num) && (fill_or_stroke == other->fill_or_stroke));
+               return ((item == other->item) && (point_type == other->point_type) && (point_i == other->point_i) && (fill_or_stroke == other->fill_or_stroke));
     }
 };
 
@@ -75,15 +76,15 @@ struct GrDragger {
        void updateKnotShape();
        void updateTip();
 
-       void moveThisToDraggable (SPItem *item, guint point_num, bool fill_or_stroke, bool write_repr);
-       void moveOtherToDraggable (SPItem *item, guint point_num, bool fill_or_stroke, bool write_repr);
+       void moveThisToDraggable (SPItem *item, guint point_type, guint point_i, bool fill_or_stroke, bool write_repr);
+       void moveOtherToDraggable (SPItem *item, guint point_type, guint point_i, bool fill_or_stroke, bool write_repr);
        void updateDependencies (bool write_repr);
 
        bool mayMerge (GrDragger *other);
        bool mayMerge (GrDraggable *da2);
 
-       bool isA (guint point_num);
-       bool isA (SPItem *item, guint point_num, bool fill_or_stroke);
+       bool isA (guint point_type);
+       bool isA (SPItem *item, guint point_type, guint point_i, bool fill_or_stroke);
 
        void fireDraggables (bool write_repr, bool scale_radial = false, bool merging_focus = false);
 };
@@ -106,9 +107,9 @@ struct GrDrag {
        GrDragger *selected;
        void setSelected (GrDragger *dragger);
 
-       GrDragger *getDraggerFor (SPItem *item, guint point_num, bool fill_or_stroke);
+       GrDragger *getDraggerFor (SPItem *item, guint point_type, guint point_i, bool fill_or_stroke);
 
-       void grabKnot (SPItem *item, guint point_num, bool fill_or_stroke, gint x, gint y, guint32 etime);
+       void grabKnot (SPItem *item, guint point_type, guint point_i, bool fill_or_stroke, gint x, gint y, guint32 etime);
 
        bool local_change;