X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fui%2Fwidget%2Fpreferences-widget.cpp;h=6c5473caa062ca39e0e64f0e0257cde57170c024;hb=fd5c8954a92eac9af9af21d2a3665e9c673203a2;hp=243fe029dfa4137e31debf5b8df99f9b68ca6932;hpb=e38df2ff7d95236e712464a1a8c472f2d9636e53;p=inkscape.git diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 243fe029d..6c5473caa 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -275,7 +275,7 @@ void PrefEntryButtonHBox::init(const std::string& prefs_path, const std::string& _attr = attr; _default_string = default_string; relatedEntry = new Gtk::Entry(); - relatedButton = new Gtk::Button("Reset"); + relatedButton = new Gtk::Button(_("Reset")); relatedEntry->set_invisible_char('*'); relatedEntry->set_visibility(visibility); relatedEntry->set_text(prefs_get_string_attribute(_prefs_path.c_str(), _attr.c_str())); @@ -339,6 +339,40 @@ void PrefEntry::on_changed() } } +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