Code

Rename LPE: mirror reflect --> mirror symmetry
[inkscape.git] / src / display / canvas-grid.h
index 07e27cb4a4a0a390ee7da625c2c21e8a09fbf416..a9e317534b90dd12740b80b49aef5681741f8786 100644 (file)
  *
  */
 
-#include <display/sp-canvas.h>
-#include "xml/repr.h"
-#include <gtkmm/box.h>
-
+#include <cstring>
+#include <string>
 
+#include <gtkmm/box.h>
 #include <gtkmm.h>
+
+#include "display/sp-canvas.h"
+#include "xml/repr.h"
 #include "ui/widget/color-picker.h"
 #include "ui/widget/scalar-unit.h"
-
 #include "ui/widget/registered-widget.h"
 #include "ui/widget/registry.h"
-#include "ui/widget/tolerance-slider.h"
-
 #include "xml/node-event-vector.h"
-
 #include "snapper.h"
 #include "line-snapper.h"
 
@@ -89,7 +87,7 @@ public:
     virtual void readRepr() = 0;
     virtual void onReprAttrChanged (Inkscape::XML::Node * /*repr*/, const gchar */*key*/, const gchar */*oldval*/, const gchar */*newval*/, bool /*is_interactive*/) = 0;
 
-    virtual Gtk::Widget & getWidget() = 0;
+    Gtk::Widget * newWidget();
 
     Inkscape::XML::Node * repr;
     SPDocument *doc;
@@ -98,24 +96,20 @@ public:
 
     static void on_repr_attr_changed (Inkscape::XML::Node * repr, const gchar *key, const gchar *oldval, const gchar *newval, bool is_interactive, void * data);
 
-    bool isVisible() { return visible; };
-    bool isSnapEnabled() { return snap_enabled; };
+    bool isVisible() { return (isEnabled() &&visible); };
+    bool isEnabled();
 
 protected:
     CanvasGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument *in_doc, GridType type);
 
+    virtual Gtk::Widget * newSpecificWidget() = 0;
+
     GSList * canvasitems;  // list of created canvasitems
 
     SPNamedView * namedview;
 
-    Gtk::VBox vbox;
-    Gtk::Label namelabel;
-
     Inkscape::UI::Widget::Registry _wr;
-    Inkscape::UI::Widget::RegisteredCheckButton _rcb_visible;
     bool visible;
-    Inkscape::UI::Widget::RegisteredCheckButton _rcb_snap_enabled;
-    bool snap_enabled;
 
     GridType gridtype;
 
@@ -136,8 +130,6 @@ public:
     void readRepr();
     void onReprAttrChanged (Inkscape::XML::Node * repr, const gchar *key, const gchar *oldval, const gchar *newval, bool is_interactive);
 
-    Gtk::Widget & getWidget();
-
     NR::Point origin;
     guint32 color;
     guint32 empcolor;
@@ -150,20 +142,16 @@ public:
                             variables */
     NR::Point ow;      /**< Transformed origin by the affine for the zoom */
     NR::Point sw;      /**< Transformed spacing by the affine for the zoom */
+
+protected:
+    virtual Gtk::Widget * newSpecificWidget();
+
 private:
     CanvasXYGrid(const CanvasXYGrid&);
     CanvasXYGrid& operator=(const CanvasXYGrid&);
 
     void updateWidgets();
 
-    Gtk::Table table;
-
-    Inkscape::UI::Widget::RegisteredUnitMenu    _rumg, _rums;
-    Inkscape::UI::Widget::RegisteredScalarUnit  _rsu_ox, _rsu_oy, _rsu_sx, _rsu_sy;
-    Inkscape::UI::Widget::RegisteredColorPicker _rcp_gcol, _rcp_gmcol;
-    Inkscape::UI::Widget::RegisteredSuffixedInteger _rsi;
-    Inkscape::UI::Widget::RegisteredCheckButton _rcb_dotted;
-
     bool render_dotted;
 };
 
@@ -173,6 +161,7 @@ class CanvasXYGridSnapper : public LineSnapper
 {
 public:
     CanvasXYGridSnapper(CanvasXYGrid *grid, SPNamedView const *nv, NR::Coord const d);
+    bool ThisSnapperMightSnap() const;
 
 private:
     LineList _getSnapLines(NR::Point const &p) const;