From 16f7dcafe4fac100f1325b88f4623b7d5adf9a97 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Sun, 26 Sep 2010 19:53:05 +0200 Subject: Fix for Bug #586955 (the unit for user defined document size is not refreshed if document is reopen). (bzr r9793) --- src/sp-namedview.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/sp-namedview.cpp') diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index 44c3bf620..f7fdef94b 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -218,6 +218,7 @@ static void sp_namedview_build(SPObject *object, SPDocument *document, Inkscape: } sp_object_read_attr(object, "inkscape:document-units"); + sp_object_read_attr(object, "units"); sp_object_read_attr(object, "viewonly"); sp_object_read_attr(object, "showguides"); sp_object_read_attr(object, "showgrid"); @@ -572,6 +573,30 @@ static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *va object->requestModified(SP_OBJECT_MODIFIED_FLAG); break; } + case SP_ATTR_UNITS: { + SPUnit const *new_unit = NULL; + + if (value) { + SPUnit const *const req_unit = sp_unit_get_by_abbreviation(value); + if ( req_unit == NULL ) { + g_warning("Unrecognized unit `%s'", value); + /* fixme: Document errors should be reported in the status bar or + * the like (e.g. as per + * http://www.w3.org/TR/SVG11/implnote.html#ErrorProcessing); g_log + * should be only for programmer errors. */ + } else if ( req_unit->base == SP_UNIT_ABSOLUTE || + req_unit->base == SP_UNIT_DEVICE ) { + new_unit = req_unit; + } else { + g_warning("Document units must be absolute like `mm', `pt' or `px', but found `%s'", + value); + /* fixme: Don't use g_log (see above). */ + } + } + nv->units = new_unit; + object->requestModified(SP_OBJECT_MODIFIED_FLAG); + break; + } default: if (((SPObjectClass *) (parent_class))->set) { ((SPObjectClass *) (parent_class))->set(object, key, value); -- cgit v1.2.3 From 144819c918dc761641c3cb5a490205fb73194ee3 Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Wed, 17 Nov 2010 13:12:56 +1100 Subject: Super duper mega (fun!) commit: replaced encoding=utf-8 with fileencoding=utf-8 in all 1074 Vim modelines. The reason for this is that (a) setting the encoding isn't nice, and (b) Vim 7.3 (with modeline enabled) disallows it and pops up an error whenever you open any file with it ("invalid modeline"). Also corrected five deviant modestrings: * src/ui/widget/dock.cpp and src/ui/widget/dock.h: missing colon at the end * src/ui/dialog/tile.cpp: removed gratuitous second colon at the end * src/helper/units-test.h: removed gratuitous space before a colon * share/extensions/export_gimp_palette.py: missing textwidth=99 That's my geekiest commit yet. (bzr r9900) --- src/sp-namedview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/sp-namedview.cpp') diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index f7fdef94b..be2bcd478 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -1063,4 +1063,4 @@ void SPNamedView::scrollAllDesktops(double dx, double dy, bool is_scrolling) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : -- cgit v1.2.3