1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-17 16:40:07 +02:00

Remove unnecesary Format, Printf, casts to wxString

This commit is contained in:
Paul Licameli 2017-09-30 12:19:44 -04:00
parent 7fd78183d2
commit e0970ad1e8
12 changed files with 71 additions and 51 deletions

View File

@ -346,10 +346,10 @@ visit our [[http://forum.audacityteam.org/|forum]].");
#endif #endif
/* i18n-hint: The Latin phrase, "In memory of" a deceased person, often untranslated in European languages */ /* i18n-hint: The Latin phrase, "In memory of" a deceased person, often untranslated in European languages */
wxT("<p><b>") + wxString::Format(_("In Memoriam")) + wxT("</b><br>") + wxT("<p><b>") + _("In Memoriam") + wxT("</b><br>") +
GetCreditsByRole(roleDeceased) + GetCreditsByRole(roleDeceased) +
wxT("<p><b>") + wxString::Format(_("Audacity Team Members")) + wxT("</b><br>") + wxT("<p><b>") + _("Audacity Team Members") + wxT("</b><br>") +
GetCreditsByRole(roleTeamMember) + GetCreditsByRole(roleTeamMember) +
wxT("<p><b> ") + _("Emeritus:") + wxT("</b><br>") + wxT("<p><b> ") + _("Emeritus:") + wxT("</b><br>") +

View File

@ -1123,7 +1123,7 @@ void AudacityProject::CreateMenusAndCommands()
EffectManager::Get().GetEffectName(mLastEffect)); EffectManager::Get().GetEffectName(mLastEffect));
} }
else else
buildMenuLabel.Printf(_("Repeat Last Effect")); buildMenuLabel = _("Repeat Last Effect");
#ifdef EXPERIMENTAL_EFFECT_MANAGEMENT #ifdef EXPERIMENTAL_EFFECT_MANAGEMENT
c->AddItem(wxT("ManageEffects"), _("Add / Remove Plug-ins..."), FN(OnManageEffects)); c->AddItem(wxT("ManageEffects"), _("Add / Remove Plug-ins..."), FN(OnManageEffects));
@ -1937,7 +1937,7 @@ void AudacityProject::ModifyUndoMenuItems()
} }
else { else {
mCommandManager.Modify(wxT("Undo"), mCommandManager.Modify(wxT("Undo"),
wxString::Format(_("&Undo"))); _("&Undo"));
} }
if (GetUndoManager()->RedoAvailable()) { if (GetUndoManager()->RedoAvailable()) {
@ -1949,7 +1949,7 @@ void AudacityProject::ModifyUndoMenuItems()
} }
else { else {
mCommandManager.Modify(wxT("Redo"), mCommandManager.Modify(wxT("Redo"),
wxString::Format(_("&Redo"))); _("&Redo"));
mCommandManager.Enable(wxT("Redo"), false); mCommandManager.Enable(wxT("Redo"), false);
} }
} }
@ -4602,13 +4602,13 @@ void AudacityProject::OnExportMIDI(){
} }
if(numNoteTracksSelected > 1) { if(numNoteTracksSelected > 1) {
AudacityMessageBox(wxString::Format(_( AudacityMessageBox(_(
"Please select only one Note Track at a time."))); "Please select only one Note Track at a time."));
return; return;
} }
else if(numNoteTracksSelected < 1) { else if(numNoteTracksSelected < 1) {
AudacityMessageBox(wxString::Format(_( AudacityMessageBox(_(
"Please select a Note Track."))); "Please select a Note Track."));
return; return;
} }

View File

@ -4920,7 +4920,7 @@ void AudacityProject::OnTimer(wxTimerEvent& WXUNUSED(event))
ODManager::Instance()->SignalTaskQueueLoop(); ODManager::Instance()->SignalTaskQueueLoop();
msg.Printf(_("On-demand import and waveform calculation complete.")); msg = _("On-demand import and waveform calculation complete.");
mStatusBar->SetStatusText(msg, mainStatusBarField); mStatusBar->SetStatusText(msg, mainStatusBarField);
} }

View File

