[Summary] Implemented restriction logic usecases for Record

[Details] Please, note, that insensitive (during record) topbar buttons will have incorrect look so far. Will be fixed by VKamyshniy
[Reviewed by QA] MKosharniy
This commit is contained in:
Greg Zharun 2015-01-29 17:59:21 +02:00
parent 938cb16bff
commit 0ffc6cef5d
14 changed files with 125 additions and 9 deletions

View file

@ -47,6 +47,7 @@ using namespace ARDOUR;
vector<RefPtr<Gtk::Action> > ActionManager::session_sensitive_actions;
vector<RefPtr<Gtk::Action> > ActionManager::write_sensitive_actions;
vector<RefPtr<Gtk::Action> > ActionManager::record_restricted_actions;
vector<RefPtr<Gtk::Action> > ActionManager::region_list_selection_sensitive_actions;
vector<RefPtr<Gtk::Action> > ActionManager::plugin_selection_sensitive_actions;
vector<RefPtr<Gtk::Action> > ActionManager::track_selection_sensitive_actions;

View file

@ -34,6 +34,7 @@ namespace ActionManager {
extern std::vector<Glib::RefPtr<Gtk::Action> > session_sensitive_actions;
extern std::vector<Glib::RefPtr<Gtk::Action> > write_sensitive_actions;
extern std::vector<Glib::RefPtr<Gtk::Action> > record_restricted_actions;
extern std::vector<Glib::RefPtr<Gtk::Action> > region_list_selection_sensitive_actions;
extern std::vector<Glib::RefPtr<Gtk::Action> > plugin_selection_sensitive_actions;

View file

@ -1962,6 +1962,15 @@ void ARDOUR_UI::toggle_multi_out_mode ()
// the mode is already enabled, nothing to do here
return;
}
if (!_session) {
return;
}
if (_session->record_status () == Session::Recording && _session->have_rec_enabled_track ()) {
return;
}
Config->set_output_auto_connect(AutoConnectPhysical);
editor->get_waves_button ("mode_multi_out_button").set_active(true);
@ -1975,6 +1984,14 @@ void ARDOUR_UI::toggle_stereo_out_mode ()
return;
}
if (!_session) {
return;
}
if (_session->record_status () == Session::Recording && _session->have_rec_enabled_track ()) {
return;
}
Config->set_output_auto_connect(AutoConnectMaster);
editor->get_waves_button ("mode_stereo_out_button").set_active(true);
editor->get_waves_button ("mode_multi_out_button").set_active(false);
@ -4364,15 +4381,31 @@ ARDOUR_UI::record_state_changed ()
{
ENSURE_GUI_THREAD (*this, &ARDOUR_UI::record_state_changed);
if (!_session || !big_clock_window) {
if (!_session ) {
/* why bother - the clock isn't visible */
return;
}
if (_session->record_status () == Session::Recording && _session->have_rec_enabled_track ()) {
big_clock->set_active (true);
tracks_control_panel.action()->set_sensitive(false);
set_topbar_buttons_sensitive (false);
ActionManager::set_sensitive (ActionManager::record_restricted_actions, false);
if (big_clock_window) {
big_clock->set_active (true);
}
} else {
big_clock->set_active (false);
tracks_control_panel.action()->set_sensitive(true);
set_topbar_buttons_sensitive (true);
ActionManager::set_sensitive (ActionManager::record_restricted_actions, true);
if (big_clock_window) {
big_clock->set_active (false);
}
}
}

View file

@ -276,6 +276,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
void update_sample_rate_dropdown ();
void update_frame_rate_button ();
void update_recent_session_menuitems();
void set_topbar_buttons_sensitive (bool yn);
PBD::ScopedConnectionList update_connections_to_toolbar_buttons;

View file

@ -154,6 +154,7 @@ ARDOUR_UI::set_session (Session *s)
_session->SessionSaveUnderway.connect_same_thread (_session_connections, boost::bind (&ARDOUR_UI::save_session_gui_state, this));
_session->SaveSessionRequested.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::save_session_at_its_request, this, _1), gui_context());
_session->RecordStateChanged.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::record_state_changed, this), gui_context());
_session->RecordArmStateChanged.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::record_state_changed, this), gui_context());
_session->StepEditStatusChange.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::step_edit_status_change, this, _1), gui_context());
_session->TransportStateChange.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::map_transport_state, this), gui_context());
_session->DirtyChanged.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::update_autosave, this), gui_context());

View file

@ -522,6 +522,17 @@ ARDOUR_UI::update_recent_session_menuitems ()
}
}
void
ARDOUR_UI::set_topbar_buttons_sensitive (bool yn)
{
_bit_depth_button->set_sensitive (yn);
_frame_rate_button->set_sensitive (yn);
_sample_rate_dropdown->set_sensitive (yn);
_display_format_dropdown->set_sensitive (yn);
_timecode_source_dropdown->set_sensitive (yn);
}
void
ARDOUR_UI::install_actions ()
{
@ -567,9 +578,11 @@ ARDOUR_UI::install_actions ()
act = ActionManager::register_action (main_actions, X_("Close"), _("Close"), sigc::mem_fun(*this, &ARDOUR_UI::close_session));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::record_restricted_actions.push_back (act);
act = ActionManager::register_action (main_actions, X_("AddTrackBus"), _("Add Track"),
sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::add_route), (Gtk::Window*) 0));
ActionManager::record_restricted_actions.push_back (act);
//ActionManager::session_sensitive_actions.push_back (act);
//ActionManager::write_sensitive_actions.push_back (act);
@ -635,6 +648,7 @@ ARDOUR_UI::install_actions ()
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (main_actions, X_("CleanupUnused"), _("Delete Unused Sources"), sigc::mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::cleanup));
ActionManager::record_restricted_actions.push_back (act);
//ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (main_actions, X_("ShowUnused"), _("Show Unused"), sigc::mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::open_dead_folder));
//ActionManager::session_sensitive_actions.push_back (act);
@ -647,8 +661,9 @@ ARDOUR_UI::install_actions ()
/* these actions are intended to be shared across all windows */
common_actions = ActionGroup::create (X_("Common"));
ActionManager::register_action (common_actions, X_("Quit"), _("Quit"), (hide_return (sigc::mem_fun(*this, &ARDOUR_UI::finish))));
act = ActionManager::register_action (common_actions, X_("Quit"), _("Quit"), (hide_return (sigc::mem_fun(*this, &ARDOUR_UI::finish))));
ActionManager::record_restricted_actions.push_back (act);
/* windows visibility actions */
ActionManager::register_toggle_action (common_actions, X_("ToggleMaximalEditor"), _("Maximise Editor Space"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_editing_space));

View file

@ -1235,12 +1235,18 @@ Editor::start_session_auto_save_event_timing ()
void
Editor::on_record_state_changed ()
{
if (_session->actively_recording() ) {
if (_session->actively_recording() && _drags->active() ) {
_drags->abort ();
}
start_lock_event_timing ();
start_session_auto_save_event_timing ();
if (_session->actively_recording() && _session->have_rec_enabled_track () ) {
set_track_header_dnd_active (false);
} else {
set_track_header_dnd_active (true);
}
}
bool
@ -1486,6 +1492,7 @@ Editor::set_session (Session *t)
_session->locations()->changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::refresh_location_display, this), gui_context());
_session->history().Changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::history_changed, this), gui_context());
_session->RecordStateChanged.connect (_session_connections, invalidator (*this), boost::bind (&Editor::on_record_state_changed, this), gui_context());
_session->RecordArmStateChanged.connect (_session_connections, invalidator (*this), boost::bind (&Editor::on_record_state_changed, this), gui_context());
_session->locations()->session_range_location()->StartChanged.connect(_session_connections, invalidator (*this), boost::bind (&Editor::update_horizontal_adjustment_limits, this), gui_context() );
_session->locations()->session_range_location()->EndChanged.connect(_session_connections, invalidator (*this), boost::bind (&Editor::update_horizontal_adjustment_limits, this), gui_context() );

View file

@ -2083,7 +2083,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void remove_tracks ();
void toggle_tracks_active ();
void set_track_header_dnd_active (bool yn);
bool _have_idled;
int resize_idle_id;
static gboolean _idle_resize (gpointer);

View file

