13
0

1 bug fix plus padding control for ArdourButton

This commit is contained in:
Paul Davis 2013-10-12 14:56:57 -04:00
parent be8d06f848
commit 4091ff175c
2 changed files with 19 additions and 3 deletions

View File

@ -78,6 +78,8 @@ ArdourButton::ArdourButton (Element e)
, _fixed_diameter (true) , _fixed_diameter (true)
, _distinct_led_click (false) , _distinct_led_click (false)
, _hovering (false) , _hovering (false)
, _xpad_request (0)
, _ypad_request (0)
{ {
ColorsChanged.connect (sigc::mem_fun (*this, &ArdourButton::color_handler)); ColorsChanged.connect (sigc::mem_fun (*this, &ArdourButton::color_handler));
} }
@ -162,7 +164,7 @@ ArdourButton::set_markup (const std::string& str)
_layout = Pango::Layout::create (get_pango_context()); _layout = Pango::Layout::create (get_pango_context());
} }
_layout->set_text (str); _layout->set_markup (str);
queue_resize (); queue_resize ();
} }
@ -431,11 +433,20 @@ ArdourButton::set_corner_radius (float r)
set_dirty (); set_dirty ();
} }
void
ArdourButton::set_padding (int x, int y)
{
_xpad_request = x;
_ypad_request = y;
queue_resize ();
}
void void
ArdourButton::on_size_request (Gtk::Requisition* req) ArdourButton::on_size_request (Gtk::Requisition* req)
{ {
int xpad = 0; int xpad = 0 + _xpad_request;
int ypad = 6; int ypad = 6 + _ypad_request;
CairoWidget::on_size_request (req); CairoWidget::on_size_request (req);

View File

@ -71,6 +71,8 @@ class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable
void set_rounded_corner_mask (int); void set_rounded_corner_mask (int);
void set_diameter (float); void set_diameter (float);
void set_padding (int x, int y);
void set_text (const std::string&); void set_text (const std::string&);
void set_markup (const std::string&); void set_markup (const std::string&);
void set_angle (const double); void set_angle (const double);
@ -156,6 +158,9 @@ class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable
bool _fixed_diameter; bool _fixed_diameter;
bool _distinct_led_click; bool _distinct_led_click;
bool _hovering; bool _hovering;
int _xpad_request;
int _ypad_request;
static bool _flat_buttons; static bool _flat_buttons;