1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-21 08:27:13 +01:00

Rename Maybe and its members more like std::optional of C++17

This commit is contained in:
Paul Licameli
2020-01-19 09:51:50 -05:00
parent 30999ab134
commit 2570b56176
21 changed files with 75 additions and 73 deletions

View File

@@ -93,7 +93,7 @@ bool DoPasteNothingSelected(AudacityProject &project)
Track* pFirstNewTrack = NULL;
for (auto pClip : clipTrackRange) {
Maybe<WaveTrack::Locker> locker;
Optional<WaveTrack::Locker> locker;
Track::Holder uNewTrack;
Track *pNewTrack;
@@ -102,7 +102,7 @@ bool DoPasteNothingSelected(AudacityProject &project)
if ((clipboard.Project() != &project))
// Cause duplication of block files on disk, when copy is
// between projects
locker.create(wc);
locker.emplace(wc);
uNewTrack = trackFactory.NewWaveTrack(
wc->GetSampleFormat(), wc->GetRate()),
pNewTrack = uNewTrack.get();
@@ -505,7 +505,7 @@ void OnPaste(const CommandContext &context)
ff = n;
wxASSERT( n && c && n->SameKindAs(*c) );
Maybe<WaveTrack::Locker> locker;
Optional<WaveTrack::Locker> locker;
n->TypeSwitch(
[&](WaveTrack *wn){
@@ -513,7 +513,7 @@ void OnPaste(const CommandContext &context)
if (clipboard.Project() != &project)
// Cause duplication of block files on disk, when copy is
// between projects
locker.create(wc);
locker.emplace(wc);
bPastedSomething = true;
wn->ClearAndPaste(t0, t1, wc, true, true);
},
@@ -583,11 +583,11 @@ void OnPaste(const CommandContext &context)
{
const auto wc =
*clipboard.GetTracks().Any< const WaveTrack >().rbegin();
Maybe<WaveTrack::Locker> locker;
Optional<WaveTrack::Locker> locker;
if (clipboard.Project() != &project && wc)
// Cause duplication of block files on disk, when copy is
// between projects
locker.create(static_cast<const WaveTrack*>(wc));
locker.emplace(static_cast<const WaveTrack*>(wc));
tracks.Any().StartingWith(*pN).Visit(
[&](WaveTrack *wt, const Track::Fallthrough &fallthrough) {

View File

@@ -347,7 +347,7 @@ class ASAProgress final : public SAProgress {
long mTotalCells; // how many matrix cells?
long mCellCount; // how many cells so far?
long mPrevCellCount; // cell_count last reported with Update()
Maybe<ProgressDialog> mProgress;
Optional<ProgressDialog> mProgress;
#ifdef COLLECT_TIMING_DATA
FILE *mTimeFile;
wxDateTime mStartTime;
@@ -409,7 +409,7 @@ class ASAProgress final : public SAProgress {
work[1], mFrames[1], is_audio[1]);
wxFprintf(mTimeFile, "work2 = %g, work3 = %g\n", work2, work3);
#endif
mProgress.create(XO("Synchronize MIDI with Audio"),
mProgress.emplace(XO("Synchronize MIDI with Audio"),
XO("Synchronizing MIDI and Audio Tracks"));
} else if (i < 3) {
wxFprintf(mTimeFile,