diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-11-03 21:35:20 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-11-03 21:35:20 +0000 |
commit | 708fb03e87676d4fb125e0d78bd297e705a8e735 (patch) | |
tree | b105af80b058dc77f9577385a9a07f00888e1bef | |
parent | 712d7fd5e4e58af842f33408904b3936647ef0c3 (diff) |
use ArdourButton for the (radio) buttons in the monitor section; fix ArdourButton, MonitorSection and CairoWidget to work with radio semantics
git-svn-id: svn://localhost/ardour2/branches/3.0@10430 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/ardour3_ui_default.conf | 18 | ||||
-rw-r--r-- | gtk2_ardour/ardour_button.cc | 49 | ||||
-rw-r--r-- | gtk2_ardour/ardour_button.h | 6 | ||||
-rw-r--r-- | gtk2_ardour/cairo_widget.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/canvas_vars.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/monitor_section.cc | 33 | ||||
-rw-r--r-- | gtk2_ardour/monitor_section.h | 7 | ||||
-rw-r--r-- | gtk2_ardour/route_time_axis.cc | 1 |
8 files changed, 91 insertions, 26 deletions
diff --git a/gtk2_ardour/ardour3_ui_default.conf b/gtk2_ardour/ardour3_ui_default.conf index d92151e5da..b7cbc4b76f 100644 --- a/gtk2_ardour/ardour3_ui_default.conf +++ b/gtk2_ardour/ardour3_ui_default.conf @@ -319,6 +319,22 @@ <Option name="monitor section mono text" value="c7c7d8ff"/> <Option name="monitor section mono text active" value="c8c8d9ff"/> <Option name="monitor section mono text mid" value="00000000"/> + <Option name="monitor section solo model border start" value="cfd1e8ff"/> + <Option name="monitor section solo model border end" value="797a87ff"/> + <Option name="monitor section solo model border start selected" value="00000000"/> + <Option name="monitor section solo model border end selected" value="00000000"/> + <Option name="monitor section solo model fill start" value="808190ff"/> + <Option name="monitor section solo model fill end" value="5f606bff"/> + <Option name="monitor section solo model fill start active" value="808290ff"/> + <Option name="monitor section solo model fill end active" value="5f616bff"/> + <Option name="monitor section solo model fill start mid" value="00000000"/> + <Option name="monitor section solo model fill end mid" value="00000000"/> + <Option name="monitor section solo model led" value="473812ff"/> + <Option name="monitor section solo model led active" value="78cb4eff"/> + <Option name="monitor section solo model led mid" value="00000000"/> + <Option name="monitor section solo model text" value="c7c7d8ff"/> + <Option name="monitor section solo model text active" value="c8c8d9ff"/> + <Option name="monitor section solo model text mid" value="00000000"/> <Option name="monitor solo override border start" value="cfd1e8ff"/> <Option name="monitor solo override border end" value="797a87ff"/> <Option name="monitor solo override border start selected" value="00000000"/> @@ -430,7 +446,7 @@ <Option name="solo button led mid" value="00000000"/> <Option name="solo button text" value="b9bcb6ff"/> <Option name="solo button text active" value="000000ff"/> - <Option name="solo button text mid" value="00000000"/> + <Option name="solo button text mid" value="3a3a3aff"/> <Option name="record enable button border start" value="cc0909ff"/> <Option name="record enable button border end" value="7a0d0dff"/> <Option name="record enable button border start selected" value="00000000"/> diff --git a/gtk2_ardour/ardour_button.cc b/gtk2_ardour/ardour_button.cc index 580f893099..ff1ab12cce 100644 --- a/gtk2_ardour/ardour_button.cc +++ b/gtk2_ardour/ardour_button.cc @@ -65,7 +65,25 @@ ArdourButton::ArdourButton (Element e) , _led_rect (0) { ColorsChanged.connect (sigc::mem_fun (*this, &ArdourButton::color_handler)); - StateChanged.connect (sigc::mem_fun (*this, &ArdourButton::state_handler)); +} + +ArdourButton::ArdourButton (const std::string& str, Element e) + : _elements (e) + , _act_on_release (true) + , _text_width (0) + , _text_height (0) + , _diameter (11.0) + , _corner_radius (9.0) + , edge_pattern (0) + , fill_pattern (0) + , led_inset_pattern (0) + , reflection_pattern (0) + , _led_left (false) + , _fixed_diameter (true) + , _distinct_led_click (false) + , _led_rect (0) +{ + set_text (str); } ArdourButton::~ArdourButton() @@ -226,12 +244,6 @@ ArdourButton::render (cairo_t* cr) } void -ArdourButton::state_handler () -{ - set_colors (); -} - -void ArdourButton::set_diameter (float d) { _diameter = (d*2) + 5.0; @@ -427,6 +439,7 @@ ArdourButton::on_button_release_event (GdkEventButton *ev) if (_act_on_release) { if (_action) { + Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (_action); _action->activate (); return true; } @@ -497,7 +510,7 @@ ArdourButton::set_related_action (RefPtr<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)); - } + } } void @@ -562,3 +575,23 @@ ArdourButton::set_image (const RefPtr<Gdk::Pixbuf>& img) queue_draw (); } +void +ArdourButton::set_active_state (Gtkmm2ext::ActiveState s) +{ + bool changed = (_active_state != s); + CairoWidget::set_active_state (s); + if (changed) { + set_colors (); + } +} + +void +ArdourButton::set_visual_state (Gtkmm2ext::VisualState s) +{ + bool changed = (_visual_state != s); + CairoWidget::set_visual_state (s); + if (changed) { + set_colors (); + } +} + diff --git a/gtk2_ardour/ardour_button.h b/gtk2_ardour/ardour_button.h index 72614b2b8e..f13a36835e 100644 --- a/gtk2_ardour/ardour_button.h +++ b/gtk2_ardour/ardour_button.h @@ -20,6 +20,7 @@ #ifndef __gtk2_ardour_ardour_button_h__ #define __gtk2_ardour_ardour_button_h__ +#include <list> #include <stdint.h> #include <gtkmm/action.h> @@ -44,8 +45,12 @@ class ArdourButton : public CairoWidget static Element just_led_default_elements; ArdourButton (Element e = default_elements); + ArdourButton (const std::string&, Element e = default_elements); virtual ~ArdourButton (); + void set_active_state (Gtkmm2ext::ActiveState); + void set_visual_state (Gtkmm2ext::VisualState); + void set_elements (Element); Element elements() const { return _elements; } @@ -116,7 +121,6 @@ class ArdourButton : public CairoWidget void setup_led_rect (); void set_colors (); void color_handler (); - void state_handler (); Glib::RefPtr<Gtk::Action> _action; void action_activated (); diff --git a/gtk2_ardour/cairo_widget.cc b/gtk2_ardour/cairo_widget.cc index e2edc24bbc..5f83cb80d5 100644 --- a/gtk2_ardour/cairo_widget.cc +++ b/gtk2_ardour/cairo_widget.cc @@ -52,7 +52,7 @@ CairoWidget::on_expose_event (GdkEventExpose *ev) void CairoWidget::set_dirty () { - ENSURE_GUI_THREAD (*this, &CairoWidget::set_dirty) + ENSURE_GUI_THREAD (*this, &CairoWidget::set_dirty); queue_draw (); } diff --git a/gtk2_ardour/canvas_vars.h b/gtk2_ardour/canvas_vars.h index d25f32af9b..71418e9b23 100644 --- a/gtk2_ardour/canvas_vars.h +++ b/gtk2_ardour/canvas_vars.h @@ -167,6 +167,7 @@ BUTTON_VARS(MonitorSectionDimButton, "monitor section dim") BUTTON_VARS(MonitorSectionSoloButton, "monitor section solo") BUTTON_VARS(MonitorSectionInvertButton, "monitor section invert") BUTTON_VARS(MonitorSectionMonoButton, "monitor section mono") +BUTTON_VARS(MonitorSectionSoloModelButton, "monitor section solo model") BUTTON_VARS(MonitorSectionSoloOverrideButton, "monitor solo override") BUTTON_VARS(MonitorSectionSoloExclusiveButton, "monitor solo exclusive") BUTTON_VARS(RudeSolo, "rude solo") diff --git a/gtk2_ardour/monitor_section.cc b/gtk2_ardour/monitor_section.cc index 9e408b6822..dcfdefd416 100644 --- a/gtk2_ardour/monitor_section.cc +++ b/gtk2_ardour/monitor_section.cc @@ -40,9 +40,9 @@ MonitorSection::MonitorSection (Session* s) , dim_control (0) , solo_boost_control (0) , solo_cut_control (0) - , solo_in_place_button (solo_model_group, _("SiP")) - , afl_button (solo_model_group, _("AFL")) - , pfl_button (solo_model_group, _("PFL")) + , solo_in_place_button (_("SiP"), ArdourButton::led_default_elements) + , afl_button (_("AFL"), ArdourButton::led_default_elements) + , pfl_button (_("PFL"), ArdourButton::led_default_elements) , cut_all_button (ArdourButton::led_default_elements) , dim_all_button (ArdourButton::led_default_elements) , mono_button (ArdourButton::led_default_elements) @@ -89,6 +89,16 @@ MonitorSection::MonitorSection (Session* s) rude_audition_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_audition)); UI::instance()->set_tip (rude_audition_button, _("When active, auditioning is active.\nClick to stop the audition")); + solo_in_place_button.set_name ("monitor section solo model"); + afl_button.set_name ("monitor section solo model"); + pfl_button.set_name ("monitor section solo model"); + +#if 0 + solo_model_group.add (solo_in_place_button); + solo_model_group.add (afl_button); + solo_model_group.add (afl_button); +#endif + solo_model_box.set_spacing (6); solo_model_box.pack_start (solo_in_place_button, true, false); solo_model_box.pack_start (afl_button, true, false); @@ -102,19 +112,19 @@ MonitorSection::MonitorSection (Session* s) act = ActionManager::get_action (X_("Solo"), X_("solo-use-in-place")); ARDOUR_UI::instance()->tooltips().set_tip (solo_in_place_button, _("Solo controls affect solo-in-place")); if (act) { - act->connect_proxy (solo_in_place_button); + solo_in_place_button.set_related_action (act); } act = ActionManager::get_action (X_("Solo"), X_("solo-use-afl")); ARDOUR_UI::instance()->tooltips().set_tip (afl_button, _("Solo controls toggle after-fader-listen")); if (act) { - act->connect_proxy (afl_button); + afl_button.set_related_action (act); } act = ActionManager::get_action (X_("Solo"), X_("solo-use-pfl")); ARDOUR_UI::instance()->tooltips().set_tip (pfl_button, _("Solo controls toggle pre-fader-listen")); if (act) { - act->connect_proxy (pfl_button); + pfl_button.set_related_action (act); } /* Solo Boost */ @@ -749,8 +759,8 @@ MonitorSection::solo_use_afl () Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act); if (ract) { if (ract->get_active()) { - Config->set_listen_position (AfterFaderListen); Config->set_solo_control_is_listen_control (true); + Config->set_listen_position (AfterFaderListen); } } } @@ -764,13 +774,13 @@ MonitorSection::solo_use_pfl () active. */ - Glib::RefPtr<Action> act = ActionManager::get_action (X_("Solo"), X_("solo-use-afl")); + Glib::RefPtr<Action> act = ActionManager::get_action (X_("Solo"), X_("solo-use-pfl")); if (act) { Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act); if (ract) { if (ract->get_active()) { - Config->set_listen_position (PreFaderListen); Config->set_solo_control_is_listen_control (true); + Config->set_listen_position (PreFaderListen); } } } @@ -1013,8 +1023,9 @@ MonitorSection::cancel_audition (GdkEventButton*) void MonitorSection::parameter_changed (std::string name) { - if (name == "solo-control-is-listen-control" || - name == "listen-position") { + if (name == "solo-control-is-listen-control") { + update_solo_model (); + } else if (name == "listen-position") { update_solo_model (); } } diff --git a/gtk2_ardour/monitor_section.h b/gtk2_ardour/monitor_section.h index 813605fc27..f8a553b7e8 100644 --- a/gtk2_ardour/monitor_section.h +++ b/gtk2_ardour/monitor_section.h @@ -104,10 +104,9 @@ class MonitorSection : public RouteUI void solo_boost_changed (); void gain_value_changed (); - Gtk::RadioButtonGroup solo_model_group; - Gtk::RadioButton solo_in_place_button; - Gtk::RadioButton afl_button; - Gtk::RadioButton pfl_button; + ArdourButton solo_in_place_button; + ArdourButton afl_button; + ArdourButton pfl_button; Gtk::HBox solo_model_box; void solo_use_in_place (); diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 121840052d..6933429766 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -94,6 +94,7 @@ using namespace Gtkmm2ext; using namespace Gtk; using namespace Editing; using namespace std; +using std::list; Glib::RefPtr<Gdk::Pixbuf> RouteTimeAxisView::slider; |