summaryrefslogtreecommitdiffstats
path: root/src/ui/widget/page-sizer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/widget/page-sizer.cpp')
-rw-r--r--src/ui/widget/page-sizer.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp
index df464fbb0..8c3b44bf5 100644
--- a/src/ui/widget/page-sizer.cpp
+++ b/src/ui/widget/page-sizer.cpp
@@ -32,7 +32,7 @@
#include <2geom/transforms.h>
-#include "desktop-handles.h"
+
#include "document.h"
#include "desktop.h"
#include "helper/action.h"
@@ -309,7 +309,7 @@ PageSizer::PageSizer(Registry & _wr)
// Setting default custom unit to document unit
SPDesktop *dt = SP_ACTIVE_DESKTOP;
- SPNamedView *nv = sp_desktop_namedview(dt);
+ SPNamedView *nv = dt->getNamedView();
_wr.setUpdating (true);
if (nv->page_size_units) {
_dimensionUnits.setUnit(nv->page_size_units->abbr);
@@ -477,14 +477,15 @@ PageSizer::setDim (Inkscape::Util::Quantity w, Inkscape::Util::Quantity h, bool
_unit = w.unit->abbr;
if (SP_ACTIVE_DESKTOP && !_widgetRegistry->isUpdating()) {
- SPDocument *doc = sp_desktop_document(SP_ACTIVE_DESKTOP);
+ SPDocument *doc = SP_ACTIVE_DESKTOP->getDocument();
Inkscape::Util::Quantity const old_height = doc->getHeight();
- doc->setWidth (w, changeSize);
- doc->setHeight (h, changeSize);
+ doc->setWidthAndHeight (w, h, changeSize);
// The origin for the user is in the lower left corner; this point should remain stationary when
// changing the page size. The SVG's origin however is in the upper left corner, so we must compensate for this
- Geom::Translate const vert_offset(Geom::Point(0, (old_height.value("px") - h.value("px"))));
- doc->getRoot()->translateChildItems(vert_offset);
+ if (changeSize) {
+ Geom::Translate const vert_offset(Geom::Point(0, (old_height.value("px") - h.value("px"))));
+ doc->getRoot()->translateChildItems(vert_offset);
+ }
DocumentUndo::done(doc, SP_VERB_NONE, _("Set page size"));
}
@@ -606,7 +607,7 @@ PageSizer::fire_fit_canvas_to_selection_or_drawing()
SPNamedView *nv;
Inkscape::XML::Node *nv_repr;
- if ((doc = sp_desktop_document(SP_ACTIVE_DESKTOP))
+ if ((doc = SP_ACTIVE_DESKTOP->getDocument())
&& (nv = sp_document_namedview(doc, 0))
&& (nv_repr = nv->getRepr())) {
_lockMarginUpdate = true;