13
0

tweak button joiner colors by making them grab border color from the relevant button type

git-svn-id: svn://localhost/ardour2/branches/3.0@11441 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-02-03 19:10:39 +00:00
parent 1f0f5e89bb
commit cde108107d
2 changed files with 20 additions and 8 deletions

View File

@ -13,16 +13,16 @@
using namespace Gtk;
ButtonJoiner::ButtonJoiner (const std::string& str, Gtk::Widget& l, Gtk::Widget& r)
: left (l)
, right (r)
ButtonJoiner::ButtonJoiner (const std::string& str, Gtk::Widget& lw, Gtk::Widget& rw)
: left (lw)
, right (rw)
, name (str)
, active_fill_pattern (0)
, inactive_fill_pattern (0)
{
packer.set_homogeneous (true);
packer.pack_start (l);
packer.pack_start (r);
packer.pack_start (left);
packer.pack_start (right);
packer.show ();
align.add (packer);
@ -35,12 +35,22 @@ ButtonJoiner::ButtonJoiner (const std::string& str, Gtk::Widget& l, Gtk::Widget&
add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|
Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK);
uint32_t border_color;
uint32_t r, g, b, a;
border_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: border end", name));
UINT_TO_RGBA (border_color, &r, &g, &b, &a);
border_r = r/255.0;
border_g = g/255.0;
border_b = b/255.0;
/* child cairo widgets need the color of the inner edge as their
* "background"
*/
Gdk::Color col;
col.set_rgb_p (0.172, 0.192, 0.364);
col.set_rgb_p (border_r, border_g, border_b);
provide_background_for_cairo_widget (*this, col);
}
@ -71,7 +81,7 @@ ButtonJoiner::render (cairo_t* cr)
/* outer edge */
cairo_set_line_width (cr, 1);
cairo_set_source_rgb (cr, 0.172, 0.192, 0.364);
cairo_set_source_rgb (cr, border_r, border_g, border_b);
cairo_stroke (cr);
/* inner "edge" */

View File

@ -35,7 +35,9 @@ class ButtonJoiner : public CairoWidget, public Gtkmm2ext::Activatable {
std::string name;
cairo_pattern_t* active_fill_pattern;
cairo_pattern_t* inactive_fill_pattern;
double border_r;
double border_g;
double border_b;
void set_colors ();
};