Put all the Make* functions into a single .h/.cpp file (yes, kinda like the way it was), and add Make* functions for DialogDrivers. This means there's only one object that's affected by drivers being added/removed. (Driver default changes are a little different -- 2 or 3 objects.) Also one or two minor cleanups. (note: I apparently don't know much about CVS, it appears that some files might not make it into the repository; hang tight, I'm trying to find a solution.)

This commit is contained in:
Ben Anderson
2005-03-15 00:30:26 +00:00
parent 8362e44d72
commit 167e5aebc0
26 changed files with 15 additions and 455 deletions
+2 -32
View File
@@ -5,7 +5,7 @@
#include "RageUtil.h"
#include "RageLog.h"
#include "Selector_Dialog.h"
#include "arch/arch.h"
static DialogDriver *g_pImpl = NULL;
static DialogDriver_Null g_NullDriver;
@@ -17,37 +17,7 @@ void Dialog::Init()
if( g_pImpl != NULL )
return;
CString drivers = "win32,cocoa,null";
CStringArray DriversToTry;
split(drivers, ",", DriversToTry, true);
ASSERT( DriversToTry.size() != 0 );
CString Driver;
for( unsigned i = 0; g_pImpl == NULL && i < DriversToTry.size(); ++i )
{
Driver = DriversToTry[i];
#if defined(USE_DIALOG_DRIVER_WIN32)
if( !DriversToTry[i].CompareNoCase("Win32") ) g_pImpl = new DialogDriver_Win32;
#endif
#if defined(USE_DIALOG_DRIVER_COCOA)
if( !DriversToTry[i].CompareNoCase("Cocoa") ) g_pImpl = new DialogDriver_Cocoa;
#endif
#if defined(USE_DIALOG_DRIVER_NULL)
if( !DriversToTry[i].CompareNoCase("Null") ) g_pImpl = new DialogDriver_Null;
#endif
if( g_pImpl == NULL )
continue;
CString sError = g_pImpl->Init();
if( sError != "" )
{
if( LOG )
LOG->Info( "Couldn't load driver %s: %s", DriversToTry[i].c_str(), sError.c_str() );
SAFE_DELETE( g_pImpl );
}
}
g_pImpl = MakeDialogDriver();
/* DialogDriver_Null should have worked, at least. */
ASSERT( g_pImpl != NULL );