mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-15 15:49:36 +02:00
Fix window closing behavior, remove (bug 151)
This commit is contained in:
parent
c6ad77aabe
commit
828481a3c8
@ -2717,6 +2717,7 @@ void AudacityProject::OnOpen()
|
|||||||
|
|
||||||
void AudacityProject::OnClose()
|
void AudacityProject::OnClose()
|
||||||
{
|
{
|
||||||
|
mMenuClose = true;
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -760,7 +760,8 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
|
|||||||
mWantSaveCompressed(false),
|
mWantSaveCompressed(false),
|
||||||
mLastEffect(NULL),
|
mLastEffect(NULL),
|
||||||
mLastEffectType(0),
|
mLastEffectType(0),
|
||||||
mTimerRecordCanceled(false)
|
mTimerRecordCanceled(false),
|
||||||
|
mMenuClose(false)
|
||||||
{
|
{
|
||||||
int widths[] = {-1, 130};
|
int widths[] = {-1, 130};
|
||||||
mStatusBar = CreateStatusBar(2);
|
mStatusBar = CreateStatusBar(2);
|
||||||
@ -1898,13 +1899,15 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event)
|
|||||||
mLastFocusedWindow = NULL;
|
mLastFocusedWindow = NULL;
|
||||||
mIsDeleting = true;
|
mIsDeleting = true;
|
||||||
|
|
||||||
|
// Mac: we never quit as the result of a close.
|
||||||
|
// Other systems: we quit only when the close is the result of an external
|
||||||
|
// command (on Windows, those are taskbar closes, "X" box, Alt+F4, etc.)
|
||||||
bool quitOnClose;
|
bool quitOnClose;
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
bool defaultQuitOnClose = false;
|
quitOnClose = false;
|
||||||
#else
|
#else
|
||||||
bool defaultQuitOnClose = true;
|
quitOnClose = !mMenuClose;
|
||||||
#endif
|
#endif
|
||||||
gPrefs->Read(wxT("/GUI/QuitOnClose"), &quitOnClose, defaultQuitOnClose);
|
|
||||||
|
|
||||||
// DanH: If we're definitely about to quit, delete the clipboard.
|
// DanH: If we're definitely about to quit, delete the clipboard.
|
||||||
// Doing this after Deref'ing the DirManager causes problems.
|
// Doing this after Deref'ing the DirManager causes problems.
|
||||||
@ -2012,14 +2015,15 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event)
|
|||||||
// common menu.
|
// common menu.
|
||||||
wxGetApp().mLogger->Show(false);
|
wxGetApp().mLogger->Show(false);
|
||||||
|
|
||||||
if (quitOnClose)
|
|
||||||
QuitAudacity();
|
|
||||||
else {
|
|
||||||
#if !defined(__WXMAC__)
|
#if !defined(__WXMAC__)
|
||||||
wxGetApp().SetWindowRectAlreadySaved(FALSE);
|
if (quitOnClose) {
|
||||||
CreateNewAudacityProject();
|
QuitAudacity();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
wxGetApp().SetWindowRectAlreadySaved(FALSE);
|
||||||
|
CreateNewAudacityProject();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Destroy();
|
Destroy();
|
||||||
|
@ -557,6 +557,9 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
|
|||||||
//flag for cancellation of timer record.
|
//flag for cancellation of timer record.
|
||||||
bool mTimerRecordCanceled;
|
bool mTimerRecordCanceled;
|
||||||
|
|
||||||
|
// Are we currently closing as the result of a menu command?
|
||||||
|
bool mMenuClose;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
@ -78,15 +78,6 @@ void GUIPrefs::Populate()
|
|||||||
// ----------------------- End of main section --------------
|
// ----------------------- End of main section --------------
|
||||||
}
|
}
|
||||||
|
|
||||||
// Code duplication warning: this default is repeated in Project.cpp
|
|
||||||
// in the destructor. -DMM
|
|
||||||
#ifdef __WXMAC__
|
|
||||||
const bool bQuitOnCloseDefault = false;
|
|
||||||
#else
|
|
||||||
const bool bQuitOnCloseDefault = true;
|
|
||||||
#endif
|
|
||||||
// End code duplication warning
|
|
||||||
|
|
||||||
void GUIPrefs::PopulateOrExchange(ShuttleGui & S)
|
void GUIPrefs::PopulateOrExchange(ShuttleGui & S)
|
||||||
{
|
{
|
||||||
S.SetBorder(2);
|
S.SetBorder(2);
|
||||||
@ -131,9 +122,6 @@ void GUIPrefs::PopulateOrExchange(ShuttleGui & S)
|
|||||||
|
|
||||||
S.StartStatic(_("Behaviors"));
|
S.StartStatic(_("Behaviors"));
|
||||||
{
|
{
|
||||||
S.TieCheckBox(_("Closing last window &quits Audacity"),
|
|
||||||
wxT("/GUI/QuitOnClose"),
|
|
||||||
bQuitOnCloseDefault);
|
|
||||||
S.TieCheckBox(_("&Beep on completion of longer activities"),
|
S.TieCheckBox(_("&Beep on completion of longer activities"),
|
||||||
wxT("/GUI/BeepOnCompletion"),
|
wxT("/GUI/BeepOnCompletion"),
|
||||||
false);
|
false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user