diff options
Diffstat (limited to 'src/preferences.cpp')
| -rw-r--r-- | src/preferences.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/preferences.cpp b/src/preferences.cpp index afdfad010..79b60191f 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -434,6 +434,17 @@ void Preferences::setBool(Glib::ustring const &pref_path, bool value) } /** + * Set an point attribute of a preference. + * + * @param pref_path Path of the preference to modify. + * @param value The new value of the pref attribute. + */ +void Preferences::setPoint(Glib::ustring const &pref_path, Geom::Point value) +{ + _setRawValue(pref_path, Glib::ustring::compose("%1",value[Geom::X]) + "," + Glib::ustring::compose("%1",value[Geom::Y])); +} + +/** * Set an integer attribute of a preference. * * @param pref_path Path of the preference to modify. @@ -819,6 +830,18 @@ bool Preferences::_extractBool(Entry const &v) } } +Geom::Point Preferences::_extractPoint(Entry const &v) +{ + if (v.cached_point) return v.value_point; + v.cached_point = true; + gchar const *s = static_cast<gchar const *>(v._value); + gchar ** strarray = g_strsplit(s, ",", 2); + double newx = atoi(strarray[0]); + double newy = atoi(strarray[1]); + g_strfreev (strarray); + return Geom::Point(newx, newy); +} + int Preferences::_extractInt(Entry const &v) { if (v.cached_int) return v.value_int; |
