I found the problem that causes #1 but I didn't found the source that writes the root width and height with the units.
Initially it's set in document.cpp:
/* Quick hack 2 - get default image size into document */ if (!sp_repr_attr (rroot, "width")) sp_repr_set_attr (rroot, "width", A4_WIDTH_STR); if (!sp_repr_attr (rroot, "height")) sp_repr_set_attr (rroot, "height", A4_HEIGHT_STR);
but that uses preset strings "210mm" and "297mm" so you don't need to change that. (Ugly, btw, this needs to be reqritten properly, so it takes initial page size from a template.)
Then it may also be set in root.cpp, but that is already covered, because it uses sp_repr_set_double. Finally it is also set in dialogs/desktop-properties.cpp (document options dialog):
g_snprintf ( c, 32, "%g%s", adjustment->value, sp_unit_selector_get_unit (us)->abbr );
and this one needs to be replaced.
_________________________________________________________________ Tired of spam? Get advanced junk mail protection with MSN Premium http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI...
Hello, ....
g_snprintf ( c, 32, "%g%s", adjustment->value, sp_unit_selector_get_unit (us)->abbr );
and this one needs to be replaced.
Se attached diff for the function that causes the komma. For now I don't see other cases that generate wrong number output even there are a lot printfs.
Many thanks,
Adib.
--- desktop-properties.cvs.cpp 2004-03-14 20:20:44.000000000 +0100 +++ desktop-properties.cpp 2004-03-28 00:49:54.000000000 +0100 @@ -54,8 +54,9 @@ #include "../xml/repr.h" #include "../xml/repr-private.h"
#include "desktop-properties.h" +#include "svg/stringstream.h"
static void sp_dtw_activate_desktop ( Inkscape::Application *inkscape, SPDesktop *desktop, GtkWidget *dialog); @@ -232,9 +233,10 @@ SPDocument *doc; SPRepr *repr; SPUnitSelector *us; const gchar *key; - gchar c[32]; + Inkscape::SVGOStringStream os; +
if (gtk_object_get_data (GTK_OBJECT (dialog), "update")) return;
dt = SP_ACTIVE_DESKTOP; @@ -250,15 +252,15 @@ * cm when writing */ const SPUnit *unit = sp_unit_selector_get_unit (us); if (!strcmp(unit->abbr, "m")) { - g_snprintf (c, 32, "%g%s", 100*adjustment->value, "cm"); + os << 100*adjustment->value << "cm"; } else { - g_snprintf ( c, 32, "%g%s", adjustment->value, unit->abbr); + os << adjustment->value << unit->abbr; }
- sp_repr_set_attr (repr, key, c); + sp_repr_set_attr (repr, key, os.str().c_str());
/* Save this for later if (!strcmp(key, "width") || !strcmp(key, "height")) {
participants (2)
-
Adib Taraben
-
bulia byak