mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-10 09:01:13 +02: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:
parent
7d504ba015
commit
8b549ea07f
@ -330,11 +330,8 @@ void DoPause( AudacityProject &project )
|
|||||||
|
|
||||||
void DoRecord( AudacityProject &project )
|
void DoRecord( AudacityProject &project )
|
||||||
{
|
{
|
||||||
wxCommandEvent evt;
|
|
||||||
evt.SetInt(2); // 0 is default, use 1 to set shift on, 2 to clear it
|
|
||||||
|
|
||||||
auto &controlToolBar = ControlToolBar::Get( project );
|
auto &controlToolBar = ControlToolBar::Get( project );
|
||||||
controlToolBar.OnRecord(evt);
|
controlToolBar.OnRecord(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoLockPlayRegion( AudacityProject &project )
|
void DoLockPlayRegion( AudacityProject &project )
|
||||||
|
@ -247,11 +247,8 @@ void OnRecord(const CommandContext &context)
|
|||||||
void OnRecord2ndChoice(const CommandContext &context)
|
void OnRecord2ndChoice(const CommandContext &context)
|
||||||
{
|
{
|
||||||
auto &project = context.project;
|
auto &project = context.project;
|
||||||
wxCommandEvent evt;
|
|
||||||
evt.SetInt(1); // 0 is default, use 1 to set shift on, 2 to clear it
|
|
||||||
|
|
||||||
auto &controlToolBar = ControlToolBar::Get( project );
|
auto &controlToolBar = ControlToolBar::Get( project );
|
||||||
controlToolBar.OnRecord(evt);
|
controlToolBar.OnRecord(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnTimerRecord(const CommandContext &context)
|
void OnTimerRecord(const CommandContext &context)
|
||||||
|
@ -985,19 +985,20 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt)
|
|||||||
// Here instead we reduplicate some logic (from CommandHandler) because it isn't
|
// Here instead we reduplicate some logic (from CommandHandler) because it isn't
|
||||||
// normally used for buttons.
|
// normally used for buttons.
|
||||||
|
|
||||||
// Code from CommandHandler start...
|
|
||||||
AudacityProject *p = &mProject;
|
|
||||||
|
|
||||||
bool altAppearance = mRecord->WasShiftDown();
|
bool altAppearance = mRecord->WasShiftDown();
|
||||||
if (evt.GetInt() == 1) // used when called by keyboard shortcut. Default (0) ignored.
|
OnRecord( altAppearance );
|
||||||
altAppearance = true;
|
}
|
||||||
if (evt.GetInt() == 2)
|
|
||||||
altAppearance = false;
|
|
||||||
|
|
||||||
|
void ControlToolBar::OnRecord(bool altAppearance)
|
||||||
|
// STRONG-GUARANTEE (for state of current project's tracks)
|
||||||
|
{
|
||||||
bool bPreferNewTrack;
|
bool bPreferNewTrack;
|
||||||
gPrefs->Read("/GUI/PreferNewTrackRecord", &bPreferNewTrack, false);
|
gPrefs->Read("/GUI/PreferNewTrackRecord", &bPreferNewTrack, false);
|
||||||
const bool appendRecord = (altAppearance == bPreferNewTrack);
|
const bool appendRecord = (altAppearance == bPreferNewTrack);
|
||||||
|
|
||||||
|
// Code from CommandHandler start...
|
||||||
|
AudacityProject *p = &mProject;
|
||||||
|
|
||||||
if (p) {
|
if (p) {
|
||||||
const auto &selectedRegion = ViewInfo::Get( *p ).selectedRegion;
|
const auto &selectedRegion = ViewInfo::Get( *p ).selectedRegion;
|
||||||
double t0 = selectedRegion.t0();
|
double t0 = selectedRegion.t0();
|
||||||
|
@ -77,6 +77,7 @@ class ControlToolBar final : public ToolBar {
|
|||||||
void OnPlay(wxCommandEvent & evt);
|
void OnPlay(wxCommandEvent & evt);
|
||||||
void OnStop(wxCommandEvent & evt);
|
void OnStop(wxCommandEvent & evt);
|
||||||
void OnRecord(wxCommandEvent & evt);
|
void OnRecord(wxCommandEvent & evt);
|
||||||
|
void OnRecord(bool altAppearance);
|
||||||
bool DoRecord(AudacityProject &project,
|
bool DoRecord(AudacityProject &project,
|
||||||
const TransportTracks &transportTracks, // If captureTracks is empty, then tracks are created
|
const TransportTracks &transportTracks, // If captureTracks is empty, then tracks are created
|
||||||
double t0, double t1,
|
double t0, double t1,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user