summaryrefslogtreecommitdiffstats
path: root/src/snapper.h
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2010-01-14 08:13:09 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2010-01-14 08:13:09 +0000
commit7f7da4643d6909af5cd58b2f24846774e3af509b (patch)
tree1fec13b3616ecc90fb251bb9e643aefc43c80c43 /src/snapper.h
parentSome additional docs (diff)
parentInitial cut of disabling floating windows on window managers with problems. (diff)
downloadinkscape-7f7da4643d6909af5cd58b2f24846774e3af509b.tar.gz
inkscape-7f7da4643d6909af5cd58b2f24846774e3af509b.zip
* Merge from trunk
* Update to new snapping API * Modify the join action slightly (bzr r8846.2.11)
Diffstat (limited to 'src/snapper.h')
-rw-r--r--src/snapper.h36
1 files changed, 16 insertions, 20 deletions
diff --git a/src/snapper.h b/src/snapper.h
index 1801f309c..47c1c514e 100644
--- a/src/snapper.h
+++ b/src/snapper.h
@@ -20,6 +20,7 @@
#include "snapped-line.h"
#include "snapped-curve.h"
#include "snap-preferences.h"
+#include "snap-candidate.h"
struct SnappedConstraints {
std::list<Inkscape::SnappedPoint> points;
@@ -34,14 +35,13 @@ struct SPItem;
namespace Inkscape
{
-
/// Parent for classes that can snap points to something
class Snapper
{
public:
- Snapper() {}
- Snapper(SnapManager *sm, ::Geom::Coord const t);
- virtual ~Snapper() {}
+ Snapper() {}
+ Snapper(SnapManager *sm, ::Geom::Coord const t);
+ virtual ~Snapper() {}
virtual Geom::Coord getSnapperTolerance() const = 0; //returns the tolerance of the snapper in screen pixels (i.e. independent of zoom)
virtual bool getSnapperAlwaysSnap() const = 0; //if true, then the snapper will always snap, regardless of its tolerance
@@ -53,18 +53,16 @@ public:
// These four methods are only used for grids, for which snapping can be enabled individually
void setEnabled(bool s);
- void setSnapVisibleOnly(bool s);
+ void setSnapVisibleOnly(bool s);
bool getEnabled() const {return _snap_enabled;}
bool getSnapVisibleOnly() const {return _snap_visible_only;}
virtual void freeSnap(SnappedConstraints &/*sc*/,
SnapPreferences::PointType const &/*t*/,
- Geom::Point const &/*p*/,
- SnapSourceType const &/*source_type*/,
- bool const &/*first_point*/,
+ Inkscape::SnapCandidatePoint const &/*p*/,
Geom::OptRect const &/*bbox_to_snap*/,
std::vector<SPItem const *> const */*it*/,
- std::vector<std::pair<Geom::Point, int> > */*unselected_nodes*/) const {};
+ std::vector<SnapCandidatePoint> */*unselected_nodes*/) const {};
class ConstraintLine
{
@@ -91,9 +89,9 @@ public:
}
Geom::Point projection(Geom::Point const &p) const { // returns the projection of p on this constraintline
- Geom::Point const p1_on_cl = _has_point ? _point : p;
- Geom::Point const p2_on_cl = p1_on_cl + _direction;
- return Geom::projection(p, Geom::Line(p1_on_cl, p2_on_cl));
+ Geom::Point const p1_on_cl = _has_point ? _point : p;
+ Geom::Point const p2_on_cl = p1_on_cl + _direction;
+ return Geom::projection(p, Geom::Line(p1_on_cl, p2_on_cl));
}
private:
@@ -104,20 +102,18 @@ public:
};
virtual void constrainedSnap(SnappedConstraints &/*sc*/,
- SnapPreferences::PointType const &/*t*/,
- Geom::Point const &/*p*/,
- SnapSourceType const &/*source_type*/,
- bool const &/*first_point*/,
+ SnapPreferences::PointType const &/*t*/,
+ Inkscape::SnapCandidatePoint const &/*p*/,
Geom::OptRect const &/*bbox_to_snap*/,
ConstraintLine const &/*c*/,
std::vector<SPItem const *> const */*it*/) const {};
protected:
- SnapManager *_snapmanager;
+ SnapManager *_snapmanager;
- // This is only used for grids, for which snapping can be enabled individually
- bool _snap_enabled; ///< true if this snapper is enabled, otherwise false
- bool _snap_visible_only;
+ // This is only used for grids, for which snapping can be enabled individually
+ bool _snap_enabled; ///< true if this snapper is enabled, otherwise false
+ bool _snap_visible_only;
};
}