@ -524,12 +524,12 @@ int TimerRecordDialog::RunWaitDialog()
// Two column layout. Line spacing must match for both columns. // Two column layout. Line spacing must match for both columns.
// First column // First column
wxString strMsg = wxString::Format(_("Recording start:\n") + wxString strMsg = _("Recording start:\n") +
_("Duration:\n") + _("Duration:\n") +
_("Recording end:\n\n") + _("Recording end:\n\n") +
_("Automatic Save enabled:\n") + _("Automatic Save enabled:\n") +
_("Automatic Export enabled:\n") + _("Automatic Export enabled:\n") +
_("Action after Timer Recording:")); _("Action after Timer Recording:");
strMsg += ProgressDialog::ColoumnSplitMarker; strMsg += ProgressDialog::ColoumnSplitMarker;
@ -1009,12 +1009,12 @@ ProgressResult TimerRecordDialog::WaitForStart()
// Two column layout. Line spacing must match for both columns. // Two column layout. Line spacing must match for both columns.
// First column // First column
wxString strMsg = wxString::Format(_("Waiting to start recording at:\n") + wxString strMsg = _("Waiting to start recording at:\n") +
_("Recording duration:\n") + _("Recording duration:\n") +
_("Scheduled to stop at:\n\n") + _("Scheduled to stop at:\n\n") +
_("Automatic Save enabled:\n") + _("Automatic Save enabled:\n") +
_("Automatic Export enabled:\n") + _("Automatic Export enabled:\n") +
_("Action after Timer Recording:")); _("Action after Timer Recording:");
strMsg += ProgressDialog::ColoumnSplitMarker; strMsg += ProgressDialog::ColoumnSplitMarker;
@ -1054,10 +1054,10 @@ ProgressResult TimerRecordDialog::PreActionDelay(int iActionIndex, TimerRecordCo
// Two column layout. Line spacing must match for both columns. // Two column layout. Line spacing must match for both columns.
// First column // First column
wxString strMsg = wxString::Format(_("Timer Recording completed.\n\n") + wxString strMsg = _("Timer Recording completed.\n\n") +
_("Recording Saved:\n") + _("Recording Saved:\n") +
_("Recording Exported:\n") + _("Recording Exported:\n") +
_("Action after Timer Recording:")); _("Action after Timer Recording:");
strMsg += ProgressDialog::ColoumnSplitMarker; strMsg += ProgressDialog::ColoumnSplitMarker;

View File

@ -811,7 +811,7 @@ void VoiceKey::CalibrateNoise(const WaveTrack & t, sampleCount start, sampleCoun
mDirectionChangesMean = sumdc / samples; mDirectionChangesMean = sumdc / samples;
mDirectionChangesSD =sqrt(sumdc2 / samples - mDirectionChangesMean * mDirectionChangesMean) ; mDirectionChangesSD =sqrt(sumdc2 / samples - mDirectionChangesMean * mDirectionChangesMean) ;
wxString text = wxString::Format(_("Calibration Results\n")); wxString text = _("Calibration Results\n");
/* i18n-hint: %1.4f is replaced by a number. sd stands for 'Standard Deviations'*/ /* i18n-hint: %1.4f is replaced by a number. sd stands for 'Standard Deviations'*/
text += wxString::Format(_("Energy -- mean: %1.4f sd: (%1.4f)\n"),mEnergyMean,mEnergySD); text += wxString::Format(_("Energy -- mean: %1.4f sd: (%1.4f)\n"),mEnergyMean,mEnergySD);
text+= wxString::Format(_("Sign Changes -- mean: %1.4f sd: (%1.4f)\n"),mSignChangesMean,mSignChangesSD); text+= wxString::Format(_("Sign Changes -- mean: %1.4f sd: (%1.4f)\n"),mSignChangesMean,mSignChangesSD);

View File

@ -685,7 +685,7 @@ void EffectAutoDuckPanel::OnPaint(wxPaintEvent & WXUNUSED(evt))
duckAmountDb < MIN_DuckAmountDb || duckAmountDb > MAX_DuckAmountDb) duckAmountDb < MIN_DuckAmountDb || duckAmountDb > MAX_DuckAmountDb)
{ {
// values are out of range, no preview available // values are out of range, no preview available
wxString message = wxString::Format(_("Preview not available")); wxString message = _("Preview not available");
int textWidth = 0, textHeight = 0; int textWidth = 0, textHeight = 0;
dc.GetTextExtent(message, &textWidth, &textHeight); dc.GetTextExtent(message, &textWidth, &textHeight);
dc.DrawText(message, (clientWidth - textWidth) / 2, dc.DrawText(message, (clientWidth - textWidth) / 2,

View File

@ -193,7 +193,7 @@ bool EffectClickRemoval::Process()
} }
if (bGoodResult && !mbDidSomething) // Processing successful, but ineffective. if (bGoodResult && !mbDidSomething) // Processing successful, but ineffective.
Effect::MessageBox( Effect::MessageBox(
wxString::Format(_("Algorithm not effective on this audio. Nothing changed.")), _("Algorithm not effective on this audio. Nothing changed."),
wxOK | wxICON_ERROR); wxOK | wxICON_ERROR);
this->ReplaceProcessedTracks(bGoodResult && mbDidSomething); this->ReplaceProcessedTracks(bGoodResult && mbDidSomething);

View File

@ -408,7 +408,7 @@ namespace {
return wxString::Format(_("%.2f dB RMS"), diffdB); return wxString::Format(_("%.2f dB RMS"), diffdB);
else else
/* i18n-hint: dB abbreviates decibels */ /* i18n-hint: dB abbreviates decibels */
return wxString::Format(_("Infinite dB difference")); return _("Infinite dB difference");
} }
} }
@ -463,27 +463,27 @@ void ContrastDialog::results()
if (mForegroundIsDefined) { if (mForegroundIsDefined) {
mForegroundRMSText->SetName(_("Measured foreground level")); // Read by screen-readers mForegroundRMSText->SetName(_("Measured foreground level")); // Read by screen-readers
if(std::isinf(- foregrounddB)) if(std::isinf(- foregrounddB))
mForegroundRMSText->ChangeValue(wxString::Format(_("zero"))); mForegroundRMSText->ChangeValue(_("zero"));
else else
mForegroundRMSText->ChangeValue(wxString::Format(_("%.2f dB"), foregrounddB)); // i18n-hint: short form of 'decibels' mForegroundRMSText->ChangeValue(wxString::Format(_("%.2f dB"), foregrounddB)); // i18n-hint: short form of 'decibels'
} }
else { else {
mForegroundRMSText->SetName(_("No foreground measured")); // Read by screen-readers mForegroundRMSText->SetName(_("No foreground measured")); // Read by screen-readers
mForegroundRMSText->ChangeValue(wxT("")); mForegroundRMSText->ChangeValue(wxT(""));
mPassFailText->ChangeValue(wxString::Format(_("Foreground not yet measured"))); mPassFailText->ChangeValue(_("Foreground not yet measured"));
} }
if (mBackgroundIsDefined) { if (mBackgroundIsDefined) {
mBackgroundRMSText->SetName(_("Measured background level")); mBackgroundRMSText->SetName(_("Measured background level"));
if(std::isinf(- backgrounddB)) if(std::isinf(- backgrounddB))
mBackgroundRMSText->ChangeValue(wxString::Format(_("zero"))); mBackgroundRMSText->ChangeValue(_("zero"));
else else
mBackgroundRMSText->ChangeValue(wxString::Format(_("%.2f dB"), backgrounddB)); mBackgroundRMSText->ChangeValue(wxString::Format(_("%.2f dB"), backgrounddB));
} }
else { else {
mBackgroundRMSText->SetName(_("No background measured")); mBackgroundRMSText->SetName(_("No background measured"));
mBackgroundRMSText->ChangeValue(wxT("")); mBackgroundRMSText->ChangeValue(wxT(""));
mPassFailText->ChangeValue(wxString::Format(_("Background not yet measured"))); mPassFailText->ChangeValue(_("Background not yet measured"));
} }
} }

