diff options
| author | Ted Gould <ted@gould.cx> | 2008-10-27 18:03:09 +0000 |
|---|---|---|
| committer | Ted Gould <ted@canonical.com> | 2008-10-27 18:03:09 +0000 |
| commit | 7dbe11bc23efa5f51a9b84e7d0f6dd16e63e0902 (patch) | |
| tree | 7d3a2b95b84a03a19cb132cdf88bea0ab6dc4773 /src/style.cpp | |
| parent | Merging from trunk (diff) | |
| download | inkscape-7dbe11bc23efa5f51a9b84e7d0f6dd16e63e0902.tar.gz inkscape-7dbe11bc23efa5f51a9b84e7d0f6dd16e63e0902.zip | |
From trunk
(bzr r6885)
Diffstat (limited to 'src/style.cpp')
| -rw-r--r-- | src/style.cpp | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/src/style.cpp b/src/style.cpp index 966764800..a5b25e6ff 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -1,9 +1,9 @@ #define __SP_STYLE_C__ -/** \file - * SVG stylesheets implementation. - * - * Authors: +/** @file + * @brief SVG stylesheets implementation. + */ +/* Authors: * Lauris Kaplinski <lauris@kaplinski.com> * Peter Moulder <pmoulder@mail.csse.monash.edu.au> * bulia byak <buliabyak@users.sf.net> @@ -41,9 +41,11 @@ #include "style.h" #include "svg/css-ostringstream.h" #include "xml/repr.h" +#include "xml/simple-document.h" #include "unit-constants.h" #include "2geom/isnan.h" #include "macros.h" +#include "preferences.h" #include "sp-filter-reference.h" @@ -790,15 +792,33 @@ sp_style_read_from_object(SPStyle *style, SPObject *object) /** - * Read style properties from repr only. + * Read style properties from preferences. + * @param style The style to write to + * @param path Preferences directory from which the style should be read */ void -sp_style_read_from_repr(SPStyle *style, Inkscape::XML::Node *repr) +sp_style_read_from_prefs(SPStyle *style, Glib::ustring const &path) { g_return_if_fail(style != NULL); - g_return_if_fail(repr != NULL); + g_return_if_fail(path != ""); + + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - sp_style_read(style, NULL, repr); + // not optimal: we reconstruct the node based on the prefs, then pass it to + // sp_style_read for actual processing. + Inkscape::XML::SimpleDocument *tempdoc = new Inkscape::XML::SimpleDocument; + Inkscape::XML::Node *tempnode = tempdoc->createElement("temp"); + + std::vector<Inkscape::Preferences::Entry> attrs = prefs->getAllEntries(path); + for (std::vector<Inkscape::Preferences::Entry>::iterator i = attrs.begin(); i != attrs.end(); ++i) { + tempnode->setAttribute(i->getEntryName().data(), i->getString().data()); + } + + sp_style_read(style, NULL, tempnode); + + Inkscape::GC::release(tempnode); + Inkscape::GC::release(tempdoc); + delete tempdoc; } |
