1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 15:49:41 +02:00

Fix window closing behavior, remove (bug 151)

This commit is contained in:
BusinessmanProgrammerSteve 2010-04-19 06:03:21 +00:00
parent c6ad77aabe
commit 828481a3c8
4 changed files with 18 additions and 22 deletions

View File

@ -2717,6 +2717,7 @@ void AudacityProject::OnOpen()
void AudacityProject::OnClose()
{
mMenuClose = true;
Close();
}

View File

@ -760,7 +760,8 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
mWantSaveCompressed(false),
mLastEffect(NULL),
mLastEffectType(0),
mTimerRecordCanceled(false)
mTimerRecordCanceled(false),
mMenuClose(false)
{
int widths[] = {-1, 130};
mStatusBar = CreateStatusBar(2);
@ -1898,13 +1899,15 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event)
mLastFocusedWindow = NULL;
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;
#ifdef __WXMAC__
bool defaultQuitOnClose = false;
quitOnClose = false;
#else
bool defaultQuitOnClose = true;
quitOnClose = !mMenuClose;
#endif
gPrefs->Read(wxT("/GUI/QuitOnClose"), &quitOnClose, defaultQuitOnClose);
// DanH: If we're definitely about to quit, delete the clipboard.
// Doing this after Deref'ing the DirManager causes problems.
@ -2012,14 +2015,15 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event)
// common menu.
wxGetApp().mLogger->Show(false);
if (quitOnClose)
QuitAudacity();
else {
#if !defined(__WXMAC__)
if (quitOnClose) {
QuitAudacity();
}
else {
wxGetApp().SetWindowRectAlreadySaved(FALSE);
CreateNewAudacityProject();
#endif
}
#endif
}
Destroy();

View File

@ -557,6 +557,9 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
//flag for cancellation of timer record.
bool mTimerRecordCanceled;
// Are we currently closing as the result of a menu command?
bool mMenuClose;
public:
DECLARE_EVENT_TABLE()
};

View File

@ -78,15 +78,6 @@ void GUIPrefs::Populate()
// ----------------------- 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)
{
S.SetBorder(2);
@ -131,9 +122,6 @@ void GUIPrefs::PopulateOrExchange(ShuttleGui & S)
S.StartStatic(_("Behaviors"));
{
S.TieCheckBox(_("Closing last window &quits Audacity"),
wxT("/GUI/QuitOnClose"),
bQuitOnCloseDefault);
S.TieCheckBox(_("&Beep on completion of longer activities"),
wxT("/GUI/BeepOnCompletion"),
false);