summaryrefslogtreecommitdiffstats
path: root/src/snap.cpp
diff options
context:
space:
mode:
authorDiederik van Lierop <mail@diedenrezi.nl>2009-03-29 19:12:03 +0000
committerdvlierop2 <dvlierop2@users.sourceforge.net>2009-03-29 19:12:03 +0000
commite180a73c03c71c51b676cc345e92d9ff0e3115e4 (patch)
tree8f26521df08d79997a0e2c77e5df852e31476559 /src/snap.cpp
parentrevert part of 20988 to fix rendering of LPE on groups (diff)
downloadinkscape-e180a73c03c71c51b676cc345e92d9ff0e3115e4.tar.gz
inkscape-e180a73c03c71c51b676cc345e92d9ff0e3115e4.zip
- Move snap delay mechanism to the event context (used to be in SPCanvas)
- Rename lots of variables and methods to make them easier to understand - Add snapping to the connector tool (bzr r7589)
Diffstat (limited to 'src/snap.cpp')
-rw-r--r--src/snap.cpp31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/snap.cpp b/src/snap.cpp
index 2b9a45a1d..19455ba73 100644
--- a/src/snap.cpp
+++ b/src/snap.cpp
@@ -32,6 +32,7 @@
#include "desktop.h"
#include "sp-guide.h"
#include "preferences.h"
+#include "event-context.h"
using std::vector;
/**
@@ -160,12 +161,14 @@ Inkscape::SnappedPoint SnapManager::freeSnap(Inkscape::SnapPreferences::PointTyp
bool first_point,
Geom::OptRect const &bbox_to_snap) const
{
- if (_desktop->canvas->context_snap_delay_active == false) {
- g_warning("context_snap_delay_active has not been set to true by the current context. Please report this!");
- // When the context goes into dragging-mode, then Inkscape should call this: sp_canvas_set_snap_delay_active(desktop->canvas, true);
- }
+ if (_desktop->event_context->_snap_window_open == false) {
+ g_warning("context_snap_window_open has not been set to true by the current context. Please report this!");
+ // When the context goes into dragging-mode, then Inkscape should call this: sp_event_context_snap_window_open(event_context);
+ }
+
+ //std::cout << "SnapManager::freeSnap -> postponed: " << snapprefs.getSnapPostponedGlobally() << std::endl;
- if (!someSnapperMightSnap()) {
+ if (!someSnapperMightSnap()) {
return Inkscape::SnappedPoint(p, source_type, Inkscape::SNAPTARGET_UNDEFINED, NR_HUGE, 0, false, false);
}
@@ -293,12 +296,12 @@ Inkscape::SnappedPoint SnapManager::constrainedSnap(Inkscape::SnapPreferences::P
bool first_point,
Geom::OptRect const &bbox_to_snap) const
{
- if (_desktop->canvas->context_snap_delay_active == false) {
- g_warning("context_snap_delay_active has not been set to true by the current context. Please report this!");
- // When the context goes into dragging-mode, then Inkscape should call this: sp_canvas_set_snap_delay_active(desktop->canvas, true);
- }
+ if (_desktop->event_context->_snap_window_open == false) {
+ g_warning("context_snap_window_open has not been set to true by the current context. Please report this!");
+ // When the context goes into dragging-mode, then Inkscape should call this: sp_event_context_snap_window_open(event_context);
+ }
- if (!someSnapperMightSnap()) {
+ if (!someSnapperMightSnap()) {
return Inkscape::SnappedPoint(p, source_type, Inkscape::SNAPTARGET_UNDEFINED, NR_HUGE, 0, false, false);
}
@@ -331,10 +334,10 @@ void SnapManager::guideSnap(Geom::Point &p, Geom::Point const &guide_normal) con
{
// This method is used to snap a guide to nodes or to other guides, while dragging the guide around. Will not snap to grids!
- if (_desktop->canvas->context_snap_delay_active == false) {
- g_warning("context_snap_delay_active has not been set to true by the current context. Please report this!");
- // When the context goes into dragging-mode, then Inkscape should call this: sp_canvas_set_snap_delay_active(desktop->canvas, true);
- }
+ if (_desktop->event_context->_snap_window_open == false) {
+ g_warning("context_snap_window_open has not been set to true by the current context. Please report this!");
+ // When the context goes into dragging-mode, then Inkscape should call this: sp_event_context_snap_window_open(event_context);
+ }
if (!snapprefs.getSnapEnabledGlobally() || snapprefs.getSnapPostponedGlobally()) {
return;