1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-26 15:23:48 +01:00

Another overload of ControlToolBar::OnRecord taking bool...

... so that it's called directly where needed without the roundabout of
SetInt in an event, and there is no checking of the state of a button first
This commit is contained in:
Paul Licameli
2019-06-27 23:01:53 -04:00
parent 7d504ba015
commit 8b549ea07f
4 changed files with 11 additions and 15 deletions

View File

@@ -985,19 +985,20 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt)
// Here instead we reduplicate some logic (from CommandHandler) because it isn't
// normally used for buttons.
// Code from CommandHandler start...
AudacityProject *p = &mProject;
bool altAppearance = mRecord->WasShiftDown();
if (evt.GetInt() == 1) // used when called by keyboard shortcut. Default (0) ignored.
altAppearance = true;
if (evt.GetInt() == 2)
altAppearance = false;
OnRecord( altAppearance );
}
void ControlToolBar::OnRecord(bool altAppearance)
// STRONG-GUARANTEE (for state of current project's tracks)
{
bool bPreferNewTrack;
gPrefs->Read("/GUI/PreferNewTrackRecord", &bPreferNewTrack, false);
const bool appendRecord = (altAppearance == bPreferNewTrack);
// Code from CommandHandler start...
AudacityProject *p = &mProject;
if (p) {
const auto &selectedRegion = ViewInfo::Get( *p ).selectedRegion;
double t0 = selectedRegion.t0();

View File

@@ -77,6 +77,7 @@ class ControlToolBar final : public ToolBar {
void OnPlay(wxCommandEvent & evt);
void OnStop(wxCommandEvent & evt);
void OnRecord(wxCommandEvent & evt);
void OnRecord(bool altAppearance);
bool DoRecord(AudacityProject &project,
const TransportTracks &transportTracks, // If captureTracks is empty, then tracks are created
double t0, double t1,