1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-21 14:02:57 +02:00

Define and use ShuttleGui::Validator

This commit is contained in:
Paul Licameli
2017-10-30 12:23:41 -04:00
parent 8ea137e041
commit 1d32824e02
35 changed files with 567 additions and 460 deletions

View File

@@ -206,13 +206,13 @@ void EffectTimeScale::PopulateOrExchange(ShuttleGui & S)
{
S.StartMultiColumn(1, wxCENTER);
{
FloatingPointValidator<double>
vldRatePercentChangeStart(3, &m_RatePercentChangeStart, NumValidatorStyle::NO_TRAILING_ZEROES);
vldRatePercentChangeStart.SetRange(MIN_RatePercentStart, MAX_RatePercentStart);
m_pTextCtrl_RatePercentChangeStart = S.Id(ID_RatePercentChangeStart)
.Validator<FloatingPointValidator<double>>(
3, &m_RatePercentChangeStart,
NumValidatorStyle::NO_TRAILING_ZEROES,
MIN_RatePercentStart, MAX_RatePercentStart
)
.AddTextBox( {}, wxT(""), 12);
m_pTextCtrl_RatePercentChangeStart->SetValidator(vldRatePercentChangeStart);
}
S.EndMultiColumn();
S.StartHorizontalLay(wxEXPAND, 0);
@@ -229,13 +229,13 @@ void EffectTimeScale::PopulateOrExchange(ShuttleGui & S)
{
S.StartMultiColumn(1, wxCENTER);
{
FloatingPointValidator<double>
vldRatePercentChangeEnd(3, &m_RatePercentChangeEnd, NumValidatorStyle::NO_TRAILING_ZEROES);
vldRatePercentChangeEnd.SetRange(MIN_RatePercentEnd, MAX_RatePercentEnd);
m_pTextCtrl_RatePercentChangeEnd = S.Id(ID_RatePercentChangeEnd)
.Validator<FloatingPointValidator<double>>(
3, &m_RatePercentChangeEnd,
NumValidatorStyle::NO_TRAILING_ZEROES,
MIN_RatePercentEnd, MAX_RatePercentEnd
)
.AddTextBox( {}, wxT(""), 12);
m_pTextCtrl_RatePercentChangeEnd->SetValidator(vldRatePercentChangeEnd);
}
S.EndMultiColumn();
S.StartHorizontalLay(wxEXPAND, 0);
@@ -253,21 +253,22 @@ void EffectTimeScale::PopulateOrExchange(ShuttleGui & S)
{
S.StartMultiColumn(2, wxCENTER);
{
FloatingPointValidator<double>
vldPitchHalfStepsStart(3, &m_PitchHalfStepsStart, NumValidatorStyle::NO_TRAILING_ZEROES);
vldPitchHalfStepsStart.SetRange(MIN_HalfStepsStart, MAX_HalfStepsStart);
m_pTextCtrl_PitchHalfStepsStart = S.Id(ID_PitchHalfStepsStart)
.Validator<FloatingPointValidator<double>>(
3, &m_PitchHalfStepsStart,
NumValidatorStyle::NO_TRAILING_ZEROES,
MIN_HalfStepsStart, MAX_HalfStepsStart
)
.AddTextBox(_("(semitones) [-12 to 12]:"), wxT(""), 12);
m_pTextCtrl_PitchHalfStepsStart->SetValidator(vldPitchHalfStepsStart);
FloatingPointValidator<double>
vldPitchPercentChangeStart(3, &m_PitchPercentChangeStart, NumValidatorStyle::NO_TRAILING_ZEROES);
vldPitchPercentChangeStart.SetRange(MIN_PitchPercentStart, MAX_PitchPercentStart);
m_pTextCtrl_PitchPercentChangeStart = S.Id(ID_PitchPercentChangeStart)
.Validator<FloatingPointValidator<double>>(
3, &m_PitchPercentChangeStart,
NumValidatorStyle::NO_TRAILING_ZEROES,
MIN_PitchPercentStart, MAX_PitchPercentStart
)
.AddTextBox(_("(%) [-50 to 100]:"), wxT(""), 12);
m_pTextCtrl_PitchPercentChangeStart->SetValidator(vldPitchPercentChangeStart);
}
S.EndMultiColumn();
}
@@ -278,21 +279,20 @@ void EffectTimeScale::PopulateOrExchange(ShuttleGui & S)
{
S.StartMultiColumn(2, wxCENTER);
{
FloatingPointValidator<double>
vldPitchHalfStepsEnd(3, &m_PitchHalfStepsEnd, NumValidatorStyle::NO_TRAILING_ZEROES);
vldPitchHalfStepsEnd.SetRange(MIN_HalfStepsEnd, MAX_HalfStepsEnd);
m_pTextCtrl_PitchHalfStepsEnd = S.Id(ID_PitchHalfStepsEnd)
.Validator<FloatingPointValidator<double>>(
3, &m_PitchHalfStepsEnd,
NumValidatorStyle::NO_TRAILING_ZEROES,
MIN_HalfStepsEnd, MAX_HalfStepsEnd
)
.AddTextBox(_("(semitones) [-12 to 12]:"), wxT(""), 12);
m_pTextCtrl_PitchHalfStepsEnd->SetValidator(vldPitchHalfStepsEnd);
FloatingPointValidator<double>
vldPitchPercentChangeEnd(3, &m_PitchPercentChangeEnd, NumValidatorStyle::NO_TRAILING_ZEROES);
vldPitchPercentChangeEnd.SetRange(MIN_PitchPercentStart, MAX_PitchPercentStart);
m_pTextCtrl_PitchPercentChangeEnd = S.Id(ID_PitchPercentChangeEnd)
.Validator<FloatingPointValidator<double>>(
3, &m_PitchPercentChangeEnd,
NumValidatorStyle::NO_TRAILING_ZEROES,
MIN_PitchPercentStart, MAX_PitchPercentStart)
.AddTextBox(_("(%) [-50 to 100]:"), wxT(""), 12);
m_pTextCtrl_PitchPercentChangeEnd->SetValidator(vldPitchPercentChangeEnd);
}
S.EndMultiColumn();
}