Changeset 192
- Timestamp:
- 12/24/07 18:10:45 (6 months ago)
- Files:
-
- GtkRadiant/branches/ZeroRadiant/ChangeLog (added)
- GtkRadiant/branches/ZeroRadiant/TODO (added)
- GtkRadiant/branches/ZeroRadiant/config.py (modified) (1 diff)
- GtkRadiant/branches/ZeroRadiant/docs/developer (deleted)
- GtkRadiant/branches/ZeroRadiant/install/games/q3.game (deleted)
- GtkRadiant/branches/ZeroRadiant/radiant/dialog.cpp (modified) (3 diffs)
- GtkRadiant/branches/ZeroRadiant/radiant/dialog.h (modified) (1 diff)
- GtkRadiant/branches/ZeroRadiant/radiant/gtkmisc.cpp (modified) (1 diff)
- GtkRadiant/branches/ZeroRadiant/radiant/main.cpp (modified) (13 diffs)
- GtkRadiant/branches/ZeroRadiant/radiant/preferences.cpp (modified) (13 diffs)
- GtkRadiant/branches/ZeroRadiant/radiant/preferences.h (modified) (5 diffs)
- GtkRadiant/branches/ZeroRadiant/radiant/qe3.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
GtkRadiant/branches/ZeroRadiant/config.py
r190 r192 153 153 if ( config == 'debug' ): 154 154 env.Append( CFLAGS = [ '-g' ] ) 155 env.Append( CXXFLAGS = [ '-g' ] ) 155 156 env.Append( CPPDEFINES = [ '_DEBUG' ] ) 156 157 else: 157 158 env.Append( CFLAGS = [ '-O3', '-Winline', '-ffast-math', '-fno-unsafe-math-optimizations' ] ) 159 env.Append( CXXFLAGS = [ '-O3', '-Winline', '-ffast-math', '-fno-unsafe-math-optimizations' ] ) 158 160 #env.Append( CFLAGS = [ '-march=pentium3' ] ) 159 161 GtkRadiant/branches/ZeroRadiant/radiant/dialog.cpp
r185 r192 109 109 } 110 110 111 void Dialog::AddDialogData (GtkObject *object, void *buf, DLG_DATA_TYPE type)111 void Dialog::AddDialogData( GtkObject *object, void *buf, DLG_DATA_TYPE type ) 112 112 { 113 113 DLG_DATA *data; … … 121 121 } 122 122 123 void Dialog::AddModalButton (GtkWidget *widget, int ret) 124 { 125 gtk_signal_connect (GTK_OBJECT (widget), "clicked", 126 GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (ret)); 123 void Dialog::AddModalButton( GtkWidget *widget, int ret ) { 124 gtk_signal_connect( GTK_OBJECT( widget ), "clicked", 125 GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( ret ) ); 127 126 } 128 127 … … 262 261 } 263 262 264 void Dialog::EndModal (int code) 265 { 263 void Dialog::EndModal( int code ) { 266 264 m_nLoop = 0; 267 265 m_nReturn = code; 268 266 } 269 267 270 int Dialog::DoModal ()271 { 272 Create ();273 UpdateData (FALSE);268 int Dialog::DoModal() 269 { 270 Create(); 271 UpdateData( FALSE ); 274 272 275 273 PreModal(); 276 274 277 gtk_grab_add (m_pWidget);278 gtk_widget_show (m_pWidget);275 gtk_grab_add( m_pWidget ); 276 gtk_widget_show( m_pWidget ); 279 277 280 278 m_nLoop = 1; 281 while ( m_nLoop)282 gtk_main_iteration ();283 284 if (m_pWidget != NULL) 285 {286 UpdateData (TRUE);287 288 gtk_grab_remove (m_pWidget);289 gtk_widget_hide (m_pWidget);290 } 291 PostModal (m_nReturn);279 while ( m_nLoop ) { 280 gtk_main_iteration(); 281 } 282 283 if ( m_pWidget != NULL ) { 284 UpdateData( TRUE ); 285 286 gtk_grab_remove( m_pWidget ); 287 gtk_widget_hide( m_pWidget ); 288 } 289 PostModal( m_nReturn ); 292 290 293 291 return m_nReturn; 294 292 } 295 GtkRadiant/branches/ZeroRadiant/radiant/dialog.h
r183 r192 76 76 used in overloaded BuildDialog implementations to configure modal behaviour easily 77 77 */ 78 void AddModalButton (GtkWidget *widget, int ret);78 void AddModalButton( GtkWidget *widget, int ret ); 79 79 80 80 private: GtkRadiant/branches/ZeroRadiant/radiant/gtkmisc.cpp
r185 r192 852 852 // Message Boxes 853 853 854 void dialog_button_callback (GtkWidget *widget, gpointer data) 855 { 854 void dialog_button_callback( GtkWidget *widget, gpointer data ) { 856 855 GtkWidget *parent; 857 856 int *loop, *ret; 858 857 859 parent = gtk_widget_get_toplevel (widget);860 loop = (int*)g_object_get_data (G_OBJECT (parent), "loop");861 ret = (int*)g_object_get_data (G_OBJECT (parent), "ret");858 parent = gtk_widget_get_toplevel( widget ); 859 loop = (int*)g_object_get_data( G_OBJECT( parent ), "loop" ); 860 ret = (int*)g_object_get_data( G_OBJECT( parent ), "ret" ); 862 861 863 862 *loop = 0; GtkRadiant/branches/ZeroRadiant/radiant/main.cpp
r185 r192 420 420 } 421 421 422 int main (int argc, char* argv[]) 423 { 424 char *libgl, *ptr; 425 int i, j, k; 422 int main( int argc, char* argv[] ) { 423 char *libgl, *ptr; 424 int i, j, k; 426 425 427 426 #ifdef _WIN32 … … 443 442 struct passwd *pw; 444 443 seteuid(getuid()); 445 if ( geteuid() == 0 && (loginname = getlogin()) != NULL &&446 (pw = getpwnam(loginname)) != NULL) 447 setuid(pw->pw_uid);444 if ( geteuid() == 0 && ( loginname = getlogin() ) != NULL && ( pw = getpwnam(loginname) ) != NULL ) { 445 setuid(pw->pw_uid); 446 } 448 447 #endif 449 448 … … 508 507 g_strBitmapsPath += "bitmaps/"; 509 508 510 #if 0511 // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=639512 // now check if we are running from a network installation513 // use a dummy file as the flag514 FILE *f_netrun;515 CString strNetrun;516 strNetrun = g_strAppPath; strNetrun += NETRUN_FILENAME;517 f_netrun = fopen(strNetrun.GetBuffer(), "r");518 if (f_netrun)519 {520 fclose(f_netrun);521 g_PrefsDlg.m_bUseHomePath = true;522 }523 #endif524 509 CGameDialog::UpdateNetrun(false); // read the netrun configuration 525 510 526 if (CGameDialog::GetNetrun()) 527 { 511 if ( CGameDialog::GetNetrun() ) { 528 512 // we have to find a per-user g_strTempPath 529 513 // this behaves the same as on Linux … … 574 558 g_strAppPath = real; 575 559 576 #if 0577 printf("g_strAppPath: %s\n", g_strAppPath.GetBuffer());578 #endif579 580 560 // radiant is installed in the parent dir of "tools/" 581 561 // NOTE: this is not very easy for debugging … … 584 564 g_strBitmapsPath = g_strAppPath; 585 565 g_strBitmapsPath += "bitmaps/"; 586 #if 0587 printf("g_strBitmapsPath: %s\n", g_strBitmapsPath.GetBuffer());588 #endif589 566 590 567 // we will set this right after the game selection is done … … 608 585 609 586 FILE *pid; 610 pid = fopen (g_pidFile.GetBuffer(), "r"); 611 if (pid != NULL) 612 { 587 pid = fopen( g_pidFile.GetBuffer(), "r" ); 588 if ( pid != NULL ) { 613 589 fclose (pid); 614 590 CString msg; … … 652 628 653 629 // create a primary .pid for global init run 654 pid = fopen (g_pidFile.GetBuffer(), "w"); 655 if (pid) 656 fclose (pid); 630 pid = fopen( g_pidFile.GetBuffer(), "w" ); 631 if ( pid ) { 632 fclose( pid ); 633 } 657 634 658 635 // a safe check to avoid people running broken installations … … 662 639 // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=431 663 640 #ifndef _DEBUG 664 #define CHECK_VERSION641 //#define CHECK_VERSION 665 642 #endif 666 643 #ifdef CHECK_VERSION … … 729 706 730 707 g_qeglobals.disable_ini = false; 731 g_PrefsDlg.Init ();708 g_PrefsDlg.Init(); 732 709 733 710 // close the primary 734 if (remove (g_pidFile.GetBuffer ()) == -1) 735 { 711 if ( remove( g_pidFile.GetBuffer () ) == -1 ) { 736 712 CString msg; 737 713 msg = "WARNING: Could not delete "; msg += g_pidGameFile; … … 846 822 847 823 #ifndef SKIP_SPLASH 848 create_splash ();824 create_splash(); 849 825 #endif 850 826 … … 866 842 867 843 // redirect Gtk warnings to the console 868 g_log_set_handler ("Gdk", (GLogLevelFlags)(G_LOG_LEVEL_ERROR|G_LOG_LEVEL_CRITICAL|G_LOG_LEVEL_WARNING|844 g_log_set_handler( "Gdk", (GLogLevelFlags)(G_LOG_LEVEL_ERROR|G_LOG_LEVEL_CRITICAL|G_LOG_LEVEL_WARNING| 869 845 G_LOG_LEVEL_MESSAGE|G_LOG_LEVEL_INFO|G_LOG_LEVEL_DEBUG), error_redirect, NULL); 870 g_log_set_handler ("Gtk", (GLogLevelFlags)(G_LOG_LEVEL_ERROR|G_LOG_LEVEL_CRITICAL|G_LOG_LEVEL_WARNING|846 g_log_set_handler( "Gtk", (GLogLevelFlags)(G_LOG_LEVEL_ERROR|G_LOG_LEVEL_CRITICAL|G_LOG_LEVEL_WARNING| 871 847 G_LOG_LEVEL_MESSAGE|G_LOG_LEVEL_INFO|G_LOG_LEVEL_DEBUG), error_redirect, NULL); 872 848 873 849 // spog - creates new filters list for the first time 874 g_qeglobals.d_savedinfo.filters = NULL; //initialise to NULL850 g_qeglobals.d_savedinfo.filters = NULL; 875 851 g_qeglobals.d_savedinfo.filters = FilterUpdate(g_qeglobals.d_savedinfo.filters); 876 852 877 g_pParentWnd = new MainFrame (); 878 879 if (g_PrefsDlg.m_bLoadLastMap && g_PrefsDlg.m_strLastMap.GetLength() > 0) 880 Map_LoadFile(g_PrefsDlg.m_strLastMap.GetBuffer()); 881 else 882 Map_New(); 853 g_pParentWnd = new MainFrame(); 854 855 if ( g_PrefsDlg.m_bLoadLastMap && g_PrefsDlg.m_strLastMap.GetLength() > 0 ) { 856 Map_LoadFile(g_PrefsDlg.m_strLastMap.GetBuffer()); 857 } else { 858 Map_New(); 859 } 883 860 884 861 // load up shaders now that we have the map loaded 885 862 // eviltypeguy 886 Texture_ShowStartupShaders ();863 Texture_ShowStartupShaders(); 887 864 888 865 #ifndef SKIP_SPLASH 889 gdk_window_raise (splash_screen->window);890 gtk_window_set_transient_for (GTK_WINDOW (splash_screen), GTK_WINDOW (g_pParentWnd->m_pWidget));891 gtk_timeout_add (1000, try_destroy_splash, NULL);866 gdk_window_raise(splash_screen->window); 867 gtk_window_set_transient_for( GTK_WINDOW( splash_screen ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); 868 gtk_timeout_add( 1000, try_destroy_splash, NULL ); 892 869 #endif 893 870 … … 897 874 g_pParentWnd->DoWatchBSP(); 898 875 899 gtk_main ();876 gtk_main(); 900 877 901 878 // close the log file if any … … 909 886 // restricting it to linux build 910 887 #ifdef __linux__ 911 _exit (0);888 _exit( 0 ); 912 889 #endif 913 890 return 0; GtkRadiant/branches/ZeroRadiant/radiant/preferences.cpp
r185 r192 28 28 #include "stdafx.h" 29 29 #include <glib.h> 30 #include <assert.h> 30 31 #if defined (__linux__) || defined (__APPLE__) 31 32 #include <sys/stat.h> … … 958 959 } 959 960 960 void CGameDialog::DoGameDialog() 961 { 962 // show the UI 963 DoModal(); 964 965 // unhook so we can use in other places 966 // we manually incref'ed it when creating, it won't be freed (destructor) 967 gtk_container_remove (GTK_CONTAINER (mTopBox), GetGlobalFrame()); 968 969 // we save the prefs file 970 SavePrefs(); 961 void CGameDialog::DoGameInstall() { 962 mGameInstall.Run(); 963 } 964 965 void CGameDialog::DoGameDialog() { 966 // allow looping the game selection dialog with calls to the game configure dialog in between 967 while ( m_bDoGameInstall ) { 968 969 m_bDoGameInstall = false; 970 971 DoModal(); 972 973 if ( m_bDoGameInstall ) { 974 DoGameInstall(); 975 ScanForGames(); 976 // and we will loop to do another DoModal dialog 977 } 978 } 979 980 // unhook so we can use in other places 981 // we manually incref'ed it when creating, it won't be freed (destructor) 982 gtk_container_remove( GTK_CONTAINER( mTopBox ), GetGlobalFrame() ); 983 984 // we save the prefs file 985 SavePrefs(); 971 986 } 972 987 … … 975 990 GtkWidget *vbox, *text, *combo, *check; 976 991 977 if (mFrame) 978 return mFrame; 979 980 mFrame = gtk_frame_new(NULL); 981 gtk_container_set_border_width(GTK_CONTAINER(mFrame), 5); 982 gtk_widget_show(mFrame); 983 984 vbox = gtk_vbox_new (FALSE, 6); 985 gtk_widget_show (vbox); 986 gtk_container_add (GTK_CONTAINER (mFrame), vbox); 987 gtk_container_set_border_width (GTK_CONTAINER (vbox), 5); 988 989 text = gtk_label_new("Select the game:"); 990 gtk_widget_show(text); 991 gtk_box_pack_start (GTK_BOX(vbox), text, FALSE, FALSE, 0); 992 if ( mFrame != NULL ) { 993 return mFrame; 994 } 995 996 mFrame = gtk_frame_new( NULL ); 997 gtk_container_set_border_width( GTK_CONTAINER( mFrame ), 5 ); 998 gtk_widget_show( mFrame ); 999 1000 vbox = gtk_vbox_new( FALSE, 6 ); 1001 gtk_widget_show( vbox ); 1002 gtk_container_add( GTK_CONTAINER( mFrame ), vbox ); 1003 gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); 1004 1005 text = gtk_label_new( "Select the game:" ); 1006 gtk_widget_show( text ); 1007 gtk_box_pack_start( GTK_BOX( vbox ), text, FALSE, FALSE, 0 ); 992 1008 993 1009 combo = gtk_combo_new(); 994 gtk_widget_show( combo);995 gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, FALSE, 0);1010 gtk_widget_show( combo ); 1011 gtk_box_pack_start( GTK_BOX( vbox ), combo, FALSE, FALSE, 0 ); 996 1012 997 1013 // fill in with the game descriptions 998 1014 GList *combo_list = (GList*)NULL; 999 1015 list<CGameDescription *>::iterator iGame; 1000 for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++) 1001 { 1002 combo_list = g_list_append (combo_list, (void *)(*iGame)->mGameName.GetBuffer()); 1003 } 1004 gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list); 1005 g_list_free (combo_list); 1006 1007 AddDialogData (combo, &m_nComboSelect, DLG_COMBO_INT); 1008 1009 check = gtk_check_button_new_with_label("Auto load selected game on startup"); 1016 for( iGame = mGames.begin(); iGame != mGames.end(); iGame++ ) { 1017 combo_list = g_list_append( combo_list, (void *)(*iGame)->mGameName.GetBuffer() ); 1018 } 1019 gtk_combo_set_popdown_strings( GTK_COMBO( combo ), combo_list ); 1020 g_list_free( combo_list ); 1021 1022 AddDialogData( combo, &m_nComboSelect, DLG_COMBO_INT ); 1023 1024 check = gtk_check_button_new_with_label( "Auto load selected game on startup" ); 1010 1025 gtk_widget_show(check); 1011 1026 gtk_box_pack_start (GTK_BOX(vbox), check, FALSE, FALSE, 0); … … 1017 1032 1018 1033 #ifdef _WIN32 1019 check = gtk_check_button_new_with_label( "Networked install - per-user settings");1020 gtk_widget_show( check);1021 gtk_box_pack_start (GTK_BOX(vbox), check, FALSE, FALSE, 0);1022 AddDialogData (check, &m_bNetRun, DLG_CHECK_BOOL);1034 check = gtk_check_button_new_with_label( "Networked install - per-user settings" ); 1035 gtk_widget_show( check ); 1036 gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); 1037 AddDialogData( check, &m_bNetRun, DLG_CHECK_BOOL ); 1023 1038 #endif 1024 1039 1025 check = gtk_check_button_new_with_label( "Log the console to radiant.log");1026 gtk_widget_show( check);1027 gtk_box_pack_start (GTK_BOX(vbox), check, FALSE, FALSE, 0);1028 AddDialogData (check, &m_bLogConsole, DLG_CHECK_BOOL);1040 check = gtk_check_button_new_with_label( "Log the console to radiant.log" ); 1041 gtk_widget_show( check ); 1042 gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); 1043 AddDialogData( check, &m_bLogConsole, DLG_CHECK_BOOL ); 1029 1044 1030 1045 // incref it so we can pass it around 1031 gtk_widget_ref (GTK_WIDGET(mFrame));1046 gtk_widget_ref( GTK_WIDGET( mFrame ) ); 1032 1047 1033 1048 return mFrame; 1034 1049 } 1035 1050 1036 void CGameDialog::UpdateData (bool retrieve) 1037 { 1051 void CGameDialog::UpdateData( bool retrieve ) { 1038 1052 if (!retrieve) 1039 1053 { … … 1071 1085 } 1072 1086 1073 void CGameDialog::BuildDialog() 1074 { 1075 GtkWidget *dlg, *vbox1, *button; 1076 1077 dlg = m_pWidget; 1078 gtk_window_set_title (GTK_WINDOW (dlg), "Select Game"); 1079 1080 vbox1 = gtk_vbox_new (FALSE, 0); 1081 gtk_widget_show(vbox1); 1082 gtk_container_add (GTK_CONTAINER (dlg), vbox1); 1083 1084 gtk_container_add (GTK_CONTAINER (vbox1), GetGlobalFrame()); 1085 mTopBox = vbox1; 1086 1087 button = gtk_button_new_with_label ("OK"); 1088 gtk_widget_show (button); 1089 gtk_box_pack_start (GTK_BOX (vbox1), button, FALSE, FALSE, 0); 1090 AddModalButton(button, IDOK); 1091 gtk_widget_set_usize (button, 60, -2); 1087 void CGameDialog::SInstallCallback( GtkWidget *widget, gpointer data ) { 1088 CGameDialog *d = static_cast< CGameDialog* >( data ); 1089 d->m_bDoGameInstall = true; 1090 d->EndModal( 0 ); 1091 } 1092 1093 void CGameDialog::BuildDialog() { 1094 GtkWidget *dlg, *vbox1, *button, *setup_button; 1095 1096 dlg = m_pWidget; 1097 gtk_window_set_title( GTK_WINDOW( dlg ), "Select Game" ); 1098 1099 vbox1 = gtk_vbox_new( FALSE, 0 ); 1100 gtk_widget_show( vbox1 ); 1101 gtk_container_add( GTK_CONTAINER( dlg ), vbox1 ); 1102 1103 gtk_container_add( GTK_CONTAINER( vbox1 ), GetGlobalFrame() ); 1104 mTopBox = vbox1; 1105 1106 setup_button = gtk_button_new_with_label( "Configure more games" ); 1107 gtk_widget_show( setup_button ); 1108 gtk_box_pack_start( GTK_BOX( vbox1 ), setup_button, FALSE, FALSE, 0 ); 1109 gtk_signal_connect( GTK_OBJECT( setup_button ), "clicked", 1110 GTK_SIGNAL_FUNC( SInstallCallback ), this ); 1111 1112 button = gtk_button_new_with_label( "OK" ); 1113 gtk_widget_show( button ); 1114 gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 ); 1115 AddModalButton( button, IDOK ); 1116 1117 gtk_widget_set_usize( button, 60, -2 ); 1092 1118 } 1093 1119 … … 1101 1127 const char *path = strGamesPath.GetBuffer(); 1102 1128 1103 Sys_Printf("Scanning for game description files: %s\n", path); 1129 if ( !mGames.empty() ) { 1130 Sys_Printf( "Clearing game list\n" ); 1131 list<CGameDescription*>::iterator iGame; 1132 for ( iGame = mGames.begin(); iGame != mGames.end(); iGame++ ) { 1133 delete (*iGame); 1134 } 1135 mGames.clear(); 1136 } 1137 1138 Sys_Printf( "Scanning for game description files: %s\n", path ); 1104 1139 1105 1140 /*! … … 1137 1172 if (pDoc) 1138 1173 { 1139 mGames.push_front( new CGameDescription(pDoc, dirlist));1174 mGames.push_front( new CGameDescription( pDoc, dirlist ) ); 1140 1175 } 1141 1176 else … … 1164 1199 } 1165 1200 1166 /*GString* CGameDialog::InitGlobalPrefPath()1167 {1168 GString* global_rc_path;1169 // configure m_global_rc_path1170 #if defined (__linux__) || defined (__APPLE__)1171 global_rc_path = g_string_new (g_get_home_dir ());1172 1173 if (global_rc_path->str[global_rc_path->len-1] != '/')1174 g_string_append (global_rc_path, "/");1175 1176 g_string_append (global_rc_path, ".radiant/");1177 mkdir (global_rc_path->str, 0775);1178 g_string_append (global_rc_path, RADIANT_VERSION);1179 g_string_append (global_rc_path, "/");1180 mkdir (global_rc_path->str, 0775);1181 #elif WIN321182 global_rc_path = g_string_new (g_strAppPath.GetBuffer() );1183 #else1184 #error "WTF are you compiling under"1185 #endif1186 return global_rc_path;1187 }*/1188 1189 1201 void CGameDialog::InitGlobalPrefPath() 1190 1202 { … … 1209 1221 InitGlobalPrefPath(); 1210 1222 ScanForGames(); 1211 if (mGames.empty()) 1212 { 1213 Error("Didn't find any valid game file descriptions, aborting\n"); 1223 if ( mGames.empty() ) { 1224 DoGameInstall(); 1225 ScanForGames(); 1226 if ( mGames.empty() ) { 1227 Error( "No games setup, aborting\n" ); 1228 } 1214 1229 } 1215 1230 LoadPrefs(); 1216 if (m_bAutoLoadGame) 1217 { 1231 if ( m_bAutoLoadGame ) { 1218 1232 // search by .game name 1219 1233 list<CGameDescription *>::iterator iGame; … … 1227 1241 } 1228 1242 } 1229 if (!m_bAutoLoadGame || !m_pCurrentGameDescription) 1230 { 1243 if ( !m_bAutoLoadGame || !m_pCurrentGameDescription ) { 1231 1244 DoGameDialog(); 1232 1245 // use m_nComboSelect to identify the game to run as and set the globals 1233 1246 m_pCurrentGameDescription = GameDescriptionForComboItem(); 1234 if (!m_pCurrentGameDescription) 1235 Error("Lookup of game description object failed, can't continue\n"); 1247 if ( !m_pCurrentGameDescription ) { 1248 Error("Lookup of game description object failed, can't continue\n"); 1249 } 1236 1250 } 1237 1251 g_pGameDescription = m_pCurrentGameDescription; … … 1495 1509 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); 1496 1510 gtk_widget_set_usize(button, 60, -2); 1497 AddModalButton (button, IDCANCEL);1511 AddModalButton(button, IDCANCEL); 1498 1512 1499 1513 button = gtk_button_new_with_label ("Clean"); … … 3016 3030 Sys_FPrintf(SYS_ERR, "Error occured while saving local prefs file '%s'\n", m_inipath->str); 3017 3031 3018 if (m_nMouse == 0) 3019 m_nMouseButtons = 2; 3020 else 3021 m_nMouseButtons = 3; 3032 if ( m_nMouse == 0 ) { 3033 m_nMouseButtons = 2; 3034 } else { 3035 m_nMouseButtons = 3; 3036 } 3022 3037 3023 3038 } … … 3101 3116 } 3102 3117 } 3118 3119 /* 3120 ============================================================ 3121 CGameInstall 3122 ============================================================ 3123 */ 3124 3125 void CGameInstall::BuildDialog() { 3126 GtkWidget *dlg, *vbox1, *button, *text, *combo, *entry; 3127 3128 dlg = m_pWidget; 3129 gtk_window_set_title( GTK_WINDOW( dlg ), "Configure games" ); 3130 3131 vbox1 = gtk_vbox_new( FALSE, 0 ); 3132 gtk_widget_show( vbox1 ); 3133 gtk_container_add( GTK_CONTAINER( dlg ), vbox1 ); 3134 3135 text = gtk_label_new( "Select the game to configure" ); 3136 gtk_widget_show( text ); 3137 gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 ); 3138 3139 combo = gtk_combo_new(); 3140 gtk_widget_show( combo ); 3141 gtk_box_pack_start( GTK_BOX( vbox1 ), combo, FALSE, FALSE, 0 ); 3142 3143 GList *combo_list = NULL; 3144 combo_list = g_list_append( combo_list, "Quake III Arena and mods" ); 3145 combo_list = g_list_append( combo_list, "Urban Terror standalone" ); 3146 combo_list = g_list_append( combo_list, "Warsaw" ); 3147 gtk_combo_set_popdown_strings( GTK_COMBO( combo ), combo_list ); 3148 g_list_free( combo_list ); 3149 AddDialogData( combo, &m_nComboSelect, DLG_COMBO_INT ); 3150 3151 text = gtk_label_new( "Name:" ); 3152 gtk_widget_show( text ); 3153 gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 ); 3154 3155 entry = gtk_entry_new(); 3156 gtk_widget_show( entry ); 3157 gtk_box_pack_start( GTK_BOX( vbox1 ), entry, FALSE, FALSE, 0 ); 3158 AddDialogData( entry, &m_strName, DLG_ENTRY_TEXT ); 3159 3160 text = gtk_label_new( "Engine directory:" ); 3161 gtk_widget_show( text ); 3162 gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 ); 3163 3164 entry = gtk_entry_new(); 3165 gtk_widget_show( entry ); 3166 gtk_box_pack_start( GTK_BOX( vbox1 ), entry, FALSE, FALSE, 0 ); 3167 AddDialogData( entry, &m_strEngine, DLG_ENTRY_TEXT ); 3168 3169 // this gets done in the project stuff atm 3170 #if 0 3171 text = gtk_label_new( "Mod subdirectory:" ); 3172 gtk_widget_show( text ); 3173 gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 ); 3174 3175 entry = gtk_entry_new(); 3176 gtk_widget_show( entry ); 3177 gtk_box_pack_start( GTK_BOX( vbox1 ), entry, FALSE, FALSE, 0 ); 3178 AddDialogData( entry, &m_strMod, DLG_ENTRY_TEXT ); 3179 #endif 3180 3181 button = gtk_button_new_with_label( "OK" ); 3182 gtk_widget_show( button ); 3183 gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 ); 3184 AddModalButton( button, IDOK ); 3185 3186 gtk_widget_set_usize( button, 60, -2 ); 3187 } 3188 3189 void CGameInstall::Run() { 3190 DoModal(); 3191 Sys_Printf( "combo: %d name: %s engine: %s mod: %s\n", m_nComboSelect, m_strName.GetBuffer(), m_strEngine.GetBuffer(), m_strMod.GetBuffer() ); 3192 3193 // write out the game file 3194 Str gameFilePath = g_strAppPath.GetBuffer(); 3195 gameFilePath += "games/"; 3196 gameFilePath += m_strName.GetBuffer(); 3197 gameFilePath += ".game"; 3198 Sys_Printf( "game file: %s\n", gameFilePath.GetBuffer() ); 3199 3200 FILE *fg = fopen( gameFilePath.GetBuffer(), "w" ); 3201 if ( fg == NULL ) { 3202 Error( "Failed to open %s for writing\n", gameFilePath.GetBuffer() ); 3203 } 3204 fprintf( fg, "<?xml version=\"1.0\" encoding=\"iso-8859-1\" standalone=\"yes\"?>\n<game\n" ); 3205 fprintf( fg, " name=\"%s\"\n", m_strName.GetBuffer() ); 3206 fprintf( fg, " gametools=\"%sgames\"\n", g_strAppPath.GetBuffer() ); 3207 fprintf( fg, " enginepath=\"%s\"\n", m_strEngine.GetBuffer() ); 3208 switch ( m_nComboSelect ) { 3209 case GAME_Q3: 3210 fprintf( fg, " basegame=\"baseq3\"\n" ); 3211 break; 3212 case GAME_URT: 3213 fprintf( fg, " basegame=\"q3ut4\"\n" ); 3214 break; 3215 case GAME_WARSOW: 3216 fprintf( fg, " basegame=\"basewsw\"\n" ); 3217 break; 3218 } 3219 fprintf( fg, "/>\n" ); 3220 fclose( fg ); 3221 } GtkRadiant/branches/ZeroRadiant/radiant/preferences.h
r183 r192 195 195 196 196 /*! 197 select games, copy editing assets and write out configuration files 198 */ 199 class CGameInstall : public Dialog { 200 public: 201 void Run(); 202 void BuildDialog(); 203 204 enum gameType_e { 205 GAME_Q3, 206 GAME_URT, 207 GAME_WARSOW 208 }; 209 210 protected: 211 Str m_strName; 212 Str m_strMod; 213 Str m_strEngine; 214 int m_nComboSelect; 215 }; 216 217 /*! 197 218 standalone dialog for games selection, and more generally global settings 198 219 */ … … 218 239 #endif 219 240 241 bool m_bDoGameInstall; 242 243 CGameInstall mGameInstall; 244 220 245 protected: 221 246 … … 259 284 list<CGameDescription *> mGames; 260 285 261 CGameDialog() { mFrame = NULL; m_pCurrentGameDescription = NULL; m_bLogConsole = false; m_bForceLogConsole = false; } 286 CGameDialog() { 287 mFrame = NULL; 288 m_pCurrentGameDescription = NULL; 289 m_bLogConsole = false; 290 m_bForceLogConsole = false; 291 m_bDoGameInstall = true; // go through DoModal at least once 292 } 262 293 virtual ~CGameDialog(); 263 294 264 void AddPacksURL( Str &s);295 void AddPacksURL( Str &s ); 265 296 266 297 /*! … … 281 312 282 313 /*! 314 call out to the game installation dialog 315 */ 316 void DoGameInstall(); 317 318 /*! 283 319 Dialog API 284 320 this is only called when the dialog is built at startup for main engine select 285 321 */ 286 void BuildDialog ();287 void UpdateData (bool retrieve);322 void BuildDialog(); 323 void UpdateData( bool retrieve ); 288 324 289 325 /*! … … 336 372 */ 337 373 CGameDescription *GameDescriptionForComboItem(); 374 375 /*! 376 callback for the game install button 377 */ 378 static void SInstallCallback( GtkWidget *widget, gpointer data ); 338 379 }; 339 380 GtkRadiant/branches/ZeroRadiant/radiant/qe3.cpp
r185 r192 1700 1700 #define BUFFER_SIZE 4096 1701 1701 1702 extern "C" void Sys_FPrintf_VA (int level, const char *text, va_list args) 1703 { 1702 extern "C" void Sys_FPrintf_VA( int level, const char *text, va_list args ) { 1704 1703 char buf[BUFFER_SIZE]; 1705 1704 1706 1705 buf[0] = 0; 1707 vsnprintf( buf, BUFFER_SIZE, text, args);1706 vsnprintf( buf, BUFFER_SIZE, text, args ); 1708 1707 buf[BUFFER_SIZE-1] = 0; 1709 1708 const unsigned int length = strlen(buf); 1710 1709 1711 if (g_qeglobals.hLogFile) 1712 { 1710 if ( g_qeglobals.hLogFile ) { 1713 1711 #ifdef _WIN32 1714 _write( g_qeglobals.hLogFile, buf,length);1715 _commit( g_qeglobals.hLogFile);1712 _write( g_qeglobals.hLogFile, buf, length ); 1713 _commit( g_qeglobals.hLogFile ); 1716 1714 #endif 1717 1715 #if defined (__linux__) || defined (__APPLE__) 1718 write(g_qeglobals.hLogFile, buf, length); 1719 #endif 1720 } 1721 1722 if (level != SYS_NOCON) 1723 { 1716 write( g_qeglobals.hLogFile, buf, length ); 1717 #endif 1718 } 1719 1720 if ( level != SYS_NOCON ) { 1724 1721 // TTimo: FIXME: killed the console to avoid GDI leak fuckup 1725 if (g_qeglobals_gui.d_edit != NULL) 1726 { 1722 if ( g_qeglobals_gui.d_edit != NULL ) { 1727 1723 GtkTextBuffer* buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(g_qeglobals_gui.d_edit)); 1728 1724 … … 1779 1775 } 1780 1776 1781 extern "C" void Sys_Printf (const char *text, ...) 1782 { 1777 extern "C" void Sys_Printf( const char *text, ... ) { 1783 1778 va_list args; 1784 1779 1785 va_start (args, text);1786 Sys_FPrintf_VA (SYS_STD, text, args);1787 va_end (args);1780 va_start( args, text ); 1781 Sys_FPrintf_VA( SYS_STD, text, args ); 1782 va_end( args ); 1788 1783 } 1789 1784
