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>
52 #define PREF_SECTION "Prefs"
53 #define INTERNAL_SECTION "Internals"
54 #define MOUSE_KEY "MouseButtons"
55 #define WINDOW_KEY "QE4StyleWindows"
56 #define LAYOUT_KEY "WindowLayout"
57 #define RUNQ2_KEY "RunQuake2Run"
58 #define TLOCK_KEY "TextureLock"
59 #define RLOCK_KEY "RotateLock"
60 #define LOADLAST_KEY "LoadLast"
61 #define LOADLASTMAP_KEY "LoadLastMap"
62 #define LASTPROJ_KEY "LastProject"
63 #define LASTPROJVER_KEY "LastProjectKey"
64 #define LASTMAP_KEY "LastMap"
65 #define FACE_KEY "NewFaceGrab"
66 #define BSP_KEY "InternalBSP"
67 #define RCLICK_KEY "NewRightClick"
68 #define VERTEX_KEY "NewVertex"
69 #define AUTOSAVE_KEY "Autosave"
70 #define AUTOSAVETIME_KEY "AutosaveMinutes"
71 #define PAK_KEY "UsePAK"
72 #define NEWAPPLY_KEY "ApplyDismissesSurface"
73 #define HACK_KEY "Gatewayescapehack"
74 #define TEXTURE_KEY "NewTextureWindowStuff"
75 #define TINYBRUSH_KEY "CleanTinyBrushes"
76 #define TINYSIZE_KEY "CleanTinyBrusheSize"
77 #define SNAPSHOT_KEY "Snapshots"
78 #define MOVESPEED_KEY "MoveSpeed"
79 #define ANGLESPEED_KEY "AngleSpeed"
80 #define SETGAME_KEY "UseSetGame"
81 #define CAMXYUPDATE_KEY "CamXYUpdate"
82 #define CAMDRAGMULTISELECT_KEY "CamDragMultiSelect"
83 #define CAMFREELOOK_KEY "CamFreeLook"
84 #define CAMINVERSEMOUSE_KEY "CamInverseMouse"
85 #define CAMDISCRETE_KEY "CamDiscrete"
86 #define LIGHTDRAW_KEY "NewLightStyle"
87 #define WHATGAME_KEY "WhichGame"
88 #define CUBICCLIP_KEY "CubicClipping"
89 #define CUBICSCALE_KEY "CubicScale"
90 #define ALTEDGE_KEY "ALTEdgeDrag"
91 #define FACECOLORS_KEY "FaceColors"
92 #define SNAPT_KEY "SnapT"
93 #define XZVIS_KEY "XZVIS"
94 #define YZVIS_KEY "YZVIS"
95 #define ZVIS_KEY "ZVIS"
96 #define SIZEPAINT_KEY "SizePainting"
97 #define DLLENTITIES_KEY "DLLEntities"
98 #define DETACHABLEMENUS_KEY "DetachableMenus"
99 #define PATCHTOOLBAR_KEY "PatchToolBar"
100 #define WIDETOOLBAR_KEY "WideToolBar"
101 #define PLUGINTOOLBAR_KEY "PluginToolBar"
102 #define NOCLAMP_KEY "NoClamp"
103 #define SNAP_KEY "Snap"
104 #define PREFAB_KEY "PrefabPath"
105 #define USERINI_KEY "UserINIPath"
106 #define ROTATION_KEY "Rotation"
107 #define BUGGYICD_KEY "BuggyICD"
108 #define CHASEMOUSE_KEY "ChaseMouse"
109 #define ENTITYSHOW_KEY "EntityShow"
110 #define TEXTURESCALE_KEY "TextureScale"
111 #define TEXTURESCROLLBAR_KEY "TextureScrollbar"
112 #define DISPLAYLISTS_KEY "UseDisplayLists"
113 #define ANTIALIASEDLINES_KEY "UseAntialiasedPointsAndLines" // Fishman - Add antialiazed points and lines support. 09/03/00
114 #define NORMALIZECOLORS_KEY "NormalizeColors"
115 #define SHADERS_KEY "UseShaders"
116 #define SWITCHCLIP_KEY "SwitchClipKey"
117 #define SELWHOLEENTS_KEY "SelectWholeEntitiesKey"
118 #define TEXTURESUBSET_KEY "UseTextureSubsetLoading"
119 #define TEXTUREQUALITY_KEY "TextureQuality"
120 #define SHOWSHADERS_KEY "ShowShaders"
121 #define SHADERTEST_KEY "ShaderTest"
122 #define GLLIGHTING_KEY "UseGLLighting"
123 #define LOADSHADERS_KEY "LoadShaders"
124 #define NOSTIPPLE_KEY "NoStipple"
125 #define UNDOLEVELS_KEY "UndoLevels"
126 #define VERTEXMODE_KEY "VertexSplit"
127 #define ENGINEPATH_KEY "EnginePath"
128 #define ENGINE_KEY "Engine"
129 #define LOGCONSOLE_KEY "LogConsole"
130 #define SELECTCURVES_KEY "SelectCurves"
131 #define SELECTMODELS_KEY "SelectModels"
132 #define SHADERLISTONLY_KEY "ShowShaderlistOnly"
133 #define WATCHBSP_KEY "WatchBSP"
134 #define LEAKSTOP_KEY "LeakStop"
135 #define DOSLEEP_KEY "SleepMode"
136 #define SUBDIVISIONS_KEY "Subdivisions"
137 #define CLIPCAULK_KEY "ClipCaulk"
138 #define PATCHSHOWBOUNDS_KEY "PatchShowBounds"
139 #define NATIVEGUI_KEY "NativeGUI"
140 #define STARTONPRIMMON_KEY "StartOnPrimMon"
141 #define NOSYSMENUPOPUPS_KEY "NoSysMenuPopups"
142 #define SNAPTTOGRID_KEY "SnapTToGrid"
143 #define FLOATINGZ_KEY "FloatingZ"
144 #define TARGETFIX_KEY "TargetFix"
145 #define GLPOINTWORKAROUND_KEY "GlPointWorkaround" // Gef: Workaround for broken Kyro * gl driver 25-aug-2001
146 #define WHEELINC_KEY "WheelMouseInc"
147 #define PATCHBBOXSEL_KEY "PatchBBoxSel"
148 #define LASTLIGHTINTENSITY_KEY "LastLightIntensity"
149 #define CUSTOMSHADEREDITOR_KEY "UseCustomShaderEditor"
150 #define CUSTOMSHADEREDITORCOMMAND_KEY "CustomShaderEditorCommand"
151 #define TEXTURECOMPRESSIONFORMAT_KEY "TextureCompressionFormat"
152 #define LIGHTRADIUS_KEY "LightRadiuses"
153 #define Q3MAP2TEX_KEY "Q3Map2Tex"
154 #define ATIHACK_KEY "ATIHack"
157 #define ENTITYSPLIT1_KEY "EntitySplit1"
158 #define ENTITYSPLIT2_KEY "EntitySplit2"
159 #define POSITIONX_KEY "PositionX"
160 #define POSITIONY_KEY "PositionY"
161 #define ENTITYWND_KEY "EntityWnd"
162 #define MAPINFOWND_KEY "MapInfoDlg"
163 #define CAMWND_KEY "CamWnd"
164 #define ZWND_KEY "ZWnd"
165 #define XYWND_KEY "XYWnd"
166 #define XZWND_KEY "XZWnd"
167 #define YZWND_KEY "YZWnd"
168 #define PATCHWND_KEY "PatchWnd"
169 #define SURFACEWND_KEY "SurfaceWnd"
170 #define ENTITYINFOWND_KEY "EntityInfoDlg"
171 #define WIDTH_KEY "Width"
172 #define HEIGHT_KEY "Height"
173 #define ZWIDTH_KEY "ZWidth"
174 #define XYHEIGHT_KEY "XYHeight"
175 #define XYWIDTH_KEY "XYWidth"
176 #define CAMWIDTH_KEY "CamWidth"
177 #define CAMHEIGHT_KEY "CamHeight"
178 #define ZFLOATWIDTH_KEY "ZWidthFloating"
179 #define STATE_KEY "State"
182 #define COUNT_KEY "Count"
183 #define FILE_KEY "File"
186 #define SI_TEXMENU_KEY "SI_TexMenu"
187 #define SI_GAMMA_KEY "SI_Gamma"
188 #define SI_COLORS_KEY "SI_Colors"
189 #define SI_EXCLUDE_KEY "SI_Exclude"
190 #define SI_INCLUDE_KEY "SI_Include"
191 #define SI_SURFACE_TEXDEF_KEY "SI_SurfaceTexdef"
192 #define SI_PATCH_TEXDEF_KEY "SI_PatchTexdef"
193 #define SI_AXISCOLORS_KEY "SI_AxisColors"
194 #define SI_SHOWNAMES_KEY "SI_ShowNames"
195 #define SI_SHOWCOORDS_KEY "SI_ShowCoords"
196 #define SI_SHOWANGLES_KEY "SI_ShowAngles"
197 #define SI_SHOWOUTLINES_KEY "SI_ShowOutlines"
198 #define SI_SHOWAXIS_KEY "SI_ShowAxis"
199 #define SI_NOSELOUTLINES_KEY "SI_NoSelectedOutlines"
200 #define SI_OUTLINESTYLE_KEY "SI_OutLineStyle"
203 #define TD_SCALE1_KEY "_Scale1"
204 #define TD_SCALE2_KEY "_Scale2"
205 #define TD_SHIFT1_KEY "_Shift1"
206 #define TD_SHIFT2_KEY "_Shift2"
207 #define TD_ROTATE_KEY "_Rotate"
212 #define WATCHBSP_DEF 1
214 #define LOADLAST_DEF 1
216 #define SUBDIVISIONS_DEF 4
218 void WindowPosition_Parse(window_position_t& m_value, const CString& value)
220 if(sscanf(value.GetBuffer(), "%d %d %d %d", &m_value.x, &m_value.y, &m_value.w, &m_value.h) != 4)
221 m_value.x = m_value.y = m_value.w = m_value.h = -1;
224 void WindowPosition_Write(const window_position_t& m_value, CString& value)
227 sprintf(buffer, "%d %d %d %d", m_value.x, m_value.y, m_value.w, m_value.h);
232 CXMLPropertyBag::CXMLPropertyBag() {
238 // generic preference functions
240 void CXMLPropertyBag::PushAssignment(const char *name, PrefTypes_t type, void *pV)
242 list<CPrefAssignment>::iterator iAssign;
243 for(iAssign=mPrefAssignments.begin(); iAssign!=mPrefAssignments.end(); iAssign++)
245 if ((*iAssign).mName == name)
247 // we have it already, check anyway
248 if (pV != (*iAssign).mVal)
250 Sys_FPrintf(SYS_ERR, "PushAssignment, '%s' has different mVal\n", name);
255 // ok, it's not in our list yet
256 mPrefAssignments.push_front(CPrefAssignment(name, type, pV));
259 xmlNodePtr CXMLPropertyBag::EpairForName(const char *name)
261 xmlNodePtr ret = NULL;
263 xmlNodePtr pNode = mpDocNode->children;
264 while (pNode != NULL)
266 if(pNode->type == XML_ELEMENT_NODE)
268 xmlAttrPtr tmp_attr_ptr = xmlHasProp(pNode, (xmlChar *)"name");
269 if (tmp_attr_ptr != NULL && !strcmp(name, (char *)tmp_attr_ptr->children->content))
272 Sys_FPrintf( SYS_WRN, "WARNING: dupe property in CXMLPropertyBag::EpairForName '%s'\n", name );
283 void CXMLPropertyBag::GetPref(const char *name, Str *pV, const char *V)
285 xmlNodePtr pNode = EpairForName( name );
288 if ( pNode->children && pNode->children->content ) {
289 *pV = pNode->children->content;
291 // means the pref exists, and that the value is ""
297 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)V);
298 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
300 // push the pref assignment if needed
301 PushAssignment(name, PREF_STR, pV);
304 void CXMLPropertyBag::GetPref(const char *name, int *pV, int V)
307 if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
309 *pV = atoi((char *)pNode->children->content);
315 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s);
316 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
319 // push the pref assignment if needed
320 PushAssignment(name, PREF_INT, pV);
323 void CXMLPropertyBag::GetPref(const char *name, bool *pV, bool V)
326 if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
328 if (!strcmp((char *)pNode->children->content, "true"))
340 V ? strcpy(s, "true") : strcpy(s, "false");
341 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s);
342 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
345 // push the pref assignment
346 PushAssignment(name, PREF_BOOL, pV);
349 void CXMLPropertyBag::GetPref(const char *name, float *pV, float V)
352 if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
354 *pV = atof((char *)pNode->children->content);
360 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s);
361 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
364 // push the pref assignment if needed
365 PushAssignment(name, PREF_FLOAT, pV);
368 void CXMLPropertyBag::GetPref(const char *name, float* pV, float* V)
371 if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
373 sscanf((char *)pNode->children->content, "%f %f %f", &pV[0], &pV[1], &pV[2]);
378 sprintf(s, "%f %f %f", V[0], V[1], V[2]);
379 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s);
380 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
385 // push the pref assignment if needed
386 PushAssignment(name, PREF_VEC3, pV);
389 void CXMLPropertyBag::GetPref(const char *name, window_position_t* pV, window_position_t V)
392 if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
394 WindowPosition_Parse(*pV, CString((xmlChar *)pNode->children->content));
399 WindowPosition_Write(V, str);
400 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)str.GetBuffer());
401 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
404 // push the pref assignment if needed
405 PushAssignment(name, PREF_WNDPOS, pV);
408 void CXMLPropertyBag::UpdatePrefTree()
410 // read the assignments and update the tree
411 list<CPrefAssignment>::iterator iPref;
412 for(iPref = mPrefAssignments.begin(); iPref != mPrefAssignments.end(); iPref++)
414 CPrefAssignment *pPref = &(*iPref);
419 pNode = EpairForName(pPref->mName.GetBuffer());
420 // we never expect that the node could not be found, because this is supposed to happen
421 // after the tree was built with GetPref calls, never on a blank tree
424 Sys_FPrintf(SYS_ERR, "Unexpected EpairForName '%s' not found in UpdatePrefTree\n", pPref->mName.GetBuffer());
427 switch ((*iPref).mType)
430 xmlNodeSetContent(pNode, (const xmlChar *)((Str *)pPref->mVal)->GetBuffer());
433 sprintf(s, "%d", *(int *)pPref->mVal);
434 xmlNodeSetContent(pNode, (xmlChar *)s);
437 sprintf(s, "%f", *(float *)pPref->mVal);
438 xmlNodeSetContent(pNode, (xmlChar *)s);
441 *(bool *)pPref->mVal ? strcpy(s, "true") : strcpy(s, "false");
442 xmlNodeSetContent(pNode, (xmlChar *)s);
446 float* v = (float*)pPref->mVal;
447 sprintf(s, "%f %f %f", v[0], v[1], v[2]);
448 xmlNodeSetContent(pNode, (xmlChar *)s);
454 WindowPosition_Write(*(window_position_t*)pPref->mVal, str);
455 xmlNodeSetContent(pNode, (xmlChar*)str.GetBuffer());
462 void CXMLPropertyBag::Clear()
473 void CXMLPropertyBag::ReadXMLFile(const char* pFilename)
475 mpDoc = xmlParseFile(pFilename);
480 mpDocNode = mpDoc->children;
481 xmlAttrPtr tmp_attr_ptr = xmlHasProp(mpDocNode, (xmlChar *)"version");
482 if (strcmp((char *)mpDocNode->name, "qpref"))
484 Sys_FPrintf(SYS_ERR, "Unrecognized node '%s' in '%s'\n", mpDocNode->name, mpDoc->URL);
488 else if (tmp_attr_ptr != NULL && strcmp((char*)tmp_attr_ptr->children->content, "1"))
490 Sys_FPrintf(SYS_ERR, "Wrong version '%s' in <qpref> node for '%s'\n", (char*)tmp_attr_ptr->children->content, mpDoc->URL);
494 Sys_Printf("Opened XML property file: '%s'\n", pFilename);
500 // no document, create one
501 mpDoc = xmlNewDoc((xmlChar *)"1.0");
502 mpDocNode = xmlNewDocNode(mpDoc, NULL, (xmlChar *)"qpref", NULL);
503 xmlDocSetRootElement(mpDoc, mpDocNode);
504 xmlSetProp(mpDocNode, (xmlChar *)"version", (xmlChar *)"1");
505 Sys_Printf("XML property file '%s' invalid/not found, creating blank properties tree\n", pFilename);
509 qboolean CXMLPropertyBag::WriteXMLFile(const char* pFilename)
511 int res = xmlSaveFormatFile(pFilename, mpDoc, 1);
516 Sys_Printf("Wrote XML property file '%s'\n", pFilename);
520 // =============================================================================
521 // Widget callbacks for PrefsDlg
524 // browse for custom editor executable
525 static void OnBtnBrowseEditor (GtkWidget *widget, gpointer data)
527 PrefsDlg *dlg = (PrefsDlg*)data;
529 const char *filename = file_dialog(g_PrefsDlg.GetWidget(), TRUE, _("Executable for Custom Editor"));
533 dlg->m_strEditorCommand = filename;
534 dlg->UpdateData(FALSE);
539 static void OnBtnBrowseprefab (GtkWidget *widget, gpointer data)
541 PrefsDlg *dlg = (PrefsDlg*)data;
542 char *path = dlg->m_strPrefabPath;
543 if (strlen (path) == 0)
544 path = g_strGameToolsPath;
545 char *dir = dir_dialog (g_PrefsDlg.GetWidget (), _("Set prefab path"), path);
546 dlg->UpdateData(TRUE);
553 dlg->m_strPrefabPath = strPath;
554 dlg->UpdateData(FALSE);
559 static void OnBtnBrowseuserini (GtkWidget *widget, gpointer data)
561 PrefsDlg *dlg = (PrefsDlg*)data;
562 char *path = dlg->m_strUserPath;
563 if (strlen (path) == 0)
564 path = g_strGameToolsPath;
566 const char *filename = file_dialog (g_PrefsDlg.GetWidget(), TRUE, _("Find INI file"), path);
568 if (filename != NULL)
570 dlg->UpdateData(TRUE);
571 dlg->m_strUserPath = filename;
572 dlg->UpdateData(FALSE);
576 static void OnButtonClean (GtkWidget *widget, gpointer data)
578 // make sure this is what the user wants
579 if (gtk_MessageBox (g_PrefsDlg.GetWidget (), _("This will close Radiant and clean the corresponding registry entries.\n"
580 "Next time you start Radiant it will be good as new. Do you wish to continue?"),
581 _("Reset Registry"), MB_YESNO) == IDYES)
583 PrefsDlg *dlg = (PrefsDlg*)data;
584 dlg->EndModal (IDCANCEL);
586 g_qeglobals.disable_ini = true;
587 remove (dlg->m_inipath->str);
589 sprintf(buf, "%sSavedInfo.bin", dlg->m_rc_path->str);
591 HandleCommand (NULL, GINT_TO_POINTER (ID_FILE_EXIT));
596 // =============================================================================
599 // IMPORTANT NOTE: the values here don't matter very much
600 // the actual intialization if you start with an empty .ini is done when loading the prefs for the first time
601 // profile_load_int takes an argument to use if the value is not found
602 PrefsDlg::PrefsDlg ()
606 m_nView = MainFrame::eRegular;
608 m_bInternalBSP = FALSE;
609 m_bRightClick = FALSE;
613 m_bLoadLastMap = FALSE;
614 m_bTextureWindow = FALSE;
615 m_bSnapShots = FALSE;
617 m_bCleanTiny = FALSE;
618 m_bCamXYUpdate = TRUE;
619 m_bCamDragMultiSelect = FALSE;
620 m_bCamFreeLook = TRUE;
621 m_bCamFreeLookStrafe = FALSE;
622 m_bCamInverseMouse = FALSE;
623 m_bCamDiscrete = TRUE;
624 m_bNewLightDraw = FALSE;
625 m_strPrefabPath = "";
628 m_bFaceColors = FALSE;
632 m_bSizePaint = FALSE;
633 m_bDLLEntities = FALSE;
635 m_bDetachableMenus = FALSE; // Most win32 users will find detachable menus annoying
637 m_bDetachableMenus = TRUE; // Linux/Apple users are used to them...
639 m_bPatchToolbar = TRUE;
640 m_bWideToolbar = TRUE;
641 m_bPluginToolbar = TRUE;
646 m_bChaseMouse = FALSE;
647 m_bTextureScrollbar = TRUE;
648 m_bDisplayLists = TRUE;
649 m_bAntialiasedPointsAndLines = FALSE; // Fishman - Add antialiazed points and lines support. 09/03/00
650 m_bShowShaders = FALSE;
652 m_bNoStipple = FALSE;
653 m_bVertexSplit = FALSE;
654 m_bSelectCurves = TRUE;
655 m_bSelectModels = TRUE;
656 m_nEntityShowState = ENTITY_SKINNED_BOXED;
658 m_bSwitchClip = FALSE;
659 m_bSelectWholeEntities = TRUE;
660 m_nTextureQuality = 3;
661 m_bShowShaders = TRUE;
662 m_bGLLighting = FALSE;
665 m_bTexturesShaderlistOnly = FALSE;
666 // paths to ini files
676 m_bFloatingZ = FALSE;
677 m_bGlPtWorkaround = FALSE; // Gef: Kyro/GL_POINTS workaround 25-aug-2001
679 m_bNativeGUI = FALSE;
680 m_bStartOnPrimMon = FALSE;
682 m_global_rc_path = NULL;
684 m_bUseWin32Editor = TRUE;
686 // custom shader editor options
687 m_bUseCustomEditor = FALSE;
688 m_strEditorCommand = "";
690 m_nLightRadiuses = 1;
691 m_bQ3Map2Texturing = TRUE;
693 m_bGlATIHack = FALSE;
698 =========================================================
699 Games selection dialog
700 =========================================================
704 #define TOOLS_ATTRIBUTE "gametools_win32"
705 #define ENGINE_ATTRIBUTE "engine_win32"
706 #define ENGINEPATH_ATTRIBUTE "enginepath_win32"
707 #define MP_ENGINE_ATTRIBUTE "mp_engine_win32"
708 #elif defined(__linux__) || defined (__FreeBSD__)
709 #define TOOLS_ATTRIBUTE "gametools_linux"
710 #define ENGINE_ATTRIBUTE "engine_linux"
711 #define ENGINEPATH_ATTRIBUTE "enginepath_linux"
712 #define MP_ENGINE_ATTRIBUTE "mp_engine_linux"
713 #elif defined(__APPLE__)
714 #define TOOLS_ATTRIBUTE "gametools_macos"
715 #define ENGINE_ATTRIBUTE "engine_macos"
716 #define ENGINEPATH_ATTRIBUTE "enginepath_macos"
717 #define MP_ENGINE_ATTRIBUTE "mp_engine_macos"
719 #error "unsupported platform"
722 CGameDescription::CGameDescription(xmlDocPtr pDoc, const Str &GameFile)
726 // read the user-friendly game name
727 xmlNodePtr pNode = mpDoc->children;
729 while (strcmp((const char*)pNode->name, "game") && pNode != NULL) pNode=pNode->next;
732 ///< \todo add the file name (this node and gametools should all be part of CGameDescription anyway)
733 Error("Didn't find 'game' node in the game description file '%s'\n", pDoc->URL);
735 // on win32, game tools path can now be specified relative to the exe's cwd
736 prop = (char*)xmlGetProp( pNode, (xmlChar*)TOOLS_ATTRIBUTE);
737 if ( prop == NULL ) {
738 Error( "Didn't find '"TOOLS_ATTRIBUTE"' node in the game description file '%s'\n", pDoc->URL );
743 _fullpath( full, prop, PATH_MAX );
745 strncpy( full, prop, PATH_MAX );
749 for ( p = full; *p != '\0'; p++ ) {
753 mGameToolsPath = full;
754 if ( p != full && *(p-1) != '/' ) {
755 mGameToolsPath += "/";
760 prop = (char*)xmlGetProp(pNode, (xmlChar*)"name");
763 Sys_FPrintf(SYS_WRN, "Warning, 'name' attribute not found in '%s'\n", pDoc->URL);
764 mGameName = pDoc->URL;
772 mGameFile = GameFile;
774 prop = (char*)xmlGetProp(pNode, (xmlChar*)"quake2");
786 // if this is set, the open maps dialoge will open the engine path not the
787 // home dir for map loading and saving
788 prop = (char*)xmlGetProp(pNode, (xmlChar*)"no_maps_in_home");
792 noMapsInHome = false;
800 prop = (char*)xmlGetProp(pNode, (xmlChar*)"basegame");
804 mBaseGame = "baseq3";
813 prop = (char*)xmlGetProp(pNode, (const xmlChar*)ENGINE_ATTRIBUTE);
817 mEngine = "quake3.exe";
821 mEngine = "Quake3.app";
830 prop = (char*)xmlGetProp(pNode, (const xmlChar*)MP_ENGINE_ATTRIBUTE);
834 mMultiplayerEngine = "quake3.exe";
836 mMultiplayerEngine = "quake3";
838 mMultiplayerEngine = "Quake3.app";
843 mMultiplayerEngine = prop;
848 // on win32, engine path can now be specified relative to the exe's cwd
849 prop = (char*)xmlGetProp(pNode, (const xmlChar *)ENGINEPATH_ATTRIBUTE);
850 if ( prop != NULL ) {
853 _fullpath( full, prop, PATH_MAX );
855 strncpy( full, prop, PATH_MAX );
859 // process seperators
860 for ( p = full; *p != '\0'; p++ ) {
866 if ( p != full && *(p-1) != '/' ) {
872 // if engine path was not specified in the .game, it implies we can guess it from the gametools path
873 // on win32, and for most game package, the gametools are installed with the game
874 char aux_path[PATH_MAX]; // aux
875 strcpy( aux_path, mGameToolsPath.GetBuffer() );
876 if ( ( aux_path[ strlen(aux_path)-1 ] == '/' ) || ( aux_path[ strlen(aux_path)-1 ] == '\\' ) ) {
877 aux_path[strlen(aux_path)-1] = '\0'; // strip ending '/' if any
879 char up_path[PATH_MAX]; // up one level
880 ExtractFilePath( aux_path, up_path );
881 mEnginePath = up_path;
885 #if defined (__linux__) || defined (__APPLE__)
887 prop = (char*)xmlGetProp(pNode, (const xmlChar *)"prefix");
890 mUserPathPrefix = prop;
894 mShaderPath = xmlGetProp(pNode, (const xmlChar *)"shaderpath");
895 if (!mShaderPath.GetLength())
897 mShaderPath = "scripts/";
898 mShaderlist = "scripts/shaderlist.txt";
902 AddSlash(mShaderPath);
903 mShaderlist = mShaderPath;
904 mShaderlist += "shaderlist.txt";
906 xmlChar* default_scale = xmlGetProp(pNode, (const xmlChar *)"default_scale");
909 mTextureDefaultScale = atof((const char *)default_scale);
910 xmlFree(default_scale);
913 mTextureDefaultScale = 0.5f;
914 xmlChar* eclass_singleload = xmlGetProp(pNode, (const xmlChar*)"eclass_singleload");
915 if (eclass_singleload)
917 mEClassSingleLoad = true;
918 xmlFree(eclass_singleload);
921 mEClassSingleLoad = false;
922 xmlChar* no_patch = xmlGetProp(pNode, (const xmlChar *)"no_patch");
930 xmlChar* caulk_shader = xmlGetProp(pNode, (const xmlChar *)"caulk_shader");
933 mCaulkShader = caulk_shader;
934 xmlFree(caulk_shader);
937 mCaulkShader = "textures/common/caulk";
940 void CGameDescription::Dump()
943 if (CGameDialog::GetNetrun())
944 Sys_Printf("Running in network mode, prefs path set to '%s'\n", g_strTempPath.GetBuffer());
946 Sys_Printf("game name : '%s'\n", mGameName.GetBuffer());
947 Sys_Printf("game file : '%s'\n", mGameFile.GetBuffer());
948 Sys_Printf("game path : '%s'\n", mGameToolsPath.GetBuffer());
949 Sys_Printf("base game : '%s'\n", mBaseGame.GetBuffer());
950 Sys_Printf("engine path : '%s'\n", mEnginePath.GetBuffer());
951 Sys_Printf("engine : '%s'\n", mEngine.GetBuffer());
952 Sys_Printf("shaderlist : '%s'\n", mShaderlist.GetBuffer());
953 Sys_Printf("caulk shader: '%s'\n", mCaulkShader.GetBuffer());
954 #if defined (__linux__) || defined (__APPLE__)
955 Sys_Printf("prefix : '%s'\n", mUserPathPrefix.GetBuffer());
957 Sys_Printf("default texture scale: %g\n", mTextureDefaultScale);
958 Sys_Printf("single eclass load : %s\n", mEClassSingleLoad ? "Yes" : "No");
959 Sys_Printf("patches supported : %s\n", mNoPatch ? "No" : "Yes");
962 CPrefAssignment& CPrefAssignment::operator = (const CPrefAssignment& ass)
973 CPrefAssignment::CPrefAssignment(const CPrefAssignment& ass)
978 void CGameDialog::LoadPrefs()
980 // if we already have a document loaded, we will free and reload from file
981 if (mGlobalPrefs.InUse())
983 Sys_Printf("Reloading global prefs from file\n");
984 mGlobalPrefs.Clear();
987 // load global .pref file
988 CString strGlobalPref = g_PrefsDlg.m_global_rc_path->str;
989 strGlobalPref += "global.pref";
991 mGlobalPrefs.ReadXMLFile(strGlobalPref.GetBuffer());
993 mGlobalPrefs.GetPref("gamefile", &m_sGameFile, ""); // NOTE: there's no default, user HAS to select something
994 mGlobalPrefs.GetPref("autoload", &m_bAutoLoadGame, false);
995 mGlobalPrefs.GetPref("log console", &m_bLogConsole, false);
996 // in a very particular post-.pid startup
997 // we may have the console turned on and want to keep it that way
998 // so we use a latching system
999 if (m_bForceLogConsole)
1001 m_bLogConsole = true;
1002 Sys_Printf("console logging has been latched on, saving prefs\n");
1004 m_bForceLogConsole = false;
1007 // console logging: call Sys_LogConsole to check console logging status
1008 // it is important that we would log console as early as possible to make it useful
1011 if (mGlobalPrefs.mbEmpty)
1013 Sys_Printf("Saving global.pref with default pref values\n");
1018 void CGameDialog::SavePrefs()
1020 // update the tree and save it
1021 mGlobalPrefs.UpdatePrefTree();
1023 CString strGlobalPref = g_PrefsDlg.m_global_rc_path->str;
1024 strGlobalPref += "global.pref";
1026 if ( !mGlobalPrefs.WriteXMLFile( strGlobalPref.GetBuffer() ) ) {
1027 Sys_FPrintf(SYS_ERR, "Error occured while saving global prefs file '%s'\n", strGlobalPref.GetBuffer());
1031 void CGameDialog::DoGameInstall() {
1032 // make sure console logging is on whenever we enter the installation loop
1033 g_PrefsDlg.mGamesDialog.m_bLogConsole = true;
1038 void CGameDialog::DoGameDialog() {
1039 // allow looping the game selection dialog with calls to the game configure dialog in between
1040 while ( m_bDoGameInstall ) {
1042 m_bDoGameInstall = false;
1044 if ( DoModal() == IDCANCEL ) {
1045 Error( "game selection dialog canceled, cannot continue" );
1049 if ( m_bDoGameInstall ) {
1052 // and we will loop to do another DoModal dialog
1056 // unhook so we can use in other places
1057 // we manually incref'ed it when creating, it won't be freed (destructor)
1058 gtk_container_remove( GTK_CONTAINER( mTopBox ), GetGlobalFrame() );
1060 // we save the prefs file
1064 GtkWidget* CGameDialog::GetGlobalFrame()
1066 GtkWidget *vbox, *text, *combo, *check;
1068 if ( mFrame != NULL ) {
1072 mFrame = gtk_frame_new( NULL );
1073 gtk_container_set_border_width( GTK_CONTAINER( mFrame ), 5 );
1074 gtk_widget_show( mFrame );
1076 vbox = gtk_vbox_new( FALSE, 6 );
1077 gtk_widget_show( vbox );
1078 gtk_container_add( GTK_CONTAINER( mFrame ), vbox );
1079 gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
1081 text = gtk_label_new( _("Select the game:") );
1082 gtk_widget_show( text );
1083 gtk_box_pack_start( GTK_BOX( vbox ), text, FALSE, FALSE, 0 );
1085 combo = gtk_combo_box_new_text();
1086 gtk_widget_show( combo );
1087 gtk_box_pack_start( GTK_BOX( vbox ), combo, FALSE, FALSE, 0 );
1088 AddDialogData( combo, &m_nComboSelect, DLG_COMBO_BOX_INT );
1089 mGameCombo = GTK_COMBO_BOX( combo );
1093 check = gtk_check_button_new_with_label( _("Auto load selected game on startup") );
1094 gtk_widget_show(check);
1095 gtk_box_pack_start (GTK_BOX(vbox), check, FALSE, FALSE, 0);
1096 AddDialogData (check, &m_bAutoLoadGame, DLG_CHECK_BOOL);
1098 text = gtk_label_new(_("(this frame is available in the prefs menu if you set auto-select)"));
1099 gtk_widget_show(text);
1100 gtk_box_pack_start (GTK_BOX(vbox), text, FALSE, FALSE, 0);
1103 check = gtk_check_button_new_with_label( _("Networked install - per-user settings") );
1104 gtk_widget_show( check );
1105 gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 );
1106 AddDialogData( check, &m_bNetRun, DLG_CHECK_BOOL );
1109 check = gtk_check_button_new_with_label( _("Log the console to radiant.log") );
1110 gtk_widget_show( check );
1111 gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 );
1112 AddDialogData( check, &m_bLogConsole, DLG_CHECK_BOOL );
1114 // incref it so we can pass it around
1115 gtk_widget_ref( GTK_WIDGET( mFrame ) );
1120 void CGameDialog::UpdateData( bool retrieve ) {
1123 // use m_sGameFile to set m_nComboSelect
1124 list<CGameDescription *>::iterator iGame;
1126 for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++)
1128 if ((*iGame)->mGameFile == m_sGameFile)
1136 UpdateNetrun(false);
1139 Dialog::UpdateData(retrieve);
1142 // use m_nComboSelect to set m_sGameFile
1143 list<CGameDescription *>::iterator iGame = mGames.begin();
1145 for(i=0; i<m_nComboSelect; i++)
1149 m_sGameFile = (*iGame)->mGameFile;
1156 void CGameDialog::SInstallCallback( GtkWidget *widget, gpointer data ) {
1157 CGameDialog *d = static_cast< CGameDialog* >( data );
1158 d->m_bDoGameInstall = true;
1162 void CGameDialog::BuildDialog() {
1163 GtkWidget *dlg, *vbox1, *button, *setup_button;
1166 gtk_window_set_title( GTK_WINDOW( dlg ), _("Select Game") );
1168 vbox1 = gtk_vbox_new( FALSE, 0 );
1169 gtk_widget_show( vbox1 );
1170 gtk_container_add( GTK_CONTAINER( dlg ), vbox1 );
1172 gtk_container_add( GTK_CONTAINER( vbox1 ), GetGlobalFrame() );
1175 setup_button = gtk_button_new_with_label( _("Configure more games") );
1176 gtk_widget_show( setup_button );
1177 gtk_box_pack_start( GTK_BOX( vbox1 ), setup_button, FALSE, FALSE, 0 );
1178 gtk_signal_connect( GTK_OBJECT( setup_button ), "clicked",
1179 GTK_SIGNAL_FUNC( SInstallCallback ), this );
1181 button = gtk_button_new_with_label( _("OK") );
1182 gtk_widget_show( button );
1183 gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 );
1184 AddModalButton( button, IDOK );
1186 button = gtk_button_new_with_label( _("Cancel") );
1187 gtk_widget_show( button );
1188 gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 );
1189 AddModalButton( button, IDCANCEL );
1191 gtk_widget_set_usize( button, 60, -2 );
1194 void CGameDialog::UpdateGameCombo() {
1195 // fill in with the game descriptions
1196 list<CGameDescription *>::iterator iGame;
1198 if ( mGameCombo == NULL ) {
1199 Sys_Printf( "mGameCombo == NULL\n" );
1203 // clear whatever is in - wtf no way to know how many text entries?
1204 // use set/get active to track
1205 gtk_combo_box_set_active( mGameCombo, 0 );
1206 while ( gtk_combo_box_get_active( mGameCombo ) == 0 ) {
1207 gtk_combo_box_remove_text( mGameCombo, 0 );
1208 gtk_combo_box_set_active( mGameCombo, 0 );
1211 for ( iGame = mGames.begin(); iGame != mGames.end(); iGame++ ) {
1212 gtk_combo_box_append_text( mGameCombo, (*iGame)->mGameName.GetBuffer() );
1214 gtk_combo_box_set_active( mGameCombo, 0 );
1217 void CGameDialog::ScanForGames()
1222 CString strGamesPath = g_strAppPath.GetBuffer();
1223 strGamesPath += "games";
1224 const char *path = strGamesPath.GetBuffer();
1226 if ( !mGames.empty() ) {
1227 Sys_Printf( "Clearing game list\n" );
1228 list<CGameDescription*>::iterator iGame;
1229 for ( iGame = mGames.begin(); iGame != mGames.end(); iGame++ ) {
1235 Sys_Printf( "Scanning for game description files: %s\n", path );
1239 do we put game description files below g_strAppPath, or in ~/.radiant
1240 i.e. read only or read/write?
1241 my guess .. readonly cause it's an install
1242 we will probably want to add ~/.radiant/<version>/games/ scanning on top of that for developers
1243 (if that's really needed)
1246 // FIXME need to catch the 'no game description' situation and exit with a clean error
1248 dir = g_dir_open(path, 0, NULL);
1254 const gchar* name = g_dir_read_name(dir);
1258 dirlist = g_strdup(name);
1262 char *ext = strrchr (dirlist, '.');
1263 if ((ext == NULL) || (strcmp (ext, ".game") != 0))
1265 strPath.Format("%s/%s", path, dirlist);
1266 Sys_Printf("%s\n", strPath.GetBuffer());
1268 xmlDocPtr pDoc = xmlParseFile(strPath.GetBuffer());
1271 mGames.push_front( new CGameDescription( pDoc, dirlist ) );
1275 Sys_FPrintf(SYS_ERR, "XML parser failed on '%s'\n", strPath.GetBuffer());
1283 // entries in the combo need to be updated
1287 CGameDescription* CGameDialog::GameDescriptionForComboItem()
1289 list<CGameDescription *>::iterator iGame;
1291 for( iGame = mGames.begin(); iGame != mGames.end(); iGame++,i++ ) {
1292 if ( i == m_nComboSelect ) {
1296 return NULL; // not found
1299 void CGameDialog::InitGlobalPrefPath()
1301 GString *global_rc_path;
1302 // configure m_global_rc_path
1303 // this is the g_strTempPath, and it has already been mkdir'ed
1304 global_rc_path = g_string_new(g_strTempPath.GetBuffer());
1305 g_PrefsDlg.m_global_rc_path = global_rc_path;
1308 void CGameDialog::Reset()
1310 if (!g_PrefsDlg.m_global_rc_path)
1311 InitGlobalPrefPath();
1312 CString strGlobalPref = g_PrefsDlg.m_global_rc_path->str;
1313 strGlobalPref += "global.pref";
1314 remove(strGlobalPref.GetBuffer());
1317 void CGameDialog::Init()
1319 InitGlobalPrefPath();
1321 if ( mGames.empty() ) {
1324 if ( mGames.empty() ) {
1325 Error( "No games setup, aborting\n" );
1329 if ( m_bAutoLoadGame ) {
1330 // search by .game name
1331 list<CGameDescription *>::iterator iGame;
1332 for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++)
1334 if ((*iGame)->mGameFile == m_sGameFile)
1336 m_pCurrentGameDescription = (*iGame);
1341 if ( !m_bAutoLoadGame || !m_pCurrentGameDescription ) {
1343 // use m_nComboSelect to identify the game to run as and set the globals
1344 m_pCurrentGameDescription = GameDescriptionForComboItem();
1345 if ( !m_pCurrentGameDescription ) {
1346 Error("Lookup of game description object failed, can't continue\n");
1349 g_pGameDescription = m_pCurrentGameDescription;
1351 g_strGameToolsPath = g_pGameDescription->mGameToolsPath;
1353 // NOTE TTimo: this is moved from QE_LoadProject in 1.2
1354 // (probably broken)
1355 // NOTE Hydra: was broken for win32, we don't use m_strHomeGame or m_strFSBasePath
1356 #if defined (__linux__) || defined (__APPLE__)
1357 g_qeglobals.m_strHomeGame = g_get_home_dir();
1358 g_qeglobals.m_strHomeGame += "/";
1359 g_qeglobals.m_strHomeGame += m_pCurrentGameDescription->mUserPathPrefix.GetBuffer();
1360 g_qeglobals.m_strHomeGame += "/";
1362 g_qeglobals.m_strHomeGame = g_pGameDescription->mEnginePath.GetBuffer();
1365 g_pGameDescription->Dump();
1368 CGameDialog::~CGameDialog()
1372 // NOTE I'm not too sure how reliable this is
1373 gtk_widget_unref(GTK_WIDGET(mFrame));
1375 // free all the game descriptions
1376 list<CGameDescription *>::iterator iGame;
1377 for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++)
1384 void CGameDialog::AddPacksURL(Str &URL)
1386 // add the URLs for the list of game packs installed
1387 // FIXME: this is kinda hardcoded for now..
1388 list<CGameDescription *>::iterator iGame;
1389 for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++)
1391 if ((*iGame)->mGameFile == "q3.game")
1392 URL += "&Games_dlup%5B%5D=1";
1393 else if ((*iGame)->mGameFile == "wolf.game")
1394 URL += "&Games_dlup%5B%5D=2";
1395 // FIXME: double entry
1396 else if ((*iGame)->mGameFile == "wolf.game")
1397 URL += "&Games_dlup%5B%5D=3";
1398 else if ((*iGame)->mGameFile == "jk2.game")
1399 URL += "&Games_dlup%5B%5D=4";
1400 else if ((*iGame)->mGameFile == "stvef.game")
1401 URL += "&Games_dlup%5B%5D=5";
1402 else if ((*iGame)->mGameFile == "sof2.game")
1403 URL += "&Games_dlup%5B%5D=6";
1404 else if ((*iGame)->mGameFile == "ja.game")
1405 URL += "&Games_dlup%5B%5D=7";
1411 #define NETRUN_FILENAME "netrun.conf"
1413 bool CGameDialog::m_bNetRun;
1415 void CGameDialog::UpdateNetrun(bool retrieve)
1419 strNetrun = g_strAppPath; strNetrun += NETRUN_FILENAME;
1422 // now check if we are running from a network installation
1423 // use a dummy file as the flag
1424 f_netrun = fopen(strNetrun.GetBuffer(), "r");
1437 f_netrun = fopen(strNetrun.GetBuffer(), "w");
1440 Sys_FPrintf(SYS_ERR, "ERROR: Failed to create netrun file '%s'\n", strNetrun.GetBuffer());
1446 Sys_Printf("Created/Checked '%s'\n", strNetrun.GetBuffer());
1451 if (remove(strNetrun.GetBuffer()) == -1)
1453 if (errno != ENOENT)
1454 Sys_FPrintf(SYS_ERR, "Failed to remove netrun file '%s'\n", strNetrun.GetBuffer());
1459 Sys_Printf("Netrun mode is disabled\n");
1465 bool CGameDialog::GetNetrun()
1474 very first prefs init deals with selecting the game and the game tools path
1475 then we can load .ini stuff
1477 using prefs / ini settings:
1481 look in g_strGameToolsPath for .ini
1484 look in ~/.radiant/<version>/gamename
1488 #define PREFS_LOCAL_FILENAME "local.pref"
1490 void PrefsDlg::Init()
1492 mGamesDialog.Init();
1494 // m_global_rc_path has been set above, do m_rc_path with game specific stuff now
1495 // the win32 and linux versions have been unified for network mode
1497 if (!CGameDialog::GetNetrun())
1499 // legacy prefs settings, this goes where the game pack is installed
1500 m_rc_path = g_string_new (g_strGameToolsPath.GetBuffer() );
1501 m_inipath = g_string_new (m_rc_path->str);
1502 g_string_append (m_inipath, PREFS_LOCAL_FILENAME);
1506 // this is common to win32 and Linux init now
1507 m_rc_path = g_string_new (m_global_rc_path->str);
1510 g_string_append (m_rc_path, g_pGameDescription->mGameFile.GetBuffer());
1511 g_string_append (m_rc_path, "/");
1512 Q_mkdir (m_rc_path->str, 0775);
1514 // then the ini file
1515 m_inipath = g_string_new (m_rc_path->str);
1516 g_string_append (m_inipath, PREFS_LOCAL_FILENAME);
1520 void PrefsDlg::UpdateData (bool retrieve)
1522 // leo: the "changed" signal confuses the update function
1523 if (m_pWidget == NULL)
1525 mGamesDialog.UpdateData (retrieve);
1526 Dialog::UpdateData (retrieve);
1530 #define PREFSHSPACE 5
1532 #define PREFSHSPACE 0
1535 static void UpdateSensitivity( GtkWidget *widget, gpointer data )
1537 PrefsDlg *dlg = (PrefsDlg*)data;
1538 dlg->DoSensitivity();
1541 static void UpdateEditorSensitivity(GtkWidget *widget, gpointer data)
1543 PrefsDlg *dlg = (PrefsDlg*)data;
1544 dlg->DoEditorSensitivity();
1547 // start new prefs dialog
1549 /*! Utility function for swapping notebook pages for tree list selections */
1550 void PrefsDlg::showPrefPage(int prefpage)
1552 if(gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook)) != prefpage)
1553 gtk_notebook_set_page(GTK_NOTEBOOK(notebook), prefpage);
1558 static void treeSelection(GtkTreeSelection* selection, gpointer data)
1560 PrefsDlg *dlg = (PrefsDlg*)data;
1562 GtkTreeModel* model;
1563 GtkTreeIter selected;
1564 if(gtk_tree_selection_get_selected(selection, &model, &selected))
1567 gtk_tree_model_get(model, &selected, 1, (gpointer*)&prefpage, -1);
1568 dlg->showPrefPage(prefpage);
1572 void PrefsDlg::BuildDialog ()
1574 // Main Preferences dialog
1575 GtkWidget *dialog, *mainvbox, *hbox, *sc_win, *preflabel;
1577 // Widgets on notebook pages
1578 GtkWidget *check, *label, *scale, *hbox2, *combo,
1579 *table, *spin, *entry, *pixmap,
1580 *radio, *button, *pageframe, *vbox;
1582 GList *combo_list = (GList*)NULL;
1587 gtk_window_set_title(GTK_WINDOW(dialog), _("GtkRadiant Preferences"));
1588 gtk_widget_realize(dialog);
1590 mainvbox = gtk_vbox_new(FALSE, 5);
1591 gtk_container_add(GTK_CONTAINER(dialog), mainvbox);
1592 gtk_container_set_border_width(GTK_CONTAINER(mainvbox), 5);
1593 gtk_widget_show(mainvbox);
1595 hbox = gtk_hbox_new(FALSE, 5);
1596 gtk_widget_show(hbox);
1597 gtk_box_pack_end(GTK_BOX(mainvbox), hbox, FALSE, TRUE, 0);
1599 button = gtk_button_new_with_label(_("OK"));
1600 gtk_widget_show(button);
1601 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
1602 gtk_widget_set_usize(button, 60, -2);
1603 AddModalButton(button, IDOK);
1605 button = gtk_button_new_with_label(_("Cancel"));
1606 gtk_widget_show(button);
1607 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
1608 gtk_widget_set_usize(button, 60, -2);
1609 AddModalButton(button, IDCANCEL);
1611 button = gtk_button_new_with_label (_("Clean"));
1612 gtk_widget_show(button);
1613 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(OnButtonClean), this);
1614 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
1615 gtk_widget_set_usize (button, 60, -2);
1617 hbox = gtk_hbox_new(FALSE, 5);
1618 gtk_box_pack_start(GTK_BOX(mainvbox), hbox, TRUE, TRUE, 0);
1619 gtk_widget_show(hbox);
1621 sc_win = gtk_scrolled_window_new(NULL, NULL);
1622 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sc_win), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
1623 gtk_box_pack_start(GTK_BOX(hbox), sc_win, FALSE, FALSE, 0);
1624 gtk_widget_show(sc_win);
1626 // prefs pages notebook
1627 notebook = gtk_notebook_new();
1628 // hide the notebook tabs since its not supposed to look like a notebook
1629 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook), FALSE);
1630 gtk_box_pack_start(GTK_BOX(hbox), notebook, TRUE, TRUE, 0);
1631 gtk_widget_show(notebook);
1633 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sc_win), GTK_SHADOW_IN);
1636 GtkTreeStore* store = gtk_tree_store_new(2, G_TYPE_STRING, G_TYPE_POINTER);
1638 GtkWidget* view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
1639 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE);
1642 GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
1643 GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes(_("Preferences"), renderer, "text", 0, NULL);
1644 gtk_tree_view_append_column(GTK_TREE_VIEW(view), column);
1648 GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
1649 g_signal_connect(G_OBJECT(selection), "changed", G_CALLBACK(treeSelection), this);
1652 gtk_widget_show(view);
1654 gtk_container_add(GTK_CONTAINER (sc_win), view);
1657 /********************************************************************/
1658 /* Add preference tree options */
1659 /********************************************************************/
1662 gtk_tree_store_append(store, &group, NULL);
1663 gtk_tree_store_set(store, &group, 0, _("Globals"), 1, PTAB_FRONT, -1);
1666 gtk_tree_store_append(store, &tab, &group);
1667 gtk_tree_store_set(store, &tab, 0, _("Game settings"), 1, (gpointer)PTAB_GAME_SETTINGS, -1);
1673 gtk_tree_store_append(store, &group, NULL);
1674 gtk_tree_store_set(store, &group, 0, _("Display"), 1, PTAB_FRONT, -1);
1677 gtk_tree_store_append(store, &tab, &group);
1678 gtk_tree_store_set(store, &tab, 0, _("2D Display/Rendering"), 1, (gpointer)PTAB_2D, -1);
1682 gtk_tree_store_append(store, &tab, &group);
1683 gtk_tree_store_set(store, &tab, 0, _("3D View"), 1, (gpointer)PTAB_CAMERA, -1);
1687 gtk_tree_store_append(store, &tab, &group);
1688 gtk_tree_store_set(store, &tab, 0, _("Texture Settings"), 1, (gpointer)PTAB_TEXTURE, -1);
1694 gtk_tree_store_append(store, &group, NULL);
1695 gtk_tree_store_set(store, &group, 0, _("Interface"), 1, PTAB_FRONT, -1);
1698 gtk_tree_store_append(store, &tab, &group);
1699 gtk_tree_store_set(store, &tab, 0, _("Layout"), 1, (gpointer)PTAB_LAYOUT, -1);
1703 gtk_tree_store_append(store, &tab, &group);
1704 gtk_tree_store_set(store, &tab, 0, _("Mouse"), 1, (gpointer)PTAB_MOUSE, -1);
1708 gtk_tree_store_append(store, &tab, &group);
1709 gtk_tree_store_set(store, &tab, 0, _("Editing"), 1, (gpointer)PTAB_EDITING, -1);
1715 gtk_tree_store_append(store, &group, NULL);
1716 gtk_tree_store_set(store, &group, 0, _("Other"), 1, PTAB_FRONT, -1);
1719 gtk_tree_store_append(store, &tab, &group);
1720 gtk_tree_store_set(store, &tab, 0, _("Startup/Auto save"), 1, (gpointer)PTAB_STARTUP, -1);
1724 gtk_tree_store_append(store, &tab, &group);
1725 gtk_tree_store_set(store, &tab, 0, _("Paths"), 1, (gpointer)PTAB_PATHS, -1);
1729 gtk_tree_store_append(store, &tab, &group);
1730 gtk_tree_store_set(store, &tab, 0, _("Misc"), 1, (gpointer)PTAB_MISC, -1);
1732 if (!g_qeglobals.bBSPFrontendPlugin)
1735 gtk_tree_store_append(store, &tab, &group);
1736 gtk_tree_store_set(store, &tab, 0, _("BSP Monitoring"), 1, (gpointer)PTAB_BSPMONITOR, -1);
1741 gtk_tree_view_expand_all(GTK_TREE_VIEW(view));
1743 g_object_unref(G_OBJECT(store));
1746 /**********************************************************************/
1747 /* build the prefs pages */
1748 /**********************************************************************/
1751 // todo : add something interesting here
1752 // NOTE TTimo: tip of the day? or a logo?
1753 preflabel = gtk_label_new(_("Front Page"));
1754 gtk_widget_show(preflabel);
1755 pageframe = gtk_frame_new(NULL);
1756 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
1757 gtk_widget_show(pageframe);
1758 vbox = gtk_vbox_new(FALSE, 5);
1759 gtk_widget_show(vbox);
1760 gtk_widget_set_usize(GTK_WIDGET(vbox), 350, -2);
1761 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1762 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
1764 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
1766 /******** global preferences group ****************************/
1767 preflabel = gtk_label_new(_("Globals"));
1768 gtk_widget_show(preflabel);
1770 pageframe = mGamesDialog.GetGlobalFrame();
1771 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
1773 /******** 2D prefs group (xy views/rendering options) *********/
1774 preflabel = gtk_label_new(_("2D Display"));
1775 gtk_widget_show(preflabel);
1776 pageframe = gtk_frame_new(_("2D Display"));
1777 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
1778 gtk_widget_show(pageframe);
1779 vbox = gtk_vbox_new(FALSE, 5);
1780 gtk_widget_show(vbox);
1781 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1782 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
1784 // OpenGL Display Lists
1785 check = gtk_check_button_new_with_label(_("OpenGL Display Lists"));
1786 gtk_widget_show(check);
1787 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
1788 AddDialogData(check, &m_bDisplayLists, DLG_CHECK_BOOL);
1790 // Antialiased points & lines
1791 // Fishman - Add antialiazed points and lines support. 09/03/00
1792 check = gtk_check_button_new_with_label (_("OpenGL antialiased points and lines"));
1793 gtk_widget_show (check);
1794 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1795 AddDialogData (check, &m_bAntialiasedPointsAndLines, DLG_CHECK_BOOL);
1797 // Solid selection boxes
1798 check = gtk_check_button_new_with_label (_("Solid selection boxes"));
1799 gtk_widget_show (check);
1800 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1801 AddDialogData (check, &m_bNoStipple, DLG_CHECK_BOOL);
1803 // Display size info
1804 check = gtk_check_button_new_with_label (_("Display size info"));
1805 gtk_widget_show (check);
1806 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
1807 AddDialogData (check, &m_bSizePaint, DLG_CHECK_BOOL);
1809 // Alternate vertex/edge handles
1810 // Gef: Kyro GL_POINT work around 25-aug-2001
1811 check = gtk_check_button_new_with_label (_("Alternate vertex/edge handles"));
1812 gtk_widget_show(check);
1813 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
1814 AddDialogData(check, &m_bGlPtWorkaround, DLG_CHECK_BOOL);
1816 g_list_free (combo_list);
1820 check = gtk_check_button_new_with_label (_("ATI cards with broken drivers - bug #802"));
1821 gtk_widget_show(check);
1822 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
1823 AddDialogData(check, &m_bGlATIHack, DLG_CHECK_BOOL);
1826 // Add the page to the notebook
1827 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
1829 /******** 3D Camera view group *********/
1830 preflabel = gtk_label_new(_("3D View"));
1831 gtk_widget_show(preflabel);
1832 pageframe = gtk_frame_new(_("3D View"));
1833 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
1834 gtk_widget_show(pageframe);
1835 vbox = gtk_vbox_new(FALSE, 5);
1836 gtk_widget_show(vbox);
1837 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1838 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
1840 // Directional velocity (Movement Velocity)
1842 hbox2 = gtk_hbox_new (FALSE, 0);
1843 gtk_widget_show (hbox2);
1844 gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
1847 label = gtk_label_new(_("Movement Velocity"));
1848 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
1849 gtk_widget_show(label);
1850 gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
1853 adj = gtk_adjustment_new(100, 50, 300, 1, 10, 10);
1854 AddDialogData(adj, &m_nMoveSpeed, DLG_ADJ_INT);
1857 scale = gtk_hscale_new(GTK_ADJUSTMENT(adj));
1858 gtk_widget_show(scale);
1859 gtk_box_pack_start(GTK_BOX (vbox), scale, FALSE, TRUE, 2);
1861 gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
1863 // Angular velocity (Rotational Velocity)
1865 hbox2 = gtk_hbox_new (FALSE, 0);
1866 gtk_widget_show (hbox2);
1867 gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
1870 label = gtk_label_new (_("Rotational Velocity"));
1871 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
1872 gtk_widget_show (label);
1873 gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
1876 adj = gtk_adjustment_new (3, 1, 180, 1, 10, 10); // value, low, high, step, page_step, page_size
1877 AddDialogData (adj, &m_nAngleSpeed, DLG_ADJ_INT);
1880 scale = gtk_hscale_new (GTK_ADJUSTMENT (adj));
1881 gtk_widget_show (scale);
1882 gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, TRUE, 2);
1883 gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
1885 // Text under the velocity sliders
1887 hbox2 = gtk_hbox_new (FALSE, 0);
1888 gtk_widget_show (hbox2);
1889 gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
1892 label = gtk_label_new (_("slow"));
1893 gtk_widget_show (label);
1894 gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
1897 label = gtk_label_new (_("fast"));
1898 gtk_widget_show (label);
1899 gtk_box_pack_end (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
1901 // Allow drag to select multiple faces/brushes
1903 table = gtk_table_new(2, 1, FALSE);
1904 gtk_widget_show(table);
1905 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
1906 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
1907 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
1909 label = gtk_label_new (_("Use paint-select in camera view:"));
1910 gtk_widget_show (label);
1911 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
1912 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
1913 (GtkAttachOptions) (0),
1914 (GtkAttachOptions) (0), 0, 0);
1917 combo_list = g_list_append (combo_list, (void *)_("No"));
1918 combo_list = g_list_append (combo_list, (void *)_("Yes"));
1919 combo_list = g_list_append (combo_list, (void *)_("Yes (Classic Key Setup)"));
1921 combo = gtk_combo_new ();
1922 gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list);
1923 gtk_widget_show (combo);
1924 gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 0, 1,
1925 (GtkAttachOptions) (GTK_FILL),
1926 (GtkAttachOptions) (0), 0, 0);
1927 gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
1928 AddDialogData (combo, &m_nCamDragMultiSelect, DLG_COMBO_INT);
1930 // Freelook in Camera view
1931 check = gtk_check_button_new_with_label (_("Freelook in Camera view"));
1932 gtk_widget_show (check);
1933 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1934 gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT);
1935 AddDialogData (check, &m_bCamFreeLook, DLG_CHECK_BOOL);
1937 // Freelook in Camera view w/ forward & back strafing instead of up and down looking
1938 check = gtk_check_button_new_with_label (_("Freelook strafes Forward and Back"));
1939 gtk_widget_show (check);
1940 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1941 gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT);
1942 AddDialogData (check, &m_bCamFreeLookStrafe, DLG_CHECK_BOOL);
1944 // Invert mouse in freelook
1945 check = gtk_check_button_new_with_label (_("Invert mouse in freelook"));
1946 gtk_widget_show (check);
1947 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1948 gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT);
1949 AddDialogData (check, &m_bCamInverseMouse, DLG_CHECK_BOOL);
1951 // Discrete movement
1952 check = gtk_check_button_new_with_label (_("Discrete movement"));
1953 gtk_widget_show (check);
1954 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1955 gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT);
1956 AddDialogData (check, &m_bCamDiscrete, DLG_CHECK_BOOL);
1958 // Update XY views on camera move
1959 check = gtk_check_button_new_with_label (_("Update XY views on camera move"));
1960 gtk_widget_show (check);
1961 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1962 gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT);
1963 AddDialogData (check, &m_bCamXYUpdate, DLG_CHECK_BOOL);
1965 // Add the page to the notebook
1966 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
1968 /******** Texture group *********/
1969 preflabel = gtk_label_new(_("Textures"));
1970 gtk_widget_show(preflabel);
1971 pageframe = gtk_frame_new(_("Textures"));
1972 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
1973 gtk_widget_show(pageframe);
1974 vbox = gtk_vbox_new(FALSE, 6);
1975 gtk_widget_show(vbox);
1976 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1977 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
1979 // Texture quality slider
1981 label = gtk_label_new (_("Texture quality"));
1982 gtk_widget_show (label);
1983 gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
1984 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
1985 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
1988 adj = gtk_adjustment_new (0, 0, 4, 1, 1, 1);
1989 AddDialogData (adj, &m_nLatchedTextureQuality, DLG_ADJ_INT);
1992 scale = gtk_hscale_new (GTK_ADJUSTMENT (adj));
1993 gtk_widget_show (scale);
1994 gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
1995 gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
1997 // text under the texture slider
1998 hbox2 = gtk_hbox_new (FALSE, 0);
1999 gtk_widget_show (hbox2);
2000 gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
2001 label = gtk_label_new (_("low"));
2002 gtk_widget_show (label);
2003 gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
2004 label = gtk_label_new (_("high"));
2005 gtk_widget_show (label);
2006 gtk_box_pack_end (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
2009 check = gtk_check_button_new_with_label (_("Texture subsets"));
2010 gtk_widget_show (check);
2011 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2012 AddDialogData (check, &m_bTextureWindow, DLG_CHECK_BOOL);
2014 // texture scrollbar
2015 check = gtk_check_button_new_with_label (_("Texture scrollbar"));
2016 gtk_widget_show (check);
2017 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2018 AddDialogData (check, &m_bTextureScrollbar, DLG_CHECK_BOOL);
2020 // texture increment matches grid
2021 check = gtk_check_button_new_with_label (_("Tex increment matches grid"));
2022 gtk_widget_show (check);
2023 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2024 AddDialogData (check, &m_bSnapTToGrid, DLG_CHECK_BOOL);
2027 // Texture compression choice label
2029 table = gtk_table_new(2, 1, FALSE);
2030 gtk_widget_show(table);
2031 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2032 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2033 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2035 label = gtk_label_new (_("Texture Compression (if available):"));
2036 gtk_widget_show (label);
2037 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
2038 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
2039 (GtkAttachOptions) (0),
2040 (GtkAttachOptions) (0), 0, 0);
2041 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
2043 // Texture compression choice label
2045 // NONE will always be in pos 0
2046 combo_list = g_list_append (combo_list, (void *)_("None"));
2048 // if OpenGL compression is enabled it will always be
2050 if (g_qeglobals.m_bOpenGLCompressionSupported)
2052 combo_list = g_list_append (combo_list, (void *)_("OpenGL ARB"));
2055 // If S3 is enabled offer all 3 valid compression schemes in RGBA
2056 if (g_qeglobals.m_bS3CompressionSupported)
2058 combo_list = g_list_append (combo_list, (void *)_("S3TC DXT1"));
2059 combo_list = g_list_append (combo_list, (void *)_("S3TC DXT3"));
2060 combo_list = g_list_append (combo_list, (void *)_("S3TC DXT5"));
2063 combo = gtk_combo_new ();
2064 gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list);
2065 gtk_widget_show (combo);
2066 gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 0, 1,
2067 (GtkAttachOptions) (GTK_FILL),
2068 (GtkAttachOptions) (0), 0, 0);
2069 gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
2070 AddDialogData (combo, &m_nTextureCompressionFormat, DLG_COMBO_INT);
2071 g_list_free (combo_list);
2074 table = gtk_table_new(2, 1, FALSE);
2075 gtk_widget_show(table);
2076 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2077 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2078 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2082 label = gtk_label_new (_("Startup Shaders:"));
2083 gtk_widget_show (label);
2084 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
2085 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
2086 (GtkAttachOptions) (0),
2087 (GtkAttachOptions) (0), 0, 0);
2088 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
2092 combo_list = g_list_append (combo_list, (void *)_("None"));
2093 if (g_pGameDescription->mGameFile == "jk2.game" || g_pGameDescription->mGameFile == "ja.game")
2094 combo_list = g_list_append (combo_list, (void *)_("System"));
2095 else if (g_pGameDescription->mGameFile == "sof2.game")
2096 combo_list = g_list_append (combo_list, (void *)("Tools"));
2098 combo_list = g_list_append (combo_list, (void *)_("Common"));
2099 combo_list = g_list_append (combo_list, (void *)_("All"));
2100 combo = gtk_combo_new ();
2101 gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list);
2102 gtk_widget_show (combo);
2103 gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 0, 1,
2104 (GtkAttachOptions) (GTK_FILL),
2105 (GtkAttachOptions) (0), 0, 0);
2106 gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
2107 AddDialogData (combo, &m_nLatchedShader, DLG_COMBO_INT);
2108 g_list_free (combo_list);
2110 // Add the page to the notebook
2111 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2113 /******** Layout group *********/
2114 preflabel = gtk_label_new(_("Layout"));
2115 gtk_widget_show(preflabel);
2116 pageframe = gtk_frame_new(_("Layout"));
2117 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2118 gtk_widget_show(pageframe);
2119 vbox = gtk_vbox_new(FALSE, 5);
2120 gtk_widget_show(vbox);
2121 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2122 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2126 table = gtk_table_new (2, 4, FALSE);
2127 gtk_widget_show (table);
2128 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2129 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2130 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2133 pixmap = new_pixmap (g_pParentWnd->m_pWidget, "window1.bmp");
2134 gtk_widget_show (pixmap);
2135 gtk_table_attach (GTK_TABLE (table), pixmap, 0, 1, 0, 1,
2136 (GtkAttachOptions) (0),
2137 (GtkAttachOptions) (0), 0, 0);
2140 pixmap = new_pixmap (g_pParentWnd->m_pWidget, "window2.bmp");
2141 gtk_widget_show (pixmap);
2142 gtk_table_attach (GTK_TABLE (table), pixmap, 1, 2, 0, 1,
2143 (GtkAttachOptions) (0),
2144 (GtkAttachOptions) (0), 0, 0);
2147 pixmap = new_pixmap (g_pParentWnd->m_pWidget, "window3.bmp");
2148 gtk_widget_show (pixmap);
2149 gtk_table_attach (GTK_TABLE (table), pixmap, 2, 3, 0, 1,
2150 (GtkAttachOptions) (0),
2151 (GtkAttachOptions) (0), 0, 0);
2154 pixmap = new_pixmap (g_pParentWnd->m_pWidget, "window4.bmp");
2155 gtk_widget_show (pixmap);
2156 gtk_table_attach (GTK_TABLE (table), pixmap, 3, 4, 0, 1,
2157 (GtkAttachOptions) (0),
2158 (GtkAttachOptions) (0), 0, 0);
2160 // view type 1 selector
2161 radio = gtk_radio_button_new (NULL);
2162 gtk_widget_show (radio);
2163 gtk_table_attach (GTK_TABLE (table), radio, 0, 1, 1, 2,
2164 (GtkAttachOptions) (0),
2165 (GtkAttachOptions) (0), 0, 0);
2167 // view type 2 selector
2168 radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (radio));
2169 gtk_widget_show (radio);
2170 gtk_table_attach (GTK_TABLE (table), radio, 1, 2, 1, 2,
2171 (GtkAttachOptions) (0),
2172 (GtkAttachOptions) (0), 0, 0);
2174 // view type 3 selector
2175 radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (radio));
2176 gtk_widget_show (radio);
2177 gtk_table_attach (GTK_TABLE (table), radio, 2, 3, 1, 2,
2178 (GtkAttachOptions) (0),
2179 (GtkAttachOptions) (0), 0, 0);
2181 // view type 4 selector
2182 radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (radio));
2183 gtk_widget_show (radio);
2184 gtk_table_attach (GTK_TABLE (table), radio, 3, 4, 1, 2,
2185 (GtkAttachOptions) (0),
2186 (GtkAttachOptions) (0), 0, 0);
2187 AddDialogData (radio, &m_nLatchedView, DLG_RADIO_INT);
2189 // Floating Z window
2190 check = gtk_check_button_new_with_label (_("Floating Z Window"));
2191 gtk_widget_show (check);
2192 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2193 AddDialogData (check, &m_bLatchedFloatingZ, DLG_CHECK_BOOL);
2195 // show menu tear-off seperators
2196 check = gtk_check_button_new_with_label (_("Detachable Menus"));
2197 gtk_widget_show (check);
2198 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2199 AddDialogData (check, &m_bLatchedDetachableMenus, DLG_CHECK_BOOL);
2201 if (!g_pGameDescription->mNoPatch)
2203 // show patch toolbar
2204 check = gtk_check_button_new_with_label (_("Patch Toolbar"));
2205 gtk_widget_show (check);
2206 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2207 g_object_set_data (G_OBJECT (dialog), "check_patchtoolbar", check); // Allow to be disabled for Q1/Q2
2208 AddDialogData (check, &m_bLatchedPatchToolbar, DLG_CHECK_BOOL);
2212 check = gtk_check_button_new_with_label (_("Wide Toolbar"));
2213 gtk_widget_show (check);
2214 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2215 AddDialogData (check, &m_bLatchedWideToolbar, DLG_CHECK_BOOL);
2217 // use plugin toolbar
2218 check = gtk_check_button_new_with_label (_("Plugin Toolbar"));
2219 gtk_widget_show (check);
2220 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2221 AddDialogData (check, &m_bLatchedPluginToolbar, DLG_CHECK_BOOL);
2224 // win32 file dialog
2225 check = gtk_check_button_new_with_label (_("Use win32 file load dialog"));
2226 gtk_widget_show (check);
2227 // gtk_container_add (GTK_CONTAINER (vbox), check);
2228 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2229 AddDialogData (check, &m_bNativeGUI, DLG_CHECK_BOOL);
2231 // position on primary monitor
2232 check = gtk_check_button_new_with_label (_("Start on Primary Monitor"));
2233 gtk_widget_show (check);
2234 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2235 g_object_set_data (G_OBJECT (dialog), "check_startonprimary", check);
2236 gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateSensitivity), this );
2237 AddDialogData (check, &m_bStartOnPrimMon, DLG_CHECK_BOOL);
2240 // Add the page to the notebook
2241 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2243 /******** Mouse group *********/
2244 preflabel = gtk_label_new(_("Mouse"));
2245 gtk_widget_show(preflabel);
2246 pageframe = gtk_frame_new(_("Mouse"));
2247 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2248 gtk_widget_show(pageframe);
2249 vbox = gtk_vbox_new(FALSE, 5);
2250 gtk_widget_show(vbox);
2251 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2252 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2256 hbox2 = gtk_hbox_new (FALSE, 5);
2257 gtk_widget_show (hbox2);
2258 gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0);
2261 radio = gtk_radio_button_new_with_label (NULL, _("2 button"));
2262 gtk_widget_show (radio);
2263 gtk_box_pack_start (GTK_BOX (hbox2), radio, FALSE, FALSE, 0);
2266 radio = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio), _("3 button"));
2267 gtk_widget_show (radio);
2268 gtk_box_pack_start (GTK_BOX (hbox2), radio, FALSE, FALSE, 0);
2269 AddDialogData (radio, &m_nMouse, DLG_RADIO_INT);
2271 // right click to drop entity
2272 check = gtk_check_button_new_with_label (_("Right click to drop entities"));
2273 gtk_widget_show (check);
2274 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2275 AddDialogData (check, &m_bRightClick, DLG_CHECK_BOOL);
2277 // Mouse chaser (and this does what?)
2278 check = gtk_check_button_new_with_label (_("Mouse chaser"));
2279 gtk_widget_show (check);
2280 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2281 AddDialogData (check, &m_bChaseMouse, DLG_CHECK_BOOL);
2284 check = gtk_check_button_new_with_label (_("ALT + multi-drag"));
2285 gtk_widget_show (check);
2286 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2287 AddDialogData (check, &m_bALTEdge, DLG_CHECK_BOOL);
2289 // Mouse wheel increments
2291 hbox2 = gtk_hbox_new (FALSE, 5);
2292 gtk_widget_show (hbox2);
2293 gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0);
2296 label = gtk_label_new (_("Wheel Mouse inc:"));
2297 gtk_widget_show (label);
2298 gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
2301 entry = gtk_entry_new ();
2302 gtk_widget_show (entry);
2303 gtk_widget_set_usize (entry, 40, -2);
2304 gtk_box_pack_start (GTK_BOX (hbox2), entry, FALSE, FALSE, 0);
2305 AddDialogData (entry, &m_nWheelInc, DLG_ENTRY_INT);
2307 // Add the page to the notebook
2308 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2310 /******** Editing group *********/
2311 preflabel = gtk_label_new(_("Editing"));
2312 gtk_widget_show(preflabel);
2313 pageframe = gtk_frame_new(_("Editing"));
2314 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2315 gtk_widget_show(pageframe);
2316 vbox = gtk_vbox_new(FALSE, 5);
2317 gtk_widget_show(vbox);
2318 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2319 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2321 // Vertex editing splits faces
2322 check = gtk_check_button_new_with_label (_("Vertex editing splits face"));
2323 gtk_widget_show (check);
2324 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2325 AddDialogData (check, &m_bVertexSplit, DLG_CHECK_BOOL);
2327 // Fix target/targetname collisions
2328 check = gtk_check_button_new_with_label (_("Fix target/targetname collisions"));
2329 gtk_widget_show (check);
2330 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2331 AddDialogData (check, &m_bDoTargetFix, DLG_CHECK_BOOL);
2333 // Clipper tool uses caulk
2334 check = gtk_check_button_new_with_label (_("Clipper tool uses caulk"));
2335 gtk_widget_show (check);
2336 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2337 AddDialogData (check, &m_bClipCaulk, DLG_CHECK_BOOL);
2339 // Don't clamp plane points
2340 check = gtk_check_button_new_with_label (_("Don't clamp plane points"));
2341 gtk_widget_show (check);
2342 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2343 AddDialogData (check, &m_bNoClamp, DLG_CHECK_BOOL);
2346 check = gtk_check_button_new_with_label (_("Snap to grid"));
2347 gtk_widget_show (check);
2348 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2349 AddDialogData (check, &m_bSnap, DLG_CHECK_BOOL);
2351 // Select patch by bounding box
2352 check = gtk_check_button_new_with_label (_("Select patches by bounding box"));
2353 gtk_widget_show (check);
2354 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2355 AddDialogData (check, &m_bPatchBBoxSelect, DLG_CHECK_BOOL);
2357 // Rotation increment
2359 table = gtk_table_new (2, 3, FALSE);
2360 gtk_widget_show (table);
2361 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2362 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2363 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2366 label = gtk_label_new (_("Rotation increment:"));
2367 gtk_widget_show (label);
2368 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
2369 (GtkAttachOptions) (0),
2370 (GtkAttachOptions) (0), 0, 0);
2373 entry = gtk_entry_new ();
2374 gtk_widget_show (entry);
2375 gtk_widget_set_usize (entry, 60, -2);
2376 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1,
2377 (GtkAttachOptions) (GTK_FILL),
2378 (GtkAttachOptions) (0), 0, 0);
2379 AddDialogData (entry, &m_nRotation, DLG_ENTRY_INT);
2383 label = gtk_label_new (_("Undo Levels:"));
2384 gtk_widget_show (label);
2385 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
2386 (GtkAttachOptions) (0),
2387 (GtkAttachOptions) (0), 0, 0);
2389 // spinner (allows undo levels to be set to zero)
2390 spin = gtk_spin_button_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0, 64, 1, 10, 10)), 1, 0);
2391 gtk_widget_show (spin);
2392 gtk_table_attach (GTK_TABLE (table), spin, 1, 2, 1, 2,
2393 (GtkAttachOptions) (GTK_FILL),
2394 (GtkAttachOptions) (0), 0, 0);
2395 gtk_widget_set_usize (spin, 60, -2);
2396 AddDialogData (spin, &m_nUndoLevels, DLG_SPIN_INT);
2398 // Patch subdivisions
2400 label = gtk_label_new (_("Patch subdivisions:"));
2401 gtk_widget_show (label);
2402 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
2403 (GtkAttachOptions) (0),
2404 (GtkAttachOptions) (0), 0, 0);
2406 // entry (spinner perhaps? [2-16])
2407 entry = gtk_entry_new ();
2408 gtk_widget_show (entry);
2409 gtk_widget_set_usize (entry, 60, -2);
2410 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 2, 3,
2411 (GtkAttachOptions) (GTK_FILL),
2412 (GtkAttachOptions) (0), 0, 0);
2413 AddDialogData (entry, &m_nSubdivisions, DLG_ENTRY_INT);
2415 // Add the page to the notebook
2416 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2418 /******** Save/Load group *********/
2419 preflabel = gtk_label_new(_("Startup/Auto save"));
2420 gtk_widget_show(preflabel);
2421 pageframe = gtk_frame_new(_("Startup/Auto save"));
2422 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2423 gtk_widget_show(pageframe);
2424 vbox = gtk_vbox_new(FALSE, 5);
2425 gtk_widget_show(vbox);
2426 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2427 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2430 check = gtk_check_button_new_with_label (_("Snapshots"));
2431 gtk_widget_show (check);
2432 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2433 AddDialogData (check, &m_bSnapShots, DLG_CHECK_BOOL);
2435 // load last project on open
2436 check = gtk_check_button_new_with_label (_("Load last project on open"));
2437 gtk_widget_show (check);
2438 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2439 AddDialogData (check, &m_bLoadLast, DLG_CHECK_BOOL);
2441 // load last map on open
2442 check = gtk_check_button_new_with_label (_("Load last map on open"));
2443 gtk_widget_show (check);
2444 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2445 AddDialogData (check, &m_bLoadLastMap, DLG_CHECK_BOOL);
2449 hbox2 = gtk_hbox_new (FALSE, 5);
2450 gtk_widget_show (hbox2);
2451 gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0);
2452 gtk_container_set_border_width (GTK_CONTAINER (hbox2), 0);
2455 check = gtk_check_button_new_with_label (_("Auto save every"));
2456 gtk_widget_show (check);
2457 gtk_box_pack_start (GTK_BOX (hbox2), check, FALSE, FALSE, 0);
2458 AddDialogData (check, &m_bAutoSave, DLG_CHECK_BOOL);
2461 spin = gtk_spin_button_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 1, 60, 1, 10, 10)), 1, 0);
2462 gtk_widget_show (spin);
2463 gtk_box_pack_start (GTK_BOX (hbox2), spin, FALSE, FALSE, 0);
2464 gtk_widget_set_usize (spin, 60, -2);
2465 AddDialogData (spin, &m_nAutoSave, DLG_SPIN_INT);
2468 label = gtk_label_new (_("minutes"));
2469 gtk_widget_show (label);
2470 gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
2472 // Add the page to the notebook
2473 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2475 /******** Paths group *********/
2476 preflabel = gtk_label_new(_("Paths"));
2477 gtk_widget_show(preflabel);
2478 pageframe = gtk_frame_new(_("Paths"));
2479 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2480 gtk_widget_show(pageframe);
2481 vbox = gtk_vbox_new(FALSE, 5);
2482 gtk_widget_show(vbox);
2483 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2484 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2488 table = gtk_table_new (3, 3, FALSE);
2489 gtk_widget_show (table);
2490 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2491 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2492 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2495 label = gtk_label_new (_("Prefab path:"));
2496 gtk_widget_show (label);
2497 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
2498 (GtkAttachOptions) (0),
2499 (GtkAttachOptions) (0), 0, 0);
2500 gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
2503 entry = gtk_entry_new ();
2504 gtk_widget_show (entry);
2505 gtk_widget_set_usize(GTK_WIDGET(entry), 240, -2);
2506 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1,
2507 (GtkAttachOptions) (GTK_FILL),
2508 (GtkAttachOptions) (0), 1, 0);
2509 AddDialogData (entry, &m_strPrefabPath, DLG_ENTRY_TEXT);
2513 button = gtk_button_new_with_label ("...");
2514 gtk_widget_show (button);
2515 gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (OnBtnBrowseprefab), this);
2516 gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1,
2517 (GtkAttachOptions) (0),
2518 (GtkAttachOptions) (0), 0, 0);
2523 label = gtk_label_new (_("User INI path:"));
2524 gtk_widget_show (label);
2525 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
2526 (GtkAttachOptions) (0),
2527 (GtkAttachOptions) (0), 0, 0);
2528 gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
2530 // user ini path entry
2531 entry = gtk_entry_new ();
2532 gtk_widget_show (entry);
2533 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 1, 2,
2534 (GtkAttachOptions) (GTK_FILL),
2535 (GtkAttachOptions) (0), 1, 0);
2536 AddDialogData (entry, &m_strUserPath, DLG_ENTRY_TEXT);
2538 // user ini browse button
2539 button = gtk_button_new_with_label ("...");
2540 gtk_widget_show (button);
2541 gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (OnBtnBrowseuserini), this);
2542 gtk_table_attach (GTK_TABLE (table), button, 2, 3, 1, 2,
2543 (GtkAttachOptions) (0),
2544 (GtkAttachOptions) (0), 0, 0);
2546 // Add the page to the notebook
2547 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2549 /******** Misc group *********/
2550 preflabel = gtk_label_new(_("Misc"));
2551 gtk_widget_show(preflabel);
2552 pageframe = gtk_frame_new(_("Misc"));
2553 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2554 gtk_widget_show(pageframe);
2555 vbox = gtk_vbox_new(FALSE, 5);
2556 gtk_widget_show(vbox);
2557 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2558 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2561 check = gtk_check_button_new_with_label (_("Light drawing"));
2562 gtk_widget_show (check);
2563 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2564 AddDialogData (check, &m_bNewLightDraw, DLG_CHECK_BOOL);
2568 table = gtk_table_new(2, 1, FALSE);
2569 gtk_widget_show(table);
2570 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2571 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2572 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2574 label = gtk_label_new (_("Light radiuses:"));
2575 gtk_widget_show (label);
2576 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
2577 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
2578 (GtkAttachOptions) (0),
2579 (GtkAttachOptions) (0), 0, 0);
2582 combo_list = g_list_append (combo_list, (void *)_("Disabled"));
2583 combo_list = g_list_append (combo_list, (void *)_("True Q3Map2 Style"));
2584 combo_list = g_list_append (combo_list, (void *)_("Classic Style"));
2586 combo = gtk_combo_new ();
2587 gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list);
2588 gtk_widget_show (combo);
2589 gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 0, 1,
2590 (GtkAttachOptions) (GTK_FILL),
2591 (GtkAttachOptions) (0), 0, 0);
2592 gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
2593 AddDialogData (combo, &m_nLightRadiuses, DLG_COMBO_INT);
2596 check = gtk_check_button_new_with_label (_("Use win32 file associations to open text files instead of builtin editor"));
2597 gtk_widget_show(check);
2598 gtk_box_pack_start(GTK_BOX (vbox), check, FALSE, FALSE, 0);
2599 AddDialogData (check, &g_PrefsDlg.m_bUseWin32Editor, DLG_CHECK_BOOL);
2601 // use custom shader editor
2602 check = gtk_check_button_new_with_label (_("Use Custom Shader Editor"));
2603 gtk_widget_show(check);
2604 gtk_box_pack_start(GTK_BOX (vbox), check, FALSE, FALSE, 0);
2605 gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateEditorSensitivity), this);
2606 g_object_set_data (G_OBJECT(dialog), "check_customeditor", check);
2607 AddDialogData (check, &g_PrefsDlg.m_bUseCustomEditor, DLG_CHECK_BOOL);
2609 // custom shader editor executable
2611 table = gtk_table_new (3, 1, FALSE);
2612 gtk_widget_show (table);
2613 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2614 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2615 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2618 label = gtk_label_new(_("Custom Editor Command"));
2619 gtk_widget_show(label);
2620 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
2621 (GtkAttachOptions) (0),
2622 (GtkAttachOptions) (0), 0, 0);
2623 gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
2624 g_object_set_data (G_OBJECT(dialog), "label_customeditor", label);
2625 gtk_widget_set_sensitive (label, g_PrefsDlg.m_bUseCustomEditor);
2627 // custom editor command entry
2628 entry = gtk_entry_new ();
2629 gtk_widget_show (entry);
2630 gtk_widget_set_usize(GTK_WIDGET(entry), 240, -2);
2631 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1,
2632 (GtkAttachOptions) (GTK_FILL),
2633 (GtkAttachOptions) (0), 1, 0);
2634 AddDialogData (entry, &m_strEditorCommand, DLG_ENTRY_TEXT);
2635 gtk_widget_set_sensitive (entry, g_PrefsDlg.m_bUseCustomEditor);
2636 g_object_set_data (G_OBJECT(dialog), "entry_customeditor", entry);
2639 button = gtk_button_new_with_label (_("..."));
2640 gtk_widget_show (button);
2641 gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (OnBtnBrowseEditor), this);
2642 gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1,
2643 (GtkAttachOptions) (0),
2644 (GtkAttachOptions) (0), 0, 0);
2645 g_object_set_data (G_OBJECT(dialog), "button_customeditor", button);
2646 gtk_widget_set_sensitive (button, g_PrefsDlg.m_bUseCustomEditor);
2649 // Add the page to the notebook
2650 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2652 /******** BSP Monitoring group *********/
2653 // this is never displayed if the plugin isn't available
2654 preflabel = gtk_label_new(_("BSP Monitoring"));
2655 gtk_widget_show(preflabel);
2656 pageframe = gtk_frame_new(_("BSP Monitoring"));
2657 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2658 gtk_widget_show(pageframe);
2659 vbox = gtk_vbox_new(FALSE, 5);
2660 gtk_widget_show(vbox);
2661 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2662 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2664 // Enable BSP process monitoring
2665 check = gtk_check_button_new_with_label (_("Enable BSP process monitoring"));
2666 gtk_widget_show (check);
2667 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2668 g_object_set_data (G_OBJECT (dialog), "check_monitorbsp", check);
2669 gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateSensitivity), this );
2670 AddDialogData (check, &g_PrefsDlg.m_bWatchBSP, DLG_CHECK_BOOL);
2673 check = gtk_check_button_new_with_label (_("Stop compilation on leak"));
2674 gtk_widget_show (check);
2675 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2676 g_object_set_data (G_OBJECT (dialog), "check_leakstop", check);
2677 AddDialogData (check, &g_PrefsDlg.m_bLeakStop, DLG_CHECK_BOOL);
2679 // engine after compile
2680 check = gtk_check_button_new_with_label (_("Run engine after compile"));
2681 gtk_widget_show (check);
2682 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2683 g_object_set_data (G_OBJECT (dialog), "check_runengine", check);
2684 gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateSensitivity), this );
2685 AddDialogData( check, &g_PrefsDlg.m_bRunQuake, DLG_CHECK_BOOL );
2687 // sleep mode when running engine
2688 check = gtk_check_button_new_with_label (_("Activate sleep mode when running the engine"));
2689 gtk_widget_show (check);
2690 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2691 g_object_set_data (G_OBJECT (dialog), "check_sleep", check);
2692 AddDialogData( check, &g_PrefsDlg.m_bDoSleep, DLG_CHECK_BOOL );
2694 // use q3map2's texture projection
2695 check = gtk_check_button_new_with_label (_("Texturing compatible with q3map2"));
2696 gtk_widget_show (check);
2697 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2698 g_object_set_data (G_OBJECT (dialog), "check_q3map2", check);
2699 AddDialogData( check, &g_PrefsDlg.m_bQ3Map2Texturing, DLG_CHECK_BOOL );
2701 // Add the page to the notebook
2702 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2704 gtk_notebook_set_page(GTK_NOTEBOOK(notebook), PTAB_FRONT);
2709 // end new prefs dialog
2711 void PrefsDlg::LoadTexdefPref(texdef_t* pTexdef, char* pName)
2715 memset(pTexdef, 0, sizeof(texdef_t));
2717 sprintf(buffer, "%s%s", pName, TD_SCALE1_KEY);
2718 mLocalPrefs.GetPref(buffer, &pTexdef->scale[0], 0.5f);
2720 sprintf(buffer, "%s%s", pName, TD_SCALE2_KEY);
2721 mLocalPrefs.GetPref(buffer, &pTexdef->scale[1], 0.5f);
2723 sprintf(buffer, "%s%s", pName, TD_SHIFT1_KEY);
2724 mLocalPrefs.GetPref(buffer, &pTexdef->shift[0], 8.f);
2726 sprintf(buffer, "%s%s", pName, TD_SHIFT2_KEY);
2727 mLocalPrefs.GetPref(buffer, &pTexdef->shift[1], 8.f);
2729 sprintf(buffer, "%s%s", pName, TD_ROTATE_KEY);
2730 mLocalPrefs.GetPref(buffer, &pTexdef->rotate, 45);
2733 void PrefsDlg::UpdateTextureCompression()
2735 // if OpenGL is not ready yet, don't do anything
2736 if (!g_qeglobals.m_bOpenGLReady) {
2737 Sys_Printf("OpenGL not ready - postpone texture compression capability check\n");
2741 if (g_qeglobals.bTextureCompressionSupported)
2743 if (m_nTextureCompressionFormat >= 2 && !g_qeglobals.m_bS3CompressionSupported)
2745 Sys_Printf("Inconsistant pref setting for texture compression (%d), rolling back\n", m_nTextureCompressionFormat);
2746 m_nTextureCompressionFormat = 1; // if this is not supported either, see below
2748 if (m_nTextureCompressionFormat == 1 && !g_qeglobals.m_bOpenGLCompressionSupported)
2750 Sys_Printf("Inconsistant pref setting for texture compression (GL_COMPRESSED_RGBA), rolling back\n");
2751 m_nTextureCompressionFormat = 0;
2753 switch (m_nTextureCompressionFormat)
2757 g_qeglobals.texture_components = GL_RGBA;
2758 Sys_Printf("texture compression disabled by preferences settings\n");
2763 g_qeglobals.texture_components = GL_COMPRESSED_RGBA;
2764 Sys_Printf("OpenGL texture compression enabled\n");
2769 g_qeglobals.texture_components = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
2770 Sys_Printf("S3TC DXT1 texture compression enabled\n");
2775 g_qeglobals.texture_components = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
2776 Sys_Printf("S3TC DXT3 texture compression enabled\n");
2781 g_qeglobals.texture_components = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
2782 Sys_Printf("S3TC DXT5 texture compression enabled\n");
2789 Sys_Printf("texture compression is not supported by your current graphic card/drivers\n");
2790 g_qeglobals.texture_components = GL_RGBA;
2791 m_nTextureCompressionFormat = 0;
2796 void PrefsDlg::UpdateATIHack() {
2797 // if OpenGL is not ready yet, don't do anything
2798 if (!g_qeglobals.m_bOpenGLReady) {
2799 Sys_Printf("OpenGL not ready - postpone ATI bug workaround setup\n");
2804 qglCullFace = &qglCullFace_ATIHack;
2805 qglDisable = &qglDisable_ATIHack;
2806 qglEnable = &qglEnable_ATIHack;
2807 qglPolygonMode = &qglPolygonMode_ATIHack;
2808 Sys_Printf("ATI bug workaround enabled\n");
2810 qglCullFace = qglCullFace_real;
2811 qglDisable = qglDisable_real;
2812 qglEnable = qglEnable_real;
2813 qglPolygonMode = qglPolygonMode_real;
2814 Sys_Printf("ATI bug workaround disabled\n");
2819 // TTimo: m_strEnginePath has a special status, if not found in registry we need to
2820 // initiliaze it for sure. It is not totally failsafe but we can use the same
2821 // code than in q3map, expecting to find some "quake" above us. If not, we prompt
2822 // for the engine executable path
2823 void PrefsDlg::LoadPrefs ()
2827 // first things first, load prefs from global prefs
2828 mGamesDialog.LoadPrefs();
2830 // if we already have a document loaded, we will free and reload from file
2831 if (mLocalPrefs.InUse()) {
2832 mLocalPrefs.Clear();
2835 // load local.pref file
2836 mLocalPrefs.ReadXMLFile(m_inipath->str);
2838 mLocalPrefs.GetPref(PATCHSHOWBOUNDS_KEY, &g_bPatchShowBounds, FALSE);
2839 mLocalPrefs.GetPref(MOUSE_KEY, &m_nMouse, MOUSE_DEF);
2840 m_nMouseButtons = m_nMouse ? 3 : 2;
2843 // if it's not found here, mainframe.cpp will take care of finding one
2844 mLocalPrefs.GetPref(LASTPROJ_KEY, &m_strLastProject, "");
2845 mLocalPrefs.GetPref(LASTPROJVER_KEY, &m_nLastProjectVer, -1);
2848 // NOTE TTimo: I'm not sure why this is in prefs
2849 // should probably be a project setting
2850 // and I'm not sure that we really have a way to set this reliably either
2852 strPrefab = g_qeglobals.m_strHomeGame.GetBuffer();
2853 strPrefab += g_pGameDescription->mBaseGame.GetBuffer();
2854 strPrefab += "/prefabs/";
2855 mLocalPrefs.GetPref(PREFAB_KEY, &m_strPrefabPath, strPrefab);
2857 mLocalPrefs.GetPref(LASTLIGHTINTENSITY_KEY, &m_iLastLightIntensity, 300);
2858 mLocalPrefs.GetPref(TLOCK_KEY, &m_bTextureLock, TLOCK_DEF);
2859 mLocalPrefs.GetPref(RLOCK_KEY, &m_bRotateLock, TLOCK_DEF);
2860 mLocalPrefs.GetPref(LASTMAP_KEY, &m_strLastMap, "");
2861 mLocalPrefs.GetPref(LOADLAST_KEY, &m_bLoadLast, LOADLAST_DEF);
2862 mLocalPrefs.GetPref(BSP_KEY, &m_bInternalBSP, FALSE);
2863 mLocalPrefs.GetPref(RCLICK_KEY, &m_bRightClick, TRUE);
2864 mLocalPrefs.GetPref(AUTOSAVE_KEY, &m_bAutoSave, TRUE);
2865 mLocalPrefs.GetPref(LOADLASTMAP_KEY, &m_bLoadLastMap, FALSE);
2866 mLocalPrefs.GetPref(TINYBRUSH_KEY, &m_bCleanTiny, FALSE);
2867 mLocalPrefs.GetPref(TINYSIZE_KEY, &m_fTinySize, 0.5f);
2868 mLocalPrefs.GetPref(AUTOSAVETIME_KEY, &m_nAutoSave, 5);
2869 mLocalPrefs.GetPref(SNAPSHOT_KEY, &m_bSnapShots, FALSE);
2870 mLocalPrefs.GetPref(MOVESPEED_KEY, &m_nMoveSpeed, 100);
2871 mLocalPrefs.GetPref(ANGLESPEED_KEY, &m_nAngleSpeed, 3);
2872 mLocalPrefs.GetPref(SETGAME_KEY, &m_bSetGame, FALSE);
2873 mLocalPrefs.GetPref(CAMXYUPDATE_KEY, &m_bCamXYUpdate, TRUE);
2874 mLocalPrefs.GetPref(CAMDRAGMULTISELECT_KEY, &m_nCamDragMultiSelect, TRUE);
2875 mLocalPrefs.GetPref(CAMFREELOOK_KEY, &m_bCamFreeLook, TRUE);
2876 mLocalPrefs.GetPref(CAMINVERSEMOUSE_KEY, &m_bCamInverseMouse, FALSE);
2877 mLocalPrefs.GetPref(CAMDISCRETE_KEY, &m_bCamDiscrete, TRUE);
2878 mLocalPrefs.GetPref(LIGHTDRAW_KEY, &m_bNewLightDraw, TRUE);
2879 mLocalPrefs.GetPref(CUBICCLIP_KEY, &m_bCubicClipping, TRUE);
2880 mLocalPrefs.GetPref(CUBICSCALE_KEY, &m_nCubicScale, 13);
2881 mLocalPrefs.GetPref(ALTEDGE_KEY, &m_bALTEdge, FALSE);
2882 mLocalPrefs.GetPref(FACECOLORS_KEY, &m_bFaceColors, FALSE);
2883 mLocalPrefs.GetPref(XZVIS_KEY, &m_bXZVis, FALSE);
2884 mLocalPrefs.GetPref(YZVIS_KEY, &m_bYZVis, FALSE);
2885 mLocalPrefs.GetPref(ZVIS_KEY, &m_bZVis, FALSE);
2886 mLocalPrefs.GetPref(SIZEPAINT_KEY, &m_bSizePaint, FALSE);
2887 mLocalPrefs.GetPref(DLLENTITIES_KEY, &m_bDLLEntities, FALSE);
2889 mLocalPrefs.GetPref(DETACHABLEMENUS_KEY, &m_bLatchedDetachableMenus, TRUE);
2890 m_bDetachableMenus = m_bLatchedDetachableMenus;
2892 if (g_pGameDescription->mNoPatch)
2894 m_bPatchToolbar = false;
2898 mLocalPrefs.GetPref(PATCHTOOLBAR_KEY, &m_bLatchedPatchToolbar, TRUE);
2899 m_bPatchToolbar = m_bLatchedPatchToolbar;
2902 mLocalPrefs.GetPref(WIDETOOLBAR_KEY, &m_bLatchedWideToolbar, TRUE);
2903 m_bWideToolbar = m_bLatchedWideToolbar;
2905 mLocalPrefs.GetPref(PLUGINTOOLBAR_KEY, &m_bLatchedPluginToolbar, TRUE);
2906 m_bPluginToolbar = m_bLatchedPluginToolbar;
2908 mLocalPrefs.GetPref(WINDOW_KEY, (int*)&m_nLatchedView, WINDOW_DEF);
2909 m_nView = m_nLatchedView;
2911 mLocalPrefs.GetPref(FLOATINGZ_KEY, &m_bLatchedFloatingZ, FALSE);
2912 m_bFloatingZ = m_bLatchedFloatingZ;
2914 mLocalPrefs.GetPref(TEXTUREQUALITY_KEY, &m_nLatchedTextureQuality, 3);
2915 m_nTextureQuality = m_nLatchedTextureQuality;
2917 mLocalPrefs.GetPref(LOADSHADERS_KEY, &m_nLatchedShader, 0);
2918 m_nShader = m_nLatchedShader;
2920 mLocalPrefs.GetPref(NOCLAMP_KEY, &m_bNoClamp, FALSE);
2921 mLocalPrefs.GetPref(SNAP_KEY, &m_bSnap, TRUE);
2922 mLocalPrefs.GetPref(USERINI_KEY, &m_strUserPath, "");
2923 mLocalPrefs.GetPref(ROTATION_KEY, &m_nRotation, 45);
2924 mLocalPrefs.GetPref(CHASEMOUSE_KEY, &m_bChaseMouse, TRUE);
2925 mLocalPrefs.GetPref(ENTITYSHOW_KEY, &m_nEntityShowState, ENTITY_SKINNED_BOXED);
2927 // this will probably need to be 75 or 100 for Q1.
2928 mLocalPrefs.GetPref(TEXTURESCALE_KEY, &m_nTextureScale, 50);
2930 // FIXME: Hydra - actually, this stuff is Q1,Q2 and HL specific.
2931 if ( (g_pGameDescription->mGameFile == "hl.game") )
2933 // No BSP monitoring in the default compiler tools for Half-life (yet)
2934 mLocalPrefs.GetPref(WATCHBSP_KEY, &m_bWatchBSP, FALSE);
2936 // Texture subset on by default (HL specific really, because of halflife.wad's size)
2937 mLocalPrefs.GetPref(TEXTURE_KEY, &m_bTextureWindow, TRUE);
2939 else if (g_pGameDescription->quake2)
2941 // BSP monitoring is implemented in Quake2 and Heretic2 tools
2942 mLocalPrefs.GetPref(WATCHBSP_KEY, &m_bWatchBSP, TRUE);
2944 // Texture subset on by default (HL specific really, because of halflife.wad's size)
2945 mLocalPrefs.GetPref(TEXTURE_KEY, &m_bTextureWindow, TRUE);
2949 mLocalPrefs.GetPref(WATCHBSP_KEY, &m_bWatchBSP, WATCHBSP_DEF);
2950 mLocalPrefs.GetPref(TEXTURE_KEY, &m_bTextureWindow, FALSE);
2954 mLocalPrefs.GetPref(TEXTURESCROLLBAR_KEY, &m_bTextureScrollbar, TRUE);
2955 mLocalPrefs.GetPref(DISPLAYLISTS_KEY, &m_bDisplayLists, TRUE);
2956 mLocalPrefs.GetPref(ANTIALIASEDLINES_KEY, &m_bAntialiasedPointsAndLines, FALSE);
2957 mLocalPrefs.GetPref(SWITCHCLIP_KEY, &m_bSwitchClip, TRUE);
2958 mLocalPrefs.GetPref(SELWHOLEENTS_KEY, &m_bSelectWholeEntities, TRUE);
2959 mLocalPrefs.GetPref(SHOWSHADERS_KEY, &m_bShowShaders, TRUE);
2960 mLocalPrefs.GetPref(GLLIGHTING_KEY, &m_bGLLighting, FALSE);
2961 mLocalPrefs.GetPref(NOSTIPPLE_KEY, &m_bNoStipple, FALSE);
2962 mLocalPrefs.GetPref(UNDOLEVELS_KEY, &m_nUndoLevels, 30);
2963 mLocalPrefs.GetPref(VERTEXMODE_KEY, &m_bVertexSplit, TRUE);
2964 mLocalPrefs.GetPref(RUNQ2_KEY, &m_bRunQuake, RUNQ2_DEF);
2965 mLocalPrefs.GetPref(LEAKSTOP_KEY, &m_bLeakStop, TRUE);
2966 mLocalPrefs.GetPref(DOSLEEP_KEY, &m_bDoSleep, FALSE);
2967 mLocalPrefs.GetPref(SELECTCURVES_KEY, &m_bSelectCurves, TRUE);
2968 mLocalPrefs.GetPref(SELECTMODELS_KEY, &m_bSelectModels, TRUE);
2969 mLocalPrefs.GetPref(SHADERLISTONLY_KEY, &m_bTexturesShaderlistOnly, FALSE);
2970 mLocalPrefs.GetPref(SUBDIVISIONS_KEY, &m_nSubdivisions, SUBDIVISIONS_DEF);
2971 mLocalPrefs.GetPref(CLIPCAULK_KEY, &m_bClipCaulk, FALSE);
2972 mLocalPrefs.GetPref(SNAPTTOGRID_KEY, &m_bSnapTToGrid, FALSE);
2973 mLocalPrefs.GetPref(TARGETFIX_KEY, &m_bDoTargetFix, TRUE);
2974 mLocalPrefs.GetPref(WHEELINC_KEY, &m_nWheelInc, 64);
2975 mLocalPrefs.GetPref(PATCHBBOXSEL_KEY, &m_bPatchBBoxSelect, FALSE);
2977 // Gef: Kyro GL_POINT workaround
2978 mLocalPrefs.GetPref(GLPOINTWORKAROUND_KEY, &m_bGlPtWorkaround, FALSE);
2980 // window positioning
2981 mLocalPrefs.GetPref(ENTITYSPLIT1_KEY, &mWindowInfo.nEntitySplit1, -1);
2982 mLocalPrefs.GetPref(ENTITYSPLIT2_KEY, &mWindowInfo.nEntitySplit2, -1);
2984 mLocalPrefs.GetPref(POSITIONX_KEY, &mWindowInfo.position.x, -1);
2985 mLocalPrefs.GetPref(POSITIONY_KEY, &mWindowInfo.position.y, -1);
2986 mLocalPrefs.GetPref(WIDTH_KEY, &mWindowInfo.position.w, -1);
2987 mLocalPrefs.GetPref(HEIGHT_KEY, &mWindowInfo.position.h, 450);
2989 const window_position_t default_window_pos = { 0, 0, 200, 200, };
2991 mLocalPrefs.GetPref(ENTITYWND_KEY, &mWindowInfo.posEntityWnd, default_window_pos);
2992 mLocalPrefs.GetPref(MAPINFOWND_KEY, &mWindowInfo.posMapInfoWnd, default_window_pos);
2993 mLocalPrefs.GetPref(CAMWND_KEY, &mWindowInfo.posCamWnd, default_window_pos);
2994 mLocalPrefs.GetPref(ZWND_KEY, &mWindowInfo.posZWnd, default_window_pos);
2995 mLocalPrefs.GetPref(XYWND_KEY, &mWindowInfo.posXYWnd, default_window_pos);
2996 mLocalPrefs.GetPref(YZWND_KEY, &mWindowInfo.posYZWnd, default_window_pos);
2997 mLocalPrefs.GetPref(XZWND_KEY, &mWindowInfo.posXZWnd, default_window_pos);
2998 mLocalPrefs.GetPref(PATCHWND_KEY, &mWindowInfo.posPatchWnd, default_window_pos);
2999 mLocalPrefs.GetPref(SURFACEWND_KEY, &mWindowInfo.posSurfaceWnd, default_window_pos);
3000 mLocalPrefs.GetPref(ENTITYINFOWND_KEY, &mWindowInfo.posEntityInfoWnd, default_window_pos);
3002 mLocalPrefs.GetPref(ZWIDTH_KEY, &mWindowInfo.nZWidth, 30);
3003 mLocalPrefs.GetPref(XYHEIGHT_KEY, &mWindowInfo.nXYHeight, 300);
3004 mLocalPrefs.GetPref(XYWIDTH_KEY, &mWindowInfo.nXYWidth, 300);
3005 mLocalPrefs.GetPref(CAMWIDTH_KEY, &mWindowInfo.nCamWidth, 200);
3006 mLocalPrefs.GetPref(CAMHEIGHT_KEY, &mWindowInfo.nCamHeight, 200);
3007 mLocalPrefs.GetPref(ZFLOATWIDTH_KEY, &mWindowInfo.nZFloatWidth, 300);
3009 mLocalPrefs.GetPref(STATE_KEY, &mWindowInfo.nState, SW_SHOW);
3013 mLocalPrefs.GetPref(COUNT_KEY, &m_nMRUCount, 0);
3014 for(i = 0; i < 4; i++)
3017 sprintf (buf, "%s%d", FILE_KEY, i);
3018 mLocalPrefs.GetPref(buf, &m_strMRUFiles[i], "");
3021 // some platform specific prefs
3023 mLocalPrefs.GetPref(NATIVEGUI_KEY, &m_bNativeGUI, TRUE);
3024 mLocalPrefs.GetPref(STARTONPRIMMON_KEY, &m_bStartOnPrimMon, FALSE);
3027 mLocalPrefs.GetPref(SI_TEXMENU_KEY, &g_qeglobals.d_savedinfo.iTexMenu, ID_VIEW_BILINEARMIPMAP);
3028 mLocalPrefs.GetPref(SI_GAMMA_KEY, &g_qeglobals.d_savedinfo.fGamma, 1.0f);
3029 mLocalPrefs.GetPref(SI_EXCLUDE_KEY, &g_qeglobals.d_savedinfo.exclude, 0); // nothing filtered by default
3030 mLocalPrefs.GetPref(SI_INCLUDE_KEY, &g_qeglobals.d_savedinfo.include, INCLUDE_NAMES | INCLUDE_COORDS | INCLUDE_ANGLES | INCLUDE_CAMERATINT);
3031 mLocalPrefs.GetPref(SI_SHOWNAMES_KEY, &g_qeglobals.d_savedinfo.show_names, FALSE);
3032 mLocalPrefs.GetPref(SI_SHOWCOORDS_KEY, &g_qeglobals.d_savedinfo.show_coordinates, TRUE);
3033 mLocalPrefs.GetPref(SI_SHOWANGLES_KEY, &g_qeglobals.d_savedinfo.show_angles, TRUE);
3034 mLocalPrefs.GetPref(SI_SHOWOUTLINES_KEY, &g_qeglobals.d_savedinfo.show_outline, FALSE);
3035 mLocalPrefs.GetPref(SI_SHOWAXIS_KEY, &g_qeglobals.d_savedinfo.show_axis, TRUE);
3036 mLocalPrefs.GetPref(SI_NOSELOUTLINES_KEY, &g_qeglobals.d_savedinfo.bNoSelectedOutlines, FALSE);
3038 mLocalPrefs.GetPref(SI_OUTLINESTYLE_KEY, &g_qeglobals.d_savedinfo.iSelectedOutlinesStyle, OUTLINE_ZBUF|OUTLINE_BSEL);
3040 LoadTexdefPref(&g_qeglobals.d_savedinfo.m_SIIncrement, SI_SURFACE_TEXDEF_KEY);
3041 LoadTexdefPref(&g_qeglobals.d_savedinfo.m_PIIncrement, SI_PATCH_TEXDEF_KEY);
3043 // text editor binding
3045 mLocalPrefs.GetPref(CUSTOMSHADEREDITOR_KEY, &m_bUseWin32Editor, TRUE);
3047 mLocalPrefs.GetPref(CUSTOMSHADEREDITOR_KEY, &m_bUseCustomEditor, FALSE);
3048 mLocalPrefs.GetPref(CUSTOMSHADEREDITORCOMMAND_KEY, &m_strEditorCommand, "");
3052 vec3_t vDefaultAxisColours[3] = {
3058 for(i = 0; i < 3; i++) {
3060 sprintf(buf, "%s%d", SI_AXISCOLORS_KEY, i);
3061 mLocalPrefs.GetPref(buf, g_qeglobals.d_savedinfo.AxisColors[i], vDefaultAxisColours[i]);
3064 vec3_t vDefaultColours[COLOR_LAST] = {
3065 {0.25f, 0.25f, 0.25f},
3067 {0.75f, 0.75f, 0.75f},
3069 {0.25f, 0.25f, 0.25f},
3082 for(i = 0; i < COLOR_LAST; i++) {
3084 sprintf(buf, "%s%d", SI_COLORS_KEY, i);
3085 mLocalPrefs.GetPref(buf, g_qeglobals.d_savedinfo.colors[i], vDefaultColours[i]);
3088 mLocalPrefs.GetPref(TEXTURECOMPRESSIONFORMAT_KEY, &m_nTextureCompressionFormat, 1);
3090 mLocalPrefs.GetPref(LIGHTRADIUS_KEY, &m_nLightRadiuses, TRUE);
3092 mLocalPrefs.GetPref(Q3MAP2TEX_KEY, &m_bQ3Map2Texturing, TRUE);
3095 mLocalPrefs.GetPref(ATIHACK_KEY, &m_bGlATIHack, FALSE);
3098 Undo_SetMaxSize(m_nUndoLevels); // set it internally as well / FIXME: why not just have one global value?
3100 UpdateTextureCompression();
3106 if (mLocalPrefs.mbEmpty)
3108 mLocalPrefs.mbEmpty = false;
3109 Sys_Printf("Saving local.pref with default pref values\n");
3114 void PrefsDlg::SavePrefs ()
3116 if (g_qeglobals.disable_ini)
3120 Sys_Printf("PrefsDlg::SavePrefs\n");
3123 // this will take care of copying back from the dialog to the variables
3124 // NOTE: it may be overkill to call systematically before a SavePrefs, but it's safer
3125 // this will also cause an UpdateData for the mGamesDialog
3128 mGamesDialog.SavePrefs();
3130 // update the tree and save it
3131 mLocalPrefs.UpdatePrefTree();
3132 if (!mLocalPrefs.WriteXMLFile(m_inipath->str))
3133 Sys_FPrintf(SYS_ERR, "Error occured while saving local prefs file '%s'\n", m_inipath->str);
3135 if ( m_nMouse == 0 ) {
3136 m_nMouseButtons = 2;
3138 m_nMouseButtons = 3;
3143 void PrefsDlg::PostModal (int code)
3148 // make sure the logfile is ok
3154 g_pParentWnd->SetGridStatus();
3155 Sys_UpdateWindows(W_ALL);
3156 if (m_nUndoLevels != 0)
3157 Undo_SetMaxSize(m_nUndoLevels);
3161 void PrefsDlg::DoEditorSensitivity()
3163 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(g_object_get_data (G_OBJECT(m_pWidget), "check_customeditor"))))
3165 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "label_customeditor")), TRUE);
3166 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "entry_customeditor")), TRUE);
3167 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "button_customeditor")), TRUE);
3171 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "label_customeditor")), FALSE);
3172 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "entry_customeditor")), FALSE);
3173 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "button_customeditor")), FALSE);
3177 void PrefsDlg::DoSensitivity()
3180 // first, look at the project file version ... will monitoring work?
3181 // project files now XML, guaranteed to be at least version 2
3182 if (0)//IntForKey( g_qeglobals.d_project_entity, "version" ) < 2)
3187 Msg = "The current project file (";
3188 Msg += g_PrefsDlg.m_strLastProject;
3189 Msg += ") is not at least version 2.\nI need version 2 or above to setup BSP monitoring correctly.";
3190 gtk_MessageBox(m_pWidget, Msg.GetBuffer(), MB_OK );
3195 // go ahead, disable everybuddy
3196 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_leakstop" )), FALSE );
3197 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_monitorbsp" )), FALSE );
3198 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_runengine" )), FALSE );
3199 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_sleep" )), FALSE );
3206 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_leakstop" )), TRUE );
3207 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_monitorbsp" )), TRUE );
3208 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_runengine" )), TRUE );
3209 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_sleep" )), TRUE );
3211 if ( ! gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( g_object_get_data( G_OBJECT(m_pWidget), "check_monitorbsp" ) ) ) )
3213 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_leakstop" )), FALSE );
3214 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_runengine" )), FALSE );
3215 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_sleep" )), FALSE );
3216 } else if (! gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( g_object_get_data( G_OBJECT(m_pWidget), "check_runengine" ) ) ) )
3218 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_sleep" )), FALSE );
3223 ============================================================
3225 ============================================================
3228 CGameInstall::CGameInstall() {
3229 memset( m_availGames, 0, sizeof( m_availGames ) );
3232 void CGameInstall::OnBtnBrowseEngine( GtkWidget *widget, gpointer data ) {
3233 Sys_Printf( "OnBtnBrowseEngine\n" );
3235 CGameInstall* i = static_cast<CGameInstall*>( data );
3236 char *dir = dir_dialog( i->m_pWidget, _("Select game directory"), NULL );
3238 i->UpdateData( TRUE );
3240 if ( dir != NULL ) {
3241 i->m_strEngine = dir;
3242 i->UpdateData( FALSE );
3247 void CGameInstall::OnGameSelectChanged( GtkWidget *widget, gpointer data ) {
3248 Sys_Printf( "OnGameSelectChanged\n" );
3250 CGameInstall* i = static_cast<CGameInstall*>( data );
3251 i->UpdateData( TRUE );
3252 i->m_strName = gtk_combo_box_get_active_text( GTK_COMBO_BOX( widget ) );
3253 i->UpdateData( FALSE );
3256 void CGameInstall::BuildDialog() {
3257 GtkWidget *dlg, *vbox1, *button, *text, *combo, *entry, *hbox;
3260 gtk_window_set_title( GTK_WINDOW( dlg ), _("Configure games") );
3262 vbox1 = gtk_vbox_new( FALSE, 0 );
3263 gtk_widget_show( vbox1 );
3264 gtk_container_add( GTK_CONTAINER( dlg ), vbox1 );
3266 text = gtk_label_new( _("Select the game to configure") );
3267 gtk_widget_show( text );
3268 gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 );
3270 combo = gtk_combo_box_new_text();
3271 gtk_widget_show( combo );
3272 gtk_box_pack_start( GTK_BOX( vbox1 ), combo, FALSE, FALSE, 0 );
3274 // GList *combo_list = NULL;
3276 while ( m_availGames[ iGame ] != GAME_NONE ) {
3277 switch ( m_availGames[ iGame ] ) {
3279 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Quake II") );
3282 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Quake III Arena and mods") );
3285 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Urban Terror (standalone)") );
3288 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("UFO: Alien Invasion") );
3291 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Quake2World") );
3294 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Warsow") );
3297 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Nexuiz") );
3299 case GAME_TREMULOUS:
3300 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Tremulous") );
3303 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Jedi Academy and mods") );
3308 AddDialogData( combo, &m_nComboSelect, DLG_COMBO_BOX_INT );
3309 gtk_signal_connect( GTK_OBJECT( combo ), "changed", G_CALLBACK( OnGameSelectChanged ), this );
3310 gtk_combo_box_set_active( GTK_COMBO_BOX( combo ), 0 ); // NOTE: will trigger signal
3312 text = gtk_label_new( _("Name:") );
3313 gtk_widget_show( text );
3314 gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 );
3316 entry = gtk_entry_new();
3317 gtk_widget_show( entry );
3318 gtk_box_pack_start( GTK_BOX( vbox1 ), entry, FALSE, FALSE, 0 );
3319 AddDialogData( entry, &m_strName, DLG_ENTRY_TEXT );
3321 text = gtk_label_new( _("Engine directory:") );
3322 gtk_widget_show( text );
3323 gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 );
3325 hbox = gtk_hbox_new( FALSE, 0 );
3326 gtk_widget_show( hbox );
3327 gtk_box_pack_start( GTK_BOX( vbox1 ), hbox, FALSE, FALSE, 0 );
3329 entry = gtk_entry_new();
3330 gtk_widget_show( entry );
3331 gtk_box_pack_start( GTK_BOX( hbox ), entry, FALSE, FALSE, 0 );
3332 AddDialogData( entry, &m_strEngine, DLG_ENTRY_TEXT );
3334 button = gtk_button_new_with_label (_("..."));
3335 gtk_widget_show( button );
3336 gtk_signal_connect( GTK_OBJECT( button ), "clicked", GTK_SIGNAL_FUNC( OnBtnBrowseEngine ), this );
3337 gtk_box_pack_start( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
3339 // this gets done in the project stuff atm
3341 text = gtk_label_new( _("Mod subdirectory:") );
3342 gtk_widget_show( text );
3343 gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 );
3345 entry = gtk_entry_new();
3346 gtk_widget_show( entry );
3347 gtk_box_pack_start( GTK_BOX( vbox1 ), entry, FALSE, FALSE, 0 );
3348 AddDialogData( entry, &m_strMod, DLG_ENTRY_TEXT );
3351 button = gtk_button_new_with_label( _("OK") );
3352 gtk_widget_show( button );
3353 gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 );
3354 AddModalButton( button, IDOK );
3356 button = gtk_button_new_with_label( _("Cancel") );
3357 gtk_widget_show( button );
3358 gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 );
3359 AddModalButton( button, IDCANCEL );
3361 gtk_widget_set_usize( button, 60, -2 );
3364 void CGameInstall::Run() {
3366 if ( m_availGames[0] == GAME_NONE ) {
3369 if ( DoModal() == IDCANCEL ) {
3370 Sys_Printf( "game dialog cancelled\n" );
3373 Sys_Printf( "combo: %d name: %s engine: %s mod: %s\n", m_nComboSelect, m_strName.GetBuffer(), m_strEngine.GetBuffer(), m_strMod.GetBuffer() );
3375 // write out the game file
3376 Str gameFilePath = g_strAppPath.GetBuffer();
3377 gameFilePath += "games/";
3378 gameFilePath += m_strName.GetBuffer();
3379 gameFilePath += ".game";
3380 Sys_Printf( "game file: %s\n", gameFilePath.GetBuffer() );
3382 FILE * fg = fopen( gameFilePath.GetBuffer(), "w" );
3384 Error( "Failed to open %s for writing\n", gameFilePath.GetBuffer() );
3386 fprintf( fg, "<?xml version=\"1.0\" encoding=\"iso-8859-1\" standalone=\"yes\"?>\n<game\n" );
3387 fprintf( fg, " name=\"%s\"\n", m_strName.GetBuffer() );
3388 fprintf( fg, " "ENGINEPATH_ATTRIBUTE"=\"%s\"\n", m_strEngine.GetBuffer() );
3389 switch ( m_availGames[ m_nComboSelect ] ) {
3391 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/Quake2Pack/game\"\n", g_strAppPath.GetBuffer() );
3392 fprintf( fg, " prefix=\".quake2\"\n" );
3393 Str source = g_strAppPath.GetBuffer();
3394 source += "installs/";
3396 source += "/install/";
3397 Str dest = m_strEngine.GetBuffer();
3398 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3399 fprintf( fg, " basegame=\"baseq2\"\n" );
3403 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/Q3Pack/game\"\n", g_strAppPath.GetBuffer() );
3404 fprintf( fg, " prefix=\".q3a\"\n" );
3405 Str source = g_strAppPath.GetBuffer();
3406 source += "installs/";
3408 source += "/install/";
3409 Str dest = m_strEngine.GetBuffer();
3410 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3411 fprintf( fg, " basegame=\"baseq3\"\n" );
3415 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/UrTPack/game\"\n", g_strAppPath.GetBuffer() );
3416 fprintf( fg, " prefix=\".q3a\"\n" );
3417 Str source = g_strAppPath.GetBuffer();
3418 source += "installs/";
3420 source += "/install/";
3421 Str dest = m_strEngine.GetBuffer();
3422 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3423 fprintf( fg, " basegame=\"q3ut4\"\n" );
3427 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/UFOAIPack/game\"\n", g_strAppPath.GetBuffer() );
3428 fprintf( fg, " prefix=\".ufoai\"\n" );
3429 Str source = g_strAppPath.GetBuffer();
3430 source += "installs/";
3431 source += UFOAI_PACK;
3432 source += "/install/";
3433 Str dest = m_strEngine.GetBuffer();
3434 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3435 fprintf( fg, " basegame=\"base\"\n" );
3439 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/Q2WPack/game\"\n", g_strAppPath.GetBuffer() );
3440 fprintf( fg, " prefix=\".quake2world\"\n" );
3441 Str source = g_strAppPath.GetBuffer();
3442 source += "installs/";
3444 source += "/install/";
3445 Str dest = m_strEngine.GetBuffer();
3446 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3447 fprintf( fg, " basegame=\"default\"\n" );
3451 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/WarsowPack/game\"\n", g_strAppPath.GetBuffer() );
3452 fprintf( fg, " prefix=\".warsow\"\n" );
3453 Str source = g_strAppPath.GetBuffer();
3454 source += "installs/";
3455 source += WARSOW_PACK;
3456 source += "/install/";
3457 Str dest = m_strEngine.GetBuffer();
3458 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3459 fprintf( fg, " basegame=\"basewsw\"\n" );
3463 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/NexuizPack/game\"\n", g_strAppPath.GetBuffer() );
3464 fprintf( fg, " prefix=\".nexuiz\"\n" );
3465 Str source = g_strAppPath.GetBuffer();
3466 source += "installs/";
3467 source += NEXUIZ_PACK;
3468 source += "/install/";
3469 Str dest = m_strEngine.GetBuffer();
3470 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3471 fprintf( fg, " basegame=\"data\"\n" );
3474 case GAME_TREMULOUS: {
3475 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/TremulousPack/game\"\n", g_strAppPath.GetBuffer() );
3476 fprintf( fg, " prefix=\".tremulous\"\n" );
3477 Str source = g_strAppPath.GetBuffer();
3478 source += "installs/";
3479 source += TREMULOUS_PACK;
3480 source += "/install/";
3481 Str dest = m_strEngine.GetBuffer();
3482 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3483 fprintf( fg, " basegame=\"base\"\n" );
3487 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/JAPack/game\"\n", g_strAppPath.GetBuffer() );
3488 fprintf( fg, " prefix=\".ja\"\n" );
3489 Str source = g_strAppPath.GetBuffer();
3490 source += "installs/";
3492 source += "/install/";
3493 Str dest = m_strEngine.GetBuffer();
3494 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3495 fprintf( fg, " basegame=\"base\"\n" );
3499 fprintf( fg, "/>\n" );
3505 CGameInstall::ScanGames
3506 scan for active games that can be installed, based on the presence
3509 void CGameInstall::ScanGames() {
3510 Str pakPaths = g_strAppPath.GetBuffer();
3512 const char *dirname;
3514 pakPaths += "installs/";
3515 FindFiles fileScan( pakPaths.GetBuffer() );
3516 while ( ( dirname = fileScan.NextFile() ) != NULL ) {
3517 if ( stricmp( dirname, Q3_PACK ) == 0 ) {
3518 m_availGames[ iGame++ ] = GAME_Q3;
3520 if ( stricmp( dirname, URT_PACK ) == 0 ) {
3521 m_availGames[ iGame++ ] = GAME_URT;
3523 if ( stricmp( dirname, UFOAI_PACK ) == 0 ) {
3524 m_availGames[ iGame++ ] = GAME_UFOAI;
3526 if ( stricmp( dirname, Q2W_PACK ) == 0 ) {
3527 m_availGames[ iGame++ ] = GAME_Q2W;
3529 if ( stricmp( dirname, WARSOW_PACK ) == 0 ) {
3530 m_availGames[ iGame++ ] = GAME_WARSOW;
3532 if ( stricmp( dirname, NEXUIZ_PACK ) == 0 ) {
3533 m_availGames[ iGame++ ] = GAME_NEXUIZ;
3535 if ( stricmp( dirname, Q2_PACK ) == 0 ) {
3536 m_availGames[ iGame++ ] = GAME_Q2;
3538 if ( stricmp( dirname, TREMULOUS_PACK ) == 0 ) {
3539 m_availGames[ iGame++ ] = GAME_TREMULOUS;
3541 if ( stricmp( dirname, JA_PACK ) == 0 ) {
3542 m_availGames[ iGame++ ] = GAME_JA;
3545 Sys_Printf("No installable games found in: %s\n",
3546 pakPaths.GetBuffer() );