mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-09 07:05:43 +01:00
expand ArdourButton API to expose ::is_led_click() for use by derived classes and owners
This commit is contained in:
parent
d693fba28a
commit
16535e9e1d
2 changed files with 18 additions and 7 deletions
|
|
@ -1055,19 +1055,29 @@ ArdourButton::on_button_press_event (GdkEventButton *ev)
|
|||
return _fallthrough_to_parent ? false : true;
|
||||
}
|
||||
|
||||
bool
|
||||
ArdourButton::is_led_click (GdkEventButton *ev)
|
||||
{
|
||||
if (ev->button == 1 && _hovering && (_elements & Indicator) && _led_rect && _distinct_led_click) {
|
||||
if (ev->x >= _led_rect->x && ev->x < _led_rect->x + _led_rect->width &&
|
||||
ev->y >= _led_rect->y && ev->y < _led_rect->y + _led_rect->height) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
ArdourButton::on_button_release_event (GdkEventButton *ev)
|
||||
{
|
||||
if (ev->type == GDK_2BUTTON_PRESS || ev->type == GDK_3BUTTON_PRESS) {
|
||||
return _fallthrough_to_parent ? false : true;
|
||||
}
|
||||
if (ev->button == 1 && _hovering && (_elements & Indicator) && _led_rect && _distinct_led_click) {
|
||||
if (ev->x >= _led_rect->x && ev->x < _led_rect->x + _led_rect->width &&
|
||||
ev->y >= _led_rect->y && ev->y < _led_rect->y + _led_rect->height) {
|
||||
std::cerr << "LED click\n";
|
||||
signal_led_clicked(ev); /* EMIT SIGNAL */
|
||||
return true;
|
||||
}
|
||||
|
||||
if (is_led_click (ev)) {
|
||||
signal_led_clicked(ev); /* EMIT SIGNAL */
|
||||
return true;
|
||||
}
|
||||
|
||||
_grabbed = false;
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ class LIBWIDGETS_API ArdourButton : public CairoWidget , public Gtkmm2ext::Activ
|
|||
void add_sizing_text (std::string const&);
|
||||
void set_sizing_texts (std::vector<std::string> const&);
|
||||
|
||||
bool is_led_click (GdkEventButton*);
|
||||
sigc::signal<void, GdkEventButton*> signal_led_clicked;
|
||||
sigc::signal<void> signal_clicked;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue