diff --git a/gtk2_ardour/actions.cc b/gtk2_ardour/actions.cc index bd9ef3c51d..59418aadad 100644 --- a/gtk2_ardour/actions.cc +++ b/gtk2_ardour/actions.cc @@ -47,6 +47,7 @@ using namespace ARDOUR; vector > ActionManager::session_sensitive_actions; vector > ActionManager::write_sensitive_actions; +vector > ActionManager::record_restricted_actions; vector > ActionManager::region_list_selection_sensitive_actions; vector > ActionManager::plugin_selection_sensitive_actions; vector > ActionManager::track_selection_sensitive_actions; diff --git a/gtk2_ardour/actions.h b/gtk2_ardour/actions.h index 50f9c20b82..d37f799839 100644 --- a/gtk2_ardour/actions.h +++ b/gtk2_ardour/actions.h @@ -34,6 +34,7 @@ namespace ActionManager { extern std::vector > session_sensitive_actions; extern std::vector > write_sensitive_actions; + extern std::vector > record_restricted_actions; extern std::vector > region_list_selection_sensitive_actions; extern std::vector > plugin_selection_sensitive_actions; diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 12e51e9d95..2c99f0b848 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -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); + } + } } diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index fcf94b38bb..c67dd1ff9b 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -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; diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index 6b3e8213fb..ecdc040302 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -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()); diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 88e1a4e509..b7d3ce7445 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -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)); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 7dadb7bd37..6fdc2745f6 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -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() ); diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 09538c3f82..652f03fd44 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -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); diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 2dc7fd4995..bea8da6b2f 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -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)); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index d827357d1a..9d01ca6dba 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -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(*iter); + + if (rtv) { + if (yn) { + rtv->enable_header_dnd (); + } else { + rtv->disable_header_dnd (); + } + } + } +} + void Editor::remove_tracks () { diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc index 8e071c080c..3c89f09f6a 100644 --- a/gtk2_ardour/editor_selection.cc +++ b/gtk2_ardour/editor_selection.cc @@ -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 (); diff --git a/gtk2_ardour/tracks_control_panel.logic.cc b/gtk2_ardour/tracks_control_panel.logic.cc index 8cd0491ca7..3b05185568 100644 --- a/gtk2_ardour/tracks_control_panel.logic.cc +++ b/gtk2_ardour/tracks_control_panel.logic.cc @@ -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); } diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index f0438ffc0a..eb1886adaf 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -304,7 +304,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop /* Record status signals */ PBD::Signal0 RecordStateChanged; - + PBD::Signal0 RecordArmStateChanged; + /* Emited when session is loaded */ PBD::Signal0 SessionLoaded; diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index c08be20e1a..fd659f55ad 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -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