Bug470: Disable some Manage Curves buttons when no curve selected

This commit is contained in:
Paul Licameli 2016-06-22 19:08:47 -04:00
parent 5b7e9518e2
commit ad711e783b
2 changed files with 19 additions and 0 deletions

View File

@ -3183,6 +3183,10 @@ BEGIN_EVENT_TABLE(EditCurvesDialog, wxDialog)
EVT_BUTTON(LibraryButtonID, EditCurvesDialog::OnLibrary)
EVT_BUTTON(DefaultsButtonID, EditCurvesDialog::OnDefaults)
EVT_BUTTON(wxID_OK, EditCurvesDialog::OnOK)
EVT_LIST_ITEM_SELECTED(CurvesListID,
EditCurvesDialog::OnListSelectionChange)
EVT_LIST_ITEM_DESELECTED(CurvesListID,
EditCurvesDialog::OnListSelectionChange)
END_EVENT_TABLE()
EditCurvesDialog::EditCurvesDialog(wxWindow * parent, EffectEqualization * effect, int position):
@ -3644,6 +3648,19 @@ void EditCurvesDialog::OnOK(wxCommandEvent & WXUNUSED(event))
EndModal(true);
}
void EditCurvesDialog::OnListSelectionChange( wxListEvent & )
{
const bool enable = mList->GetSelectedItemCount() > 0;
static const int ids[] = {
UpButtonID,
DownButtonID,
RenameButtonID,
DeleteButtonID,
};
for (auto id : ids)
FindWindowById(id, this)->Enable(enable);
}
#if wxUSE_ACCESSIBILITY
SliderAx::SliderAx(wxWindow * window, const wxString &fmt) :

View File

@ -369,6 +369,8 @@ private:
void OnLibrary( wxCommandEvent &event );
void OnDefaults( wxCommandEvent &event );
void OnOK(wxCommandEvent &event);
void OnListSelectionChange( wxListEvent &event );
DECLARE_EVENT_TABLE()
};