diff options
| author | Thomas Holder <thomas@thomas-holder.de> | 2019-07-27 14:40:29 +0000 |
|---|---|---|
| committer | Thomas Holder <thomas@thomas-holder.de> | 2019-07-27 14:40:29 +0000 |
| commit | 63203fb881bfce667a14b2bbb3ec2ee40a9adf77 (patch) | |
| tree | 86f322f2330dd9bd2f6719ffd7fd828bc67e4356 | |
| parent | Crashfix for connectors avoid selected items (diff) | |
| download | inkscape-63203fb881bfce667a14b2bbb3ec2ee40a9adf77.tar.gz inkscape-63203fb881bfce667a14b2bbb3ec2ee40a9adf77.zip | |
Make doc2dt a document property
Closes #340
| -rw-r--r-- | src/desktop.cpp | 30 | ||||
| -rw-r--r-- | src/desktop.h | 8 | ||||
| -rw-r--r-- | src/display/canvas-grid.cpp | 4 | ||||
| -rw-r--r-- | src/document.cpp | 17 | ||||
| -rw-r--r-- | src/document.h | 16 | ||||
| -rw-r--r-- | src/helper/png-write.cpp | 7 | ||||
| -rw-r--r-- | src/object/box3d.cpp | 5 | ||||
| -rw-r--r-- | src/object/persp3d.cpp | 4 | ||||
| -rw-r--r-- | src/object/sp-guide.cpp | 10 | ||||
| -rw-r--r-- | src/object/sp-item.cpp | 22 | ||||
| -rwxr-xr-x | src/selection-chemistry.cpp | 25 | ||||
| -rw-r--r-- | src/ui/dialog/grid-arrange-tab.cpp | 2 | ||||
| -rw-r--r-- | src/ui/dialog/polar-arrange-tab.cpp | 4 | ||||
| -rw-r--r-- | src/ui/tools/spray-tool.cpp | 3 | ||||
| -rw-r--r-- | src/ui/tools/text-tool.cpp | 3 | ||||
| -rw-r--r-- | src/ui/widget/page-sizer.cpp | 2 |
16 files changed, 84 insertions, 78 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp index a56a418c2..6fc3f8d05 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -147,7 +147,6 @@ SPDesktop::SPDesktop() , _widget(nullptr) , _guides_message_context(nullptr) , _active(false) - , _doc2dt(Geom::identity()) , _image_render_observer(this, "/options/rendering/imageinoutlinemode") , grids_visible(false) { @@ -280,11 +279,7 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas, Inkscape::UI::View::EditWid /* Connect event for page resize */ - if (!prefs->getBool("/options/yaxisdown", true)) { - _doc2dt[3] = -1; - _doc2dt[5] = document->getHeight().value("px"); - } - sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (drawing), _doc2dt); + sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (drawing), doc2dt()); _modified_connection = namedview->connectModified(sigc::bind<2>(sigc::ptr_fun(&_namedview_modified), this)); @@ -928,7 +923,7 @@ SPDesktop::set_display_area( Geom::Rect const &r, double border, bool log) } else { zoom = w.height() / r.height(); } - _current_affine.setScale( Geom::Scale(zoom, _doc2dt[3] * zoom) ); + _current_affine.setScale( Geom::Scale(zoom, yaxisdir() * zoom) ); // Zero offset, actual offset calculated later. _current_affine.setOffset( Geom::Point( 0, 0 ) ); @@ -945,7 +940,7 @@ Geom::Rect SPDesktop::get_display_area(bool use_integer_viewbox) const Geom::Rect const viewbox = use_integer_viewbox ? canvas->getViewboxIntegers() : canvas->getViewbox(); double const scale = _current_affine.getZoom(); - return viewbox * Geom::Scale(1. / scale, _doc2dt[3] / scale); + return viewbox * Geom::Scale(1. / scale, yaxisdir() / scale); } /** @@ -956,7 +951,7 @@ SPDesktop::zoom_absolute_keep_point (Geom::Point const &c, double zoom) { zoom = CLAMP (zoom, SP_DESKTOP_ZOOM_MIN, SP_DESKTOP_ZOOM_MAX); Geom::Point w = d2w( c ); // Must be before zoom changed. - _current_affine.setScale( Geom::Scale(zoom, _doc2dt[3] * zoom) ); + _current_affine.setScale( Geom::Scale(zoom, yaxisdir() * zoom) ); set_display_area( c, w ); } @@ -976,7 +971,7 @@ void SPDesktop::zoom_absolute_center_point (Geom::Point const &c, double zoom) { zoom = CLAMP (zoom, SP_DESKTOP_ZOOM_MIN, SP_DESKTOP_ZOOM_MAX); - _current_affine.setScale( Geom::Scale(zoom, _doc2dt[3] * zoom) ); + _current_affine.setScale( Geom::Scale(zoom, yaxisdir() * zoom) ); Geom::Rect viewbox = canvas->getViewbox(); set_display_area( c, viewbox.midpoint() ); } @@ -1762,10 +1757,7 @@ SPDesktop::onDocumentURISet (gchar const* uri) void SPDesktop::onDocumentResized (gdouble width, gdouble height) { - if (!Inkscape::Preferences::get()->getBool("/options/yaxisdown", true)) { - _doc2dt[5] = height; - } - sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (drawing), _doc2dt); + sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (drawing), doc2dt()); Geom::Rect const a(Geom::Point(0, 0), Geom::Point(width, height)); SP_CTRLRECT(page)->setRectangle(a); SP_CTRLRECT(page_border)->setRectangle(a); @@ -1946,19 +1938,21 @@ Geom::Point SPDesktop::d2w(Geom::Point const &p) const return p * _current_affine.d2w(); } -Geom::Affine SPDesktop::doc2dt() const +const Geom::Affine &SPDesktop::doc2dt() const { - return _doc2dt; + g_assert(doc() != nullptr); + return doc()->doc2dt(); } Geom::Affine SPDesktop::dt2doc() const { - return _doc2dt.inverse(); + g_assert(doc() != nullptr); + return doc()->dt2doc(); } Geom::Point SPDesktop::doc2dt(Geom::Point const &p) const { - return p * _doc2dt; + return p * doc2dt(); } Geom::Point SPDesktop::dt2doc(Geom::Point const &p) const diff --git a/src/desktop.h b/src/desktop.h index 9b37754c7..09ac4a634 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -436,13 +436,13 @@ public: Geom::Affine w2d() const; //transformation from window to desktop coordinates (zoom/rotate). Geom::Point w2d(Geom::Point const &p) const; Geom::Point d2w(Geom::Point const &p) const; - Geom::Affine doc2dt() const; + const Geom::Affine& doc2dt() const; Geom::Affine dt2doc() const; Geom::Point doc2dt(Geom::Point const &p) const; Geom::Point dt2doc(Geom::Point const &p) const; - bool is_yaxisdown() const { return _doc2dt[3] > 0; } - double yaxisdir() const { return _doc2dt[3]; } + bool is_yaxisdown() const { return doc2dt()[3] > 0; } + double yaxisdir() const { return doc2dt()[3]; } void setDocument (SPDocument* doc) override; bool shutdown() override; @@ -548,8 +548,6 @@ private: bool _quick_zoom_enabled; ///< Signifies that currently we're in quick zoom mode DesktopAffine _quick_zoom_affine; ///< The transform of the screen before quick zoom - Geom::Affine _doc2dt; - /* * Allow redrawing or refreshing if preferences change */ diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index dc821fbd3..3f98c6926 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -406,9 +406,7 @@ void CanvasGrid::align_clicked(int align) Geom::Point dimensions = doc->getDimensions(); dimensions[Geom::X] *= align % 3 * 0.5; dimensions[Geom::Y] *= align / 3 * 0.5; - if (SP_ACTIVE_DESKTOP) { - dimensions = SP_ACTIVE_DESKTOP->doc2dt(dimensions); - } + dimensions *= doc->doc2dt(); setOrigin(dimensions); } diff --git a/src/document.cpp b/src/document.cpp index a9084ce10..f2be81612 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -115,6 +115,12 @@ SPDocument::SPDocument() : _node_cache_valid(false), _activexmltree(nullptr) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + + if (!prefs->getBool("/options/yaxisdown", true)) { + _doc2dt[3] = -1; + } + // Penalise libavoid for choosing paths with needless extra segments. // This results in much better looking orthogonal connector paths. router->setRoutingPenalty(Avoid::segmentPenalty); @@ -761,6 +767,15 @@ void SPDocument::setHeight(const Inkscape::Util::Quantity &height, bool changeSi root->updateRepr(); } +const Geom::Affine &SPDocument::doc2dt() const +{ + if (root && !is_yaxisdown()) { + _doc2dt[5] = root->height.computed; + } + + return _doc2dt; +} + Geom::Rect SPDocument::getViewBox() const { Geom::Rect viewBox; @@ -839,7 +854,7 @@ void SPDocument::fitToRect(Geom::Rect const &rect, bool with_margins) } } - double y_dir = SP_ACTIVE_DESKTOP ? SP_ACTIVE_DESKTOP->yaxisdir() : 1; + double y_dir = yaxisdir(); if (y_dir > 0) { std::swap(margin_top, margin_bottom); diff --git a/src/document.h b/src/document.h index 609d665bc..fd7e15fc5 100644 --- a/src/document.h +++ b/src/document.h @@ -29,6 +29,7 @@ #include <glibmm/ustring.h> #include <sigc++/sigc++.h> +#include <2geom/affine.h> #include <2geom/forward.h> #include "3rdparty/libcroco/cr-cascade.h" @@ -390,7 +391,22 @@ private: sigc::signal<void> destroySignal; + mutable Geom::Affine _doc2dt; + public: + /// Document to desktop coordinate transformation. + const Geom::Affine &doc2dt() const; + /// Desktop to document coordinate transformation. + const Geom::Affine &dt2doc() const + { + // Note: doc2dt().inverse() happens to be identical to doc2dt() + return doc2dt(); + } + /// True if the desktop Y-axis points down, false if it points up. + bool is_yaxisdown() const { return yaxisdir() > 0; } + /// "1" if the desktop Y-axis points down, "-1" if it points up. + double yaxisdir() const { return _doc2dt[3]; } + void addUndoObserver(Inkscape::UndoStackObserver& observer); void removeUndoObserver(Inkscape::UndoStackObserver& observer); diff --git a/src/helper/png-write.cpp b/src/helper/png-write.cpp index 5fedc08ec..1f2150cf1 100644 --- a/src/helper/png-write.cpp +++ b/src/helper/png-write.cpp @@ -429,13 +429,8 @@ ExportResult sp_export_png_file(SPDocument *doc, gchar const *filename, doc->ensureUpToDate(); - Geom::Affine dt2doc; - if (SP_ACTIVE_DESKTOP) { - dt2doc = SP_ACTIVE_DESKTOP->dt2doc(); - } - /* Calculate translation by transforming to document coordinates (flipping Y)*/ - Geom::Point translation = -(area * dt2doc).min(); + Geom::Point translation = -(area * doc->dt2doc()).min(); /* This calculation is only valid when assumed that (x0,y0)= area.corner(0) and (x1,y1) = area.corner(2) * 1) a[0] * x0 + a[2] * y1 + a[4] = 0.0 diff --git a/src/object/box3d.cpp b/src/object/box3d.cpp index 483e5e7ae..f4b1665e5 100644 --- a/src/object/box3d.cpp +++ b/src/object/box3d.cpp @@ -649,7 +649,10 @@ box3d_XY_axes_are_swapped (SPBox3D *box) { static inline void box3d_aux_set_z_orders (int z_orders[6], int a, int b, int c, int d, int e, int f) { - if (!SP_ACTIVE_DESKTOP || SP_ACTIVE_DESKTOP->is_yaxisdown()) { + // TODO add function argument: SPDocument *doc = box->document + auto doc = SP_ACTIVE_DOCUMENT; + + if (doc->is_yaxisdown()) { std::swap(a, f); std::swap(b, e); std::swap(c, d); diff --git a/src/object/persp3d.cpp b/src/object/persp3d.cpp index 3646f2df1..f772b2649 100644 --- a/src/object/persp3d.cpp +++ b/src/object/persp3d.cpp @@ -96,7 +96,7 @@ static Proj::Pt2 legacy_transform_forward(Proj::Pt2 pt, SPDocument const *doc) { } // <inkscape:perspective> stores inverted y-axis coordinates - if (!SP_ACTIVE_DESKTOP || SP_ACTIVE_DESKTOP->is_yaxisdown()) { + if (doc->is_yaxisdown()) { pt[1] *= -1; if (pt[2]) { pt[1] += doc->getHeight().value("px"); @@ -111,7 +111,7 @@ static Proj::Pt2 legacy_transform_forward(Proj::Pt2 pt, SPDocument const *doc) { */ static Proj::Pt2 legacy_transform_backward(Proj::Pt2 pt, SPDocument const *doc) { // <inkscape:perspective> stores inverted y-axis coordinates - if (!SP_ACTIVE_DESKTOP || SP_ACTIVE_DESKTOP->is_yaxisdown()) { + if (doc->is_yaxisdown()) { pt[1] *= -1; if (pt[2]) { pt[1] += doc->getHeight().value("px"); diff --git a/src/object/sp-guide.cpp b/src/object/sp-guide.cpp index 853511d42..6230e10eb 100644 --- a/src/object/sp-guide.cpp +++ b/src/object/sp-guide.cpp @@ -130,7 +130,7 @@ void SPGuide::set(SPAttributeEnum key, const gchar *value) { Geom::Point direction(newx, newy); // <sodipodi:guide> stores inverted y-axis coordinates - if (!SP_ACTIVE_DESKTOP || SP_ACTIVE_DESKTOP->is_yaxisdown()) { + if (document->is_yaxisdown()) { direction[Geom::Y] *= -1.0; } @@ -181,7 +181,7 @@ void SPGuide::set(SPAttributeEnum key, const gchar *value) { } // <sodipodi:guide> stores inverted y-axis coordinates - if (!SP_ACTIVE_DESKTOP || SP_ACTIVE_DESKTOP->is_yaxisdown()) { + if (document->is_yaxisdown()) { this->point_on_line[Geom::Y] = document->getHeight().value("px") - this->point_on_line[Geom::Y]; } } else { @@ -215,7 +215,7 @@ SPGuide *SPGuide::createSPGuide(SPDocument *doc, Geom::Point const &pt1, Geom::P SPRoot *root = doc->getRoot(); // <sodipodi:guide> stores inverted y-axis coordinates - if (!SP_ACTIVE_DESKTOP || SP_ACTIVE_DESKTOP->is_yaxisdown()) { + if (doc->is_yaxisdown()) { newy = doc->getHeight().value("px") - newy; n[Geom::Y] *= -1.0; } @@ -388,7 +388,7 @@ void SPGuide::moveto(Geom::Point const point_on_line, bool const commit) double newy = point_on_line.y(); // <sodipodi:guide> stores inverted y-axis coordinates - if (!SP_ACTIVE_DESKTOP || SP_ACTIVE_DESKTOP->is_yaxisdown()) { + if (document->is_yaxisdown()) { newy = document->getHeight().value("px") - newy; } @@ -441,7 +441,7 @@ void SPGuide::set_normal(Geom::Point const normal_to_line, bool const commit) auto normal = normal_to_line; // <sodipodi:guide> stores inverted y-axis coordinates - if (!SP_ACTIVE_DESKTOP || SP_ACTIVE_DESKTOP->is_yaxisdown()) { + if (document->is_yaxisdown()) { normal[Geom::Y] *= -1.0; } diff --git a/src/object/sp-item.cpp b/src/object/sp-item.cpp index 98ce76f2e..dfc482267 100644 --- a/src/object/sp-item.cpp +++ b/src/object/sp-item.cpp @@ -502,9 +502,7 @@ void SPItem::set(SPAttributeEnum key, gchar const* value) { case SP_ATTR_TRANSFORM_CENTER_Y: if (value) { item->transform_center_y = g_strtod(value, nullptr); - if (SP_ACTIVE_DESKTOP) { - item->transform_center_y *= -SP_ACTIVE_DESKTOP->yaxisdir(); - } + item->transform_center_y *= -document->yaxisdir(); } else { item->transform_center_y = 0; } @@ -745,9 +743,7 @@ Inkscape::XML::Node* SPItem::write(Inkscape::XML::Document *xml_doc, Inkscape::X repr->setAttribute ("inkscape:transform-center-x", nullptr); if (item->transform_center_y != 0) { auto y = item->transform_center_y; - if (SP_ACTIVE_DESKTOP) { - y *= -SP_ACTIVE_DESKTOP->yaxisdir(); - } + y *= -document->yaxisdir(); sp_repr_set_svg_double (repr, "inkscape:transform-center-y", y); } else repr->setAttribute ("inkscape:transform-center-y", nullptr); @@ -918,8 +914,8 @@ Geom::OptRect SPItem::desktopGeometricBounds() const Geom::OptRect SPItem::desktopVisualBounds() const { Geom::OptRect ret = documentVisualBounds(); - if (ret && SP_ACTIVE_DESKTOP) { - *ret *= SP_ACTIVE_DESKTOP->doc2dt(); + if (ret) { + *ret *= document->doc2dt(); } return ret; } @@ -1590,10 +1586,7 @@ Geom::Affine SPItem::i2doc_affine() const Geom::Affine SPItem::i2dt_affine() const { Geom::Affine ret(i2doc_affine()); - SPDesktop const *desktop = SP_ACTIVE_DESKTOP; - if ( desktop ) { - ret *= desktop->doc2dt(); - } + ret *= document->doc2dt(); return ret; } @@ -1603,9 +1596,8 @@ void SPItem::set_i2d_affine(Geom::Affine const &i2dt) Geom::Affine dt2p; /* desktop to item parent transform */ if (parent) { dt2p = static_cast<SPItem *>(parent)->i2dt_affine().inverse(); - } else if (SP_ACTIVE_DESKTOP) { - SPDesktop *dt = SP_ACTIVE_DESKTOP; - dt2p = dt->dt2doc(); + } else { + dt2p = document->dt2doc(); } Geom::Affine const i2p( i2dt * dt2p ); diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 4c17db511..39b70eb29 100755 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -1863,7 +1863,7 @@ void ObjectSet::rotate90(bool ccw) return; auto items_copy = items(); - double y_dir = desktop() ? desktop()->yaxisdir() : 1; + double y_dir = document() ? document()->yaxisdir() : 1; Geom::Rotate const rot_90(Geom::Point(0, ccw ? -y_dir : y_dir)); // pos. or neg. rotation, depending on the value of ccw for (auto l=items_copy.begin();l!=items_copy.end() ;++l) { SPItem *item = *l; @@ -2966,17 +2966,15 @@ void ObjectSet::cloneOriginalPathLPE(bool allow_transforms) void ObjectSet::toMarker(bool apply) { // sp_selection_tile has similar code - if (desktop() == nullptr) { // TODO: We should not need desktop for that. - // Someone get rid of the dt2doc() call. - return; - } SPDocument *doc = document(); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); // check if something is selected if (isEmpty()) { - desktop()->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to convert to marker.")); + if (desktop()) + desktop()->messageStack()->flash(Inkscape::WARNING_MESSAGE, + _("Select <b>object(s)</b> to convert to marker.")); return; } @@ -2987,7 +2985,7 @@ void ObjectSet::toMarker(bool apply) return; } - Geom::Point center = desktop()->dt2doc(*c); + Geom::Point center = (*c) * doc->dt2doc(); std::vector<SPItem*> items_(items().begin(), items().end()); @@ -3011,7 +3009,7 @@ void ObjectSet::toMarker(bool apply) repr_copies.push_back(dup); } - Geom::Rect bbox(desktop()->dt2doc(r->min()), desktop()->dt2doc(r->max())); + Geom::Rect bbox(r->min() * doc->dt2doc(), r->max() * doc->dt2doc()); if (apply) { // Delete objects so that their clones don't get alerted; @@ -3346,16 +3344,15 @@ void ObjectSet::unSymbol() void ObjectSet::tile(bool apply) { // toMarker has similar code - if (desktop() == nullptr) { //same remark as in toMarker: no good reason to have this. - return; - } SPDocument *doc = document(); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); // check if something is selected if (isEmpty()) { - desktop()->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to convert to pattern.")); + if (desktop()) + desktop()->messageStack()->flash(Inkscape::WARNING_MESSAGE, + _("Select <b>object(s)</b> to convert to pattern.")); return; } @@ -3393,7 +3390,7 @@ void ObjectSet::tile(bool apply) repr_copies.push_back(dup); } - Geom::Rect bbox(desktop()->dt2doc(r->min()), desktop()->dt2doc(r->max())); + Geom::Rect bbox(r->min() * doc->dt2doc(), r->max() * doc->dt2doc()); if (apply) { // delete objects so that their clones don't get alerted; this object will be restored shortly @@ -3730,7 +3727,7 @@ void ObjectSet::createBitmapCopy() } Geom::Affine t; - auto bbox_doc = (*bbox) * _desktop->dt2doc(); + auto bbox_doc = (*bbox) * doc->dt2doc(); double shift_x = bbox_doc.left(); double shift_y = bbox_doc.top(); if (res == Inkscape::Util::Quantity::convert(1, "in", "px")) { // for default 96 dpi, snap it to pixel grid diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp index 8b43090c4..edfdf2838 100644 --- a/src/ui/dialog/grid-arrange-tab.cpp +++ b/src/ui/dialog/grid-arrange-tab.cpp @@ -326,7 +326,7 @@ g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_h Geom::Point move = Geom::Point(new_x, new_y) - min; Geom::Affine const affine = Geom::Affine(Geom::Translate(move)); - item->set_i2d_affine(item->i2doc_affine() * affine * SP_ACTIVE_DESKTOP->doc2dt()); + item->set_i2d_affine(item->i2doc_affine() * affine * item->document->doc2dt()); item->doWriteTransform(item->transform); item->updateRepr(); cnt +=1; diff --git a/src/ui/dialog/polar-arrange-tab.cpp b/src/ui/dialog/polar-arrange-tab.cpp index 98f3bf2aa..5a2b1a145 100644 --- a/src/ui/dialog/polar-arrange-tab.cpp +++ b/src/ui/dialog/polar-arrange-tab.cpp @@ -240,9 +240,9 @@ static Geom::Point getAnchorPoint(int anchor, SPItem *item) // If using center if(anchor == 9) source = item->getCenter(); - else if (SP_ACTIVE_DESKTOP) + else { - source *= SP_ACTIVE_DESKTOP->doc2dt(); + source *= item->document->doc2dt(); } return source; diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp index f29a68691..c910607a9 100644 --- a/src/ui/tools/spray-tool.cpp +++ b/src/ui/tools/spray-tool.cpp @@ -426,8 +426,7 @@ static void sp_spray_transform_path(SPItem * item, Geom::Path &path, Geom::Affin if (item->parent) { dt2p = static_cast<SPItem *>(item->parent)->i2dt_affine().inverse(); } else { - SPDesktop *dt = SP_ACTIVE_DESKTOP; - dt2p = dt->dt2doc(); + dt2p = item->document->dt2doc(); } Geom::Affine i2dt = item->i2dt_affine() * Geom::Translate(center).inverse() * affine * Geom::Translate(center); path *= i2dt * dt2p; diff --git a/src/ui/tools/text-tool.cpp b/src/ui/tools/text-tool.cpp index 18fefa508..b8d66817b 100644 --- a/src/ui/tools/text-tool.cpp +++ b/src/ui/tools/text-tool.cpp @@ -1669,8 +1669,7 @@ static void sp_text_context_update_cursor(TextTool *tc, bool scroll_to_see) if (opt_frame) { // User units to screen pixels Geom::Rect frame = *opt_frame; - frame *= SP_TEXT(tc->text)->i2doc_affine(); - frame *= SP_ACTIVE_DESKTOP->dt2doc().inverse(); + frame *= tc->text->i2dt_affine(); SP_CTRLRECT(tc->frame)->setRectangle(frame); sp_canvas_item_show(tc->frame); diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index bd7409a0c..d869a1c5e 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -344,7 +344,7 @@ PageSizer::setDim (Inkscape::Util::Quantity w, Inkscape::Util::Quantity h, bool 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 - if (changeSize && !SP_ACTIVE_DESKTOP->is_yaxisdown()) { + if (changeSize && !doc->is_yaxisdown()) { Geom::Translate const vert_offset(Geom::Point(0, (old_height.value("px") - h.value("px")))); doc->getRoot()->translateChildItems(vert_offset); } |
