1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-01 16:19:43 +02:00

Fix merge problem

This commit is contained in:
Leland Lucius 2015-07-28 15:23:30 -05:00
parent 37168ebbf6
commit 7687972aa4

View File

@ -126,7 +126,9 @@ It handles initialization and termination by subclassing wxApp.
// Windows specific linker control...only needed once so
// this is a good place (unless we want to add another file).
#if defined(__WXMSW__)
//#if wxCHECK_VERSION(3, 0, 2) && !wxCHECK_VERSION(3, 1, 0)
#include <wx/init.h>
//#endif
// These lines ensure that Audacity gets WindowsXP themes.
// Without them we get the old-style Windows98/2000 look under XP.
# if !defined(__WXWINCE__)
@ -210,6 +212,15 @@ It handles initialization and termination by subclassing wxApp.
# if defined(EXPERIMENTAL_CRASH_REPORT)
# pragma comment(lib, "wxmsw" V "u" D "_qa")
# endif
# pragma comment(lib, "wxbase" V "u" D)
# pragma comment(lib, "wxbase" V "u" D "_net.lib")
# pragma comment(lib, "wxmsw" V "u" D "_adv.lib")
# pragma comment(lib, "wxmsw" V "u" D "_core.lib")
# pragma comment(lib, "wxmsw" V "u" D "_html.lib")
# pragma comment(lib, "wxpng" D)
# pragma comment(lib, "wxzlib" D)
# pragma comment(lib, "wxjpeg" D)
# pragma comment(lib, "wxtiff" D)
# undef V
# undef D
@ -223,9 +234,6 @@ It handles initialization and termination by subclassing wxApp.
////////////////////////////////////////////////////////////
DEFINE_EVENT_TYPE(EVT_OPEN_AUDIO_FILE);
DEFINE_EVENT_TYPE(EVT_CAPTURE_KEYBOARD);
DEFINE_EVENT_TYPE(EVT_RELEASE_KEYBOARD);
DEFINE_EVENT_TYPE(EVT_CAPTURE_KEY);
#ifdef __WXGTK__
static void wxOnAssert(const wxChar *fileName, int lineNumber, const wxChar *msg)
@ -244,8 +252,6 @@ static void wxOnAssert(const wxChar *fileName, int lineNumber, const wxChar *msg
}
#endif
static wxFrame *gParentFrame = NULL;
static bool gInited = false;
bool gIsQuitting = false;
@ -256,6 +262,8 @@ void QuitAudacity(bool bForce)
gIsQuitting = true;
wxTheApp->SetExitOnFrameDelete(true);
// Try to close each open window. If the user hits Cancel
// in a Save Changes dialog, don't continue.
// BG: unless force is true
@ -290,14 +298,8 @@ void QuitAudacity(bool bForce)
}
}
LWSlider::DeleteSharedTipPanel();
ModuleManager::Get().Dispatch(AppQuiting);
if (gParentFrame)
gParentFrame->Destroy();
gParentFrame = NULL;
#ifdef EXPERIMENTAL_SCOREALIGN
CloseScoreAlignDialog();
#endif
@ -649,12 +651,12 @@ public:
};
};
#ifndef __WXMAC__
#if !defined(__WXMAC__) && !defined(__WXMSW__)
IMPLEMENT_APP(AudacityApp)
/* make the application class known to wxWidgets for dynamic construction */
#endif
#ifdef __WXMAC__
#if defined(__WXMAC__) || defined(__WXMSW__)
// This should be removed when Lame and FFmpeg support is converted
// from loadable libraries to commands.
//
@ -669,6 +671,8 @@ IMPLEMENT_APP(AudacityApp)
// one tried.
IMPLEMENT_APP_NO_MAIN(AudacityApp)
IMPLEMENT_WX_THEME_SUPPORT
#if defined(__WXMAC__)
int main(int argc, char *argv[])
{
if (getenv("DYLD_LIBRARY_PATH")) {
@ -677,8 +681,31 @@ int main(int argc, char *argv[])
unsetenv("DYLD_LIBRARY_PATH");
execve(argv[0], argv, environ);
}
wxDISABLE_DEBUG_SUPPORT();
return wxEntry(argc, argv);
}
#elif defined(__WXMSW__)
extern "C" int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
wxCmdLineArgType WXUNUSED(lpCmdLine),
int nCmdShow)
{
wxDISABLE_DEBUG_SUPPORT();
// Disable setting of HiDPI aware mode
wxMSWDisableSettingHighDPIAware();
/* NB: We pass NULL in place of lpCmdLine to behave the same as */
/* Borland-specific wWinMain() above. If it becomes needed */
/* to pass lpCmdLine to wxEntry() here, you'll have to fix */
/* wWinMain() above too. */
return wxEntry(hInstance, hPrevInstance, NULL, nCmdShow);
}
#endif
#endif
#ifdef __WXMAC__
@ -988,11 +1015,12 @@ void AudacityApp::InitLang( const wxString & lang )
wxSetEnv(wxT("LANG"), wxT("en_US.UTF-8"));
#endif
#if wxCHECK_VERSION(3,0,0)
mLocale = new wxLocale(wxT(""), lang, wxT(""), true);
#else
mLocale = new wxLocale(wxT(""), lang, wxT(""), true, true);
#endif
const wxLanguageInfo *info = wxLocale::FindLanguageInfo(lang);
if (!lang)
{
return;
}
mLocale = new wxLocale(info->Language);
for(unsigned int i=0; i<audacityPathList.GetCount(); i++)
mLocale->AddCatalogLookupPathPrefix(audacityPathList[i]);
@ -1076,16 +1104,16 @@ void AudacityApp::GenerateCrashReport(wxDebugReport::Context ctx)
}
#endif
#if defined(__WXGTK__)
// On wxGTK, there's a focus issue where dialogs do not automatically pass focus
// to the first child. This means that you can use the keyboard to navigate within
// the dialog. Watching for the ACTIVATE event allows us to set the focus ourselves
// when each dialog opens.
//
// See bug #57
//
int AudacityApp::FilterEvent(wxEvent & event)
{
#if !wxCHECK_VERSION(3, 0, 0) && defined(__WXGTK__)
// On wxGTK, there's a focus issue where dialogs do not automatically pass focus
// to the first child. This means that you can use the keyboard to navigate within
// the dialog. Watching for the ACTIVATE event allows us to set the focus ourselves
// when each dialog opens.
//
// See bug #57
//
if (event.GetEventType() == wxEVT_ACTIVATE)
{
wxActivateEvent & e = (wxActivateEvent &) event;
@ -1095,11 +1123,12 @@ int AudacityApp::FilterEvent(wxEvent & event)
((wxWindow *)e.GetEventObject())->SetFocus();
}
}
return -1;
}
break;
#endif
return Event_Skip;
}
AudacityApp::AudacityApp()
{
// Do not capture crashes in debug builds
@ -1116,6 +1145,9 @@ AudacityApp::AudacityApp()
// main frame
bool AudacityApp::OnInit()
{
// Ensure we have an event loop during initialization
wxEventLoopGuarantor eventLoop;
delete wxLog::SetActiveTarget(new AudacityLogger);
mLocale = NULL;
@ -1126,11 +1158,6 @@ bool AudacityApp::OnInit()
mChecker = NULL;
mIPCServ = NULL;
#if defined(__WXGTK__)
// Workaround for bug 154 -- initialize to false
inKbdHandler = false;
#endif
#if defined(__WXMAC__)
// Disable window animation
wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 );
@ -1280,15 +1307,6 @@ bool AudacityApp::OnInit()
// If we're waiitng in a dialog before then we can very easily
// start multiple instances, defeating the single instance checker.
//JKC We'd like to initialise the module manager WHILE showing the splash screen.
//Can't in wx3.0.1 as MultiDialog interacts poorly with the splash screen. So we do it before.
//TODO: Find out why opening a multidialog wrecks the splash screen.
//best current guess is that it's something to do with doing a DoModal this early
//in the program.
// Initialize the CommandHandler
InitCommandHandler();
@ -1298,64 +1316,6 @@ bool AudacityApp::OnInit()
// Initialize the ModuleManager, including loading found modules
ModuleManager::Get().Initialize(*mCmdHandler);
#if !wxCHECK_VERSION(3, 0, 0)
FinishInits();
#endif
return TRUE;
}
#if wxCHECK_VERSION(3, 0, 0)
#include <wx/evtloop.h>
static bool bInitsDone = false;
void AudacityApp::OnEventLoopEnter(wxEventLoopBase * pLoop)
{
if( !pLoop->IsMain() )
return;
if (bInitsDone)
return;
bInitsDone = true;
FinishInits();
}
#endif
// JKC: I've split 'FinishInits()' from 'OnInit()', so that
// we can have a real event loop running. We could (I think)
// put everything that is in OnInit() in here.
// This change was to support wxWidgets 3.0.0 and allow us
// to show a dialog (for module loading) during initialisation.
// without it messing up the splash screen.
// Hasn't actually fixed that yet, but is addressing the point
// they make in their release notes.
void AudacityApp::FinishInits()
{
// Until we are ready for wxWidgets 3.x, put a warning dialog up.
// Our problem is that distros may ship with 3.x builds as default.
// We are saying, don't.
//
// wx3 is Ok for experimental builds.
//
// Deliberately not translated. People can search for the english error
// text for more details. This error will only show in versions
// of Audacity that were incorrectly built.
//
// The intention was to do this, if needed, as part of the splash screen.
// However the splash screen is one of the things broken by wx3.0
// changes in OnInit handling. We also can't put this dialog earlier.
#if wxCHECK_VERSION(3, 0, 0)
ShowErrorDialog( NULL,
wxT("Bad Version"),
wxT(
"Audacity should be built with wxWidgets 2.8.12.\n\n This version \
of Audacity (") AUDACITY_VERSION_STRING wxT(") is using ") wxVERSION_STRING \
wxT( ".\n We're not ready for that version of wxWidgets yet.\n\n \
Click the 'Help' button for known issues."),
wxT("http://wiki.audacityteam.org/wiki/Incorrect_wxWidgets_Version"),
true);
#endif
// Parse command line and handle options that might require
// immediate exit...no need to initialize all of the audio
// stuff to display the version string.
@ -1405,9 +1365,6 @@ Click the 'Help' button for known issues."),
exit(1);
}
// No Splash screen on wx3 whislt we sort out the problem
// with showing a dialog AND a splash screen during inits.
#if !wxCHECK_VERSION(3, 0, 0)
// BG: Create a temporary window to set as the top window
wxImage logoimage((const char **) AudacityLogoWithName_xpm);
logoimage.Rescale(logoimage.GetWidth() / 2, logoimage.GetHeight() / 2);
@ -1424,7 +1381,7 @@ Click the 'Help' button for known issues."),
wxSTAY_ON_TOP);
temporarywindow->SetTitle(_("Audacity is starting up..."));
SetTopWindow(temporarywindow);
#endif
wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI);
//JKC: Would like to put module loading here.
@ -1454,15 +1411,10 @@ Click the 'Help' button for known issues."),
mRecentFiles->UseMenu(recentMenu);
mRecentFiles->AddFilesToMenu(recentMenu);
// This invisibale frame will be the "root" of all other frames and will
// become the active frame when no projects are open.
gParentFrame = new wxFrame(NULL, -1, wxEmptyString, wxPoint(0, 0), wxSize(0, 0), 0);
SetExitOnFrameDelete(false);
#endif //__WXMAC__
SetExitOnFrameDelete(true);
AudacityProject *project = CreateNewAudacityProject();
mCmdHandler->SetProject(project);
wxWindow * pWnd = MakeHijackPanel() ;
@ -1474,11 +1426,8 @@ Click the 'Help' button for known issues."),
pWnd->Show( true );
}
#if !wxCHECK_VERSION(3, 0, 0)
temporarywindow->Show(false);
delete temporarywindow;
#endif
if( project->mShowSplashScreen )
project->OnHelpWelcome();
@ -1506,7 +1455,7 @@ Click the 'Help' button for known issues."),
DirManager::SetDontDeleteTempFiles();
delete parser;
QuitAudacity(true);
return;
return false;
}
//
@ -1519,7 +1468,7 @@ Click the 'Help' button for known issues."),
delete parser;
RunBenchmark(NULL);
return;
return false;
}
for (size_t i = 0, cnt = parser->GetParamCount(); i < cnt; i++)
@ -1538,6 +1487,8 @@ Click the 'Help' button for known issues."),
mTimer.SetOwner(this, kAudacityAppTimerID);
mTimer.Start(200);
return TRUE;
}
void AudacityApp::InitCommandHandler()
@ -1613,6 +1564,7 @@ bool AudacityApp::InitTempDir()
// Failed
wxMessageBox(_("Audacity could not find a place to store temporary files.\nPlease enter an appropriate directory in the preferences dialog."));
PrefsDialog dialog(NULL);
// Only want one page of the preferences
DirectoriesPrefsFactory directoriesPrefsFactory;
PrefsDialog::Factories factories;