summaryrefslogtreecommitdiffstats
path: root/src/verbs.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2017-03-22 19:03:41 +0000
committertavmjong-free <tavmjong@free.fr>2017-03-22 19:03:41 +0000
commita184a53752fb8027c22e4a5d68819fd7b78a15d8 (patch)
treeaa4d7f84fc1b76dc8afde129eade5d660c9e0219 /src/verbs.cpp
parentAdd entry for canvas rotate step in Inkscape Preferences dialog. (diff)
downloadinkscape-a184a53752fb8027c22e4a5d68819fd7b78a15d8.tar.gz
inkscape-a184a53752fb8027c22e4a5d68819fd7b78a15d8.zip
Add canvas flip. No GUI. Can be bound to keys via preferences.
(bzr r15606)
Diffstat (limited to 'src/verbs.cpp')
-rw-r--r--src/verbs.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/verbs.cpp b/src/verbs.cpp
index 78967e89b..b7b6da340 100644
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
@@ -1996,6 +1996,40 @@ void ZoomVerb::perform(SPAction *action, void *data)
case SP_VERB_ROTATE_ZERO:
dt->rotate_absolute_center_point( midpoint, 0.0 );
break;
+ case SP_VERB_FLIP_HORIZONTAL:
+ {
+ // While drawing with the pen/pencil tool, flip towards the end of the unfinished path
+ if (tools_isactive(dt, TOOLS_FREEHAND_PENCIL) || tools_isactive(dt, TOOLS_FREEHAND_PEN)) {
+ SPCurve *rc = SP_DRAW_CONTEXT(ec)->red_curve;
+ if (!rc->is_empty()) {
+ Geom::Point const flip_to (*rc->last_point());
+ dt->flip_relative_keep_point(flip_to, SPDesktop::FLIP_HORIZONTAL);
+ break;
+ }
+ }
+
+ dt->flip_relative_center_point( midpoint, SPDesktop::FLIP_HORIZONTAL);
+ break;
+ }
+ case SP_VERB_FLIP_VERTICAL:
+ {
+ gint mul = 1 + Inkscape::UI::Tools::gobble_key_events( GDK_KEY_parenright, 0);
+ // While drawing with the pen/pencil tool, flip towards the end of the unfinished path
+ if (tools_isactive(dt, TOOLS_FREEHAND_PENCIL) || tools_isactive(dt, TOOLS_FREEHAND_PEN)) {
+ SPCurve *rc = SP_DRAW_CONTEXT(ec)->red_curve;
+ if (!rc->is_empty()) {
+ Geom::Point const flip_to (*rc->last_point());
+ dt->flip_relative_keep_point(flip_to, SPDesktop::FLIP_VERTICAL);
+ break;
+ }
+ }
+
+ dt->flip_relative_center_point( midpoint, SPDesktop::FLIP_VERTICAL);
+ break;
+ }
+ case SP_VERB_FLIP_NONE:
+ dt->flip_absolute_center_point( midpoint, SPDesktop::FLIP_NONE);
+ break;
case SP_VERB_TOGGLE_RULERS:
dt->toggleRulers();
break;
@@ -2961,6 +2995,10 @@ Verb *Verb::_base_verbs[] = {
new ZoomVerb(SP_VERB_ROTATE_CCW, "RotateCounterClockwise", N_("Rotate Counter-Clockwise"), N_("Rotate canvas counter-clockwise"), NULL),
new ZoomVerb(SP_VERB_ROTATE_ZERO, "RotateZero", N_("Rotate Zero"), N_("Reset canvas rotation to zero"), NULL),
+ new ZoomVerb(SP_VERB_FLIP_HORIZONTAL, "FlipHorizontal", N_("Flip Horizontal"), N_("Flip canvas horizontally"), INKSCAPE_ICON("object-flip-horizontal")),
+ new ZoomVerb(SP_VERB_FLIP_VERTICAL, "FlipVertical", N_("Flip Vertical"), N_("Flip canvas vertically"), INKSCAPE_ICON("object-flip-vertical")),
+ new ZoomVerb(SP_VERB_FLIP_NONE, "FlipNone", N_("Flip None"), N_("Undo any flip"), NULL),
+
// WHY ARE THE FOLLOWING ZoomVerbs???