diff options
| author | Nicolas Dufour <nicoduf@yahoo.fr> | 2010-09-23 16:12:29 +0000 |
|---|---|---|
| committer | JazzyNico <nicoduf@yahoo.fr> | 2010-09-23 16:12:29 +0000 |
| commit | fa58c37ea0d719b4f3ba693e7368fbbd454ff74a (patch) | |
| tree | 174f71b780f45f536d8ba30b17ed607a9334a093 | |
| parent | Tablet auto-organization and naming. (diff) | |
| download | inkscape-fa58c37ea0d719b4f3ba693e7368fbbd454ff74a.tar.gz inkscape-fa58c37ea0d719b4f3ba693e7368fbbd454ff74a.zip | |
Fix for bug #635521 (Fields in Transform dialog reset).
(bzr r9778)
| -rw-r--r-- | src/ui/dialog/transformation.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index 1cab38d98..1ceed50a7 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -26,6 +26,7 @@ #include "selection-chemistry.h" #include "verbs.h" #include "preferences.h" +#include "sp-namedview.h" #include "sp-item-transform.h" #include "macros.h" #include "sp-item.h" @@ -198,6 +199,14 @@ void Transformation::layoutPageMove() { _units_move.setUnitType(UNIT_TYPE_LINEAR); + + // Setting default unit to document unit + SPDesktop *dt = getDesktop(); + SPNamedView *nv = sp_desktop_namedview(dt); + if (nv->doc_units) { + _units_move.setUnit(nv->doc_units->abbr); + } + _scalar_move_horizontal.initScalar(-1e6, 1e6); _scalar_move_horizontal.setDigits(3); _scalar_move_horizontal.setIncrements(0.1, 1.0); @@ -462,8 +471,9 @@ Transformation::updatePageMove(Inkscape::Selection *selection) double x = bbox->min()[Geom::X]; double y = bbox->min()[Geom::Y]; - _scalar_move_horizontal.setValue(x, "px"); - _scalar_move_vertical.setValue(y, "px"); + double conversion = _units_move.getConversion("px"); + _scalar_move_horizontal.setValue(x / conversion); + _scalar_move_vertical.setValue(y / conversion); } } else { // do nothing, so you can apply the same relative move to many objects in turn @@ -871,6 +881,8 @@ Transformation::onMoveRelativeToggled() double x = _scalar_move_horizontal.getValue("px"); double y = _scalar_move_vertical.getValue("px"); + double conversion = _units_move.getConversion("px"); + //g_message("onMoveRelativeToggled: %f, %f px\n", x, y); Geom::OptRect bbox = selection->bounds(); @@ -878,12 +890,12 @@ Transformation::onMoveRelativeToggled() if (bbox) { if (_check_move_relative.get_active()) { // From absolute to relative - _scalar_move_horizontal.setValue(x - bbox->min()[Geom::X], "px"); - _scalar_move_vertical.setValue( y - bbox->min()[Geom::Y], "px"); + _scalar_move_horizontal.setValue((x - bbox->min()[Geom::X]) / conversion); + _scalar_move_vertical.setValue(( y - bbox->min()[Geom::Y]) / conversion); } else { // From relative to absolute - _scalar_move_horizontal.setValue(bbox->min()[Geom::X] + x, "px"); - _scalar_move_vertical.setValue( bbox->min()[Geom::Y] + y, "px"); + _scalar_move_horizontal.setValue((bbox->min()[Geom::X] + x) / conversion); + _scalar_move_vertical.setValue(( bbox->min()[Geom::Y] + y) / conversion); } } |
