summaryrefslogtreecommitdiffstats
path: root/src/ui/widget
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2007-12-14 18:46:47 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2007-12-14 18:46:47 +0000
commiteb87dc10b67de267764b3fac83b00b89d93b98ad (patch)
tree4504a1ed05da4a24409af43adfcf6c855ad96cca /src/ui/widget
parentupdate to latest 2geom (diff)
downloadinkscape-eb87dc10b67de267764b3fac83b00b89d93b98ad.tar.gz
inkscape-eb87dc10b67de267764b3fac83b00b89d93b98ad.zip
Add default grid settings to Inkscape preferences.
(bzr r4230)
Diffstat (limited to 'src/ui/widget')
-rw-r--r--src/ui/widget/color-picker.h2
-rw-r--r--src/ui/widget/preferences-widget.cpp17
-rw-r--r--src/ui/widget/preferences-widget.h18
3 files changed, 36 insertions, 1 deletions
diff --git a/src/ui/widget/color-picker.h b/src/ui/widget/color-picker.h
index 0349c75e5..9ac38b84b 100644
--- a/src/ui/widget/color-picker.h
+++ b/src/ui/widget/color-picker.h
@@ -58,7 +58,7 @@ protected:
ColorPreview _preview;
Gtk::Tooltips _tt;
- const Glib::ustring _title;
+ /*const*/ Glib::ustring _title;
sigc::signal<void,guint32> _changed_signal;
guint32 _rgba;
bool _undo;
diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp
index 243fe029d..29f86745e 100644
--- a/src/ui/widget/preferences-widget.cpp
+++ b/src/ui/widget/preferences-widget.cpp
@@ -339,6 +339,23 @@ 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);
+ }
+}
+
} // namespace Widget
} // namespace UI
} // namespace Inkscape
diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h
index 72f010f13..f754cde1b 100644
--- a/src/ui/widget/preferences-widget.h
+++ b/src/ui/widget/preferences-widget.h
@@ -27,6 +27,8 @@
#include <sigc++/sigc++.h>
//#include <glibmm/i18n.h>
+#include "ui/widget/color-picker.h"
+
namespace Inkscape {
namespace UI {
namespace Widget {
@@ -128,6 +130,22 @@ protected:
void onFileChanged();
};
+class PrefColorPicker : public ColorPicker
+{
+public:
+ PrefColorPicker() : ColorPicker("", "", 0, false) {};
+ virtual ~PrefColorPicker() {};
+
+ void init(const Glib::ustring& label, const std::string& prefs_path, const std::string& attr,
+ guint32 default_rgba);
+
+protected:
+ std::string _prefs_path;
+ std::string _attr;
+ virtual void on_changed (guint32 rgba);
+};
+
+
class DialogPage : public Gtk::Table
{
public: