X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=radiant%2Fmain.cpp;h=bad501209f8fe39ae0f2af1e1f657299c3099c4f;hb=18d60f90d7603cb420150739251cf98519c57406;hp=93de25c9165056fa13c979ea71fe950f2552ca3b;hpb=569c0d2b9f44331d0b9c0ae7594147efb9e632e1;p=xonotic%2Fnetradiant.git diff --git a/radiant/main.cpp b/radiant/main.cpp index 93de25c9..bad50120 100644 --- a/radiant/main.cpp +++ b/radiant/main.cpp @@ -49,7 +49,7 @@ \link math/plane.h math/plane.h \endlink - Planes \n \link math/aabb.h math/aabb.h \endlink - AABBs \n - Callback MemberCaller FunctionCaller - callbacks similar to using boost::function with boost::bind \n + Callback MemberCaller0 FunctionCaller - callbacks similar to using boost::function with boost::bind \n SmartPointer SmartReference - smart-pointer and smart-reference similar to Loki's SmartPtr \n \link generic/bitfield.h generic/bitfield.h \endlink - Type-safe bitfield \n @@ -62,6 +62,7 @@ */ #include "main.h" +#include "globaldefs.h" #include "version.h" @@ -89,7 +90,7 @@ #include "referencecache.h" #include "stacktrace.h" -#ifdef WIN32 +#if GDEF_OS_WINDOWS #include #endif @@ -213,12 +214,12 @@ void error_redirect( const gchar *domain, GLogLevelFlags log_level, const gchar } } -#if defined ( _DEBUG ) && defined ( WIN32 ) && defined ( _MSC_VER ) +#if GDEF_COMPILER_MSVC && GDEF_DEBUG #include "crtdbg.h" #endif void crt_init(){ -#if defined ( _DEBUG ) && defined ( WIN32 ) && defined ( _MSC_VER ) +#if GDEF_COMPILER_MSVC && GDEF_DEBUG _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #endif } @@ -301,14 +302,14 @@ bool handleMessage(){ globalErrorStream() << m_buffer.c_str(); if ( !m_lock.locked() ) { ScopedLock lock( m_lock ); -#if defined _DEBUG +#if GDEF_DEBUG m_buffer << "Break into the debugger?\n"; - bool handled = ui::root.alert( m_buffer.c_str(), "Radiant - Runtime Error", ui::alert_type::YESNO, ui::alert_icon::Error ) == ui::alert_response::NO; + bool handled = ui::root.window().alert( m_buffer.c_str(), "Radiant - Runtime Error", ui::alert_type::YESNO, ui::alert_icon::Error ) == ui::alert_response::NO; m_buffer.clear(); return handled; #else m_buffer << "Please report this error to the developers\n"; - ui::root.alert( m_buffer.c_str(), "Radiant - Runtime Error", ui::alert_type::OK, ui::alert_icon::Error ); + ui::root.window().alert( m_buffer.c_str(), "Radiant - Runtime Error", ui::alert_type::OK, ui::alert_icon::Error ); m_buffer.clear(); #endif } @@ -367,7 +368,7 @@ bool check_version(){ // make something idiot proof and someone will make better idiots, this may be overkill // let's leave it disabled in debug mode in any case // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=431 -#ifndef _DEBUG +#if !GDEF_DEBUG #define CHECK_VERSION #endif #ifdef CHECK_VERSION @@ -389,7 +390,7 @@ bool check_version(){ msg << "This editor binary (" RADIANT_VERSION ") doesn't match what the latest setup has configured in this directory\n" "Make sure you run the right/latest editor binary you installed\n" << AppPath_get(); - ui::root.alert( msg.c_str(), "Radiant", ui::alert_type::OK, ui::alert_icon::Default); + ui::root.window().alert( msg.c_str(), "Radiant", ui::alert_type::OK, ui::alert_icon::Default); } return bVerIsGood; #else @@ -417,24 +418,24 @@ void create_global_pid(){ if ( remove( g_pidFile.c_str() ) == -1 ) { StringOutputStream msg( 256 ); msg << "WARNING: Could not delete " << g_pidFile.c_str(); - ui::root.alert( msg.c_str(), "Radiant", ui::alert_type::OK, ui::alert_icon::Error ); + ui::root.window().alert( msg.c_str(), "Radiant", ui::alert_type::OK, ui::alert_icon::Error ); } // in debug, never prompt to clean registry, turn console logging auto after a failed start -#if !defined( _DEBUG ) +#if !GDEF_DEBUG StringOutputStream msg( 256 ); msg << "Radiant failed to start properly the last time it was run.\n" "The failure may be related to current global preferences.\n" "Do you want to reset global preferences to defaults?"; - if ( ui::root.alert( msg.c_str(), "Radiant - Startup Failure", ui::alert_type::YESNO, ui::alert_icon::Question ) == ui::alert_response::YES ) { + if ( ui::root.window().alert( msg.c_str(), "Radiant - Startup Failure", ui::alert_type::YESNO, ui::alert_icon::Question ) == ui::alert_response::YES ) { g_GamesDialog.Reset(); } msg.clear(); msg << "Logging console output to " << SettingsPath_get() << "radiant.log\nRefer to the log if Radiant fails to start again."; - ui::root.alert( msg.c_str(), "Radiant - Console Log", ui::alert_type::OK ); + ui::root.window().alert( msg.c_str(), "Radiant - Console Log", ui::alert_type::OK ); #endif // set without saving, the class is not in a coherent state yet @@ -458,7 +459,7 @@ void remove_global_pid(){ if ( remove( g_pidFile.c_str() ) == -1 ) { StringOutputStream msg( 256 ); msg << "WARNING: Could not delete " << g_pidFile.c_str(); - ui::root.alert( msg.c_str(), "Radiant", ui::alert_type::OK, ui::alert_icon::Error ); + ui::root.window().alert( msg.c_str(), "Radiant", ui::alert_type::OK, ui::alert_icon::Error ); } } @@ -476,24 +477,24 @@ void create_local_pid(){ if ( remove( g_pidGameFile.c_str() ) == -1 ) { StringOutputStream msg; msg << "WARNING: Could not delete " << g_pidGameFile.c_str(); - ui::root.alert( msg.c_str(), "Radiant", ui::alert_type::OK, ui::alert_icon::Error ); + ui::root.window().alert( msg.c_str(), "Radiant", ui::alert_type::OK, ui::alert_icon::Error ); } // in debug, never prompt to clean registry, turn console logging auto after a failed start -#if !defined( _DEBUG ) +#if !GDEF_DEBUG StringOutputStream msg; msg << "Radiant failed to start properly the last time it was run.\n" "The failure may be caused by current preferences.\n" "Do you want to reset all preferences to defaults?"; - if ( ui::root.alert( msg.c_str(), "Radiant - Startup Failure", ui::alert_type::YESNO, ui::alert_icon::Question ) == ui::alert_response::YES ) { + if ( ui::root.window().alert( msg.c_str(), "Radiant - Startup Failure", ui::alert_type::YESNO, ui::alert_icon::Question ) == ui::alert_response::YES ) { Preferences_Reset(); } msg.clear(); msg << "Logging console output to " << SettingsPath_get() << "radiant.log\nRefer to the log if Radiant fails to start again."; - ui::root.alert( msg.c_str(), "Radiant - Console Log", ui::alert_type::OK ); + ui::root.window().alert( msg.c_str(), "Radiant - Console Log", ui::alert_type::OK ); #endif // force console logging on! (will go in prefs too) @@ -539,7 +540,7 @@ int main( int argc, char* argv[] ){ streams_init(); -#ifdef WIN32 +#if GDEF_OS_WINDOWS HMODULE lib; lib = LoadLibrary( "dwmapi.dll" ); if ( lib != 0 ) { @@ -593,7 +594,7 @@ int main( int argc, char* argv[] ){ GlobalDebugMessageHandler::instance().setHandler( GlobalPopupDebugMessageHandler::instance() ); - environment_init( argc, argv ); + environment_init(argc, (char const **) argv); paths_init();