mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 15:25:01 +01:00
Meter point toggle button now uses a popup menu instead of toggling
This commit is contained in:
parent
47de9314cc
commit
33c74357f0
4 changed files with 76 additions and 106 deletions
|
|
@ -92,6 +92,7 @@ GainMeterBase::GainMeterBase (Session* s, bool horizontal, int fader_length, int
|
||||||
dB_coeff_step(Config->get_max_gain())) // page increment
|
dB_coeff_step(Config->get_max_gain())) // page increment
|
||||||
, gain_automation_style_button ("")
|
, gain_automation_style_button ("")
|
||||||
, gain_automation_state_button ("")
|
, gain_automation_state_button ("")
|
||||||
|
, meter_point_button (_("pre"))
|
||||||
, gain_astate_propagate (false)
|
, gain_astate_propagate (false)
|
||||||
, _data_type (DataType::AUDIO)
|
, _data_type (DataType::AUDIO)
|
||||||
{
|
{
|
||||||
|
|
@ -165,6 +166,35 @@ GainMeterBase::GainMeterBase (Session* s, bool horizontal, int fader_length, int
|
||||||
gain_astate_menu.set_reserve_toggle_size(false);
|
gain_astate_menu.set_reserve_toggle_size(false);
|
||||||
gain_astyle_menu.set_name ("ArdourContextMenu");
|
gain_astyle_menu.set_name ("ArdourContextMenu");
|
||||||
|
|
||||||
|
meter_point_button.set_name ("mixer strip button");
|
||||||
|
|
||||||
|
set_tooltip (&meter_point_button, _("Metering point"));
|
||||||
|
|
||||||
|
meter_point_button.unset_flags (Gtk::CAN_FOCUS);
|
||||||
|
|
||||||
|
meter_point_button.set_size_request(15, 15);
|
||||||
|
|
||||||
|
meter_point_menu.set_name ("ArdourContextMenu");
|
||||||
|
meter_point_menu.set_reserve_toggle_size(false);
|
||||||
|
|
||||||
|
meter_point_menu.items().clear ();
|
||||||
|
meter_point_menu.items().push_back (MenuElem(_("Input"),
|
||||||
|
sigc::bind (sigc::mem_fun (*this,
|
||||||
|
&GainMeterBase::meter_point_clicked), (MeterPoint) MeterInput)));
|
||||||
|
meter_point_menu.items().push_back (MenuElem(_("Pre Fader"),
|
||||||
|
sigc::bind (sigc::mem_fun (*this,
|
||||||
|
&GainMeterBase::meter_point_clicked), (MeterPoint) MeterPreFader)));
|
||||||
|
meter_point_menu.items().push_back (MenuElem(_("Post Fader"),
|
||||||
|
sigc::bind (sigc::mem_fun (*this,
|
||||||
|
&GainMeterBase::meter_point_clicked), (MeterPoint) MeterPostFader)));
|
||||||
|
meter_point_menu.items().push_back (MenuElem(_("Output"),
|
||||||
|
sigc::bind (sigc::mem_fun (*this,
|
||||||
|
&GainMeterBase::meter_point_clicked), (MeterPoint) MeterOutput)));
|
||||||
|
meter_point_menu.items().push_back (MenuElem(_("Custom"),
|
||||||
|
sigc::bind (sigc::mem_fun (*this,
|
||||||
|
&GainMeterBase::meter_point_clicked), (MeterPoint) MeterCustom)));
|
||||||
|
meter_point_button.signal_button_press_event().connect (sigc::mem_fun (*this, &GainMeter::meter_press), false);
|
||||||
|
|
||||||
gain_adjustment.signal_value_changed().connect (sigc::mem_fun(*this, &GainMeterBase::fader_moved));
|
gain_adjustment.signal_value_changed().connect (sigc::mem_fun(*this, &GainMeterBase::fader_moved));
|
||||||
peak_display.signal_button_release_event().connect (sigc::mem_fun(*this, &GainMeterBase::peak_button_release), false);
|
peak_display.signal_button_release_event().connect (sigc::mem_fun(*this, &GainMeterBase::peak_button_release), false);
|
||||||
gain_display.signal_key_press_event().connect (sigc::mem_fun(*this, &GainMeterBase::gain_key_press), false);
|
gain_display.signal_key_press_event().connect (sigc::mem_fun(*this, &GainMeterBase::gain_key_press), false);
|
||||||
|
|
@ -611,112 +641,42 @@ GainMeterBase::update_gain_sensitive ()
|
||||||
static_cast<Gtkmm2ext::SliderController*>(gain_slider)->set_sensitive (x);
|
static_cast<Gtkmm2ext::SliderController*>(gain_slider)->set_sensitive (x);
|
||||||
}
|
}
|
||||||
|
|
||||||
static MeterPoint
|
|
||||||
next_meter_point (MeterPoint mp)
|
|
||||||
{
|
|
||||||
switch (mp) {
|
|
||||||
case MeterInput:
|
|
||||||
return MeterPreFader;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MeterPreFader:
|
|
||||||
return MeterPostFader;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MeterPostFader:
|
|
||||||
return MeterOutput;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MeterOutput:
|
|
||||||
return MeterCustom;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MeterCustom:
|
|
||||||
return MeterInput;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
abort(); /*NOTREACHED*/
|
|
||||||
return MeterInput;
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
gint
|
||||||
GainMeterBase::meter_press(GdkEventButton* ev)
|
GainMeterBase::meter_press(GdkEventButton* ev)
|
||||||
{
|
{
|
||||||
wait_for_release = false;
|
|
||||||
|
|
||||||
if (!_route) {
|
if (!_route) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ignore_toggle) {
|
if (!ignore_toggle) {
|
||||||
|
switch (ev->button) {
|
||||||
if (Keyboard::is_context_menu_event (ev)) {
|
case 1:
|
||||||
|
|
||||||
// no menu at this time.
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (Keyboard::is_button2_event(ev)) {
|
|
||||||
|
|
||||||
// Primary-button2 click is the midi binding click
|
|
||||||
// button2-click is "momentary"
|
|
||||||
|
|
||||||
if (!Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier))) {
|
|
||||||
wait_for_release = true;
|
|
||||||
old_meter_point = _route->meter_point ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_route && (ev->button == 1 || Keyboard::is_button2_event (ev))) {
|
|
||||||
|
|
||||||
if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) {
|
if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) {
|
||||||
|
|
||||||
/* Primary+Tertiary-click applies change to all routes */
|
/* Primary+Tertiary-click applies change to all routes */
|
||||||
|
|
||||||
_session->foreach_route (this, &GainMeterBase::set_meter_point, next_meter_point (_route->meter_point()));
|
meter_point_change_target = MeterPointChangeAll;
|
||||||
|
|
||||||
|
|
||||||
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
|
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
|
||||||
|
|
||||||
/* Primary-click: solo mix group.
|
/* Primary-click: apply change to all routes in group */
|
||||||
NOTE: Primary-button2 is MIDI learn.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (ev->button == 1) {
|
meter_point_change_target = MeterPointChangeGroup;
|
||||||
set_route_group_meter_point (*_route, next_meter_point (_route->meter_point()));
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* click: change just this route */
|
/* click: change just this route */
|
||||||
|
|
||||||
// XXX no undo yet
|
meter_point_change_target = MeterPointChangeSingle;
|
||||||
|
}
|
||||||
_route->set_meter_point (next_meter_point (_route->meter_point()));
|
Gtkmm2ext::anchored_menu_popup(&meter_point_menu,
|
||||||
|
&meter_point_button,
|
||||||
|
"", 1, ev->time);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
return TRUE;
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
|
||||||
GainMeterBase::meter_release(GdkEventButton*)
|
|
||||||
{
|
|
||||||
if (!ignore_toggle) {
|
|
||||||
if (wait_for_release) {
|
|
||||||
wait_for_release = false;
|
|
||||||
|
|
||||||
if (_route) {
|
|
||||||
set_meter_point (*_route, old_meter_point);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -738,10 +698,20 @@ GainMeterBase::set_route_group_meter_point (Route& route, MeterPoint mp)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GainMeterBase::meter_point_clicked ()
|
GainMeterBase::meter_point_clicked (MeterPoint mp)
|
||||||
{
|
{
|
||||||
if (_route) {
|
if (_route) {
|
||||||
/* WHAT? */
|
switch (meter_point_change_target) {
|
||||||
|
case MeterPointChangeAll:
|
||||||
|
_session->foreach_route (this, &GainMeterBase::set_meter_point, mp);
|
||||||
|
break;
|
||||||
|
case MeterPointChangeGroup:
|
||||||
|
set_route_group_meter_point (*_route, mp);
|
||||||
|
break;
|
||||||
|
case MeterPointChangeSingle:
|
||||||
|
_route->set_meter_point (mp);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,12 @@ namespace Gtk {
|
||||||
class Menu;
|
class Menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum MeterPointChangeTarget {
|
||||||
|
MeterPointChangeAll,
|
||||||
|
MeterPointChangeGroup,
|
||||||
|
MeterPointChangeSingle
|
||||||
|
};
|
||||||
|
|
||||||
class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr
|
class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -139,6 +145,10 @@ class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr
|
||||||
Gtk::Menu gain_astate_menu;
|
Gtk::Menu gain_astate_menu;
|
||||||
Gtk::Menu gain_astyle_menu;
|
Gtk::Menu gain_astyle_menu;
|
||||||
|
|
||||||
|
ArdourButton meter_point_button;
|
||||||
|
|
||||||
|
Gtk::Menu meter_point_menu;
|
||||||
|
|
||||||
void set_gain_astate (ARDOUR::AutoState);
|
void set_gain_astate (ARDOUR::AutoState);
|
||||||
bool gain_astate_propagate;
|
bool gain_astate_propagate;
|
||||||
static sigc::signal<void, ARDOUR::AutoState> ChangeGainAutomationState;
|
static sigc::signal<void, ARDOUR::AutoState> ChangeGainAutomationState;
|
||||||
|
|
@ -163,7 +173,7 @@ class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr
|
||||||
void fader_moved ();
|
void fader_moved ();
|
||||||
void gain_changed ();
|
void gain_changed ();
|
||||||
|
|
||||||
void meter_point_clicked ();
|
void meter_point_clicked (ARDOUR::MeterPoint);
|
||||||
void gain_unit_changed ();
|
void gain_unit_changed ();
|
||||||
|
|
||||||
virtual void hide_all_meters ();
|
virtual void hide_all_meters ();
|
||||||
|
|
@ -181,11 +191,11 @@ class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr
|
||||||
|
|
||||||
void set_route_group_meter_point (ARDOUR::Route&, ARDOUR::MeterPoint);
|
void set_route_group_meter_point (ARDOUR::Route&, ARDOUR::MeterPoint);
|
||||||
void set_meter_point (ARDOUR::Route&, ARDOUR::MeterPoint);
|
void set_meter_point (ARDOUR::Route&, ARDOUR::MeterPoint);
|
||||||
gint meter_release (GdkEventButton*);
|
|
||||||
gint meter_press (GdkEventButton*);
|
gint meter_press (GdkEventButton*);
|
||||||
bool wait_for_release;
|
|
||||||
ARDOUR::MeterPoint old_meter_point;
|
ARDOUR::MeterPoint old_meter_point;
|
||||||
|
|
||||||
|
MeterPointChangeTarget meter_point_change_target;
|
||||||
|
|
||||||
void parameter_changed (const char*);
|
void parameter_changed (const char*);
|
||||||
|
|
||||||
void reset_peak_display ();
|
void reset_peak_display ();
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,6 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, bool in_mixer)
|
||||||
, solo_iso_table (1, 2)
|
, solo_iso_table (1, 2)
|
||||||
, mute_solo_table (1, 2)
|
, mute_solo_table (1, 2)
|
||||||
, bottom_button_table (1, 3)
|
, bottom_button_table (1, 3)
|
||||||
, meter_point_button (_("pre"))
|
|
||||||
, monitor_section_button (0)
|
, monitor_section_button (0)
|
||||||
, midi_input_enable_button (0)
|
, midi_input_enable_button (0)
|
||||||
, _plugin_insert_cnt (0)
|
, _plugin_insert_cnt (0)
|
||||||
|
|
@ -130,7 +129,6 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, boost::shared_ptr<Route> rt
|
||||||
, solo_iso_table (1, 2)
|
, solo_iso_table (1, 2)
|
||||||
, mute_solo_table (1, 2)
|
, mute_solo_table (1, 2)
|
||||||
, bottom_button_table (1, 3)
|
, bottom_button_table (1, 3)
|
||||||
, meter_point_button (_("pre"))
|
|
||||||
, monitor_section_button (0)
|
, monitor_section_button (0)
|
||||||
, midi_input_enable_button (0)
|
, midi_input_enable_button (0)
|
||||||
, _plugin_insert_cnt (0)
|
, _plugin_insert_cnt (0)
|
||||||
|
|
@ -179,13 +177,7 @@ MixerStrip::init ()
|
||||||
output_button.set_text (_("Output"));
|
output_button.set_text (_("Output"));
|
||||||
output_button.set_name ("mixer strip button");
|
output_button.set_name ("mixer strip button");
|
||||||
|
|
||||||
set_tooltip (&meter_point_button, _("Click to select metering point"));
|
bottom_button_table.attach (gpm.meter_point_button, 2, 3, 0, 1);
|
||||||
meter_point_button.set_name ("mixer strip button");
|
|
||||||
|
|
||||||
bottom_button_table.attach (meter_point_button, 2, 3, 0, 1);
|
|
||||||
|
|
||||||
meter_point_button.signal_button_press_event().connect (sigc::mem_fun (gpm, &GainMeter::meter_press), false);
|
|
||||||
meter_point_button.signal_button_release_event().connect (sigc::mem_fun (gpm, &GainMeter::meter_release), false);
|
|
||||||
|
|
||||||
hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
|
hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
|
||||||
|
|
||||||
|
|
@ -646,7 +638,7 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
meter_point_button.set_text (meter_point_string (_route->meter_point()));
|
gpm.meter_point_button.set_text (meter_point_string (_route->meter_point()));
|
||||||
|
|
||||||
delete route_ops_menu;
|
delete route_ops_menu;
|
||||||
route_ops_menu = 0;
|
route_ops_menu = 0;
|
||||||
|
|
@ -714,7 +706,7 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
|
||||||
mute_solo_table.show();
|
mute_solo_table.show();
|
||||||
bottom_button_table.show();
|
bottom_button_table.show();
|
||||||
gpm.show_all ();
|
gpm.show_all ();
|
||||||
meter_point_button.show();
|
gpm.meter_point_button.show();
|
||||||
input_button_box.show_all();
|
input_button_box.show_all();
|
||||||
output_button.show();
|
output_button.show();
|
||||||
name_button.show();
|
name_button.show();
|
||||||
|
|
@ -2086,7 +2078,7 @@ MixerStrip::monitor_changed ()
|
||||||
void
|
void
|
||||||
MixerStrip::meter_changed ()
|
MixerStrip::meter_changed ()
|
||||||
{
|
{
|
||||||
meter_point_button.set_text (meter_point_string (_route->meter_point()));
|
gpm.meter_point_button.set_text (meter_point_string (_route->meter_point()));
|
||||||
gpm.setup_meters ();
|
gpm.setup_meters ();
|
||||||
// reset peak when meter point changes
|
// reset peak when meter point changes
|
||||||
gpm.reset_peak_display();
|
gpm.reset_peak_display();
|
||||||
|
|
@ -2127,7 +2119,7 @@ MixerStrip::drop_send ()
|
||||||
output_button.set_sensitive (true);
|
output_button.set_sensitive (true);
|
||||||
group_button.set_sensitive (true);
|
group_button.set_sensitive (true);
|
||||||
set_invert_sensitive (true);
|
set_invert_sensitive (true);
|
||||||
meter_point_button.set_sensitive (true);
|
gpm.meter_point_button.set_sensitive (true);
|
||||||
mute_button->set_sensitive (true);
|
mute_button->set_sensitive (true);
|
||||||
solo_button->set_sensitive (true);
|
solo_button->set_sensitive (true);
|
||||||
solo_isolated_led->set_sensitive (true);
|
solo_isolated_led->set_sensitive (true);
|
||||||
|
|
@ -2174,7 +2166,7 @@ MixerStrip::show_send (boost::shared_ptr<Send> send)
|
||||||
input_button.set_sensitive (false);
|
input_button.set_sensitive (false);
|
||||||
group_button.set_sensitive (false);
|
group_button.set_sensitive (false);
|
||||||
set_invert_sensitive (false);
|
set_invert_sensitive (false);
|
||||||
meter_point_button.set_sensitive (false);
|
gpm.meter_point_button.set_sensitive (false);
|
||||||
mute_button->set_sensitive (false);
|
mute_button->set_sensitive (false);
|
||||||
solo_button->set_sensitive (false);
|
solo_button->set_sensitive (false);
|
||||||
rec_enable_button->set_sensitive (false);
|
rec_enable_button->set_sensitive (false);
|
||||||
|
|
@ -2280,9 +2272,9 @@ MixerStrip::set_button_names ()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_route) {
|
if (_route) {
|
||||||
meter_point_button.set_text (meter_point_string (_route->meter_point()));
|
gpm.meter_point_button.set_text (meter_point_string (_route->meter_point()));
|
||||||
} else {
|
} else {
|
||||||
meter_point_button.set_text ("");
|
gpm.meter_point_button.set_text ("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -185,8 +185,6 @@ class MixerStrip : public AxisView, public RouteUI, public Gtk::EventBox
|
||||||
Gtk::Table mute_solo_table;
|
Gtk::Table mute_solo_table;
|
||||||
Gtk::Table bottom_button_table;
|
Gtk::Table bottom_button_table;
|
||||||
|
|
||||||
ArdourButton meter_point_button;
|
|
||||||
|
|
||||||
void meter_changed ();
|
void meter_changed ();
|
||||||
void monitor_changed ();
|
void monitor_changed ();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue