map most (all?) monitor processor state into/onto monitor section GUI

git-svn-id: svn://localhost/ardour2/branches/3.0@6749 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2010-03-12 00:19:46 +00:00
parent c5dab0e2a8
commit e10f59f96c
3 changed files with 113 additions and 84 deletions

View file

@ -243,32 +243,48 @@ MonitorSection::MonitorSection (Session* s)
map_state (); map_state ();
_tearoff = new TearOff (hpacker); _tearoff = new TearOff (hpacker);
/* if torn off, make this a normal window */ /* if torn off, make this a normal window */
_tearoff->tearoff_window().set_type_hint (Gdk::WINDOW_TYPE_HINT_NORMAL); _tearoff->tearoff_window().set_type_hint (Gdk::WINDOW_TYPE_HINT_NORMAL);
_tearoff->tearoff_window().set_title (X_("Monitor")); _tearoff->tearoff_window().set_title (X_("Monitor"));
_tearoff->tearoff_window().signal_key_press_event().connect (sigc::mem_fun (*this, &MonitorSection::tearoff_key_press_event), false); _tearoff->tearoff_window().signal_key_press_event().connect (sigc::ptr_fun (forward_key_press), false);
} }
MonitorSection::~MonitorSection () MonitorSection::~MonitorSection ()
{ {
for (ChannelButtons::iterator i = _channel_buttons.begin(); i != _channel_buttons.end(); ++i) {
delete *i;
}
_channel_buttons.clear ();
delete gain_control; delete gain_control;
delete dim_control; delete dim_control;
delete solo_boost_control; delete solo_boost_control;
delete _tearoff; delete _tearoff;
} }
bool MonitorSection::ChannelButtonSet::ChannelButtonSet ()
MonitorSection::tearoff_key_press_event (GdkEventKey* ev) : cut (X_(""))
, dim (X_(""))
, solo (X_(""))
, invert (X_(""))
{ {
cerr << "T key event\n"; cut.set_name (X_("MixerMuteButton"));
return forward_key_press (ev); dim.set_name (X_("MixerMuteButton"));
solo.set_name (X_("MixerSoloButton"));
gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (cut.gobj()), false);
gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (dim.gobj()), false);
gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (invert.gobj()), false);
gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (solo.gobj()), false);
} }
void void
MonitorSection::populate_buttons () MonitorSection::populate_buttons ()
{ {
Glib::RefPtr<Action> act; Glib::RefPtr<Action> act;
uint32_t nchans = _route->monitor_control()->output_streams().n_audio(); uint32_t nchans = _monitor->output_streams().n_audio();
main_table.resize (nchans+1, 5); main_table.resize (nchans+1, 5);
main_table.set_col_spacings (6); main_table.set_col_spacings (6);
@ -286,41 +302,7 @@ MonitorSection::populate_buttons ()
l1 = manage (new Label (X_("inv"))); l1 = manage (new Label (X_("inv")));
main_table.attach (*l1, 4, 5, 0, 1, SHRINK|FILL, SHRINK|FILL); main_table.attach (*l1, 4, 5, 0, 1, SHRINK|FILL, SHRINK|FILL);
#if 0 const uint32_t row_offset = 1;
/* the "all" buttons for cut & dim */
Label *la = manage (new Label (X_("all")));
main_table.attach (*la, 0, 1, 1, 2, SHRINK|FILL, SHRINK|FILL);
/* cut all */
BindableToggleButton* ca = manage (new BindableToggleButton (X_("")));
ca->set_name (X_("MixerMuteButton"));
gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (ca->gobj()), false);
main_table.attach (*ca, 1, 2, 1, 2, SHRINK|FILL, SHRINK|FILL);
act = ActionManager::get_action (X_("Monitor"), X_("monitor-cut-all"));
if (act) {
act->connect_proxy (*ca);
}
/* dim all */
BindableToggleButton* da = manage (new BindableToggleButton (X_("")));
da->set_name (X_("MixerMuteButton"));
gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (da->gobj()), false);
main_table.attach (*da, 2, 3, 1, 2, SHRINK|FILL, SHRINK|FILL);
act = ActionManager::get_action (X_("Monitor"), X_("monitor-dim-all"));
if (act) {
act->connect_proxy (*da);
}
uint32_t row_offset = 2;
#else
uint32_t row_offset = 1;
#endif
for (uint32_t i = 0; i < nchans; ++i) { for (uint32_t i = 0; i < nchans; ++i) {
@ -339,61 +321,41 @@ MonitorSection::populate_buttons ()
l = buf; l = buf;
} }
Label* c1 = manage (new Label (l)); Label* label = manage (new Label (l));
main_table.attach (*c1, 0, 1, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL); main_table.attach (*label, 0, 1, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL);
/* Cut */
BindableToggleButton* c2 = manage (new BindableToggleButton (X_(""))); ChannelButtonSet* cbs = new ChannelButtonSet;
c2->set_name (X_("MixerMuteButton"));
gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (c2->gobj()), false); _channel_buttons.push_back (cbs);
main_table.attach (*c2, 1, 2, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL);
main_table.attach (cbs->cut, 1, 2, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL);
main_table.attach (cbs->dim, 2, 3, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL);
main_table.attach (cbs->solo, 3, 4, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL);
main_table.attach (cbs->invert, 4, 5, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL);
snprintf (buf, sizeof (buf), "monitor-cut-%u", i+1); snprintf (buf, sizeof (buf), "monitor-cut-%u", i+1);
act = ActionManager::get_action (X_("Monitor"), buf); act = ActionManager::get_action (X_("Monitor"), buf);
if (act) { if (act) {
act->connect_proxy (*c2); act->connect_proxy (cbs->cut);
} }
/* Dim */
BindableToggleButton* c3 = manage (new BindableToggleButton (X_("")));
c3->set_name (X_("MixerMuteButton"));
gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (c2->gobj()), false);
main_table.attach (*c3, 2, 3, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL);
snprintf (buf, sizeof (buf), "monitor-dim-%u", i+1); snprintf (buf, sizeof (buf), "monitor-dim-%u", i+1);
act = ActionManager::get_action (X_("Monitor"), buf); act = ActionManager::get_action (X_("Monitor"), buf);
if (act) { if (act) {
act->connect_proxy (*c3); act->connect_proxy (cbs->dim);
} }
/* Solo */
BindableToggleButton* c4 = manage (new BindableToggleButton (X_("")));
c4->set_name (X_("MixerSoloButton"));
gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (c2->gobj()), false);
main_table.attach (*c4, 3, 4, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL);
snprintf (buf, sizeof (buf), "monitor-solo-%u", i+1); snprintf (buf, sizeof (buf), "monitor-solo-%u", i+1);
act = ActionManager::get_action (X_("Monitor"), buf); act = ActionManager::get_action (X_("Monitor"), buf);
if (act) { if (act) {
act->connect_proxy (*c4); act->connect_proxy (cbs->solo);
} }
/* Invert (Polarity/Phase) */
BindableToggleButton* c5 = manage (new BindableToggleButton (X_("")));
c5->set_name (X_("MixerPhaseInvertButton"));
gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (c2->gobj()), false);
main_table.attach (*c5, 4, 5, i+row_offset, i+row_offset+1, SHRINK|FILL, SHRINK|FILL);
snprintf (buf, sizeof (buf), "monitor-invert-%u", i+1); snprintf (buf, sizeof (buf), "monitor-invert-%u", i+1);
act = ActionManager::get_action (X_("Monitor"), buf); act = ActionManager::get_action (X_("Monitor"), buf);
if (act) { if (act) {
act->connect_proxy (*c5); act->connect_proxy (cbs->invert);
} }
} }
main_table.show_all (); main_table.show_all ();
@ -495,16 +457,15 @@ void
MonitorSection::invert_channel (uint32_t chn) MonitorSection::invert_channel (uint32_t chn)
{ {
char buf[64]; char buf[64];
snprintf (buf, sizeof (buf), "monitor-invert-%u", chn);
--chn; // 0-based in backend --chn; // 0-based in backend
snprintf (buf, sizeof (buf), "monitor-invert-%u", chn);
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), buf); Glib::RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), buf);
if (act) { if (act) {
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
_monitor->set_polarity (chn, tact->get_active()); _monitor->set_polarity (chn, tact->get_active());
} }
} }
void void
@ -525,7 +486,7 @@ MonitorSection::register_actions ()
ActionManager::register_toggle_action (monitor_actions, "monitor-dim-all", "", ActionManager::register_toggle_action (monitor_actions, "monitor-dim-all", "",
sigc::mem_fun (*this, &MonitorSection::dim_all)); sigc::mem_fun (*this, &MonitorSection::dim_all));
/* note the 1-based counting for naming vs. 0-based for action */ /* note the 1-based counting (for naming - backend uses 0-based) */
for (uint32_t chn = 1; chn <= 16; ++chn) { for (uint32_t chn = 1; chn <= 16; ++chn) {
@ -721,13 +682,59 @@ MonitorSection::map_state ()
action_name = X_("solo-use-in-place"); action_name = X_("solo-use-in-place");
} }
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Solo"), action_name); Glib::RefPtr<Action> act;
act = ActionManager::get_action (X_("Solo"), action_name);
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) {
ract->set_active (true); ract->set_active (true);
} }
} }
act = ActionManager::get_action (X_("Monitor"), "monitor-solo");
if (act) {
Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
if (ract) {
ract->set_active (_monitor->mono());
}
}
act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all");
if (act) {
Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
if (ract) {
ract->set_active (_monitor->cut_all());
}
}
act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all");
if (act) {
Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
if (ract) {
ract->set_active (_monitor->dim_all());
}
}
act = ActionManager::get_action (X_("Monitor"), "monitor-mono");
if (act) {
Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (act);
if (ract) {
ract->set_active (_monitor->mono());
}
}
uint32_t nchans = _monitor->output_streams().n_audio();
assert (nchans == _channel_buttons.size ());
for (uint32_t n = 0; n < nchans; ++n) {
ChannelButtonSet* cbs = _channel_buttons[n];
cbs->cut.set_active (_monitor->cut (n));
cbs->dim.set_active (_monitor->dimmed (n));
cbs->solo.set_active (_monitor->soloed (n));
cbs->invert.set_active (_monitor->inverted (n));
}
} }
void void

