Rename ShuttleGui::SetSizeHints, chain-call it like other methods...

... And rewrite some other existing calls to SetMinSize
This commit is contained in:
Paul Licameli 2018-01-31 15:31:22 -05:00
parent 64a96e6f01
commit b5ee7676fd
27 changed files with 120 additions and 94 deletions

View File

@ -216,8 +216,8 @@ void BenchmarkDialog::MakeBenchmarkDialog()
mText = S.Id(StaticTextID)
/* i18n-hint noun */
.Name(XO("Output"))
.MinSize( { 500, 200 } )
.AddTextWindow(wxT(""));
mText->SetSizeHints(wxSize(500,200));
//
S.SetBorder(10);

View File

@ -310,9 +310,9 @@ FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id,
S.EndVerticalLay();
mFreqPlot = safenew FreqPlot(this, wxID_ANY);
mFreqPlot->SetMinSize(wxSize(wxDefaultCoord, FREQ_WINDOW_HEIGHT));
S.Prop(1);
S.AddWindow(mFreqPlot, wxEXPAND);
S.Prop(1)
.MinSize( { wxDefaultCoord, FREQ_WINDOW_HEIGHT } )
.AddWindow(mFreqPlot, wxEXPAND);
S.StartHorizontalLay(wxEXPAND, 0);
{
@ -448,14 +448,14 @@ FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id,
S.AddSpace(5);
mAlgChoice = S.Id(FreqAlgChoiceID).Focus()
.MinSize( { wxDefaultCoord, wxDefaultCoord } )
.AddChoice(_("&Algorithm:"), algChoices, mAlg);
S.SetSizeHints(wxDefaultCoord, wxDefaultCoord);
S.AddSpace(5);
mSizeChoice = S.Id(FreqSizeChoiceID)
.MinSize( { wxDefaultCoord, wxDefaultCoord } )
.AddChoice(_("&Size:"), sizeChoices, mSize);
S.SetSizeHints(wxDefaultCoord, wxDefaultCoord);
S.AddSpace(5);
@ -471,15 +471,15 @@ FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id,
S.AddSpace(5);
mFuncChoice = S.Id(FreqFuncChoiceID)
.MinSize( { wxDefaultCoord, wxDefaultCoord } )
.AddChoice(_("&Function:"), funcChoices, mFunc);
S.SetSizeHints(wxDefaultCoord, wxDefaultCoord);
mFuncChoice->MoveAfterInTabOrder(mSizeChoice);
S.AddSpace(5);
mAxisChoice = S.Id(FreqAxisChoiceID)
.MinSize( { wxDefaultCoord, wxDefaultCoord } )
.AddChoice(_("&Axis:"), axisChoices, mAxis);
S.SetSizeHints(wxDefaultCoord, wxDefaultCoord);
mAxisChoice->MoveAfterInTabOrder(mFuncChoice);
S.AddSpace(5);

View File

@ -84,6 +84,7 @@ HistoryWindow::HistoryWindow(AudacityProject *parent, UndoManager *manager):
S.StartStatic(_("&Manage History"), 1);
{
mList = S
.MinSize()
.AddListControlReportMode(
{ { _("Action"), wxLIST_FORMAT_LEFT, 260 },
{ _("Reclaimable Space"), wxLIST_FORMAT_LEFT, 125 } },
@ -139,7 +140,6 @@ HistoryWindow::HistoryWindow(AudacityProject *parent, UndoManager *manager):
S.EndVerticalLay();
// ----------------------- End of main section --------------
mList->SetMinSize(mList->GetSize());
Fit();
SetMinSize(GetSize());
mList->SetColumnWidth(0, mList->GetClientSize().x - mList->GetColumnWidth(1));

View File

@ -184,14 +184,6 @@ void ShuttleGuiBase::ResetId()
miIdNext = 3000;
}
/// Used to modify an already placed Window.
void ShuttleGuiBase::SetSizeHints( int minX, int minY )
{
if( mShuttleMode != eIsCreating )
return;
mpLastWind->SetSizeHints( minX, minY );
}
/// Used to modify an already placed FlexGridSizer to make a column stretchy.
void ShuttleGuiBase::SetStretchyCol( int i )
@ -1460,6 +1452,7 @@ wxChoice * ShuttleGuiBase::DoTieChoice(
}
else
pChoice = AddChoice( Prompt, choices, WrappedRef.ReadAsInt() );
ShuttleGui::SetMinSize(pChoice, choices);
}
break;
// IF setting internal storage from the controls.
@ -1497,7 +1490,6 @@ wxChoice * ShuttleGuiBase::DoTieChoice(
wxASSERT( false );
break;
}
SetSizeHints(choices);
return pChoice;
}
@ -2086,6 +2078,11 @@ void ShuttleGuiBase::UpdateSizersCore(bool bPrepend, int Flags, bool prompt)
for (auto &pair : mItem.mRootConnections)
mpWind->Connect( pair.first, pair.second, nullptr, mpDlg );
if( mItem.mUseBestSize )
mpWind->SetMinSize( mpWind->GetBestSize() );
else if( mItem.mHasMinSize )
mpWind->SetMinSize( mItem.mMinSize );
// Reset to defaults
mItem = {};
}
@ -2107,7 +2104,7 @@ void ShuttleGuiBase::UpdateSizersCore(bool bPrepend, int Flags, bool prompt)
mpSizer = pSubSizer;
PushSizer();
}
mpLastWind = mpWind;
mpWind = NULL;
miProp = 0;
miSizerProp =0;
@ -2398,7 +2395,7 @@ wxSizerItem * ShuttleGui::AddSpace( int width, int height )
return mpSizer->Add( width, height, miProp);
}
void ShuttleGuiBase::SetSizeHints( wxWindow *window, const wxArrayStringEx & items )
void ShuttleGui::SetMinSize( wxWindow *window, const wxArrayStringEx & items )
{
int maxw = 0;
@ -2429,10 +2426,16 @@ void ShuttleGuiBase::SetSizeHints( wxWindow *window, const wxArrayStringEx & ite
window->SetMinSize( { maxw, -1 } );
}
void ShuttleGuiBase::SetSizeHints( const wxArrayStringEx & items )
/*
void ShuttleGui::SetMinSize( wxWindow *window, const std::vector<int> & items )
{
if( mShuttleMode != eIsCreating )
return;
wxArrayStringEx strs;
SetSizeHints( mpLastWind, items );
for( size_t i = 0; i < items.size(); i++ )
{
strs.Add( wxString::Format( wxT("%d"), items[i] ) );
}
SetMinSize( window, strs );
}
*/

View File

@ -203,6 +203,18 @@ struct Item {
return std::move( *this );
}
Item&& MinSize() && // set best size as min size
{
mUseBestSize = true;
return std::move ( *this );
}
Item&& MinSize( wxSize sz ) &&
{
mMinSize = sz; mHasMinSize = true;
return std::move ( *this );
}
std::function< void(wxWindow*) > mValidatorSetter;
TranslatableString mToolTip;
TranslatableString mName;
@ -212,8 +224,13 @@ struct Item {
long miStyle{};
wxSize mMinSize{ -1, -1 };
bool mHasMinSize{ false };
bool mUseBestSize{ false };
bool mFocused { false };
bool mDisabled { false };
};
}
@ -419,7 +436,6 @@ public:
const int max,
const int min);
//-- End of variants.
void SetSizeHints( int minX, int minY );
void SetBorder( int Border ) {miBorder = Border;};
void SetSizerProportion( int iProp ) {miSizerProp = iProp;};
void SetStretchyCol( int i );
@ -451,18 +467,12 @@ protected:
long GetStyle( long Style );
private:
void SetSizeHints( const wxArrayStringEx & items );
void DoInsertListColumns(
wxListCtrl *pListCtrl,
long listControlStyles,
std::initializer_list<const ListControlColumn> columns );
public:
static void SetSizeHints( wxWindow *window, const wxArrayStringEx & items );
protected:
wxWindow * mpLastWind;
wxWindow *const mpDlg;
wxSizer * pSizerStack[ nMaxNestedSizers ];
@ -647,6 +657,11 @@ public:
return *this;
}
ShuttleGui &MinSize() // set best size as min size
{ std::move( mItem ).MinSize(); return *this; }
ShuttleGui &MinSize( wxSize sz )
{ std::move( mItem ).MinSize( sz ); return *this; }
GuiWaveTrack * AddGuiWaveTrack( const wxString & Name);
AttachableScrollBar * AddAttachableScrollBar( long style = wxSB_HORIZONTAL );
@ -658,6 +673,11 @@ public:
wxSizerItem * AddSpace( int width, int height );
wxSizerItem * AddSpace( int size ) { return AddSpace( size, size ); };
// Calculate width of a choice control adequate for the items, maybe after
// the dialog is created but the items change.
static void SetMinSize( wxWindow *window, const wxArrayStringEx & items );
// static void SetMinSize( wxWindow *window, const std::vector<int> & items );
teShuttleMode GetMode() { return mShuttleMode; };
};

