diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2007-12-20 16:07:52 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2007-12-20 16:07:52 +0000 |
| commit | 64e80ad6870950aff58300b3034e8848b63c9049 (patch) | |
| tree | b6f2f881eb0b7fb199e937e5eedbafb8a5e8afcb /src/xml/repr-util.cpp | |
| parent | (Hopefully) proper fix this time for stolen 'D + modifier' shortcuts. (diff) | |
| download | inkscape-64e80ad6870950aff58300b3034e8848b63c9049.tar.gz inkscape-64e80ad6870950aff58300b3034e8848b63c9049.zip | |
guidelines: minor corrections
add point reading to repr-util.cpp
(bzr r4264)
Diffstat (limited to 'src/xml/repr-util.cpp')
| -rw-r--r-- | src/xml/repr-util.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/xml/repr-util.cpp b/src/xml/repr-util.cpp index 560a70004..7a45f6fcd 100644 --- a/src/xml/repr-util.cpp +++ b/src/xml/repr-util.cpp @@ -576,7 +576,7 @@ sp_repr_set_svg_double(Inkscape::XML::Node *repr, gchar const *key, double val) return true; } -unsigned sp_repr_set_svg_point(Inkscape::XML::Node *repr, gchar const *key, Geom::Point val) +unsigned sp_repr_set_point(Inkscape::XML::Node *repr, gchar const *key, Geom::Point val) { g_return_val_if_fail(repr != NULL, FALSE); g_return_val_if_fail(key != NULL, FALSE); @@ -588,6 +588,30 @@ unsigned sp_repr_set_svg_point(Inkscape::XML::Node *repr, gchar const *key, Geom return true; } +unsigned int +sp_repr_get_point(Inkscape::XML::Node *repr, gchar const *key, Geom::Point *val) +{ + g_return_val_if_fail(repr != NULL, FALSE); + g_return_val_if_fail(key != NULL, FALSE); + g_return_val_if_fail(val != NULL, FALSE); + + gchar const *v = repr->attribute(key); + + gchar ** strarray = g_strsplit(v, ",", 2); + + if (strarray && strarray[0] && strarray[1]) { + double newx, newy; + newx = g_ascii_strtod(strarray[0], NULL); + newy = g_ascii_strtod(strarray[1], NULL); + g_strfreev (strarray); + *val = Geom::Point(newx, newy); + return TRUE; + } + + g_strfreev (strarray); + return FALSE; +} + /* Local Variables: mode:c++ |
