void
Dialog_Color::create_color_edit_widget()
{
- color_edit_widget = manage(new Widget_ColorEdit());
- color_edit_widget->signal_value_changed().connect(sigc::mem_fun(*this,
+ color_edit_widget = manage(new Gtk::ColorSelection());
+ color_edit_widget->set_has_opacity_control(true);
+ color_edit_widget->signal_color_changed().connect(sigc::mem_fun(*this,
&studio::Dialog_Color::on_color_changed));
get_vbox()->pack_start(*color_edit_widget);
}
}
void
+Dialog_Color::set_color(const synfig::Color& color)
+{
+ color_edit_widget->set_current_color(studio::colorconv_synfig2gdk(color));
+ color_edit_widget->set_current_alpha(color.get_a());
+}
+
+synfig::Color
+Dialog_Color::get_color() const
+{
+ return studio::colorconv_gdk2synfig(color_edit_widget->get_current_color(), color_edit_widget->get_current_alpha() / 65535.0);
+}
+
+void
Dialog_Color::reset()
{
signal_edited_.clear();
/* === H E A D E R S ======================================================= */
#include <gtk/gtk.h>
+#include <gtkmm/colorselection.h>
#include <gtkmm/dialog.h>
#include <gtkmm/tooltips.h>
#include <sigc++/functors/slot.h>
DialogSettings dialog_settings;
Gtk::Tooltips tooltips;
- Widget_ColorEdit* color_edit_widget;
+ Gtk::ColorSelection* color_edit_widget;
sigc::signal<void,synfig::Color> signal_edited_;
sigc::signal<void,synfig::Color>& signal_edited() { return signal_edited_; }
- void set_color(const synfig::Color& x) { color_edit_widget->set_value(x); }
- synfig::Color get_color() const { return color_edit_widget->get_value(); }
+ void set_color(const synfig::Color& x);
+ synfig::Color get_color() const;
void reset();
bool busy() const { return busy_; }