[Summary] Changed logic for GLOBAL REC button

[Reviewed] GZharun
This commit is contained in:
nikolay 2014-09-18 15:13:54 +03:00
parent 1fe5453c44
commit 6f01d1894c
4 changed files with 34 additions and 18 deletions

View file

@ -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

View file

@ -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;

View file

@ -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<Playlist>);

View file

@ -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<gint*>(&_have_rec_enabled_track)) == 1;
}
bool
Session::have_rec_disabled_track () const
{
return g_atomic_int_get (const_cast<gint*>(&_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<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
if (tr && !tr->record_enabled ()) {
break;
}
++i;
}
g_atomic_int_set (&_have_rec_disabled_track, i != rl->end () ? 1 : 0);
}
void