Code

Rename LPE: mirror reflect --> mirror symmetry
[inkscape.git] / src / display / canvas-axonomgrid.h
index 22fceed4473560fc5cf79a09ed0d7375bd80a295..668c59649b08bdb736a3e1a208bde677ade85d67 100644 (file)
@@ -1,59 +1,95 @@
-#ifndef SP_CANVAS_AXONOMGRID_H\r
-#define SP_CANVAS_AXONOMGRID_H\r
-\r
-/*\r
- * SPCAxonomGrid\r
- *\r
- * Generic (and quite unintelligent) modified copy of the grid item for gnome canvas\r
- *\r
- * Copyright (C) 2006 Johan Engelen  <johan@shouraizou.nl>\r
- * Copyright (C) 2000 Lauris Kaplinski 2000\r
- *\r
- */\r
-\r
-#include <display/sp-canvas.h>\r
-#include <libnr/nr-coord.h>\r
-\r
-\r
-#define SP_TYPE_CAXONOMGRID            (sp_caxonomgrid_get_type ())\r
-#define SP_CAXONOMGRID(obj)            (GTK_CHECK_CAST ((obj), SP_TYPE_CAXONOMGRID, SPCAxonomGrid))\r
-#define SP_CAXONOMGRID_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), SP_TYPE_CAXONOMGRID, SPCAxonomGridClass))\r
-#define SP_IS_CAXONOMGRID(obj)         (GTK_CHECK_TYPE ((obj), SP_TYPE_CAXONOMGRID))\r
-#define SP_IS_CAXONOMGRID_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_CAXONOMGRID))\r
-\r
-\r
-/** \brief  All the variables that are tracked for a axonometric grid specific\r
-            canvas item. */\r
-struct SPCAxonomGrid : public SPCanvasItem{\r
-       NR::Point origin;     /**< Origin of the grid */\r
-       double lengthy;       /**< The lengths of the primary y-axis */\r
-       double angle_deg[3];  /**< Angle of each axis (note that angle[2] == 0) */\r
-       double angle_rad[3];  /**< Angle of each axis (note that angle[2] == 0) */\r
-       double tan_angle[3];  /**< tan(angle[.]) */\r
-       guint32 color;        /**< Color for normal lines */\r
-       guint32 empcolor;     /**< Color for emphasis lines */\r
-       gint empspacing;      /**< Spacing between emphasis lines */\r
-       bool scaled;          /**< Whether the grid is in scaled mode */\r
-       \r
-       NR::Point ow;         /**< Transformed origin by the affine for the zoom */\r
-       double lyw;           /**< Transformed length y by the affine for the zoom */\r
-       double lxw_x;\r
-       double lxw_z;\r
-       double spacing_ylines;\r
-                          \r
-    NR::Point sw;          /**< the scaling factors of the affine transform */\r
-};\r
-\r
-struct SPCAxonomGridClass {\r
-       SPCanvasItemClass parent_class;\r
-};\r
-\r
-\r
-/* Standard Gtk function */\r
-GtkType sp_caxonomgrid_get_type (void);\r
-\r
-\r
-\r
-#endif    \r
-\r
-\r
+#ifndef CANVAS_AXONOMGRID_H
+#define CANVAS_AXONOMGRID_H
+
+/*
+ * Copyright (C) 2006-2007 Johan Engelen  <johan@shouraizou.nl>
+ *
+  */
+
+#include <display/sp-canvas.h>
+#include <libnr/nr-coord.h>
+#include "xml/repr.h"
+#include <gtkmm/box.h>
+
+#include <gtkmm.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 "xml/node-event-vector.h"
+
+#include "snapper.h"
+#include "line-snapper.h"
+
+#include "canvas-grid.h"
+
+struct SPDesktop;
+struct SPNamedView;
+
+namespace Inkscape {
+
+class CanvasAxonomGrid : public CanvasGrid {
+public:
+    CanvasAxonomGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument * in_doc);
+    virtual ~CanvasAxonomGrid();
+
+    void Update (NR::Matrix const &affine, unsigned int flags);
+    void Render (SPCanvasBuf *buf);
+    
+    void readRepr();
+    void onReprAttrChanged (Inkscape::XML::Node * repr, const gchar *key, const gchar *oldval, const gchar *newval, bool is_interactive);
+
+    SPUnit const* gridunit;
+
+    NR::Point origin;     /**< Origin of the grid */
+    double lengthy;       /**< The lengths of the primary y-axis */
+    double angle_deg[3];  /**< Angle of each axis (note that angle[2] == 0) */
+    double angle_rad[3];  /**< Angle of each axis (note that angle[2] == 0) */
+    double tan_angle[3];  /**< tan(angle[.]) */
+    guint32 color;        /**< Color for normal lines */
+    guint32 empcolor;     /**< Color for emphasis lines */
+    gint empspacing;      /**< Spacing between emphasis lines */
+    bool scaled;          /**< Whether the grid is in scaled mode */
+
+    NR::Point ow;         /**< Transformed origin by the affine for the zoom */
+    double lyw;           /**< Transformed length y by the affine for the zoom */
+    double lxw_x;
+    double lxw_z;
+    double spacing_ylines;
+                          
+    NR::Point sw;          /**< the scaling factors of the affine transform */
+
+protected:
+    virtual Gtk::Widget * newSpecificWidget();
+
+private:
+    CanvasAxonomGrid(const CanvasAxonomGrid&);
+    CanvasAxonomGrid& operator=(const CanvasAxonomGrid&);
+    
+    void updateWidgets();
+};
+
+
+
+class CanvasAxonomGridSnapper : public LineSnapper
+{
+public:
+    CanvasAxonomGridSnapper(CanvasAxonomGrid *grid, SPNamedView const *nv, NR::Coord const d);
+
+private:    
+    LineList _getSnapLines(NR::Point const &p) const;
+    void _addSnappedLine(SnappedConstraints &sc, NR::Point const snapped_point, NR::Coord const snapped_distance, NR::Point const normal_to_line, const NR::Point point_on_line) const;
+
+    CanvasAxonomGrid *grid;
+}; 
+
+
+}; //namespace Inkscape
+
+
+
+#endif    
+
+