2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
5 This file is part of GtkRadiant.
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 // Leonardo Zide (leo@lokigames.com)
30 #include <glib/gi18n.h>
32 #if defined (__linux__) || defined (__APPLE__)
34 #include <sys/types.h>
43 // sanity check - some gtk2 win32 runtimes replace sprintf
44 #if defined( sprintf )
45 #error sprintf is a macro. are you sure?
55 #define PREF_SECTION "Prefs"
56 #define INTERNAL_SECTION "Internals"
57 #define MOUSE_KEY "MouseButtons"
58 #define WINDOW_KEY "QE4StyleWindows"
59 #define LAYOUT_KEY "WindowLayout"
60 #define RUNQ2_KEY "RunQuake2Run"
61 #define TLOCK_KEY "TextureLock"
62 #define RLOCK_KEY "RotateLock"
63 #define LOADLAST_KEY "LoadLast"
64 #define LOADLASTMAP_KEY "LoadLastMap"
65 #define LASTPROJ_KEY "LastProject"
66 #define LASTPROJVER_KEY "LastProjectKey"
67 #define LASTMAP_KEY "LastMap"
68 #define FACE_KEY "NewFaceGrab"
69 #define BSP_KEY "InternalBSP"
70 #define RCLICK_KEY "NewRightClick"
71 #define VERTEX_KEY "NewVertex"
72 #define AUTOSAVE_KEY "Autosave"
73 #define AUTOSAVETIME_KEY "AutosaveMinutes"
74 #define PAK_KEY "UsePAK"
75 #define NEWAPPLY_KEY "ApplyDismissesSurface"
76 #define HACK_KEY "Gatewayescapehack"
77 #define TEXTURE_KEY "NewTextureWindowStuff"
78 #define TINYBRUSH_KEY "CleanTinyBrushes"
79 #define TINYSIZE_KEY "CleanTinyBrusheSize"
80 #define SNAPSHOT_KEY "Snapshots"
81 #define MOVESPEED_KEY "MoveSpeed"
82 #define ANGLESPEED_KEY "AngleSpeed"
83 #define SETGAME_KEY "UseSetGame"
84 #define CAMXYUPDATE_KEY "CamXYUpdate"
85 #define CAMDRAGMULTISELECT_KEY "CamDragMultiSelect"
86 #define CAMFREELOOK_KEY "CamFreeLook"
87 #define CAMINVERSEMOUSE_KEY "CamInverseMouse"
88 #define CAMDISCRETE_KEY "CamDiscrete"
89 #define LIGHTDRAW_KEY "NewLightStyle"
90 #define WHATGAME_KEY "WhichGame"
91 #define CUBICCLIP_KEY "CubicClipping"
92 #define CUBICSCALE_KEY "CubicScale"
93 #define ALTEDGE_KEY "ALTEdgeDrag"
94 #define FACECOLORS_KEY "FaceColors"
95 #define SNAPT_KEY "SnapT"
96 #define XZVIS_KEY "XZVIS"
97 #define YZVIS_KEY "YZVIS"
98 #define ZVIS_KEY "ZVIS"
99 #define SIZEPAINT_KEY "SizePainting"
100 #define DLLENTITIES_KEY "DLLEntities"
101 #define DETACHABLEMENUS_KEY "DetachableMenus"
102 #define PATCHTOOLBAR_KEY "PatchToolBar"
103 #define WIDETOOLBAR_KEY "WideToolBar"
104 #define PLUGINTOOLBAR_KEY "PluginToolBar"
105 #define NOCLAMP_KEY "NoClamp"
106 #define SNAP_KEY "Snap"
107 #define PREFAB_KEY "PrefabPath"
108 #define USERINI_KEY "UserINIPath"
109 #define ROTATION_KEY "Rotation"
110 #define BUGGYICD_KEY "BuggyICD"
111 #define CHASEMOUSE_KEY "ChaseMouse"
112 #define ENTITYSHOW_KEY "EntityShow"
113 #define TEXTURESCALE_KEY "TextureScale"
114 #define TEXTURESCROLLBAR_KEY "TextureScrollbar"
115 #define DISPLAYLISTS_KEY "UseDisplayLists"
116 #define ANTIALIASEDLINES_KEY "UseAntialiasedPointsAndLines" // Fishman - Add antialiazed points and lines support. 09/03/00
117 #define NORMALIZECOLORS_KEY "NormalizeColors"
118 #define SHADERS_KEY "UseShaders"
119 #define SWITCHCLIP_KEY "SwitchClipKey"
120 #define SELWHOLEENTS_KEY "SelectWholeEntitiesKey"
121 #define TEXTURESUBSET_KEY "UseTextureSubsetLoading"
122 #define TEXTUREQUALITY_KEY "TextureQuality"
123 #define SHOWSHADERS_KEY "ShowShaders"
124 #define SHADERTEST_KEY "ShaderTest"
125 #define GLLIGHTING_KEY "UseGLLighting"
126 #define LOADSHADERS_KEY "LoadShaders"
127 #define NOSTIPPLE_KEY "NoStipple"
128 #define UNDOLEVELS_KEY "UndoLevels"
129 #define VERTEXMODE_KEY "VertexSplit"
130 #define ENGINEPATH_KEY "EnginePath"
131 #define ENGINE_KEY "Engine"
132 #define LOGCONSOLE_KEY "LogConsole"
133 #define SELECTCURVES_KEY "SelectCurves"
134 #define SELECTMODELS_KEY "SelectModels"
135 #define SHADERLISTONLY_KEY "ShowShaderlistOnly"
136 #define WATCHBSP_KEY "WatchBSP"
137 #define LEAKSTOP_KEY "LeakStop"
138 #define DOSLEEP_KEY "SleepMode"
139 #define SUBDIVISIONS_KEY "Subdivisions"
140 #define CLIPCAULK_KEY "ClipCaulk"
141 #define PATCHSHOWBOUNDS_KEY "PatchShowBounds"
142 #define NATIVEGUI_KEY "NativeGUI"
143 #define STARTONPRIMMON_KEY "StartOnPrimMon"
144 #define NOSYSMENUPOPUPS_KEY "NoSysMenuPopups"
145 #define SNAPTTOGRID_KEY "SnapTToGrid"
146 #define FLOATINGZ_KEY "FloatingZ"
147 #define TARGETFIX_KEY "TargetFix"
148 #define GLPOINTWORKAROUND_KEY "GlPointWorkaround" // Gef: Workaround for broken Kyro * gl driver 25-aug-2001
149 #define WHEELINC_KEY "WheelMouseInc"
150 #define PATCHBBOXSEL_KEY "PatchBBoxSel"
151 #define LASTLIGHTINTENSITY_KEY "LastLightIntensity"
152 #define CUSTOMSHADEREDITOR_KEY "UseCustomShaderEditor"
153 #define CUSTOMSHADEREDITORCOMMAND_KEY "CustomShaderEditorCommand"
154 #define TEXTURECOMPRESSIONFORMAT_KEY "TextureCompressionFormat"
155 #define LIGHTRADIUS_KEY "LightRadiuses"
156 #define Q3MAP2TEX_KEY "Q3Map2Tex"
157 #define ATIHACK_KEY "ATIHack"
160 #define ENTITYSPLIT1_KEY "EntitySplit1"
161 #define ENTITYSPLIT2_KEY "EntitySplit2"
162 #define POSITIONX_KEY "PositionX"
163 #define POSITIONY_KEY "PositionY"
164 #define ENTITYWND_KEY "EntityWnd"
165 #define MAPINFOWND_KEY "MapInfoDlg"
166 #define CAMWND_KEY "CamWnd"
167 #define ZWND_KEY "ZWnd"
168 #define XYWND_KEY "XYWnd"
169 #define XZWND_KEY "XZWnd"
170 #define YZWND_KEY "YZWnd"
171 #define PATCHWND_KEY "PatchWnd"
172 #define SURFACEWND_KEY "SurfaceWnd"
173 #define ENTITYINFOWND_KEY "EntityInfoDlg"
174 #define WIDTH_KEY "Width"
175 #define HEIGHT_KEY "Height"
176 #define ZWIDTH_KEY "ZWidth"
177 #define XYHEIGHT_KEY "XYHeight"
178 #define XYWIDTH_KEY "XYWidth"
179 #define CAMWIDTH_KEY "CamWidth"
180 #define CAMHEIGHT_KEY "CamHeight"
181 #define ZFLOATWIDTH_KEY "ZWidthFloating"
182 #define STATE_KEY "State"
185 #define COUNT_KEY "Count"
186 #define FILE_KEY "File"
189 #define SI_TEXMENU_KEY "SI_TexMenu"
190 #define SI_GAMMA_KEY "SI_Gamma"
191 #define SI_COLORS_KEY "SI_Colors"
192 #define SI_EXCLUDE_KEY "SI_Exclude"
193 #define SI_INCLUDE_KEY "SI_Include"
194 #define SI_SURFACE_TEXDEF_KEY "SI_SurfaceTexdef"
195 #define SI_PATCH_TEXDEF_KEY "SI_PatchTexdef"
196 #define SI_AXISCOLORS_KEY "SI_AxisColors"
197 #define SI_SHOWNAMES_KEY "SI_ShowNames"
198 #define SI_SHOWCOORDS_KEY "SI_ShowCoords"
199 #define SI_SHOWANGLES_KEY "SI_ShowAngles"
200 #define SI_SHOWOUTLINES_KEY "SI_ShowOutlines"
201 #define SI_SHOWAXIS_KEY "SI_ShowAxis"
202 #define SI_NOSELOUTLINES_KEY "SI_NoSelectedOutlines"
203 #define SI_OUTLINESTYLE_KEY "SI_OutLineStyle"
206 #define TD_SCALE1_KEY "_Scale1"
207 #define TD_SCALE2_KEY "_Scale2"
208 #define TD_SHIFT1_KEY "_Shift1"
209 #define TD_SHIFT2_KEY "_Shift2"
210 #define TD_ROTATE_KEY "_Rotate"
215 #define WATCHBSP_DEF 1
217 #define LOADLAST_DEF 1
219 #define SUBDIVISIONS_DEF 4
221 void WindowPosition_Parse(window_position_t& m_value, const CString& value)
223 if(sscanf(value.GetBuffer(), "%d %d %d %d", &m_value.x, &m_value.y, &m_value.w, &m_value.h) != 4)
224 m_value.x = m_value.y = m_value.w = m_value.h = -1;
227 void WindowPosition_Write(const window_position_t& m_value, CString& value)
230 sprintf(buffer, "%d %d %d %d", m_value.x, m_value.y, m_value.w, m_value.h);
235 CXMLPropertyBag::CXMLPropertyBag() {
241 // generic preference functions
243 void CXMLPropertyBag::PushAssignment(const char *name, PrefTypes_t type, void *pV)
245 list<CPrefAssignment>::iterator iAssign;
246 for(iAssign=mPrefAssignments.begin(); iAssign!=mPrefAssignments.end(); iAssign++)
248 if ((*iAssign).mName == name)
250 // we have it already, check anyway
251 if (pV != (*iAssign).mVal)
253 Sys_FPrintf(SYS_ERR, "PushAssignment, '%s' has different mVal\n", name);
258 // ok, it's not in our list yet
259 mPrefAssignments.push_front(CPrefAssignment(name, type, pV));
262 xmlNodePtr CXMLPropertyBag::EpairForName(const char *name)
264 xmlNodePtr ret = NULL;
266 xmlNodePtr pNode = mpDocNode->children;
267 while (pNode != NULL)
269 if(pNode->type == XML_ELEMENT_NODE)
271 xmlAttrPtr tmp_attr_ptr = xmlHasProp(pNode, (xmlChar *)"name");
272 if (tmp_attr_ptr != NULL && !strcmp(name, (char *)tmp_attr_ptr->children->content))
275 Sys_FPrintf( SYS_WRN, "WARNING: dupe property in CXMLPropertyBag::EpairForName '%s'\n", name );
286 void CXMLPropertyBag::GetPref(const char *name, Str *pV, const char *V)
288 xmlNodePtr pNode = EpairForName( name );
291 if ( pNode->children && pNode->children->content ) {
292 *pV = pNode->children->content;
294 // means the pref exists, and that the value is ""
300 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)V);
301 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
303 // push the pref assignment if needed
304 PushAssignment(name, PREF_STR, pV);
307 void CXMLPropertyBag::GetPref(const char *name, int *pV, int V)
310 if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
312 *pV = atoi((char *)pNode->children->content);
318 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s);
319 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
322 // push the pref assignment if needed
323 PushAssignment(name, PREF_INT, pV);
326 void CXMLPropertyBag::GetPref(const char *name, bool *pV, bool V)
329 if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
331 if (!strcmp((char *)pNode->children->content, "true"))
343 V ? strcpy(s, "true") : strcpy(s, "false");
344 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s);
345 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
348 // push the pref assignment
349 PushAssignment(name, PREF_BOOL, pV);
352 void CXMLPropertyBag::GetPref(const char *name, float *pV, float V)
355 if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
357 *pV = atof((char *)pNode->children->content);
363 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s);
364 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
367 // push the pref assignment if needed
368 PushAssignment(name, PREF_FLOAT, pV);
371 void CXMLPropertyBag::GetPref(const char *name, float* pV, float* V)
374 if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
376 sscanf((char *)pNode->children->content, "%f %f %f", &pV[0], &pV[1], &pV[2]);
381 sprintf(s, "%f %f %f", V[0], V[1], V[2]);
382 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s);
383 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
388 // push the pref assignment if needed
389 PushAssignment(name, PREF_VEC3, pV);
392 void CXMLPropertyBag::GetPref(const char *name, window_position_t* pV, window_position_t V)
395 if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
397 WindowPosition_Parse(*pV, CString((xmlChar *)pNode->children->content));
402 WindowPosition_Write(V, str);
403 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)str.GetBuffer());
404 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
407 // push the pref assignment if needed
408 PushAssignment(name, PREF_WNDPOS, pV);
411 void CXMLPropertyBag::UpdatePrefTree()
413 // read the assignments and update the tree
414 list<CPrefAssignment>::iterator iPref;
415 for(iPref = mPrefAssignments.begin(); iPref != mPrefAssignments.end(); iPref++)
417 CPrefAssignment *pPref = &(*iPref);
422 pNode = EpairForName(pPref->mName.GetBuffer());
423 // we never expect that the node could not be found, because this is supposed to happen
424 // after the tree was built with GetPref calls, never on a blank tree
427 Sys_FPrintf(SYS_ERR, "Unexpected EpairForName '%s' not found in UpdatePrefTree\n", pPref->mName.GetBuffer());
430 switch ((*iPref).mType)
433 xmlNodeSetContent(pNode, (const xmlChar *)((Str *)pPref->mVal)->GetBuffer());
436 sprintf(s, "%d", *(int *)pPref->mVal);
437 xmlNodeSetContent(pNode, (xmlChar *)s);
440 sprintf(s, "%f", *(float *)pPref->mVal);
441 xmlNodeSetContent(pNode, (xmlChar *)s);
444 *(bool *)pPref->mVal ? strcpy(s, "true") : strcpy(s, "false");
445 xmlNodeSetContent(pNode, (xmlChar *)s);
449 float* v = (float*)pPref->mVal;
450 sprintf(s, "%f %f %f", v[0], v[1], v[2]);
451 xmlNodeSetContent(pNode, (xmlChar *)s);
457 WindowPosition_Write(*(window_position_t*)pPref->mVal, str);
458 xmlNodeSetContent(pNode, (xmlChar*)str.GetBuffer());
465 void CXMLPropertyBag::Clear()
476 void CXMLPropertyBag::ReadXMLFile(const char* pFilename)
478 mpDoc = xmlParseFile(pFilename);
483 mpDocNode = mpDoc->children;
484 xmlAttrPtr tmp_attr_ptr = xmlHasProp(mpDocNode, (xmlChar *)"version");
485 if (strcmp((char *)mpDocNode->name, "qpref"))
487 Sys_FPrintf(SYS_ERR, "Unrecognized node '%s' in '%s'\n", mpDocNode->name, mpDoc->URL);
491 else if (tmp_attr_ptr != NULL && strcmp((char*)tmp_attr_ptr->children->content, "1"))
493 Sys_FPrintf(SYS_ERR, "Wrong version '%s' in <qpref> node for '%s'\n", (char*)tmp_attr_ptr->children->content, mpDoc->URL);
497 Sys_Printf("Opened XML property file: '%s'\n", pFilename);
503 // no document, create one
504 mpDoc = xmlNewDoc((xmlChar *)"1.0");
505 mpDocNode = xmlNewDocNode(mpDoc, NULL, (xmlChar *)"qpref", NULL);
506 xmlDocSetRootElement(mpDoc, mpDocNode);
507 xmlSetProp(mpDocNode, (xmlChar *)"version", (xmlChar *)"1");
508 Sys_Printf("XML property file '%s' invalid/not found, creating blank properties tree\n", pFilename);
512 qboolean CXMLPropertyBag::WriteXMLFile(const char* pFilename)
514 int res = xmlSaveFormatFile(pFilename, mpDoc, 1);
519 Sys_Printf("Wrote XML property file '%s'\n", pFilename);
523 // =============================================================================
524 // Widget callbacks for PrefsDlg
527 // browse for custom editor executable
528 static void OnBtnBrowseEditor (GtkWidget *widget, gpointer data)
530 PrefsDlg *dlg = (PrefsDlg*)data;
532 const char *filename = file_dialog(g_PrefsDlg.GetWidget(), TRUE, _("Executable for Custom Editor"));
536 dlg->m_strEditorCommand = filename;
537 dlg->UpdateData(FALSE);
542 static void OnBtnBrowseprefab (GtkWidget *widget, gpointer data)
544 PrefsDlg *dlg = (PrefsDlg*)data;
545 char *path = dlg->m_strPrefabPath;
546 if (strlen (path) == 0)
547 path = g_strGameToolsPath;
548 char *dir = dir_dialog (g_PrefsDlg.GetWidget (), _("Set prefab path"), path);
549 dlg->UpdateData(TRUE);
556 dlg->m_strPrefabPath = strPath;
557 dlg->UpdateData(FALSE);
562 static void OnBtnBrowseuserini (GtkWidget *widget, gpointer data)
564 PrefsDlg *dlg = (PrefsDlg*)data;
565 char *path = dlg->m_strUserPath;
566 if (strlen (path) == 0)
567 path = g_strGameToolsPath;
569 const char *filename = file_dialog (g_PrefsDlg.GetWidget(), TRUE, _("Find INI file"), path);
571 if (filename != NULL)
573 dlg->UpdateData(TRUE);
574 dlg->m_strUserPath = filename;
575 dlg->UpdateData(FALSE);
579 static void OnButtonClean (GtkWidget *widget, gpointer data)
581 // make sure this is what the user wants
582 if (gtk_MessageBox (g_PrefsDlg.GetWidget (), _("This will close Radiant and clean the corresponding registry entries.\n"
583 "Next time you start Radiant it will be good as new. Do you wish to continue?"),
584 _("Reset Registry"), MB_YESNO) == IDYES)
586 PrefsDlg *dlg = (PrefsDlg*)data;
587 dlg->EndModal (IDCANCEL);
589 g_qeglobals.disable_ini = true;
590 remove (dlg->m_inipath->str);
592 sprintf(buf, "%sSavedInfo.bin", dlg->m_rc_path->str);
594 HandleCommand (NULL, GINT_TO_POINTER (ID_FILE_EXIT));
599 // =============================================================================
602 // IMPORTANT NOTE: the values here don't matter very much
603 // the actual intialization if you start with an empty .ini is done when loading the prefs for the first time
604 // profile_load_int takes an argument to use if the value is not found
605 PrefsDlg::PrefsDlg ()
609 m_nView = MainFrame::eRegular;
611 m_bInternalBSP = FALSE;
612 m_bRightClick = FALSE;
616 m_bLoadLastMap = FALSE;
617 m_bTextureWindow = FALSE;
618 m_bSnapShots = FALSE;
620 m_bCleanTiny = FALSE;
621 m_bCamXYUpdate = TRUE;
622 m_bCamDragMultiSelect = FALSE;
623 m_bCamFreeLook = TRUE;
624 m_bCamFreeLookStrafe = FALSE;
625 m_bCamInverseMouse = FALSE;
626 m_bCamDiscrete = TRUE;
627 m_bNewLightDraw = FALSE;
628 m_strPrefabPath = "";
631 m_bFaceColors = FALSE;
635 m_bSizePaint = FALSE;
636 m_bDLLEntities = FALSE;
638 m_bDetachableMenus = FALSE; // Most win32 users will find detachable menus annoying
640 m_bDetachableMenus = TRUE; // Linux/Apple users are used to them...
642 m_bPatchToolbar = TRUE;
643 m_bWideToolbar = TRUE;
644 m_bPluginToolbar = TRUE;
649 m_bChaseMouse = FALSE;
650 m_bTextureScrollbar = TRUE;
651 m_bDisplayLists = TRUE;
652 m_bAntialiasedPointsAndLines = FALSE; // Fishman - Add antialiazed points and lines support. 09/03/00
653 m_bShowShaders = FALSE;
655 m_bNoStipple = FALSE;
656 m_bVertexSplit = FALSE;
657 m_bSelectCurves = TRUE;
658 m_bSelectModels = TRUE;
659 m_nEntityShowState = ENTITY_SKINNED_BOXED;
661 m_bSwitchClip = FALSE;
662 m_bSelectWholeEntities = TRUE;
663 m_nTextureQuality = 3;
664 m_bShowShaders = TRUE;
665 m_bGLLighting = FALSE;
668 m_bTexturesShaderlistOnly = FALSE;
669 // paths to ini files
679 m_bFloatingZ = FALSE;
680 m_bGlPtWorkaround = FALSE; // Gef: Kyro/GL_POINTS workaround 25-aug-2001
682 m_bNativeGUI = FALSE;
683 m_bStartOnPrimMon = FALSE;
685 m_global_rc_path = NULL;
687 m_bUseWin32Editor = TRUE;
689 // custom shader editor options
690 m_bUseCustomEditor = FALSE;
691 m_strEditorCommand = "";
693 m_nLightRadiuses = 1;
694 m_bQ3Map2Texturing = TRUE;
696 m_bGlATIHack = FALSE;
701 =========================================================
702 Games selection dialog
703 =========================================================
707 #define TOOLS_ATTRIBUTE "gametools_win32"
708 #define ENGINE_ATTRIBUTE "engine_win32"
709 #define ENGINEPATH_ATTRIBUTE "enginepath_win32"
710 #define MP_ENGINE_ATTRIBUTE "mp_engine_win32"
711 #elif defined(__linux__) || defined (__FreeBSD__)
712 #define TOOLS_ATTRIBUTE "gametools_linux"
713 #define ENGINE_ATTRIBUTE "engine_linux"
714 #define ENGINEPATH_ATTRIBUTE "enginepath_linux"
715 #define MP_ENGINE_ATTRIBUTE "mp_engine_linux"
716 #elif defined(__APPLE__)
717 #define TOOLS_ATTRIBUTE "gametools_macos"
718 #define ENGINE_ATTRIBUTE "engine_macos"
719 #define ENGINEPATH_ATTRIBUTE "enginepath_macos"
720 #define MP_ENGINE_ATTRIBUTE "mp_engine_macos"
722 #error "unsupported platform"
725 CGameDescription::CGameDescription(xmlDocPtr pDoc, const Str &GameFile)
729 // read the user-friendly game name
730 xmlNodePtr pNode = mpDoc->children;
732 while (strcmp((const char*)pNode->name, "game") && pNode != NULL) pNode=pNode->next;
735 ///< \todo add the file name (this node and gametools should all be part of CGameDescription anyway)
736 Error("Didn't find 'game' node in the game description file '%s'\n", pDoc->URL);
738 // on win32, game tools path can now be specified relative to the exe's cwd
739 prop = (char*)xmlGetProp( pNode, (xmlChar*)TOOLS_ATTRIBUTE);
740 if ( prop == NULL ) {
741 Error( "Didn't find '"TOOLS_ATTRIBUTE"' node in the game description file '%s'\n", pDoc->URL );
746 _fullpath( full, prop, PATH_MAX );
748 strncpy( full, prop, PATH_MAX );
752 for ( p = full; *p != '\0'; p++ ) {
756 mGameToolsPath = full;
757 if ( p != full && *(p-1) != '/' ) {
758 mGameToolsPath += "/";
763 prop = (char*)xmlGetProp(pNode, (xmlChar*)"name");
766 Sys_FPrintf(SYS_WRN, "Warning, 'name' attribute not found in '%s'\n", pDoc->URL);
767 mGameName = pDoc->URL;
775 mGameFile = GameFile;
777 prop = (char*)xmlGetProp(pNode, (xmlChar*)"quake2");
789 // if this is set, the open maps dialoge will open the engine path not the
790 // home dir for map loading and saving
791 prop = (char*)xmlGetProp(pNode, (xmlChar*)"no_maps_in_home");
795 noMapsInHome = false;
803 prop = (char*)xmlGetProp(pNode, (xmlChar*)"basegame");
807 mBaseGame = "baseq3";
816 prop = (char*)xmlGetProp(pNode, (const xmlChar*)ENGINE_ATTRIBUTE);
820 mEngine = "quake3.exe";
824 mEngine = "Quake3.app";
833 prop = (char*)xmlGetProp(pNode, (const xmlChar*)MP_ENGINE_ATTRIBUTE);
837 mMultiplayerEngine = "quake3.exe";
839 mMultiplayerEngine = "quake3";
841 mMultiplayerEngine = "Quake3.app";
846 mMultiplayerEngine = prop;
851 // on win32, engine path can now be specified relative to the exe's cwd
852 prop = (char*)xmlGetProp(pNode, (const xmlChar *)ENGINEPATH_ATTRIBUTE);
853 if ( prop != NULL ) {
856 _fullpath( full, prop, PATH_MAX );
858 strncpy( full, prop, PATH_MAX );
862 // process seperators
863 for ( p = full; *p != '\0'; p++ ) {
869 if ( p != full && *(p-1) != '/' ) {
875 // if engine path was not specified in the .game, it implies we can guess it from the gametools path
876 // on win32, and for most game package, the gametools are installed with the game
877 char aux_path[PATH_MAX]; // aux
878 strcpy( aux_path, mGameToolsPath.GetBuffer() );
879 if ( ( aux_path[ strlen(aux_path)-1 ] == '/' ) || ( aux_path[ strlen(aux_path)-1 ] == '\\' ) ) {
880 aux_path[strlen(aux_path)-1] = '\0'; // strip ending '/' if any
882 char up_path[PATH_MAX]; // up one level
883 ExtractFilePath( aux_path, up_path );
884 mEnginePath = up_path;
888 #if defined (__linux__) || defined (__APPLE__)
890 prop = (char*)xmlGetProp(pNode, (const xmlChar *)"prefix");
893 mUserPathPrefix = prop;
897 mShaderPath = xmlGetProp(pNode, (const xmlChar *)"shaderpath");
898 if (!mShaderPath.GetLength())
900 mShaderPath = "scripts/";
901 mShaderlist = "scripts/shaderlist.txt";
905 AddSlash(mShaderPath);
906 mShaderlist = mShaderPath;
907 mShaderlist += "shaderlist.txt";
909 xmlChar* default_scale = xmlGetProp(pNode, (const xmlChar *)"default_scale");
912 mTextureDefaultScale = atof((const char *)default_scale);
913 xmlFree(default_scale);
916 mTextureDefaultScale = 0.5f;
917 xmlChar* eclass_singleload = xmlGetProp(pNode, (const xmlChar*)"eclass_singleload");
918 if (eclass_singleload)
920 mEClassSingleLoad = true;
921 xmlFree(eclass_singleload);
924 mEClassSingleLoad = false;
925 xmlChar* no_patch = xmlGetProp(pNode, (const xmlChar *)"no_patch");
933 xmlChar* caulk_shader = xmlGetProp(pNode, (const xmlChar *)"caulk_shader");
936 mCaulkShader = caulk_shader;
937 xmlFree(caulk_shader);
940 mCaulkShader = "textures/common/caulk";
943 void CGameDescription::Dump()
946 if (CGameDialog::GetNetrun())
947 Sys_Printf("Running in network mode, prefs path set to '%s'\n", g_strTempPath.GetBuffer());
949 Sys_Printf("game name : '%s'\n", mGameName.GetBuffer());
950 Sys_Printf("game file : '%s'\n", mGameFile.GetBuffer());
951 Sys_Printf("game path : '%s'\n", mGameToolsPath.GetBuffer());
952 Sys_Printf("base game : '%s'\n", mBaseGame.GetBuffer());
953 Sys_Printf("engine path : '%s'\n", mEnginePath.GetBuffer());
954 Sys_Printf("engine : '%s'\n", mEngine.GetBuffer());
955 Sys_Printf("shaderlist : '%s'\n", mShaderlist.GetBuffer());
956 Sys_Printf("caulk shader: '%s'\n", mCaulkShader.GetBuffer());
957 #if defined (__linux__) || defined (__APPLE__)
958 Sys_Printf("prefix : '%s'\n", mUserPathPrefix.GetBuffer());
960 Sys_Printf("default texture scale: %g\n", mTextureDefaultScale);
961 Sys_Printf("single eclass load : %s\n", mEClassSingleLoad ? "Yes" : "No");
962 Sys_Printf("patches supported : %s\n", mNoPatch ? "No" : "Yes");
965 CPrefAssignment& CPrefAssignment::operator = (const CPrefAssignment& ass)
976 CPrefAssignment::CPrefAssignment(const CPrefAssignment& ass)
981 void CGameDialog::LoadPrefs()
983 // if we already have a document loaded, we will free and reload from file
984 if (mGlobalPrefs.InUse())
986 Sys_Printf("Reloading global prefs from file\n");
987 mGlobalPrefs.Clear();
990 // load global .pref file
991 CString strGlobalPref = g_PrefsDlg.m_global_rc_path->str;
992 strGlobalPref += "global.pref";
994 mGlobalPrefs.ReadXMLFile(strGlobalPref.GetBuffer());
996 mGlobalPrefs.GetPref("gamefile", &m_sGameFile, ""); // NOTE: there's no default, user HAS to select something
997 mGlobalPrefs.GetPref("autoload", &m_bAutoLoadGame, false);
998 mGlobalPrefs.GetPref("log console", &m_bLogConsole, false);
999 // in a very particular post-.pid startup
1000 // we may have the console turned on and want to keep it that way
1001 // so we use a latching system
1002 if (m_bForceLogConsole)
1004 m_bLogConsole = true;
1005 Sys_Printf("console logging has been latched on, saving prefs\n");
1007 m_bForceLogConsole = false;
1010 // console logging: call Sys_LogConsole to check console logging status
1011 // it is important that we would log console as early as possible to make it useful
1014 if (mGlobalPrefs.mbEmpty)
1016 Sys_Printf("Saving global.pref with default pref values\n");
1021 void CGameDialog::SavePrefs()
1023 // update the tree and save it
1024 mGlobalPrefs.UpdatePrefTree();
1026 CString strGlobalPref = g_PrefsDlg.m_global_rc_path->str;
1027 strGlobalPref += "global.pref";
1029 if ( !mGlobalPrefs.WriteXMLFile( strGlobalPref.GetBuffer() ) ) {
1030 Sys_FPrintf(SYS_ERR, "Error occured while saving global prefs file '%s'\n", strGlobalPref.GetBuffer());
1034 void CGameDialog::DoGameInstall() {
1035 // make sure console logging is on whenever we enter the installation loop
1036 g_PrefsDlg.mGamesDialog.m_bLogConsole = true;
1041 void CGameDialog::DoGameDialog() {
1042 // allow looping the game selection dialog with calls to the game configure dialog in between
1043 while ( m_bDoGameInstall ) {
1045 m_bDoGameInstall = false;
1047 if ( DoModal() == IDCANCEL ) {
1048 Error( "game selection dialog canceled, cannot continue" );
1052 if ( m_bDoGameInstall ) {
1055 // and we will loop to do another DoModal dialog
1059 // unhook so we can use in other places
1060 // we manually incref'ed it when creating, it won't be freed (destructor)
1061 gtk_container_remove( GTK_CONTAINER( mTopBox ), GetGlobalFrame() );
1063 // we save the prefs file
1067 GtkWidget* CGameDialog::GetGlobalFrame()
1069 GtkWidget *vbox, *text, *combo, *check;
1071 if ( mFrame != NULL ) {
1075 mFrame = gtk_frame_new( NULL );
1076 gtk_container_set_border_width( GTK_CONTAINER( mFrame ), 5 );
1077 gtk_widget_show( mFrame );
1079 vbox = gtk_vbox_new( FALSE, 6 );
1080 gtk_widget_show( vbox );
1081 gtk_container_add( GTK_CONTAINER( mFrame ), vbox );
1082 gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
1084 text = gtk_label_new( _("Select the game:") );
1085 gtk_widget_show( text );
1086 gtk_box_pack_start( GTK_BOX( vbox ), text, FALSE, FALSE, 0 );
1088 combo = gtk_combo_box_new_text();
1089 gtk_widget_show( combo );
1090 gtk_box_pack_start( GTK_BOX( vbox ), combo, FALSE, FALSE, 0 );
1091 AddDialogData( combo, &m_nComboSelect, DLG_COMBO_BOX_INT );
1092 mGameCombo = GTK_COMBO_BOX( combo );
1096 check = gtk_check_button_new_with_label( _("Auto load selected game on startup") );
1097 gtk_widget_show(check);
1098 gtk_box_pack_start (GTK_BOX(vbox), check, FALSE, FALSE, 0);
1099 AddDialogData (check, &m_bAutoLoadGame, DLG_CHECK_BOOL);
1101 text = gtk_label_new(_("(this frame is available in the prefs menu if you set auto-select)"));
1102 gtk_widget_show(text);
1103 gtk_box_pack_start (GTK_BOX(vbox), text, FALSE, FALSE, 0);
1106 check = gtk_check_button_new_with_label( _("Networked install - per-user settings") );
1107 gtk_widget_show( check );
1108 gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 );
1109 AddDialogData( check, &m_bNetRun, DLG_CHECK_BOOL );
1112 check = gtk_check_button_new_with_label( _("Log the console to radiant.log") );
1113 gtk_widget_show( check );
1114 gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 );
1115 AddDialogData( check, &m_bLogConsole, DLG_CHECK_BOOL );
1117 // incref it so we can pass it around
1118 gtk_widget_ref( GTK_WIDGET( mFrame ) );
1123 void CGameDialog::UpdateData( bool retrieve ) {
1126 // use m_sGameFile to set m_nComboSelect
1127 list<CGameDescription *>::iterator iGame;
1129 for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++)
1131 if ((*iGame)->mGameFile == m_sGameFile)
1139 UpdateNetrun(false);
1142 Dialog::UpdateData(retrieve);
1145 // use m_nComboSelect to set m_sGameFile
1146 list<CGameDescription *>::iterator iGame = mGames.begin();
1148 for(i=0; i<m_nComboSelect; i++)
1152 m_sGameFile = (*iGame)->mGameFile;
1159 void CGameDialog::SInstallCallback( GtkWidget *widget, gpointer data ) {
1160 CGameDialog *d = static_cast< CGameDialog* >( data );
1161 d->m_bDoGameInstall = true;
1165 void CGameDialog::BuildDialog() {
1166 GtkWidget *dlg, *vbox1, *button, *setup_button;
1169 gtk_window_set_title( GTK_WINDOW( dlg ), _("Select Game") );
1171 vbox1 = gtk_vbox_new( FALSE, 0 );
1172 gtk_widget_show( vbox1 );
1173 gtk_container_add( GTK_CONTAINER( dlg ), vbox1 );
1175 gtk_container_add( GTK_CONTAINER( vbox1 ), GetGlobalFrame() );
1178 setup_button = gtk_button_new_with_label( _("Configure more games") );
1179 gtk_widget_show( setup_button );
1180 gtk_box_pack_start( GTK_BOX( vbox1 ), setup_button, FALSE, FALSE, 0 );
1181 gtk_signal_connect( GTK_OBJECT( setup_button ), "clicked",
1182 GTK_SIGNAL_FUNC( SInstallCallback ), this );
1184 button = gtk_button_new_with_label( _("OK") );
1185 gtk_widget_show( button );
1186 gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 );
1187 AddModalButton( button, IDOK );
1189 button = gtk_button_new_with_label( _("Cancel") );
1190 gtk_widget_show( button );
1191 gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 );
1192 AddModalButton( button, IDCANCEL );
1194 gtk_widget_set_usize( button, 60, -2 );
1197 void CGameDialog::UpdateGameCombo() {
1198 // fill in with the game descriptions
1199 list<CGameDescription *>::iterator iGame;
1201 if ( mGameCombo == NULL ) {
1202 Sys_Printf( "mGameCombo == NULL\n" );
1206 // clear whatever is in - wtf no way to know how many text entries?
1207 // use set/get active to track
1208 gtk_combo_box_set_active( mGameCombo, 0 );
1209 while ( gtk_combo_box_get_active( mGameCombo ) == 0 ) {
1210 gtk_combo_box_remove_text( mGameCombo, 0 );
1211 gtk_combo_box_set_active( mGameCombo, 0 );
1214 for ( iGame = mGames.begin(); iGame != mGames.end(); iGame++ ) {
1215 gtk_combo_box_append_text( mGameCombo, (*iGame)->mGameName.GetBuffer() );
1217 gtk_combo_box_set_active( mGameCombo, 0 );
1220 void CGameDialog::ScanForGames()
1225 CString strGamesPath = g_strAppPath.GetBuffer();
1226 strGamesPath += "games";
1227 const char *path = strGamesPath.GetBuffer();
1229 if ( !mGames.empty() ) {
1230 Sys_Printf( "Clearing game list\n" );
1231 list<CGameDescription*>::iterator iGame;
1232 for ( iGame = mGames.begin(); iGame != mGames.end(); iGame++ ) {
1238 Sys_Printf( "Scanning for game description files: %s\n", path );
1242 do we put game description files below g_strAppPath, or in ~/.radiant
1243 i.e. read only or read/write?
1244 my guess .. readonly cause it's an install
1245 we will probably want to add ~/.radiant/<version>/games/ scanning on top of that for developers
1246 (if that's really needed)
1249 // FIXME need to catch the 'no game description' situation and exit with a clean error
1251 dir = g_dir_open(path, 0, NULL);
1257 const gchar* name = g_dir_read_name(dir);
1261 dirlist = g_strdup(name);
1265 char *ext = strrchr (dirlist, '.');
1266 if ((ext == NULL) || (strcmp (ext, ".game") != 0))
1268 strPath.Format("%s/%s", path, dirlist);
1269 Sys_Printf("%s\n", strPath.GetBuffer());
1271 xmlDocPtr pDoc = xmlParseFile(strPath.GetBuffer());
1274 mGames.push_front( new CGameDescription( pDoc, dirlist ) );
1278 Sys_FPrintf(SYS_ERR, "XML parser failed on '%s'\n", strPath.GetBuffer());
1286 // entries in the combo need to be updated
1290 CGameDescription* CGameDialog::GameDescriptionForComboItem()
1292 list<CGameDescription *>::iterator iGame;
1294 for( iGame = mGames.begin(); iGame != mGames.end(); iGame++,i++ ) {
1295 if ( i == m_nComboSelect ) {
1299 return NULL; // not found
1302 void CGameDialog::InitGlobalPrefPath()
1304 GString *global_rc_path;
1305 // configure m_global_rc_path
1306 // this is the g_strTempPath, and it has already been mkdir'ed
1307 global_rc_path = g_string_new(g_strTempPath.GetBuffer());
1308 g_PrefsDlg.m_global_rc_path = global_rc_path;
1311 void CGameDialog::Reset()
1313 if (!g_PrefsDlg.m_global_rc_path)
1314 InitGlobalPrefPath();
1315 CString strGlobalPref = g_PrefsDlg.m_global_rc_path->str;
1316 strGlobalPref += "global.pref";
1317 remove(strGlobalPref.GetBuffer());
1320 void CGameDialog::Init()
1322 InitGlobalPrefPath();
1324 if ( mGames.empty() ) {
1327 if ( mGames.empty() ) {
1328 Error( "No games setup, aborting\n" );
1332 if ( m_bAutoLoadGame ) {
1333 // search by .game name
1334 list<CGameDescription *>::iterator iGame;
1335 for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++)
1337 if ((*iGame)->mGameFile == m_sGameFile)
1339 m_pCurrentGameDescription = (*iGame);
1344 if ( !m_bAutoLoadGame || !m_pCurrentGameDescription ) {
1346 // use m_nComboSelect to identify the game to run as and set the globals
1347 m_pCurrentGameDescription = GameDescriptionForComboItem();
1348 if ( !m_pCurrentGameDescription ) {
1349 Error("Lookup of game description object failed, can't continue\n");
1352 g_pGameDescription = m_pCurrentGameDescription;
1354 g_strGameToolsPath = g_pGameDescription->mGameToolsPath;
1356 // NOTE TTimo: this is moved from QE_LoadProject in 1.2
1357 // (probably broken)
1358 // NOTE Hydra: was broken for win32, we don't use m_strHomeGame or m_strFSBasePath
1359 #if defined (__linux__) || defined (__APPLE__)
1360 g_qeglobals.m_strHomeGame = g_get_home_dir();
1361 g_qeglobals.m_strHomeGame += "/";
1362 g_qeglobals.m_strHomeGame += m_pCurrentGameDescription->mUserPathPrefix.GetBuffer();
1363 g_qeglobals.m_strHomeGame += "/";
1365 g_qeglobals.m_strHomeGame = g_pGameDescription->mEnginePath.GetBuffer();
1368 g_pGameDescription->Dump();
1371 CGameDialog::~CGameDialog()
1375 // NOTE I'm not too sure how reliable this is
1376 gtk_widget_unref(GTK_WIDGET(mFrame));
1378 // free all the game descriptions
1379 list<CGameDescription *>::iterator iGame;
1380 for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++)
1387 void CGameDialog::AddPacksURL(Str &URL)
1389 // add the URLs for the list of game packs installed
1390 // FIXME: this is kinda hardcoded for now..
1391 list<CGameDescription *>::iterator iGame;
1392 for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++)
1394 if ((*iGame)->mGameFile == "q3.game")
1395 URL += "&Games_dlup%5B%5D=1";
1396 else if ((*iGame)->mGameFile == "wolf.game")
1397 URL += "&Games_dlup%5B%5D=2";
1398 // FIXME: double entry
1399 else if ((*iGame)->mGameFile == "wolf.game")
1400 URL += "&Games_dlup%5B%5D=3";
1401 else if ((*iGame)->mGameFile == "jk2.game")
1402 URL += "&Games_dlup%5B%5D=4";
1403 else if ((*iGame)->mGameFile == "stvef.game")
1404 URL += "&Games_dlup%5B%5D=5";
1405 else if ((*iGame)->mGameFile == "sof2.game")
1406 URL += "&Games_dlup%5B%5D=6";
1407 else if ((*iGame)->mGameFile == "ja.game")
1408 URL += "&Games_dlup%5B%5D=7";
1414 #define NETRUN_FILENAME "netrun.conf"
1416 bool CGameDialog::m_bNetRun;
1418 void CGameDialog::UpdateNetrun(bool retrieve)
1422 strNetrun = g_strAppPath; strNetrun += NETRUN_FILENAME;
1425 // now check if we are running from a network installation
1426 // use a dummy file as the flag
1427 f_netrun = fopen(strNetrun.GetBuffer(), "r");
1440 f_netrun = fopen(strNetrun.GetBuffer(), "w");
1443 Sys_FPrintf(SYS_ERR, "ERROR: Failed to create netrun file '%s'\n", strNetrun.GetBuffer());
1449 Sys_Printf("Created/Checked '%s'\n", strNetrun.GetBuffer());
1454 if (remove(strNetrun.GetBuffer()) == -1)
1456 if (errno != ENOENT)
1457 Sys_FPrintf(SYS_ERR, "Failed to remove netrun file '%s'\n", strNetrun.GetBuffer());
1462 Sys_Printf("Netrun mode is disabled\n");
1468 bool CGameDialog::GetNetrun()
1477 very first prefs init deals with selecting the game and the game tools path
1478 then we can load .ini stuff
1480 using prefs / ini settings:
1484 look in g_strGameToolsPath for .ini
1487 look in ~/.radiant/<version>/gamename
1491 #define PREFS_LOCAL_FILENAME "local.pref"
1493 void PrefsDlg::Init()
1495 mGamesDialog.Init();
1497 // m_global_rc_path has been set above, do m_rc_path with game specific stuff now
1498 // the win32 and linux versions have been unified for network mode
1500 if (!CGameDialog::GetNetrun())
1502 // legacy prefs settings, this goes where the game pack is installed
1503 m_rc_path = g_string_new (g_strGameToolsPath.GetBuffer() );
1504 m_inipath = g_string_new (m_rc_path->str);
1505 g_string_append (m_inipath, PREFS_LOCAL_FILENAME);
1509 // this is common to win32 and Linux init now
1510 m_rc_path = g_string_new (m_global_rc_path->str);
1513 g_string_append (m_rc_path, g_pGameDescription->mGameFile.GetBuffer());
1514 g_string_append (m_rc_path, "/");
1515 Q_mkdir (m_rc_path->str, 0775);
1517 // then the ini file
1518 m_inipath = g_string_new (m_rc_path->str);
1519 g_string_append (m_inipath, PREFS_LOCAL_FILENAME);
1523 void PrefsDlg::UpdateData (bool retrieve)
1525 // leo: the "changed" signal confuses the update function
1526 if (m_pWidget == NULL)
1528 mGamesDialog.UpdateData (retrieve);
1529 Dialog::UpdateData (retrieve);
1533 #define PREFSHSPACE 5
1535 #define PREFSHSPACE 0
1538 static void UpdateSensitivity( GtkWidget *widget, gpointer data )
1540 PrefsDlg *dlg = (PrefsDlg*)data;
1541 dlg->DoSensitivity();
1544 static void UpdateEditorSensitivity(GtkWidget *widget, gpointer data)
1546 PrefsDlg *dlg = (PrefsDlg*)data;
1547 dlg->DoEditorSensitivity();
1550 // start new prefs dialog
1552 /*! Utility function for swapping notebook pages for tree list selections */
1553 void PrefsDlg::showPrefPage(int prefpage)
1555 if(gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook)) != prefpage)
1556 gtk_notebook_set_page(GTK_NOTEBOOK(notebook), prefpage);
1561 static void treeSelection(GtkTreeSelection* selection, gpointer data)
1563 PrefsDlg *dlg = (PrefsDlg*)data;
1565 GtkTreeModel* model;
1566 GtkTreeIter selected;
1567 if(gtk_tree_selection_get_selected(selection, &model, &selected))
1570 gtk_tree_model_get(model, &selected, 1, (gpointer*)&prefpage, -1);
1571 dlg->showPrefPage(prefpage);
1575 void PrefsDlg::BuildDialog ()
1577 // Main Preferences dialog
1578 GtkWidget *dialog, *mainvbox, *hbox, *sc_win, *preflabel;
1580 // Widgets on notebook pages
1581 GtkWidget *check, *label, *scale, *hbox2, *combo,
1582 *table, *spin, *entry, *pixmap,
1583 *radio, *button, *pageframe, *vbox;
1585 GList *combo_list = (GList*)NULL;
1590 gtk_window_set_title(GTK_WINDOW(dialog), _("GtkRadiant Preferences"));
1591 gtk_widget_realize(dialog);
1593 mainvbox = gtk_vbox_new(FALSE, 5);
1594 gtk_container_add(GTK_CONTAINER(dialog), mainvbox);
1595 gtk_container_set_border_width(GTK_CONTAINER(mainvbox), 5);
1596 gtk_widget_show(mainvbox);
1598 hbox = gtk_hbox_new(FALSE, 5);
1599 gtk_widget_show(hbox);
1600 gtk_box_pack_end(GTK_BOX(mainvbox), hbox, FALSE, TRUE, 0);
1602 button = gtk_button_new_with_label(_("OK"));
1603 gtk_widget_show(button);
1604 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
1605 gtk_widget_set_usize(button, 60, -2);
1606 AddModalButton(button, IDOK);
1608 button = gtk_button_new_with_label(_("Cancel"));
1609 gtk_widget_show(button);
1610 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
1611 gtk_widget_set_usize(button, 60, -2);
1612 AddModalButton(button, IDCANCEL);
1614 button = gtk_button_new_with_label (_("Clean"));
1615 gtk_widget_show(button);
1616 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(OnButtonClean), this);
1617 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
1618 gtk_widget_set_usize (button, 60, -2);
1620 hbox = gtk_hbox_new(FALSE, 5);
1621 gtk_box_pack_start(GTK_BOX(mainvbox), hbox, TRUE, TRUE, 0);
1622 gtk_widget_show(hbox);
1624 sc_win = gtk_scrolled_window_new(NULL, NULL);
1625 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sc_win), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
1626 gtk_box_pack_start(GTK_BOX(hbox), sc_win, FALSE, FALSE, 0);
1627 gtk_widget_show(sc_win);
1629 // prefs pages notebook
1630 notebook = gtk_notebook_new();
1631 // hide the notebook tabs since its not supposed to look like a notebook
1632 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook), FALSE);
1633 gtk_box_pack_start(GTK_BOX(hbox), notebook, TRUE, TRUE, 0);
1634 gtk_widget_show(notebook);
1636 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sc_win), GTK_SHADOW_IN);
1639 GtkTreeStore* store = gtk_tree_store_new(2, G_TYPE_STRING, G_TYPE_POINTER);
1641 GtkWidget* view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
1642 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE);
1645 GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
1646 GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes(_("Preferences"), renderer, "text", 0, NULL);
1647 gtk_tree_view_append_column(GTK_TREE_VIEW(view), column);
1651 GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
1652 g_signal_connect(G_OBJECT(selection), "changed", G_CALLBACK(treeSelection), this);
1655 gtk_widget_show(view);
1657 gtk_container_add(GTK_CONTAINER (sc_win), view);
1660 /********************************************************************/
1661 /* Add preference tree options */
1662 /********************************************************************/
1665 gtk_tree_store_append(store, &group, NULL);
1666 gtk_tree_store_set(store, &group, 0, _("Globals"), 1, PTAB_FRONT, -1);
1669 gtk_tree_store_append(store, &tab, &group);
1670 gtk_tree_store_set(store, &tab, 0, _("Game settings"), 1, (gpointer)PTAB_GAME_SETTINGS, -1);
1676 gtk_tree_store_append(store, &group, NULL);
1677 gtk_tree_store_set(store, &group, 0, _("Display"), 1, PTAB_FRONT, -1);
1680 gtk_tree_store_append(store, &tab, &group);
1681 gtk_tree_store_set(store, &tab, 0, _("2D Display/Rendering"), 1, (gpointer)PTAB_2D, -1);
1685 gtk_tree_store_append(store, &tab, &group);
1686 gtk_tree_store_set(store, &tab, 0, _("3D View"), 1, (gpointer)PTAB_CAMERA, -1);
1690 gtk_tree_store_append(store, &tab, &group);
1691 gtk_tree_store_set(store, &tab, 0, _("Texture Settings"), 1, (gpointer)PTAB_TEXTURE, -1);
1697 gtk_tree_store_append(store, &group, NULL);
1698 gtk_tree_store_set(store, &group, 0, _("Interface"), 1, PTAB_FRONT, -1);
1701 gtk_tree_store_append(store, &tab, &group);
1702 gtk_tree_store_set(store, &tab, 0, _("Layout"), 1, (gpointer)PTAB_LAYOUT, -1);
1706 gtk_tree_store_append(store, &tab, &group);
1707 gtk_tree_store_set(store, &tab, 0, _("Mouse"), 1, (gpointer)PTAB_MOUSE, -1);
1711 gtk_tree_store_append(store, &tab, &group);
1712 gtk_tree_store_set(store, &tab, 0, _("Editing"), 1, (gpointer)PTAB_EDITING, -1);
1718 gtk_tree_store_append(store, &group, NULL);
1719 gtk_tree_store_set(store, &group, 0, _("Other"), 1, PTAB_FRONT, -1);
1722 gtk_tree_store_append(store, &tab, &group);
1723 gtk_tree_store_set(store, &tab, 0, _("Startup/Auto save"), 1, (gpointer)PTAB_STARTUP, -1);
1727 gtk_tree_store_append(store, &tab, &group);
1728 gtk_tree_store_set(store, &tab, 0, _("Paths"), 1, (gpointer)PTAB_PATHS, -1);
1732 gtk_tree_store_append(store, &tab, &group);
1733 gtk_tree_store_set(store, &tab, 0, _("Misc"), 1, (gpointer)PTAB_MISC, -1);
1735 if (!g_qeglobals.bBSPFrontendPlugin)
1738 gtk_tree_store_append(store, &tab, &group);
1739 gtk_tree_store_set(store, &tab, 0, _("BSP Monitoring"), 1, (gpointer)PTAB_BSPMONITOR, -1);
1744 gtk_tree_view_expand_all(GTK_TREE_VIEW(view));
1746 g_object_unref(G_OBJECT(store));
1749 /**********************************************************************/
1750 /* build the prefs pages */
1751 /**********************************************************************/
1754 // todo : add something interesting here
1755 // NOTE TTimo: tip of the day? or a logo?
1756 preflabel = gtk_label_new(_("Front Page"));
1757 gtk_widget_show(preflabel);
1758 pageframe = gtk_frame_new(NULL);
1759 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
1760 gtk_widget_show(pageframe);
1761 vbox = gtk_vbox_new(FALSE, 5);
1762 gtk_widget_show(vbox);
1763 gtk_widget_set_usize(GTK_WIDGET(vbox), 350, -2);
1764 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1765 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
1767 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
1769 /******** global preferences group ****************************/
1770 preflabel = gtk_label_new(_("Globals"));
1771 gtk_widget_show(preflabel);
1773 pageframe = mGamesDialog.GetGlobalFrame();
1774 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
1776 /******** 2D prefs group (xy views/rendering options) *********/
1777 preflabel = gtk_label_new(_("2D Display"));
1778 gtk_widget_show(preflabel);
1779 pageframe = gtk_frame_new(_("2D Display"));
1780 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
1781 gtk_widget_show(pageframe);
1782 vbox = gtk_vbox_new(FALSE, 5);
1783 gtk_widget_show(vbox);
1784 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1785 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
1787 // OpenGL Display Lists
1788 check = gtk_check_button_new_with_label(_("OpenGL Display Lists"));
1789 gtk_widget_show(check);
1790 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
1791 AddDialogData(check, &m_bDisplayLists, DLG_CHECK_BOOL);
1793 // Antialiased points & lines
1794 // Fishman - Add antialiazed points and lines support. 09/03/00
1795 check = gtk_check_button_new_with_label (_("OpenGL antialiased points and lines"));
1796 gtk_widget_show (check);
1797 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1798 AddDialogData (check, &m_bAntialiasedPointsAndLines, DLG_CHECK_BOOL);
1800 // Solid selection boxes
1801 check = gtk_check_button_new_with_label (_("Solid selection boxes"));
1802 gtk_widget_show (check);
1803 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1804 AddDialogData (check, &m_bNoStipple, DLG_CHECK_BOOL);
1806 // Display size info
1807 check = gtk_check_button_new_with_label (_("Display size info"));
1808 gtk_widget_show (check);
1809 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
1810 AddDialogData (check, &m_bSizePaint, DLG_CHECK_BOOL);
1812 // Alternate vertex/edge handles
1813 // Gef: Kyro GL_POINT work around 25-aug-2001
1814 check = gtk_check_button_new_with_label (_("Alternate vertex/edge handles"));
1815 gtk_widget_show(check);
1816 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
1817 AddDialogData(check, &m_bGlPtWorkaround, DLG_CHECK_BOOL);
1819 g_list_free (combo_list);
1823 check = gtk_check_button_new_with_label (_("ATI cards with broken drivers - bug #802"));
1824 gtk_widget_show(check);
1825 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
1826 AddDialogData(check, &m_bGlATIHack, DLG_CHECK_BOOL);
1829 // Add the page to the notebook
1830 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
1832 /******** 3D Camera view group *********/
1833 preflabel = gtk_label_new(_("3D View"));
1834 gtk_widget_show(preflabel);
1835 pageframe = gtk_frame_new(_("3D View"));
1836 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
1837 gtk_widget_show(pageframe);
1838 vbox = gtk_vbox_new(FALSE, 5);
1839 gtk_widget_show(vbox);
1840 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1841 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
1843 // Directional velocity (Movement Velocity)
1845 hbox2 = gtk_hbox_new (FALSE, 0);
1846 gtk_widget_show (hbox2);
1847 gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
1850 label = gtk_label_new(_("Movement Velocity"));
1851 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
1852 gtk_widget_show(label);
1853 gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
1856 adj = gtk_adjustment_new(100, 50, 300, 1, 10, 10);
1857 AddDialogData(adj, &m_nMoveSpeed, DLG_ADJ_INT);
1860 scale = gtk_hscale_new(GTK_ADJUSTMENT(adj));
1861 gtk_widget_show(scale);
1862 gtk_box_pack_start(GTK_BOX (vbox), scale, FALSE, TRUE, 2);
1864 gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
1866 // Angular velocity (Rotational Velocity)
1868 hbox2 = gtk_hbox_new (FALSE, 0);
1869 gtk_widget_show (hbox2);
1870 gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
1873 label = gtk_label_new (_("Rotational Velocity"));
1874 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
1875 gtk_widget_show (label);
1876 gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
1879 adj = gtk_adjustment_new (3, 1, 180, 1, 10, 10); // value, low, high, step, page_step, page_size
1880 AddDialogData (adj, &m_nAngleSpeed, DLG_ADJ_INT);
1883 scale = gtk_hscale_new (GTK_ADJUSTMENT (adj));
1884 gtk_widget_show (scale);
1885 gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, TRUE, 2);
1886 gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
1888 // Text under the velocity sliders
1890 hbox2 = gtk_hbox_new (FALSE, 0);
1891 gtk_widget_show (hbox2);
1892 gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
1895 label = gtk_label_new (_("slow"));
1896 gtk_widget_show (label);
1897 gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
1900 label = gtk_label_new (_("fast"));
1901 gtk_widget_show (label);
1902 gtk_box_pack_end (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
1904 // Allow drag to select multiple faces/brushes
1906 table = gtk_table_new(2, 1, FALSE);
1907 gtk_widget_show(table);
1908 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
1909 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
1910 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
1912 label = gtk_label_new (_("Use paint-select in camera view:"));
1913 gtk_widget_show (label);
1914 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
1915 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
1916 (GtkAttachOptions) (0),
1917 (GtkAttachOptions) (0), 0, 0);
1920 combo_list = g_list_append (combo_list, (void *)_("No"));
1921 combo_list = g_list_append (combo_list, (void *)_("Yes"));
1922 combo_list = g_list_append (combo_list, (void *)_("Yes (Classic Key Setup)"));
1924 combo = gtk_combo_new ();
1925 gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list);
1926 gtk_widget_show (combo);
1927 gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 0, 1,
1928 (GtkAttachOptions) (GTK_FILL),
1929 (GtkAttachOptions) (0), 0, 0);
1930 gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
1931 AddDialogData (combo, &m_nCamDragMultiSelect, DLG_COMBO_INT);
1933 // Freelook in Camera view
1934 check = gtk_check_button_new_with_label (_("Freelook in Camera view"));
1935 gtk_widget_show (check);
1936 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1937 gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT);
1938 AddDialogData (check, &m_bCamFreeLook, DLG_CHECK_BOOL);
1940 // Freelook in Camera view w/ forward & back strafing instead of up and down looking
1941 check = gtk_check_button_new_with_label (_("Freelook strafes Forward and Back"));
1942 gtk_widget_show (check);
1943 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1944 gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT);
1945 AddDialogData (check, &m_bCamFreeLookStrafe, DLG_CHECK_BOOL);
1947 // Invert mouse in freelook
1948 check = gtk_check_button_new_with_label (_("Invert mouse in freelook"));
1949 gtk_widget_show (check);
1950 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1951 gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT);
1952 AddDialogData (check, &m_bCamInverseMouse, DLG_CHECK_BOOL);
1954 // Discrete movement
1955 check = gtk_check_button_new_with_label (_("Discrete movement"));
1956 gtk_widget_show (check);
1957 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1958 gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT);
1959 AddDialogData (check, &m_bCamDiscrete, DLG_CHECK_BOOL);
1961 // Update XY views on camera move
1962 check = gtk_check_button_new_with_label (_("Update XY views on camera move"));
1963 gtk_widget_show (check);
1964 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1965 gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT);
1966 AddDialogData (check, &m_bCamXYUpdate, DLG_CHECK_BOOL);
1968 // Add the page to the notebook
1969 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
1971 /******** Texture group *********/
1972 preflabel = gtk_label_new(_("Textures"));
1973 gtk_widget_show(preflabel);
1974 pageframe = gtk_frame_new(_("Textures"));
1975 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
1976 gtk_widget_show(pageframe);
1977 vbox = gtk_vbox_new(FALSE, 6);
1978 gtk_widget_show(vbox);
1979 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1980 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
1982 // Texture quality slider
1984 label = gtk_label_new (_("Texture quality"));
1985 gtk_widget_show (label);
1986 gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
1987 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
1988 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
1991 adj = gtk_adjustment_new (0, 0, 4, 1, 1, 1);
1992 AddDialogData (adj, &m_nLatchedTextureQuality, DLG_ADJ_INT);
1995 scale = gtk_hscale_new (GTK_ADJUSTMENT (adj));
1996 gtk_widget_show (scale);
1997 gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
1998 gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
2000 // text under the texture slider
2001 hbox2 = gtk_hbox_new (FALSE, 0);
2002 gtk_widget_show (hbox2);
2003 gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
2004 label = gtk_label_new (_("low"));
2005 gtk_widget_show (label);
2006 gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
2007 label = gtk_label_new (_("high"));
2008 gtk_widget_show (label);
2009 gtk_box_pack_end (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
2012 check = gtk_check_button_new_with_label (_("Texture subsets"));
2013 gtk_widget_show (check);
2014 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2015 AddDialogData (check, &m_bTextureWindow, DLG_CHECK_BOOL);
2017 // texture scrollbar
2018 check = gtk_check_button_new_with_label (_("Texture scrollbar"));
2019 gtk_widget_show (check);
2020 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2021 AddDialogData (check, &m_bTextureScrollbar, DLG_CHECK_BOOL);
2023 // texture increment matches grid
2024 check = gtk_check_button_new_with_label (_("Tex increment matches grid"));
2025 gtk_widget_show (check);
2026 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2027 AddDialogData (check, &m_bSnapTToGrid, DLG_CHECK_BOOL);
2030 // Texture compression choice label
2032 table = gtk_table_new(2, 1, FALSE);
2033 gtk_widget_show(table);
2034 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2035 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2036 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2038 label = gtk_label_new (_("Texture Compression (if available):"));
2039 gtk_widget_show (label);
2040 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
2041 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
2042 (GtkAttachOptions) (0),
2043 (GtkAttachOptions) (0), 0, 0);
2044 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
2046 // Texture compression choice label
2048 // NONE will always be in pos 0
2049 combo_list = g_list_append (combo_list, (void *)_("None"));
2051 // if OpenGL compression is enabled it will always be
2053 if (g_qeglobals.m_bOpenGLCompressionSupported)
2055 combo_list = g_list_append (combo_list, (void *)_("OpenGL ARB"));
2058 // If S3 is enabled offer all 3 valid compression schemes in RGBA
2059 if (g_qeglobals.m_bS3CompressionSupported)
2061 combo_list = g_list_append (combo_list, (void *)_("S3TC DXT1"));
2062 combo_list = g_list_append (combo_list, (void *)_("S3TC DXT3"));
2063 combo_list = g_list_append (combo_list, (void *)_("S3TC DXT5"));
2066 combo = gtk_combo_new ();
2067 gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list);
2068 gtk_widget_show (combo);
2069 gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 0, 1,
2070 (GtkAttachOptions) (GTK_FILL),
2071 (GtkAttachOptions) (0), 0, 0);
2072 gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
2073 AddDialogData (combo, &m_nTextureCompressionFormat, DLG_COMBO_INT);
2074 g_list_free (combo_list);
2077 table = gtk_table_new(2, 1, FALSE);
2078 gtk_widget_show(table);
2079 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2080 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2081 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2085 label = gtk_label_new (_("Startup Shaders:"));
2086 gtk_widget_show (label);
2087 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
2088 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
2089 (GtkAttachOptions) (0),
2090 (GtkAttachOptions) (0), 0, 0);
2091 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
2095 combo_list = g_list_append (combo_list, (void *)_("None"));
2096 if (g_pGameDescription->mGameFile == "jk2.game" || g_pGameDescription->mGameFile == "ja.game")
2097 combo_list = g_list_append (combo_list, (void *)_("System"));
2098 else if (g_pGameDescription->mGameFile == "sof2.game")
2099 combo_list = g_list_append (combo_list, (void *)("Tools"));
2101 combo_list = g_list_append (combo_list, (void *)_("Common"));
2102 combo_list = g_list_append (combo_list, (void *)_("All"));
2103 combo = gtk_combo_new ();
2104 gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list);
2105 gtk_widget_show (combo);
2106 gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 0, 1,
2107 (GtkAttachOptions) (GTK_FILL),
2108 (GtkAttachOptions) (0), 0, 0);
2109 gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
2110 AddDialogData (combo, &m_nLatchedShader, DLG_COMBO_INT);
2111 g_list_free (combo_list);
2113 // Add the page to the notebook
2114 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2116 /******** Layout group *********/
2117 preflabel = gtk_label_new(_("Layout"));
2118 gtk_widget_show(preflabel);
2119 pageframe = gtk_frame_new(_("Layout"));
2120 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2121 gtk_widget_show(pageframe);
2122 vbox = gtk_vbox_new(FALSE, 5);
2123 gtk_widget_show(vbox);
2124 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2125 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2129 table = gtk_table_new (2, 4, FALSE);
2130 gtk_widget_show (table);
2131 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2132 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2133 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2136 pixmap = new_pixmap (g_pParentWnd->m_pWidget, "window1.bmp");
2137 gtk_widget_show (pixmap);
2138 gtk_table_attach (GTK_TABLE (table), pixmap, 0, 1, 0, 1,
2139 (GtkAttachOptions) (0),
2140 (GtkAttachOptions) (0), 0, 0);
2143 pixmap = new_pixmap (g_pParentWnd->m_pWidget, "window2.bmp");
2144 gtk_widget_show (pixmap);
2145 gtk_table_attach (GTK_TABLE (table), pixmap, 1, 2, 0, 1,
2146 (GtkAttachOptions) (0),
2147 (GtkAttachOptions) (0), 0, 0);
2150 pixmap = new_pixmap (g_pParentWnd->m_pWidget, "window3.bmp");
2151 gtk_widget_show (pixmap);
2152 gtk_table_attach (GTK_TABLE (table), pixmap, 2, 3, 0, 1,
2153 (GtkAttachOptions) (0),
2154 (GtkAttachOptions) (0), 0, 0);
2157 pixmap = new_pixmap (g_pParentWnd->m_pWidget, "window4.bmp");
2158 gtk_widget_show (pixmap);
2159 gtk_table_attach (GTK_TABLE (table), pixmap, 3, 4, 0, 1,
2160 (GtkAttachOptions) (0),
2161 (GtkAttachOptions) (0), 0, 0);
2163 // view type 1 selector
2164 radio = gtk_radio_button_new (NULL);
2165 gtk_widget_show (radio);
2166 gtk_table_attach (GTK_TABLE (table), radio, 0, 1, 1, 2,
2167 (GtkAttachOptions) (0),
2168 (GtkAttachOptions) (0), 0, 0);
2170 // view type 2 selector
2171 radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (radio));
2172 gtk_widget_show (radio);
2173 gtk_table_attach (GTK_TABLE (table), radio, 1, 2, 1, 2,
2174 (GtkAttachOptions) (0),
2175 (GtkAttachOptions) (0), 0, 0);
2177 // view type 3 selector
2178 radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (radio));
2179 gtk_widget_show (radio);
2180 gtk_table_attach (GTK_TABLE (table), radio, 2, 3, 1, 2,
2181 (GtkAttachOptions) (0),
2182 (GtkAttachOptions) (0), 0, 0);
2184 // view type 4 selector
2185 radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (radio));
2186 gtk_widget_show (radio);
2187 gtk_table_attach (GTK_TABLE (table), radio, 3, 4, 1, 2,
2188 (GtkAttachOptions) (0),
2189 (GtkAttachOptions) (0), 0, 0);
2190 AddDialogData (radio, &m_nLatchedView, DLG_RADIO_INT);
2192 // Floating Z window
2193 check = gtk_check_button_new_with_label (_("Floating Z Window"));
2194 gtk_widget_show (check);
2195 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2196 AddDialogData (check, &m_bLatchedFloatingZ, DLG_CHECK_BOOL);
2198 // show menu tear-off seperators
2199 check = gtk_check_button_new_with_label (_("Detachable Menus"));
2200 gtk_widget_show (check);
2201 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2202 AddDialogData (check, &m_bLatchedDetachableMenus, DLG_CHECK_BOOL);
2204 if (!g_pGameDescription->mNoPatch)
2206 // show patch toolbar
2207 check = gtk_check_button_new_with_label (_("Patch Toolbar"));
2208 gtk_widget_show (check);
2209 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2210 g_object_set_data (G_OBJECT (dialog), "check_patchtoolbar", check); // Allow to be disabled for Q1/Q2
2211 AddDialogData (check, &m_bLatchedPatchToolbar, DLG_CHECK_BOOL);
2215 check = gtk_check_button_new_with_label (_("Wide Toolbar"));
2216 gtk_widget_show (check);
2217 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2218 AddDialogData (check, &m_bLatchedWideToolbar, DLG_CHECK_BOOL);
2220 // use plugin toolbar
2221 check = gtk_check_button_new_with_label (_("Plugin Toolbar"));
2222 gtk_widget_show (check);
2223 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2224 AddDialogData (check, &m_bLatchedPluginToolbar, DLG_CHECK_BOOL);
2227 // win32 file dialog
2228 check = gtk_check_button_new_with_label (_("Use win32 file load dialog"));
2229 gtk_widget_show (check);
2230 // gtk_container_add (GTK_CONTAINER (vbox), check);
2231 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2232 AddDialogData (check, &m_bNativeGUI, DLG_CHECK_BOOL);
2234 // position on primary monitor
2235 check = gtk_check_button_new_with_label (_("Start on Primary Monitor"));
2236 gtk_widget_show (check);
2237 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2238 g_object_set_data (G_OBJECT (dialog), "check_startonprimary", check);
2239 gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateSensitivity), this );
2240 AddDialogData (check, &m_bStartOnPrimMon, DLG_CHECK_BOOL);
2243 // Add the page to the notebook
2244 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2246 /******** Mouse group *********/
2247 preflabel = gtk_label_new(_("Mouse"));
2248 gtk_widget_show(preflabel);
2249 pageframe = gtk_frame_new(_("Mouse"));
2250 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2251 gtk_widget_show(pageframe);
2252 vbox = gtk_vbox_new(FALSE, 5);
2253 gtk_widget_show(vbox);
2254 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2255 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2259 hbox2 = gtk_hbox_new (FALSE, 5);
2260 gtk_widget_show (hbox2);
2261 gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0);
2264 radio = gtk_radio_button_new_with_label (NULL, _("2 button"));
2265 gtk_widget_show (radio);
2266 gtk_box_pack_start (GTK_BOX (hbox2), radio, FALSE, FALSE, 0);
2269 radio = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio), _("3 button"));
2270 gtk_widget_show (radio);
2271 gtk_box_pack_start (GTK_BOX (hbox2), radio, FALSE, FALSE, 0);
2272 AddDialogData (radio, &m_nMouse, DLG_RADIO_INT);
2274 // right click to drop entity
2275 check = gtk_check_button_new_with_label (_("Right click to drop entities"));
2276 gtk_widget_show (check);
2277 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2278 AddDialogData (check, &m_bRightClick, DLG_CHECK_BOOL);
2280 // Mouse chaser (and this does what?)
2281 check = gtk_check_button_new_with_label (_("Mouse chaser"));
2282 gtk_widget_show (check);
2283 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2284 AddDialogData (check, &m_bChaseMouse, DLG_CHECK_BOOL);
2287 check = gtk_check_button_new_with_label (_("ALT + multi-drag"));
2288 gtk_widget_show (check);
2289 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2290 AddDialogData (check, &m_bALTEdge, DLG_CHECK_BOOL);
2292 // Mouse wheel increments
2294 hbox2 = gtk_hbox_new (FALSE, 5);
2295 gtk_widget_show (hbox2);
2296 gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0);
2299 label = gtk_label_new (_("Wheel Mouse inc:"));
2300 gtk_widget_show (label);
2301 gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
2304 entry = gtk_entry_new ();
2305 gtk_widget_show (entry);
2306 gtk_widget_set_usize (entry, 40, -2);
2307 gtk_box_pack_start (GTK_BOX (hbox2), entry, FALSE, FALSE, 0);
2308 AddDialogData (entry, &m_nWheelInc, DLG_ENTRY_INT);
2310 // Add the page to the notebook
2311 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2313 /******** Editing group *********/
2314 preflabel = gtk_label_new(_("Editing"));
2315 gtk_widget_show(preflabel);
2316 pageframe = gtk_frame_new(_("Editing"));
2317 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2318 gtk_widget_show(pageframe);
2319 vbox = gtk_vbox_new(FALSE, 5);
2320 gtk_widget_show(vbox);
2321 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2322 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2324 // Vertex editing splits faces
2325 check = gtk_check_button_new_with_label (_("Vertex editing splits face"));
2326 gtk_widget_show (check);
2327 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2328 AddDialogData (check, &m_bVertexSplit, DLG_CHECK_BOOL);
2330 // Fix target/targetname collisions
2331 check = gtk_check_button_new_with_label (_("Fix target/targetname collisions"));
2332 gtk_widget_show (check);
2333 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2334 AddDialogData (check, &m_bDoTargetFix, DLG_CHECK_BOOL);
2336 // Clipper tool uses caulk
2337 check = gtk_check_button_new_with_label (_("Clipper tool uses caulk"));
2338 gtk_widget_show (check);
2339 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2340 AddDialogData (check, &m_bClipCaulk, DLG_CHECK_BOOL);
2342 // Don't clamp plane points
2343 check = gtk_check_button_new_with_label (_("Don't clamp plane points"));
2344 gtk_widget_show (check);
2345 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2346 AddDialogData (check, &m_bNoClamp, DLG_CHECK_BOOL);
2349 check = gtk_check_button_new_with_label (_("Snap to grid"));
2350 gtk_widget_show (check);
2351 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2352 AddDialogData (check, &m_bSnap, DLG_CHECK_BOOL);
2354 // Select patch by bounding box
2355 check = gtk_check_button_new_with_label (_("Select patches by bounding box"));
2356 gtk_widget_show (check);
2357 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2358 AddDialogData (check, &m_bPatchBBoxSelect, DLG_CHECK_BOOL);
2360 // Rotation increment
2362 table = gtk_table_new (2, 3, FALSE);
2363 gtk_widget_show (table);
2364 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2365 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2366 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2369 label = gtk_label_new (_("Rotation increment:"));
2370 gtk_widget_show (label);
2371 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
2372 (GtkAttachOptions) (0),
2373 (GtkAttachOptions) (0), 0, 0);
2376 entry = gtk_entry_new ();
2377 gtk_widget_show (entry);
2378 gtk_widget_set_usize (entry, 60, -2);
2379 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1,
2380 (GtkAttachOptions) (GTK_FILL),
2381 (GtkAttachOptions) (0), 0, 0);
2382 AddDialogData (entry, &m_nRotation, DLG_ENTRY_INT);
2386 label = gtk_label_new (_("Undo Levels:"));
2387 gtk_widget_show (label);
2388 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
2389 (GtkAttachOptions) (0),
2390 (GtkAttachOptions) (0), 0, 0);
2392 // spinner (allows undo levels to be set to zero)
2393 spin = gtk_spin_button_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0, 64, 1, 10, 10)), 1, 0);
2394 gtk_widget_show (spin);
2395 gtk_table_attach (GTK_TABLE (table), spin, 1, 2, 1, 2,
2396 (GtkAttachOptions) (GTK_FILL),
2397 (GtkAttachOptions) (0), 0, 0);
2398 gtk_widget_set_usize (spin, 60, -2);
2399 AddDialogData (spin, &m_nUndoLevels, DLG_SPIN_INT);
2401 // Patch subdivisions
2403 label = gtk_label_new (_("Patch subdivisions:"));
2404 gtk_widget_show (label);
2405 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
2406 (GtkAttachOptions) (0),
2407 (GtkAttachOptions) (0), 0, 0);
2409 // entry (spinner perhaps? [2-16])
2410 entry = gtk_entry_new ();
2411 gtk_widget_show (entry);
2412 gtk_widget_set_usize (entry, 60, -2);
2413 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 2, 3,
2414 (GtkAttachOptions) (GTK_FILL),
2415 (GtkAttachOptions) (0), 0, 0);
2416 AddDialogData (entry, &m_nSubdivisions, DLG_ENTRY_INT);
2418 // Add the page to the notebook
2419 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2421 /******** Save/Load group *********/
2422 preflabel = gtk_label_new(_("Startup/Auto save"));
2423 gtk_widget_show(preflabel);
2424 pageframe = gtk_frame_new(_("Startup/Auto save"));
2425 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2426 gtk_widget_show(pageframe);
2427 vbox = gtk_vbox_new(FALSE, 5);
2428 gtk_widget_show(vbox);
2429 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2430 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2433 check = gtk_check_button_new_with_label (_("Snapshots"));
2434 gtk_widget_show (check);
2435 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2436 AddDialogData (check, &m_bSnapShots, DLG_CHECK_BOOL);
2438 // load last project on open
2439 check = gtk_check_button_new_with_label (_("Load last project on open"));
2440 gtk_widget_show (check);
2441 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2442 AddDialogData (check, &m_bLoadLast, DLG_CHECK_BOOL);
2444 // load last map on open
2445 check = gtk_check_button_new_with_label (_("Load last map on open"));
2446 gtk_widget_show (check);
2447 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2448 AddDialogData (check, &m_bLoadLastMap, DLG_CHECK_BOOL);
2452 hbox2 = gtk_hbox_new (FALSE, 5);
2453 gtk_widget_show (hbox2);
2454 gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0);
2455 gtk_container_set_border_width (GTK_CONTAINER (hbox2), 0);
2458 check = gtk_check_button_new_with_label (_("Auto save every"));
2459 gtk_widget_show (check);
2460 gtk_box_pack_start (GTK_BOX (hbox2), check, FALSE, FALSE, 0);
2461 AddDialogData (check, &m_bAutoSave, DLG_CHECK_BOOL);
2464 spin = gtk_spin_button_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 1, 60, 1, 10, 10)), 1, 0);
2465 gtk_widget_show (spin);
2466 gtk_box_pack_start (GTK_BOX (hbox2), spin, FALSE, FALSE, 0);
2467 gtk_widget_set_usize (spin, 60, -2);
2468 AddDialogData (spin, &m_nAutoSave, DLG_SPIN_INT);
2471 label = gtk_label_new (_("minutes"));
2472 gtk_widget_show (label);
2473 gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
2475 // Add the page to the notebook
2476 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2478 /******** Paths group *********/
2479 preflabel = gtk_label_new(_("Paths"));
2480 gtk_widget_show(preflabel);
2481 pageframe = gtk_frame_new(_("Paths"));
2482 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2483 gtk_widget_show(pageframe);
2484 vbox = gtk_vbox_new(FALSE, 5);
2485 gtk_widget_show(vbox);
2486 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2487 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2491 table = gtk_table_new (3, 3, FALSE);
2492 gtk_widget_show (table);
2493 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2494 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2495 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2498 label = gtk_label_new (_("Prefab path:"));
2499 gtk_widget_show (label);
2500 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
2501 (GtkAttachOptions) (0),
2502 (GtkAttachOptions) (0), 0, 0);
2503 gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
2506 entry = gtk_entry_new ();
2507 gtk_widget_show (entry);
2508 gtk_widget_set_usize(GTK_WIDGET(entry), 240, -2);
2509 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1,
2510 (GtkAttachOptions) (GTK_FILL),
2511 (GtkAttachOptions) (0), 1, 0);
2512 AddDialogData (entry, &m_strPrefabPath, DLG_ENTRY_TEXT);
2516 button = gtk_button_new_with_label ("...");
2517 gtk_widget_show (button);
2518 gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (OnBtnBrowseprefab), this);
2519 gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1,
2520 (GtkAttachOptions) (0),
2521 (GtkAttachOptions) (0), 0, 0);
2526 label = gtk_label_new (_("User INI path:"));
2527 gtk_widget_show (label);
2528 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
2529 (GtkAttachOptions) (0),
2530 (GtkAttachOptions) (0), 0, 0);
2531 gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
2533 // user ini path entry
2534 entry = gtk_entry_new ();
2535 gtk_widget_show (entry);
2536 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 1, 2,
2537 (GtkAttachOptions) (GTK_FILL),
2538 (GtkAttachOptions) (0), 1, 0);
2539 AddDialogData (entry, &m_strUserPath, DLG_ENTRY_TEXT);
2541 // user ini browse button
2542 button = gtk_button_new_with_label ("...");
2543 gtk_widget_show (button);
2544 gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (OnBtnBrowseuserini), this);
2545 gtk_table_attach (GTK_TABLE (table), button, 2, 3, 1, 2,
2546 (GtkAttachOptions) (0),
2547 (GtkAttachOptions) (0), 0, 0);
2549 // Add the page to the notebook
2550 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2552 /******** Misc group *********/
2553 preflabel = gtk_label_new(_("Misc"));
2554 gtk_widget_show(preflabel);
2555 pageframe = gtk_frame_new(_("Misc"));
2556 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2557 gtk_widget_show(pageframe);
2558 vbox = gtk_vbox_new(FALSE, 5);
2559 gtk_widget_show(vbox);
2560 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2561 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2564 check = gtk_check_button_new_with_label (_("Light drawing"));
2565 gtk_widget_show (check);
2566 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2567 AddDialogData (check, &m_bNewLightDraw, DLG_CHECK_BOOL);
2571 table = gtk_table_new(2, 1, FALSE);
2572 gtk_widget_show(table);
2573 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2574 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2575 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2577 label = gtk_label_new (_("Light radiuses:"));
2578 gtk_widget_show (label);
2579 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
2580 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
2581 (GtkAttachOptions) (0),
2582 (GtkAttachOptions) (0), 0, 0);
2585 combo_list = g_list_append (combo_list, (void *)_("Disabled"));
2586 combo_list = g_list_append (combo_list, (void *)_("True Q3Map2 Style"));
2587 combo_list = g_list_append (combo_list, (void *)_("Classic Style"));
2589 combo = gtk_combo_new ();
2590 gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list);
2591 gtk_widget_show (combo);
2592 gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 0, 1,
2593 (GtkAttachOptions) (GTK_FILL),
2594 (GtkAttachOptions) (0), 0, 0);
2595 gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
2596 AddDialogData (combo, &m_nLightRadiuses, DLG_COMBO_INT);
2599 check = gtk_check_button_new_with_label (_("Use win32 file associations to open text files instead of builtin editor"));
2600 gtk_widget_show(check);
2601 gtk_box_pack_start(GTK_BOX (vbox), check, FALSE, FALSE, 0);
2602 AddDialogData (check, &g_PrefsDlg.m_bUseWin32Editor, DLG_CHECK_BOOL);
2604 // use custom shader editor
2605 check = gtk_check_button_new_with_label (_("Use Custom Shader Editor"));
2606 gtk_widget_show(check);
2607 gtk_box_pack_start(GTK_BOX (vbox), check, FALSE, FALSE, 0);
2608 gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateEditorSensitivity), this);
2609 g_object_set_data (G_OBJECT(dialog), "check_customeditor", check);
2610 AddDialogData (check, &g_PrefsDlg.m_bUseCustomEditor, DLG_CHECK_BOOL);
2612 // custom shader editor executable
2614 table = gtk_table_new (3, 1, FALSE);
2615 gtk_widget_show (table);
2616 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2617 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2618 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2621 label = gtk_label_new(_("Custom Editor Command"));
2622 gtk_widget_show(label);
2623 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
2624 (GtkAttachOptions) (0),
2625 (GtkAttachOptions) (0), 0, 0);
2626 gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
2627 g_object_set_data (G_OBJECT(dialog), "label_customeditor", label);
2628 gtk_widget_set_sensitive (label, g_PrefsDlg.m_bUseCustomEditor);
2630 // custom editor command entry
2631 entry = gtk_entry_new ();
2632 gtk_widget_show (entry);
2633 gtk_widget_set_usize(GTK_WIDGET(entry), 240, -2);
2634 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1,
2635 (GtkAttachOptions) (GTK_FILL),
2636 (GtkAttachOptions) (0), 1, 0);
2637 AddDialogData (entry, &m_strEditorCommand, DLG_ENTRY_TEXT);
2638 gtk_widget_set_sensitive (entry, g_PrefsDlg.m_bUseCustomEditor);
2639 g_object_set_data (G_OBJECT(dialog), "entry_customeditor", entry);
2642 button = gtk_button_new_with_label (_("..."));
2643 gtk_widget_show (button);
2644 gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (OnBtnBrowseEditor), this);
2645 gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1,
2646 (GtkAttachOptions) (0),
2647 (GtkAttachOptions) (0), 0, 0);
2648 g_object_set_data (G_OBJECT(dialog), "button_customeditor", button);
2649 gtk_widget_set_sensitive (button, g_PrefsDlg.m_bUseCustomEditor);
2652 // Add the page to the notebook
2653 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2655 /******** BSP Monitoring group *********/
2656 // this is never displayed if the plugin isn't available
2657 preflabel = gtk_label_new(_("BSP Monitoring"));
2658 gtk_widget_show(preflabel);
2659 pageframe = gtk_frame_new(_("BSP Monitoring"));
2660 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2661 gtk_widget_show(pageframe);
2662 vbox = gtk_vbox_new(FALSE, 5);
2663 gtk_widget_show(vbox);
2664 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2665 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2667 // Enable BSP process monitoring
2668 check = gtk_check_button_new_with_label (_("Enable BSP process monitoring"));
2669 gtk_widget_show (check);
2670 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2671 g_object_set_data (G_OBJECT (dialog), "check_monitorbsp", check);
2672 gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateSensitivity), this );
2673 AddDialogData (check, &g_PrefsDlg.m_bWatchBSP, DLG_CHECK_BOOL);
2676 check = gtk_check_button_new_with_label (_("Stop compilation on leak"));
2677 gtk_widget_show (check);
2678 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2679 g_object_set_data (G_OBJECT (dialog), "check_leakstop", check);
2680 AddDialogData (check, &g_PrefsDlg.m_bLeakStop, DLG_CHECK_BOOL);
2682 // engine after compile
2683 check = gtk_check_button_new_with_label (_("Run engine after compile"));
2684 gtk_widget_show (check);
2685 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2686 g_object_set_data (G_OBJECT (dialog), "check_runengine", check);
2687 gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateSensitivity), this );
2688 AddDialogData( check, &g_PrefsDlg.m_bRunQuake, DLG_CHECK_BOOL );
2690 // sleep mode when running engine
2691 check = gtk_check_button_new_with_label (_("Activate sleep mode when running the engine"));
2692 gtk_widget_show (check);
2693 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2694 g_object_set_data (G_OBJECT (dialog), "check_sleep", check);
2695 AddDialogData( check, &g_PrefsDlg.m_bDoSleep, DLG_CHECK_BOOL );
2697 // use q3map2's texture projection
2698 check = gtk_check_button_new_with_label (_("Texturing compatible with q3map2"));
2699 gtk_widget_show (check);
2700 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2701 g_object_set_data (G_OBJECT (dialog), "check_q3map2", check);
2702 AddDialogData( check, &g_PrefsDlg.m_bQ3Map2Texturing, DLG_CHECK_BOOL );
2704 // Add the page to the notebook
2705 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2707 gtk_notebook_set_page(GTK_NOTEBOOK(notebook), PTAB_FRONT);
2712 // end new prefs dialog
2714 void PrefsDlg::LoadTexdefPref(texdef_t* pTexdef, char* pName)
2718 memset(pTexdef, 0, sizeof(texdef_t));
2720 sprintf(buffer, "%s%s", pName, TD_SCALE1_KEY);
2721 mLocalPrefs.GetPref(buffer, &pTexdef->scale[0], 0.5f);
2723 sprintf(buffer, "%s%s", pName, TD_SCALE2_KEY);
2724 mLocalPrefs.GetPref(buffer, &pTexdef->scale[1], 0.5f);
2726 sprintf(buffer, "%s%s", pName, TD_SHIFT1_KEY);
2727 mLocalPrefs.GetPref(buffer, &pTexdef->shift[0], 8.f);
2729 sprintf(buffer, "%s%s", pName, TD_SHIFT2_KEY);
2730 mLocalPrefs.GetPref(buffer, &pTexdef->shift[1], 8.f);
2732 sprintf(buffer, "%s%s", pName, TD_ROTATE_KEY);
2733 mLocalPrefs.GetPref(buffer, &pTexdef->rotate, 45);
2736 void PrefsDlg::UpdateTextureCompression()
2738 // if OpenGL is not ready yet, don't do anything
2739 if (!g_qeglobals.m_bOpenGLReady) {
2740 Sys_Printf("OpenGL not ready - postpone texture compression capability check\n");
2744 if (g_qeglobals.bTextureCompressionSupported)
2746 if (m_nTextureCompressionFormat >= 2 && !g_qeglobals.m_bS3CompressionSupported)
2748 Sys_Printf("Inconsistant pref setting for texture compression (%d), rolling back\n", m_nTextureCompressionFormat);
2749 m_nTextureCompressionFormat = 1; // if this is not supported either, see below
2751 if (m_nTextureCompressionFormat == 1 && !g_qeglobals.m_bOpenGLCompressionSupported)
2753 Sys_Printf("Inconsistant pref setting for texture compression (GL_COMPRESSED_RGBA), rolling back\n");
2754 m_nTextureCompressionFormat = 0;
2756 switch (m_nTextureCompressionFormat)
2760 g_qeglobals.texture_components = GL_RGBA;
2761 Sys_Printf("texture compression disabled by preferences settings\n");
2766 g_qeglobals.texture_components = GL_COMPRESSED_RGBA;
2767 Sys_Printf("OpenGL texture compression enabled\n");
2772 g_qeglobals.texture_components = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
2773 Sys_Printf("S3TC DXT1 texture compression enabled\n");
2778 g_qeglobals.texture_components = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
2779 Sys_Printf("S3TC DXT3 texture compression enabled\n");
2784 g_qeglobals.texture_components = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
2785 Sys_Printf("S3TC DXT5 texture compression enabled\n");
2792 Sys_Printf("texture compression is not supported by your current graphic card/drivers\n");
2793 g_qeglobals.texture_components = GL_RGBA;
2794 m_nTextureCompressionFormat = 0;
2799 void PrefsDlg::UpdateATIHack() {
2800 // if OpenGL is not ready yet, don't do anything
2801 if (!g_qeglobals.m_bOpenGLReady) {
2802 Sys_Printf("OpenGL not ready - postpone ATI bug workaround setup\n");
2807 qglCullFace = &qglCullFace_ATIHack;
2808 qglDisable = &qglDisable_ATIHack;
2809 qglEnable = &qglEnable_ATIHack;
2810 qglPolygonMode = &qglPolygonMode_ATIHack;
2811 Sys_Printf("ATI bug workaround enabled\n");
2813 qglCullFace = qglCullFace_real;
2814 qglDisable = qglDisable_real;
2815 qglEnable = qglEnable_real;
2816 qglPolygonMode = qglPolygonMode_real;
2817 Sys_Printf("ATI bug workaround disabled\n");
2822 // TTimo: m_strEnginePath has a special status, if not found in registry we need to
2823 // initiliaze it for sure. It is not totally failsafe but we can use the same
2824 // code than in q3map, expecting to find some "quake" above us. If not, we prompt
2825 // for the engine executable path
2826 void PrefsDlg::LoadPrefs ()
2830 // first things first, load prefs from global prefs
2831 mGamesDialog.LoadPrefs();
2833 // if we already have a document loaded, we will free and reload from file
2834 if (mLocalPrefs.InUse()) {
2835 mLocalPrefs.Clear();
2838 // load local.pref file
2839 mLocalPrefs.ReadXMLFile(m_inipath->str);
2841 mLocalPrefs.GetPref(PATCHSHOWBOUNDS_KEY, &g_bPatchShowBounds, FALSE);
2842 mLocalPrefs.GetPref(MOUSE_KEY, &m_nMouse, MOUSE_DEF);
2843 m_nMouseButtons = m_nMouse ? 3 : 2;
2846 // if it's not found here, mainframe.cpp will take care of finding one
2847 mLocalPrefs.GetPref(LASTPROJ_KEY, &m_strLastProject, "");
2848 mLocalPrefs.GetPref(LASTPROJVER_KEY, &m_nLastProjectVer, -1);
2851 // NOTE TTimo: I'm not sure why this is in prefs
2852 // should probably be a project setting
2853 // and I'm not sure that we really have a way to set this reliably either
2855 strPrefab = g_qeglobals.m_strHomeGame.GetBuffer();
2856 strPrefab += g_pGameDescription->mBaseGame.GetBuffer();
2857 strPrefab += "/prefabs/";
2858 mLocalPrefs.GetPref(PREFAB_KEY, &m_strPrefabPath, strPrefab);
2860 mLocalPrefs.GetPref(LASTLIGHTINTENSITY_KEY, &m_iLastLightIntensity, 300);
2861 mLocalPrefs.GetPref(TLOCK_KEY, &m_bTextureLock, TLOCK_DEF);
2862 mLocalPrefs.GetPref(RLOCK_KEY, &m_bRotateLock, TLOCK_DEF);
2863 mLocalPrefs.GetPref(LASTMAP_KEY, &m_strLastMap, "");
2864 mLocalPrefs.GetPref(LOADLAST_KEY, &m_bLoadLast, LOADLAST_DEF);
2865 mLocalPrefs.GetPref(BSP_KEY, &m_bInternalBSP, FALSE);
2866 mLocalPrefs.GetPref(RCLICK_KEY, &m_bRightClick, TRUE);
2867 mLocalPrefs.GetPref(AUTOSAVE_KEY, &m_bAutoSave, TRUE);
2868 mLocalPrefs.GetPref(LOADLASTMAP_KEY, &m_bLoadLastMap, FALSE);
2869 mLocalPrefs.GetPref(TINYBRUSH_KEY, &m_bCleanTiny, FALSE);
2870 mLocalPrefs.GetPref(TINYSIZE_KEY, &m_fTinySize, 0.5f);
2871 mLocalPrefs.GetPref(AUTOSAVETIME_KEY, &m_nAutoSave, 5);
2872 mLocalPrefs.GetPref(SNAPSHOT_KEY, &m_bSnapShots, FALSE);
2873 mLocalPrefs.GetPref(MOVESPEED_KEY, &m_nMoveSpeed, 100);
2874 mLocalPrefs.GetPref(ANGLESPEED_KEY, &m_nAngleSpeed, 3);
2875 mLocalPrefs.GetPref(SETGAME_KEY, &m_bSetGame, FALSE);
2876 mLocalPrefs.GetPref(CAMXYUPDATE_KEY, &m_bCamXYUpdate, TRUE);
2877 mLocalPrefs.GetPref(CAMDRAGMULTISELECT_KEY, &m_nCamDragMultiSelect, TRUE);
2878 mLocalPrefs.GetPref(CAMFREELOOK_KEY, &m_bCamFreeLook, TRUE);
2879 mLocalPrefs.GetPref(CAMINVERSEMOUSE_KEY, &m_bCamInverseMouse, FALSE);
2880 mLocalPrefs.GetPref(CAMDISCRETE_KEY, &m_bCamDiscrete, TRUE);
2881 mLocalPrefs.GetPref(LIGHTDRAW_KEY, &m_bNewLightDraw, TRUE);
2882 mLocalPrefs.GetPref(CUBICCLIP_KEY, &m_bCubicClipping, TRUE);
2883 mLocalPrefs.GetPref(CUBICSCALE_KEY, &m_nCubicScale, 13);
2884 mLocalPrefs.GetPref(ALTEDGE_KEY, &m_bALTEdge, FALSE);
2885 mLocalPrefs.GetPref(FACECOLORS_KEY, &m_bFaceColors, FALSE);
2886 mLocalPrefs.GetPref(XZVIS_KEY, &m_bXZVis, FALSE);
2887 mLocalPrefs.GetPref(YZVIS_KEY, &m_bYZVis, FALSE);
2888 mLocalPrefs.GetPref(ZVIS_KEY, &m_bZVis, FALSE);
2889 mLocalPrefs.GetPref(SIZEPAINT_KEY, &m_bSizePaint, FALSE);
2890 mLocalPrefs.GetPref(DLLENTITIES_KEY, &m_bDLLEntities, FALSE);
2892 mLocalPrefs.GetPref(DETACHABLEMENUS_KEY, &m_bLatchedDetachableMenus, TRUE);
2893 m_bDetachableMenus = m_bLatchedDetachableMenus;
2895 if (g_pGameDescription->mNoPatch)
2897 m_bPatchToolbar = false;
2901 mLocalPrefs.GetPref(PATCHTOOLBAR_KEY, &m_bLatchedPatchToolbar, TRUE);
2902 m_bPatchToolbar = m_bLatchedPatchToolbar;
2905 mLocalPrefs.GetPref(WIDETOOLBAR_KEY, &m_bLatchedWideToolbar, TRUE);
2906 m_bWideToolbar = m_bLatchedWideToolbar;
2908 mLocalPrefs.GetPref(PLUGINTOOLBAR_KEY, &m_bLatchedPluginToolbar, TRUE);
2909 m_bPluginToolbar = m_bLatchedPluginToolbar;
2911 mLocalPrefs.GetPref(WINDOW_KEY, (int*)&m_nLatchedView, WINDOW_DEF);
2912 m_nView = m_nLatchedView;
2914 mLocalPrefs.GetPref(FLOATINGZ_KEY, &m_bLatchedFloatingZ, FALSE);
2915 m_bFloatingZ = m_bLatchedFloatingZ;
2917 mLocalPrefs.GetPref(TEXTUREQUALITY_KEY, &m_nLatchedTextureQuality, 3);
2918 m_nTextureQuality = m_nLatchedTextureQuality;
2920 mLocalPrefs.GetPref(LOADSHADERS_KEY, &m_nLatchedShader, 0);
2921 m_nShader = m_nLatchedShader;
2923 mLocalPrefs.GetPref(NOCLAMP_KEY, &m_bNoClamp, FALSE);
2924 mLocalPrefs.GetPref(SNAP_KEY, &m_bSnap, TRUE);
2925 mLocalPrefs.GetPref(USERINI_KEY, &m_strUserPath, "");
2926 mLocalPrefs.GetPref(ROTATION_KEY, &m_nRotation, 45);
2927 mLocalPrefs.GetPref(CHASEMOUSE_KEY, &m_bChaseMouse, TRUE);
2928 mLocalPrefs.GetPref(ENTITYSHOW_KEY, &m_nEntityShowState, ENTITY_SKINNED_BOXED);
2930 // this will probably need to be 75 or 100 for Q1.
2931 mLocalPrefs.GetPref(TEXTURESCALE_KEY, &m_nTextureScale, 50);
2933 // FIXME: Hydra - actually, this stuff is Q1,Q2 and HL specific.
2934 if ( (g_pGameDescription->mGameFile == "hl.game") )
2936 // No BSP monitoring in the default compiler tools for Half-life (yet)
2937 mLocalPrefs.GetPref(WATCHBSP_KEY, &m_bWatchBSP, FALSE);
2939 // Texture subset on by default (HL specific really, because of halflife.wad's size)
2940 mLocalPrefs.GetPref(TEXTURE_KEY, &m_bTextureWindow, TRUE);
2942 else if (g_pGameDescription->quake2)
2944 // BSP monitoring is implemented in Quake2 and Heretic2 tools
2945 mLocalPrefs.GetPref(WATCHBSP_KEY, &m_bWatchBSP, TRUE);
2947 // Texture subset on by default (HL specific really, because of halflife.wad's size)
2948 mLocalPrefs.GetPref(TEXTURE_KEY, &m_bTextureWindow, TRUE);
2952 mLocalPrefs.GetPref(WATCHBSP_KEY, &m_bWatchBSP, WATCHBSP_DEF);
2953 mLocalPrefs.GetPref(TEXTURE_KEY, &m_bTextureWindow, FALSE);
2957 mLocalPrefs.GetPref(TEXTURESCROLLBAR_KEY, &m_bTextureScrollbar, TRUE);
2958 mLocalPrefs.GetPref(DISPLAYLISTS_KEY, &m_bDisplayLists, TRUE);
2959 mLocalPrefs.GetPref(ANTIALIASEDLINES_KEY, &m_bAntialiasedPointsAndLines, FALSE);
2960 mLocalPrefs.GetPref(SWITCHCLIP_KEY, &m_bSwitchClip, TRUE);
2961 mLocalPrefs.GetPref(SELWHOLEENTS_KEY, &m_bSelectWholeEntities, TRUE);
2962 mLocalPrefs.GetPref(SHOWSHADERS_KEY, &m_bShowShaders, TRUE);
2963 mLocalPrefs.GetPref(GLLIGHTING_KEY, &m_bGLLighting, FALSE);
2964 mLocalPrefs.GetPref(NOSTIPPLE_KEY, &m_bNoStipple, FALSE);
2965 mLocalPrefs.GetPref(UNDOLEVELS_KEY, &m_nUndoLevels, 30);
2966 mLocalPrefs.GetPref(VERTEXMODE_KEY, &m_bVertexSplit, TRUE);
2967 mLocalPrefs.GetPref(RUNQ2_KEY, &m_bRunQuake, RUNQ2_DEF);
2968 mLocalPrefs.GetPref(LEAKSTOP_KEY, &m_bLeakStop, TRUE);
2969 mLocalPrefs.GetPref(DOSLEEP_KEY, &m_bDoSleep, FALSE);
2970 mLocalPrefs.GetPref(SELECTCURVES_KEY, &m_bSelectCurves, TRUE);
2971 mLocalPrefs.GetPref(SELECTMODELS_KEY, &m_bSelectModels, TRUE);
2972 mLocalPrefs.GetPref(SHADERLISTONLY_KEY, &m_bTexturesShaderlistOnly, FALSE);
2973 mLocalPrefs.GetPref(SUBDIVISIONS_KEY, &m_nSubdivisions, SUBDIVISIONS_DEF);
2974 mLocalPrefs.GetPref(CLIPCAULK_KEY, &m_bClipCaulk, FALSE);
2975 mLocalPrefs.GetPref(SNAPTTOGRID_KEY, &m_bSnapTToGrid, FALSE);
2976 mLocalPrefs.GetPref(TARGETFIX_KEY, &m_bDoTargetFix, TRUE);
2977 mLocalPrefs.GetPref(WHEELINC_KEY, &m_nWheelInc, 64);
2978 mLocalPrefs.GetPref(PATCHBBOXSEL_KEY, &m_bPatchBBoxSelect, FALSE);
2980 // Gef: Kyro GL_POINT workaround
2981 mLocalPrefs.GetPref(GLPOINTWORKAROUND_KEY, &m_bGlPtWorkaround, FALSE);
2983 // window positioning
2984 mLocalPrefs.GetPref(ENTITYSPLIT1_KEY, &mWindowInfo.nEntitySplit1, -1);
2985 mLocalPrefs.GetPref(ENTITYSPLIT2_KEY, &mWindowInfo.nEntitySplit2, -1);
2987 mLocalPrefs.GetPref(POSITIONX_KEY, &mWindowInfo.position.x, -1);
2988 mLocalPrefs.GetPref(POSITIONY_KEY, &mWindowInfo.position.y, -1);
2989 mLocalPrefs.GetPref(WIDTH_KEY, &mWindowInfo.position.w, -1);
2990 mLocalPrefs.GetPref(HEIGHT_KEY, &mWindowInfo.position.h, 450);
2992 const window_position_t default_window_pos = { 0, 0, 200, 200, };
2994 mLocalPrefs.GetPref(ENTITYWND_KEY, &mWindowInfo.posEntityWnd, default_window_pos);
2995 mLocalPrefs.GetPref(MAPINFOWND_KEY, &mWindowInfo.posMapInfoWnd, default_window_pos);
2996 mLocalPrefs.GetPref(CAMWND_KEY, &mWindowInfo.posCamWnd, default_window_pos);
2997 mLocalPrefs.GetPref(ZWND_KEY, &mWindowInfo.posZWnd, default_window_pos);
2998 mLocalPrefs.GetPref(XYWND_KEY, &mWindowInfo.posXYWnd, default_window_pos);
2999 mLocalPrefs.GetPref(YZWND_KEY, &mWindowInfo.posYZWnd, default_window_pos);
3000 mLocalPrefs.GetPref(XZWND_KEY, &mWindowInfo.posXZWnd, default_window_pos);
3001 mLocalPrefs.GetPref(PATCHWND_KEY, &mWindowInfo.posPatchWnd, default_window_pos);
3002 mLocalPrefs.GetPref(SURFACEWND_KEY, &mWindowInfo.posSurfaceWnd, default_window_pos);
3003 mLocalPrefs.GetPref(ENTITYINFOWND_KEY, &mWindowInfo.posEntityInfoWnd, default_window_pos);
3005 mLocalPrefs.GetPref(ZWIDTH_KEY, &mWindowInfo.nZWidth, 30);
3006 mLocalPrefs.GetPref(XYHEIGHT_KEY, &mWindowInfo.nXYHeight, 300);
3007 mLocalPrefs.GetPref(XYWIDTH_KEY, &mWindowInfo.nXYWidth, 300);
3008 mLocalPrefs.GetPref(CAMWIDTH_KEY, &mWindowInfo.nCamWidth, 200);
3009 mLocalPrefs.GetPref(CAMHEIGHT_KEY, &mWindowInfo.nCamHeight, 200);
3010 mLocalPrefs.GetPref(ZFLOATWIDTH_KEY, &mWindowInfo.nZFloatWidth, 300);
3012 mLocalPrefs.GetPref(STATE_KEY, &mWindowInfo.nState, SW_SHOW);
3016 mLocalPrefs.GetPref(COUNT_KEY, &m_nMRUCount, 0);
3017 for(i = 0; i < 4; i++)
3020 sprintf (buf, "%s%d", FILE_KEY, i);
3021 mLocalPrefs.GetPref(buf, &m_strMRUFiles[i], "");
3024 // some platform specific prefs
3026 mLocalPrefs.GetPref(NATIVEGUI_KEY, &m_bNativeGUI, TRUE);
3027 mLocalPrefs.GetPref(STARTONPRIMMON_KEY, &m_bStartOnPrimMon, FALSE);
3030 mLocalPrefs.GetPref(SI_TEXMENU_KEY, &g_qeglobals.d_savedinfo.iTexMenu, ID_VIEW_BILINEARMIPMAP);
3031 mLocalPrefs.GetPref(SI_GAMMA_KEY, &g_qeglobals.d_savedinfo.fGamma, 1.0f);
3032 mLocalPrefs.GetPref(SI_EXCLUDE_KEY, &g_qeglobals.d_savedinfo.exclude, 0); // nothing filtered by default
3033 mLocalPrefs.GetPref(SI_INCLUDE_KEY, &g_qeglobals.d_savedinfo.include, INCLUDE_NAMES | INCLUDE_COORDS | INCLUDE_ANGLES | INCLUDE_CAMERATINT);
3034 mLocalPrefs.GetPref(SI_SHOWNAMES_KEY, &g_qeglobals.d_savedinfo.show_names, FALSE);
3035 mLocalPrefs.GetPref(SI_SHOWCOORDS_KEY, &g_qeglobals.d_savedinfo.show_coordinates, TRUE);
3036 mLocalPrefs.GetPref(SI_SHOWANGLES_KEY, &g_qeglobals.d_savedinfo.show_angles, TRUE);
3037 mLocalPrefs.GetPref(SI_SHOWOUTLINES_KEY, &g_qeglobals.d_savedinfo.show_outline, FALSE);
3038 mLocalPrefs.GetPref(SI_SHOWAXIS_KEY, &g_qeglobals.d_savedinfo.show_axis, TRUE);
3039 mLocalPrefs.GetPref(SI_NOSELOUTLINES_KEY, &g_qeglobals.d_savedinfo.bNoSelectedOutlines, FALSE);
3041 mLocalPrefs.GetPref(SI_OUTLINESTYLE_KEY, &g_qeglobals.d_savedinfo.iSelectedOutlinesStyle, OUTLINE_ZBUF|OUTLINE_BSEL);
3043 LoadTexdefPref(&g_qeglobals.d_savedinfo.m_SIIncrement, SI_SURFACE_TEXDEF_KEY);
3044 LoadTexdefPref(&g_qeglobals.d_savedinfo.m_PIIncrement, SI_PATCH_TEXDEF_KEY);
3046 // text editor binding
3048 mLocalPrefs.GetPref(CUSTOMSHADEREDITOR_KEY, &m_bUseWin32Editor, TRUE);
3050 mLocalPrefs.GetPref(CUSTOMSHADEREDITOR_KEY, &m_bUseCustomEditor, FALSE);
3051 mLocalPrefs.GetPref(CUSTOMSHADEREDITORCOMMAND_KEY, &m_strEditorCommand, "");
3055 vec3_t vDefaultAxisColours[3] = {
3061 for(i = 0; i < 3; i++) {
3063 sprintf(buf, "%s%d", SI_AXISCOLORS_KEY, i);
3064 mLocalPrefs.GetPref(buf, g_qeglobals.d_savedinfo.AxisColors[i], vDefaultAxisColours[i]);
3067 vec3_t vDefaultColours[COLOR_LAST] = {
3068 {0.25f, 0.25f, 0.25f},
3070 {0.75f, 0.75f, 0.75f},
3072 {0.25f, 0.25f, 0.25f},
3085 for(i = 0; i < COLOR_LAST; i++) {
3087 sprintf(buf, "%s%d", SI_COLORS_KEY, i);
3088 mLocalPrefs.GetPref(buf, g_qeglobals.d_savedinfo.colors[i], vDefaultColours[i]);
3091 mLocalPrefs.GetPref(TEXTURECOMPRESSIONFORMAT_KEY, &m_nTextureCompressionFormat, 1);
3093 mLocalPrefs.GetPref(LIGHTRADIUS_KEY, &m_nLightRadiuses, TRUE);
3095 mLocalPrefs.GetPref(Q3MAP2TEX_KEY, &m_bQ3Map2Texturing, TRUE);
3098 mLocalPrefs.GetPref(ATIHACK_KEY, &m_bGlATIHack, FALSE);
3101 Undo_SetMaxSize(m_nUndoLevels); // set it internally as well / FIXME: why not just have one global value?
3103 UpdateTextureCompression();
3109 if (mLocalPrefs.mbEmpty)
3111 mLocalPrefs.mbEmpty = false;
3112 Sys_Printf("Saving local.pref with default pref values\n");
3117 void PrefsDlg::SavePrefs ()
3119 if (g_qeglobals.disable_ini)
3123 Sys_Printf("PrefsDlg::SavePrefs\n");
3126 // this will take care of copying back from the dialog to the variables
3127 // NOTE: it may be overkill to call systematically before a SavePrefs, but it's safer
3128 // this will also cause an UpdateData for the mGamesDialog
3131 mGamesDialog.SavePrefs();
3133 // update the tree and save it
3134 mLocalPrefs.UpdatePrefTree();
3135 if (!mLocalPrefs.WriteXMLFile(m_inipath->str))
3136 Sys_FPrintf(SYS_ERR, "Error occured while saving local prefs file '%s'\n", m_inipath->str);
3138 if ( m_nMouse == 0 ) {
3139 m_nMouseButtons = 2;
3141 m_nMouseButtons = 3;
3146 void PrefsDlg::PostModal (int code)
3151 // make sure the logfile is ok
3157 g_pParentWnd->SetGridStatus();
3158 Sys_UpdateWindows(W_ALL);
3159 if (m_nUndoLevels != 0)
3160 Undo_SetMaxSize(m_nUndoLevels);
3164 void PrefsDlg::DoEditorSensitivity()
3166 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(g_object_get_data (G_OBJECT(m_pWidget), "check_customeditor"))))
3168 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "label_customeditor")), TRUE);
3169 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "entry_customeditor")), TRUE);
3170 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "button_customeditor")), TRUE);
3174 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "label_customeditor")), FALSE);
3175 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "entry_customeditor")), FALSE);
3176 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "button_customeditor")), FALSE);
3180 void PrefsDlg::DoSensitivity()
3183 // first, look at the project file version ... will monitoring work?
3184 // project files now XML, guaranteed to be at least version 2
3185 if (0)//IntForKey( g_qeglobals.d_project_entity, "version" ) < 2)
3190 Msg = "The current project file (";
3191 Msg += g_PrefsDlg.m_strLastProject;
3192 Msg += ") is not at least version 2.\nI need version 2 or above to setup BSP monitoring correctly.";
3193 gtk_MessageBox(m_pWidget, Msg.GetBuffer(), MB_OK );
3198 // go ahead, disable everybuddy
3199 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_leakstop" )), FALSE );
3200 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_monitorbsp" )), FALSE );
3201 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_runengine" )), FALSE );
3202 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_sleep" )), FALSE );
3209 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_leakstop" )), TRUE );
3210 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_monitorbsp" )), TRUE );
3211 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_runengine" )), TRUE );
3212 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_sleep" )), TRUE );
3214 if ( ! gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( g_object_get_data( G_OBJECT(m_pWidget), "check_monitorbsp" ) ) ) )
3216 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_leakstop" )), FALSE );
3217 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_runengine" )), FALSE );
3218 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_sleep" )), FALSE );
3219 } else if (! gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( g_object_get_data( G_OBJECT(m_pWidget), "check_runengine" ) ) ) )
3221 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_sleep" )), FALSE );
3226 ============================================================
3228 ============================================================
3231 CGameInstall::CGameInstall() {
3232 memset( m_availGames, 0, sizeof( m_availGames ) );
3235 void CGameInstall::OnBtnBrowseEngine( GtkWidget *widget, gpointer data ) {
3236 Sys_Printf( "OnBtnBrowseEngine\n" );
3238 CGameInstall* i = static_cast<CGameInstall*>( data );
3239 char *dir = dir_dialog( i->m_pWidget, _("Select game directory"), NULL );
3241 i->UpdateData( TRUE );
3243 if ( dir != NULL ) {
3244 i->m_strEngine = dir;
3245 i->UpdateData( FALSE );
3250 void CGameInstall::OnGameSelectChanged( GtkWidget *widget, gpointer data ) {
3251 Sys_Printf( "OnGameSelectChanged\n" );
3253 CGameInstall* i = static_cast<CGameInstall*>( data );
3254 i->UpdateData( TRUE );
3255 i->m_strName = gtk_combo_box_get_active_text( GTK_COMBO_BOX( widget ) );
3256 i->UpdateData( FALSE );
3259 void CGameInstall::BuildDialog() {
3260 GtkWidget *dlg, *vbox1, *button, *text, *combo, *entry, *hbox;
3263 gtk_window_set_title( GTK_WINDOW( dlg ), _("Configure games") );
3265 vbox1 = gtk_vbox_new( FALSE, 0 );
3266 gtk_widget_show( vbox1 );
3267 gtk_container_add( GTK_CONTAINER( dlg ), vbox1 );
3269 text = gtk_label_new( _("Select the game to configure") );
3270 gtk_widget_show( text );
3271 gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 );
3273 combo = gtk_combo_box_new_text();
3274 gtk_widget_show( combo );
3275 gtk_box_pack_start( GTK_BOX( vbox1 ), combo, FALSE, FALSE, 0 );
3277 // GList *combo_list = NULL;
3279 while ( m_availGames[ iGame ] != GAME_NONE ) {
3280 switch ( m_availGames[ iGame ] ) {
3282 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Quake II") );
3285 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Quake III Arena and mods") );
3288 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Urban Terror (standalone)") );
3291 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("UFO: Alien Invasion") );
3294 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Quake2World") );
3297 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Warsow") );
3300 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Nexuiz") );
3302 case GAME_TREMULOUS:
3303 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Tremulous") );
3306 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Jedi Academy and mods") );
3311 AddDialogData( combo, &m_nComboSelect, DLG_COMBO_BOX_INT );
3312 gtk_signal_connect( GTK_OBJECT( combo ), "changed", G_CALLBACK( OnGameSelectChanged ), this );
3313 gtk_combo_box_set_active( GTK_COMBO_BOX( combo ), 0 ); // NOTE: will trigger signal
3315 text = gtk_label_new( _("Name:") );
3316 gtk_widget_show( text );
3317 gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 );
3319 entry = gtk_entry_new();
3320 gtk_widget_show( entry );
3321 gtk_box_pack_start( GTK_BOX( vbox1 ), entry, FALSE, FALSE, 0 );
3322 AddDialogData( entry, &m_strName, DLG_ENTRY_TEXT );
3324 text = gtk_label_new( _("Engine directory:") );
3325 gtk_widget_show( text );
3326 gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 );
3328 hbox = gtk_hbox_new( FALSE, 0 );
3329 gtk_widget_show( hbox );
3330 gtk_box_pack_start( GTK_BOX( vbox1 ), hbox, FALSE, FALSE, 0 );
3332 entry = gtk_entry_new();
3333 gtk_widget_show( entry );
3334 gtk_box_pack_start( GTK_BOX( hbox ), entry, FALSE, FALSE, 0 );
3335 AddDialogData( entry, &m_strEngine, DLG_ENTRY_TEXT );
3337 button = gtk_button_new_with_label (_("..."));
3338 gtk_widget_show( button );
3339 gtk_signal_connect( GTK_OBJECT( button ), "clicked", GTK_SIGNAL_FUNC( OnBtnBrowseEngine ), this );
3340 gtk_box_pack_start( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
3342 // this gets done in the project stuff atm
3344 text = gtk_label_new( _("Mod subdirectory:") );
3345 gtk_widget_show( text );
3346 gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 );
3348 entry = gtk_entry_new();
3349 gtk_widget_show( entry );
3350 gtk_box_pack_start( GTK_BOX( vbox1 ), entry, FALSE, FALSE, 0 );
3351 AddDialogData( entry, &m_strMod, DLG_ENTRY_TEXT );
3354 button = gtk_button_new_with_label( _("OK") );
3355 gtk_widget_show( button );
3356 gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 );
3357 AddModalButton( button, IDOK );
3359 button = gtk_button_new_with_label( _("Cancel") );
3360 gtk_widget_show( button );
3361 gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 );
3362 AddModalButton( button, IDCANCEL );
3364 gtk_widget_set_usize( button, 60, -2 );
3367 void CGameInstall::Run() {
3369 if ( m_availGames[0] == GAME_NONE ) {
3372 if ( DoModal() == IDCANCEL ) {
3373 Sys_Printf( "game dialog cancelled\n" );
3376 Sys_Printf( "combo: %d name: %s engine: %s mod: %s\n", m_nComboSelect, m_strName.GetBuffer(), m_strEngine.GetBuffer(), m_strMod.GetBuffer() );
3378 // write out the game file
3379 Str gameFilePath = g_strAppPath.GetBuffer();
3380 gameFilePath += "games/";
3381 gameFilePath += m_strName.GetBuffer();
3382 gameFilePath += ".game";
3383 Sys_Printf( "game file: %s\n", gameFilePath.GetBuffer() );
3385 FILE * fg = fopen( gameFilePath.GetBuffer(), "w" );
3387 Error( "Failed to open %s for writing\n", gameFilePath.GetBuffer() );
3389 fprintf( fg, "<?xml version=\"1.0\" encoding=\"iso-8859-1\" standalone=\"yes\"?>\n<game\n" );
3390 fprintf( fg, " name=\"%s\"\n", m_strName.GetBuffer() );
3391 fprintf( fg, " "ENGINEPATH_ATTRIBUTE"=\"%s\"\n", m_strEngine.GetBuffer() );
3392 switch ( m_availGames[ m_nComboSelect ] ) {
3394 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/Quake2Pack/game\"\n", g_strAppPath.GetBuffer() );
3395 fprintf( fg, " prefix=\".quake2\"\n" );
3396 Str source = g_strAppPath.GetBuffer();
3397 source += "installs/";
3399 source += "/install/";
3400 Str dest = m_strEngine.GetBuffer();
3401 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3402 fprintf( fg, " basegame=\"baseq2\"\n" );
3406 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/Q3Pack/game\"\n", g_strAppPath.GetBuffer() );
3407 fprintf( fg, " prefix=\".q3a\"\n" );
3408 Str source = g_strAppPath.GetBuffer();
3409 source += "installs/";
3411 source += "/install/";
3412 Str dest = m_strEngine.GetBuffer();
3413 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3414 fprintf( fg, " basegame=\"baseq3\"\n" );
3418 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/UrTPack/game\"\n", g_strAppPath.GetBuffer() );
3419 fprintf( fg, " prefix=\".q3a\"\n" );
3420 Str source = g_strAppPath.GetBuffer();
3421 source += "installs/";
3423 source += "/install/";
3424 Str dest = m_strEngine.GetBuffer();
3425 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3426 fprintf( fg, " basegame=\"q3ut4\"\n" );
3430 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/UFOAIPack/game\"\n", g_strAppPath.GetBuffer() );
3431 fprintf( fg, " prefix=\".ufoai\"\n" );
3432 Str source = g_strAppPath.GetBuffer();
3433 source += "installs/";
3434 source += UFOAI_PACK;
3435 source += "/install/";
3436 Str dest = m_strEngine.GetBuffer();
3437 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3438 fprintf( fg, " basegame=\"base\"\n" );
3442 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/Q2WPack/game\"\n", g_strAppPath.GetBuffer() );
3443 fprintf( fg, " prefix=\".quake2world\"\n" );
3444 Str source = g_strAppPath.GetBuffer();
3445 source += "installs/";
3447 source += "/install/";
3448 Str dest = m_strEngine.GetBuffer();
3449 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3450 fprintf( fg, " basegame=\"default\"\n" );
3454 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/WarsowPack/game\"\n", g_strAppPath.GetBuffer() );
3455 fprintf( fg, " prefix=\".warsow\"\n" );
3456 Str source = g_strAppPath.GetBuffer();
3457 source += "installs/";
3458 source += WARSOW_PACK;
3459 source += "/install/";
3460 Str dest = m_strEngine.GetBuffer();
3461 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3462 fprintf( fg, " basegame=\"basewsw\"\n" );
3466 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/NexuizPack/game\"\n", g_strAppPath.GetBuffer() );
3467 fprintf( fg, " prefix=\".nexuiz\"\n" );
3468 Str source = g_strAppPath.GetBuffer();
3469 source += "installs/";
3470 source += NEXUIZ_PACK;
3471 source += "/install/";
3472 Str dest = m_strEngine.GetBuffer();
3473 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3474 fprintf( fg, " basegame=\"data\"\n" );
3477 case GAME_TREMULOUS: {
3478 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/TremulousPack/game\"\n", g_strAppPath.GetBuffer() );
3479 fprintf( fg, " prefix=\".tremulous\"\n" );
3480 Str source = g_strAppPath.GetBuffer();
3481 source += "installs/";
3482 source += TREMULOUS_PACK;
3483 source += "/install/";
3484 Str dest = m_strEngine.GetBuffer();
3485 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3486 fprintf( fg, " basegame=\"base\"\n" );
3490 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/JAPack/game\"\n", g_strAppPath.GetBuffer() );
3491 fprintf( fg, " prefix=\".ja\"\n" );
3492 Str source = g_strAppPath.GetBuffer();
3493 source += "installs/";
3495 source += "/install/";
3496 Str dest = m_strEngine.GetBuffer();
3497 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3498 fprintf( fg, " basegame=\"base\"\n" );
3502 fprintf( fg, "/>\n" );
3508 CGameInstall::ScanGames
3509 scan for active games that can be installed, based on the presence
3512 void CGameInstall::ScanGames() {
3513 Str pakPaths = g_strAppPath.GetBuffer();
3515 const char *dirname;
3517 pakPaths += "installs/";
3518 FindFiles fileScan( pakPaths.GetBuffer() );
3519 while ( ( dirname = fileScan.NextFile() ) != NULL ) {
3520 if ( stricmp( dirname, Q3_PACK ) == 0 ) {
3521 m_availGames[ iGame++ ] = GAME_Q3;
3523 if ( stricmp( dirname, URT_PACK ) == 0 ) {
3524 m_availGames[ iGame++ ] = GAME_URT;
3526 if ( stricmp( dirname, UFOAI_PACK ) == 0 ) {
3527 m_availGames[ iGame++ ] = GAME_UFOAI;
3529 if ( stricmp( dirname, Q2W_PACK ) == 0 ) {
3530 m_availGames[ iGame++ ] = GAME_Q2W;
3532 if ( stricmp( dirname, WARSOW_PACK ) == 0 ) {
3533 m_availGames[ iGame++ ] = GAME_WARSOW;
3535 if ( stricmp( dirname, NEXUIZ_PACK ) == 0 ) {
3536 m_availGames[ iGame++ ] = GAME_NEXUIZ;
3538 if ( stricmp( dirname, Q2_PACK ) == 0 ) {
3539 m_availGames[ iGame++ ] = GAME_Q2;
3541 if ( stricmp( dirname, TREMULOUS_PACK ) == 0 ) {
3542 m_availGames[ iGame++ ] = GAME_TREMULOUS;
3544 if ( stricmp( dirname, JA_PACK ) == 0 ) {
3545 m_availGames[ iGame++ ] = GAME_JA;
3548 Sys_Printf("No installable games found in: %s\n",
3549 pakPaths.GetBuffer() );