make it possible (hackily) to pick the base color for the knob images created by MotionFeedback

git-svn-id: svn://localhost/ardour2/branches/3.0@10337 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-10-29 15:53:22 +00:00
parent f871d665d5
commit d7b685cc5f
2 changed files with 19 additions and 3 deletions

View File

@ -63,7 +63,7 @@ class MotionFeedback : public Gtk::VBox
boost::shared_ptr<PBD::Controllable> controllable() const;
virtual void set_controllable (boost::shared_ptr<PBD::Controllable> c);
void set_lamp_color (const Gdk::Color&);
static void set_lamp_color (const std::string&);
static Glib::RefPtr<Gdk::Pixbuf> render_pixbuf (int size);
@ -111,6 +111,7 @@ class MotionFeedback : public Gtk::VBox
Gtk::EventBox* value_packer;
Glib::RefPtr<Gdk::Pixbuf> pixbuf;
BindingProxy binding_proxy;
static Gdk::Color* base_color;
void (*print_func) (char buf[32], const boost::shared_ptr<PBD::Controllable>&, void *);
void *print_arg;

View File

@ -39,6 +39,8 @@ using namespace Gtk;
using namespace Gtkmm2ext;
using namespace sigc;
Gdk::Color* MotionFeedback::base_color;
MotionFeedback::MotionFeedback (Glib::RefPtr<Gdk::Pixbuf> pix,
Type t,
boost::shared_ptr<PBD::Controllable> c,
@ -60,6 +62,10 @@ MotionFeedback::MotionFeedback (Glib::RefPtr<Gdk::Pixbuf> pix,
, subwidth (subw)
, subheight (subh)
{
if (!base_color) {
base_color = new Gdk::Color ("#1a5274");
}
char value_name[1024];
print_func = default_printer;
@ -467,12 +473,11 @@ MotionFeedback::render_pixbuf (int size)
GdkColor col2 = {0,0,0,0};
GdkColor col3 = {0,0,0,0};
Gdk::Color base ("#b9feff");
GdkColor dark;
GdkColor bright;
ProlooksHSV* hsv;
hsv = prolooks_hsv_new_for_gdk_color (base.gobj());
hsv = prolooks_hsv_new_for_gdk_color (base_color->gobj());
bright = (prolooks_hsv_to_gdk_color (hsv, &col2), col2);
prolooks_hsv_set_saturation (hsv, 0.66);
prolooks_hsv_set_value (hsv, 0.67);
@ -729,3 +734,13 @@ MotionFeedback::core_draw (cairo_t* cr, int phase, double size, double progress_
cairo_pattern_destroy (knob_ripples);
}
void
MotionFeedback::set_lamp_color (const std::string& str)
{
if (base_color) {
*base_color = Gdk::Color (str);
} else {
base_color = new Gdk::Color (str);
}
}