Code

Refactoring SPColor to C++ and removing legacy CMYK implementation
[inkscape.git] / src / gradient-drag.h
index b6702bf8e335d8a5a2f89af469fa1ed8712251b3..3f12cc09c50e2a86dda7b3602a4437c036ec134f 100644 (file)
@@ -48,7 +48,7 @@ struct GrDraggable {
     }
 };
 
-struct GrDrag;
+class GrDrag;
 
 /**
 This class holds together a visible on-canvas knot and a list of draggables that need to
@@ -99,56 +99,65 @@ struct GrDragger {
 This is the root class of the gradient dragging machinery. It holds lists of GrDraggers
 and of lines (simple canvas items). It also remembers one of the draggers as selected.
 */
-struct GrDrag {
-       GrDrag(SPDesktop *desktop);
-       ~GrDrag();
+class GrDrag {
+public: // FIXME: make more of this private!
 
-       void addLine (NR::Point p1, NR::Point p2, guint32 rgba);
+    GrDrag(SPDesktop *desktop);
+    ~GrDrag();
 
-       void addDragger (GrDraggable *draggable);
-
-       void addDraggersRadial (SPRadialGradient *rg, SPItem *item, bool fill_or_stroke);
-       void addDraggersLinear (SPLinearGradient *lg, SPItem *item, bool fill_or_stroke);
-
-       GList *selected; // list of GrDragger*
+    // especially the selection must be private, fix gradient-context to remove direct access to it
+    GList *selected; // list of GrDragger*
     void setSelected (GrDragger *dragger, bool add_to_selection = false, bool override = true);
     void setDeselected (GrDragger *dragger);
-    void deselect_all();
+    void deselectAll();
+    
+    void deleteSelected (bool just_one = false);
     
     bool keep_selection;    
     
-       GrDragger *getDraggerFor (SPItem *item, guint point_type, guint point_i, bool fill_or_stroke);
+    GrDragger *getDraggerFor (SPItem *item, guint point_type, guint point_i, bool fill_or_stroke);
+
+    void grabKnot (SPItem *item, guint point_type, guint point_i, 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;
 
-       bool local_change;
+    SPDesktop *desktop;
 
-       SPDesktop *desktop;
-       Inkscape::Selection *selection;
-       sigc::connection sel_changed_connection;
-       sigc::connection sel_modified_connection;
+    // lists of edges of selection bboxes, to snap draggers to
+    std::vector<double> hor_levels;
+    std::vector<double> vert_levels;
 
-       sigc::connection style_set_connection;
-       sigc::connection style_query_connection;
+    GList *draggers;
+    GSList *lines;
 
-       // lists of edges of selection bboxes, to snap draggers to
-       std::vector<double> hor_levels;
-       std::vector<double> vert_levels;
+    void updateDraggers ();
+    void updateLines ();
+    void updateLevels ();
+
+    void selected_move (double x, double y);
+    void selected_move_screen (double x, double y);
+
+    void select_next ();
+    void select_prev ();
+
+    void selected_reverse_vector ();
+
+private: 
+    void deselect_all();
 
-       GList *draggers;
-       GSList *lines;
+    void addLine (NR::Point p1, NR::Point p2, guint32 rgba);
 
-       void updateDraggers ();
-       void updateLines ();
-       void updateLevels ();
+    void addDragger (GrDraggable *draggable);
 
-       void selected_move (double x, double y);
-       void selected_move_screen (double x, double y);
+    void addDraggersRadial (SPRadialGradient *rg, SPItem *item, bool fill_or_stroke);
+    void addDraggersLinear (SPLinearGradient *lg, SPItem *item, bool fill_or_stroke);
 
-       void select_next ();
-       void select_prev ();
+    Inkscape::Selection *selection;
+    sigc::connection sel_changed_connection;
+    sigc::connection sel_modified_connection;
 
-       void selected_reverse_vector ();
+    sigc::connection style_set_connection;
+    sigc::connection style_query_connection;
 };
 
 #endif