View File

@ -278,24 +278,24 @@ void EffectChangePitch::PopulateOrExchange(ShuttleGui & S)
m_pChoice_FromPitch = S.Id(ID_FromPitch)
/* i18n-hint: changing a quantity "from" one value "to" another */
.Name(XO("from"))
.MinSize( { 80, -1 } )
.AddChoice(_("from"), pitch);
m_pChoice_FromPitch->SetSizeHints(80, -1);
m_pSpin_FromOctave = S.Id(ID_FromOctave)
.Name(XO("from Octave"))
.MinSize( { 50, -1 } )
.AddSpinCtrl( {}, m_nFromOctave, INT_MAX, INT_MIN);
m_pSpin_FromOctave->SetSizeHints(50, -1);
m_pChoice_ToPitch = S.Id(ID_ToPitch)
/* i18n-hint: changing a quantity "from" one value "to" another */
.Name(XO("to"))
.MinSize( { 80, -1 } )
.AddChoice(_("to"), pitch);
m_pChoice_ToPitch->SetSizeHints(80, -1);
m_pSpin_ToOctave = S.Id(ID_ToOctave)
.Name(XO("to Octave"))
.MinSize( { 50, -1 } )
.AddSpinCtrl( {}, m_nToOctave, INT_MAX, INT_MIN);
m_pSpin_ToOctave->SetSizeHints(50, -1);
}
S.EndMultiColumn();

