1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-03-07 15:05:38 +01:00

Stack-allocate where possible! ...

... Removed many unnecessary naked news and deletes.
This commit is contained in:
Paul Licameli
2016-01-31 20:39:24 -05:00
parent be1d9b7dd5
commit dbaa811577
43 changed files with 785 additions and 839 deletions

View File

@@ -1159,7 +1159,7 @@ bool AudacityApp::OnInit()
#if defined(__WXMAC__)
// Disable window animation
wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 );
wxSystemOptions::SetOption(wxMAC_WINDOW_PLAIN_TRANSITION, 1);
#endif
#ifdef AUDACITY_NAME
@@ -1203,32 +1203,32 @@ bool AudacityApp::OnInit()
#ifdef AUDACITY_NAME
AddUniquePathToPathList(wxString::Format(wxT("%s/.%s-files"),
home.c_str(), wxT(AUDACITY_NAME)),
audacityPathList);
home.c_str(), wxT(AUDACITY_NAME)),
audacityPathList);
AddUniquePathToPathList(wxString::Format(wxT("%s/share/%s"),
wxT(INSTALL_PREFIX), wxT(AUDACITY_NAME)),
audacityPathList);
wxT(INSTALL_PREFIX), wxT(AUDACITY_NAME)),
audacityPathList);
AddUniquePathToPathList(wxString::Format(wxT("%s/share/doc/%s"),
wxT(INSTALL_PREFIX), wxT(AUDACITY_NAME)),
audacityPathList);
wxT(INSTALL_PREFIX), wxT(AUDACITY_NAME)),
audacityPathList);
#else //AUDACITY_NAME
AddUniquePathToPathList(wxString::Format(wxT("%s/.audacity-files"),
home.c_str()),
audacityPathList);
home.c_str()),
audacityPathList);
AddUniquePathToPathList(wxString::Format(wxT("%s/share/audacity"),
wxT(INSTALL_PREFIX)),
audacityPathList);
wxT(INSTALL_PREFIX)),
audacityPathList);
AddUniquePathToPathList(wxString::Format(wxT("%s/share/doc/audacity"),
wxT(INSTALL_PREFIX)),
audacityPathList);
wxT(INSTALL_PREFIX)),
audacityPathList);
#endif //AUDACITY_NAME
AddUniquePathToPathList(wxString::Format(wxT("%s/share/locale"),
wxT(INSTALL_PREFIX)),
audacityPathList);
wxT(INSTALL_PREFIX)),
audacityPathList);
AddUniquePathToPathList(wxString::Format(wxT("./locale")),
audacityPathList);
audacityPathList);
#endif //__WXGTK__
@@ -1242,12 +1242,12 @@ bool AudacityApp::OnInit()
// On Windows, the path to the Audacity program is in argv[0]
wxString progPath = wxPathOnly(argv[0]);
AddUniquePathToPathList(progPath, audacityPathList);
AddUniquePathToPathList(progPath+wxT("\\Languages"), audacityPathList);
AddUniquePathToPathList(progPath + wxT("\\Languages"), audacityPathList);
// See bug #1271 for explanation of location
tmpDirLoc = FileNames::MkDir(wxStandardPaths::Get().GetUserLocalDataDir());
defaultTempDir.Printf(wxT("%s\\SessionData"),
tmpDirLoc.c_str());
tmpDirLoc.c_str());
#endif //__WXWSW__
#ifdef __WXMAC__
@@ -1257,15 +1257,15 @@ bool AudacityApp::OnInit()
AddUniquePathToPathList(progPath, audacityPathList);
// If Audacity is a "bundle" package, then the root directory is
// the great-great-grandparent of the directory containing the executable.
AddUniquePathToPathList(progPath+wxT("/../../../"), audacityPathList);
AddUniquePathToPathList(progPath + wxT("/../../../"), audacityPathList);
// These allow for searching the "bundle"
AddUniquePathToPathList(progPath+wxT("/../"), audacityPathList);
AddUniquePathToPathList(progPath+wxT("/../Resources"), audacityPathList);
AddUniquePathToPathList(progPath + wxT("/../"), audacityPathList);
AddUniquePathToPathList(progPath + wxT("/../Resources"), audacityPathList);
defaultTempDir.Printf(wxT("%s/audacity-%s"),
tmpDirLoc.c_str(),
wxGetUserId().c_str());
tmpDirLoc.c_str(),
wxGetUserId().c_str());
#endif //__WXMAC__
// Define languanges for which we have translations, but that are not yet
@@ -1283,9 +1283,9 @@ bool AudacityApp::OnInit()
// Initialize preferences and language
InitPreferences();
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) && !defined(__CYGWIN__)
this->AssociateFileTypes();
#endif
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) && !defined(__CYGWIN__)
this->AssociateFileTypes();
#endif
// TODO - read the number of files to store in history from preferences
mRecentFiles = new FileHistory(ID_RECENT_LAST - ID_RECENT_FIRST + 1, ID_RECENT_CLEAR);
@@ -1303,10 +1303,10 @@ bool AudacityApp::OnInit()
return false;
}
//<<<< Try to avoid dialogs before this point.
// The reason is that InitTempDir starts the single instance checker.
// If we're waiitng in a dialog before then we can very easily
// start multiple instances, defeating the single instance checker.
//<<<< Try to avoid dialogs before this point.
// The reason is that InitTempDir starts the single instance checker.
// If we're waiitng in a dialog before then we can very easily
// start multiple instances, defeating the single instance checker.
// Initialize the CommandHandler
InitCommandHandler();
@@ -1367,68 +1367,70 @@ bool AudacityApp::OnInit()
}
// BG: Create a temporary window to set as the top window
wxImage logoimage((const char **) AudacityLogoWithName_xpm);
wxImage logoimage((const char **)AudacityLogoWithName_xpm);
logoimage.Rescale(logoimage.GetWidth() / 2, logoimage.GetHeight() / 2);
wxBitmap logo(logoimage);
wxSplashScreen *temporarywindow =
new wxSplashScreen(logo,
wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_NO_TIMEOUT,
0,
NULL,
wxID_ANY,
wxDefaultPosition,
wxDefaultSize,
wxSTAY_ON_TOP);
temporarywindow->SetTitle(_("Audacity is starting up..."));
SetTopWindow(temporarywindow);
wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI);
AudacityProject *project;
{
wxSplashScreen temporarywindow(
logo,
wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_NO_TIMEOUT,
0,
NULL,
wxID_ANY,
wxDefaultPosition,
wxDefaultSize,
wxSTAY_ON_TOP);
temporarywindow.SetTitle(_("Audacity is starting up..."));
SetTopWindow(&temporarywindow);
wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI);
//JKC: Would like to put module loading here.
//JKC: Would like to put module loading here.
// More initialization
// More initialization
InitDitherers();
InitAudioIO();
InitDitherers();
InitAudioIO();
#ifdef __WXMAC__
// On the Mac, users don't expect a program to quit when you close the last window.
// Create a menubar that will show when all project windows are closed.
// On the Mac, users don't expect a program to quit when you close the last window.
// Create a menubar that will show when all project windows are closed.
wxMenu *fileMenu = new wxMenu();
wxMenu *recentMenu = new wxMenu();
fileMenu->Append(wxID_NEW, wxString(_("&New")) + wxT("\tCtrl+N"));
fileMenu->Append(wxID_OPEN, wxString(_("&Open...")) + wxT("\tCtrl+O"));
fileMenu->AppendSubMenu(recentMenu, _("Open &Recent..."));
fileMenu->Append(wxID_ABOUT, _("&About Audacity..."));
fileMenu->Append(wxID_PREFERENCES, wxString(_("&Preferences...")) + wxT("\tCtrl+,"));
wxMenu *fileMenu = new wxMenu();
wxMenu *recentMenu = new wxMenu();
fileMenu->Append(wxID_NEW, wxString(_("&New")) + wxT("\tCtrl+N"));
fileMenu->Append(wxID_OPEN, wxString(_("&Open...")) + wxT("\tCtrl+O"));
fileMenu->AppendSubMenu(recentMenu, _("Open &Recent..."));
fileMenu->Append(wxID_ABOUT, _("&About Audacity..."));
fileMenu->Append(wxID_PREFERENCES, wxString(_("&Preferences...")) + wxT("\tCtrl+,"));
wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(fileMenu, _("&File"));
wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(fileMenu, _("&File"));
wxMenuBar::MacSetCommonMenuBar(menuBar);
wxMenuBar::MacSetCommonMenuBar(menuBar);
mRecentFiles->UseMenu(recentMenu);
mRecentFiles->AddFilesToMenu(recentMenu);
mRecentFiles->UseMenu(recentMenu);
mRecentFiles->AddFilesToMenu(recentMenu);
SetExitOnFrameDelete(false);
SetExitOnFrameDelete(false);
#endif //__WXMAC__
AudacityProject *project = CreateNewAudacityProject();
mCmdHandler->SetProject(project);
wxWindow * pWnd = MakeHijackPanel() ;
if( pWnd )
{
project->Show( false );
pWnd->SetParent( project );
SetTopWindow(pWnd);
pWnd->Show( true );
}
project = CreateNewAudacityProject();
mCmdHandler->SetProject(project);
wxWindow * pWnd = MakeHijackPanel();
if (pWnd)
{
project->Show(false);
pWnd->SetParent(project);
SetTopWindow(pWnd);
pWnd->Show(true);
}
temporarywindow->Show(false);
delete temporarywindow;
temporarywindow.Show(false);
}
if( project->mShowSplashScreen )
project->OnHelpWelcome();