summaryrefslogtreecommitdiff
path: root/gtk2_ardour/ardour_button.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-11-10 18:04:34 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-11-10 18:04:34 +0000
commitf96ccb195828daeec03646ee4013531fe88c87fa (patch)
tree3da613868cbc350540de5f896c0f75cfff7c696f /gtk2_ardour/ardour_button.cc
parent6449c2e5c8b027245fe5fb9942984243e4a653d7 (diff)
ardour-button-ize zoom buttons; move MIDI panic button to transport bar
git-svn-id: svn://localhost/ardour2/branches/3.0@10528 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/ardour_button.cc')
-rw-r--r--gtk2_ardour/ardour_button.cc51
1 files changed, 47 insertions, 4 deletions
diff --git a/gtk2_ardour/ardour_button.cc b/gtk2_ardour/ardour_button.cc
index 1ba4de7535..5f6e1f8dc0 100644
--- a/gtk2_ardour/ardour_button.cc
+++ b/gtk2_ardour/ardour_button.cc
@@ -481,6 +481,7 @@ ArdourButton::on_button_release_event (GdkEventButton *ev)
}
}
+
return false;
}
@@ -543,10 +544,22 @@ ArdourButton::set_related_action (RefPtr<Action> act)
{
_action = act;
- Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (_action);
- if (tact) {
- tact->signal_toggled().connect (sigc::mem_fun (*this, &ArdourButton::action_toggled));
- }
+ if (_action) {
+
+ string str = _action->property_tooltip().get_value();
+ if (!str.empty()) {
+ ARDOUR_UI::instance()->set_tip (*this, str);
+ }
+
+ Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (_action);
+ if (tact) {
+ tact->signal_toggled().connect (sigc::mem_fun (*this, &ArdourButton::action_toggled));
+ }
+
+ _action->connect_property_changed ("sensitive", sigc::mem_fun (*this, &ArdourButton::action_sensitivity_changed));
+ _action->connect_property_changed ("visible", sigc::mem_fun (*this, &ArdourButton::action_visibility_changed));
+ _action->connect_property_changed ("tooltip", sigc::mem_fun (*this, &ArdourButton::action_tooltip_changed));
+ }
}
void
@@ -677,3 +690,33 @@ ArdourButton::set_tweaks (Tweaks t)
queue_draw ();
}
}
+
+void
+ArdourButton::action_sensitivity_changed ()
+{
+ if (_action->property_sensitive ()) {
+ set_visual_state (Gtkmm2ext::VisualState (visual_state() & ~Gtkmm2ext::Insensitive));
+ } else {
+ set_visual_state (Gtkmm2ext::VisualState (visual_state() | Gtkmm2ext::Insensitive));
+ }
+
+}
+
+
+void
+ArdourButton::action_visibility_changed ()
+{
+ if (_action->property_visible ()) {
+ show ();
+ } else {
+ hide ();
+ }
+}
+
+void
+ArdourButton::action_tooltip_changed ()
+{
+ string str = _action->property_tooltip().get_value();
+ ARDOUR_UI::instance()->set_tip (*this, str);
+}
+