diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index f784faf888..7997fb4c5d 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -658,7 +658,7 @@ Editor::Editor () setup_toolbar (); ARDOUR_UI::Blink.connect (sigc::mem_fun(*this, &Editor::solo_blink)); - ARDOUR_UI::Blink.connect (sigc::mem_fun(*this, &Editor::record_status_blink)); + ARDOUR_UI::Blink.connect (sigc::mem_fun(*this, &Editor::record_status_update)); global_solo_button.signal_clicked.connect (sigc::mem_fun(*this,&Editor::global_solo_clicked)); global_rec_button.signal_clicked.connect (sigc::mem_fun(*this,&Editor::global_rec_clicked)); marker_button.signal_clicked.connect (sigc::mem_fun(*this,&Editor::marker_button_clicked)); @@ -5738,33 +5738,26 @@ Editor::global_solo_clicked (WavesButton*) } void -Editor::record_status_blink (bool onoff) +Editor::record_status_update (bool onoff) { if (!_session) { - return; + return; } - if (_session->have_rec_enabled_track()) { - switch (_session->record_status()) { - case Session::Disabled: - case Session::Enabled: - global_rec_button.set_active (onoff); - break; - - case Session::Recording: - global_rec_button.set_active (true); - break; - } - } else { + if ( !_session->have_rec_disabled_track() ) + global_rec_button.set_active (true); + else global_rec_button.set_active (false); - } } void Editor::global_rec_clicked (WavesButton*) { DisplaySuspender ds; - _session->set_record_enabled (_session->get_routes(), !_session->have_rec_enabled_track()); + /* If exists record disabled track make all tracks record enabled. + If does not exist record disabled track make all tracks record disabled. + */ + _session->set_record_enabled (_session->get_routes(), _session->have_rec_disabled_track()); } void diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 3287a8d753..b019a16c3c 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1630,7 +1630,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void global_solo_clicked (WavesButton*); WavesButton& global_rec_button; void global_rec_clicked (WavesButton*); - void record_status_blink (bool); + void record_status_update (bool); Gtkmm2ext::TearOff* _mouse_mode_tearoff; WavesButton& _tool_marker_button; diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index c06bbc7423..0020542b71 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -218,6 +218,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop BufferSet& get_mix_buffers (ChanCount count = ChanCount::ZERO); bool have_rec_enabled_track () const; + bool have_rec_disabled_track () const; bool have_captured() const { return _have_captured; } @@ -1616,6 +1617,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop void update_have_rec_enabled_track (); gint _have_rec_enabled_track; + gint _have_rec_disabled_track; static int ask_about_playlist_deletion (boost::shared_ptr); diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 72e1611ae5..b41f7733aa 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -275,6 +275,7 @@ Session::Session (AudioEngine &eng, , first_file_header_format_reset (true) , have_looped (false) , _have_rec_enabled_track (false) + , _have_rec_disabled_track (true) , _step_editors (0) , _suspend_timecode_transmission (0) , _speakers (new Speakers) @@ -5160,6 +5161,12 @@ Session::have_rec_enabled_track () const return g_atomic_int_get (const_cast(&_have_rec_enabled_track)) == 1; } +bool +Session::have_rec_disabled_track () const +{ + return g_atomic_int_get (const_cast(&_have_rec_disabled_track)) == 1; +} + /** Update the state of our rec-enabled tracks flag */ void Session::update_have_rec_enabled_track () @@ -5183,6 +5190,20 @@ Session::update_have_rec_enabled_track () if (g_atomic_int_get (&_have_rec_enabled_track) != old) { RecordStateChanged (); /* EMIT SIGNAL */ } + + + i = rl->begin(); + while (i != rl->end ()) { + + boost::shared_ptr tr = boost::dynamic_pointer_cast (*i); + if (tr && !tr->record_enabled ()) { + break; + } + + ++i; + } + + g_atomic_int_set (&_have_rec_disabled_track, i != rl->end () ? 1 : 0); } void