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

David Bailes patch for bug 591

This commit is contained in:
v.audacity 2012-10-11 01:45:33 +00:00
parent a30cc8930e
commit 3cb679ccd8
4 changed files with 21 additions and 17 deletions

View File

@ -2659,11 +2659,10 @@ void AudacityProject::OnSetLeftSelection()
} }
else else
{ {
TimeDialog dlg(this, _("Set Left Selection Boundary"), _("Position"));
wxString fmt = gPrefs->Read(wxT("/SelectionFormat"), wxT("")); wxString fmt = gPrefs->Read(wxT("/SelectionFormat"), wxT(""));
dlg.SetFormatString(fmt); TimeDialog dlg(this, _("Set Left Selection Boundary"),
dlg.SetSampleRate(mRate); fmt, mRate, mViewInfo.sel0, _("Position"));
dlg.SetTimeValue(mViewInfo.sel0);
if (wxID_OK == dlg.ShowModal()) if (wxID_OK == dlg.ShowModal())
{ {
//Get the value from the dialog //Get the value from the dialog
@ -2702,11 +2701,10 @@ void AudacityProject::OnSetRightSelection()
} }
else else
{ {
TimeDialog dlg(this, _("Set Right Selection Boundary"), _("Position"));
wxString fmt = gPrefs->Read(wxT("/SelectionFormat"), wxT("")); wxString fmt = gPrefs->Read(wxT("/SelectionFormat"), wxT(""));
dlg.SetFormatString(fmt); TimeDialog dlg(this, _("Set Right Selection Boundary"),
dlg.SetSampleRate(mRate); fmt, mRate, mViewInfo.sel1, _("Position"));
dlg.SetTimeValue(mViewInfo.sel1);
if (wxID_OK == dlg.ShowModal()) if (wxID_OK == dlg.ShowModal())
{ {
//Get the value from the dialog //Get the value from the dialog

View File

@ -30,12 +30,15 @@ END_EVENT_TABLE()
TimeDialog::TimeDialog(wxWindow *parent, TimeDialog::TimeDialog(wxWindow *parent,
const wxString &title, const wxString &title,
const wxString &format,
double rate,
double time,
const wxString &prompt) const wxString &prompt)
: wxDialog(parent, wxID_ANY, title), : wxDialog(parent, wxID_ANY, title),
mFormat(format),
mRate(rate),
mTime(time),
mPrompt(prompt), mPrompt(prompt),
mFormat(wxT("seconds")),
mRate(44100),
mTime(0.0),
mTimeCtrl(NULL) mTimeCtrl(NULL)
{ {
ShuttleGui S(this, eIsCreating); ShuttleGui S(this, eIsCreating);

View File

@ -26,6 +26,9 @@ class TimeDialog:public wxDialog
TimeDialog(wxWindow *parent, TimeDialog(wxWindow *parent,
const wxString &title, const wxString &title,
const wxString &format,
double rate,
double time,
const wxString &prompt = _("Duration")); const wxString &prompt = _("Duration"));
void SetFormatString(wxString formatString); void SetFormatString(wxString formatString);

View File

@ -30,20 +30,20 @@
bool EffectSilence::PromptUser() bool EffectSilence::PromptUser()
{ {
TimeDialog dlog(mParent, _("Silence Generator")); wxString fmt;
dlog.SetSampleRate(mProjectRate);
if (mT1 > mT0) { if (mT1 > mT0) {
// there is a selection: let's fit in there... // there is a selection: let's fit in there...
mDuration = mT1 - mT0; mDuration = mT1 - mT0;
dlog.SetFormatString(_("hh:mm:ss + samples")); fmt = _("hh:mm:ss + samples");
} else { } else {
// Retrieve last used values // Retrieve last used values
gPrefs->Read(wxT("/Effects/SilenceGen/Duration"), &mDuration, 30L); gPrefs->Read(wxT("/Effects/SilenceGen/Duration"), &mDuration, 30L);
dlog.SetFormatString(_("hh:mm:ss + milliseconds")); fmt = _("hh:mm:ss + milliseconds");
} }
dlog.SetTimeValue(mDuration);
TimeDialog dlog(mParent, _("Silence Generator"), fmt, mProjectRate,
mDuration );
if (dlog.ShowModal() == wxID_CANCEL) if (dlog.ShowModal() == wxID_CANCEL)
return false; return false;