View File

@ -288,7 +288,7 @@ bool ExportFFmpeg::Init(const char *shortname, AudacityProject *project, const T
mEncFormatCtx.reset(avformat_alloc_context()); mEncFormatCtx.reset(avformat_alloc_context());
if (!mEncFormatCtx) if (!mEncFormatCtx)
{ {
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - Can't allocate output format context.")), AudacityMessageBox(_("FFmpeg : ERROR - Can't allocate output format context."),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION); _("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION);
return false; return false;
} }
@ -546,8 +546,10 @@ bool ExportFFmpeg::InitCodecs(AudacityProject *project)
mEncAudioFifoOutBuf.reset(static_cast<int16_t*>(av_malloc(mEncAudioFifoOutBufSiz))); mEncAudioFifoOutBuf.reset(static_cast<int16_t*>(av_malloc(mEncAudioFifoOutBufSiz)));
if (!mEncAudioFifoOutBuf) if (!mEncAudioFifoOutBuf)
{ {
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - Can't allocate buffer to read into from audio FIFO.")), AudacityMessageBox(
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION); _("FFmpeg : ERROR - Can't allocate buffer to read into from audio FIFO."),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION
);
return false; return false;
} }
@ -576,22 +578,28 @@ static int encode_audio(AVCodecContext *avctx, AVPacket *pkt, int16_t *audio_sam
buffer_size = av_samples_get_buffer_size(NULL, avctx->channels, frame->nb_samples, buffer_size = av_samples_get_buffer_size(NULL, avctx->channels, frame->nb_samples,
avctx->sample_fmt, 0); avctx->sample_fmt, 0);
if (buffer_size < 0) { if (buffer_size < 0) {
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - Could not get sample buffer size")), AudacityMessageBox(
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION); _("FFmpeg : ERROR - Could not get sample buffer size"),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION
);
return buffer_size; return buffer_size;
} }
samples.reset(static_cast<uint8_t*>(av_malloc(buffer_size))); samples.reset(static_cast<uint8_t*>(av_malloc(buffer_size)));
if (!samples) { if (!samples) {
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - Could not allocate bytes for samples buffer")), AudacityMessageBox(
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION); _("FFmpeg : ERROR - Could not allocate bytes for samples buffer"),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION
);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
/* setup the data pointers in the AVFrame */ /* setup the data pointers in the AVFrame */
ret = avcodec_fill_audio_frame(frame.get(), avctx->channels, avctx->sample_fmt, ret = avcodec_fill_audio_frame(frame.get(), avctx->channels, avctx->sample_fmt,
samples.get(), buffer_size, 0); samples.get(), buffer_size, 0);
if (ret < 0) { if (ret < 0) {
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - Could not setup audio frame")), AudacityMessageBox(
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION); _("FFmpeg : ERROR - Could not setup audio frame"),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION
);
return ret; return ret;
} }
@ -638,8 +646,10 @@ static int encode_audio(AVCodecContext *avctx, AVPacket *pkt, int16_t *audio_sam
ret = avcodec_encode_audio2(avctx, pkt, frame.get(), &got_output); ret = avcodec_encode_audio2(avctx, pkt, frame.get(), &got_output);
if (ret < 0) { if (ret < 0) {
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - encoding frame failed")), AudacityMessageBox(
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION); _("FFmpeg : ERROR - encoding frame failed"),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION
);
return ret; return ret;
} }
@ -664,8 +674,10 @@ bool ExportFFmpeg::Finalize()
int nAudioFrameSizeOut = default_frame_size * mEncAudioCodecCtx->channels * sizeof(int16_t); int nAudioFrameSizeOut = default_frame_size * mEncAudioCodecCtx->channels * sizeof(int16_t);
if (nAudioFrameSizeOut > mEncAudioFifoOutBufSiz || nFifoBytes > mEncAudioFifoOutBufSiz) { if (nAudioFrameSizeOut > mEncAudioFifoOutBufSiz || nFifoBytes > mEncAudioFifoOutBufSiz) {
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - Too much remaining data.")), AudacityMessageBox(
_("FFmpeg Error"), wxOK | wxCENTER | wxICON_EXCLAMATION); _("FFmpeg : ERROR - Too much remaining data."),
_("FFmpeg Error"), wxOK | wxCENTER | wxICON_EXCLAMATION
);
return false; return false;
} }
@ -727,8 +739,10 @@ bool ExportFFmpeg::Finalize()
if (av_interleaved_write_frame(mEncFormatCtx.get(), &pkt) != 0) if (av_interleaved_write_frame(mEncFormatCtx.get(), &pkt) != 0)
{ {
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - Couldn't write last audio frame to output file.")), AudacityMessageBox(
_("FFmpeg Error"), wxOK | wxCENTER | wxICON_EXCLAMATION); _("FFmpeg : ERROR - Couldn't write last audio frame to output file."),
_("FFmpeg Error"), wxOK | wxCENTER | wxICON_EXCLAMATION
);
break; break;
} }
} }
@ -777,8 +791,10 @@ bool ExportFFmpeg::EncodeAudioFrame(int16_t *pFrame, size_t frameSize)
return false; return false;
if (nAudioFrameSizeOut > mEncAudioFifoOutBufSiz) { if (nAudioFrameSizeOut > mEncAudioFifoOutBufSiz) {
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - nAudioFrameSizeOut too large.")), AudacityMessageBox(
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION); _("FFmpeg : ERROR - nAudioFrameSizeOut too large."),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION
);
return false; return false;
} }
@ -795,8 +811,10 @@ bool ExportFFmpeg::EncodeAudioFrame(int16_t *pFrame, size_t frameSize)
default_frame_size); default_frame_size);
if (ret < 0) if (ret < 0)
{ {
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - Can't encode audio frame.")), AudacityMessageBox(
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION); _("FFmpeg : ERROR - Can't encode audio frame."),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION
);
return false; return false;
} }
if (ret == 0) if (ret == 0)
@ -814,8 +832,10 @@ bool ExportFFmpeg::EncodeAudioFrame(int16_t *pFrame, size_t frameSize)
// Write the encoded audio frame to the output file. // Write the encoded audio frame to the output file.
if ((ret = av_interleaved_write_frame(mEncFormatCtx.get(), &pkt)) < 0) if ((ret = av_interleaved_write_frame(mEncFormatCtx.get(), &pkt)) < 0)
{ {
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - Failed to write audio frame to file.")), AudacityMessageBox(
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION); _("FFmpeg : ERROR - Failed to write audio frame to file."),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION
);
return false; return false;
} }
} }

View File

@ -307,12 +307,12 @@ void ExportMultiple::PopulateOrExchange(ShuttleGui& S)
// Row 1 // Row 1
S.SetBorder(1); S.SetBorder(1);
mTrack = S.Id(TrackID) mTrack = S.Id(TrackID)
.AddRadioButton(wxString(_("Tracks"))); .AddRadioButton(_("Tracks"));
mTrack->SetName(_("Tracks")); mTrack->SetName(_("Tracks"));
// Row 2 // Row 2
S.SetBorder(1); S.SetBorder(1);
mLabel = S.Id(LabelID).AddRadioButtonToGroup(wxString(_("Labels"))); mLabel = S.Id(LabelID).AddRadioButtonToGroup(_("Labels"));
mLabel->SetName(_("Labels")); mLabel->SetName(_("Labels"));
S.SetBorder(3); S.SetBorder(3);

View File

@ -875,7 +875,7 @@ UIHandle::Result TimeShiftHandle::Release
wxString msg; wxString msg;
bool consolidate; bool consolidate;
if (mDidSlideVertically) { if (mDidSlideVertically) {
msg.Printf(_("Moved clips to another track")); msg = _("Moved clips to another track");
consolidate = false; consolidate = false;
} }
else { else {

View File

@ -2235,11 +2235,11 @@ wxAccStatus MeterAx::GetName(int WXUNUSED(childId), wxString* name)
// always retain the leading space. Therefore a space has // always retain the leading space. Therefore a space has
// been added to ensure at least one space, and stop // been added to ensure at least one space, and stop
// words from being merged // words from being merged
*name += wxT(" ") + wxString::Format(_(" Monitoring ")); *name += wxT(" ") + _(" Monitoring ");
} }
else if (m->mActive) else if (m->mActive)
{ {
*name += wxT(" ") + wxString::Format(_(" Active ")); *name += wxT(" ") + _(" Active ");
} }
float peak = 0.; float peak = 0.;
@ -2262,7 +2262,7 @@ wxAccStatus MeterAx::GetName(int WXUNUSED(childId), wxString* name)
if (clipped) if (clipped)
{ {
*name += wxT(" ") + wxString::Format(_(" Clipped ")); *name += wxT(" ") + _(" Clipped ");
} }
} }