summaryrefslogtreecommitdiffstats
path: root/src/preferences.cpp
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2018-11-25 10:10:02 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2018-11-25 10:11:19 +0000
commit5e593d90927b37a54f5c2d663bd25d6d661d7be9 (patch)
tree96abef646519840e5946e941863d1991cbb458eb /src/preferences.cpp
parentAdd plugs for the icon and GTK3 themes (diff)
downloadinkscape-5e593d90927b37a54f5c2d663bd25d6d661d7be9.tar.gz
inkscape-5e593d90927b37a54f5c2d663bd25d6d661d7be9.zip
Fix bug 1804946: Measurement tool is very slow when using grids
This move from Namedview to a new prefernecr point to not reload full namedview on meassure
Diffstat (limited to 'src/preferences.cpp')
-rw-r--r--src/preferences.cpp23
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;