@ -283,10 +283,13 @@ Editor::register_actions ()
reg_sens (editor_actions, "vertical-zoom-out", _("Zoom Out Vertical "), sigc::mem_fun (*this, &Editor::vertical_zoom_step_out ));
act = reg_sens (editor_actions, "DeleteSelectedTracks", _("Delete Selected"), sigc::mem_fun(ARDOUR_UI::instance(), &ARDOUR_UI::delete_selected_tracks));
ActionManager::record_restricted_actions.push_back (act);
ActionManager::track_selection_sensitive_actions.push_back (act);
act = reg_sens (editor_actions, "move-selected-tracks-up", _("Move Up"), sigc::bind (sigc::mem_fun(*_routes, &EditorRoutes::move_selected_tracks), true));
ActionManager::record_restricted_actions.push_back (act);
ActionManager::track_selection_sensitive_actions.push_back (act);
act = reg_sens (editor_actions, "move-selected-tracks-down", _("Move Down"), sigc::bind (sigc::mem_fun(*_routes, &EditorRoutes::move_selected_tracks), false));
ActionManager::record_restricted_actions.push_back (act);
ActionManager::track_selection_sensitive_actions.push_back (act);
act = reg_sens (editor_actions, "scroll-tracks-up", _("Scroll Tracks Up"), sigc::mem_fun(*this, &Editor::scroll_tracks_up));
@ -327,10 +330,14 @@ Editor::register_actions ()
reg_sens (editor_actions, "duplicate-range", _("Duplicate Range"), sigc::bind (sigc::mem_fun(*this, &Editor::duplicate_range), false));
undo_action = reg_sens (editor_actions, "undo", _("Undo"), sigc::bind (sigc::mem_fun(*this, &Editor::undo), 1U));
ActionManager::record_restricted_actions.push_back (undo_action);
redo_action = reg_sens (editor_actions, "redo", _("Redo"), sigc::bind (sigc::mem_fun(*this, &Editor::redo), 1U));
ActionManager::record_restricted_actions.push_back (redo_action);
redo_action = reg_sens (editor_actions, "alternate-redo", _("Redo"), sigc::bind (sigc::mem_fun(*this, &Editor::redo), 1U));
ActionManager::record_restricted_actions.push_back (redo_action);
redo_action = reg_sens (editor_actions, "alternate-alternate-redo", _("Redo"), sigc::bind (sigc::mem_fun(*this, &Editor::redo), 1U));
ActionManager::record_restricted_actions.push_back (redo_action);
reg_sens (editor_actions, "export-audio", _("Export Audio"), sigc::mem_fun(*this, &Editor::export_audio));
reg_sens (editor_actions, "export-range", _("Export Range"), sigc::mem_fun(*this, &Editor::export_range));

View file

@ -6601,6 +6601,24 @@ Editor::toggle_tracks_active ()
}
}
void
Editor::set_track_header_dnd_active (bool yn)
{
TrackViewList::iterator iter = track_views.begin ();
for (; iter != track_views.end(); ++iter) {
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(*iter);
if (rtv) {
if (yn) {
rtv->enable_header_dnd ();
} else {
rtv->disable_header_dnd ();
}
}
}
}
void
Editor::remove_tracks ()
{

View file

@ -1112,6 +1112,11 @@ Editor::track_selection_changed ()
// check if we should enable track selectin sensitive actions
ActionManager::set_sensitive (ActionManager::track_selection_sensitive_actions, track_selected() );
// but disable those actions which are restricted if we are actively recording
if (_session->record_status () == Session::Recording && _session->have_rec_enabled_track ()) {
ActionManager::set_sensitive (ActionManager::record_restricted_actions, false );
}
/* make session dirty */
set_session_dirty ();

View file

@ -1496,6 +1496,15 @@ TracksControlPanel::on_multi_out (WavesButton*)
return;
}
ARDOUR::Session* session = ARDOUR_UI::instance()->the_session();
if (!session) {
return;
}
if (session->record_status () == Session::Recording && session->have_rec_enabled_track ()) {
return;
}
Config->set_output_auto_connect(AutoConnectPhysical);
}
@ -1506,6 +1515,15 @@ TracksControlPanel::on_stereo_out (WavesButton*)
return;
}
ARDOUR::Session* session = ARDOUR_UI::instance()->the_session();
if (!session) {
return;
}
if (session->record_status () == Session::Recording && session->have_rec_enabled_track ()) {
return;
}
Config->set_output_auto_connect(AutoConnectMaster);
}

View file

@ -304,7 +304,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
/* Record status signals */
PBD::Signal0<void> RecordStateChanged;
PBD::Signal0<void> RecordArmStateChanged;
/* Emited when session is loaded */
PBD::Signal0<void> SessionLoaded;

View file

@ -5483,6 +5483,12 @@ Session::update_route_record_state ()
}
g_atomic_int_set (&_have_rec_disabled_track, i != rl->end () ? 1 : 0);
bool record_arm_state_changed = (old != g_atomic_int_get (&_have_rec_enabled_track) );
if (record_status() == Recording && record_arm_state_changed ) {
RecordArmStateChanged ();
}
}
void