View File

@ -349,15 +349,15 @@ void EffectChangeSpeed::PopulateOrExchange(ShuttleGui & S)
mpChoice_FromVinyl = S.Id(ID_FromVinyl)
.Name(XO("From rpm"))
.MinSize( { 100, -1 } )
/* i18n-hint: changing a quantity "from" one value "to" another */
.AddChoice(_("from"), vinylChoices);
mpChoice_FromVinyl->SetSizeHints(100, -1);
mpChoice_ToVinyl = S.Id(ID_ToVinyl)
/* i18n-hint: changing a quantity "from" one value "to" another */
.Name(XO("To rpm"))
.MinSize( { 100, -1 } )
.AddChoice(_("to"), vinylChoices);
mpChoice_ToVinyl->SetSizeHints(100, -1);
}
S.EndMultiColumn();

View File

@ -351,8 +351,8 @@ void EffectClickRemoval::PopulateOrExchange(ShuttleGui & S)
.Name(XO("Threshold"))
.Style(wxSL_HORIZONTAL)
.Validator<wxGenericValidator>(&mThresholdLevel)
.MinSize( { 150, -1 } )
.AddSlider( {}, mThresholdLevel, MAX_Threshold, MIN_Threshold);
mThreshS->SetMinSize(wxSize(150, -1));
// Click width
mWidthT = S.Id(ID_Width)
@ -366,8 +366,8 @@ void EffectClickRemoval::PopulateOrExchange(ShuttleGui & S)
.Name(XO("Max Spike Width"))
.Style(wxSL_HORIZONTAL)
.Validator<wxGenericValidator>(&mClickWidth)
.MinSize( { 150, -1 } )
.AddSlider( {}, mClickWidth, MAX_Width, MIN_Width);
mWidthS->SetMinSize(wxSize(150, -1));
}
S.EndMultiColumn();

View File

@ -213,8 +213,9 @@ void EffectCompressor::PopulateOrExchange(ShuttleGui & S)
mThresholdDB,
mNoiseFloorDB,
mRatio);
mPanel->SetMinSize(wxSize(400, 200));
S.Prop(true).AddWindow(mPanel, wxEXPAND | wxALL);
S.Prop(true)
.MinSize( { 400, 200 } )
.AddWindow(mPanel, wxEXPAND | wxALL);
S.SetBorder(5);
}
S.EndHorizontalLay();

View File

