void EchoDialog::PopulateOrExchange(ShuttleGui & S) { S.StartHorizontalLay(wxCENTER, false); { /* i18n-hint: && in here is an escape character to get a single & on * screen, so keep it as is */ S.AddTitle(_("by Dominic Mazzoni && Vaughan Johnson")); } S.EndHorizontalLay(); S.StartHorizontalLay(wxCENTER, false); { // Add a little space } S.EndHorizontalLay(); S.StartMultiColumn(2, wxALIGN_CENTER); { m_pTextCtrl_Delay = S.AddTextBox(_("Delay time (seconds):"), wxT("1.0"), 10); m_pTextCtrl_Delay->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); m_pTextCtrl_Decay = S.AddTextBox(_("Decay factor:"), wxT("0.5"), 10); m_pTextCtrl_Decay->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); } S.EndMultiColumn(); }
void PaulstretchDialog::PopulateOrExchange(ShuttleGui & S){ S.StartHorizontalLay(wxCENTER, false); { S.AddTitle(_("by Nasca Octavian Paul")); } S.EndHorizontalLay(); S.StartHorizontalLay(wxCENTER, false); S.EndHorizontalLay(); S.StartMultiColumn(2, wxALIGN_CENTER); { /* i18n-hint: This is how many times longer the sound will be, e.g. applying * the effect to a 1-second sample, with the default Stretch Factor of 10.0 * will give an (approximately) 10 second sound */ m_pTextCtrl_Amount = S.AddTextBox(_("Stretch Factor:"),wxT("10.0"),10); m_pTextCtrl_Amount->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); m_pTextCtrl_TimeResolution= S.AddTextBox(_("Time Resolution (seconds):"), wxT("0.25"),10); m_pTextCtrl_TimeResolution->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); } S.EndMultiColumn(); };
void MacroCommandDialog::PopulateOrExchange(ShuttleGui &S) { S.StartVerticalLay(true); { S.StartMultiColumn(4, wxEXPAND); { S.SetStretchyCol(1); mCommand = S.AddTextBox(_("&Command"), wxT(""), 20); mCommand->SetEditable(false); mEditParams = S.Id(EditParamsButtonID).AddButton(_("&Edit Parameters")); mEditParams->Enable(false); // disable button as box is empty mUsePreset = S.Id(UsePresetButtonID).AddButton(_("&Use Preset")); mUsePreset->Enable(false); // disable button as box is empty } S.EndMultiColumn(); S.StartMultiColumn(2, wxEXPAND); { S.SetStretchyCol(1); mParameters = S.AddTextBox(_("&Parameters"), wxT(""), 0); mParameters->SetEditable(false); wxString prompt{_("&Details")}; S.Prop(0).AddPrompt(prompt); mDetails = S.AddTextWindow( wxT("")); mDetails->SetEditable(false); mDetails->SetName(wxStripMenuCodes(prompt)); } S.EndMultiColumn(); S.Prop(10).StartStatic(_("Choose command"), true); { S.SetStyle(wxSUNKEN_BORDER | wxLC_LIST | wxLC_SINGLE_SEL); mChoices = S.Id(CommandsListID).AddListControl(); } S.EndStatic(); } S.EndVerticalLay(); S.AddStandardButtons( eOkButton | eCancelButton | eHelpButton); PopulateCommandList(); if (mChoices->GetItemCount() > 0) { // set first item to be selected (and the focus when the // list first becomes the focus) mChoices->SetItemState(0, wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED, wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED); } SetMinSize(wxSize(780, 560)); Fit(); Center(); }
void EffectEcho::PopulateOrExchange(ShuttleGui & S) { S.AddSpace(0, 5); S.StartMultiColumn(2, wxALIGN_CENTER); { FloatingPointValidator<double> vldDelay(3, &delay, NUM_VAL_NO_TRAILING_ZEROES); vldDelay.SetRange(MIN_Delay, MAX_Delay); S.AddTextBox(_("Delay time (seconds):"), wxT(""), 10)->SetValidator(vldDelay); FloatingPointValidator<double> vldDecay(3, &decay, NUM_VAL_NO_TRAILING_ZEROES); vldDecay.SetRange(MIN_Decay, MAX_Decay); S.AddTextBox(_("Decay factor:"), wxT(""), 10)->SetValidator(vldDecay); } S.EndMultiColumn(); }
void EffectNoise::PopulateOrExchange(ShuttleGui & S) { wxASSERT(nTypes == WXSIZEOF(kTypeStrings)); S.StartMultiColumn(2, wxCENTER); { auto typeChoices = LocalizedStrings(kTypeStrings, nTypes); S.AddChoice(_("Noise type:"), wxT(""), &typeChoices)->SetValidator(wxGenericValidator(&mType)); FloatingPointValidator<double> vldAmp(6, &mAmp, NumValidatorStyle::NO_TRAILING_ZEROES); vldAmp.SetRange(MIN_Amp, MAX_Amp); S.AddTextBox(_("Amplitude (0-1):"), wxT(""), 12)->SetValidator(vldAmp); S.AddPrompt(_("Duration:")); mNoiseDurationT = safenew NumericTextCtrl(S.GetParent(), wxID_ANY, NumericConverter::TIME, GetDurationFormat(), GetDuration(), mProjectRate, NumericTextCtrl::Options{} .AutoPos(true)); mNoiseDurationT->SetName(_("Duration")); S.AddWindow(mNoiseDurationT, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL); } S.EndMultiColumn(); }
void EffectNoise::PopulateOrExchange(ShuttleGui & S) { wxASSERT(kNumTypes == WXSIZEOF(kTypeStrings)); wxArrayString typeChoices; for (int i = 0; i < kNumTypes; i++) { typeChoices.Add(wxGetTranslation(kTypeStrings[i])); } S.StartMultiColumn(2, wxCENTER); { S.AddChoice(_("Noise type:"), wxT(""), &typeChoices)->SetValidator(wxGenericValidator(&mType)); FloatingPointValidator<double> vldAmp(6, &mAmp, NUM_VAL_NO_TRAILING_ZEROES); vldAmp.SetRange(MIN_Amp, MAX_Amp); S.AddTextBox(_("Amplitude (0-1):"), wxT(""), 12)->SetValidator(vldAmp); S.AddPrompt(_("Duration:")); mNoiseDurationT = new NumericTextCtrl(NumericConverter::TIME, S.GetParent(), wxID_ANY, GetDurationFormat(), GetDuration(), mProjectRate, wxDefaultPosition, wxDefaultSize, true); mNoiseDurationT->SetName(_("Duration")); mNoiseDurationT->EnableMenu(); S.AddWindow(mNoiseDurationT, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL); } S.EndMultiColumn(); }
void PopulateOrExchange(ShuttleGui & S) { wxString text; S.SetBorder(10); S.StartVerticalLay(true); { text.Printf(_("Audacity needs the file '%s' to import and export audio via FFmpeg."), mName.c_str()); S.AddTitle(text); S.SetBorder(3); S.StartHorizontalLay(wxALIGN_LEFT, true); { text.Printf(_("Location of '%s':"), mName.c_str()); S.AddTitle(text); } S.EndHorizontalLay(); S.StartMultiColumn(2, wxEXPAND); S.SetStretchyCol(0); { if (mLibPath.GetFullPath().IsEmpty()) { text.Printf(_("To find '%s', click here -->"), mName.c_str()); mPathText = S.AddTextBox(wxT(""), text, 0); } else { mPathText = S.AddTextBox(wxT(""), mLibPath.GetFullPath(), 0); } S.Id(ID_FFMPEG_BROWSE).AddButton(_("Browse..."), wxALIGN_RIGHT); S.AddVariableText(_("To get a free copy of FFmpeg, click here -->"), true); S.Id(ID_FFMPEG_DLOAD).AddButton(_("Download"), wxALIGN_RIGHT); } S.EndMultiColumn(); S.AddStandardButtons(); } S.EndVerticalLay(); Layout(); Fit(); SetMinSize(GetSize()); Center(); return; }
void EchoDialog::PopulateOrExchange(ShuttleGui & S) { S.AddSpace(0, 5); S.StartMultiColumn(2, wxALIGN_CENTER); { m_pTextCtrl_Delay = S.AddTextBox(_("Delay time (seconds):"), wxT("1.0"), 10); m_pTextCtrl_Delay->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); m_pTextCtrl_Decay = S.AddTextBox(_("Decay factor:"), wxT("0.5"), 10); m_pTextCtrl_Decay->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); } S.EndMultiColumn(); }
void EffectPaulstretch::PopulateOrExchange(ShuttleGui & S) { S.StartMultiColumn(2, wxALIGN_CENTER); { FloatingPointValidator<float> vldAmount(1, &mAmount); vldAmount.SetMin(MIN_Amount); /* i18n-hint: This is how many times longer the sound will be, e.g. applying * the effect to a 1-second sample, with the default Stretch Factor of 10.0 * will give an (approximately) 10 second sound */ S.AddTextBox(_("Stretch Factor:"), wxT(""), 10)->SetValidator(vldAmount); FloatingPointValidator<float> vldTime(3, &mTime_resolution, NumValidatorStyle::ONE_TRAILING_ZERO); vldTime.SetMin(MIN_Time); S.AddTextBox(_("Time Resolution (seconds):"), wxT(""), 10)->SetValidator(vldTime); } S.EndMultiColumn(); };
void BatchCommandDialog::PopulateOrExchange(ShuttleGui &S) { S.StartVerticalLay(true); { S.StartMultiColumn(3, wxEXPAND); { S.SetStretchyCol(1); mCommand = S.AddTextBox(_("&Command"), wxT(""), 20); mCommand->SetEditable(false); mEditParams = S.Id(EditParamsButtonID).AddButton(_("&Edit Parameters")); mEditParams->Enable( false ); // disable button as box is empty } S.EndMultiColumn(); S.StartMultiColumn(2, wxEXPAND); { S.SetStretchyCol(1); mParameters = S.AddTextBox(_("&Parameters"), wxT(""), 0); mParameters->SetEditable(false); } S.EndMultiColumn(); S.StartStatic(_("C&hoose command"), true); { S.SetStyle(wxSUNKEN_BORDER | wxLC_LIST | wxLC_SINGLE_SEL); mChoices = S.Id(CommandsListID).AddListControl(); } S.EndStatic(); } S.EndVerticalLay(); S.AddStandardButtons(); for(int i=0;i<99;i++) { mChoices->InsertItem( i, wxString::Format(wxT("Item%02i"),i)); } PopulateCommandList(); SetSize(350, 400); SetSizeHints(GetSize()); Center(); }
void EffectRepeat::PopulateOrExchange(ShuttleGui & S) { S.StartHorizontalLay(wxCENTER, false); { IntegerValidator<int> vldRepeatCount(&repeatCount); vldRepeatCount.SetRange(MIN_Count, 2147483647 / mProjectRate); mRepeatCount = S.AddTextBox(_("Number of repeats to add:"), wxT(""), 12); mRepeatCount->SetValidator(vldRepeatCount); } S.EndHorizontalLay(); 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.EndMultiColumn(); }
void EffectTruncSilence::PopulateOrExchange(ShuttleGui & S) { wxASSERT(kNumActions == WXSIZEOF(kActionStrings)); wxArrayString actionChoices; for (int i = 0; i < kNumActions; i++) { actionChoices.Add(wxGetTranslation(kActionStrings[i])); } S.AddSpace(0, 5); S.StartStatic(_("Detect Silence")); { S.StartMultiColumn(3, wxALIGN_CENTER_HORIZONTAL); { // Threshold mTruncDbChoice = S.AddChoice(_("Level:"), wxT(""), &mDbChoices); mTruncDbChoice->SetValidator(wxGenericValidator(&mTruncDbChoiceIndex)); S.SetSizeHints(-1, -1); S.AddSpace(0); // 'choices' already includes units. // Ignored silence FloatingPointValidator<double> vldDur(3, &mInitialAllowedSilence, NUM_VAL_NO_TRAILING_ZEROES); vldDur.SetRange(MIN_Minimum, MAX_Minimum); mInitialAllowedSilenceT = S.AddTextBox(_("Duration:"), wxT(""), 12); mInitialAllowedSilenceT->SetValidator(vldDur); S.AddUnits(wxT("seconds")); } S.EndMultiColumn(); } S.EndStatic(); S.StartStatic(_("Action")); { S.StartHorizontalLay(); { // Action choices mActionChoice = S.AddChoice(wxT(""), wxT(""), &actionChoices); mActionChoice->SetValidator(wxGenericValidator(&mActionIndex)); S.SetSizeHints(-1, -1); } S.EndHorizontalLay(); S.StartMultiColumn(3, wxALIGN_CENTER_HORIZONTAL); { // Truncation / Compression factor FloatingPointValidator<double> vldTrunc(3, &mTruncLongestAllowedSilence, NUM_VAL_NO_TRAILING_ZEROES); vldTrunc.SetRange(MIN_Truncate, MAX_Truncate); mTruncLongestAllowedSilenceT = S.AddTextBox(_("Truncate to:"), wxT(""), 12); mTruncLongestAllowedSilenceT->SetValidator(vldTrunc); S.AddUnits(wxT("seconds")); FloatingPointValidator<double> vldComp(3, &mSilenceCompressPercent, NUM_VAL_NO_TRAILING_ZEROES); vldComp.SetRange(MIN_Compress, MAX_Compress); mSilenceCompressPercentT = S.AddTextBox(_("Compress to:"), wxT(""), 12); mSilenceCompressPercentT->SetValidator(vldComp); S.AddUnits(wxT("percent")); } S.EndMultiColumn(); S.StartMultiColumn(2, wxALIGN_CENTER_HORIZONTAL); { mIndependent = S.AddCheckBox(_("Truncate tracks independently"), mbIndependent ? wxT("true") : wxT("false")); } S.EndMultiColumn(); } S.EndStatic(); UpdateUI(); }
void EffectAutoDuck::PopulateOrExchange(ShuttleGui & S) { S.SetBorder(5); S.StartVerticalLay(true); { S.AddSpace(0, 5); mPanel = safenew EffectAutoDuckPanel(S.GetParent(), this); S.AddWindow(mPanel); S.AddSpace(0, 5); S.StartMultiColumn(6, wxCENTER); { FloatingPointValidator<double> vldDuckAmountDb(1, &mDuckAmountDb, NUM_VAL_NO_TRAILING_ZEROES); vldDuckAmountDb.SetRange(MIN_DuckAmountDb, MAX_DuckAmountDb); mDuckAmountDbBox = S.AddTextBox(_("Duck amount:"), wxT(""), 10); mDuckAmountDbBox->SetValidator(vldDuckAmountDb); S.AddUnits(_("dB")); FloatingPointValidator<double> vldMaximumPause(2, &mMaximumPause, NUM_VAL_NO_TRAILING_ZEROES); vldMaximumPause.SetRange(MIN_MaximumPause, MAX_MaximumPause); mMaximumPauseBox = S.AddTextBox(_("Maximum pause:"), wxT(""), 10); mMaximumPauseBox->SetValidator(vldMaximumPause); S.AddUnits(_("seconds")); FloatingPointValidator<double> vldOuterFadeDownLen(2, &mOuterFadeDownLen, NUM_VAL_NO_TRAILING_ZEROES); vldOuterFadeDownLen.SetRange(MIN_OuterFadeDownLen, MAX_OuterFadeDownLen); mOuterFadeDownLenBox = S.AddTextBox(_("Outer fade down length:"), wxT(""), 10); mOuterFadeDownLenBox->SetValidator(vldOuterFadeDownLen); S.AddUnits(_("seconds")); FloatingPointValidator<double> vldOuterFadeUpLen(2, &mOuterFadeUpLen, NUM_VAL_NO_TRAILING_ZEROES); vldOuterFadeUpLen.SetRange(MIN_OuterFadeUpLen, MAX_OuterFadeUpLen); mOuterFadeUpLenBox = S.AddTextBox(_("Outer fade up length:"), wxT(""), 10); mOuterFadeUpLenBox->SetValidator(vldOuterFadeUpLen); S.AddUnits(_("seconds")); FloatingPointValidator<double> vldInnerFadeDownLen(2, &mInnerFadeDownLen, NUM_VAL_NO_TRAILING_ZEROES); vldInnerFadeDownLen.SetRange(MIN_InnerFadeDownLen, MAX_InnerFadeDownLen); mInnerFadeDownLenBox = S.AddTextBox(_("Inner fade down length:"), wxT(""), 10); mInnerFadeDownLenBox->SetValidator(vldInnerFadeDownLen); S.AddUnits(_("seconds")); FloatingPointValidator<double> vldInnerFadeUpLen(2, &mInnerFadeUpLen, NUM_VAL_NO_TRAILING_ZEROES); vldInnerFadeUpLen.SetRange(MIN_InnerFadeUpLen, MAX_InnerFadeUpLen); mInnerFadeUpLenBox = S.AddTextBox(_("Inner fade up length:"), wxT(""), 10); mInnerFadeUpLenBox->SetValidator(vldInnerFadeUpLen); S.AddUnits(_("seconds")); } S.EndMultiColumn(); S.StartMultiColumn(3, wxCENTER); { FloatingPointValidator<double> vldThresholdDb(2, &mThresholdDb, NUM_VAL_NO_TRAILING_ZEROES); vldThresholdDb.SetRange(MIN_ThresholdDb, MAX_ThresholdDb); mThresholdDbBox = S.AddTextBox(_("Threshold:"), wxT(""), 10); mThresholdDbBox->SetValidator(vldThresholdDb); S.AddUnits(_("dB")); } S.EndMultiColumn(); } S.EndVerticalLay(); return; }
void EffectToneGen::PopulateOrExchange(ShuttleGui & S) { wxTextCtrl *t; S.StartMultiColumn(2, wxCENTER); { wxChoice *c = S.AddChoice(_("Waveform:"), wxT(""), &mWaveforms); c->SetValidator(wxGenericValidator(&mWaveform)); if (mChirp) { S.AddFixedText(wxT("")); S.StartHorizontalLay(wxEXPAND); { S.StartHorizontalLay(wxLEFT, 50); { S.AddTitle(_("Start")); } S.EndHorizontalLay(); S.StartHorizontalLay(wxLEFT, 50); { S.AddTitle(_("End")); } S.EndHorizontalLay(); } S.EndHorizontalLay(); S.AddPrompt(_("Frequency (Hz):")); S.StartHorizontalLay(wxEXPAND); { S.StartHorizontalLay(wxLEFT, 50); { FloatingPointValidator<double> vldStartFreq(6, &mFrequency[0], NUM_VAL_NO_TRAILING_ZEROES); vldStartFreq.SetRange(MIN_StartFreq, GetActiveProject()->GetRate() / 2.0); t = S.AddTextBox(wxT(""), wxT(""), 12); t->SetName(_("Frequency Hertz Start")); t->SetValidator(vldStartFreq); } S.EndHorizontalLay(); S.StartHorizontalLay(wxLEFT, 50); { FloatingPointValidator<double> vldEndFreq(6, &mFrequency[1], NUM_VAL_NO_TRAILING_ZEROES); vldEndFreq.SetRange(MIN_EndFreq, GetActiveProject()->GetRate() / 2.0); t = S.AddTextBox(wxT(""), wxT(""), 12); t->SetName(_("Frequency Hertz End")); t->SetValidator(vldEndFreq); } S.EndHorizontalLay(); } S.EndHorizontalLay(); S.AddPrompt(_("Amplitude (Hz):")); S.StartHorizontalLay(wxEXPAND); { S.StartHorizontalLay(wxLEFT, 50); { FloatingPointValidator<double> vldStartAmp(6, &mAmplitude[0], NUM_VAL_NO_TRAILING_ZEROES); vldStartAmp.SetRange(MIN_StartAmp, MAX_StartAmp); t = S.AddTextBox(wxT(""), wxT(""), 12); t->SetName(_("Amplitude Start")); t->SetValidator(vldStartAmp); } S.EndHorizontalLay(); S.StartHorizontalLay(wxLEFT, 50); { FloatingPointValidator<double> vldEndAmp(6, &mAmplitude[1], NUM_VAL_NO_TRAILING_ZEROES); vldEndAmp.SetRange(MIN_EndAmp, MAX_EndAmp); t = S.AddTextBox(wxT(""), wxT(""), 12); t->SetName(_("Amplitude End")); t->SetValidator(vldEndAmp); } S.EndHorizontalLay(); } S.EndHorizontalLay(); c = S.AddChoice(_("Interpolation:"), wxT(""), &mInterpolations); c->SetValidator(wxGenericValidator(&mInterpolation)); } else { FloatingPointValidator<double> vldFrequency(6, &mFrequency[0], NUM_VAL_NO_TRAILING_ZEROES); vldFrequency.SetRange(MIN_Frequency, GetActiveProject()->GetRate() / 2.0); t = S.AddTextBox(_("Frequency (Hz):"), wxT(""), 12); t->SetValidator(vldFrequency); FloatingPointValidator<double> vldAmplitude(6, &mAmplitude[0], NUM_VAL_NO_TRAILING_ZEROES); vldAmplitude.SetRange(MIN_Amplitude, MAX_Amplitude); t = S.AddTextBox(_("Amplitude (0-1):"), wxT(""), 12); t->SetValidator(vldAmplitude); } bool isSelection; double duration = GetDuration(&isSelection); S.AddPrompt(_("Duration:")); mToneDurationT = new NumericTextCtrl(NumericConverter::TIME, S.GetParent(), wxID_ANY, isSelection ? _("hh:mm:ss + samples") : _("hh:mm:ss + milliseconds"), duration, mProjectRate, wxDefaultPosition, wxDefaultSize, true); mToneDurationT->SetName(_("Duration")); mToneDurationT->EnableMenu(); S.AddWindow(mToneDurationT, wxALIGN_LEFT | wxALL); } S.EndMultiColumn(); return; }
void VampEffect::PopulateOrExchange(ShuttleGui & S) { Vamp::Plugin::ProgramList programs = mPlugin->getPrograms(); mParameters = mPlugin->getParameterDescriptors(); auto count = mParameters.size(); mToggles.reinit( count ); mSliders.reinit( count ); mFields.reinit( count ); mLabels.reinit( count ); mChoices.reinit( count ); mValues.reinit( count ); S.SetStyle(wxVSCROLL | wxTAB_TRAVERSAL); wxScrolledWindow *scroller = S.StartScroller(2); { S.StartStatic(_("Plugin Settings")); { S.StartMultiColumn(5, wxEXPAND); { S.SetStretchyCol(3); if (!programs.empty()) { wxString currentProgram = wxString::FromUTF8(mPlugin->getCurrentProgram().c_str()); wxArrayStringEx choices; for (size_t i = 0, cnt = programs.size(); i < cnt; i++) { choices.push_back(wxString::FromUTF8(programs[i].c_str())); } S.AddPrompt(_("Program")); S.Id(ID_Program); mProgram = S.AddChoice( {}, choices, choices.Index( currentProgram ) ); mProgram->SetName(_("Program")); mProgram->SetSizeHints(-1, -1); wxSizer *s = mProgram->GetContainingSizer(); s->GetItem(mProgram)->SetFlag(wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL); S.AddSpace(1, 1); S.AddSpace(1, 1); S.AddSpace(1, 1); } for (size_t p = 0; p < count; p++) { wxString tip = wxString::FromUTF8(mParameters[p].description.c_str()); wxString unit = wxString::FromUTF8(mParameters[p].unit.c_str()); float value = mPlugin->getParameter(mParameters[p].identifier); mToggles[p] = NULL; mChoices[p] = NULL; mSliders[p] = NULL; mFields[p] = NULL; mValues[p] = 0.0; wxString labelText = wxString::FromUTF8(mParameters[p].name.c_str()); if (!unit.empty()) { labelText += wxT(" (") + unit + wxT(")"); } S.AddPrompt(labelText + wxT(":")); if (mParameters[p].isQuantized && mParameters[p].quantizeStep == 1.0 && mParameters[p].minValue == 0.0 && mParameters[p].maxValue == 1.0) { S.Id(ID_Toggles + p); mToggles[p] = S.AddCheckBox( {}, value > 0.5); mToggles[p]->SetName(labelText); if (!tip.empty()) { mToggles[p]->SetToolTip(tip); } wxSizer *s = mToggles[p]->GetContainingSizer(); s->GetItem(mToggles[p])->SetFlag(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL); S.AddSpace(1, 1); S.AddSpace(1, 1); S.AddSpace(1, 1); } else if (mParameters[p].isQuantized && mParameters[p].quantizeStep == 1.0 && !mParameters[p].valueNames.empty()) { wxArrayStringEx choices; int selected = -1; for (size_t i = 0, cnt = mParameters[p].valueNames.size(); i < cnt; i++) { wxString choice = wxString::FromUTF8(mParameters[p].valueNames[i].c_str()); if (size_t(value - mParameters[p].minValue + 0.5) == i) { selected = i; } choices.push_back(choice); } S.Id(ID_Choices + p); mChoices[p] = S.AddChoice( {}, choices, selected ); mChoices[p]->SetName(labelText); mChoices[p]->SetSizeHints(-1, -1); if (!tip.empty()) { mChoices[p]->SetToolTip(tip); } wxSizer *s = mChoices[p]->GetContainingSizer(); s->GetItem(mChoices[p])->SetFlag(wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL); S.AddSpace(1, 1); S.AddSpace(1, 1); S.AddSpace(1, 1); } else { mValues[p] = value; FloatingPointValidator<float> vld(6, &mValues[p]); vld.SetRange(mParameters[p].minValue, mParameters[p].maxValue); float range = mParameters[p].maxValue - mParameters[p].minValue; auto style = range < 10 ? NumValidatorStyle::THREE_TRAILING_ZEROES : range < 100 ? NumValidatorStyle::TWO_TRAILING_ZEROES : NumValidatorStyle::ONE_TRAILING_ZERO; vld.SetStyle(style); S.Id(ID_Texts + p); mFields[p] = S.AddTextBox( {}, wxT(""), 12); mFields[p]->SetName(labelText); mFields[p]->SetValidator(vld); if (!tip.empty()) { mFields[p]->SetToolTip(tip); } wxSizer *s = mFields[p]->GetContainingSizer(); s->GetItem(mFields[p])->SetFlag(wxALIGN_CENTER_VERTICAL | wxALL); wxString str = Internat::ToDisplayString(mParameters[p].minValue); S.AddPrompt(str); S.SetStyle(wxSL_HORIZONTAL); S.Id(ID_Sliders + p); mSliders[p] = S.AddSlider( {}, 0, 1000, 0); mSliders[p]->SetName(labelText); mSliders[p]->SetSizeHints(150, -1); if (!tip.empty()) { mSliders[p]->SetToolTip(tip); } str = Internat::ToDisplayString(mParameters[p].maxValue); S.AddUnits(str); } } } S.EndMultiColumn(); } S.EndStatic(); } S.EndScroller(); scroller->SetScrollRate(0, 20); return; }
void EffectTruncSilence::PopulateOrExchange(ShuttleGui & S) { wxASSERT(nActions == WXSIZEOF(kActionStrings)); S.AddSpace(0, 5); S.StartStatic(_("Detect Silence")); { S.StartMultiColumn(3, wxALIGN_CENTER_HORIZONTAL); { // Threshold FloatingPointValidator<double> vldThreshold(3, &mThresholdDB, NumValidatorStyle::NO_TRAILING_ZEROES); vldThreshold.SetRange(MIN_Threshold, MAX_Threshold); mThresholdText = S.AddTextBox(_("Threshold:"), wxT(""), 0); mThresholdText->SetValidator(vldThreshold); S.AddUnits(_("dB")); // Ignored silence FloatingPointValidator<double> vldDur(3, &mInitialAllowedSilence, NumValidatorStyle::NO_TRAILING_ZEROES); vldDur.SetRange(MIN_Minimum, MAX_Minimum); mInitialAllowedSilenceT = S.AddTextBox(_("Duration:"), wxT(""), 12); mInitialAllowedSilenceT->SetValidator(vldDur); S.AddUnits(_("seconds")); } S.EndMultiColumn(); } S.EndStatic(); S.StartStatic(_("Action")); { S.StartHorizontalLay(); { // Action choices auto actionChoices = LocalizedStrings(kActionStrings, nActions); mActionChoice = S.AddChoice( {}, wxT(""), &actionChoices); mActionChoice->SetValidator(wxGenericValidator(&mActionIndex)); S.SetSizeHints(-1, -1); } S.EndHorizontalLay(); S.StartMultiColumn(3, wxALIGN_CENTER_HORIZONTAL); { // Truncation / Compression factor FloatingPointValidator<double> vldTrunc(3, &mTruncLongestAllowedSilence, NumValidatorStyle::NO_TRAILING_ZEROES); vldTrunc.SetRange(MIN_Truncate, MAX_Truncate); mTruncLongestAllowedSilenceT = S.AddTextBox(_("Truncate to:"), wxT(""), 12); mTruncLongestAllowedSilenceT->SetValidator(vldTrunc); S.AddUnits(_("seconds")); FloatingPointValidator<double> vldComp(3, &mSilenceCompressPercent, NumValidatorStyle::NO_TRAILING_ZEROES); vldComp.SetRange(MIN_Compress, MAX_Compress); mSilenceCompressPercentT = S.AddTextBox(_("Compress to:"), wxT(""), 12); mSilenceCompressPercentT->SetValidator(vldComp); S.AddUnits(_("%")); } S.EndMultiColumn(); S.StartMultiColumn(2, wxALIGN_CENTER_HORIZONTAL); { mIndependent = S.AddCheckBox(_("Truncate tracks independently"), mbIndependent ? wxT("true") : wxT("false")); } S.EndMultiColumn(); } S.EndStatic(); UpdateUI(); }