From 3391203e931d311328acf6a5272af90ca8bf76ce Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Tue, 12 May 2015 10:26:27 -0500 Subject: [PATCH] Make sure buttons are disabled for "special" commands --- src/BatchCommandDialog.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/BatchCommandDialog.cpp b/src/BatchCommandDialog.cpp index 0c4fb4b05..0675ed820 100644 --- a/src/BatchCommandDialog.cpp +++ b/src/BatchCommandDialog.cpp @@ -169,8 +169,10 @@ void BatchCommandDialog::OnItemSelected(wxListEvent &event) EffectManager & em = EffectManager::Get(); PluginID ID = em.GetEffectByIdentifier(command); - wxASSERT(!ID.IsEmpty()); - mEditParams->Enable(true); + + // If ID is empty, then the effect wasn't found, in which case, the user must have + // selected one of the "special" commands. + mEditParams->Enable(!ID.IsEmpty()); mUsePreset->Enable(em.HasPresets(ID)); if (command == mCommand->GetValue()) @@ -179,6 +181,7 @@ void BatchCommandDialog::OnItemSelected(wxListEvent &event) } mCommand->SetValue(command); + wxString params = BatchCommands::GetCurrentParamsFor(command); if (params.IsEmpty()) { @@ -216,9 +219,16 @@ void BatchCommandDialog::SetCommandAndParams(const wxString &Command, const wxSt mParameters->SetValue( Params ); int item = mChoices->FindItem(-1, Command); - if( item != -1 ) + if (item != wxNOT_FOUND) { mChoices->SetItemState(item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); - mEditParams->Enable( true ); + + EffectManager & em = EffectManager::Get(); + PluginID ID = em.GetEffectByIdentifier(Command); + + // If ID is empty, then the effect wasn't found, in which case, the user must have + // selected one of the "special" commands. + mEditParams->Enable(!ID.IsEmpty()); + mUsePreset->Enable(em.HasPresets(ID)); } }