@ -367,10 +367,10 @@ void EffectDistortion::PopulateOrExchange(ShuttleGui & S)
S.StartMultiColumn(4, wxCENTER);
{
mTypeChoiceCtrl = S.Id(ID_Type)
.MinSize( { -1, -1 } )
.Validator<wxGenericValidator>(&mParams.mTableChoiceIndx)
.AddChoice(_("Distortion type:"),
LocalizedStrings(kTableTypeStrings, nTableTypes));
S.SetSizeHints(-1, -1);
mDCBlockCheckBox = S.Id(ID_DCBlock).AddCheckBox(_("DC blocking filter"),
DEF_DCBlock);

View File

@ -355,11 +355,11 @@ void EffectDtmf::PopulateOrExchange(ShuttleGui & S)
S.AddFixedText(_("Tone/silence ratio:"), false);
mDtmfDutyCycleS = S.Id(ID_DutyCycle)
.Style(wxSL_HORIZONTAL | wxEXPAND)
.MinSize( { -1, -1 } )
.AddSlider( {},
dtmfDutyCycle * SCL_DutyCycle,
MAX_DutyCycle * SCL_DutyCycle,
MIN_DutyCycle * SCL_DutyCycle);
S.SetSizeHints(-1,-1);
}
S.EndMultiColumn();

View File

@ -789,8 +789,9 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S)
mPanel = safenew EqualizationPanel(parent, wxID_ANY, this);
S.Prop(1);
S.AddWindow(mPanel, wxEXPAND );
S.SetSizeHints(wxDefaultCoord, wxDefaultCoord);
S
.MinSize( { wxDefaultCoord, wxDefaultCoord } )
.AddWindow(mPanel, wxEXPAND );
S.SetBorder(5);
S.StartVerticalLay();

View File

@ -1440,8 +1440,8 @@ struct ControlInfo {
S.Id(id)
.Name( sliderName )
.Style(wxSL_HORIZONTAL)
.MinSize( { 150, -1 } )
.AddSlider( {}, 0, sliderMax);
slider->SetSizeHints(150, -1);
}
MemberPointer field;

View File

@ -724,8 +724,8 @@ void NoiseRemovalDialog::PopulateOrExchange(ShuttleGui & S)
mGainS = S.Id(ID_GAIN_SLIDER)
.Name(XO("Noise reduction"))
.Style(wxSL_HORIZONTAL)
.MinSize( { 150, -1 } )
.AddSlider(wxT(""), 0, GAIN_MAX, GAIN_MIN);
mGainS->SetSizeHints(150, -1);
mSensitivityT = S.Id(ID_SENSITIVITY_TEXT)
.Validator<wxTextValidator>(wxFILTER_NUMERIC)
@ -733,8 +733,8 @@ void NoiseRemovalDialog::PopulateOrExchange(ShuttleGui & S)
mSensitivityS = S.Id(ID_SENSITIVITY_SLIDER)
.Name(XO("Sensitivity"))
.Style(wxSL_HORIZONTAL)
.MinSize( { 150, -1 } )
.AddSlider(wxT(""), 0, SENSITIVITY_MAX, SENSITIVITY_MIN);
mSensitivityS->SetSizeHints(150, -1);
mFreqT = S.Id(ID_FREQ_TEXT)
.Validator<wxTextValidator>(wxFILTER_NUMERIC)
@ -742,8 +742,8 @@ void NoiseRemovalDialog::PopulateOrExchange(ShuttleGui & S)
mFreqS = S.Id(ID_FREQ_SLIDER)
.Name(XO("Frequency smoothing"))
.Style(wxSL_HORIZONTAL)
.MinSize( { 150, -1 } )
.AddSlider(wxT(""), 0, FREQ_MAX, FREQ_MIN);
mFreqS->SetSizeHints(150, -1);
mTimeT = S.Id(ID_TIME_TEXT)
.Validator<wxTextValidator>(wxFILTER_NUMERIC)
@ -751,8 +751,8 @@ void NoiseRemovalDialog::PopulateOrExchange(ShuttleGui & S)
mTimeS = S.Id(ID_TIME_SLIDER)
.Name(XO("Attack/decay time"))
.Style(wxSL_HORIZONTAL)
.MinSize( { 150, -1 } )
.AddSlider(wxT(""), 0, TIME_MAX, TIME_MIN);
mTimeS->SetSizeHints(150, -1);
S.AddPrompt(_("Noise:"));
mKeepSignal = S.Id(ID_RADIOBUTTON_KEEPSIGNAL)

View File

