X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fnetradiant.git;a=blobdiff_plain;f=radiant%2Fpreferences.cpp;h=9608fbb981737ff33dfa130623b4e5934c31e4e8;hp=07b0a4799a62db0a45ec36f2bcb07344bcb40a5f;hb=cc4e44e31a89c8efed942ca26e2a341466f9a3b2;hpb=2def0428da1f9148a4101d984a7f1b72bfde57d8 diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index 07b0a479..9608fbb9 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -27,6 +27,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "stdafx.h" #include +#include +#include #if defined (__linux__) || defined (__APPLE__) #include #include @@ -94,6 +96,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define WIDETOOLBAR_KEY "WideToolBar" #define PLUGINTOOLBAR_KEY "PluginToolBar" #define NOCLAMP_KEY "NoClamp" +#define SNAP_KEY "Snap" #define PREFAB_KEY "PrefabPath" #define USERINI_KEY "UserINIPath" #define ROTATION_KEY "Rotation" @@ -230,7 +233,7 @@ CXMLPropertyBag::CXMLPropertyBag() { // generic preference functions -void CXMLPropertyBag::PushAssignment(char *name, PrefTypes_t type, void *pV) +void CXMLPropertyBag::PushAssignment(const char *name, PrefTypes_t type, void *pV) { list::iterator iAssign; for(iAssign=mPrefAssignments.begin(); iAssign!=mPrefAssignments.end(); iAssign++) @@ -273,7 +276,7 @@ xmlNodePtr CXMLPropertyBag::EpairForName(const char *name) return ret; } -void CXMLPropertyBag::GetPref(char *name, Str *pV, char *V) +void CXMLPropertyBag::GetPref(const char *name, Str *pV, const char *V) { xmlNodePtr pNode = EpairForName( name ); if ( pNode ) @@ -281,7 +284,6 @@ void CXMLPropertyBag::GetPref(char *name, Str *pV, char *V) if ( pNode->children && pNode->children->content ) { *pV = pNode->children->content; } else { - // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=427 // means the pref exists, and that the value is "" *pV = ""; } @@ -295,9 +297,9 @@ void CXMLPropertyBag::GetPref(char *name, Str *pV, char *V) PushAssignment(name, PREF_STR, pV); } -void CXMLPropertyBag::GetPref(char *name, int *pV, int V) +void CXMLPropertyBag::GetPref(const char *name, int *pV, int V) { - xmlNodePtr pNode; + xmlNodePtr pNode; if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content) { *pV = atoi((char *)pNode->children->content); @@ -311,12 +313,12 @@ void CXMLPropertyBag::GetPref(char *name, int *pV, int V) *pV=V; } // push the pref assignment if needed - PushAssignment(name, PREF_INT, pV); + PushAssignment(name, PREF_INT, pV); } -void CXMLPropertyBag::GetPref(char *name, bool *pV, bool V) +void CXMLPropertyBag::GetPref(const char *name, bool *pV, bool V) { - xmlNodePtr pNode; + xmlNodePtr pNode; if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content) { if (!strcmp((char *)pNode->children->content, "true")) @@ -337,12 +339,12 @@ void CXMLPropertyBag::GetPref(char *name, bool *pV, bool V) *pV=V; } // push the pref assignment - PushAssignment(name, PREF_BOOL, pV); + PushAssignment(name, PREF_BOOL, pV); } -void CXMLPropertyBag::GetPref(char *name, float *pV, float V) +void CXMLPropertyBag::GetPref(const char *name, float *pV, float V) { - xmlNodePtr pNode; + xmlNodePtr pNode; if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content) { *pV = atof((char *)pNode->children->content); @@ -356,12 +358,12 @@ void CXMLPropertyBag::GetPref(char *name, float *pV, float V) *pV=V; } // push the pref assignment if needed - PushAssignment(name, PREF_FLOAT, pV); + PushAssignment(name, PREF_FLOAT, pV); } -void CXMLPropertyBag::GetPref(char *name, float* pV, float* V) +void CXMLPropertyBag::GetPref(const char *name, float* pV, float* V) { - xmlNodePtr pNode; + xmlNodePtr pNode; if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content) { sscanf((char *)pNode->children->content, "%f %f %f", &pV[0], &pV[1], &pV[2]); @@ -377,12 +379,12 @@ void CXMLPropertyBag::GetPref(char *name, float* pV, float* V) pV[2] = V[2]; } // push the pref assignment if needed - PushAssignment(name, PREF_VEC3, pV); + PushAssignment(name, PREF_VEC3, pV); } -void CXMLPropertyBag::GetPref(char *name, window_position_t* pV, window_position_t V) +void CXMLPropertyBag::GetPref(const char *name, window_position_t* pV, window_position_t V) { - xmlNodePtr pNode; + xmlNodePtr pNode; if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content) { WindowPosition_Parse(*pV, CString((xmlChar *)pNode->children->content)); @@ -396,7 +398,7 @@ void CXMLPropertyBag::GetPref(char *name, window_position_t* pV, window_position *pV = V; } // push the pref assignment if needed - PushAssignment(name, PREF_WNDPOS, pV); + PushAssignment(name, PREF_WNDPOS, pV); } void CXMLPropertyBag::UpdatePrefTree() @@ -484,7 +486,7 @@ void CXMLPropertyBag::ReadXMLFile(const char* pFilename) Sys_FPrintf(SYS_ERR, "Wrong version '%s' in node for '%s'\n", (char*)tmp_attr_ptr->children->content, mpDoc->URL); xmlFreeDoc(mpDoc); mpDoc = NULL; - } + } Sys_Printf("Opened XML property file: '%s'\n", pFilename); } @@ -503,7 +505,7 @@ void CXMLPropertyBag::ReadXMLFile(const char* pFilename) qboolean CXMLPropertyBag::WriteXMLFile(const char* pFilename) { int res = xmlSaveFormatFile(pFilename, mpDoc, 1); - + if(res == -1) return false; @@ -519,9 +521,9 @@ qboolean CXMLPropertyBag::WriteXMLFile(const char* pFilename) static void OnBtnBrowseEditor (GtkWidget *widget, gpointer data) { PrefsDlg *dlg = (PrefsDlg*)data; - - const char *filename = file_dialog(g_PrefsDlg.GetWidget(), TRUE, "Executable for Custom Editor"); - + + const char *filename = file_dialog(g_PrefsDlg.GetWidget(), TRUE, _("Executable for Custom Editor")); + if(filename != NULL) { dlg->m_strEditorCommand = filename; @@ -536,7 +538,7 @@ static void OnBtnBrowseprefab (GtkWidget *widget, gpointer data) char *path = dlg->m_strPrefabPath; if (strlen (path) == 0) path = g_strGameToolsPath; - char *dir = dir_dialog (g_PrefsDlg.GetWidget (), "Set prefab path", path); + char *dir = dir_dialog (g_PrefsDlg.GetWidget (), _("Set prefab path"), path); dlg->UpdateData(TRUE); if (dir != NULL) @@ -557,7 +559,7 @@ static void OnBtnBrowseuserini (GtkWidget *widget, gpointer data) if (strlen (path) == 0) path = g_strGameToolsPath; // TODO: INI filter? - const char *filename = file_dialog (g_PrefsDlg.GetWidget(), TRUE, "Find INI file", path); + const char *filename = file_dialog (g_PrefsDlg.GetWidget(), TRUE, _("Find INI file"), path); if (filename != NULL) { @@ -567,12 +569,12 @@ static void OnBtnBrowseuserini (GtkWidget *widget, gpointer data) } } -static void OnButtonClean (GtkWidget *widget, gpointer data) +static void OnButtonClean (GtkWidget *widget, gpointer data) { // make sure this is what the user wants - if (gtk_MessageBox (g_PrefsDlg.GetWidget (), "This will close Radiant and clean the corresponding registry entries.\n" - "Next time you start Radiant it will be good as new. Do you wish to continue?", - "Reset Registry", MB_YESNO) == IDYES) + if (gtk_MessageBox (g_PrefsDlg.GetWidget (), _("This will close Radiant and clean the corresponding registry entries.\n" + "Next time you start Radiant it will be good as new. Do you wish to continue?"), + _("Reset Registry"), MB_YESNO) == IDYES) { PrefsDlg *dlg = (PrefsDlg*)data; dlg->EndModal (IDCANCEL); @@ -634,6 +636,7 @@ PrefsDlg::PrefsDlg () m_bWideToolbar = TRUE; m_bPluginToolbar = TRUE; m_bNoClamp = FALSE; + m_bSnap = TRUE; m_strUserPath = ""; m_nRotation = 0; m_bChaseMouse = FALSE; @@ -693,11 +696,30 @@ Games selection dialog ========================================================= */ +#if defined(WIN32) +#define TOOLS_ATTRIBUTE "gametools_win32" +#define ENGINE_ATTRIBUTE "engine_win32" +#define ENGINEPATH_ATTRIBUTE "enginepath_win32" +#define MP_ENGINE_ATTRIBUTE "mp_engine_win32" +#elif defined(__linux__) || defined (__FreeBSD__) +#define TOOLS_ATTRIBUTE "gametools_linux" +#define ENGINE_ATTRIBUTE "engine_linux" +#define ENGINEPATH_ATTRIBUTE "enginepath_linux" +#define MP_ENGINE_ATTRIBUTE "mp_engine_linux" +#elif defined(__APPLE__) +#define TOOLS_ATTRIBUTE "gametools_macos" +#define ENGINE_ATTRIBUTE "engine_macos" +#define ENGINEPATH_ATTRIBUTE "enginepath_macos" +#define MP_ENGINE_ATTRIBUTE "mp_engine_macos" +#else +#error "unsupported platform" +#endif + CGameDescription::CGameDescription(xmlDocPtr pDoc, const Str &GameFile) { char *p, *prop; mpDoc = pDoc; - // read the user-friendly game name + // read the user-friendly game name xmlNodePtr pNode = mpDoc->children; while (strcmp((const char*)pNode->name, "game") && pNode != NULL) pNode=pNode->next; @@ -707,9 +729,9 @@ CGameDescription::CGameDescription(xmlDocPtr pDoc, const Str &GameFile) Error("Didn't find 'game' node in the game description file '%s'\n", pDoc->URL); } // on win32, game tools path can now be specified relative to the exe's cwd - prop = (char*)xmlGetProp( pNode, (xmlChar*)"gametools" ); + prop = (char*)xmlGetProp( pNode, (xmlChar*)TOOLS_ATTRIBUTE); if ( prop == NULL ) { - Error( "Didn't find 'gametools' node in the game description file '%s'\n", pDoc->URL ); + Error( "Didn't find '"TOOLS_ATTRIBUTE"' node in the game description file '%s'\n", pDoc->URL ); } { char full[PATH_MAX]; @@ -745,71 +767,117 @@ CGameDescription::CGameDescription(xmlDocPtr pDoc, const Str &GameFile) mGameFile = GameFile; - prop = (char*)xmlGetProp(pNode, (xmlChar*)"basegame"); + prop = (char*)xmlGetProp(pNode, (xmlChar*)"quake2"); if (prop == NULL) { // default - mBaseGame = "baseq3"; + quake2 = false; } else { - mBaseGame = prop; + quake2 = true; xmlFree(prop); } - // on win32, engine path can now be specified relative to the exe's cwd - prop = (char*)xmlGetProp(pNode, (const xmlChar *)"enginepath"); - if ( prop != NULL ) { - char full[PATH_MAX]; -#ifdef _WIN32 - _fullpath( full, prop, PATH_MAX ); -#else - strncpy( full, prop, PATH_MAX ); -#endif - xmlFree( prop ); - prop = NULL; - // process seperators - for ( p = full; *p != '\0'; p++ ) { - if ( *p == '\\' ) { - *p = '/'; - } - } - mEnginePath = full; - if ( p != full && *(p-1) != '/' ) { - mEnginePath += "/"; - } + // if this is set, the open maps dialoge will open the engine path not the + // home dir for map loading and saving + prop = (char*)xmlGetProp(pNode, (xmlChar*)"no_maps_in_home"); + if (prop == NULL) + { + // default + noMapsInHome = false; } else { - // if engine path was not specified in the .game, it implies we can guess it from the gametools path - // on win32, and for most game package, the gametools are installed with the game - char aux_path[PATH_MAX]; // aux - strcpy( aux_path, mGameToolsPath.GetBuffer() ); - if ( ( aux_path[ strlen(aux_path)-1 ] == '/' ) || ( aux_path[ strlen(aux_path)-1 ] == '\\' ) ) { - aux_path[strlen(aux_path)-1] = '\0'; // strip ending '/' if any - } - char up_path[PATH_MAX]; // up one level - ExtractFilePath( aux_path, up_path ); - mEnginePath = up_path; + noMapsInHome = true; + xmlFree(prop); } - prop = (char*)xmlGetProp(pNode, (xmlChar*)"engine"); + prop = (char*)xmlGetProp(pNode, (xmlChar*)"basegame"); if (prop == NULL) { -#ifdef _WIN32 - mEngine = "quake3.exe"; -#elif __linux__ - mEngine = "quake3"; -#elif __APPLE__ - mEngine = "Quake3.app"; -#endif + // default + mBaseGame = "baseq3"; } else { - mEngine = prop; + mBaseGame = prop; xmlFree(prop); } + + prop = (char*)xmlGetProp(pNode, (const xmlChar*)ENGINE_ATTRIBUTE); + if (prop == NULL) + { +#ifdef _WIN32 + mEngine = "quake3.exe"; +#elif __linux__ + mEngine = "quake3"; +#elif __APPLE__ + mEngine = "Quake3.app"; +#endif + } + else + { + mEngine = prop; + xmlFree(prop); + } + + prop = (char*)xmlGetProp(pNode, (const xmlChar*)MP_ENGINE_ATTRIBUTE); + if (prop == NULL) + { +#ifdef _WIN32 + mMultiplayerEngine = "quake3.exe"; +#elif __linux__ + mMultiplayerEngine = "quake3"; +#elif __APPLE__ + mMultiplayerEngine = "Quake3.app"; +#endif + } + else + { + mMultiplayerEngine = prop; + xmlFree(prop); + } + + { + // on win32, engine path can now be specified relative to the exe's cwd + prop = (char*)xmlGetProp(pNode, (const xmlChar *)ENGINEPATH_ATTRIBUTE); + if ( prop != NULL ) { + char full[PATH_MAX]; + #ifdef _WIN32 + _fullpath( full, prop, PATH_MAX ); + #else + strncpy( full, prop, PATH_MAX ); + #endif + xmlFree( prop ); + prop = NULL; + // process seperators + for ( p = full; *p != '\0'; p++ ) { + if ( *p == '\\' ) { + *p = '/'; + } + } + mEnginePath = full; + if ( p != full && *(p-1) != '/' ) { + mEnginePath += "/"; + } + } + else + { + // if engine path was not specified in the .game, it implies we can guess it from the gametools path + // on win32, and for most game package, the gametools are installed with the game + char aux_path[PATH_MAX]; // aux + strcpy( aux_path, mGameToolsPath.GetBuffer() ); + if ( ( aux_path[ strlen(aux_path)-1 ] == '/' ) || ( aux_path[ strlen(aux_path)-1 ] == '\\' ) ) { + aux_path[strlen(aux_path)-1] = '\0'; // strip ending '/' if any + } + char up_path[PATH_MAX]; // up one level + ExtractFilePath( aux_path, up_path ); + mEnginePath = up_path; + } + } + #if defined (__linux__) || defined (__APPLE__) // *nix specific prop = (char*)xmlGetProp(pNode, (const xmlChar *)"prefix"); @@ -905,8 +973,6 @@ CPrefAssignment::CPrefAssignment(const CPrefAssignment& ass) void CGameDialog::LoadPrefs() { - bool bEmpty = false; - // if we already have a document loaded, we will free and reload from file if (mGlobalPrefs.InUse()) { @@ -949,92 +1015,105 @@ void CGameDialog::SavePrefs() { // update the tree and save it mGlobalPrefs.UpdatePrefTree(); - + CString strGlobalPref = g_PrefsDlg.m_global_rc_path->str; strGlobalPref += "global.pref"; - - if (!mGlobalPrefs.WriteXMLFile(strGlobalPref.GetBuffer())) + + if ( !mGlobalPrefs.WriteXMLFile( strGlobalPref.GetBuffer() ) ) { Sys_FPrintf(SYS_ERR, "Error occured while saving global prefs file '%s'\n", strGlobalPref.GetBuffer()); + } } -void CGameDialog::DoGameDialog() -{ - // show the UI - DoModal(); +void CGameDialog::DoGameInstall() { + // make sure console logging is on whenever we enter the installation loop + g_PrefsDlg.mGamesDialog.m_bLogConsole = true; + Sys_LogFile(); + mGameInstall.Run(); +} + +void CGameDialog::DoGameDialog() { + // allow looping the game selection dialog with calls to the game configure dialog in between + while ( m_bDoGameInstall ) { - // unhook so we can use in other places - // we manually incref'ed it when creating, it won't be freed (destructor) - gtk_container_remove (GTK_CONTAINER (mTopBox), GetGlobalFrame()); + m_bDoGameInstall = false; - // we save the prefs file - SavePrefs(); + if ( DoModal() == IDCANCEL ) { + Error( "game selection dialog canceled, cannot continue" ); + return; + } + + if ( m_bDoGameInstall ) { + DoGameInstall(); + ScanForGames(); + // and we will loop to do another DoModal dialog + } + } + + // unhook so we can use in other places + // we manually incref'ed it when creating, it won't be freed (destructor) + gtk_container_remove( GTK_CONTAINER( mTopBox ), GetGlobalFrame() ); + + // we save the prefs file + SavePrefs(); } GtkWidget* CGameDialog::GetGlobalFrame() { GtkWidget *vbox, *text, *combo, *check; - if (mFrame) - return mFrame; - - mFrame = gtk_frame_new(NULL); - gtk_container_set_border_width(GTK_CONTAINER(mFrame), 5); - gtk_widget_show(mFrame); + if ( mFrame != NULL ) { + return mFrame; + } - vbox = gtk_vbox_new (FALSE, 6); - gtk_widget_show (vbox); - gtk_container_add (GTK_CONTAINER (mFrame), vbox); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 5); + mFrame = gtk_frame_new( NULL ); + gtk_container_set_border_width( GTK_CONTAINER( mFrame ), 5 ); + gtk_widget_show( mFrame ); - text = gtk_label_new("Select the game:"); - gtk_widget_show(text); - gtk_box_pack_start (GTK_BOX(vbox), text, FALSE, FALSE, 0); + vbox = gtk_vbox_new( FALSE, 6 ); + gtk_widget_show( vbox ); + gtk_container_add( GTK_CONTAINER( mFrame ), vbox ); + gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); - combo = gtk_combo_new(); - gtk_widget_show(combo); - gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, FALSE, 0); + text = gtk_label_new( _("Select the game:") ); + gtk_widget_show( text ); + gtk_box_pack_start( GTK_BOX( vbox ), text, FALSE, FALSE, 0 ); - // fill in with the game descriptions - GList *combo_list = (GList*)NULL; - list::iterator iGame; - for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++) - { - combo_list = g_list_append (combo_list, (void *)(*iGame)->mGameName.GetBuffer()); - } - gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list); - g_list_free (combo_list); + combo = gtk_combo_box_new_text(); + gtk_widget_show( combo ); + gtk_box_pack_start( GTK_BOX( vbox ), combo, FALSE, FALSE, 0 ); + AddDialogData( combo, &m_nComboSelect, DLG_COMBO_BOX_INT ); + mGameCombo = GTK_COMBO_BOX( combo ); - AddDialogData (combo, &m_nComboSelect, DLG_COMBO_INT); + UpdateGameCombo(); - check = gtk_check_button_new_with_label("Auto load selected game on startup"); + check = gtk_check_button_new_with_label( _("Auto load selected game on startup") ); gtk_widget_show(check); gtk_box_pack_start (GTK_BOX(vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bAutoLoadGame, DLG_CHECK_BOOL); - - text = gtk_label_new("(this frame is available in the prefs menu if you set auto-select)"); + + text = gtk_label_new(_("(this frame is available in the prefs menu if you set auto-select)")); gtk_widget_show(text); gtk_box_pack_start (GTK_BOX(vbox), text, FALSE, FALSE, 0); #ifdef _WIN32 - check = gtk_check_button_new_with_label("Networked install - per-user settings"); - gtk_widget_show(check); - gtk_box_pack_start (GTK_BOX(vbox), check, FALSE, FALSE, 0); - AddDialogData (check, &m_bNetRun, DLG_CHECK_BOOL); + check = gtk_check_button_new_with_label( _("Networked install - per-user settings") ); + gtk_widget_show( check ); + gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + AddDialogData( check, &m_bNetRun, DLG_CHECK_BOOL ); #endif - check = gtk_check_button_new_with_label("Log the console to radiant.log"); - gtk_widget_show(check); - gtk_box_pack_start (GTK_BOX(vbox), check, FALSE, FALSE, 0); - AddDialogData (check, &m_bLogConsole, DLG_CHECK_BOOL); + check = gtk_check_button_new_with_label( _("Log the console to radiant.log") ); + gtk_widget_show( check ); + gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + AddDialogData( check, &m_bLogConsole, DLG_CHECK_BOOL ); // incref it so we can pass it around - gtk_widget_ref (GTK_WIDGET(mFrame)); + gtk_widget_ref( GTK_WIDGET( mFrame ) ); return mFrame; } -void CGameDialog::UpdateData (bool retrieve) -{ +void CGameDialog::UpdateData( bool retrieve ) { if (!retrieve) { // use m_sGameFile to set m_nComboSelect @@ -1070,25 +1149,65 @@ void CGameDialog::UpdateData (bool retrieve) } } -void CGameDialog::BuildDialog() -{ - GtkWidget *dlg, *vbox1, *button; +void CGameDialog::SInstallCallback( GtkWidget *widget, gpointer data ) { + CGameDialog *d = static_cast< CGameDialog* >( data ); + d->m_bDoGameInstall = true; + d->EndModal( 0 ); +} - dlg = m_pWidget; - gtk_window_set_title (GTK_WINDOW (dlg), "Select Game"); +void CGameDialog::BuildDialog() { + GtkWidget *dlg, *vbox1, *button, *setup_button; - vbox1 = gtk_vbox_new (FALSE, 0); - gtk_widget_show(vbox1); - gtk_container_add (GTK_CONTAINER (dlg), vbox1); + dlg = m_pWidget; + gtk_window_set_title( GTK_WINDOW( dlg ), _("Select Game") ); - gtk_container_add (GTK_CONTAINER (vbox1), GetGlobalFrame()); - mTopBox = vbox1; + vbox1 = gtk_vbox_new( FALSE, 0 ); + gtk_widget_show( vbox1 ); + gtk_container_add( GTK_CONTAINER( dlg ), vbox1 ); - button = gtk_button_new_with_label ("OK"); - gtk_widget_show (button); - gtk_box_pack_start (GTK_BOX (vbox1), button, FALSE, FALSE, 0); - AddModalButton(button, IDOK); - gtk_widget_set_usize (button, 60, -2); + gtk_container_add( GTK_CONTAINER( vbox1 ), GetGlobalFrame() ); + mTopBox = vbox1; + + setup_button = gtk_button_new_with_label( _("Configure more games") ); + gtk_widget_show( setup_button ); + gtk_box_pack_start( GTK_BOX( vbox1 ), setup_button, FALSE, FALSE, 0 ); + gtk_signal_connect( GTK_OBJECT( setup_button ), "clicked", + GTK_SIGNAL_FUNC( SInstallCallback ), this ); + + button = gtk_button_new_with_label( _("OK") ); + gtk_widget_show( button ); + gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 ); + AddModalButton( button, IDOK ); + + button = gtk_button_new_with_label( _("Cancel") ); + gtk_widget_show( button ); + gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 ); + AddModalButton( button, IDCANCEL ); + + gtk_widget_set_usize( button, 60, -2 ); +} + +void CGameDialog::UpdateGameCombo() { + // fill in with the game descriptions + list::iterator iGame; + + if ( mGameCombo == NULL ) { + Sys_Printf( "mGameCombo == NULL\n" ); + return; + } + + // clear whatever is in - wtf no way to know how many text entries? + // use set/get active to track + gtk_combo_box_set_active( mGameCombo, 0 ); + while ( gtk_combo_box_get_active( mGameCombo ) == 0 ) { + gtk_combo_box_remove_text( mGameCombo, 0 ); + gtk_combo_box_set_active( mGameCombo, 0 ); + } + + for ( iGame = mGames.begin(); iGame != mGames.end(); iGame++ ) { + gtk_combo_box_append_text( mGameCombo, (*iGame)->mGameName.GetBuffer() ); + } + gtk_combo_box_set_active( mGameCombo, 0 ); } void CGameDialog::ScanForGames() @@ -1100,7 +1219,16 @@ void CGameDialog::ScanForGames() strGamesPath += "games"; const char *path = strGamesPath.GetBuffer(); - Sys_Printf("Scanning for game description files: %s\n", path); + if ( !mGames.empty() ) { + Sys_Printf( "Clearing game list\n" ); + list::iterator iGame; + for ( iGame = mGames.begin(); iGame != mGames.end(); iGame++ ) { + delete (*iGame); + } + mGames.clear(); + } + + Sys_Printf( "Scanning for game description files: %s\n", path ); /*! \todo FIXME LINUX: @@ -1136,56 +1264,34 @@ void CGameDialog::ScanForGames() xmlDocPtr pDoc = xmlParseFile(strPath.GetBuffer()); if (pDoc) { - mGames.push_front(new CGameDescription(pDoc, dirlist)); + mGames.push_front( new CGameDescription( pDoc, dirlist ) ); } else { Sys_FPrintf(SYS_ERR, "XML parser failed on '%s'\n", strPath.GetBuffer()); } - g_free(dirlist); + g_free( dirlist ); } - g_dir_close (dir); + g_dir_close( dir ); } + + // entries in the combo need to be updated + UpdateGameCombo(); } CGameDescription* CGameDialog::GameDescriptionForComboItem() { list::iterator iGame; int i=0; - for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++,i++) - { - if (i == m_nComboSelect) - { + for( iGame = mGames.begin(); iGame != mGames.end(); iGame++,i++ ) { + if ( i == m_nComboSelect ) { return (*iGame); } } return NULL; // not found } -/*GString* CGameDialog::InitGlobalPrefPath() -{ - GString* global_rc_path; - // configure m_global_rc_path -#if defined (__linux__) || defined (__APPLE__) - global_rc_path = g_string_new (g_get_home_dir ()); - - if (global_rc_path->str[global_rc_path->len-1] != '/') - g_string_append (global_rc_path, "/"); - - g_string_append (global_rc_path, ".radiant/"); - mkdir (global_rc_path->str, 0775); - g_string_append (global_rc_path, RADIANT_VERSION); - g_string_append (global_rc_path, "/"); - mkdir (global_rc_path->str, 0775); -#elif WIN32 - global_rc_path = g_string_new (g_strAppPath.GetBuffer() ); -#else -#error "WTF are you compiling under" -#endif - return global_rc_path; -}*/ - void CGameDialog::InitGlobalPrefPath() { GString *global_rc_path; @@ -1208,13 +1314,15 @@ void CGameDialog::Init() { InitGlobalPrefPath(); ScanForGames(); - if (mGames.empty()) - { - Error("Didn't find any valid game file descriptions, aborting\n"); + if ( mGames.empty() ) { + DoGameInstall(); + ScanForGames(); + if ( mGames.empty() ) { + Error( "No games setup, aborting\n" ); + } } LoadPrefs(); - if (m_bAutoLoadGame) - { + if ( m_bAutoLoadGame ) { // search by .game name list::iterator iGame; for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++) @@ -1226,13 +1334,13 @@ void CGameDialog::Init() } } } - if (!m_bAutoLoadGame || !m_pCurrentGameDescription) - { + if ( !m_bAutoLoadGame || !m_pCurrentGameDescription ) { DoGameDialog(); // use m_nComboSelect to identify the game to run as and set the globals m_pCurrentGameDescription = GameDescriptionForComboItem(); - if (!m_pCurrentGameDescription) - Error("Lookup of game description object failed, can't continue\n"); + if ( !m_pCurrentGameDescription ) { + Error("Lookup of game description object failed, can't continue\n"); + } } g_pGameDescription = m_pCurrentGameDescription; @@ -1249,7 +1357,7 @@ void CGameDialog::Init() #else g_qeglobals.m_strHomeGame = g_pGameDescription->mEnginePath.GetBuffer(); #endif - + g_pGameDescription->Dump(); } @@ -1275,11 +1383,12 @@ void CGameDialog::AddPacksURL(Str &URL) // FIXME: this is kinda hardcoded for now.. list::iterator iGame; for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++) - { - if ((*iGame)->mGameFile == "q3.game") + { + if ((*iGame)->mGameFile == "q3.game") URL += "&Games_dlup%5B%5D=1"; else if ((*iGame)->mGameFile == "wolf.game") URL += "&Games_dlup%5B%5D=2"; + // FIXME: double entry else if ((*iGame)->mGameFile == "wolf.game") URL += "&Games_dlup%5B%5D=3"; else if ((*iGame)->mGameFile == "jk2.game") @@ -1306,7 +1415,6 @@ void CGameDialog::UpdateNetrun(bool retrieve) strNetrun = g_strAppPath; strNetrun += NETRUN_FILENAME; if (!retrieve) { - // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=639 // now check if we are running from a network installation // use a dummy file as the flag f_netrun = fopen(strNetrun.GetBuffer(), "r"); @@ -1393,16 +1501,16 @@ void PrefsDlg::Init() #endif // this is common to win32 and Linux init now m_rc_path = g_string_new (m_global_rc_path->str); - + // game sub-dir g_string_append (m_rc_path, g_pGameDescription->mGameFile.GetBuffer()); g_string_append (m_rc_path, "/"); Q_mkdir (m_rc_path->str, 0775); - + // then the ini file m_inipath = g_string_new (m_rc_path->str); g_string_append (m_inipath, PREFS_LOCAL_FILENAME); - + } void PrefsDlg::UpdateData (bool retrieve) @@ -1439,7 +1547,7 @@ void PrefsDlg::showPrefPage(int prefpage) { if(gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook)) != prefpage) gtk_notebook_set_page(GTK_NOTEBOOK(notebook), prefpage); - + return; } @@ -1466,46 +1574,46 @@ void PrefsDlg::BuildDialog () GtkWidget *check, *label, *scale, *hbox2, *combo, *table, *spin, *entry, *pixmap, *radio, *button, *pageframe, *vbox; - + GList *combo_list = (GList*)NULL; - + GtkObject *adj; - + dialog = m_pWidget; - gtk_window_set_title(GTK_WINDOW(dialog), "GtkRadiant Preferences"); + gtk_window_set_title(GTK_WINDOW(dialog), _("GtkRadiant Preferences")); gtk_widget_realize(dialog); - + mainvbox = gtk_vbox_new(FALSE, 5); gtk_container_add(GTK_CONTAINER(dialog), mainvbox); gtk_container_set_border_width(GTK_CONTAINER(mainvbox), 5); gtk_widget_show(mainvbox); - + hbox = gtk_hbox_new(FALSE, 5); gtk_widget_show(hbox); gtk_box_pack_end(GTK_BOX(mainvbox), hbox, FALSE, TRUE, 0); - button = gtk_button_new_with_label("OK"); + button = gtk_button_new_with_label(_("OK")); gtk_widget_show(button); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_widget_set_usize(button, 60, -2); AddModalButton(button, IDOK); - button = gtk_button_new_with_label("Cancel"); + button = gtk_button_new_with_label(_("Cancel")); gtk_widget_show(button); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_widget_set_usize(button, 60, -2); - AddModalButton (button, IDCANCEL); + AddModalButton(button, IDCANCEL); - button = gtk_button_new_with_label ("Clean"); + button = gtk_button_new_with_label (_("Clean")); gtk_widget_show(button); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(OnButtonClean), this); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_widget_set_usize (button, 60, -2); - + hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(mainvbox), hbox, TRUE, TRUE, 0); gtk_widget_show(hbox); - + sc_win = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sc_win), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_box_pack_start(GTK_BOX(hbox), sc_win, FALSE, FALSE, 0); @@ -1528,7 +1636,7 @@ void PrefsDlg::BuildDialog () { GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); - GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes("Preferences", renderer, "text", 0, NULL); + GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes(_("Preferences"), renderer, "text", 0, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); } @@ -1548,97 +1656,97 @@ void PrefsDlg::BuildDialog () { GtkTreeIter group; gtk_tree_store_append(store, &group, NULL); - gtk_tree_store_set(store, &group, 0, "Globals", 1, PTAB_FRONT, -1); + gtk_tree_store_set(store, &group, 0, _("Globals"), 1, PTAB_FRONT, -1); { GtkTreeIter tab; gtk_tree_store_append(store, &tab, &group); - gtk_tree_store_set(store, &tab, 0, "Game settings", 1, (gpointer)PTAB_GAME_SETTINGS, -1); + gtk_tree_store_set(store, &tab, 0, _("Game settings"), 1, (gpointer)PTAB_GAME_SETTINGS, -1); } } { GtkTreeIter group; gtk_tree_store_append(store, &group, NULL); - gtk_tree_store_set(store, &group, 0, "Display", 1, PTAB_FRONT, -1); + gtk_tree_store_set(store, &group, 0, _("Display"), 1, PTAB_FRONT, -1); { GtkTreeIter tab; gtk_tree_store_append(store, &tab, &group); - gtk_tree_store_set(store, &tab, 0, "2D Display/Rendering", 1, (gpointer)PTAB_2D, -1); + gtk_tree_store_set(store, &tab, 0, _("2D Display/Rendering"), 1, (gpointer)PTAB_2D, -1); } { GtkTreeIter tab; gtk_tree_store_append(store, &tab, &group); - gtk_tree_store_set(store, &tab, 0, "3D View", 1, (gpointer)PTAB_CAMERA, -1); + gtk_tree_store_set(store, &tab, 0, _("3D View"), 1, (gpointer)PTAB_CAMERA, -1); } { GtkTreeIter tab; gtk_tree_store_append(store, &tab, &group); - gtk_tree_store_set(store, &tab, 0, "Texture Settings", 1, (gpointer)PTAB_TEXTURE, -1); + gtk_tree_store_set(store, &tab, 0, _("Texture Settings"), 1, (gpointer)PTAB_TEXTURE, -1); } } - + { GtkTreeIter group; gtk_tree_store_append(store, &group, NULL); - gtk_tree_store_set(store, &group, 0, "Interface", 1, PTAB_FRONT, -1); + gtk_tree_store_set(store, &group, 0, _("Interface"), 1, PTAB_FRONT, -1); { GtkTreeIter tab; gtk_tree_store_append(store, &tab, &group); - gtk_tree_store_set(store, &tab, 0, "Layout", 1, (gpointer)PTAB_LAYOUT, -1); + gtk_tree_store_set(store, &tab, 0, _("Layout"), 1, (gpointer)PTAB_LAYOUT, -1); } { GtkTreeIter tab; gtk_tree_store_append(store, &tab, &group); - gtk_tree_store_set(store, &tab, 0, "Mouse", 1, (gpointer)PTAB_MOUSE, -1); + gtk_tree_store_set(store, &tab, 0, _("Mouse"), 1, (gpointer)PTAB_MOUSE, -1); } { GtkTreeIter tab; gtk_tree_store_append(store, &tab, &group); - gtk_tree_store_set(store, &tab, 0, "Editing", 1, (gpointer)PTAB_EDITING, -1); + gtk_tree_store_set(store, &tab, 0, _("Editing"), 1, (gpointer)PTAB_EDITING, -1); } } - + { GtkTreeIter group; gtk_tree_store_append(store, &group, NULL); - gtk_tree_store_set(store, &group, 0, "Other", 1, PTAB_FRONT, -1); + gtk_tree_store_set(store, &group, 0, _("Other"), 1, PTAB_FRONT, -1); { GtkTreeIter tab; gtk_tree_store_append(store, &tab, &group); - gtk_tree_store_set(store, &tab, 0, "Startup/Auto save", 1, (gpointer)PTAB_STARTUP, -1); + gtk_tree_store_set(store, &tab, 0, _("Startup/Auto save"), 1, (gpointer)PTAB_STARTUP, -1); } { GtkTreeIter tab; gtk_tree_store_append(store, &tab, &group); - gtk_tree_store_set(store, &tab, 0, "Paths", 1, (gpointer)PTAB_PATHS, -1); + gtk_tree_store_set(store, &tab, 0, _("Paths"), 1, (gpointer)PTAB_PATHS, -1); } { GtkTreeIter tab; gtk_tree_store_append(store, &tab, &group); - gtk_tree_store_set(store, &tab, 0, "Misc", 1, (gpointer)PTAB_MISC, -1); + gtk_tree_store_set(store, &tab, 0, _("Misc"), 1, (gpointer)PTAB_MISC, -1); } if (!g_qeglobals.bBSPFrontendPlugin) { GtkTreeIter tab; gtk_tree_store_append(store, &tab, &group); - gtk_tree_store_set(store, &tab, 0, "BSP Monitoring", 1, (gpointer)PTAB_BSPMONITOR, -1); + gtk_tree_store_set(store, &tab, 0, _("BSP Monitoring"), 1, (gpointer)PTAB_BSPMONITOR, -1); } } } gtk_tree_view_expand_all(GTK_TREE_VIEW(view)); - + g_object_unref(G_OBJECT(store)); } - + /**********************************************************************/ /* build the prefs pages */ /**********************************************************************/ - + // Front page... // todo : add something interesting here // NOTE TTimo: tip of the day? or a logo? - preflabel = gtk_label_new("Front Page"); + preflabel = gtk_label_new(_("Front Page")); gtk_widget_show(preflabel); pageframe = gtk_frame_new(NULL); gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5); @@ -1648,55 +1756,55 @@ void PrefsDlg::BuildDialog () gtk_widget_set_usize(GTK_WIDGET(vbox), 350, -2); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); gtk_container_add(GTK_CONTAINER(pageframe), vbox); - + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel); /******** global preferences group ****************************/ - preflabel = gtk_label_new("Globals"); + preflabel = gtk_label_new(_("Globals")); gtk_widget_show(preflabel); pageframe = mGamesDialog.GetGlobalFrame(); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel); - + /******** 2D prefs group (xy views/rendering options) *********/ - preflabel = gtk_label_new("2D Display"); + preflabel = gtk_label_new(_("2D Display")); gtk_widget_show(preflabel); - pageframe = gtk_frame_new("2D Display"); + pageframe = gtk_frame_new(_("2D Display")); gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5); gtk_widget_show(pageframe); vbox = gtk_vbox_new(FALSE, 5); gtk_widget_show(vbox); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); gtk_container_add(GTK_CONTAINER(pageframe), vbox); - + // OpenGL Display Lists - check = gtk_check_button_new_with_label("OpenGL Display Lists"); + check = gtk_check_button_new_with_label(_("OpenGL Display Lists")); gtk_widget_show(check); gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0); AddDialogData(check, &m_bDisplayLists, DLG_CHECK_BOOL); - + // Antialiased points & lines // Fishman - Add antialiazed points and lines support. 09/03/00 - check = gtk_check_button_new_with_label ("OpenGL antialiased points and lines"); + check = gtk_check_button_new_with_label (_("OpenGL antialiased points and lines")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bAntialiasedPointsAndLines, DLG_CHECK_BOOL); - + // Solid selection boxes - check = gtk_check_button_new_with_label ("Solid selection boxes"); + check = gtk_check_button_new_with_label (_("Solid selection boxes")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bNoStipple, DLG_CHECK_BOOL); - + // Display size info - check = gtk_check_button_new_with_label ("Display size info"); + check = gtk_check_button_new_with_label (_("Display size info")); gtk_widget_show (check); gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bSizePaint, DLG_CHECK_BOOL); // Alternate vertex/edge handles // Gef: Kyro GL_POINT work around 25-aug-2001 - check = gtk_check_button_new_with_label ("Alternate vertex/edge handles"); + check = gtk_check_button_new_with_label (_("Alternate vertex/edge handles")); gtk_widget_show(check); gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0); AddDialogData(check, &m_bGlPtWorkaround, DLG_CHECK_BOOL); @@ -1705,20 +1813,19 @@ void PrefsDlg::BuildDialog () #ifdef ATIHACK_812 // ATI bugs - // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=812 - check = gtk_check_button_new_with_label ("ATI cards with broken drivers - bug #802"); + check = gtk_check_button_new_with_label (_("ATI cards with broken drivers - bug #802")); gtk_widget_show(check); gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0); AddDialogData(check, &m_bGlATIHack, DLG_CHECK_BOOL); #endif - + // Add the page to the notebook gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel); - + /******** 3D Camera view group *********/ - preflabel = gtk_label_new("3D View"); + preflabel = gtk_label_new(_("3D View")); gtk_widget_show(preflabel); - pageframe = gtk_frame_new("3D View"); + pageframe = gtk_frame_new(_("3D View")); gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5); gtk_widget_show(pageframe); vbox = gtk_vbox_new(FALSE, 5); @@ -1731,62 +1838,62 @@ void PrefsDlg::BuildDialog () hbox2 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox2); gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0); - + // label - label = gtk_label_new("Movement Velocity"); + label = gtk_label_new(_("Movement Velocity")); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_widget_show(label); gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0); - + // adjustment adj = gtk_adjustment_new(100, 50, 300, 1, 10, 10); AddDialogData(adj, &m_nMoveSpeed, DLG_ADJ_INT); - + // scale scale = gtk_hscale_new(GTK_ADJUSTMENT(adj)); gtk_widget_show(scale); gtk_box_pack_start(GTK_BOX (vbox), scale, FALSE, TRUE, 2); - + gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE); - + // Angular velocity (Rotational Velocity) // label container hbox2 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox2); gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0); - + // label - label = gtk_label_new ("Rotational Velocity"); + label = gtk_label_new (_("Rotational Velocity")); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_widget_show (label); gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0); - + // adjustment adj = gtk_adjustment_new (3, 1, 180, 1, 10, 10); // value, low, high, step, page_step, page_size AddDialogData (adj, &m_nAngleSpeed, DLG_ADJ_INT); - + // scale scale = gtk_hscale_new (GTK_ADJUSTMENT (adj)); gtk_widget_show (scale); gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, TRUE, 2); - gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE); + gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE); // Text under the velocity sliders // container hbox2 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox2); gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0); - + // label - label = gtk_label_new ("slow"); + label = gtk_label_new (_("slow")); gtk_widget_show (label); gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0); - + // label - label = gtk_label_new ("fast"); + label = gtk_label_new (_("fast")); gtk_widget_show (label); gtk_box_pack_end (GTK_BOX (hbox2), label, FALSE, FALSE, 0); - + // Allow drag to select multiple faces/brushes // container table = gtk_table_new(2, 1, FALSE); @@ -1795,7 +1902,7 @@ void PrefsDlg::BuildDialog () gtk_table_set_row_spacings (GTK_TABLE (table), 5); gtk_table_set_col_spacings (GTK_TABLE (table), 5); - label = gtk_label_new ("Use paint-select in camera view:"); + label = gtk_label_new (_("Use paint-select in camera view:")); gtk_widget_show (label); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, @@ -1803,9 +1910,9 @@ void PrefsDlg::BuildDialog () (GtkAttachOptions) (0), 0, 0); combo_list = NULL; - combo_list = g_list_append (combo_list, (void *)"No"); - combo_list = g_list_append (combo_list, (void *)"Yes"); - combo_list = g_list_append (combo_list, (void *)"Yes (Classic Key Setup)"); + combo_list = g_list_append (combo_list, (void *)_("No")); + combo_list = g_list_append (combo_list, (void *)_("Yes")); + combo_list = g_list_append (combo_list, (void *)_("Yes (Classic Key Setup)")); combo = gtk_combo_new (); gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list); @@ -1814,38 +1921,38 @@ void PrefsDlg::BuildDialog () (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE); - AddDialogData (combo, &m_nCamDragMultiSelect, DLG_COMBO_INT); + AddDialogData (combo, &m_nCamDragMultiSelect, DLG_COMBO_INT); // Freelook in Camera view - check = gtk_check_button_new_with_label ("Freelook in Camera view"); + check = gtk_check_button_new_with_label (_("Freelook in Camera view")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT); AddDialogData (check, &m_bCamFreeLook, DLG_CHECK_BOOL); // Freelook in Camera view w/ forward & back strafing instead of up and down looking - check = gtk_check_button_new_with_label ("Freelook strafes Forward and Back"); + check = gtk_check_button_new_with_label (_("Freelook strafes Forward and Back")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT); AddDialogData (check, &m_bCamFreeLookStrafe, DLG_CHECK_BOOL); // Invert mouse in freelook - check = gtk_check_button_new_with_label ("Invert mouse in freelook"); + check = gtk_check_button_new_with_label (_("Invert mouse in freelook")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT); AddDialogData (check, &m_bCamInverseMouse, DLG_CHECK_BOOL); // Discrete movement - check = gtk_check_button_new_with_label ("Discrete movement"); + check = gtk_check_button_new_with_label (_("Discrete movement")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT); AddDialogData (check, &m_bCamDiscrete, DLG_CHECK_BOOL); // Update XY views on camera move - check = gtk_check_button_new_with_label ("Update XY views on camera move"); + check = gtk_check_button_new_with_label (_("Update XY views on camera move")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT); @@ -1855,28 +1962,28 @@ void PrefsDlg::BuildDialog () gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel); /******** Texture group *********/ - preflabel = gtk_label_new("Textures"); + preflabel = gtk_label_new(_("Textures")); gtk_widget_show(preflabel); - pageframe = gtk_frame_new("Textures"); + pageframe = gtk_frame_new(_("Textures")); gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5); gtk_widget_show(pageframe); vbox = gtk_vbox_new(FALSE, 6); gtk_widget_show(vbox); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); gtk_container_add(GTK_CONTAINER(pageframe), vbox); - + // Texture quality slider // label - label = gtk_label_new ("Texture quality"); + label = gtk_label_new (_("Texture quality")); gtk_widget_show (label); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); - + // adjustment adj = gtk_adjustment_new (0, 0, 4, 1, 1, 1); AddDialogData (adj, &m_nLatchedTextureQuality, DLG_ADJ_INT); - + // scale scale = gtk_hscale_new (GTK_ADJUSTMENT (adj)); gtk_widget_show (scale); @@ -1887,27 +1994,27 @@ void PrefsDlg::BuildDialog () hbox2 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox2); gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0); - label = gtk_label_new ("low"); + label = gtk_label_new (_("low")); gtk_widget_show (label); gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0); - label = gtk_label_new ("high"); + label = gtk_label_new (_("high")); gtk_widget_show (label); gtk_box_pack_end (GTK_BOX (hbox2), label, FALSE, FALSE, 0); // texture subsets - check = gtk_check_button_new_with_label ("Texture subsets"); + check = gtk_check_button_new_with_label (_("Texture subsets")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bTextureWindow, DLG_CHECK_BOOL); - + // texture scrollbar - check = gtk_check_button_new_with_label ("Texture scrollbar"); + check = gtk_check_button_new_with_label (_("Texture scrollbar")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bTextureScrollbar, DLG_CHECK_BOOL); // texture increment matches grid - check = gtk_check_button_new_with_label ("Tex increment matches grid"); + check = gtk_check_button_new_with_label (_("Tex increment matches grid")); gtk_widget_show (check); gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bSnapTToGrid, DLG_CHECK_BOOL); @@ -1921,7 +2028,7 @@ void PrefsDlg::BuildDialog () gtk_table_set_row_spacings (GTK_TABLE (table), 5); gtk_table_set_col_spacings (GTK_TABLE (table), 5); - label = gtk_label_new ("Texture Compression (if available):"); + label = gtk_label_new (_("Texture Compression (if available):")); gtk_widget_show (label); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, @@ -1932,21 +2039,21 @@ void PrefsDlg::BuildDialog () // Texture compression choice label combo_list = NULL; // NONE will always be in pos 0 - combo_list = g_list_append (combo_list, (void *)"None"); + combo_list = g_list_append (combo_list, (void *)_("None")); // if OpenGL compression is enabled it will always be // in pos 1 if (g_qeglobals.m_bOpenGLCompressionSupported) { - combo_list = g_list_append (combo_list, (void *)"OpenGL ARB"); + combo_list = g_list_append (combo_list, (void *)_("OpenGL ARB")); } // If S3 is enabled offer all 3 valid compression schemes in RGBA if (g_qeglobals.m_bS3CompressionSupported) { - combo_list = g_list_append (combo_list, (void *)"S3TC DXT1"); - combo_list = g_list_append (combo_list, (void *)"S3TC DXT3"); - combo_list = g_list_append (combo_list, (void *)"S3TC DXT5"); + combo_list = g_list_append (combo_list, (void *)_("S3TC DXT1")); + combo_list = g_list_append (combo_list, (void *)_("S3TC DXT3")); + combo_list = g_list_append (combo_list, (void *)_("S3TC DXT5")); } combo = gtk_combo_new (); @@ -1968,24 +2075,24 @@ void PrefsDlg::BuildDialog () // Startup shaders // label - label = gtk_label_new ("Startup Shaders:"); + label = gtk_label_new (_("Startup Shaders:")); gtk_widget_show (label); gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); - + // combo list combo_list = NULL; - combo_list = g_list_append (combo_list, (void *)"None"); + combo_list = g_list_append (combo_list, (void *)_("None")); if (g_pGameDescription->mGameFile == "jk2.game" || g_pGameDescription->mGameFile == "ja.game") - combo_list = g_list_append (combo_list, (void *)"System"); + combo_list = g_list_append (combo_list, (void *)_("System")); else if (g_pGameDescription->mGameFile == "sof2.game") - combo_list = g_list_append (combo_list, (void *)"Tools"); + combo_list = g_list_append (combo_list, (void *)("Tools")); else - combo_list = g_list_append (combo_list, (void *)"Common"); - combo_list = g_list_append (combo_list, (void *)"All"); + combo_list = g_list_append (combo_list, (void *)_("Common")); + combo_list = g_list_append (combo_list, (void *)_("All")); combo = gtk_combo_new (); gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list); gtk_widget_show (combo); @@ -1995,14 +2102,14 @@ void PrefsDlg::BuildDialog () gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE); AddDialogData (combo, &m_nLatchedShader, DLG_COMBO_INT); g_list_free (combo_list); - + // Add the page to the notebook gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel); - + /******** Layout group *********/ - preflabel = gtk_label_new("Layout"); + preflabel = gtk_label_new(_("Layout")); gtk_widget_show(preflabel); - pageframe = gtk_frame_new("Layout"); + pageframe = gtk_frame_new(_("Layout")); gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5); gtk_widget_show(pageframe); vbox = gtk_vbox_new(FALSE, 5); @@ -2074,15 +2181,15 @@ void PrefsDlg::BuildDialog () (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); AddDialogData (radio, &m_nLatchedView, DLG_RADIO_INT); - + // Floating Z window - check = gtk_check_button_new_with_label ("Floating Z Window"); + check = gtk_check_button_new_with_label (_("Floating Z Window")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bLatchedFloatingZ, DLG_CHECK_BOOL); - + // show menu tear-off seperators - check = gtk_check_button_new_with_label ("Detachable Menus"); + check = gtk_check_button_new_with_label (_("Detachable Menus")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bLatchedDetachableMenus, DLG_CHECK_BOOL); @@ -2090,7 +2197,7 @@ void PrefsDlg::BuildDialog () if (!g_pGameDescription->mNoPatch) { // show patch toolbar - check = gtk_check_button_new_with_label ("Patch Toolbar"); + check = gtk_check_button_new_with_label (_("Patch Toolbar")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); g_object_set_data (G_OBJECT (dialog), "check_patchtoolbar", check); // Allow to be disabled for Q1/Q2 @@ -2098,48 +2205,48 @@ void PrefsDlg::BuildDialog () } // use wide toolbar - check = gtk_check_button_new_with_label ("Wide Toolbar"); + check = gtk_check_button_new_with_label (_("Wide Toolbar")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bLatchedWideToolbar, DLG_CHECK_BOOL); // use plugin toolbar - check = gtk_check_button_new_with_label ("Plugin Toolbar"); + check = gtk_check_button_new_with_label (_("Plugin Toolbar")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bLatchedPluginToolbar, DLG_CHECK_BOOL); #ifdef _WIN32 // win32 file dialog - check = gtk_check_button_new_with_label ("Use win32 file load dialog"); + check = gtk_check_button_new_with_label (_("Use win32 file load dialog")); gtk_widget_show (check); // gtk_container_add (GTK_CONTAINER (vbox), check); gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bNativeGUI, DLG_CHECK_BOOL); // position on primary monitor - check = gtk_check_button_new_with_label ("Start on Primary Monitor"); + check = gtk_check_button_new_with_label (_("Start on Primary Monitor")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); g_object_set_data (G_OBJECT (dialog), "check_startonprimary", check); gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateSensitivity), this ); AddDialogData (check, &m_bStartOnPrimMon, DLG_CHECK_BOOL); -#endif +#endif // Add the page to the notebook gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel); - + /******** Mouse group *********/ - preflabel = gtk_label_new("Mouse"); + preflabel = gtk_label_new(_("Mouse")); gtk_widget_show(preflabel); - pageframe = gtk_frame_new("Mouse"); + pageframe = gtk_frame_new(_("Mouse")); gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5); gtk_widget_show(pageframe); vbox = gtk_vbox_new(FALSE, 5); gtk_widget_show(vbox); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); gtk_container_add(GTK_CONTAINER(pageframe), vbox); - + // Buttons // container hbox2 = gtk_hbox_new (FALSE, 5); @@ -2147,30 +2254,30 @@ void PrefsDlg::BuildDialog () gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0); // 2 button radio - radio = gtk_radio_button_new_with_label (NULL, "2 button"); + radio = gtk_radio_button_new_with_label (NULL, _("2 button")); gtk_widget_show (radio); gtk_box_pack_start (GTK_BOX (hbox2), radio, FALSE, FALSE, 0); // 3 button radio - radio = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio), "3 button"); + radio = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio), _("3 button")); gtk_widget_show (radio); gtk_box_pack_start (GTK_BOX (hbox2), radio, FALSE, FALSE, 0); AddDialogData (radio, &m_nMouse, DLG_RADIO_INT); // right click to drop entity - check = gtk_check_button_new_with_label ("Right click to drop entities"); + check = gtk_check_button_new_with_label (_("Right click to drop entities")); gtk_widget_show (check); gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bRightClick, DLG_CHECK_BOOL); // Mouse chaser (and this does what?) - check = gtk_check_button_new_with_label ("Mouse chaser"); + check = gtk_check_button_new_with_label (_("Mouse chaser")); gtk_widget_show (check); gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bChaseMouse, DLG_CHECK_BOOL); // Alt + multi-drag - check = gtk_check_button_new_with_label ("ALT + multi-drag"); + check = gtk_check_button_new_with_label (_("ALT + multi-drag")); gtk_widget_show (check); gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bALTEdge, DLG_CHECK_BOOL); @@ -2180,63 +2287,69 @@ void PrefsDlg::BuildDialog () hbox2 = gtk_hbox_new (FALSE, 5); gtk_widget_show (hbox2); gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0); - + // label - label = gtk_label_new ("Wheel Mouse inc:"); + label = gtk_label_new (_("Wheel Mouse inc:")); gtk_widget_show (label); gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0); - + // entry entry = gtk_entry_new (); gtk_widget_show (entry); gtk_widget_set_usize (entry, 40, -2); gtk_box_pack_start (GTK_BOX (hbox2), entry, FALSE, FALSE, 0); - AddDialogData (entry, &m_nWheelInc, DLG_ENTRY_INT); + AddDialogData (entry, &m_nWheelInc, DLG_ENTRY_INT); // Add the page to the notebook gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel); - + /******** Editing group *********/ - preflabel = gtk_label_new("Editing"); + preflabel = gtk_label_new(_("Editing")); gtk_widget_show(preflabel); - pageframe = gtk_frame_new("Editing"); + pageframe = gtk_frame_new(_("Editing")); gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5); gtk_widget_show(pageframe); vbox = gtk_vbox_new(FALSE, 5); gtk_widget_show(vbox); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); gtk_container_add(GTK_CONTAINER(pageframe), vbox); - + // Vertex editing splits faces - check = gtk_check_button_new_with_label ("Vertex editing splits face"); + check = gtk_check_button_new_with_label (_("Vertex editing splits face")); gtk_widget_show (check); gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bVertexSplit, DLG_CHECK_BOOL); // Fix target/targetname collisions - check = gtk_check_button_new_with_label ("Fix target/targetname collisions"); + check = gtk_check_button_new_with_label (_("Fix target/targetname collisions")); gtk_widget_show (check); gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bDoTargetFix, DLG_CHECK_BOOL); - + // Clipper tool uses caulk - check = gtk_check_button_new_with_label ("Clipper tool uses caulk"); + check = gtk_check_button_new_with_label (_("Clipper tool uses caulk")); gtk_widget_show (check); gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bClipCaulk, DLG_CHECK_BOOL); // Don't clamp plane points - check = gtk_check_button_new_with_label ("Don't clamp plane points"); + check = gtk_check_button_new_with_label (_("Don't clamp plane points")); gtk_widget_show (check); gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bNoClamp, DLG_CHECK_BOOL); + // Snap to grid + check = gtk_check_button_new_with_label (_("Snap to grid")); + gtk_widget_show (check); + gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0); + AddDialogData (check, &m_bSnap, DLG_CHECK_BOOL); + // Select patch by bounding box - check = gtk_check_button_new_with_label ("Select patches by bounding box"); + check = gtk_check_button_new_with_label (_("Select patches by bounding box")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); - AddDialogData (check, &m_bPatchBBoxSelect, DLG_CHECK_BOOL); - + AddDialogData (check, &m_bPatchBBoxSelect, DLG_CHECK_BOOL); + // Rotation increment // container table = gtk_table_new (2, 3, FALSE); @@ -2244,14 +2357,14 @@ void PrefsDlg::BuildDialog () gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table), 5); gtk_table_set_col_spacings (GTK_TABLE (table), 5); - + // label - label = gtk_label_new ("Rotation increment:"); + label = gtk_label_new (_("Rotation increment:")); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); - + // entry entry = gtk_entry_new (); gtk_widget_show (entry); @@ -2260,17 +2373,17 @@ void PrefsDlg::BuildDialog () (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); AddDialogData (entry, &m_nRotation, DLG_ENTRY_INT); - + // Undo levels // label - label = gtk_label_new ("Undo Levels:"); + label = gtk_label_new (_("Undo Levels:")); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); - + // spinner (allows undo levels to be set to zero) - spin = gtk_spin_button_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0, 64, 1, 10, 10)), 1, 0); + spin = gtk_spin_button_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0, 64, 1, 10, 10)), 1, 0); gtk_widget_show (spin); gtk_table_attach (GTK_TABLE (table), spin, 1, 2, 1, 2, (GtkAttachOptions) (GTK_FILL), @@ -2280,12 +2393,12 @@ void PrefsDlg::BuildDialog () // Patch subdivisions // label - label = gtk_label_new ("Patch subdivisions:"); + label = gtk_label_new (_("Patch subdivisions:")); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); - + // entry (spinner perhaps? [2-16]) entry = gtk_entry_new (); gtk_widget_show (entry); @@ -2297,11 +2410,11 @@ void PrefsDlg::BuildDialog () // Add the page to the notebook gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel); - + /******** Save/Load group *********/ - preflabel = gtk_label_new("Startup/Auto save"); + preflabel = gtk_label_new(_("Startup/Auto save")); gtk_widget_show(preflabel); - pageframe = gtk_frame_new("Startup/Auto save"); + pageframe = gtk_frame_new(_("Startup/Auto save")); gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5); gtk_widget_show(pageframe); vbox = gtk_vbox_new(FALSE, 5); @@ -2310,19 +2423,19 @@ void PrefsDlg::BuildDialog () gtk_container_add(GTK_CONTAINER(pageframe), vbox); // Snapshots - check = gtk_check_button_new_with_label ("Snapshots"); + check = gtk_check_button_new_with_label (_("Snapshots")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bSnapShots, DLG_CHECK_BOOL); - + // load last project on open - check = gtk_check_button_new_with_label ("Load last project on open"); + check = gtk_check_button_new_with_label (_("Load last project on open")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bLoadLast, DLG_CHECK_BOOL); // load last map on open - check = gtk_check_button_new_with_label ("Load last map on open"); + check = gtk_check_button_new_with_label (_("Load last map on open")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bLoadLastMap, DLG_CHECK_BOOL); @@ -2333,32 +2446,32 @@ void PrefsDlg::BuildDialog () gtk_widget_show (hbox2); gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (hbox2), 0); - + // label - check = gtk_check_button_new_with_label ("Auto save every"); + check = gtk_check_button_new_with_label (_("Auto save every")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (hbox2), check, FALSE, FALSE, 0); AddDialogData (check, &m_bAutoSave, DLG_CHECK_BOOL); - + // spinner spin = gtk_spin_button_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 1, 60, 1, 10, 10)), 1, 0); gtk_widget_show (spin); gtk_box_pack_start (GTK_BOX (hbox2), spin, FALSE, FALSE, 0); gtk_widget_set_usize (spin, 60, -2); AddDialogData (spin, &m_nAutoSave, DLG_SPIN_INT); - + // label - label = gtk_label_new ("minutes"); + label = gtk_label_new (_("minutes")); gtk_widget_show (label); gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0); - + // Add the page to the notebook gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel); - + /******** Paths group *********/ - preflabel = gtk_label_new("Paths"); + preflabel = gtk_label_new(_("Paths")); gtk_widget_show(preflabel); - pageframe = gtk_frame_new("Paths"); + pageframe = gtk_frame_new(_("Paths")); gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5); gtk_widget_show(pageframe); vbox = gtk_vbox_new(FALSE, 5); @@ -2373,15 +2486,15 @@ void PrefsDlg::BuildDialog () gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table), 5); gtk_table_set_col_spacings (GTK_TABLE (table), 5); - + // label - label = gtk_label_new ("Prefab path:"); + label = gtk_label_new (_("Prefab path:")); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5); - + // path entry entry = gtk_entry_new (); gtk_widget_show (entry); @@ -2391,8 +2504,7 @@ void PrefsDlg::BuildDialog () (GtkAttachOptions) (0), 1, 0); AddDialogData (entry, &m_strPrefabPath, DLG_ENTRY_TEXT); - // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=805 -#if 0 +#if 0 // browse button button = gtk_button_new_with_label ("..."); gtk_widget_show (button); @@ -2404,13 +2516,13 @@ void PrefsDlg::BuildDialog () // User ini path // label - label = gtk_label_new ("User INI path:"); + label = gtk_label_new (_("User INI path:")); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5); - + // user ini path entry entry = gtk_entry_new (); gtk_widget_show (entry); @@ -2418,7 +2530,7 @@ void PrefsDlg::BuildDialog () (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 1, 0); AddDialogData (entry, &m_strUserPath, DLG_ENTRY_TEXT); - + // user ini browse button button = gtk_button_new_with_label ("..."); gtk_widget_show (button); @@ -2429,20 +2541,20 @@ void PrefsDlg::BuildDialog () // Add the page to the notebook gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel); - + /******** Misc group *********/ - preflabel = gtk_label_new("Misc"); + preflabel = gtk_label_new(_("Misc")); gtk_widget_show(preflabel); - pageframe = gtk_frame_new("Misc"); + pageframe = gtk_frame_new(_("Misc")); gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5); gtk_widget_show(pageframe); vbox = gtk_vbox_new(FALSE, 5); gtk_widget_show(vbox); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); gtk_container_add(GTK_CONTAINER(pageframe), vbox); - + // Light drawing - check = gtk_check_button_new_with_label ("Light drawing"); + check = gtk_check_button_new_with_label (_("Light drawing")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bNewLightDraw, DLG_CHECK_BOOL); @@ -2455,7 +2567,7 @@ void PrefsDlg::BuildDialog () gtk_table_set_row_spacings (GTK_TABLE (table), 5); gtk_table_set_col_spacings (GTK_TABLE (table), 5); - label = gtk_label_new ("Light radiuses:"); + label = gtk_label_new (_("Light radiuses:")); gtk_widget_show (label); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, @@ -2463,9 +2575,9 @@ void PrefsDlg::BuildDialog () (GtkAttachOptions) (0), 0, 0); combo_list = NULL; - combo_list = g_list_append (combo_list, (void *)"Disabled"); - combo_list = g_list_append (combo_list, (void *)"True Q3Map2 Style"); - combo_list = g_list_append (combo_list, (void *)"Classic Style"); + combo_list = g_list_append (combo_list, (void *)_("Disabled")); + combo_list = g_list_append (combo_list, (void *)_("True Q3Map2 Style")); + combo_list = g_list_append (combo_list, (void *)_("Classic Style")); combo = gtk_combo_new (); gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list); @@ -2477,19 +2589,19 @@ void PrefsDlg::BuildDialog () AddDialogData (combo, &m_nLightRadiuses, DLG_COMBO_INT); #ifdef _WIN32 - check = gtk_check_button_new_with_label ("Use win32 file associations to open text files instead of builtin editor"); + check = gtk_check_button_new_with_label (_("Use win32 file associations to open text files instead of builtin editor")); gtk_widget_show(check); gtk_box_pack_start(GTK_BOX (vbox), check, FALSE, FALSE, 0); AddDialogData (check, &g_PrefsDlg.m_bUseWin32Editor, DLG_CHECK_BOOL); #else // use custom shader editor - check = gtk_check_button_new_with_label ("Use Custom Shader Editor"); + check = gtk_check_button_new_with_label (_("Use Custom Shader Editor")); gtk_widget_show(check); gtk_box_pack_start(GTK_BOX (vbox), check, FALSE, FALSE, 0); gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateEditorSensitivity), this); g_object_set_data (G_OBJECT(dialog), "check_customeditor", check); AddDialogData (check, &g_PrefsDlg.m_bUseCustomEditor, DLG_CHECK_BOOL); - + // custom shader editor executable // table table = gtk_table_new (3, 1, FALSE); @@ -2497,9 +2609,9 @@ void PrefsDlg::BuildDialog () gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table), 5); gtk_table_set_col_spacings (GTK_TABLE (table), 5); - + // label - label = gtk_label_new("Custom Editor Command"); + label = gtk_label_new(_("Custom Editor Command")); gtk_widget_show(label); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, (GtkAttachOptions) (0), @@ -2507,7 +2619,7 @@ void PrefsDlg::BuildDialog () gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5); g_object_set_data (G_OBJECT(dialog), "label_customeditor", label); gtk_widget_set_sensitive (label, g_PrefsDlg.m_bUseCustomEditor); - + // custom editor command entry entry = gtk_entry_new (); gtk_widget_show (entry); @@ -2518,9 +2630,9 @@ void PrefsDlg::BuildDialog () AddDialogData (entry, &m_strEditorCommand, DLG_ENTRY_TEXT); gtk_widget_set_sensitive (entry, g_PrefsDlg.m_bUseCustomEditor); g_object_set_data (G_OBJECT(dialog), "entry_customeditor", entry); - + // browse button - button = gtk_button_new_with_label ("..."); + button = gtk_button_new_with_label (_("...")); gtk_widget_show (button); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (OnBtnBrowseEditor), this); gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1, @@ -2535,9 +2647,9 @@ void PrefsDlg::BuildDialog () /******** BSP Monitoring group *********/ // this is never displayed if the plugin isn't available - preflabel = gtk_label_new("BSP Monitoring"); + preflabel = gtk_label_new(_("BSP Monitoring")); gtk_widget_show(preflabel); - pageframe = gtk_frame_new("BSP Monitoring"); + pageframe = gtk_frame_new(_("BSP Monitoring")); gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5); gtk_widget_show(pageframe); vbox = gtk_vbox_new(FALSE, 5); @@ -2546,7 +2658,7 @@ void PrefsDlg::BuildDialog () gtk_container_add(GTK_CONTAINER(pageframe), vbox); // Enable BSP process monitoring - check = gtk_check_button_new_with_label ("Enable BSP process monitoring"); + check = gtk_check_button_new_with_label (_("Enable BSP process monitoring")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); g_object_set_data (G_OBJECT (dialog), "check_monitorbsp", check); @@ -2554,29 +2666,29 @@ void PrefsDlg::BuildDialog () AddDialogData (check, &g_PrefsDlg.m_bWatchBSP, DLG_CHECK_BOOL); // Stop on leak - check = gtk_check_button_new_with_label ("Stop compilation on leak"); + check = gtk_check_button_new_with_label (_("Stop compilation on leak")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); g_object_set_data (G_OBJECT (dialog), "check_leakstop", check); AddDialogData (check, &g_PrefsDlg.m_bLeakStop, DLG_CHECK_BOOL); // engine after compile - check = gtk_check_button_new_with_label ("Run engine after compile"); + check = gtk_check_button_new_with_label (_("Run engine after compile")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); g_object_set_data (G_OBJECT (dialog), "check_runengine", check); gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateSensitivity), this ); - AddDialogData( check, &g_PrefsDlg.m_bRunQuake, DLG_CHECK_BOOL ); - + AddDialogData( check, &g_PrefsDlg.m_bRunQuake, DLG_CHECK_BOOL ); + // sleep mode when running engine - check = gtk_check_button_new_with_label ("Activate sleep mode when running the engine"); + check = gtk_check_button_new_with_label (_("Activate sleep mode when running the engine")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); g_object_set_data (G_OBJECT (dialog), "check_sleep", check); AddDialogData( check, &g_PrefsDlg.m_bDoSleep, DLG_CHECK_BOOL ); - + // use q3map2's texture projection - check = gtk_check_button_new_with_label ("Texturing compatible with q3map2"); + check = gtk_check_button_new_with_label (_("Texturing compatible with q3map2")); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); g_object_set_data (G_OBJECT (dialog), "check_q3map2", check); @@ -2599,7 +2711,7 @@ void PrefsDlg::LoadTexdefPref(texdef_t* pTexdef, char* pName) memset(pTexdef, 0, sizeof(texdef_t)); sprintf(buffer, "%s%s", pName, TD_SCALE1_KEY); - mLocalPrefs.GetPref(buffer, &pTexdef->scale[0], 0.5f); + mLocalPrefs.GetPref(buffer, &pTexdef->scale[0], 0.5f); sprintf(buffer, "%s%s", pName, TD_SCALE2_KEY); mLocalPrefs.GetPref(buffer, &pTexdef->scale[1], 0.5f); @@ -2621,7 +2733,7 @@ void PrefsDlg::UpdateTextureCompression() Sys_Printf("OpenGL not ready - postpone texture compression capability check\n"); return; } - + if (g_qeglobals.bTextureCompressionSupported) { if (m_nTextureCompressionFormat >= 2 && !g_qeglobals.m_bS3CompressionSupported) @@ -2700,7 +2812,7 @@ void PrefsDlg::UpdateATIHack() { } #endif -// TTimo: m_strEnginePath has a special status, if not found in registry we need to +// TTimo: m_strEnginePath has a special status, if not found in registry we need to // initiliaze it for sure. It is not totally failsafe but we can use the same // code than in q3map, expecting to find some "quake" above us. If not, we prompt // for the engine executable path @@ -2722,7 +2834,7 @@ void PrefsDlg::LoadPrefs () mLocalPrefs.GetPref(PATCHSHOWBOUNDS_KEY, &g_bPatchShowBounds, FALSE); mLocalPrefs.GetPref(MOUSE_KEY, &m_nMouse, MOUSE_DEF); m_nMouseButtons = m_nMouse ? 3 : 2; - + // project file // if it's not found here, mainframe.cpp will take care of finding one mLocalPrefs.GetPref(LASTPROJ_KEY, &m_strLastProject, ""); @@ -2772,7 +2884,7 @@ void PrefsDlg::LoadPrefs () mLocalPrefs.GetPref(DETACHABLEMENUS_KEY, &m_bLatchedDetachableMenus, TRUE); m_bDetachableMenus = m_bLatchedDetachableMenus; - + if (g_pGameDescription->mNoPatch) { m_bPatchToolbar = false; @@ -2785,7 +2897,7 @@ void PrefsDlg::LoadPrefs () mLocalPrefs.GetPref(WIDETOOLBAR_KEY, &m_bLatchedWideToolbar, TRUE); m_bWideToolbar = m_bLatchedWideToolbar; - + mLocalPrefs.GetPref(PLUGINTOOLBAR_KEY, &m_bLatchedPluginToolbar, TRUE); m_bPluginToolbar = m_bLatchedPluginToolbar; @@ -2802,6 +2914,7 @@ void PrefsDlg::LoadPrefs () m_nShader = m_nLatchedShader; mLocalPrefs.GetPref(NOCLAMP_KEY, &m_bNoClamp, FALSE); + mLocalPrefs.GetPref(SNAP_KEY, &m_bSnap, TRUE); mLocalPrefs.GetPref(USERINI_KEY, &m_strUserPath, ""); mLocalPrefs.GetPref(ROTATION_KEY, &m_nRotation, 45); mLocalPrefs.GetPref(CHASEMOUSE_KEY, &m_bChaseMouse, TRUE); @@ -2819,7 +2932,7 @@ void PrefsDlg::LoadPrefs () // Texture subset on by default (HL specific really, because of halflife.wad's size) mLocalPrefs.GetPref(TEXTURE_KEY, &m_bTextureWindow, TRUE); } - else if ( ( g_pGameDescription->mGameFile == "q2.game" ) || ( g_pGameDescription->mGameFile == "heretic2.game" ) ) + else if (g_pGameDescription->quake2) { // BSP monitoring is implemented in Quake2 and Heretic2 tools mLocalPrefs.GetPref(WATCHBSP_KEY, &m_bWatchBSP, TRUE); @@ -2856,7 +2969,7 @@ void PrefsDlg::LoadPrefs () mLocalPrefs.GetPref(TARGETFIX_KEY, &m_bDoTargetFix, TRUE); mLocalPrefs.GetPref(WHEELINC_KEY, &m_nWheelInc, 64); mLocalPrefs.GetPref(PATCHBBOXSEL_KEY, &m_bPatchBBoxSelect, FALSE); - + // Gef: Kyro GL_POINT workaround mLocalPrefs.GetPref(GLPOINTWORKAROUND_KEY, &m_bGlPtWorkaround, FALSE); @@ -2894,11 +3007,11 @@ void PrefsDlg::LoadPrefs () // menu stuff mLocalPrefs.GetPref(COUNT_KEY, &m_nMRUCount, 0); - for(i = 0; i < 4; i++) + for(i = 0; i < 4; i++) { char buf[64]; sprintf (buf, "%s%d", FILE_KEY, i); - mLocalPrefs.GetPref(buf, &m_strMRUFiles[i], ""); + mLocalPrefs.GetPref(buf, &m_strMRUFiles[i], ""); } // some platform specific prefs @@ -3015,10 +3128,11 @@ void PrefsDlg::SavePrefs () if (!mLocalPrefs.WriteXMLFile(m_inipath->str)) Sys_FPrintf(SYS_ERR, "Error occured while saving local prefs file '%s'\n", m_inipath->str); - if (m_nMouse == 0) - m_nMouseButtons = 2; - else - m_nMouseButtons = 3; + if ( m_nMouse == 0 ) { + m_nMouseButtons = 2; + } else { + m_nMouseButtons = 3; + } } @@ -3070,7 +3184,7 @@ void PrefsDlg::DoSensitivity() Msg += g_PrefsDlg.m_strLastProject; Msg += ") is not at least version 2.\nI need version 2 or above to setup BSP monitoring correctly."; gtk_MessageBox(m_pWidget, Msg.GetBuffer(), MB_OK ); - + m_bWarn = false; } @@ -3100,3 +3214,308 @@ void PrefsDlg::DoSensitivity() gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_sleep" )), FALSE ); } } + +/* +============================================================ +CGameInstall +============================================================ +*/ + +CGameInstall::CGameInstall() { + memset( m_availGames, 0, sizeof( m_availGames ) ); +} + +void CGameInstall::OnBtnBrowseEngine( GtkWidget *widget, gpointer data ) { + Sys_Printf( "OnBtnBrowseEngine\n" ); + + CGameInstall* i = static_cast( data ); + char *dir = dir_dialog( i->m_pWidget, _("Select game directory"), NULL ); + + i->UpdateData( TRUE ); + + if ( dir != NULL ) { + i->m_strEngine = dir; + i->UpdateData( FALSE ); + g_free( dir ); + } +} + +void CGameInstall::OnGameSelectChanged( GtkWidget *widget, gpointer data ) { + Sys_Printf( "OnGameSelectChanged\n" ); + + CGameInstall* i = static_cast( data ); + i->UpdateData( TRUE ); + i->m_strName = gtk_combo_box_get_active_text( GTK_COMBO_BOX( widget ) ); + i->UpdateData( FALSE ); +} + +void CGameInstall::BuildDialog() { + GtkWidget *dlg, *vbox1, *button, *text, *combo, *entry, *hbox; + + dlg = m_pWidget; + gtk_window_set_title( GTK_WINDOW( dlg ), _("Configure games") ); + + vbox1 = gtk_vbox_new( FALSE, 0 ); + gtk_widget_show( vbox1 ); + gtk_container_add( GTK_CONTAINER( dlg ), vbox1 ); + + text = gtk_label_new( _("Select the game to configure") ); + gtk_widget_show( text ); + gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 ); + + combo = gtk_combo_box_new_text(); + gtk_widget_show( combo ); + gtk_box_pack_start( GTK_BOX( vbox1 ), combo, FALSE, FALSE, 0 ); + + // GList *combo_list = NULL; + int iGame = 0; + while ( m_availGames[ iGame ] != GAME_NONE ) { + switch ( m_availGames[ iGame ] ) { + case GAME_Q2: + gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Quake II") ); + break; + case GAME_Q3: + gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Quake III Arena and mods") ); + break; + case GAME_URT: + gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Urban Terror (standalone)") ); + break; + case GAME_UFOAI: + gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("UFO: Alien Invasion") ); + break; + case GAME_Q2W: + gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Quake2World") ); + break; + case GAME_WARSOW: + gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Warsow") ); + break; + case GAME_NEXUIZ: + gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Nexuiz") ); + break; + case GAME_TREMULOUS: + gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Tremulous") ); + break; + } + iGame++; + } + AddDialogData( combo, &m_nComboSelect, DLG_COMBO_BOX_INT ); + gtk_signal_connect( GTK_OBJECT( combo ), "changed", G_CALLBACK( OnGameSelectChanged ), this ); + gtk_combo_box_set_active( GTK_COMBO_BOX( combo ), 0 ); // NOTE: will trigger signal + + text = gtk_label_new( _("Name:") ); + gtk_widget_show( text ); + gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 ); + + entry = gtk_entry_new(); + gtk_widget_show( entry ); + gtk_box_pack_start( GTK_BOX( vbox1 ), entry, FALSE, FALSE, 0 ); + AddDialogData( entry, &m_strName, DLG_ENTRY_TEXT ); + + text = gtk_label_new( _("Engine directory:") ); + gtk_widget_show( text ); + gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 ); + + hbox = gtk_hbox_new( FALSE, 0 ); + gtk_widget_show( hbox ); + gtk_box_pack_start( GTK_BOX( vbox1 ), hbox, FALSE, FALSE, 0 ); + + entry = gtk_entry_new(); + gtk_widget_show( entry ); + gtk_box_pack_start( GTK_BOX( hbox ), entry, FALSE, FALSE, 0 ); + AddDialogData( entry, &m_strEngine, DLG_ENTRY_TEXT ); + + button = gtk_button_new_with_label (_("...")); + gtk_widget_show( button ); + gtk_signal_connect( GTK_OBJECT( button ), "clicked", GTK_SIGNAL_FUNC( OnBtnBrowseEngine ), this ); + gtk_box_pack_start( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); + + // this gets done in the project stuff atm +#if 0 + text = gtk_label_new( _("Mod subdirectory:") ); + gtk_widget_show( text ); + gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 ); + + entry = gtk_entry_new(); + gtk_widget_show( entry ); + gtk_box_pack_start( GTK_BOX( vbox1 ), entry, FALSE, FALSE, 0 ); + AddDialogData( entry, &m_strMod, DLG_ENTRY_TEXT ); +#endif + + button = gtk_button_new_with_label( _("OK") ); + gtk_widget_show( button ); + gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 ); + AddModalButton( button, IDOK ); + + button = gtk_button_new_with_label( _("Cancel") ); + gtk_widget_show( button ); + gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 ); + AddModalButton( button, IDCANCEL ); + + gtk_widget_set_usize( button, 60, -2 ); +} + +void CGameInstall::Run() { + ScanGames(); + if ( DoModal() == IDCANCEL ) { + Sys_Printf( "game dialog cancelled\n" ); + return; + } + Sys_Printf( "combo: %d name: %s engine: %s mod: %s\n", m_nComboSelect, m_strName.GetBuffer(), m_strEngine.GetBuffer(), m_strMod.GetBuffer() ); + + // write out the game file + Str gameFilePath = g_strAppPath.GetBuffer(); + gameFilePath += "games/"; + gameFilePath += m_strName.GetBuffer(); + gameFilePath += ".game"; + Sys_Printf( "game file: %s\n", gameFilePath.GetBuffer() ); + + FILE *fg = fopen( gameFilePath.GetBuffer(), "w" ); + if ( fg == NULL || ferror( fg ) ) { + Error( "Failed to open %s for writing\n", gameFilePath.GetBuffer() ); + } + fprintf( fg, "\n\n" ); + fclose( fg ); +} + +/* +=============== +CGameInstall::ScanGames +scan for active games that can be installed, based on the presence +=============== +*/ +void CGameInstall::ScanGames() { + Str pakPaths = g_strAppPath.GetBuffer(); + int iGame = 0; + const char *dirname; + + pakPaths += "installs/"; + FindFiles fileScan( pakPaths.GetBuffer() ); + while ( ( dirname = fileScan.NextFile() ) != NULL ) { + if ( stricmp( dirname, Q3_PACK ) == 0 ) { + m_availGames[ iGame++ ] = GAME_Q3; + } + if ( stricmp( dirname, URT_PACK ) == 0 ) { + m_availGames[ iGame++ ] = GAME_URT; + } + if ( stricmp( dirname, UFOAI_PACK ) == 0 ) { + m_availGames[ iGame++ ] = GAME_UFOAI; + } + if ( stricmp( dirname, Q2W_PACK ) == 0 ) { + m_availGames[ iGame++ ] = GAME_Q2W; + } + if ( stricmp( dirname, WARSOW_PACK ) == 0 ) { + m_availGames[ iGame++ ] = GAME_WARSOW; + } + if ( stricmp( dirname, NEXUIZ_PACK ) == 0 ) { + m_availGames[ iGame++ ] = GAME_NEXUIZ; + } + if ( stricmp( dirname, Q2_PACK ) == 0 ) { + m_availGames[ iGame++ ] = GAME_Q2; + } + if ( stricmp( dirname, TREMULOUS_PACK ) == 0 ) { + m_availGames[ iGame++ ] = GAME_TREMULOUS; + } + } +} +