View file

@ -53,6 +53,18 @@ class MonitorSection : public RouteUI
LevelMeter meter; LevelMeter meter;
Gtkmm2ext::TearOff* _tearoff; Gtkmm2ext::TearOff* _tearoff;
struct ChannelButtonSet {
BindableToggleButton cut;
BindableToggleButton dim;
BindableToggleButton solo;
BindableToggleButton invert;
ChannelButtonSet ();
};
typedef std::vector<ChannelButtonSet*> ChannelButtons;
ChannelButtons _channel_buttons;
Gtk::Adjustment gain_adjustment; Gtk::Adjustment gain_adjustment;
VolumeController* gain_control; VolumeController* gain_control;
Gtk::Adjustment dim_adjustment; Gtk::Adjustment dim_adjustment;
@ -104,6 +116,4 @@ class MonitorSection : public RouteUI
void solo_blink (bool); void solo_blink (bool);
bool cancel_solo (GdkEventButton*); bool cancel_solo (GdkEventButton*);
bool tearoff_key_press_event (GdkEventKey*);
}; };

View file

@ -201,7 +201,7 @@ MonitorProcessor::state (bool full)
chn_node->add_property ("id", buf); chn_node->add_property ("id", buf);
chn_node->add_property (X_("cut"), x->cut == 1.0 ? "no" : "yes"); chn_node->add_property (X_("cut"), x->cut == 1.0 ? "no" : "yes");
chn_node->add_property (X_("invert"), x->polarity == 1.0 ? "yes" : "no"); chn_node->add_property (X_("invert"), x->polarity == 1.0 ? "no" : "yes");
chn_node->add_property (X_("dim"), x->dim ? "yes" : "no"); chn_node->add_property (X_("dim"), x->dim ? "yes" : "no");
chn_node->add_property (X_("solo"), x->soloed ? "yes" : "no"); chn_node->add_property (X_("solo"), x->soloed ? "yes" : "no");
@ -409,3 +409,15 @@ MonitorProcessor::mono () const
{ {
return _mono; return _mono;
} }
bool
MonitorProcessor::dim_all () const
{
return _dim_all;
}
bool
MonitorProcessor::cut_all () const
{
return _cut_all;
}