diff --git a/src/document.cpp b/src/document.cpp
index d38d5423fde0fee95ba41a4966c36203e6613b5b..4f54870324b9232fc972ff3897f0ac0b50124826 100644 (file)
--- a/src/document.cpp
+++ b/src/document.cpp
#include "xml/repr.h"
#include "helper/units.h"
#include "inkscape-private.h"
-#include "inkscape_version.h"
+#include "inkscape-version.h"
#include "sp-object-repr.h"
#include "sp-namedview.h"
#include "desktop.h"
router(new Avoid::Router()),
perspectives(0),
current_persp3d(0),
- _collection_queue(0)
+ _collection_queue(0),
+ oldSignalsConnected(false)
{
// Don't use the Consolidate moves optimisation.
router->ConsolidateMoves = false;
modified_id = 0;
}
- _selection_changed_connection.disconnect();
- _desktop_activated_connection.disconnect();
+ if (oldSignalsConnected) {
+ g_signal_handlers_disconnect_by_func(G_OBJECT(INKSCAPE),
+ reinterpret_cast<gpointer>(sp_document_reset_key),
+ static_cast<gpointer>(this));
+ } else {
+ _selection_changed_connection.disconnect();
+ _desktop_activated_connection.disconnect();
+ }
if (keepalive) {
inkscape_unref();
/* fixme: Not sure about this, but lets assume ::build updates */
rroot->setAttribute("sodipodi:version", SODIPODI_VERSION);
- rroot->setAttribute("inkscape:version", INKSCAPE_VERSION);
+ rroot->setAttribute("inkscape:version", Inkscape::version_string);
/* fixme: Again, I moved these here to allow version determining in ::build (Lauris) */
/* Quick hack 2 - get default image size into document */
if (!pagecolor.empty()) {
rnew->setAttribute("pagecolor", pagecolor.data());
}
- Glib::ustring bordercolor = prefs->getString("/template/base/pagecolor");
+ Glib::ustring bordercolor = prefs->getString("/template/base/bordercolor");
if (!bordercolor.empty()) {
rnew->setAttribute("bordercolor", bordercolor.data());
}
G_CALLBACK(sp_document_reset_key), document);
g_signal_connect(G_OBJECT(INKSCAPE), "activate_desktop",
G_CALLBACK(sp_document_reset_key), document);
+ document->oldSignalsConnected = true;
} else {
document->_selection_changed_connection = Inkscape::NSApplication::Editor::connectSelectionChanged (sigc::mem_fun (*document, &SPDocument::reset_key));
document->_desktop_activated_connection = Inkscape::NSApplication::Editor::connectDesktopActivated (sigc::mem_fun (*document, &SPDocument::reset_key));
+ document->oldSignalsConnected = false;
}
return document;
if (root->width.unit == SVGLength::PERCENT && root->viewBox_set) { // set to viewBox=
root->viewBox.x1 = root->viewBox.x0 + sp_units_get_pixels (width, *unit);
} else { // set to width=
+ gdouble old_computed = root->width.computed;
root->width.computed = sp_units_get_pixels (width, *unit);
/* SVG does not support meters as a unit, so we must translate meters to
* cm when writing */
root->width.value = width;
root->width.unit = (SVGLength::Unit) sp_unit_get_svg_unit(unit);
}
+
+ if (root->viewBox_set)
+ root->viewBox.x1 = root->viewBox.x0 + (root->width.computed / old_computed) * (root->viewBox.x1 - root->viewBox.x0);
}
SP_OBJECT (root)->updateRepr();
@@ -532,6 +545,7 @@ void sp_document_set_height (SPDocument * document, gdouble height, const SPUnit
if (root->height.unit == SVGLength::PERCENT && root->viewBox_set) { // set to viewBox=
root->viewBox.y1 = root->viewBox.y0 + sp_units_get_pixels (height, *unit);
} else { // set to height=
+ gdouble old_computed = root->height.computed;
root->height.computed = sp_units_get_pixels (height, *unit);
/* SVG does not support meters as a unit, so we must translate meters to
* cm when writing */
@@ -542,6 +556,9 @@ void sp_document_set_height (SPDocument * document, gdouble height, const SPUnit
root->height.value = height;
root->height.unit = (SVGLength::Unit) sp_unit_get_svg_unit(unit);
}
+
+ if (root->viewBox_set)
+ root->viewBox.y1 = root->viewBox.y0 + (root->height.computed / old_computed) * (root->viewBox.y1 - root->viewBox.y0);
}
SP_OBJECT (root)->updateRepr();