13
0

closing in on a genuinely general scheme for handling route RT changes, now accomodating per-track, route-group override, natural route group and "all" rec-enable operations. still no sight of solo or mute ops

git-svn-id: svn://localhost/ardour2/branches/3.0@6326 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2009-12-08 01:52:49 +00:00
parent 8faf95b9bd
commit 90f95df207
2 changed files with 60 additions and 18 deletions

View File

@ -453,18 +453,49 @@ RouteUI::solo_release(GdkEventButton*)
} }
void void
RouteUI::post_rec_cleanup (SessionEvent* ev, UndoTransaction* undo, Session::GlobalRecordEnableStateCommand* cmd) RouteUI::post_rtop_cleanup (SessionEvent* ev)
{ {
ENSURE_GUI_THREAD (bind (mem_fun (*this, &RouteUI::post_rec_cleanup), ev, undo, cmd)); ENSURE_GUI_THREAD (bind (mem_fun (*this, &RouteUI::post_rtop_cleanup), ev));
delete ev; delete ev;
}
check_rec_enable_sensitivity (); 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);
}
cmd->mark(); void
undo->add_command(cmd); 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;
_session.finish_reversible_command (*undo); 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 bool
@ -489,30 +520,35 @@ RouteUI::rec_enable_press(GdkEventButton* ev)
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) { } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) {
UndoTransaction* undo = _session.start_reversible_command (_("rec-enable change"));
Session::GlobalRecordEnableStateCommand *cmd = new Session::GlobalRecordEnableStateCommand(_session, this);
SessionEvent* ev = new SessionEvent (SessionEvent::RealTimeOperation, SessionEvent::Add, SessionEvent::Immediate, 0, 0.0); SessionEvent* ev = new SessionEvent (SessionEvent::RealTimeOperation, SessionEvent::Add, SessionEvent::Immediate, 0, 0.0);
ev->rt_slot = bind (sigc::mem_fun (_session, &Session::set_all_record_enable), _session.get_routes(), !rec_enable_button->get_active()); ev->rt_slot = bind (sigc::mem_fun (_session, &Session::set_all_record_enable), _session.get_routes(), !rec_enable_button->get_active());
ev->rt_return = bind (sigc::mem_fun (*this, &RouteUI::post_rec_cleanup), undo, cmd); ev->rt_return = sigc::mem_fun (*this, &RouteUI::post_rtop_cleanup);
_session.queue_event (ev); _session.queue_event (ev);
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) { } 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. NOTE: Primary-button2 is MIDI learn.
*/ */
set_route_group_rec_enable (_route, !_route->record_enabled()); if (ev->button == 1) {
queue_route_group_op (RouteGroup::RecEnable, &Session::set_all_record_enable, !rec_enable_button->get_active());
}
} else if (Keyboard::is_context_menu_event (ev)) { } else if (Keyboard::is_context_menu_event (ev)) {
/* do this on release */ /* do this on release */
} else { } else {
reversibly_apply_track_boolean ("rec-enable change", &Track::set_record_enable, !track()->record_enabled(), this); boost::shared_ptr<RouteList> rl (new RouteList);
check_rec_enable_sensitivity (); 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_all_record_enable), rl, !rec_enable_button->get_active());
ev->rt_return = sigc::mem_fun (*this, &RouteUI::post_rtop_cleanup);
_session.queue_event (ev);
} }
} }
@ -827,6 +863,8 @@ RouteUI::update_rec_display ()
} else { } else {
rec_enable_button->set_visual_state (0); rec_enable_button->set_visual_state (0);
} }
check_rec_enable_sensitivity ();
} }
void void

View File

@ -28,6 +28,7 @@
#include "ardour/session_event.h" #include "ardour/session_event.h"
#include "ardour/session.h" #include "ardour/session.h"
#include "ardour/route.h" #include "ardour/route.h"
#include "ardour/route_group.h"
#include "ardour/track.h" #include "ardour/track.h"
#include "axis_view.h" #include "axis_view.h"
@ -207,12 +208,15 @@ class RouteUI : public virtual AxisView
void init (); void init ();
void reset (); void reset ();
void queue_route_group_op (ARDOUR::RouteGroup::Property prop, void (ARDOUR::Session::*session_method)(boost::shared_ptr<ARDOUR::RouteList>, bool), bool yn);
private: private:
void check_rec_enable_sensitivity (); void check_rec_enable_sensitivity ();
void parameter_changed (std::string const &); void parameter_changed (std::string const &);
void relabel_solo_button (); void relabel_solo_button ();
void post_rec_cleanup (ARDOUR::SessionEvent* ev, UndoTransaction* undo, ARDOUR::Session::GlobalRecordEnableStateCommand*); void post_rtop_cleanup (ARDOUR::SessionEvent* ev);
void post_group_rtop_cleanup (ARDOUR::SessionEvent* ev, ARDOUR::RouteGroup*, ARDOUR::RouteGroup::Property);
}; };
#endif /* __ardour_route_ui__ */ #endif /* __ardour_route_ui__ */