1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-16 16:10:06 +02:00

Bug #334 - On OSX, this fixes the issue where you can

terminate Audacity while the progress dialog is being
displayed.
This commit is contained in:
lllucius 2011-04-03 02:22:59 +00:00
parent 8a1546ddaf
commit dbf2cdf605

View File

@ -37,6 +37,9 @@
#include <wx/event.h>
#include <wx/frame.h>
#include <wx/intl.h>
#if defined(__WXMAC__)
#include <wx/menu.h>
#endif
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/stopwatch.h>
@ -1144,6 +1147,21 @@ ProgressDialog::ProgressDialog(const wxString & title, const wxString & message,
// delay, we MUST disable other windows/menus anyway since we run the risk
// of allowing other tasks to run before this one is complete.
mDisable = new wxWindowDisabler(this);
#if defined(__WXMAC__)
// LL: On the Mac, the parent windows get disabled, but they still respond
// to the close button being clicked and the application quit menu item
// is still enabled. We do not want the parent window to be destroyed
// while we're active, so we have to kludge around a bit to keep this
// from happening.
WindowRef windowRef = (WindowRef) MacGetWindowRef();
SetWindowModality( windowRef, kWindowModalityAppModal, NULL ) ;
BeginAppModalStateForWindow(windowRef);
wxMenuBar *bar = wxStaticCast(wxGetTopLevelParent(wxTheApp->GetTopWindow()), wxFrame)->GetMenuBar();
bar->Enable(wxID_PREFERENCES, false);
bar->Enable(wxID_EXIT, false);
#endif
}
//
@ -1158,10 +1176,18 @@ ProgressDialog::~ProgressDialog()
Beep();
}
#if defined(__WXMAC__)
wxMenuBar *bar = wxStaticCast(wxGetTopLevelParent(wxTheApp->GetTopWindow()), wxFrame)->GetMenuBar();
bar->Enable(wxID_PREFERENCES, true);
bar->Enable(wxID_EXIT, true);
WindowRef windowRef = (WindowRef) MacGetWindowRef();
EndAppModalStateForWindow(windowRef);
#endif
if (mDisable)
{
delete mDisable;
}
#if defined(__WXGTK__)