mirror of
https://github.com/cookiengineer/audacity
synced 2026-02-07 20:22:13 +01:00
Fixed bugs with MultiDialog. Fixed Bug with prompting about modules.
Previously MultiDialog attempted to centre on parent dialog, but there was a NULL parent. Now the application top window is used. Dialog shows centred, for example when there are missing block files. If the top window is a WX_STAY_ON_TOP, we move our dialog to the left, as otherwise it would be partially hidden. Previously Audacity would ask about enabling a module whilst the splash screen was showing. For some as yet undetermined reason the MultiDialog and Splash Screen are incompatible. Possibly it's related to doing a ShowModal before a full application exists. The not ideal workaround is to now delay showing the splash screen until after the modules have been loaded.
This commit is contained in:
@@ -36,7 +36,8 @@ for each problem encountered, since there can be many orphans.
|
||||
class MultiDialog : public wxDialog
|
||||
{
|
||||
public:
|
||||
MultiDialog(wxString message,
|
||||
MultiDialog(wxWindow * pParent,
|
||||
wxString message,
|
||||
wxString title,
|
||||
const wxChar **buttons, wxString boxMsg, bool log);
|
||||
~MultiDialog() {};
|
||||
@@ -57,10 +58,11 @@ BEGIN_EVENT_TABLE(MultiDialog, wxDialog)
|
||||
EVT_BUTTON(ID_SHOW_LOG_BUTTON, MultiDialog::OnShowLog)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
MultiDialog::MultiDialog(wxString message,
|
||||
MultiDialog::MultiDialog(wxWindow * pParent,
|
||||
wxString message,
|
||||
wxString title,
|
||||
const wxChar **buttons, wxString boxMsg, bool log)
|
||||
: wxDialog(NULL, (wxWindowID)-1, title,
|
||||
: wxDialog(pParent, wxID_ANY, title,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxCAPTION) // not wxDEFAULT_DIALOG_STYLE because we don't want wxCLOSE_BOX and wxSYSTEM_MENU
|
||||
{
|
||||
@@ -140,11 +142,25 @@ void MultiDialog::OnShowLog(wxCommandEvent & WXUNUSED(event))
|
||||
|
||||
|
||||
int ShowMultiDialog(wxString message,
|
||||
wxString title,
|
||||
const wxChar **buttons, wxString boxMsg, bool log)
|
||||
wxString title,
|
||||
const wxChar **buttons, wxString boxMsg, bool log)
|
||||
{
|
||||
MultiDialog dlog(message, title, buttons, boxMsg, log);
|
||||
dlog.CentreOnParent();
|
||||
wxWindow * pParent = wxGetApp().GetTopWindow();
|
||||
if (pParent) {
|
||||
if ((pParent->GetWindowStyle() & wxSTAY_ON_TOP) == wxSTAY_ON_TOP)
|
||||
pParent = NULL;
|
||||
}
|
||||
MultiDialog dlog(pParent,
|
||||
message, title, buttons, boxMsg, log);
|
||||
// If dialog does not have a parent, cannot be centred on it.
|
||||
if (pParent != NULL)
|
||||
dlog.CentreOnParent();
|
||||
else {
|
||||
dlog.CenterOnScreen();
|
||||
wxPoint Pos = dlog.GetPosition() + wxPoint(-300, -10);
|
||||
dlog.Move(Pos);
|
||||
dlog;
|
||||
}
|
||||
return dlog.ShowModal();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user