Code

Use is_straight_curve() instead of three separate dynamic casts
[inkscape.git] / src / display / canvas-axonomgrid.h
1 #ifndef CANVAS_AXONOMGRID_H
2 #define CANVAS_AXONOMGRID_H
4 /*
5  * Copyright (C) 2006-2007 Johan Engelen  <johan@shouraizou.nl>
6  *
7   */
9 #include <display/sp-canvas.h>
10 #include <libnr/nr-coord.h>
11 #include "xml/repr.h"
12 #include <gtkmm/box.h>
14 #include <gtkmm.h>
15 #include "ui/widget/color-picker.h"
16 #include "ui/widget/scalar-unit.h"
18 #include "ui/widget/registered-widget.h"
19 #include "ui/widget/registry.h"
21 #include "xml/node-event-vector.h"
23 #include "snapper.h"
24 #include "line-snapper.h"
26 #include "canvas-grid.h"
28 struct SPDesktop;
29 struct SPNamedView;
31 namespace Inkscape {
33 class CanvasAxonomGrid : public CanvasGrid {
34 public:
35     CanvasAxonomGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument * in_doc);
36     virtual ~CanvasAxonomGrid();
38     void Update (NR::Matrix const &affine, unsigned int flags);
39     void Render (SPCanvasBuf *buf);
40     
41     void readRepr();
42     void onReprAttrChanged (Inkscape::XML::Node * repr, const gchar *key, const gchar *oldval, const gchar *newval, bool is_interactive);
44     SPUnit const* gridunit;
46     NR::Point origin;     /**< Origin of the grid */
47     double lengthy;       /**< The lengths of the primary y-axis */
48     double angle_deg[3];  /**< Angle of each axis (note that angle[2] == 0) */
49     double angle_rad[3];  /**< Angle of each axis (note that angle[2] == 0) */
50     double tan_angle[3];  /**< tan(angle[.]) */
51     guint32 color;        /**< Color for normal lines */
52     guint32 empcolor;     /**< Color for emphasis lines */
53     gint empspacing;      /**< Spacing between emphasis lines */
54     bool scaled;          /**< Whether the grid is in scaled mode */
56     NR::Point ow;         /**< Transformed origin by the affine for the zoom */
57     double lyw;           /**< Transformed length y by the affine for the zoom */
58     double lxw_x;
59     double lxw_z;
60     double spacing_ylines;
61                           
62     NR::Point sw;          /**< the scaling factors of the affine transform */
64 protected:
65     virtual Gtk::Widget * newSpecificWidget();
67 private:
68     CanvasAxonomGrid(const CanvasAxonomGrid&);
69     CanvasAxonomGrid& operator=(const CanvasAxonomGrid&);
70     
71     void updateWidgets();
72 };
76 class CanvasAxonomGridSnapper : public LineSnapper
77 {
78 public:
79     CanvasAxonomGridSnapper(CanvasAxonomGrid *grid, SPNamedView const *nv, NR::Coord const d);
81 private:    
82     LineList _getSnapLines(NR::Point const &p) const;
83     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;
85     CanvasAxonomGrid *grid;
86 }; 
89 }; //namespace Inkscape
93 #endif