@ -300,10 +300,10 @@ void EffectNormalize::PopulateOrExchange(ShuttleGui & S)
S.StartHorizontalLay(wxALIGN_LEFT, false);
{
mGainCheckBox = S
.MinSize()
.Validator<wxGenericValidator>(&mGain)
.AddCheckBox(_("Normalize peak amplitude to "),
mGain);
mGainCheckBox->SetMinSize( mGainCheckBox->GetSize());
mLevelTextCtrl = S
.Name(XO("Peak amplitude dB"))

View File

@ -264,9 +264,9 @@ void EffectPhaser::PopulateOrExchange(ShuttleGui & S)
mStagesS = S.Id(ID_Stages)
.Name(XO("Stages"))
.Style(wxSL_HORIZONTAL)
.MinSize( { 100, -1 } )
.AddSlider( {}, DEF_Stages * SCL_Stages, MAX_Stages * SCL_Stages, MIN_Stages * SCL_Stages);
mStagesS->SetLineSize(2);
mStagesS->SetMinSize(wxSize(100, -1));
mDryWetT = S.Id(ID_DryWet)
.Validator<IntegerValidator<int>>(
@ -276,8 +276,8 @@ void EffectPhaser::PopulateOrExchange(ShuttleGui & S)
mDryWetS = S.Id(ID_DryWet)
.Name(XO("Dry Wet"))
.Style(wxSL_HORIZONTAL)
.MinSize( { 100, -1 } )
.AddSlider( {}, DEF_DryWet * SCL_DryWet, MAX_DryWet * SCL_DryWet, MIN_DryWet * SCL_DryWet);
mDryWetS->SetMinSize(wxSize(100, -1));
mFreqT = S.Id(ID_Freq)
.Validator<FloatingPointValidator<double>>(
@ -287,8 +287,8 @@ void EffectPhaser::PopulateOrExchange(ShuttleGui & S)
mFreqS = S.Id(ID_Freq)
.Name(XO("LFO frequency in hertz"))
.Style(wxSL_HORIZONTAL)
.MinSize( { 100, -1 } )
.AddSlider( {}, DEF_Freq * SCL_Freq, MAX_Freq * SCL_Freq, 0.0);
mFreqS ->SetMinSize(wxSize(100, -1));
mPhaseT = S.Id(ID_Phase)
.Validator<FloatingPointValidator<double>>(
@ -298,9 +298,9 @@ void EffectPhaser::PopulateOrExchange(ShuttleGui & S)
mPhaseS = S.Id(ID_Phase)
.Name(XO("LFO start phase in degrees"))
.Style(wxSL_HORIZONTAL)
.MinSize( { 100, -1 } )
.AddSlider( {}, DEF_Phase * SCL_Phase, MAX_Phase * SCL_Phase, MIN_Phase * SCL_Phase);
mPhaseS->SetLineSize(10);
mPhaseS->SetMinSize(wxSize(100, -1));
mDepthT = S.Id(ID_Depth)
.Validator<IntegerValidator<int>>(
@ -310,8 +310,8 @@ void EffectPhaser::PopulateOrExchange(ShuttleGui & S)
mDepthS = S.Id(ID_Depth)
.Name(XO("Depth in percent"))
.Style(wxSL_HORIZONTAL)
.MinSize( { 100, -1 } )
.AddSlider( {}, DEF_Depth * SCL_Depth, MAX_Depth * SCL_Depth, MIN_Depth * SCL_Depth);
mDepthS->SetMinSize(wxSize(100, -1));
mFeedbackT = S.Id(ID_Feedback)
.Validator<IntegerValidator<int>>(
@ -321,9 +321,9 @@ void EffectPhaser::PopulateOrExchange(ShuttleGui & S)
mFeedbackS = S.Id(ID_Feedback)
.Name(XO("Feedback in percent"))
.Style(wxSL_HORIZONTAL)
.MinSize( { 100, -1 } )
.AddSlider( {}, DEF_Feedback * SCL_Feedback, MAX_Feedback * SCL_Feedback, MIN_Feedback * SCL_Feedback);
mFeedbackS->SetLineSize(10);
mFeedbackS->SetMinSize(wxSize(100, -1));
mOutGainT = S.Id(ID_OutGain)
.Validator<FloatingPointValidator<double>>(
@ -333,8 +333,8 @@ void EffectPhaser::PopulateOrExchange(ShuttleGui & S)
mOutGainS = S.Id(ID_OutGain)
.Name(XO("Output gain (dB)"))
.Style(wxSL_HORIZONTAL)
.MinSize( { 100, -1 } )
.AddSlider( {}, DEF_OutGain * SCL_OutGain, MAX_OutGain * SCL_OutGain, MIN_OutGain * SCL_OutGain);
mOutGainS->SetMinSize(wxSize(100, -1));
}
S.EndMultiColumn();
}

View File

@ -398,9 +398,9 @@ void EffectScienFilter::PopulateOrExchange(ShuttleGui & S)
);
S.SetBorder(5);
S.Prop(1);
S.AddWindow(mPanel, wxEXPAND | wxRIGHT);
S.SetSizeHints(-1, -1);
S.Prop(1)
.MinSize( { -1, -1 } )
.AddWindow(mPanel, wxEXPAND | wxRIGHT);
S.StartVerticalLay();
{
@ -460,14 +460,15 @@ void EffectScienFilter::PopulateOrExchange(ShuttleGui & S)
mFilterTypeCtl = S.Id(ID_Type)
.Focus()
.Validator<wxGenericValidator>(&mFilterType)
.MinSize( { -1, -1 } )
.AddChoice(_("&Filter Type:"),
LocalizedStrings(kTypeStrings, nTypes)
);
S.SetSizeHints(-1, -1);
mFilterOrderCtl = S.Id(ID_Order)
.Validator<wxGenericValidator>(&mOrderIndex)
/*i18n-hint: 'Order' means the complexity of the filter, and is a number between 1 and 10.*/
.MinSize( { -1, -1 } )
.AddChoice(_("O&rder:"),
[]{
wxArrayStringEx orders;
@ -476,7 +477,6 @@ void EffectScienFilter::PopulateOrExchange(ShuttleGui & S)
return orders;
}()
);
S.SetSizeHints(-1, -1);
S.AddSpace(1, 1);
mRippleCtlP = S.AddVariableText(_("&Passband Ripple:"), false, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
@ -490,11 +490,11 @@ void EffectScienFilter::PopulateOrExchange(ShuttleGui & S)
mFilterSubTypeCtl = S.Id(ID_SubType)
.Validator<wxGenericValidator>(&mFilterSubtype)
.MinSize( { -1, -1 } )
.AddChoice(_("&Subtype:"),
LocalizedStrings(kSubTypeStrings, nSubTypes)
);
S.SetSizeHints(-1, -1);
mCutoffCtl = S.Id(ID_Cutoff)
.Name(XO("Cutoff (Hz)"))
.Validator<FloatingPointValidator<float>>(

View File

@ -101,9 +101,9 @@ ScoreAlignDialog::ScoreAlignDialog(ScoreAlignParams &params)
mFramePeriodSlider = S.Id(ID_FRAMEPERIOD)
.Name(XO("Frame Period"))
.Style(wxSL_HORIZONTAL)
.MinSize( { 300, -1 } )
.AddSlider(wxT(""),
/*pos*/ (int) (p.mFramePeriod * 100 + 0.5), /*max*/ 50, /*min*/ 5);
S.SetSizeHints(300, -1);
mFramePeriodText = S.AddVariableText(SA_DFT_FRAME_PERIOD_TEXT, true,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);

View File

@ -780,9 +780,10 @@ void EffectTruncSilence::PopulateOrExchange(ShuttleGui & S)
{
// Action choices
auto actionChoices = LocalizedStrings(kActionStrings, nActions);
mActionChoice = S.Validator<wxGenericValidator>(&mActionIndex)
mActionChoice = S
.Validator<wxGenericValidator>(&mActionIndex)
.MinSize( { -1, -1 } )
.AddChoice( {}, actionChoices );
S.SetSizeHints(-1, -1);
}
S.EndHorizontalLay();
S.StartMultiColumn(3, wxALIGN_CENTER_HORIZONTAL);

View File

@ -823,10 +823,10 @@ void VSTEffectOptionsDialog::PopulateOrExchange(ShuttleGui & S)
wxTextCtrl *t;
t = S.Validator<IntegerValidator<int>>(
&mBufferSize, NumValidatorStyle::DEFAULT, 8, 1048576 * 1)
.MinSize( { 100, -1 } )
.TieNumericTextBox(_("&Buffer Size (8 to 1048576 samples):"),
mBufferSize,
12);
t->SetMinSize(wxSize(100, -1));
}
S.EndHorizontalLay();
}

View File

@ -248,8 +248,8 @@ void EffectWahwah::PopulateOrExchange(ShuttleGui & S)
mFreqS = S.Id(ID_Freq)
.Name(XO("LFO frequency in hertz"))
.Style(wxSL_HORIZONTAL)
.MinSize( { 100, -1 } )
.AddSlider( {}, DEF_Freq * SCL_Freq, MAX_Freq * SCL_Freq, MIN_Freq * SCL_Freq);
mFreqS->SetMinSize(wxSize(100, -1));
mPhaseT = S.Id(ID_Phase)
.Validator<FloatingPointValidator<double>>(
@ -259,9 +259,9 @@ void EffectWahwah::PopulateOrExchange(ShuttleGui & S)
mPhaseS = S.Id(ID_Phase)
.Name(XO("LFO start phase in degrees"))
.Style(wxSL_HORIZONTAL)
.MinSize( { 100, -1 } )
.AddSlider( {}, DEF_Phase * SCL_Phase, MAX_Phase * SCL_Phase, MIN_Phase * SCL_Phase);
mPhaseS->SetLineSize(10);
mPhaseS->SetMinSize(wxSize(100, -1));
mDepthT = S.Id(ID_Depth)
.Validator<IntegerValidator<int>>(
@ -271,8 +271,8 @@ void EffectWahwah::PopulateOrExchange(ShuttleGui & S)
mDepthS = S.Id(ID_Depth)
.Name(XO("Depth in percent"))
.Style(wxSL_HORIZONTAL)
.MinSize( { 100, -1 } )
.AddSlider( {}, DEF_Depth * SCL_Depth, MAX_Depth * SCL_Depth, MIN_Depth * SCL_Depth);
mDepthS->SetMinSize(wxSize(100, -1));
mResT = S.Id(ID_Res)
.Validator<FloatingPointValidator<double>>(
@ -282,8 +282,8 @@ void EffectWahwah::PopulateOrExchange(ShuttleGui & S)
mResS = S.Id(ID_Res)
.Name(XO("Resonance"))
.Style(wxSL_HORIZONTAL)
.MinSize( { 100, -1 } )
.AddSlider( {}, DEF_Res * SCL_Res, MAX_Res * SCL_Res, MIN_Res * SCL_Res);
mResS->SetMinSize(wxSize(100, -1));
mFreqOfsT = S.Id(ID_FreqOfs)
.Validator<IntegerValidator<int>>(
@ -293,8 +293,8 @@ void EffectWahwah::PopulateOrExchange(ShuttleGui & S)
mFreqOfsS = S.Id(ID_FreqOfs)
.Name(XO("Wah frequency offset in percent"))
.Style(wxSL_HORIZONTAL)
.MinSize( { 100, -1 } )
.AddSlider( {}, DEF_FreqOfs * SCL_FreqOfs, MAX_FreqOfs * SCL_FreqOfs, MIN_FreqOfs * SCL_FreqOfs);
mFreqOfsT->SetMinSize(wxSize(100, -1));
mOutGainT = S.Id(ID_OutGain)
.Validator<FloatingPointValidator<double>>(
@ -304,8 +304,8 @@ void EffectWahwah::PopulateOrExchange(ShuttleGui & S)
mOutGainS = S.Id(ID_OutGain)
.Name(XO("Output gain (dB)"))
.Style(wxSL_HORIZONTAL)
.MinSize( { 100, -1 } )
.AddSlider( {}, DEF_OutGain * SCL_OutGain, MAX_OutGain * SCL_OutGain, MIN_OutGain * SCL_OutGain);
mOutGainS->SetMinSize(wxSize(100, -1));
}
S.EndMultiColumn();
}

View File

@ -2587,8 +2587,9 @@ void NyquistEffect::BuildPromptWindow(ShuttleGui & S)
S.StartHorizontalLay(wxEXPAND, 1);
{
mCommandText = S.Focus().AddTextWindow(wxT(""));
mCommandText->SetMinSize(wxSize(500, 200));
mCommandText = S.Focus()
.MinSize( { 500, 200 } )
.AddTextWindow(wxT(""));
}
S.EndHorizontalLay();
@ -2735,8 +2736,8 @@ void NyquistEffect::BuildEffectWindow(ShuttleGui & S)
{
S.Id(ID_Slider + i)
.Style(wxSL_HORIZONTAL)
.MinSize( { 150, -1 } )
.AddSlider( {}, 0, ctrl.ticks, 0);
S.SetSizeHints(150, -1);
}
}

View File

@ -562,6 +562,7 @@ void VampEffect::PopulateOrExchange(ShuttleGui & S)
S.Id(ID_Program);
mProgram = S.Name(XO("Program"))
.MinSize( { -1, -1 } )
.AddChoice( {},
[&]{
wxArrayStringEx choices;
@ -571,7 +572,6 @@ void VampEffect::PopulateOrExchange(ShuttleGui & S)
}(),
wxString::FromUTF8(mPlugin->getCurrentProgram().c_str())
);
mProgram->SetSizeHints(-1, -1);
wxSizer *s = mProgram->GetContainingSizer();
s->GetItem(mProgram)->SetFlag(wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL);
@ -638,8 +638,9 @@ void VampEffect::PopulateOrExchange(ShuttleGui & S)
S.Id(ID_Choices + p);
mChoices[p] = S.ToolTip( TranslatableString{ tip } )
.Name( TranslatableString{ labelText } )
.MinSize( { -1, -1 } )
.AddChoice( {}, choices, selected );
mChoices[p]->SetSizeHints(-1, -1);
wxSizer *s = mChoices[p]->GetContainingSizer();
s->GetItem(mChoices[p])->SetFlag(wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL);
@ -675,9 +676,9 @@ void VampEffect::PopulateOrExchange(ShuttleGui & S)
mSliders[p] = S.ToolTip( TranslatableString{ tip } )
.Name( TranslatableString{ labelText } )
.Style(wxSL_HORIZONTAL)
.MinSize( { 150, -1 } )
.AddSlider( {}, 0, 1000, 0);
mSliders[p]->SetSizeHints(150, -1);
str = Internat::ToDisplayString(mParameters[p].maxValue);
S.AddUnits(str);
}

View File

@ -1611,8 +1611,8 @@ void ExportFFmpegOptions::PopulateOrExchange(ShuttleGui & S)
mProfileChoice = S.Id(FEProfileID)
.ToolTip(XO("AAC Profile\nLow Complexity - default\nMost players won't play anything other than LC"))
.MinSize( { 100, -1 } )
.TieChoice(_("Profile:"), AACProfiles);
mProfileChoice->SetSizeHints( 100,-1);
}
S.EndMultiColumn();
}
@ -1635,13 +1635,13 @@ void ExportFFmpegOptions::PopulateOrExchange(ShuttleGui & S)
mPredictionOrderMethodChoice = S.Id(FEPredOrderID)
.ToolTip(XO("Prediction Order Method\nEstimate - fastest, lower compression\nLog search - slowest, best compression\nFull search - default"))
.MinSize( { 100, -1 } )
.TieNumberAsChoice(
_("PdO Method:"),
{wxT("/FileFormats/FFmpegPredOrderMethod"),
4}, // Full search
PredictionOrderMethodNames
);
mPredictionOrderMethodChoice->SetSizeHints( 100,-1);
mMinPredictionOrderSpin = S.Id(FEMinPredID)
.ToolTip(XO("Minimal prediction order\nOptional\n-1 - default\nmin - 0\nmax - 32 (with LPC) or 4 (without LPC)"))

View File

@ -315,9 +315,8 @@ void DevicePrefs::OnHost(wxCommandEvent & e)
}
}
ShuttleGui S(this, eIsCreating);
S.SetSizeHints(mPlay, mPlay->GetStrings());
S.SetSizeHints(mRecord, mRecord->GetStrings());
ShuttleGui::SetMinSize(mPlay, mPlay->GetStrings());
ShuttleGui::SetMinSize(mRecord, mRecord->GetStrings());
OnDevice(e);
}
@ -381,8 +380,7 @@ void DevicePrefs::OnDevice(wxCommandEvent & WXUNUSED(event))
mChannels->SetSelection(0);
}
ShuttleGui S(this, eIsCreating);
S.SetSizeHints(mChannels, channelnames);
ShuttleGui::SetMinSize(mChannels, channelnames);
Layout();
}

View File

@ -199,8 +199,9 @@ void EffectsPrefs::PopulateOrExchange(ShuttleGui & S)
{
S.StartMultiColumn(2);
{
wxChoice *c = S.TieChoice( _("S&ort or Group:"), EffectsGroupBy);
if( c ) c->SetMinSize(c->GetBestSize());
wxChoice *c = S
.MinSize()
.TieChoice( _("S&ort or Group:"), EffectsGroupBy);
S.TieIntegerTextBox(_("&Maximum effects per group (0 to disable):"),
{wxT("/Effects/MaxPerGroup"),

View File

@ -256,10 +256,9 @@ void MidiIOPrefs::OnHost(wxCommandEvent & WXUNUSED(e))
mRecord->SetSelection(0);
}
#endif
ShuttleGui S(this, eIsCreating);
S.SetSizeHints(mPlay, playnames);
ShuttleGui::SetMinSize(mPlay, playnames);
#ifdef EXPERIMENTAL_MIDI_IN
S.SetSizeHints(mRecord, recordnames);
ShuttleGui::SetMinSize(mRecord, recordnames);
#endif
// OnDevice(e);
}