From 17afc51644b2b327e173a23d6066dde598838c03 Mon Sep 17 00:00:00 2001 From: Gale Andrews Date: Sun, 18 Sep 2016 18:56:34 +0100 Subject: [PATCH 1/3] Typo in code comment --- src/TimerRecordDialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TimerRecordDialog.cpp b/src/TimerRecordDialog.cpp index fb99d5879..9180f7626 100644 --- a/src/TimerRecordDialog.cpp +++ b/src/TimerRecordDialog.cpp @@ -303,7 +303,7 @@ void TimerRecordDialog::OnAutoSavePathButton_Click(wxCommandEvent& WXUNUSED(even AudacityProject* pProject = GetActiveProject(); - // If project already exits then abort - we do not allow users to overwrite an existing project + // If project already exists then abort - we do not allow users to overwrite an existing project // unless it is the current project. if (wxFileExists(fName) && (pProject->GetFileName() != fName)) { wxMessageDialog m( From 655d7596aba913ef6b8c46c1350db65b0bcf4123 Mon Sep 17 00:00:00 2001 From: Mark Young Date: Sun, 18 Sep 2016 22:15:54 +0100 Subject: [PATCH 2/3] Assign mMessage to the first column wxStaticText control to allow non-TimerRecord usages to work correctly. --- src/widgets/ProgressDialog.cpp | 11 +++++++++-- src/widgets/ProgressDialog.h | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/widgets/ProgressDialog.cpp b/src/widgets/ProgressDialog.cpp index 05fbe2ac1..dbd7bba3b 100644 --- a/src/widgets/ProgressDialog.cpp +++ b/src/widgets/ProgressDialog.cpp @@ -1069,7 +1069,7 @@ void ProgressDialog::Init() } // Add a new text column each time this is called. -void ProgressDialog::AddMessageAsColumn(wxBoxSizer * pSizer, const wxString & sText) { +void ProgressDialog::AddMessageAsColumn(wxBoxSizer * pSizer, const wxString & sText, bool bFirstColumn) { // Assuming that we don't want empty columns, bail out if there is no text. if (sText.IsEmpty()) @@ -1086,6 +1086,12 @@ void ProgressDialog::AddMessageAsColumn(wxBoxSizer * pSizer, const wxString & sT wxALIGN_LEFT); oText->SetName(sText); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs) + // If this is the first column then set the mMessage pointer so non-TimerRecord usages + // will still work correctly + if (bFirstColumn) { + mMessage = oText; + } + pSizer->Add(oText, 1, wxEXPAND | wxALL, 5); } @@ -1125,7 +1131,8 @@ bool ProgressDialog::Create(const wxString & title, auto colSizer = uColSizer.get(); for (size_t column = 0; column < arMessages.GetCount(); column++) { - AddMessageAsColumn(colSizer, arMessages[column]); + bool bFirstCol = (column == 0); + AddMessageAsColumn(colSizer, arMessages[column], bFirstCol); } // and put message column(s) into a main vertical sizer. diff --git a/src/widgets/ProgressDialog.h b/src/widgets/ProgressDialog.h index d916493b3..4341306df 100644 --- a/src/widgets/ProgressDialog.h +++ b/src/widgets/ProgressDialog.h @@ -113,7 +113,7 @@ private: const wxString & sTitle, int iButtonID = -1); - void AddMessageAsColumn(wxBoxSizer * pSizer, const wxString & sText); + void AddMessageAsColumn(wxBoxSizer * pSizer, const wxString & sText, bool bFirstColumn); private: // This guarantees we have an active event loop...possible during OnInit() From 0eb2f85bfb4aa5778c8c2811412067b2863202c5 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Mon, 19 Sep 2016 10:38:42 -0400 Subject: [PATCH 3/3] Use DBL_MAX, not arbitrary 1000000000.0, as "infinite" time interval --- src/AudioIO.cpp | 1 + src/AudioIO.h | 3 ++- src/Lyrics.cpp | 2 +- src/Menus.cpp | 2 +- src/MixerBoard.cpp | 1 + src/TimeTrack.cpp | 5 +++-- src/toolbars/ControlToolBar.cpp | 5 +++-- 7 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/AudioIO.cpp b/src/AudioIO.cpp index fed87be66..a9b8599a5 100644 --- a/src/AudioIO.cpp +++ b/src/AudioIO.cpp @@ -269,6 +269,7 @@ writing audio. #include "AudioIO.h" #include "float_cast.h" +#include #include #include #include diff --git a/src/AudioIO.h b/src/AudioIO.h index 3f89b1d69..929fb2d83 100644 --- a/src/AudioIO.h +++ b/src/AudioIO.h @@ -70,7 +70,8 @@ bool ValidateDeviceNames(); class AudioIOListener; -#define BAD_STREAM_TIME -1000000000.0 +// #include if you need this constant +#define BAD_STREAM_TIME (-DBL_MAX) #define MAX_MIDI_BUFFER_SIZE 5000 #define DEFAULT_SYNTH_LATENCY 5 diff --git a/src/Lyrics.cpp b/src/Lyrics.cpp index cd08e5f0f..2faae7421 100644 --- a/src/Lyrics.cpp +++ b/src/Lyrics.cpp @@ -421,7 +421,7 @@ void Lyrics::Update(double t) { if (t < 0.0) { - // TrackPanel::OnTimer passes gAudioIO->GetStreamTime(), which is -1000000000 if !IsStreamActive(). + // TrackPanel::OnTimer passes gAudioIO->GetStreamTime(), which is -DBL_MAX if !IsStreamActive(). // In that case, use the selection start time. AudacityProject* pProj = GetActiveProject(); mT = pProj->GetSel0(); diff --git a/src/Menus.cpp b/src/Menus.cpp index 1face9b57..b99dfa8bd 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -5888,7 +5888,7 @@ void AudacityProject::HandleAlign(int index, bool moveSel) wxString action; wxString shortAction; double offset; - double minOffset = 1000000000.0; + double minOffset = DBL_MAX; double maxEndOffset = 0.0; double leftOffset = 0.0; bool bRightChannel = false; diff --git a/src/MixerBoard.cpp b/src/MixerBoard.cpp index e2d68601a..85994f014 100644 --- a/src/MixerBoard.cpp +++ b/src/MixerBoard.cpp @@ -13,6 +13,7 @@ #include "Experimental.h" #include "MixerBoard.h" +#include #include #include diff --git a/src/TimeTrack.cpp b/src/TimeTrack.cpp index bdbd8008d..f5d909d18 100644 --- a/src/TimeTrack.cpp +++ b/src/TimeTrack.cpp @@ -16,6 +16,7 @@ #include "Audacity.h" #include "TimeTrack.h" +#include #include #include "AColor.h" #include "widgets/Ruler.h" @@ -44,7 +45,7 @@ TimeTrack::TimeTrack(const std::shared_ptr &projDirManager, const Zo mDisplayLog = false; mEnvelope = std::make_unique(); - mEnvelope->SetTrackLen(1000000000.0); + mEnvelope->SetTrackLen(DBL_MAX); mEnvelope->SetInterpolateDB(true); mEnvelope->Flatten(1.0); mEnvelope->Mirror(false); @@ -71,7 +72,7 @@ TimeTrack::TimeTrack(const TimeTrack &orig): ///@TODO: Give Envelope:: a copy-constructor instead of this? mEnvelope = std::make_unique(); - mEnvelope->SetTrackLen(1000000000.0); + mEnvelope->SetTrackLen(DBL_MAX); SetInterpolateLog(orig.GetInterpolateLog()); // this calls Envelope::SetInterpolateDB mEnvelope->Flatten(1.0); mEnvelope->Mirror(false); diff --git a/src/toolbars/ControlToolBar.cpp b/src/toolbars/ControlToolBar.cpp index 8a6047b62..9a5194abb 100644 --- a/src/toolbars/ControlToolBar.cpp +++ b/src/toolbars/ControlToolBar.cpp @@ -33,6 +33,7 @@ *//*******************************************************************/ #include +#include #include "../Audacity.h" #include "../Experimental.h" @@ -891,7 +892,7 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt) double t0 = p->GetSel0(); double t1 = p->GetSel1(); if (t1 == t0) - t1 = 1000000000.0; // record for a long, long time (tens of years) + t1 = DBL_MAX; // record for a long, long time /* TODO: set up stereo tracks if that is how the user has set up * their preferences, and choose sample format based on prefs */ @@ -985,7 +986,7 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt) } } - t1 = 1000000000.0; // record for a long, long time (tens of years) + t1 = DBL_MAX; // record for a long, long time } else { bool recordingNameCustom, useTrackNumber, useDateStamp, useTimeStamp;