summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog
diff options
context:
space:
mode:
authorThomas Holder <thomas@thomas-holder.de>2018-09-12 14:43:47 +0000
committerThomas Holder <thomas@thomas-holder.de>2018-09-12 14:43:47 +0000
commit1fa0c72b664afa4803dffd463ed11ce01632ab76 (patch)
treec1f746d4e8f7a5d65541cf6c05d3cdc79b3f9c10 /src/ui/dialog
parentFix preferences crash (diff)
downloadinkscape-1fa0c72b664afa4803dffd463ed11ce01632ab76.tar.gz
inkscape-1fa0c72b664afa4803dffd463ed11ce01632ab76.zip
New option to invert y-axis
Replaces all hard coded or implicit desktop coordinate usage with doc2dt multiplication. New global preference: Interface > Origin at upper left https://bugs.launchpad.net/inkscape/+bug/170049
Diffstat (limited to 'src/ui/dialog')
-rw-r--r--src/ui/dialog/align-and-distribute.cpp18
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp5
-rw-r--r--src/ui/dialog/inkscape-preferences.h1
3 files changed, 22 insertions, 2 deletions
diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp
index 7ad8a5e18..b21fd2956 100644
--- a/src/ui/dialog/align-and-distribute.cpp
+++ b/src/ui/dialog/align-and-distribute.cpp
@@ -130,7 +130,7 @@ void ActionAlign::do_action(SPDesktop *desktop, int index)
std::vector<SPItem*> selected(selection->items().begin(), selection->items().end());
if (selected.empty()) return;
- const Coeffs &a = _allCoeffs[index];
+ Coeffs a = _allCoeffs[index]; // copy
SPItem *focus = nullptr;
Geom::OptRect b = Geom::OptRect();
Selection::CompareSize horiz = (a.mx0 != 0.0) || (a.mx1 != 0.0)
@@ -168,6 +168,13 @@ void ActionAlign::do_action(SPDesktop *desktop, int index)
b = focus->desktopPreferredBounds();
g_return_if_fail(b);
+ if (horiz == Selection::HORIZONTAL && desktop->is_yaxisdown()) {
+ a.my0 = 1. - a.my0;
+ a.my1 = 1. - a.my1;
+ a.sy0 = 1. - a.sy0;
+ a.sy1 = 1. - a.sy1;
+ }
+
// Generate the move point from the selected bounding box
Geom::Point mp = Geom::Point(a.mx0 * b->min()[Geom::X] + a.mx1 * b->max()[Geom::X],
a.my0 * b->min()[Geom::Y] + a.my1 * b->max()[Geom::Y]);
@@ -303,6 +310,13 @@ private :
++second;
if (second == selected.end()) return;
+ double kBegin = _kBegin;
+ double kEnd = _kEnd;
+ if (_orientation == Geom::Y && desktop->is_yaxisdown()) {
+ kBegin = 1. - kBegin;
+ kEnd = 1. - kEnd;
+ }
+
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
int prefs_bbox = prefs->getBool("/tools/bounding_box");
std::vector< BBoxSort > sorted;
@@ -312,7 +326,7 @@ private :
SPItem *item = *it;
Geom::OptRect bbox = !prefs_bbox ? (item)->desktopVisualBounds() : (item)->desktopGeometricBounds();
if (bbox) {
- sorted.emplace_back(item, *bbox, _orientation, _kBegin, _kEnd);
+ sorted.emplace_back(item, *bbox, _orientation, kBegin, kEnd);
}
}
//sort bbox by anchors
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index ecf470d21..bb15d771d 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -771,6 +771,11 @@ void InkscapePreferences::initPageUI()
_("Selects whether the dockbar switcher will show text labels, icons, or both"), false);
}
+ _ui_yaxisdown.init( _("Origin at upper left with y-axis pointing down (requires restart)"), "/options/yaxisdown", false);
+ _page_ui.add_line( false, "", _ui_yaxisdown, "",
+ _("When off, origin is at lower left corner and y-axis points up"), true);
+
+
// Theme
_page_theme.add_group_header(_("Theme changes"));
{
diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h
index 55ea35f63..d0b51fa83 100644
--- a/src/ui/dialog/inkscape-preferences.h
+++ b/src/ui/dialog/inkscape-preferences.h
@@ -385,6 +385,7 @@ protected:
UI::Widget::PrefSpinButton _misc_recent;
UI::Widget::PrefCheckButton _ui_partialdynamic;
UI::Widget::ZoomCorrRulerSlider _ui_zoom_correction;
+ UI::Widget::PrefCheckButton _ui_yaxisdown;
//Spellcheck
UI::Widget::PrefCombo _spell_language;