Define and use ShuttleGui::Disable; remove EnableCtrl
This commit is contained in:
parent
c72dbf5b51
commit
d98e41aad1
|
@ -89,10 +89,12 @@ void MacroCommandDialog::PopulateOrExchange(ShuttleGui &S)
|
|||
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
|
||||
mEditParams = S.Id(EditParamsButtonID)
|
||||
.Disable() // disable button as box is empty
|
||||
.AddButton(_("&Edit Parameters"));
|
||||
mUsePreset = S.Id(UsePresetButtonID)
|
||||
.Disable() // disable button as box is empty
|
||||
.AddButton(_("&Use Preset"));
|
||||
}
|
||||
S.EndMultiColumn();
|
||||
|
||||
|
|
|
@ -632,8 +632,12 @@ void MacrosWindow::PopulateOrExchange(ShuttleGui & S)
|
|||
mRestore = S.Id(RestoreButtonID).AddButton(_("Re&store"));
|
||||
// Not yet ready for prime time.
|
||||
#if 0
|
||||
S.Id(ImportButtonID).AddButton(_("I&mport..."))->Enable( false);
|
||||
S.Id(ExportButtonID).AddButton(_("E&xport..."))->Enable( false);
|
||||
S.Id(ImportButtonID)
|
||||
.Disable()
|
||||
.AddButton(_("I&mport..."));
|
||||
S.Id(ExportButtonID)
|
||||
.Disable()
|
||||
.AddButton(_("E&xport..."));
|
||||
#endif
|
||||
}
|
||||
S.EndVerticalLay();
|
||||
|
|
|
@ -365,11 +365,10 @@ void DependencyDialog::PopulateOrExchange(ShuttleGui& S)
|
|||
mCopySelectedFilesButton =
|
||||
S.Id(CopySelectedFilesButtonID)
|
||||
.Focus()
|
||||
.Disable(mFileListCtrl->GetSelectedItemCount() <= 0)
|
||||
.AddButton(
|
||||
_("Copy Selected Files"),
|
||||
wxALIGN_LEFT, true);
|
||||
mCopySelectedFilesButton->Enable(
|
||||
mFileListCtrl->GetSelectedItemCount() > 0);
|
||||
}
|
||||
S.EndStatic();
|
||||
|
||||
|
@ -383,11 +382,12 @@ void DependencyDialog::PopulateOrExchange(ShuttleGui& S)
|
|||
S.Id(wxID_NO).AddButton(_("Do Not Copy"));
|
||||
|
||||
mCopyAllFilesButton =
|
||||
S.Id(wxID_YES).AddButton(_("Copy All Files (Safer)"));
|
||||
S.Id(wxID_YES)
|
||||
// Enabling mCopyAllFilesButton is also done in PopulateList,
|
||||
// but at its call above, mCopyAllFilesButton does not yet exist.
|
||||
.Disable(mHasMissingFiles)
|
||||
.AddButton(_("Copy All Files (Safer)"));
|
||||
|
||||
// Enabling mCopyAllFilesButton is also done in PopulateList,
|
||||
// but at its call above, mCopyAllFilesButton does not yet exist.
|
||||
mCopyAllFilesButton->Enable(!mHasMissingFiles);
|
||||
}
|
||||
S.EndHorizontalLay();
|
||||
|
||||
|
|
|
@ -184,13 +184,6 @@ void ShuttleGuiBase::ResetId()
|
|||
miIdNext = 3000;
|
||||
}
|
||||
|
||||
void ShuttleGuiBase::EnableCtrl( bool bEnable )
|
||||
{
|
||||
if( mShuttleMode != eIsCreating )
|
||||
return;
|
||||
mpLastWind->Enable( bEnable );
|
||||
}
|
||||
|
||||
/// Used to modify an already placed Window.
|
||||
void ShuttleGuiBase::SetSizeHints( int minX, int minY )
|
||||
{
|
||||
|
@ -2087,6 +2080,9 @@ void ShuttleGuiBase::UpdateSizersCore(bool bPrepend, int Flags, bool prompt)
|
|||
if (mItem.mFocused)
|
||||
mpWind->SetFocus();
|
||||
|
||||
if (mItem.mDisabled)
|
||||
mpWind->Enable( false );
|
||||
|
||||
// Reset to defaults
|
||||
mItem = {};
|
||||
}
|
||||
|
|
|
@ -174,6 +174,12 @@ struct Item {
|
|||
return std::move( *this );
|
||||
}
|
||||
|
||||
Item&& Disable( bool disabled = true ) &&
|
||||
{
|
||||
mDisabled = disabled;
|
||||
return std::move( *this );
|
||||
}
|
||||
|
||||
std::function< void(wxWindow*) > mValidatorSetter;
|
||||
TranslatableString mToolTip;
|
||||
TranslatableString mName;
|
||||
|
@ -182,6 +188,7 @@ struct Item {
|
|||
long miStyle{};
|
||||
|
||||
bool mFocused { false };
|
||||
bool mDisabled { false };
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -387,7 +394,6 @@ public:
|
|||
const int max,
|
||||
const int min);
|
||||
//-- End of variants.
|
||||
void EnableCtrl( bool bEnable );
|
||||
void SetSizeHints( int minX, int minY );
|
||||
void SetBorder( int Border ) {miBorder = Border;};
|
||||
void SetSizerProportion( int iProp ) {miSizerProp = iProp;};
|
||||
|
@ -545,6 +551,12 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
ShuttleGui &Disable( bool disabled = true )
|
||||
{
|
||||
std::move( mItem ).Disable( disabled );
|
||||
return *this;
|
||||
}
|
||||
|
||||
ShuttleGui & ToolTip( const TranslatableString &tip )
|
||||
{
|
||||
std::move( mItem ).ToolTip( tip );
|
||||
|
|
|
@ -271,12 +271,8 @@ void EffectAmplify::PopulateOrExchange(ShuttleGui & S)
|
|||
// Clipping
|
||||
S.StartHorizontalLay(wxCENTER);
|
||||
{
|
||||
mClip = S.Id(ID_Clip).AddCheckBox(_("Allow clipping"), false);
|
||||
if (IsBatchProcessing())
|
||||
{
|
||||
mClip->Enable(false);
|
||||
mCanClip = true;
|
||||
}
|
||||
mClip = S.Id(ID_Clip).Disable( mCanClip = IsBatchProcessing() )
|
||||
.AddCheckBox(_("Allow clipping"), false);
|
||||
}
|
||||
S.EndHorizontalLay();
|
||||
}
|
||||
|
|
|
@ -285,13 +285,13 @@ void EffectChangeTempo::PopulateOrExchange(ShuttleGui & S)
|
|||
S.StartHorizontalLay(wxALIGN_CENTER);
|
||||
{
|
||||
m_pTextCtrl_FromLength = S.Id(ID_FromLength)
|
||||
.Disable() // Disable because the value comes from the
|
||||
// user selection.
|
||||
.Validator<FloatingPointValidator<double>>(
|
||||
precision, &m_FromLength,
|
||||
NumValidatorStyle::TWO_TRAILING_ZEROES)
|
||||
/* i18n-hint: changing a quantity "from" one value "to" another */
|
||||
.AddTextBox(_("from"), wxT(""), 12);
|
||||
m_pTextCtrl_FromLength->Enable(false); // Disable because the value comes from the user selection.
|
||||
|
||||
m_pTextCtrl_ToLength = S.Id(ID_ToLength)
|
||||
.Validator<FloatingPointValidator<double>>(
|
||||
2, &m_ToLength, NumValidatorStyle::TWO_TRAILING_ZEROES,
|
||||
|
|
|
@ -1069,29 +1069,23 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S)
|
|||
.AddRadioButton(_("D&efault"),
|
||||
0, value);
|
||||
mMathProcessingType[1] = S.Id(ID_SSE)
|
||||
.Disable(!EffectEqualization48x::GetMathCaps()->SSE)
|
||||
.AddRadioButtonToGroup(_("&SSE"),
|
||||
1, value);
|
||||
mMathProcessingType[2] = S.Id(ID_SSEThreaded)
|
||||
.Disable(!EffectEqualization48x::GetMathCaps()->SSE)
|
||||
.AddRadioButtonToGroup(_("SSE &Threaded"),
|
||||
2, value);
|
||||
mMathProcessingType[3] = S.Id(ID_AVX)
|
||||
// not implemented
|
||||
.Disable(true /* !EffectEqualization48x::GetMathCaps()->AVX */)
|
||||
.AddRadioButtonToGroup(_("A&VX"),
|
||||
3, value);
|
||||
mMathProcessingType[4] = S.Id(ID_AVXThreaded)
|
||||
// not implemented
|
||||
.Disable(true /* !EffectEqualization48x::GetMathCaps()->AVX */)
|
||||
.AddRadioButtonToGroup(_("AV&X Threaded"),
|
||||
4, value);
|
||||
|
||||
if (!EffectEqualization48x::GetMathCaps()->SSE)
|
||||
{
|
||||
mMathProcessingType[1]->Disable();
|
||||
mMathProcessingType[2]->Disable();
|
||||
}
|
||||
if (true) //!EffectEqualization48x::GetMathCaps()->AVX) { not implemented
|
||||
{
|
||||
mMathProcessingType[3]->Disable();
|
||||
mMathProcessingType[4]->Disable();
|
||||
}
|
||||
|
||||
S.Id(ID_Bench).AddButton(_("&Bench"));
|
||||
}
|
||||
S.EndHorizontalLay();
|
||||
|
|
|
@ -392,21 +392,21 @@ void ExportMP3Options::PopulateOrExchange(ShuttleGui & S)
|
|||
codes
|
||||
);
|
||||
|
||||
mMode = S.TieNumberAsChoice(
|
||||
_("Variable Speed:"),
|
||||
{ wxT("/FileFormats/MP3VarMode"), ROUTINE_FAST },
|
||||
varModeNames );
|
||||
mMode->Enable(enable);
|
||||
mMode = S.Disable(!enable)
|
||||
.TieNumberAsChoice(
|
||||
_("Variable Speed:"),
|
||||
{ wxT("/FileFormats/MP3VarMode"), ROUTINE_FAST },
|
||||
varModeNames );
|
||||
|
||||
S.AddPrompt(_("Channel Mode:"));
|
||||
S.StartMultiColumn(3, wxEXPAND);
|
||||
{
|
||||
S.StartRadioButtonGroup(MP3ChannelModeSetting);
|
||||
{
|
||||
mJoint = S.TieRadioButton();
|
||||
mStereo = S.TieRadioButton();
|
||||
mJoint->Enable(!mono);
|
||||
mStereo->Enable(!mono);
|
||||
mJoint = S.Disable(mono)
|
||||
.TieRadioButton();
|
||||
mStereo = S.Disable(mono)
|
||||
.TieRadioButton();
|
||||
}
|
||||
S.EndRadioButtonGroup();
|
||||
|
||||
|
|
|
@ -113,23 +113,23 @@ void LibraryPrefs::PopulateOrExchange(ShuttleGui & S)
|
|||
S.AddVariableText(_("LAME MP3 Library:"),
|
||||
true,
|
||||
wxALL | wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL);
|
||||
wxButton *locate_button = S.Id(ID_MP3_FIND_BUTTON).AddButton(_("&Locate..."),
|
||||
wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
|
||||
S.Id(ID_MP3_FIND_BUTTON)
|
||||
#ifdef DISABLE_DYNAMIC_LOADING_LAME
|
||||
.Disable()
|
||||
#endif
|
||||
.AddButton(_("&Locate..."),
|
||||
wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
|
||||
S.AddVariableText(_("LAME MP3 Library:"),
|
||||
true,
|
||||
wxALL | wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL);
|
||||
wxButton *download_button = S.Id(ID_MP3_DOWN_BUTTON).AddButton(_("&Download"),
|
||||
wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
|
||||
|
||||
S.Id(ID_MP3_DOWN_BUTTON)
|
||||
#ifdef DISABLE_DYNAMIC_LOADING_LAME
|
||||
locate_button->Enable(FALSE);
|
||||
download_button->Enable(FALSE);
|
||||
#else
|
||||
(void)locate_button;
|
||||
(void)download_button;
|
||||
#endif // DISABLE_DYNAMIC_LOADING_LAME
|
||||
.Disable()
|
||||
#endif
|
||||
.AddButton(_("&Download"),
|
||||
wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
|
||||
|
||||
#endif
|
||||
}
|
||||
S.EndTwoColumn();
|
||||
}
|
||||
|
@ -155,31 +155,32 @@ void LibraryPrefs::PopulateOrExchange(ShuttleGui & S)
|
|||
true,
|
||||
wxALL | wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL);
|
||||
S.Id(ID_FFMPEG_FIND_BUTTON);
|
||||
wxButton *bfnd = S.AddButton(_("Loca&te..."),
|
||||
wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
|
||||
S
|
||||
#if !defined(USE_FFMPEG) || defined(DISABLE_DYNAMIC_LOADING_FFMPEG)
|
||||
.Disable()
|
||||
#endif
|
||||
.AddButton(_("Loca&te..."),
|
||||
wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
|
||||
S.AddVariableText(_("FFmpeg Library:"),
|
||||
true,
|
||||
wxALL | wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL);
|
||||
S.Id(ID_FFMPEG_DOWN_BUTTON);
|
||||
wxButton *bdwn = S.AddButton(_("Dow&nload"),
|
||||
wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
|
||||
S
|
||||
#if !defined(USE_FFMPEG) || defined(DISABLE_DYNAMIC_LOADING_FFMPEG)
|
||||
bdwn->Enable(FALSE);
|
||||
bfnd->Enable(FALSE);
|
||||
#else
|
||||
// fix compilation warnings about unused variables
|
||||
wxUnusedVar(bfnd);
|
||||
wxUnusedVar(bdwn);
|
||||
.Disable()
|
||||
#endif
|
||||
.AddButton(_("Dow&nload"),
|
||||
wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
|
||||
}
|
||||
S.EndTwoColumn();
|
||||
#ifdef EXPERIMENTAL_OD_FFMPEG
|
||||
wxCheckBox* checkbox = S.TieCheckBox(_("Allow &background on-demand loading"),
|
||||
S
|
||||
#if !defined(USE_FFMPEG)
|
||||
.Disable()
|
||||
#endif
|
||||
.TieCheckBox(_("Allow &background on-demand loading"),
|
||||
wxT("/Library/FFmpegOnDemand"),
|
||||
false);
|
||||
#if !defined(USE_FFMPEG)
|
||||
if( checkbox ) checkbox->Enable(FALSE);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
S.EndStatic();
|
||||
|
|
|
@ -159,12 +159,11 @@ void RecordingPrefs::PopulateOrExchange(ShuttleGui & S)
|
|||
|
||||
mToggleCustomName = S
|
||||
.Name(XO("Custom name text"))
|
||||
.Disable(!mUseCustomTrackName)
|
||||
.TieTextBox( {},
|
||||
{wxT("/GUI/TrackNames/RecodingTrackName"),
|
||||
_("Recorded_Audio")},
|
||||
30);
|
||||
if ( mToggleCustomName )
|
||||
mToggleCustomName->Enable(mUseCustomTrackName);
|
||||
30);
|
||||
}
|
||||
S.EndMultiColumn();
|
||||
|
||||
|
|
|
@ -166,18 +166,18 @@ void HelpSystem::ShowHtmlText(wxWindow *pParent,
|
|||
{
|
||||
S.StartHorizontalLay( wxEXPAND, false );
|
||||
{
|
||||
wxButton * pWndBackwards = S.Id( wxID_BACKWARD )
|
||||
S.Id( wxID_BACKWARD )
|
||||
.Disable()
|
||||
#if wxUSE_TOOLTIPS
|
||||
.ToolTip( XO("Backwards" ) )
|
||||
#endif
|
||||
.AddButton( _("<") );
|
||||
wxButton * pWndForwards = S.Id( wxID_FORWARD )
|
||||
S.Id( wxID_FORWARD )
|
||||
.Disable()
|
||||
#if wxUSE_TOOLTIPS
|
||||
.ToolTip( XO("Forwards" ) )
|
||||
#endif
|
||||
.AddButton( _(">") );
|
||||
pWndForwards->Enable( false );
|
||||
pWndBackwards->Enable( false );
|
||||
}
|
||||
S.EndHorizontalLay();
|
||||
|
||||
|
|
Loading…
Reference in New Issue