diff options
| author | Matthew Petroff <matthew@mpetroff.net> | 2013-09-11 23:35:54 +0000 |
|---|---|---|
| committer | Matthew Petroff <matthew@mpetroff.net> | 2013-09-11 23:35:54 +0000 |
| commit | 93167c446a8a8e5574e94cda37dc91c17072513b (patch) | |
| tree | 97b53d07efb1198d272679ff97bc77ea2b320c6b /src | |
| parent | Fix document unit change undo bug. (diff) | |
| download | inkscape-93167c446a8a8e5574e94cda37dc91c17072513b.tar.gz inkscape-93167c446a8a8e5574e94cda37dc91c17072513b.zip | |
Finish fixing document unit change undo bug.
(bzr r12475.1.15)
Diffstat (limited to 'src')
| -rw-r--r-- | src/sp-item-group.cpp | 8 | ||||
| -rw-r--r-- | src/ui/dialog/document-properties.cpp | 10 | ||||
| -rw-r--r-- | src/ui/dialog/document-properties.h | 1 |
3 files changed, 10 insertions, 9 deletions
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index ec368bbac..be62764c3 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -591,12 +591,12 @@ void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p) } else { // TODO: transformed text on textpath } - } - - if (SP_IS_BOX3D(item)) { + } else if (SP_IS_BOX3D(item)) { // Force recalculation from perspective box3d_position_set(SP_BOX3D(item)); - } else if (SP_IS_USE(item)) { + } + + if (SP_IS_USE(item)) { // calculate the matrix we need to apply to the clone // to cancel its induced transform from its original Geom::Affine move = final.inverse() * item->transform * final; diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index a2712bf68..1b2761b13 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -175,7 +175,6 @@ DocumentProperties::DocumentProperties() _rum_deflt._changed_connection.block(); _rum_deflt.getUnitMenu()->signal_changed().connect(sigc::mem_fun(*this, &DocumentProperties::onDocUnitChange)); - _old_doc_unit = _rum_deflt.getUnit(); } void DocumentProperties::init() @@ -1637,6 +1636,11 @@ void DocumentProperties::onRemoveGrid() void DocumentProperties::onDocUnitChange() { SPDocument *doc = SP_ACTIVE_DOCUMENT; + Inkscape::XML::Node *repr = sp_desktop_namedview(getDesktop())->getRepr(); + Inkscape::Util::Unit old_doc_unit = unit_table.getUnit("px"); + if(repr->attribute("inkscape:document-units")) { + old_doc_unit = unit_table.getUnit(repr->attribute("inkscape:document-units")); + } Inkscape::Util::Unit doc_unit = _rum_deflt.getUnit(); // Don't execute when change is being undone @@ -1647,7 +1651,6 @@ void DocumentProperties::onDocUnitChange() // Set document unit Inkscape::SVGOStringStream os; os << doc_unit.abbr; - Inkscape::XML::Node *repr = sp_desktop_namedview(getDesktop())->getRepr(); repr->setAttribute("inkscape:document-units", os.str().c_str()); // Set viewBox @@ -1656,12 +1659,11 @@ void DocumentProperties::onDocUnitChange() doc->setViewBox(Geom::Rect::from_xywh(0, 0, width.value(doc_unit), height.value(doc_unit))); // Scale and translate objects - gdouble scale = Inkscape::Util::Quantity::convert(1, _old_doc_unit, doc_unit); + gdouble scale = Inkscape::Util::Quantity::convert(1, old_doc_unit, doc_unit); doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(0, doc->getHeight().value("px"))); doc->setModifiedSinceSave(); - _old_doc_unit = doc_unit; DocumentUndo::done(doc, SP_VERB_NONE, _("Changed document unit")); } diff --git a/src/ui/dialog/document-properties.h b/src/ui/dialog/document-properties.h index 56abf9741..e3ca91731 100644 --- a/src/ui/dialog/document-properties.h +++ b/src/ui/dialog/document-properties.h @@ -218,7 +218,6 @@ private: void onRemoveGrid(); // callback for document unit change - Inkscape::Util::Unit _old_doc_unit; void onDocUnitChange(); }; |
