summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2011-06-15 18:40:46 +0000
committerJohan Engelen <goejendaagh@zonnet.nl>2011-06-15 18:40:46 +0000
commit4294089d059618544c060911e2eb9663ee76c666 (patch)
tree8545afb68cbed6bdc416b08a72d600a32b3c177e /src
parentAttempt to make ImageMagick and OpenMP optional with cmake. (diff)
downloadinkscape-4294089d059618544c060911e2eb9663ee76c666.tar.gz
inkscape-4294089d059618544c060911e2eb9663ee76c666.zip
add preference for relative guideline rotation snapping (see rev 10303)
(bzr r10307)
Diffstat (limited to 'src')
-rw-r--r--src/desktop-events.cpp28
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp5
-rw-r--r--src/ui/dialog/inkscape-preferences.h1
3 files changed, 25 insertions, 9 deletions
diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp
index a0ceb77e3..eb2b3a093 100644
--- a/src/desktop-events.cpp
+++ b/src/desktop-events.cpp
@@ -319,11 +319,17 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data)
if (event->motion.state & GDK_CONTROL_MASK) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
unsigned const snaps = abs(prefs->getInt("/options/rotationsnapsperpi/value", 12));
+ bool const relative_snaps = abs(prefs->getBool("/options/relativeguiderotationsnap/value", false));
if (snaps) {
- Geom::Angle orig_angle(guide->normal_to_line);
- Geom::Angle snap_angle = angle - orig_angle;
- double sections = floor(snap_angle.radians0() * snaps / M_PI + .5);
- angle = (M_PI / snaps) * sections + orig_angle.radians0();
+ if (relative_snaps) {
+ Geom::Angle orig_angle(guide->normal_to_line);
+ Geom::Angle snap_angle = angle - orig_angle;
+ double sections = floor(snap_angle.radians0() * snaps / M_PI + .5);
+ angle = (M_PI / snaps) * sections + orig_angle.radians0();
+ } else {
+ double sections = floor(angle.radians0() * snaps / M_PI + .5);
+ angle = (M_PI / snaps) * sections;
+ }
}
}
sp_guide_set_normal(*guide, Geom::Point::polar(angle).cw(), false);
@@ -387,11 +393,17 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data)
if (event->motion.state & GDK_CONTROL_MASK) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
unsigned const snaps = abs(prefs->getInt("/options/rotationsnapsperpi/value", 12));
+ bool const relative_snaps = abs(prefs->getBool("/options/relativeguiderotationsnap/value", false));
if (snaps) {
- Geom::Angle orig_angle(guide->normal_to_line);
- Geom::Angle snap_angle = angle - orig_angle;
- double sections = floor(snap_angle.radians0() * snaps / M_PI + .5);
- angle = (M_PI / snaps) * sections + orig_angle.radians0();
+ if (relative_snaps) {
+ Geom::Angle orig_angle(guide->normal_to_line);
+ Geom::Angle snap_angle = angle - orig_angle;
+ double sections = floor(snap_angle.radians0() * snaps / M_PI + .5);
+ angle = (M_PI / snaps) * sections + orig_angle.radians0();
+ } else {
+ double sections = floor(angle.radians0() * snaps / M_PI + .5);
+ angle = (M_PI / snaps) * sections;
+ }
}
}
sp_guide_set_normal(*guide, Geom::Point::polar(angle).cw(), true);
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index b8b86fac1..52c434961 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -7,7 +7,7 @@
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
* Bruno Dilly <bruno.dilly@gmail.com>
*
- * Copyright (C) 2004-2007 Authors
+ * Copyright (C) 2004-2011 Authors
*
* Released under GNU GPL. Read the file 'COPYING' for more information.
*/
@@ -270,6 +270,9 @@ void InkscapePreferences::initPageSteps()
_steps_rot_snap.init("/options/rotationsnapsperpi/value", labels, values, num_items, 12);
_page_steps.add_line( false, _("Rotation snaps every:"), _steps_rot_snap, _("degrees"),
_("Rotating with Ctrl pressed snaps every that much degrees; also, pressing [ or ] rotates by this amount"), false);
+ _steps_rot_relative.init ( _("Relative snapping of guideline angles"), "/options/relativeguiderotationsnap/value", false);
+ _page_steps.add_line( false, "", _steps_rot_relative, "",
+ _("When on, the snap angles when rotating a guideline will be relative to the original angle"));
_steps_zoom.init ( "/options/zoomincrement/value", 101.0, 500.0, 1.0, 1.0, 1.414213562, true, true);
_page_steps.add_line( false, _("Zoom in/out by:"), _steps_zoom, _("%"),
_("Zoom tool click, +/- keys, and middle click zoom in and out by this multiplier"), false);
diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h
index 9e51fbf0a..13851e525 100644
--- a/src/ui/dialog/inkscape-preferences.h
+++ b/src/ui/dialog/inkscape-preferences.h
@@ -179,6 +179,7 @@ protected:
UI::Widget::PrefCheckButton _snap_mouse_pointer;
UI::Widget::PrefCombo _steps_rot_snap;
+ UI::Widget::PrefCheckButton _steps_rot_relative;
UI::Widget::PrefCheckButton _steps_compass;
UI::Widget::PrefSpinUnit _steps_arrow;
UI::Widget::PrefSpinUnit _steps_scale;