1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-19 09:01:15 +02:00

Missing alias file tracking out of AudacityApp, into new files...

... which reduces the need for including AudacityApp.h
This commit is contained in:
Paul Licameli
2019-04-25 16:34:07 -04:00
parent 0ab29d21e9
commit a047fa6e7a
19 changed files with 249 additions and 175 deletions

View File

@@ -12,16 +12,12 @@
\class ErrorDialog
\brief Gives an Error message with an option for help.
*//*****************************************************************//**
\class MissingAliasFileDialog
\brief Special case of ErrorDialog for reporting missing alias files.
*//********************************************************************/
#include "../Audacity.h"
#include "ErrorDialog.h"
#include <wx/app.h>
#include <wx/button.h>
#include <wx/icon.h>
#include <wx/dialog.h>
@@ -37,43 +33,14 @@
#include "../AllThemeResources.h"
#include "../ShuttleGui.h"
#include "../HelpText.h"
#include "../Project.h"
#include "../Prefs.h"
#include "HelpSystem.h"
// special case for alias missing dialog because we keep track of if it exists.
class MissingAliasFileDialog final : public ErrorDialog
{
public:
MissingAliasFileDialog(AudacityProject *parent,
const wxString & dlogTitle,
const wxString & message,
const wxString & helpURL,
const bool Close = true, const bool modal = true);
virtual ~MissingAliasFileDialog();
};
BEGIN_EVENT_TABLE(ErrorDialog, wxDialogWrapper)
EVT_BUTTON( wxID_OK, ErrorDialog::OnOk)
EVT_BUTTON( wxID_HELP, ErrorDialog::OnHelp)
END_EVENT_TABLE()
MissingAliasFileDialog::MissingAliasFileDialog(AudacityProject *parent,
const wxString & dlogTitle,
const wxString & message,
const wxString & helpURL,
const bool Close, const bool modal):
ErrorDialog(parent, dlogTitle, message, helpURL, Close, modal)
{
parent->SetMissingAliasFileDialog(this);
}
MissingAliasFileDialog::~MissingAliasFileDialog()
{
((AudacityProject*)GetParent())->SetMissingAliasFileDialog(NULL);
}
ErrorDialog::ErrorDialog(
wxWindow *parent,
const wxString & dlogTitle,
@@ -202,34 +169,6 @@ void ShowModelessErrorDialog(wxWindow *parent,
// but in practice Destroy() in OnOK does that
}
void ShowMissingAliasFilesDialog(AudacityProject *parent,
const wxString &dlogTitle,
const wxString &message,
const wxString &helpPage,
const bool Close)
{
wxASSERT(parent); // to justify safenew
ErrorDialog *dlog = safenew MissingAliasFileDialog(parent, dlogTitle, message, helpPage, Close, false);
// Don't center because in many cases (effect, export, etc) there will be a progress bar in the center that blocks this.
// instead put it just above or on the top of the project.
wxPoint point;
point.x = 0;
point.y = parent ? parent->GetPosition().y - 200 : 100;
if (point.y < 100)
point.y = 100;
dlog->SetPosition(point);
dlog->CentreOnParent(wxHORIZONTAL);
// This needs to be modeless because user may need to
// stop playback AND read dialog's instructions.
dlog->Show();
// ANSWER-ME: Vigilant Sentry flags this method as not deleting dlog, so a mem leak.
// PRL: answer is that the parent window guarantees destruction of the dialog
// but in practice Destroy() in OnOK does that
}
extern wxString AudacityMessageBoxCaptionStr()
{
return _("Message");

View File

@@ -18,6 +18,8 @@
#include <wx/msgdlg.h> // to inherit
#include "wxPanelWrapper.h" // to inherit
class AliasBlockFile;
class AudacityProject;
class ErrorDialog /* not final */ : public wxDialogWrapper
@@ -56,13 +58,6 @@ void ShowModelessErrorDialog(wxWindow *parent,
const wxString &helpPage,
bool Close = true);
/// Displays a custom modeless error dialog for aliased file errors
void ShowMissingAliasFilesDialog(AudacityProject *parent,
const wxString &dlogTitle,
const wxString &message,
const wxString &helpPage,
const bool Close = true);
extern wxString AudacityMessageBoxCaptionStr();
// Do not use wxMessageBox!! Its default window title does not translate!