mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 16:10:06 +02:00
Don't call QuitAudacity directly from src/menus...
... This cuts link dependency on AudacityApp.cpp, and allows the function to be private to that file
This commit is contained in:
parent
187e3be0d6
commit
6cde697a8e
@ -109,9 +109,6 @@
|
|||||||
|
|
||||||
class wxWindow;
|
class wxWindow;
|
||||||
|
|
||||||
void QuitAudacity(bool bForce);
|
|
||||||
void QuitAudacity();
|
|
||||||
|
|
||||||
// Please try to support unlimited path length instead of using PLATFORM_MAX_PATH!
|
// Please try to support unlimited path length instead of using PLATFORM_MAX_PATH!
|
||||||
// Define one constant for maximum path value, so we don't have to do
|
// Define one constant for maximum path value, so we don't have to do
|
||||||
// platform-specific conditionals everywhere we want to check it.
|
// platform-specific conditionals everywhere we want to check it.
|
||||||
|
@ -266,7 +266,7 @@ static void wxOnAssert(const wxChar *fileName, int lineNumber, const wxChar *msg
|
|||||||
static bool gInited = false;
|
static bool gInited = false;
|
||||||
static bool gIsQuitting = false;
|
static bool gIsQuitting = false;
|
||||||
|
|
||||||
void QuitAudacity(bool bForce)
|
static void QuitAudacity(bool bForce)
|
||||||
{
|
{
|
||||||
// guard against recursion
|
// guard against recursion
|
||||||
if (gIsQuitting)
|
if (gIsQuitting)
|
||||||
@ -323,7 +323,7 @@ void QuitAudacity(bool bForce)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuitAudacity()
|
static void QuitAudacity()
|
||||||
{
|
{
|
||||||
QuitAudacity(false);
|
QuitAudacity(false);
|
||||||
}
|
}
|
||||||
@ -647,9 +647,14 @@ BEGIN_EVENT_TABLE(AudacityApp, wxApp)
|
|||||||
EVT_MENU(wxID_OPEN, AudacityApp::OnMenuOpen)
|
EVT_MENU(wxID_OPEN, AudacityApp::OnMenuOpen)
|
||||||
EVT_MENU(wxID_ABOUT, AudacityApp::OnMenuAbout)
|
EVT_MENU(wxID_ABOUT, AudacityApp::OnMenuAbout)
|
||||||
EVT_MENU(wxID_PREFERENCES, AudacityApp::OnMenuPreferences)
|
EVT_MENU(wxID_PREFERENCES, AudacityApp::OnMenuPreferences)
|
||||||
EVT_MENU(wxID_EXIT, AudacityApp::OnMenuExit)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Associate the handler with the menu id on all operating systems, even
|
||||||
|
// if they don't have an application menu bar like in macOS, so that
|
||||||
|
// other parts of the program can send the application a shut-down
|
||||||
|
// event
|
||||||
|
EVT_MENU(wxID_EXIT, AudacityApp::OnMenuExit)
|
||||||
|
|
||||||
#ifndef __WXMSW__
|
#ifndef __WXMSW__
|
||||||
EVT_SOCKET(ID_IPC_SERVER, AudacityApp::OnServerEvent)
|
EVT_SOCKET(ID_IPC_SERVER, AudacityApp::OnServerEvent)
|
||||||
EVT_SOCKET(ID_IPC_SOCKET, AudacityApp::OnSocketEvent)
|
EVT_SOCKET(ID_IPC_SOCKET, AudacityApp::OnSocketEvent)
|
||||||
|
@ -39,9 +39,6 @@ class AppCommandEvent;
|
|||||||
class AudacityLogger;
|
class AudacityLogger;
|
||||||
class AudacityProject;
|
class AudacityProject;
|
||||||
|
|
||||||
void QuitAudacity(bool bForce);
|
|
||||||
void QuitAudacity();
|
|
||||||
|
|
||||||
class AliasBlockFile;
|
class AliasBlockFile;
|
||||||
|
|
||||||
class AudacityApp final : public wxApp {
|
class AudacityApp final : public wxApp {
|
||||||
|
@ -2784,7 +2784,9 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event)
|
|||||||
|
|
||||||
#if !defined(__WXMAC__)
|
#if !defined(__WXMAC__)
|
||||||
if (quitOnClose) {
|
if (quitOnClose) {
|
||||||
QuitAudacity();
|
// Simulate the application Exit menu item
|
||||||
|
wxCommandEvent evt{ wxEVT_MENU, wxID_EXIT };
|
||||||
|
wxTheApp->AddPendingEvent( evt );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
AllProjects::Reset();
|
AllProjects::Reset();
|
||||||
|
@ -542,7 +542,9 @@ void OnPrint(const CommandContext &context)
|
|||||||
|
|
||||||
void OnExit(const CommandContext &WXUNUSED(context) )
|
void OnExit(const CommandContext &WXUNUSED(context) )
|
||||||
{
|
{
|
||||||
QuitAudacity();
|
// Simulate the application Exit menu item
|
||||||
|
wxCommandEvent evt{ wxEVT_MENU, wxID_EXIT };
|
||||||
|
wxTheApp->AddPendingEvent( evt );
|
||||||
}
|
}
|
||||||
|
|
||||||
}; // struct Handler
|
}; // struct Handler
|
||||||
|
@ -457,7 +457,11 @@ void OnTimerRecord(const CommandContext &context)
|
|||||||
// No action required
|
// No action required
|
||||||
break;
|
break;
|
||||||
case POST_TIMER_RECORD_CLOSE:
|
case POST_TIMER_RECORD_CLOSE:
|
||||||
wxTheApp->CallAfter( []{ QuitAudacity(); } );
|
wxTheApp->CallAfter( []{
|
||||||
|
// Simulate the application Exit menu item
|
||||||
|
wxCommandEvent evt{ wxEVT_MENU, wxID_EXIT };
|
||||||
|
wxTheApp->AddPendingEvent( evt );
|
||||||
|
} );
|
||||||
break;
|
break;
|
||||||
case POST_TIMER_RECORD_RESTART:
|
case POST_TIMER_RECORD_RESTART:
|
||||||
// Restart System
|
// Restart System
|
||||||
|
Loading…
x
Reference in New Issue
Block a user