From a53defedf33cb743e74a570d21a8bce10939b9fe Mon Sep 17 00:00:00 2001 From: lllucius Date: Wed, 30 Oct 2013 02:42:51 +0000 Subject: [PATCH] Bug 646 - Additional fix the Cancel button It now interrupts the scan if the user clicks OK first. --- src/effects/VST/VSTEffect.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/effects/VST/VSTEffect.cpp b/src/effects/VST/VSTEffect.cpp index de1016930..197e074a6 100644 --- a/src/effects/VST/VSTEffect.cpp +++ b/src/effects/VST/VSTEffect.cpp @@ -450,6 +450,8 @@ class PluginRegistrationDialog:public wxDialog { wxArrayString mFiles; wxArrayInt miState; + bool mCancelClicked; + DECLARE_EVENT_TABLE() }; @@ -659,9 +661,10 @@ void PluginRegistrationDialog::ToggleItem(int i) void PluginRegistrationDialog::OnApply(wxCommandEvent & WXUNUSED(event)) { + mCancelClicked = false; size_t cnt = mFiles.GetCount(); - for (size_t i = 0; i < cnt; i++) { + for (size_t i = 0; i < cnt && !mCancelClicked; i++) { wxString file = mFiles[i]; mPlugins->EnsureVisible( i ); @@ -671,13 +674,17 @@ void PluginRegistrationDialog::OnApply(wxCommandEvent & WXUNUSED(event)) VSTEffect::ScanOnePlugin( file ); mPlugins->SetItemImage( i, SHOW_CHECKED ); } + wxYield(); } - EndModal(wxID_OK); + + EndModal(mCancelClicked ? wxID_CANCEL : wxID_OK); } void PluginRegistrationDialog::OnCancel(wxCommandEvent & WXUNUSED(event)) { - EndModal(wxID_CANCEL); + mCancelClicked = true; + + EndModal(mCancelClicked ? wxID_CANCEL : wxID_OK); }