mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 08:36:32 +01:00
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
This commit is contained in:
parent
712d7fd5e4
commit
708fb03e87
8 changed files with 91 additions and 26 deletions
|
|
@ -319,6 +319,22 @@
|
||||||
<Option name="monitor section mono text" value="c7c7d8ff"/>
|
<Option name="monitor section mono text" value="c7c7d8ff"/>
|
||||||
<Option name="monitor section mono text active" value="c8c8d9ff"/>
|
<Option name="monitor section mono text active" value="c8c8d9ff"/>
|
||||||
<Option name="monitor section mono text mid" value="00000000"/>
|
<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 start" value="cfd1e8ff"/>
|
||||||
<Option name="monitor solo override border end" value="797a87ff"/>
|
<Option name="monitor solo override border end" value="797a87ff"/>
|
||||||
<Option name="monitor solo override border start selected" value="00000000"/>
|
<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 led mid" value="00000000"/>
|
||||||
<Option name="solo button text" value="b9bcb6ff"/>
|
<Option name="solo button text" value="b9bcb6ff"/>
|
||||||
<Option name="solo button text active" value="000000ff"/>
|
<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 start" value="cc0909ff"/>
|
||||||
<Option name="record enable button border end" value="7a0d0dff"/>
|
<Option name="record enable button border end" value="7a0d0dff"/>
|
||||||
<Option name="record enable button border start selected" value="00000000"/>
|
<Option name="record enable button border start selected" value="00000000"/>
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,25 @@ ArdourButton::ArdourButton (Element e)
|
||||||
, _led_rect (0)
|
, _led_rect (0)
|
||||||
{
|
{
|
||||||
ColorsChanged.connect (sigc::mem_fun (*this, &ArdourButton::color_handler));
|
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()
|
ArdourButton::~ArdourButton()
|
||||||
|
|
@ -225,12 +243,6 @@ ArdourButton::render (cairo_t* cr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
ArdourButton::state_handler ()
|
|
||||||
{
|
|
||||||
set_colors ();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ArdourButton::set_diameter (float d)
|
ArdourButton::set_diameter (float d)
|
||||||
{
|
{
|
||||||
|
|
@ -427,6 +439,7 @@ ArdourButton::on_button_release_event (GdkEventButton *ev)
|
||||||
|
|
||||||
if (_act_on_release) {
|
if (_act_on_release) {
|
||||||
if (_action) {
|
if (_action) {
|
||||||
|
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (_action);
|
||||||
_action->activate ();
|
_action->activate ();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -562,3 +575,23 @@ ArdourButton::set_image (const RefPtr<Gdk::Pixbuf>& img)
|
||||||
queue_draw ();
|
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 ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
#ifndef __gtk2_ardour_ardour_button_h__
|
#ifndef __gtk2_ardour_ardour_button_h__
|
||||||
#define __gtk2_ardour_ardour_button_h__
|
#define __gtk2_ardour_ardour_button_h__
|
||||||
|
|
||||||
|
#include <list>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <gtkmm/action.h>
|
#include <gtkmm/action.h>
|
||||||
|
|
@ -44,8 +45,12 @@ class ArdourButton : public CairoWidget
|
||||||
static Element just_led_default_elements;
|
static Element just_led_default_elements;
|
||||||
|
|
||||||
ArdourButton (Element e = default_elements);
|
ArdourButton (Element e = default_elements);
|
||||||
|
ArdourButton (const std::string&, Element e = default_elements);
|
||||||
virtual ~ArdourButton ();
|
virtual ~ArdourButton ();
|
||||||
|
|
||||||
|
void set_active_state (Gtkmm2ext::ActiveState);
|
||||||
|
void set_visual_state (Gtkmm2ext::VisualState);
|
||||||
|
|
||||||
void set_elements (Element);
|
void set_elements (Element);
|
||||||
Element elements() const { return _elements; }
|
Element elements() const { return _elements; }
|
||||||
|
|
||||||
|
|
@ -116,7 +121,6 @@ class ArdourButton : public CairoWidget
|
||||||
void setup_led_rect ();
|
void setup_led_rect ();
|
||||||
void set_colors ();
|
void set_colors ();
|
||||||
void color_handler ();
|
void color_handler ();
|
||||||
void state_handler ();
|
|
||||||
|
|
||||||
Glib::RefPtr<Gtk::Action> _action;
|
Glib::RefPtr<Gtk::Action> _action;
|
||||||
void action_activated ();
|
void action_activated ();
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ CairoWidget::on_expose_event (GdkEventExpose *ev)
|
||||||
void
|
void
|
||||||
CairoWidget::set_dirty ()
|
CairoWidget::set_dirty ()
|
||||||
{
|
{
|
||||||
ENSURE_GUI_THREAD (*this, &CairoWidget::set_dirty)
|
ENSURE_GUI_THREAD (*this, &CairoWidget::set_dirty);
|
||||||
queue_draw ();
|
queue_draw ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -167,6 +167,7 @@ BUTTON_VARS(MonitorSectionDimButton, "monitor section dim")
|
||||||
BUTTON_VARS(MonitorSectionSoloButton, "monitor section solo")
|
BUTTON_VARS(MonitorSectionSoloButton, "monitor section solo")
|
||||||
BUTTON_VARS(MonitorSectionInvertButton, "monitor section invert")
|
BUTTON_VARS(MonitorSectionInvertButton, "monitor section invert")
|
||||||
BUTTON_VARS(MonitorSectionMonoButton, "monitor section mono")
|
BUTTON_VARS(MonitorSectionMonoButton, "monitor section mono")
|
||||||
|
BUTTON_VARS(MonitorSectionSoloModelButton, "monitor section solo model")
|
||||||
BUTTON_VARS(MonitorSectionSoloOverrideButton, "monitor solo override")
|
BUTTON_VARS(MonitorSectionSoloOverrideButton, "monitor solo override")
|
||||||
BUTTON_VARS(MonitorSectionSoloExclusiveButton, "monitor solo exclusive")
|
BUTTON_VARS(MonitorSectionSoloExclusiveButton, "monitor solo exclusive")
|
||||||
BUTTON_VARS(RudeSolo, "rude solo")
|
BUTTON_VARS(RudeSolo, "rude solo")
|
||||||
|
|
|
||||||
|
|
@ -40,9 +40,9 @@ MonitorSection::MonitorSection (Session* s)
|
||||||
, dim_control (0)
|
, dim_control (0)
|
||||||
, solo_boost_control (0)
|
, solo_boost_control (0)
|
||||||
, solo_cut_control (0)
|
, solo_cut_control (0)
|
||||||
, solo_in_place_button (solo_model_group, _("SiP"))
|
, solo_in_place_button (_("SiP"), ArdourButton::led_default_elements)
|
||||||
, afl_button (solo_model_group, _("AFL"))
|
, afl_button (_("AFL"), ArdourButton::led_default_elements)
|
||||||
, pfl_button (solo_model_group, _("PFL"))
|
, pfl_button (_("PFL"), ArdourButton::led_default_elements)
|
||||||
, cut_all_button (ArdourButton::led_default_elements)
|
, cut_all_button (ArdourButton::led_default_elements)
|
||||||
, dim_all_button (ArdourButton::led_default_elements)
|
, dim_all_button (ArdourButton::led_default_elements)
|
||||||
, mono_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));
|
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"));
|
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.set_spacing (6);
|
||||||
solo_model_box.pack_start (solo_in_place_button, true, false);
|
solo_model_box.pack_start (solo_in_place_button, true, false);
|
||||||
solo_model_box.pack_start (afl_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"));
|
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"));
|
ARDOUR_UI::instance()->tooltips().set_tip (solo_in_place_button, _("Solo controls affect solo-in-place"));
|
||||||
if (act) {
|
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"));
|
act = ActionManager::get_action (X_("Solo"), X_("solo-use-afl"));
|
||||||
ARDOUR_UI::instance()->tooltips().set_tip (afl_button, _("Solo controls toggle after-fader-listen"));
|
ARDOUR_UI::instance()->tooltips().set_tip (afl_button, _("Solo controls toggle after-fader-listen"));
|
||||||
if (act) {
|
if (act) {
|
||||||
act->connect_proxy (afl_button);
|
afl_button.set_related_action (act);
|
||||||
}
|
}
|
||||||
|
|
||||||
act = ActionManager::get_action (X_("Solo"), X_("solo-use-pfl"));
|
act = ActionManager::get_action (X_("Solo"), X_("solo-use-pfl"));
|
||||||
ARDOUR_UI::instance()->tooltips().set_tip (pfl_button, _("Solo controls toggle pre-fader-listen"));
|
ARDOUR_UI::instance()->tooltips().set_tip (pfl_button, _("Solo controls toggle pre-fader-listen"));
|
||||||
if (act) {
|
if (act) {
|
||||||
act->connect_proxy (pfl_button);
|
pfl_button.set_related_action (act);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Solo Boost */
|
/* Solo Boost */
|
||||||
|
|
@ -749,8 +759,8 @@ MonitorSection::solo_use_afl ()
|
||||||
Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
|
Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
|
||||||
if (ract) {
|
if (ract) {
|
||||||
if (ract->get_active()) {
|
if (ract->get_active()) {
|
||||||
Config->set_listen_position (AfterFaderListen);
|
|
||||||
Config->set_solo_control_is_listen_control (true);
|
Config->set_solo_control_is_listen_control (true);
|
||||||
|
Config->set_listen_position (AfterFaderListen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -764,13 +774,13 @@ MonitorSection::solo_use_pfl ()
|
||||||
active.
|
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) {
|
if (act) {
|
||||||
Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
|
Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
|
||||||
if (ract) {
|
if (ract) {
|
||||||
if (ract->get_active()) {
|
if (ract->get_active()) {
|
||||||
Config->set_listen_position (PreFaderListen);
|
|
||||||
Config->set_solo_control_is_listen_control (true);
|
Config->set_solo_control_is_listen_control (true);
|
||||||
|
Config->set_listen_position (PreFaderListen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1013,8 +1023,9 @@ MonitorSection::cancel_audition (GdkEventButton*)
|
||||||
void
|
void
|
||||||
MonitorSection::parameter_changed (std::string name)
|
MonitorSection::parameter_changed (std::string name)
|
||||||
{
|
{
|
||||||
if (name == "solo-control-is-listen-control" ||
|
if (name == "solo-control-is-listen-control") {
|
||||||
name == "listen-position") {
|
update_solo_model ();
|
||||||
|
} else if (name == "listen-position") {
|
||||||
update_solo_model ();
|
update_solo_model ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,10 +104,9 @@ class MonitorSection : public RouteUI
|
||||||
void solo_boost_changed ();
|
void solo_boost_changed ();
|
||||||
void gain_value_changed ();
|
void gain_value_changed ();
|
||||||
|
|
||||||
Gtk::RadioButtonGroup solo_model_group;
|
ArdourButton solo_in_place_button;
|
||||||
Gtk::RadioButton solo_in_place_button;
|
ArdourButton afl_button;
|
||||||
Gtk::RadioButton afl_button;
|
ArdourButton pfl_button;
|
||||||
Gtk::RadioButton pfl_button;
|
|
||||||
Gtk::HBox solo_model_box;
|
Gtk::HBox solo_model_box;
|
||||||
|
|
||||||
void solo_use_in_place ();
|
void solo_use_in_place ();
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,7 @@ using namespace Gtkmm2ext;
|
||||||
using namespace Gtk;
|
using namespace Gtk;
|
||||||
using namespace Editing;
|
using namespace Editing;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
using std::list;
|
||||||
|
|
||||||
Glib::RefPtr<Gdk::Pixbuf> RouteTimeAxisView::slider;
|
Glib::RefPtr<Gdk::Pixbuf> RouteTimeAxisView::slider;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue