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

View File

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

View File

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

View File

@ -30,20 +30,20 @@
bool EffectSilence::PromptUser()
{
TimeDialog dlog(mParent, _("Silence Generator"));
dlog.SetSampleRate(mProjectRate);
wxString fmt;
if (mT1 > mT0) {
// there is a selection: let's fit in there...
mDuration = mT1 - mT0;
dlog.SetFormatString(_("hh:mm:ss + samples"));
fmt = _("hh:mm:ss + samples");
} else {
// Retrieve last used values
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)
return false;