summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2012-10-26 21:35:20 +0000
committerJohan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl>2012-10-26 21:35:20 +0000
commit90dbe10154f75b9f3f5f82f53193e20f01537ac1 (patch)
treea9783b7494234fef81fcc69d0ff5f1035cf766e6 /src
parentinclude yourself first, then the others (diff)
downloadinkscape-90dbe10154f75b9f3f5f82f53193e20f01537ac1.tar.gz
inkscape-90dbe10154f75b9f3f5f82f53193e20f01537ac1.zip
bit of a clean-up
(bzr r11832)
Diffstat (limited to 'src')
-rw-r--r--src/display/canvas-axonomgrid.cpp30
-rw-r--r--src/display/canvas-axonomgrid.h15
2 files changed, 19 insertions, 26 deletions
diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp
index 2df5102de..f2a9e38cb 100644
--- a/src/display/canvas-axonomgrid.cpp
+++ b/src/display/canvas-axonomgrid.cpp
@@ -12,35 +12,29 @@
* smaller than 90 degrees (measured from horizontal, 0 degrees being a line extending
* to the right). The x-axis will always have an angle between 0 and 90 degrees.
*/
-
- /*
- * TODO:
- * THIS FILE AND THE HEADER FILE NEED CLEANING UP. PLEASE DO NOT HESISTATE TO DO SO.
- */
-
+
#include "display/canvas-axonomgrid.h"
#include <glibmm/i18n.h>
#include "ui/widget/registered-widget.h"
-#include "2geom/line.h"
#include "desktop.h"
-#include "canvas-grid.h"
#include "desktop-handles.h"
#include "display/cairo-utils.h"
#include "display/canvas-grid.h"
#include "display/sp-canvas-util.h"
+#include "display/sp-canvas.h"
#include "document.h"
-#include "helper/units.h"
#include "inkscape.h"
#include "preferences.h"
#include "sp-namedview.h"
#include "sp-object.h"
#include "svg/svg-color.h"
+#include "2geom/line.h"
+#include "2geom/angle.h"
#include "util/mathfns.h"
-#include "xml/node-event-vector.h"
#include "round.h"
-#include "display/sp-canvas.h"
+#include "helper/units.h"
#include <gtkmm/box.h>
#include <gtkmm/label.h>
@@ -48,12 +42,6 @@
enum Dim3 { X=0, Y, Z };
-#ifndef M_PI
-# define M_PI 3.14159265358979323846
-#endif
-
-static double deg_to_rad(double deg) { return deg*M_PI/180.0;}
-
/**
* This function calls Cairo to render a line on a particular canvas buffer.
* Coordinates are interpreted as SCREENcoordinates
@@ -139,9 +127,9 @@ CanvasAxonomGrid::CanvasAxonomGrid (SPNamedView * nv, Inkscape::XML::Node * in_r
angle_deg[Z] = prefs->getDouble("/options/grids/axonom/angle_z", 30.0);
angle_deg[Y] = 0;
- angle_rad[X] = deg_to_rad(angle_deg[X]);
+ angle_rad[X] = Geom::deg_to_rad(angle_deg[X]);
tan_angle[X] = tan(angle_rad[X]);
- angle_rad[Z] = deg_to_rad(angle_deg[Z]);
+ angle_rad[Z] = Geom::deg_to_rad(angle_deg[Z]);
tan_angle[Z] = tan(angle_rad[Z]);
snapper = new CanvasAxonomGridSnapper(this, &namedview->snap_manager, 0);
@@ -254,7 +242,7 @@ CanvasAxonomGrid::readRepr()
angle_deg[X] = g_ascii_strtod(value, NULL);
if (angle_deg[X] < 0.) angle_deg[X] = 0.;
if (angle_deg[X] > 89.0) angle_deg[X] = 89.0;
- angle_rad[X] = deg_to_rad(angle_deg[X]);
+ angle_rad[X] = Geom::deg_to_rad(angle_deg[X]);
tan_angle[X] = tan(angle_rad[X]);
}
@@ -262,7 +250,7 @@ CanvasAxonomGrid::readRepr()
angle_deg[Z] = g_ascii_strtod(value, NULL);
if (angle_deg[Z] < 0.) angle_deg[Z] = 0.;
if (angle_deg[Z] > 89.0) angle_deg[Z] = 89.0;
- angle_rad[Z] = deg_to_rad(angle_deg[Z]);
+ angle_rad[Z] = Geom::deg_to_rad(angle_deg[Z]);
tan_angle[Z] = tan(angle_rad[Z]);
}
diff --git a/src/display/canvas-axonomgrid.h b/src/display/canvas-axonomgrid.h
index 04919f947..0e24d3f56 100644
--- a/src/display/canvas-axonomgrid.h
+++ b/src/display/canvas-axonomgrid.h
@@ -2,9 +2,12 @@
#define CANVAS_AXONOMGRID_H
/*
- * Copyright (C) 2006-2007 Johan Engelen <johan@shouraizou.nl>
+ * Authors:
+ * Johan Engelen <j.b.c.engelen@alumnus.utwente.nl>
*
- */
+ * Copyright (C) 2006-2012 Authors
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
#include "line-snapper.h"
#include "canvas-grid.h"
@@ -15,7 +18,7 @@ struct SPNamedView;
namespace Inkscape {
namespace XML {
- class Node;
+ class Node;
};
class CanvasAxonomGrid : public CanvasGrid {
@@ -36,6 +39,9 @@ public:
bool scaled; /**< Whether the grid is in scaled mode */
+protected:
+ friend class CanvasAxonomGridSnapper;
+
Geom::Point ow; /**< Transformed origin by the affine for the zoom */
double lyw; /**< Transformed length y by the affine for the zoom */
double lxw_x;
@@ -44,7 +50,6 @@ public:
Geom::Point sw; /**< the scaling factors of the affine transform */
-protected:
virtual Gtk::Widget * newSpecificWidget();
private:
@@ -63,7 +68,7 @@ public:
bool ThisSnapperMightSnap() const;
Geom::Coord getSnapperTolerance() const; //returns the tolerance of the snapper in screen pixels (i.e. independent of zoom)
- bool getSnapperAlwaysSnap() const; //if true, then the snapper will always snap, regardless of its tolerance
+ bool getSnapperAlwaysSnap() const; //if true, then the snapper will always snap, regardless of its tolerance
private:
LineList _getSnapLines(Geom::Point const &p) const;