if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) {
+#if 0
/* Primary-Tertiary-click applies change to all routes */
_session.begin_reversible_command (_("mute change"));
Session::GlobalMuteStateCommand *cmd = new Session::GlobalMuteStateCommand(_session, this);
- _session.set_all_mute (!_route->muted());
+ _session.set_mute (!_route->muted());
cmd->mark();
_session.add_command(cmd);
_session.commit_reversible_command ();
multiple_mute_change = true;
+#endif
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
+#if 0
/* Primary-button1 applies change to the mix group.
NOTE: Primary-button2 is MIDI learn.
*/
if (ev->button == 1) {
set_route_group_mute (_route, !_route->muted());
}
+#endif
} else {
+#if 0
/* plain click applies change to this route */
if (wait_for_release) {
_route->set_mute (!_route->muted(), this);
} else {
reversibly_apply_route_boolean ("mute change", &Route::set_mute, !_route->muted(), this);
}
+#endif
}
}
}
return true;
}
+void
+RouteUI::post_solo_cleanup (SessionEvent* ev, bool was_not_latched)
+{
+ ENSURE_GUI_THREAD (bind (mem_fun (*this, &RouteUI::post_solo_cleanup), ev, was_not_latched));
+
+ delete ev;
+
+ if (was_not_latched) {
+ Config->set_solo_latched (false);
+ }
+}
+
bool
RouteUI::solo_press(GdkEventButton* ev)
{
/* Primary-Tertiary-click applies change to all routes */
bool was_not_latched = false;
+
if (!Config->get_solo_latched ()) {
was_not_latched = true;
/*
*/
Config->set_solo_latched (true);
}
- _session.begin_reversible_command (_("solo change"));
- Session::GlobalSoloStateCommand *cmd = new Session::GlobalSoloStateCommand(_session, this);
- _session.set_all_solo (!_route->soloed());
- cmd->mark();
- _session.add_command (cmd);
- _session.commit_reversible_command ();
- multiple_solo_change = true;
- if (was_not_latched) {
- Config->set_solo_latched (false);
- }
+
+ SessionEvent* ev = new SessionEvent (SessionEvent::RealTimeOperation, SessionEvent::Add, SessionEvent::Immediate, 0, 0.0);
+ ev->rt_slot = bind (sigc::mem_fun (_session, &Session::set_solo), _session.get_routes(), !_route->soloed());
+ ev->rt_return = bind (sigc::mem_fun (*this, &RouteUI::post_solo_cleanup), was_not_latched);
+
+ _session.queue_event (ev);
} else if (Keyboard::modifier_state_contains (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::SecondaryModifier))) {
// Primary-Secondary-click: exclusively solo this track, not a toggle */
+
+ //boost::shared_ptr<RouteList> rl (new RouteList);
+ //rl->push_back (route());
- _session.begin_reversible_command (_("solo change"));
- Session::GlobalSoloStateCommand *cmd = new Session::GlobalSoloStateCommand (_session, this);
- _session.set_all_solo (false);
- _route->set_solo (true, this);
- cmd->mark();
- _session.add_command(cmd);
- _session.commit_reversible_command ();
+ //SessionEvent* ev = new SessionEvent (SessionEvent::RealTimeOperation, SessionEvent::Add, SessionEvent::Immediate, 0, 0.0);
+ // ev->rt_slot = bind (sigc::mem_fun (_session, &Session::set_just_one_solo), rl, true);
+ //ev->rt_return = sigc::mem_fun (*this, &RouteUI::post_rtop_cleanup);
+
+ //_session.queue_event (ev);
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
- // shift-click: set this route to solo safe
-
- if (Profile->get_sae() && ev->button == 1) {
- // button 1 and shift-click: disables solo_latched for this click
- if (!Config->get_solo_latched ()) {
- Config->set_solo_latched (true);
- reversibly_apply_route_boolean ("solo change", &Route::set_solo, !_route->soloed(), this);
- Config->set_solo_latched (false);
- }
- } else {
- _route->set_solo_isolated (!_route->solo_isolated(), this);
- wait_for_release = false;
- }
+ // shift-click: toggle solo isolated status
+
+ _route->set_solo_isolated (!_route->solo_isolated(), this);
+ wait_for_release = false;
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
+#if 0
/* Primary-button1: solo mix group.
NOTE: Primary-button2 is MIDI learn.
*/
if (ev->button == 1) {
- set_route_group_solo (_route, !_route->soloed());
+ queue_route_group_op (RouteGroup::Solo, &Session::set_all_solo, !_route->soloed());
}
+#endif
+
} else {
/* click: solo this route */
- if (wait_for_release) {
- _route->set_solo (!_route->soloed(), this);
- } else {
- reversibly_apply_route_boolean ("solo change", &Route::set_solo, !_route->soloed(), this);
- }
+
+ boost::shared_ptr<RouteList> rl (new RouteList);
+ rl->push_back (route());
+
+ SessionEvent* ev = new SessionEvent (SessionEvent::RealTimeOperation, SessionEvent::Add, SessionEvent::Immediate, 0, 0.0);
+ ev->rt_slot = bind (sigc::mem_fun (_session, &Session::set_solo), rl, !rec_enable_button->get_active());
+ ev->rt_return = sigc::mem_fun (*this, &RouteUI::post_rtop_cleanup);
+
+ _session.queue_event (ev);
}
}
}
return true;
}
+void
+RouteUI::post_rtop_cleanup (SessionEvent* ev)
+{
+ ENSURE_GUI_THREAD (bind (mem_fun (*this, &RouteUI::post_rtop_cleanup), ev));
+ delete ev;
+}
+
+void
+RouteUI::post_group_rtop_cleanup (SessionEvent* ev, RouteGroup* rg, RouteGroup::Property prop)
+{
+ ENSURE_GUI_THREAD (bind (mem_fun (*this, &RouteUI::post_group_rtop_cleanup), ev, rg, prop));
+ delete ev;
+ rg->set_property (prop, false);
+}
+
+void
+RouteUI::queue_route_group_op (RouteGroup::Property prop, void (Session::*session_method)(boost::shared_ptr<RouteList>, bool), bool yn)
+{
+ RouteGroup* rg = _route->route_group();
+ bool prop_was_active;
+
+ if (rg) {
+ prop_was_active = rg->active_property (prop);
+ rg->set_property (prop, true);
+ } else {
+ prop_was_active = false;
+ }
+
+ /* we will queue the op for just this route, but because its route group now has the relevant property marked active,
+ the operation will apply to the whole group (if there is a group)
+ */
+
+ boost::shared_ptr<RouteList> rl (new RouteList);
+ rl->push_back (route());
+
+ SessionEvent* ev = new SessionEvent (SessionEvent::RealTimeOperation, SessionEvent::Add, SessionEvent::Immediate, 0, 0.0);
+ ev->rt_slot = bind (sigc::mem_fun (_session, session_method), rl, yn);
+ if (rg && !prop_was_active) {
+ ev->rt_return = bind (sigc::mem_fun (*this, &RouteUI::post_group_rtop_cleanup), rg, prop);
+ } else {
+ ev->rt_return = sigc::mem_fun (*this, &RouteUI::post_rtop_cleanup);
+ }
+
+ _session.queue_event (ev);
+}
+
bool
RouteUI::rec_enable_press(GdkEventButton* ev)
{
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) {
- _session.begin_reversible_command (_("rec-enable change"));
- Session::GlobalRecordEnableStateCommand *cmd = new Session::GlobalRecordEnableStateCommand(_session, this);
-
- if (rec_enable_button->get_active()) {
- _session.record_disenable_all ();
- } else {
- _session.record_enable_all ();
- check_rec_enable_sensitivity ();
- }
-
- cmd->mark();
- _session.add_command(cmd);
- _session.commit_reversible_command ();
+#if 0
+ _session.set_record_enable (_session.get_route(), !rec_enable_button->get_active(), sigc::mem_fun (*this, &RouteUI::post_rtop_cleanup));
+#endif
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
- /* Primary-button1 applies change to the mix group.
+ /* Primary-button1 applies change to the route group (even if it is not active)
NOTE: Primary-button2 is MIDI learn.
*/
-
- set_route_group_rec_enable (_route, !_route->record_enabled());
+#if 0
+ if (ev->button == 1 && _route->route_group()) {
+ _session.set_record_enable (_route->route_group(), !rec_enable_button->get_active(),
+ queue_route_group_op (RouteGroup::RecEnable, &Session::set_record_enable,
+ }
+#endif
} else if (Keyboard::is_context_menu_event (ev)) {
/* do this on release */
} else {
- reversibly_apply_track_boolean ("rec-enable change", &Track::set_record_enable, !track()->record_enabled(), this);
- check_rec_enable_sensitivity ();
+
+#if 0
+ boost::shared_ptr<RouteList> rl (new RouteList);
+ rl->push_back (route());
+ _session.set_record_enable (rl, !rec_enable_button->get_active(), sigc::mem_fun (*this, &RouteUI::post_rtop_cleanup));
+#endif
}
}
Gtkmm2ext::UI::instance()->call_slot (mem_fun (*this, &RouteUI::update_solo_display));
}
+int
+RouteUI::solo_visual_state (boost::shared_ptr<Route> r)
+{
+ if (Config->get_solo_control_is_listen_control()) {
+
+ if (r->listening()) {
+ return 1;
+ } else {
+ return 0;
+ }
+
+ } else {
+
+ if (r->solo_isolated()) {
+ return 2;
+ } else if (r->soloed()) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
+ return 0;
+}
+
void
RouteUI::update_solo_display ()
{
bool x;
-
+
if (Config->get_solo_control_is_listen_control()) {
if (solo_button->get_active() != (x = _route->listening())) {
ignore_toggle = false;
}
- if (x) {
- solo_button->set_visual_state (1);
- } else {
- solo_button->set_visual_state (0);
- }
-
-
} else {
- if (solo_button->get_active() != (x = _route->soloed())){
+ if (solo_button->get_active() != (x = _route->soloed())) {
ignore_toggle = true;
solo_button->set_active (x);
ignore_toggle = false;
}
- if (_route->solo_isolated()) {
- solo_button->set_visual_state (2);
- } else if (x) {
- solo_button->set_visual_state (1);
- } else {
- solo_button->set_visual_state (0);
- }
}
+
+ solo_button->set_visual_state (solo_visual_state (_route));
}
void
Gtkmm2ext::UI::instance()->call_slot (mem_fun (*this, &RouteUI::update_mute_display));
}
+int
+RouteUI::mute_visual_state (Session& s, boost::shared_ptr<Route> r)
+{
+ if (Config->get_show_solo_mutes()) {
+
+ if (r->muted ()) {
+ /* full mute */
+ return 2;
+ } else if (s.soloing() && !r->soloed() && !r->solo_isolated()) {
+ /* mute-because-not-soloed */
+ return 1;
+ } else {
+ /* no mute at all */
+ return 0;
+ }
+
+ } else {
+
+ if (r->muted()) {
+ /* full mute */
+ return 2;
+ } else {
+ /* no mute at all */
+ return 0;
+ }
+ }
+
+ return 0;
+}
+
void
RouteUI::update_mute_display ()
{
ignore_toggle = false;
}
- /* now attend to visual state */
-
- if (Config->get_show_solo_mutes()) {
- if (_route->muted()) {
- /* full mute */
- mute_button->set_visual_state (2);
- } else if (_session.soloing() && !_route->soloed() && !_route->solo_isolated()) {
- /* mute-because-not-soloed */
- mute_button->set_visual_state (1);
- } else {
- /* no mute at all */
- mute_button->set_visual_state (0);
- }
- } else {
- if (_route->muted()) {
- /* full mute */
- mute_button->set_visual_state (2);
- } else {
- /* no mute at all */
- mute_button->set_visual_state (0);
- }
- }
-
+ mute_button->set_visual_state (mute_visual_state (_session, _route));
}
void
rec_enable_button->set_active (model);
ignore_toggle = false;
}
- else {
- return;
- }
/* now make sure its color state is correct */
} else {
rec_enable_button->set_visual_state (0);
}
+
+ check_rec_enable_sensitivity ();
}
void
items.push_back (CheckMenuElem(*check));
check->show_all();
+ check = new CheckMenuItem(_("Solo Safe"));
+ check->set_active (_route->solo_safe());
+ check->signal_toggled().connect (bind (mem_fun (*this, &RouteUI::toggle_solo_safe), check));
+ _route->solo_safe_changed.connect(bind (mem_fun (*this, &RouteUI::solo_safe_toggle), check));
+ items.push_back (CheckMenuElem(*check));
+ check->show_all();
+
//items.push_back (SeparatorElem());
// items.push_back (MenuElem (_("MIDI Bind"), mem_fun (*mute_button, &BindableToggleButton::midi_learn)));
_route->set_solo_isolated (check->get_active(), this);
}
+void
+RouteUI::toggle_solo_safe (Gtk::CheckMenuItem* check)
+{
+ _route->set_solo_safe (check->get_active(), this);
+}
+
void
RouteUI::set_route_group_solo(boost::shared_ptr<Route> route, bool yn)
{
}
}
+
+void
+RouteUI::solo_safe_toggle(void* /*src*/, Gtk::CheckMenuItem* check)
+{
+ bool yn = _route->solo_safe ();
+
+ if (check->get_active() != yn) {
+ check->set_active (yn);
+ }
+}
+
void
RouteUI::disconnect_input ()
{