1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-25 08:38:39 +02:00

More complete fix for bug 1060 issues

This commit is contained in:
Steve Daulton 2015-07-18 18:31:36 +01:00
parent c43936f630
commit 78d0347be2
4 changed files with 34 additions and 16 deletions

View File

@ -724,6 +724,11 @@ wxString Effect::GetDurationFormat()
return mDurationFormat;
}
wxString Effect::GetSelectionFormat()
{
return GetActiveProject()->GetSelectionFormat();
}
void Effect::SetDuration(double seconds)
{
if (seconds < 0.0)

View File

@ -146,6 +146,7 @@ class AUDACITY_DLL_API Effect : public wxEvtHandler,
virtual double GetDefaultDuration();
virtual double GetDuration();
virtual wxString GetDurationFormat();
virtual wxString GetSelectionFormat(); // time format in Selection toolbar
virtual void SetDuration(double duration);
virtual bool Apply();

View File

@ -38,7 +38,7 @@
// Define keys, defaults, minimums, and maximums for the effect parameters
//
// Name Type Key Def Min Max Scale
Param( Count, int, XO("Count"), 10, 1, INT_MAX, 1 );
Param( Count, int, XO("Count"), 1, 1, INT_MAX, 1 );
BEGIN_EVENT_TABLE(EffectRepeat, wxEvtHandler)
EVT_TEXT(wxID_ANY, EffectRepeat::OnRepeatTextChange)
@ -46,7 +46,7 @@ END_EVENT_TABLE()
EffectRepeat::EffectRepeat()
{
repeatCount = 10;
repeatCount = DEF_Count;
SetLinearEffectFlag(true);
}
@ -175,16 +175,17 @@ void EffectRepeat::PopulateOrExchange(ShuttleGui & S)
{
IntegerValidator<int> vldRepeatCount(&repeatCount);
vldRepeatCount.SetRange(MIN_Count, 2147483647 / mProjectRate);
mRepeatCount = S.AddTextBox(_("Number of times to repeat:"), wxT(""), 12);
mRepeatCount = S.AddTextBox(_("Number of repeats to add:"), wxT(""), 12);
mRepeatCount->SetValidator(vldRepeatCount);
}
S.EndHorizontalLay();
S.StartHorizontalLay(wxCENTER, true);
S.StartMultiColumn(1, wxCENTER);
{
mCurrentTime = S.AddVariableText(_("Current selection length: dd:hh:mm:ss"));
mTotalTime = S.AddVariableText(_("New selection length: dd:hh:mm:ss"));
}
S.EndHorizontalLay();
S.EndMultiColumn();
}
bool EffectRepeat::TransferDataToWindow()
@ -215,22 +216,32 @@ bool EffectRepeat::TransferDataFromWindow()
void EffectRepeat::DisplayNewTime()
{
long l;
wxString str;
mRepeatCount->GetValue().ToLong(&l);
if (l > 0)
{
NumericConverter nc(NumericConverter::TIME,
GetSelectionFormat(),
mT1 - mT0,
mProjectRate);
str = _("Current selection length: ") + nc.GetString();
mCurrentTime->SetLabel(str);
mCurrentTime->SetName(str); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
if (l > 0) {
EnableApply(true);
repeatCount = l;
NumericConverter nc(NumericConverter::TIME,
_("hh:mm:ss"),
(mT1 - mT0) * (repeatCount + 1),
mProjectRate);
wxString str = _("New selection length: ") + nc.GetString();
mTotalTime->SetLabel(str);
mTotalTime->SetName(str); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
nc.SetValue((mT1 - mT0) * (repeatCount + 1));
str = _("New selection length: ") + nc.GetString();
}
else {
str = _("Warning: No repeats.");
EnableApply(false);
}
mTotalTime->SetLabel(str);
mTotalTime->SetName(str); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
}
void EffectRepeat::OnRepeatTextChange(wxCommandEvent & WXUNUSED(evt))

View File

@ -59,6 +59,7 @@ private:
int repeatCount;
wxTextCtrl *mRepeatCount;
wxStaticText *mCurrentTime;
wxStaticText *mTotalTime;
DECLARE_EVENT_TABLE();