index 243fe029dfa4137e31debf5b8df99f9b68ca6932..7b94512cfef7710482d5acd610654616cc63846f 100644 (file)
}
}
+void PrefColorPicker::init(const Glib::ustring& label, const std::string& prefs_path, const std::string& attr,
+ guint32 default_rgba)
+{
+ _prefs_path = prefs_path;
+ _attr = attr;
+ _title = label;
+ this->setRgba32( prefs_get_int_attribute (_prefs_path.c_str(), _attr.c_str(), (int)default_rgba) );
+}
+
+void PrefColorPicker::on_changed (guint32 rgba)
+{
+ if (this->is_visible()) //only take action if the user toggled it
+ {
+ prefs_set_int_attribute (_prefs_path.c_str(), _attr.c_str(), (int) rgba);
+ }
+}
+
+void PrefUnit::init(const std::string& prefs_path, const std::string& attr)
+{
+ _prefs_path = prefs_path;
+ _attr = attr;
+ setUnitType(UNIT_TYPE_LINEAR);
+ gchar const * prefval = prefs_get_string_attribute(_prefs_path.c_str(), _attr.c_str());
+ setUnit(prefval);
+}
+
+void PrefUnit::on_changed()
+{
+ if (this->is_visible()) //only take action if user changed value
+ {
+ prefs_set_string_attribute(_prefs_path.c_str(), _attr.c_str(), getUnitAbbr().c_str());
+ }
+}
+
} // namespace Widget
} // namespace UI
} // namespace Inkscape