diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-10-31 15:28:21 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-10-31 15:28:21 +0000 |
commit | 25949e9d83fb9b3c119ac14200f5fe82eb1380a0 (patch) | |
tree | 297118d9f77800e21745585cf04f020e47b7e392 /gtk2_ardour/ardour_button.cc | |
parent | a423a42d9b9ecac21f7c705adfc7476779cd8460 (diff) |
various tweaks to get clicks on processor "buttons" to work right and to keep track of processor state and position, hopefully
git-svn-id: svn://localhost/ardour2/branches/3.0@10349 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/ardour_button.cc')
-rw-r--r-- | gtk2_ardour/ardour_button.cc | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/gtk2_ardour/ardour_button.cc b/gtk2_ardour/ardour_button.cc index ef537d1999..c832fb88d5 100644 --- a/gtk2_ardour/ardour_button.cc +++ b/gtk2_ardour/ardour_button.cc @@ -423,19 +423,33 @@ ArdourButton::on_button_release_event (GdkEventButton *ev) if ((_elements & Indicator) && _distinct_led_click) { /* if within LED, emit signal */ - + + float text_margin; int top = lrint (_height/2.0 - _diameter/2.0); int bottom = lrint (_height/2.0 + _diameter/2.0); int left; int right; - if (_led_left) { - left = 4; - right = left + _diameter; + + if (_width < 75) { + text_margin = 3; } else { - left = lrint (_width - 4 - _diameter/2.0); - right = left + _diameter; + text_margin = 10; } + + top = _height/2.0; + if (_elements & Text) { + if (_led_left) { + left = text_margin; + } else { + left = _width - ((_diameter/2.0) + 4.0); + } + } else { + left = _width/2.0 - _diameter/2.0; + } + + right = left + _diameter; + if (ev->x >= left && ev->x <= right && ev->y <= bottom && ev->y >= top) { signal_led_clicked(); /* EMIT SIGNAL */ return true; @@ -528,3 +542,9 @@ ArdourButton::action_toggled () } } } + +void +ArdourButton::on_style_changed (const RefPtr<Style>&) +{ + set_colors (); +} |