2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
5 This file is part of GtkRadiant.
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 // Leonardo Zide (leo@lokigames.com)
30 #include <glib/gi18n.h>
32 #if defined (__linux__) || defined (__APPLE__)
34 #include <sys/types.h>
43 // sanity check - some gtk2 win32 runtimes replace sprintf
44 #if defined( sprintf )
45 #error sprintf is a macro. are you sure?
55 #define PREF_SECTION "Prefs"
56 #define INTERNAL_SECTION "Internals"
57 #define MOUSE_KEY "MouseButtons"
58 #define WINDOW_KEY "QE4StyleWindows"
59 #define LAYOUT_KEY "WindowLayout"
60 #define RUNQ2_KEY "RunQuake2Run"
61 #define TLOCK_KEY "TextureLock"
62 #define RLOCK_KEY "RotateLock"
63 #define LOADLAST_KEY "LoadLast"
64 #define LOADLASTMAP_KEY "LoadLastMap"
65 #define LASTPROJ_KEY "LastProject"
66 #define LASTPROJVER_KEY "LastProjectKey"
67 #define LASTMAP_KEY "LastMap"
68 #define FACE_KEY "NewFaceGrab"
69 #define BSP_KEY "InternalBSP"
70 #define RCLICK_KEY "NewRightClick"
71 #define VERTEX_KEY "NewVertex"
72 #define AUTOSAVE_KEY "Autosave"
73 #define AUTOSAVETIME_KEY "AutosaveMinutes"
74 #define PAK_KEY "UsePAK"
75 #define NEWAPPLY_KEY "ApplyDismissesSurface"
76 #define HACK_KEY "Gatewayescapehack"
77 #define TEXTURE_KEY "NewTextureWindowStuff"
78 #define TINYBRUSH_KEY "CleanTinyBrushes"
79 #define TINYSIZE_KEY "CleanTinyBrusheSize"
80 #define SNAPSHOT_KEY "Snapshots"
81 #define MOVESPEED_KEY "MoveSpeed"
82 #define ANGLESPEED_KEY "AngleSpeed"
83 #define SETGAME_KEY "UseSetGame"
84 #define CAMXYUPDATE_KEY "CamXYUpdate"
85 #define CAMDRAGMULTISELECT_KEY "CamDragMultiSelect"
86 #define CAMFREELOOK_KEY "CamFreeLook"
87 #define CAMINVERSEMOUSE_KEY "CamInverseMouse"
88 #define CAMDISCRETE_KEY "CamDiscrete"
89 #define LIGHTDRAW_KEY "NewLightStyle"
90 #define WHATGAME_KEY "WhichGame"
91 #define CUBICCLIP_KEY "CubicClipping"
92 #define CUBICSCALE_KEY "CubicScale"
93 #define ALTEDGE_KEY "ALTEdgeDrag"
94 #define FACECOLORS_KEY "FaceColors"
95 #define SNAPT_KEY "SnapT"
96 #define XZVIS_KEY "XZVIS"
97 #define YZVIS_KEY "YZVIS"
98 #define ZVIS_KEY "ZVIS"
99 #define SIZEPAINT_KEY "SizePainting"
100 #define DLLENTITIES_KEY "DLLEntities"
101 #define DETACHABLEMENUS_KEY "DetachableMenus"
102 #define PATCHTOOLBAR_KEY "PatchToolBar"
103 #define WIDETOOLBAR_KEY "WideToolBar"
104 #define PLUGINTOOLBAR_KEY "PluginToolBar"
105 #define NOCLAMP_KEY "NoClamp"
106 #define SNAP_KEY "Snap"
107 #define PREFAB_KEY "PrefabPath"
108 #define USERINI_KEY "UserINIPath"
109 #define ROTATION_KEY "Rotation"
110 #define BUGGYICD_KEY "BuggyICD"
111 #define CHASEMOUSE_KEY "ChaseMouse"
112 #define ENTITYSHOW_KEY "EntityShow"
113 #define TEXTURESCALE_KEY "TextureScale"
114 #define TEXTURESCROLLBAR_KEY "TextureScrollbar"
115 #define DISPLAYLISTS_KEY "UseDisplayLists"
116 #define ANTIALIASEDLINES_KEY "UseAntialiasedPointsAndLines" // Fishman - Add antialiazed points and lines support. 09/03/00
117 #define NORMALIZECOLORS_KEY "NormalizeColors"
118 #define SHADERS_KEY "UseShaders"
119 #define SWITCHCLIP_KEY "SwitchClipKey"
120 #define SELWHOLEENTS_KEY "SelectWholeEntitiesKey"
121 #define TEXTURESUBSET_KEY "UseTextureSubsetLoading"
122 #define TEXTUREQUALITY_KEY "TextureQuality"
123 #define SHOWSHADERS_KEY "ShowShaders"
124 #define SHADERTEST_KEY "ShaderTest"
125 #define GLLIGHTING_KEY "UseGLLighting"
126 #define LOADSHADERS_KEY "LoadShaders"
127 #define NOSTIPPLE_KEY "NoStipple"
128 #define UNDOLEVELS_KEY "UndoLevels"
129 #define VERTEXMODE_KEY "VertexSplit"
130 #define ENGINEPATH_KEY "EnginePath"
131 #define ENGINE_KEY "Engine"
132 #define LOGCONSOLE_KEY "LogConsole"
133 #define SELECTCURVES_KEY "SelectCurves"
134 #define SELECTMODELS_KEY "SelectModels"
135 #define SHADERLISTONLY_KEY "ShowShaderlistOnly"
136 #define WATCHBSP_KEY "WatchBSP"
137 #define LEAKSTOP_KEY "LeakStop"
138 #define DOSLEEP_KEY "SleepMode"
139 #define SUBDIVISIONS_KEY "Subdivisions"
140 #define DEFAULTTEXURESCALE_KEY "DefaultTextureScale"
141 #define CLIPCAULK_KEY "ClipCaulk"
142 #define PATCHSHOWBOUNDS_KEY "PatchShowBounds"
143 #define NATIVEGUI_KEY "NativeGUI"
144 #define STARTONPRIMMON_KEY "StartOnPrimMon"
145 #define NOSYSMENUPOPUPS_KEY "NoSysMenuPopups"
146 #define SNAPTTOGRID_KEY "SnapTToGrid"
147 #define FLOATINGZ_KEY "FloatingZ"
148 #define TARGETFIX_KEY "TargetFix"
149 #define GLPOINTWORKAROUND_KEY "GlPointWorkaround" // Gef: Workaround for broken Kyro * gl driver 25-aug-2001
150 #define WHEELINC_KEY "WheelMouseInc"
151 #define PATCHBBOXSEL_KEY "PatchBBoxSel"
152 #define LASTLIGHTINTENSITY_KEY "LastLightIntensity"
153 #define CUSTOMSHADEREDITOR_KEY "UseCustomShaderEditor"
154 #define CUSTOMSHADEREDITORCOMMAND_KEY "CustomShaderEditorCommand"
155 #define TEXTURECOMPRESSIONFORMAT_KEY "TextureCompressionFormat"
156 #define LIGHTRADIUS_KEY "LightRadiuses"
157 #define Q3MAP2TEX_KEY "Q3Map2Tex"
158 #define ATIHACK_KEY "ATIHack"
161 #define ENTITYSPLIT1_KEY "EntitySplit1"
162 #define ENTITYSPLIT2_KEY "EntitySplit2"
163 #define POSITIONX_KEY "PositionX"
164 #define POSITIONY_KEY "PositionY"
165 #define ENTITYWND_KEY "EntityWnd"
166 #define MAPINFOWND_KEY "MapInfoDlg"
167 #define CAMWND_KEY "CamWnd"
168 #define ZWND_KEY "ZWnd"
169 #define XYWND_KEY "XYWnd"
170 #define XZWND_KEY "XZWnd"
171 #define YZWND_KEY "YZWnd"
172 #define PATCHWND_KEY "PatchWnd"
173 #define SURFACEWND_KEY "SurfaceWnd"
174 #define ENTITYINFOWND_KEY "EntityInfoDlg"
175 #define WIDTH_KEY "Width"
176 #define HEIGHT_KEY "Height"
177 #define ZWIDTH_KEY "ZWidth"
178 #define XYHEIGHT_KEY "XYHeight"
179 #define XYWIDTH_KEY "XYWidth"
180 #define CAMWIDTH_KEY "CamWidth"
181 #define CAMHEIGHT_KEY "CamHeight"
182 #define ZFLOATWIDTH_KEY "ZWidthFloating"
183 #define STATE_KEY "State"
186 #define COUNT_KEY "Count"
187 #define FILE_KEY "File"
190 #define SI_TEXMENU_KEY "SI_TexMenu"
191 #define SI_GAMMA_KEY "SI_Gamma"
192 #define SI_COLORS_KEY "SI_Colors"
193 #define SI_EXCLUDE_KEY "SI_Exclude"
194 #define SI_INCLUDE_KEY "SI_Include"
195 #define SI_SURFACE_TEXDEF_KEY "SI_SurfaceTexdef"
196 #define SI_PATCH_TEXDEF_KEY "SI_PatchTexdef"
197 #define SI_AXISCOLORS_KEY "SI_AxisColors"
198 #define SI_SHOWNAMES_KEY "SI_ShowNames"
199 #define SI_SHOWCOORDS_KEY "SI_ShowCoords"
200 #define SI_SHOWANGLES_KEY "SI_ShowAngles"
201 #define SI_SHOWOUTLINES_KEY "SI_ShowOutlines"
202 #define SI_SHOWAXIS_KEY "SI_ShowAxis"
203 #define SI_NOSELOUTLINES_KEY "SI_NoSelectedOutlines"
204 #define SI_OUTLINESTYLE_KEY "SI_OutLineStyle"
207 #define TD_SCALE1_KEY "_Scale1"
208 #define TD_SCALE2_KEY "_Scale2"
209 #define TD_SHIFT1_KEY "_Shift1"
210 #define TD_SHIFT2_KEY "_Shift2"
211 #define TD_ROTATE_KEY "_Rotate"
216 #define WATCHBSP_DEF 1
218 #define LOADLAST_DEF 1
220 #define SUBDIVISIONS_DEF 4
222 void WindowPosition_Parse(window_position_t& m_value, const CString& value)
224 if(sscanf(value.GetBuffer(), "%d %d %d %d", &m_value.x, &m_value.y, &m_value.w, &m_value.h) != 4)
225 m_value.x = m_value.y = m_value.w = m_value.h = -1;
228 void WindowPosition_Write(const window_position_t& m_value, CString& value)
231 sprintf(buffer, "%d %d %d %d", m_value.x, m_value.y, m_value.w, m_value.h);
236 CXMLPropertyBag::CXMLPropertyBag() {
242 // generic preference functions
244 void CXMLPropertyBag::PushAssignment(const char *name, PrefTypes_t type, void *pV)
246 list<CPrefAssignment>::iterator iAssign;
247 for(iAssign=mPrefAssignments.begin(); iAssign!=mPrefAssignments.end(); iAssign++)
249 if ((*iAssign).mName == name)
251 // we have it already, check anyway
252 if (pV != (*iAssign).mVal)
254 Sys_FPrintf(SYS_ERR, "PushAssignment, '%s' has different mVal\n", name);
259 // ok, it's not in our list yet
260 mPrefAssignments.push_front(CPrefAssignment(name, type, pV));
263 xmlNodePtr CXMLPropertyBag::EpairForName(const char *name)
265 xmlNodePtr ret = NULL;
267 xmlNodePtr pNode = mpDocNode->children;
268 while (pNode != NULL)
270 if(pNode->type == XML_ELEMENT_NODE)
272 xmlAttrPtr tmp_attr_ptr = xmlHasProp(pNode, (xmlChar *)"name");
273 if (tmp_attr_ptr != NULL && !strcmp(name, (char *)tmp_attr_ptr->children->content))
276 Sys_FPrintf( SYS_WRN, "WARNING: dupe property in CXMLPropertyBag::EpairForName '%s'\n", name );
287 void CXMLPropertyBag::GetPref(const char *name, Str *pV, const char *V)
289 xmlNodePtr pNode = EpairForName( name );
292 if ( pNode->children && pNode->children->content ) {
293 *pV = pNode->children->content;
295 // means the pref exists, and that the value is ""
301 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)V);
302 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
304 // push the pref assignment if needed
305 PushAssignment(name, PREF_STR, pV);
308 void CXMLPropertyBag::GetPref(const char *name, int *pV, int V)
311 if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
313 *pV = atoi((char *)pNode->children->content);
319 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s);
320 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
323 // push the pref assignment if needed
324 PushAssignment(name, PREF_INT, pV);
327 void CXMLPropertyBag::GetPref(const char *name, bool *pV, bool V)
330 if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
332 if (!strcmp((char *)pNode->children->content, "true"))
344 V ? strcpy(s, "true") : strcpy(s, "false");
345 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s);
346 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
349 // push the pref assignment
350 PushAssignment(name, PREF_BOOL, pV);
353 void CXMLPropertyBag::GetPref(const char *name, float *pV, float V)
356 if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
358 *pV = atof((char *)pNode->children->content);
364 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s);
365 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
368 // push the pref assignment if needed
369 PushAssignment(name, PREF_FLOAT, pV);
372 void CXMLPropertyBag::GetPref(const char *name, float* pV, float* V)
375 if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
377 sscanf((char *)pNode->children->content, "%f %f %f", &pV[0], &pV[1], &pV[2]);
382 sprintf(s, "%f %f %f", V[0], V[1], V[2]);
383 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s);
384 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
389 // push the pref assignment if needed
390 PushAssignment(name, PREF_VEC3, pV);
393 void CXMLPropertyBag::GetPref(const char *name, window_position_t* pV, window_position_t V)
396 if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
398 WindowPosition_Parse(*pV, CString((xmlChar *)pNode->children->content));
403 WindowPosition_Write(V, str);
404 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)str.GetBuffer());
405 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
408 // push the pref assignment if needed
409 PushAssignment(name, PREF_WNDPOS, pV);
412 void CXMLPropertyBag::UpdatePrefTree()
414 // read the assignments and update the tree
415 list<CPrefAssignment>::iterator iPref;
416 for(iPref = mPrefAssignments.begin(); iPref != mPrefAssignments.end(); iPref++)
418 CPrefAssignment *pPref = &(*iPref);
423 pNode = EpairForName(pPref->mName.GetBuffer());
424 // we never expect that the node could not be found, because this is supposed to happen
425 // after the tree was built with GetPref calls, never on a blank tree
428 Sys_FPrintf(SYS_ERR, "Unexpected EpairForName '%s' not found in UpdatePrefTree\n", pPref->mName.GetBuffer());
431 switch ((*iPref).mType)
434 xmlNodeSetContent(pNode, (const xmlChar *)((Str *)pPref->mVal)->GetBuffer());
437 sprintf(s, "%d", *(int *)pPref->mVal);
438 xmlNodeSetContent(pNode, (xmlChar *)s);
441 sprintf(s, "%f", *(float *)pPref->mVal);
442 xmlNodeSetContent(pNode, (xmlChar *)s);
445 *(bool *)pPref->mVal ? strcpy(s, "true") : strcpy(s, "false");
446 xmlNodeSetContent(pNode, (xmlChar *)s);
450 float* v = (float*)pPref->mVal;
451 sprintf(s, "%f %f %f", v[0], v[1], v[2]);
452 xmlNodeSetContent(pNode, (xmlChar *)s);
458 WindowPosition_Write(*(window_position_t*)pPref->mVal, str);
459 xmlNodeSetContent(pNode, (xmlChar*)str.GetBuffer());
466 void CXMLPropertyBag::Clear()
477 void CXMLPropertyBag::ReadXMLFile(const char* pFilename)
479 mpDoc = xmlParseFile(pFilename);
484 mpDocNode = mpDoc->children;
485 xmlAttrPtr tmp_attr_ptr = xmlHasProp(mpDocNode, (xmlChar *)"version");
486 if (strcmp((char *)mpDocNode->name, "qpref"))
488 Sys_FPrintf(SYS_ERR, "Unrecognized node '%s' in '%s'\n", mpDocNode->name, mpDoc->URL);
492 else if (tmp_attr_ptr != NULL && strcmp((char*)tmp_attr_ptr->children->content, "1"))
494 Sys_FPrintf(SYS_ERR, "Wrong version '%s' in <qpref> node for '%s'\n", (char*)tmp_attr_ptr->children->content, mpDoc->URL);
498 Sys_Printf("Opened XML property file: '%s'\n", pFilename);
504 // no document, create one
505 mpDoc = xmlNewDoc((xmlChar *)"1.0");
506 mpDocNode = xmlNewDocNode(mpDoc, NULL, (xmlChar *)"qpref", NULL);
507 xmlDocSetRootElement(mpDoc, mpDocNode);
508 xmlSetProp(mpDocNode, (xmlChar *)"version", (xmlChar *)"1");
509 Sys_Printf("XML property file '%s' invalid/not found, creating blank properties tree\n", pFilename);
513 qboolean CXMLPropertyBag::WriteXMLFile(const char* pFilename)
515 int res = xmlSaveFormatFile(pFilename, mpDoc, 1);
520 Sys_Printf("Wrote XML property file '%s'\n", pFilename);
524 // =============================================================================
525 // Widget callbacks for PrefsDlg
528 // browse for custom editor executable
529 static void OnBtnBrowseEditor (GtkWidget *widget, gpointer data)
531 PrefsDlg *dlg = (PrefsDlg*)data;
533 const char *filename = file_dialog(g_PrefsDlg.GetWidget(), TRUE, _("Executable for Custom Editor"));
537 dlg->m_strEditorCommand = filename;
538 dlg->UpdateData(FALSE);
543 static void OnBtnBrowseprefab (GtkWidget *widget, gpointer data)
545 PrefsDlg *dlg = (PrefsDlg*)data;
546 char *path = dlg->m_strPrefabPath;
547 if (strlen (path) == 0)
548 path = g_strGameToolsPath;
549 char *dir = dir_dialog (g_PrefsDlg.GetWidget (), _("Set prefab path"), path);
550 dlg->UpdateData(TRUE);
557 dlg->m_strPrefabPath = strPath;
558 dlg->UpdateData(FALSE);
563 static void OnBtnBrowseuserini (GtkWidget *widget, gpointer data)
565 PrefsDlg *dlg = (PrefsDlg*)data;
566 char *path = dlg->m_strUserPath;
567 if (strlen (path) == 0)
568 path = g_strGameToolsPath;
570 const char *filename = file_dialog (g_PrefsDlg.GetWidget(), TRUE, _("Find INI file"), path);
572 if (filename != NULL)
574 dlg->UpdateData(TRUE);
575 dlg->m_strUserPath = filename;
576 dlg->UpdateData(FALSE);
580 static void OnButtonClean (GtkWidget *widget, gpointer data)
582 // make sure this is what the user wants
583 if (gtk_MessageBox (g_PrefsDlg.GetWidget (), _("This will close Radiant and clean the corresponding registry entries.\n"
584 "Next time you start Radiant it will be good as new. Do you wish to continue?"),
585 _("Reset Registry"), MB_YESNO) == IDYES)
587 PrefsDlg *dlg = (PrefsDlg*)data;
588 dlg->EndModal (IDCANCEL);
590 g_qeglobals.disable_ini = true;
591 remove (dlg->m_inipath->str);
593 sprintf(buf, "%sSavedInfo.bin", dlg->m_rc_path->str);
595 HandleCommand (NULL, GINT_TO_POINTER (ID_FILE_EXIT));
600 // =============================================================================
603 // IMPORTANT NOTE: the values here don't matter very much
604 // the actual intialization if you start with an empty .ini is done when loading the prefs for the first time
605 // profile_load_int takes an argument to use if the value is not found
606 PrefsDlg::PrefsDlg ()
610 m_nView = MainFrame::eRegular;
612 m_bInternalBSP = FALSE;
613 m_bRightClick = FALSE;
617 m_bLoadLastMap = FALSE;
618 m_bTextureWindow = FALSE;
619 m_bSnapShots = FALSE;
621 m_bCleanTiny = FALSE;
622 m_bCamXYUpdate = TRUE;
623 m_bCamDragMultiSelect = FALSE;
624 m_bCamFreeLook = TRUE;
625 m_bCamFreeLookStrafe = FALSE;
626 m_bCamInverseMouse = FALSE;
627 m_bCamDiscrete = TRUE;
628 m_bNewLightDraw = FALSE;
629 m_strPrefabPath = "";
632 m_bFaceColors = FALSE;
636 m_bSizePaint = FALSE;
637 m_bDLLEntities = FALSE;
639 m_bDetachableMenus = FALSE; // Most win32 users will find detachable menus annoying
641 m_bDetachableMenus = TRUE; // Linux/Apple users are used to them...
643 m_bPatchToolbar = TRUE;
644 m_bWideToolbar = TRUE;
645 m_bPluginToolbar = TRUE;
650 m_bChaseMouse = FALSE;
651 m_bTextureScrollbar = TRUE;
652 m_bDisplayLists = TRUE;
653 m_bAntialiasedPointsAndLines = FALSE; // Fishman - Add antialiazed points and lines support. 09/03/00
654 m_bShowShaders = FALSE;
656 m_bNoStipple = FALSE;
657 m_bVertexSplit = FALSE;
658 m_bSelectCurves = TRUE;
659 m_bSelectModels = TRUE;
660 m_nEntityShowState = ENTITY_SKINNED_BOXED;
662 m_bSwitchClip = FALSE;
663 m_bSelectWholeEntities = TRUE;
664 m_nTextureQuality = 3;
665 m_bShowShaders = TRUE;
666 m_bGLLighting = FALSE;
669 m_bTexturesShaderlistOnly = FALSE;
670 // paths to ini files
680 m_bFloatingZ = FALSE;
681 m_bGlPtWorkaround = FALSE; // Gef: Kyro/GL_POINTS workaround 25-aug-2001
683 m_bNativeGUI = FALSE;
684 m_bStartOnPrimMon = FALSE;
686 m_global_rc_path = NULL;
688 m_bUseWin32Editor = TRUE;
690 // custom shader editor options
691 m_bUseCustomEditor = FALSE;
692 m_strEditorCommand = "";
694 m_nLightRadiuses = 1;
695 m_bQ3Map2Texturing = TRUE;
697 m_bGlATIHack = FALSE;
702 =========================================================
703 Games selection dialog
704 =========================================================
708 #define TOOLS_ATTRIBUTE "gametools_win32"
709 #define ENGINE_ATTRIBUTE "engine_win32"
710 #define ENGINEPATH_ATTRIBUTE "enginepath_win32"
711 #define MP_ENGINE_ATTRIBUTE "mp_engine_win32"
712 #elif defined(__linux__) || defined (__FreeBSD__)
713 #define TOOLS_ATTRIBUTE "gametools_linux"
714 #define ENGINE_ATTRIBUTE "engine_linux"
715 #define ENGINEPATH_ATTRIBUTE "enginepath_linux"
716 #define MP_ENGINE_ATTRIBUTE "mp_engine_linux"
717 #elif defined(__APPLE__)
718 #define TOOLS_ATTRIBUTE "gametools_macos"
719 #define ENGINE_ATTRIBUTE "engine_macos"
720 #define ENGINEPATH_ATTRIBUTE "enginepath_macos"
721 #define MP_ENGINE_ATTRIBUTE "mp_engine_macos"
723 #error "unsupported platform"
726 CGameDescription::CGameDescription(xmlDocPtr pDoc, const Str &GameFile)
730 // read the user-friendly game name
731 xmlNodePtr pNode = mpDoc->children;
733 while (strcmp((const char*)pNode->name, "game") && pNode != NULL) pNode=pNode->next;
736 ///< \todo add the file name (this node and gametools should all be part of CGameDescription anyway)
737 Error("Didn't find 'game' node in the game description file '%s'\n", pDoc->URL);
739 // on win32, game tools path can now be specified relative to the exe's cwd
740 prop = (char*)xmlGetProp( pNode, (xmlChar*)TOOLS_ATTRIBUTE);
741 if ( prop == NULL ) {
742 Error( "Didn't find '"TOOLS_ATTRIBUTE"' node in the game description file '%s'\n", pDoc->URL );
747 _fullpath( full, prop, PATH_MAX );
749 strncpy( full, prop, PATH_MAX );
753 for ( p = full; *p != '\0'; p++ ) {
757 mGameToolsPath = full;
758 if ( p != full && *(p-1) != '/' ) {
759 mGameToolsPath += "/";
764 prop = (char*)xmlGetProp(pNode, (xmlChar*)"name");
767 Sys_FPrintf(SYS_WRN, "Warning, 'name' attribute not found in '%s'\n", pDoc->URL);
768 mGameName = pDoc->URL;
776 mGameFile = GameFile;
778 prop = (char*)xmlGetProp(pNode, (xmlChar*)"quake2");
790 // if this is set, the open maps dialoge will open the engine path not the
791 // home dir for map loading and saving
792 prop = (char*)xmlGetProp(pNode, (xmlChar*)"no_maps_in_home");
796 noMapsInHome = false;
804 prop = (char*)xmlGetProp(pNode, (xmlChar*)"basegame");
808 mBaseGame = "baseq3";
817 prop = (char*)xmlGetProp(pNode, (const xmlChar*)ENGINE_ATTRIBUTE);
821 mEngine = "quake3.exe";
825 mEngine = "Quake3.app";
834 prop = (char*)xmlGetProp(pNode, (const xmlChar*)MP_ENGINE_ATTRIBUTE);
838 mMultiplayerEngine = "quake3.exe";
840 mMultiplayerEngine = "quake3";
842 mMultiplayerEngine = "Quake3.app";
847 mMultiplayerEngine = prop;
852 // on win32, engine path can now be specified relative to the exe's cwd
853 prop = (char*)xmlGetProp(pNode, (const xmlChar *)ENGINEPATH_ATTRIBUTE);
854 if ( prop != NULL ) {
857 _fullpath( full, prop, PATH_MAX );
859 strncpy( full, prop, PATH_MAX );
863 // process seperators
864 for ( p = full; *p != '\0'; p++ ) {
870 if ( p != full && *(p-1) != '/' ) {
876 // if engine path was not specified in the .game, it implies we can guess it from the gametools path
877 // on win32, and for most game package, the gametools are installed with the game
878 char aux_path[PATH_MAX]; // aux
879 strcpy( aux_path, mGameToolsPath.GetBuffer() );
880 if ( ( aux_path[ strlen(aux_path)-1 ] == '/' ) || ( aux_path[ strlen(aux_path)-1 ] == '\\' ) ) {
881 aux_path[strlen(aux_path)-1] = '\0'; // strip ending '/' if any
883 char up_path[PATH_MAX]; // up one level
884 ExtractFilePath( aux_path, up_path );
885 mEnginePath = up_path;
889 #if defined (__linux__) || defined (__APPLE__)
891 prop = (char*)xmlGetProp(pNode, (const xmlChar *)"prefix");
894 mUserPathPrefix = prop;
898 mShaderPath = xmlGetProp(pNode, (const xmlChar *)"shaderpath");
899 if (!mShaderPath.GetLength())
901 mShaderPath = "scripts/";
902 mShaderlist = "scripts/shaderlist.txt";
906 AddSlash(mShaderPath);
907 mShaderlist = mShaderPath;
908 mShaderlist += "shaderlist.txt";
910 xmlChar* default_scale = xmlGetProp(pNode, (const xmlChar *)"default_scale");
913 mTextureDefaultScale = atof((const char *)default_scale);
914 xmlFree(default_scale);
917 mTextureDefaultScale = 0.5f;
918 xmlChar* eclass_singleload = xmlGetProp(pNode, (const xmlChar*)"eclass_singleload");
919 if (eclass_singleload)
921 mEClassSingleLoad = true;
922 xmlFree(eclass_singleload);
925 mEClassSingleLoad = false;
926 xmlChar* no_patch = xmlGetProp(pNode, (const xmlChar *)"no_patch");
934 xmlChar* caulk_shader = xmlGetProp(pNode, (const xmlChar *)"caulk_shader");
937 mCaulkShader = caulk_shader;
938 xmlFree(caulk_shader);
941 mCaulkShader = "textures/common/caulk";
944 void CGameDescription::Dump()
947 if (CGameDialog::GetNetrun())
948 Sys_Printf("Running in network mode, prefs path set to '%s'\n", g_strTempPath.GetBuffer());
950 Sys_Printf("game name : '%s'\n", mGameName.GetBuffer());
951 Sys_Printf("game file : '%s'\n", mGameFile.GetBuffer());
952 Sys_Printf("game path : '%s'\n", mGameToolsPath.GetBuffer());
953 Sys_Printf("base game : '%s'\n", mBaseGame.GetBuffer());
954 Sys_Printf("engine path : '%s'\n", mEnginePath.GetBuffer());
955 Sys_Printf("engine : '%s'\n", mEngine.GetBuffer());
956 Sys_Printf("shaderlist : '%s'\n", mShaderlist.GetBuffer());
957 Sys_Printf("caulk shader: '%s'\n", mCaulkShader.GetBuffer());
958 #if defined (__linux__) || defined (__APPLE__)
959 Sys_Printf("prefix : '%s'\n", mUserPathPrefix.GetBuffer());
961 Sys_Printf("default texture scale: %g\n", mTextureDefaultScale);
962 Sys_Printf("single eclass load : %s\n", mEClassSingleLoad ? "Yes" : "No");
963 Sys_Printf("patches supported : %s\n", mNoPatch ? "No" : "Yes");
966 CPrefAssignment& CPrefAssignment::operator = (const CPrefAssignment& ass)
977 CPrefAssignment::CPrefAssignment(const CPrefAssignment& ass)
982 void CGameDialog::LoadPrefs()
984 // if we already have a document loaded, we will free and reload from file
985 if (mGlobalPrefs.InUse())
987 Sys_Printf("Reloading global prefs from file\n");
988 mGlobalPrefs.Clear();
991 // load global .pref file
992 CString strGlobalPref = g_PrefsDlg.m_global_rc_path->str;
993 strGlobalPref += "global.pref";
995 mGlobalPrefs.ReadXMLFile(strGlobalPref.GetBuffer());
997 mGlobalPrefs.GetPref("gamefile", &m_sGameFile, ""); // NOTE: there's no default, user HAS to select something
998 mGlobalPrefs.GetPref("autoload", &m_bAutoLoadGame, false);
999 mGlobalPrefs.GetPref("log console", &m_bLogConsole, false);
1000 // in a very particular post-.pid startup
1001 // we may have the console turned on and want to keep it that way
1002 // so we use a latching system
1003 if (m_bForceLogConsole)
1005 m_bLogConsole = true;
1006 Sys_Printf("console logging has been latched on, saving prefs\n");
1008 m_bForceLogConsole = false;
1011 // console logging: call Sys_LogConsole to check console logging status
1012 // it is important that we would log console as early as possible to make it useful
1015 if (mGlobalPrefs.mbEmpty)
1017 Sys_Printf("Saving global.pref with default pref values\n");
1022 void CGameDialog::SavePrefs()
1024 // update the tree and save it
1025 mGlobalPrefs.UpdatePrefTree();
1027 CString strGlobalPref = g_PrefsDlg.m_global_rc_path->str;
1028 strGlobalPref += "global.pref";
1030 if ( !mGlobalPrefs.WriteXMLFile( strGlobalPref.GetBuffer() ) ) {
1031 Sys_FPrintf(SYS_ERR, "Error occured while saving global prefs file '%s'\n", strGlobalPref.GetBuffer());
1035 void CGameDialog::DoGameInstall() {
1036 // make sure console logging is on whenever we enter the installation loop
1037 g_PrefsDlg.mGamesDialog.m_bLogConsole = true;
1042 void CGameDialog::DoGameDialog() {
1043 // allow looping the game selection dialog with calls to the game configure dialog in between
1044 while ( m_bDoGameInstall ) {
1046 m_bDoGameInstall = false;
1048 if ( DoModal() == IDCANCEL ) {
1049 Error( "game selection dialog canceled, cannot continue" );
1053 if ( m_bDoGameInstall ) {
1056 // and we will loop to do another DoModal dialog
1060 // unhook so we can use in other places
1061 // we manually incref'ed it when creating, it won't be freed (destructor)
1062 gtk_container_remove( GTK_CONTAINER( mTopBox ), GetGlobalFrame() );
1064 // we save the prefs file
1068 GtkWidget* CGameDialog::GetGlobalFrame()
1070 GtkWidget *vbox, *text, *combo, *check;
1072 if ( mFrame != NULL ) {
1076 mFrame = gtk_frame_new( NULL );
1077 gtk_container_set_border_width( GTK_CONTAINER( mFrame ), 5 );
1078 gtk_widget_show( mFrame );
1080 vbox = gtk_vbox_new( FALSE, 6 );
1081 gtk_widget_show( vbox );
1082 gtk_container_add( GTK_CONTAINER( mFrame ), vbox );
1083 gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
1085 text = gtk_label_new( _("Select the game:") );
1086 gtk_widget_show( text );
1087 gtk_box_pack_start( GTK_BOX( vbox ), text, FALSE, FALSE, 0 );
1089 combo = gtk_combo_box_new_text();
1090 gtk_widget_show( combo );
1091 gtk_box_pack_start( GTK_BOX( vbox ), combo, FALSE, FALSE, 0 );
1092 AddDialogData( combo, &m_nComboSelect, DLG_COMBO_BOX_INT );
1093 mGameCombo = GTK_COMBO_BOX( combo );
1097 check = gtk_check_button_new_with_label( _("Auto load selected game on startup") );
1098 gtk_widget_show(check);
1099 gtk_box_pack_start (GTK_BOX(vbox), check, FALSE, FALSE, 0);
1100 AddDialogData (check, &m_bAutoLoadGame, DLG_CHECK_BOOL);
1102 text = gtk_label_new(_("(this frame is available in the prefs menu if you set auto-select)"));
1103 gtk_widget_show(text);
1104 gtk_box_pack_start (GTK_BOX(vbox), text, FALSE, FALSE, 0);
1107 check = gtk_check_button_new_with_label( _("Networked install - per-user settings") );
1108 gtk_widget_show( check );
1109 gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 );
1110 AddDialogData( check, &m_bNetRun, DLG_CHECK_BOOL );
1113 check = gtk_check_button_new_with_label( _("Log the console to radiant.log") );
1114 gtk_widget_show( check );
1115 gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 );
1116 AddDialogData( check, &m_bLogConsole, DLG_CHECK_BOOL );
1118 // incref it so we can pass it around
1119 gtk_widget_ref( GTK_WIDGET( mFrame ) );
1124 void CGameDialog::UpdateData( bool retrieve ) {
1127 // use m_sGameFile to set m_nComboSelect
1128 list<CGameDescription *>::iterator iGame;
1130 for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++)
1132 if ((*iGame)->mGameFile == m_sGameFile)
1140 UpdateNetrun(false);
1143 Dialog::UpdateData(retrieve);
1146 // use m_nComboSelect to set m_sGameFile
1147 list<CGameDescription *>::iterator iGame = mGames.begin();
1149 for(i=0; i<m_nComboSelect; i++)
1153 m_sGameFile = (*iGame)->mGameFile;
1160 void CGameDialog::SInstallCallback( GtkWidget *widget, gpointer data ) {
1161 CGameDialog *d = static_cast< CGameDialog* >( data );
1162 d->m_bDoGameInstall = true;
1166 void CGameDialog::BuildDialog() {
1167 GtkWidget *dlg, *vbox1, *button, *setup_button;
1170 gtk_window_set_title( GTK_WINDOW( dlg ), _("Select Game") );
1172 vbox1 = gtk_vbox_new( FALSE, 0 );
1173 gtk_widget_show( vbox1 );
1174 gtk_container_add( GTK_CONTAINER( dlg ), vbox1 );
1176 gtk_container_add( GTK_CONTAINER( vbox1 ), GetGlobalFrame() );
1179 setup_button = gtk_button_new_with_label( _("Configure more games") );
1180 gtk_widget_show( setup_button );
1181 gtk_box_pack_start( GTK_BOX( vbox1 ), setup_button, FALSE, FALSE, 0 );
1182 gtk_signal_connect( GTK_OBJECT( setup_button ), "clicked",
1183 GTK_SIGNAL_FUNC( SInstallCallback ), this );
1185 button = gtk_button_new_with_label( _("OK") );
1186 gtk_widget_show( button );
1187 gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 );
1188 AddModalButton( button, IDOK );
1190 button = gtk_button_new_with_label( _("Cancel") );
1191 gtk_widget_show( button );
1192 gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 );
1193 AddModalButton( button, IDCANCEL );
1195 gtk_widget_set_usize( button, 60, -2 );
1198 void CGameDialog::UpdateGameCombo() {
1199 // fill in with the game descriptions
1200 list<CGameDescription *>::iterator iGame;
1202 if ( mGameCombo == NULL ) {
1203 Sys_Printf( "mGameCombo == NULL\n" );
1207 // clear whatever is in - wtf no way to know how many text entries?
1208 // use set/get active to track
1209 gtk_combo_box_set_active( mGameCombo, 0 );
1210 while ( gtk_combo_box_get_active( mGameCombo ) == 0 ) {
1211 gtk_combo_box_remove_text( mGameCombo, 0 );
1212 gtk_combo_box_set_active( mGameCombo, 0 );
1215 for ( iGame = mGames.begin(); iGame != mGames.end(); iGame++ ) {
1216 gtk_combo_box_append_text( mGameCombo, (*iGame)->mGameName.GetBuffer() );
1218 gtk_combo_box_set_active( mGameCombo, 0 );
1221 void CGameDialog::ScanForGames()
1226 CString strGamesPath = g_strAppPath.GetBuffer();
1227 strGamesPath += "games";
1228 const char *path = strGamesPath.GetBuffer();
1230 if ( !mGames.empty() ) {
1231 Sys_Printf( "Clearing game list\n" );
1232 list<CGameDescription*>::iterator iGame;
1233 for ( iGame = mGames.begin(); iGame != mGames.end(); iGame++ ) {
1239 Sys_Printf( "Scanning for game description files: %s\n", path );
1243 do we put game description files below g_strAppPath, or in ~/.radiant
1244 i.e. read only or read/write?
1245 my guess .. readonly cause it's an install
1246 we will probably want to add ~/.radiant/<version>/games/ scanning on top of that for developers
1247 (if that's really needed)
1250 // FIXME need to catch the 'no game description' situation and exit with a clean error
1252 dir = g_dir_open(path, 0, NULL);
1258 const gchar* name = g_dir_read_name(dir);
1262 dirlist = g_strdup(name);
1266 char *ext = strrchr (dirlist, '.');
1267 if ((ext == NULL) || (strcmp (ext, ".game") != 0))
1269 strPath.Format("%s/%s", path, dirlist);
1270 Sys_Printf("%s\n", strPath.GetBuffer());
1272 xmlDocPtr pDoc = xmlParseFile(strPath.GetBuffer());
1275 mGames.push_front( new CGameDescription( pDoc, dirlist ) );
1279 Sys_FPrintf(SYS_ERR, "XML parser failed on '%s'\n", strPath.GetBuffer());
1287 // entries in the combo need to be updated
1291 CGameDescription* CGameDialog::GameDescriptionForComboItem()
1293 list<CGameDescription *>::iterator iGame;
1295 for( iGame = mGames.begin(); iGame != mGames.end(); iGame++,i++ ) {
1296 if ( i == m_nComboSelect ) {
1300 return NULL; // not found
1303 void CGameDialog::InitGlobalPrefPath()
1305 GString *global_rc_path;
1306 // configure m_global_rc_path
1307 // this is the g_strTempPath, and it has already been mkdir'ed
1308 global_rc_path = g_string_new(g_strTempPath.GetBuffer());
1309 g_PrefsDlg.m_global_rc_path = global_rc_path;
1312 void CGameDialog::Reset()
1314 if (!g_PrefsDlg.m_global_rc_path)
1315 InitGlobalPrefPath();
1316 CString strGlobalPref = g_PrefsDlg.m_global_rc_path->str;
1317 strGlobalPref += "global.pref";
1318 remove(strGlobalPref.GetBuffer());
1321 void CGameDialog::Init()
1323 InitGlobalPrefPath();
1325 if ( mGames.empty() ) {
1328 if ( mGames.empty() ) {
1329 Error( "No games setup, aborting\n" );
1333 if ( m_bAutoLoadGame ) {
1334 // search by .game name
1335 list<CGameDescription *>::iterator iGame;
1336 for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++)
1338 if ((*iGame)->mGameFile == m_sGameFile)
1340 m_pCurrentGameDescription = (*iGame);
1345 if ( !m_bAutoLoadGame || !m_pCurrentGameDescription ) {
1347 // use m_nComboSelect to identify the game to run as and set the globals
1348 m_pCurrentGameDescription = GameDescriptionForComboItem();
1349 if ( !m_pCurrentGameDescription ) {
1350 Error("Lookup of game description object failed, can't continue\n");
1353 g_pGameDescription = m_pCurrentGameDescription;
1355 g_strGameToolsPath = g_pGameDescription->mGameToolsPath;
1357 // NOTE TTimo: this is moved from QE_LoadProject in 1.2
1358 // (probably broken)
1359 // NOTE Hydra: was broken for win32, we don't use m_strHomeGame or m_strFSBasePath
1360 #if defined (__linux__) || defined (__APPLE__)
1361 g_qeglobals.m_strHomeGame = g_get_home_dir();
1362 g_qeglobals.m_strHomeGame += "/";
1363 g_qeglobals.m_strHomeGame += m_pCurrentGameDescription->mUserPathPrefix.GetBuffer();
1364 g_qeglobals.m_strHomeGame += "/";
1366 g_qeglobals.m_strHomeGame = g_pGameDescription->mEnginePath.GetBuffer();
1369 g_pGameDescription->Dump();
1372 CGameDialog::~CGameDialog()
1376 // NOTE I'm not too sure how reliable this is
1377 gtk_widget_unref(GTK_WIDGET(mFrame));
1379 // free all the game descriptions
1380 list<CGameDescription *>::iterator iGame;
1381 for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++)
1388 void CGameDialog::AddPacksURL(Str &URL)
1390 // add the URLs for the list of game packs installed
1391 // FIXME: this is kinda hardcoded for now..
1392 list<CGameDescription *>::iterator iGame;
1393 for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++)
1395 if ((*iGame)->mGameFile == "q3.game")
1396 URL += "&Games_dlup%5B%5D=1";
1397 else if ((*iGame)->mGameFile == "wolf.game")
1398 URL += "&Games_dlup%5B%5D=2";
1399 // FIXME: double entry
1400 else if ((*iGame)->mGameFile == "wolf.game")
1401 URL += "&Games_dlup%5B%5D=3";
1402 else if ((*iGame)->mGameFile == "jk2.game")
1403 URL += "&Games_dlup%5B%5D=4";
1404 else if ((*iGame)->mGameFile == "stvef.game")
1405 URL += "&Games_dlup%5B%5D=5";
1406 else if ((*iGame)->mGameFile == "sof2.game")
1407 URL += "&Games_dlup%5B%5D=6";
1408 else if ((*iGame)->mGameFile == "ja.game")
1409 URL += "&Games_dlup%5B%5D=7";
1415 #define NETRUN_FILENAME "netrun.conf"
1417 bool CGameDialog::m_bNetRun;
1419 void CGameDialog::UpdateNetrun(bool retrieve)
1423 strNetrun = g_strAppPath; strNetrun += NETRUN_FILENAME;
1426 // now check if we are running from a network installation
1427 // use a dummy file as the flag
1428 f_netrun = fopen(strNetrun.GetBuffer(), "r");
1441 f_netrun = fopen(strNetrun.GetBuffer(), "w");
1444 Sys_FPrintf(SYS_ERR, "ERROR: Failed to create netrun file '%s'\n", strNetrun.GetBuffer());
1450 Sys_Printf("Created/Checked '%s'\n", strNetrun.GetBuffer());
1455 if (remove(strNetrun.GetBuffer()) == -1)
1457 if (errno != ENOENT)
1458 Sys_FPrintf(SYS_ERR, "Failed to remove netrun file '%s'\n", strNetrun.GetBuffer());
1463 Sys_Printf("Netrun mode is disabled\n");
1469 bool CGameDialog::GetNetrun()
1478 very first prefs init deals with selecting the game and the game tools path
1479 then we can load .ini stuff
1481 using prefs / ini settings:
1485 look in g_strGameToolsPath for .ini
1488 look in ~/.radiant/<version>/gamename
1492 #define PREFS_LOCAL_FILENAME "local.pref"
1494 void PrefsDlg::Init()
1496 mGamesDialog.Init();
1498 // m_global_rc_path has been set above, do m_rc_path with game specific stuff now
1499 // the win32 and linux versions have been unified for network mode
1501 if (!CGameDialog::GetNetrun())
1503 // legacy prefs settings, this goes where the game pack is installed
1504 m_rc_path = g_string_new (g_strGameToolsPath.GetBuffer() );
1505 m_inipath = g_string_new (m_rc_path->str);
1506 g_string_append (m_inipath, PREFS_LOCAL_FILENAME);
1510 // this is common to win32 and Linux init now
1511 m_rc_path = g_string_new (m_global_rc_path->str);
1514 g_string_append (m_rc_path, g_pGameDescription->mGameFile.GetBuffer());
1515 g_string_append (m_rc_path, "/");
1516 Q_mkdir (m_rc_path->str, 0775);
1518 // then the ini file
1519 m_inipath = g_string_new (m_rc_path->str);
1520 g_string_append (m_inipath, PREFS_LOCAL_FILENAME);
1524 void PrefsDlg::UpdateData (bool retrieve)
1526 // leo: the "changed" signal confuses the update function
1527 if (m_pWidget == NULL)
1529 mGamesDialog.UpdateData (retrieve);
1530 Dialog::UpdateData (retrieve);
1534 #define PREFSHSPACE 5
1536 #define PREFSHSPACE 0
1539 static void UpdateSensitivity( GtkWidget *widget, gpointer data )
1541 PrefsDlg *dlg = (PrefsDlg*)data;
1542 dlg->DoSensitivity();
1545 static void UpdateEditorSensitivity(GtkWidget *widget, gpointer data)
1547 PrefsDlg *dlg = (PrefsDlg*)data;
1548 dlg->DoEditorSensitivity();
1551 // start new prefs dialog
1553 /*! Utility function for swapping notebook pages for tree list selections */
1554 void PrefsDlg::showPrefPage(int prefpage)
1556 if(gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook)) != prefpage)
1557 gtk_notebook_set_page(GTK_NOTEBOOK(notebook), prefpage);
1562 static void treeSelection(GtkTreeSelection* selection, gpointer data)
1564 PrefsDlg *dlg = (PrefsDlg*)data;
1566 GtkTreeModel* model;
1567 GtkTreeIter selected;
1568 if(gtk_tree_selection_get_selected(selection, &model, &selected))
1571 gtk_tree_model_get(model, &selected, 1, (gpointer*)&prefpage, -1);
1572 dlg->showPrefPage(prefpage);
1576 void PrefsDlg::BuildDialog ()
1578 // Main Preferences dialog
1579 GtkWidget *dialog, *mainvbox, *hbox, *sc_win, *preflabel;
1581 // Widgets on notebook pages
1582 GtkWidget *check, *label, *scale, *hbox2, *combo,
1583 *table, *spin, *entry, *pixmap,
1584 *radio, *button, *pageframe, *vbox;
1586 GList *combo_list = (GList*)NULL;
1591 gtk_window_set_title(GTK_WINDOW(dialog), _("GtkRadiant Preferences"));
1592 gtk_widget_realize(dialog);
1594 mainvbox = gtk_vbox_new(FALSE, 5);
1595 gtk_container_add(GTK_CONTAINER(dialog), mainvbox);
1596 gtk_container_set_border_width(GTK_CONTAINER(mainvbox), 5);
1597 gtk_widget_show(mainvbox);
1599 hbox = gtk_hbox_new(FALSE, 5);
1600 gtk_widget_show(hbox);
1601 gtk_box_pack_end(GTK_BOX(mainvbox), hbox, FALSE, TRUE, 0);
1603 button = gtk_button_new_with_label(_("OK"));
1604 gtk_widget_show(button);
1605 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
1606 gtk_widget_set_usize(button, 60, -2);
1607 AddModalButton(button, IDOK);
1609 button = gtk_button_new_with_label(_("Cancel"));
1610 gtk_widget_show(button);
1611 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
1612 gtk_widget_set_usize(button, 60, -2);
1613 AddModalButton(button, IDCANCEL);
1615 button = gtk_button_new_with_label (_("Clean"));
1616 gtk_widget_show(button);
1617 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(OnButtonClean), this);
1618 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
1619 gtk_widget_set_usize (button, 60, -2);
1621 hbox = gtk_hbox_new(FALSE, 5);
1622 gtk_box_pack_start(GTK_BOX(mainvbox), hbox, TRUE, TRUE, 0);
1623 gtk_widget_show(hbox);
1625 sc_win = gtk_scrolled_window_new(NULL, NULL);
1626 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sc_win), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
1627 gtk_box_pack_start(GTK_BOX(hbox), sc_win, FALSE, FALSE, 0);
1628 gtk_widget_show(sc_win);
1630 // prefs pages notebook
1631 notebook = gtk_notebook_new();
1632 // hide the notebook tabs since its not supposed to look like a notebook
1633 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook), FALSE);
1634 gtk_box_pack_start(GTK_BOX(hbox), notebook, TRUE, TRUE, 0);
1635 gtk_widget_show(notebook);
1637 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sc_win), GTK_SHADOW_IN);
1640 GtkTreeStore* store = gtk_tree_store_new(2, G_TYPE_STRING, G_TYPE_POINTER);
1642 GtkWidget* view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
1643 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE);
1646 GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
1647 GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes(_("Preferences"), renderer, "text", 0, NULL);
1648 gtk_tree_view_append_column(GTK_TREE_VIEW(view), column);
1652 GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
1653 g_signal_connect(G_OBJECT(selection), "changed", G_CALLBACK(treeSelection), this);
1656 gtk_widget_show(view);
1658 gtk_container_add(GTK_CONTAINER (sc_win), view);
1661 /********************************************************************/
1662 /* Add preference tree options */
1663 /********************************************************************/
1666 gtk_tree_store_append(store, &group, NULL);
1667 gtk_tree_store_set(store, &group, 0, _("Globals"), 1, PTAB_FRONT, -1);
1670 gtk_tree_store_append(store, &tab, &group);
1671 gtk_tree_store_set(store, &tab, 0, _("Game settings"), 1, (gpointer)PTAB_GAME_SETTINGS, -1);
1677 gtk_tree_store_append(store, &group, NULL);
1678 gtk_tree_store_set(store, &group, 0, _("Display"), 1, PTAB_FRONT, -1);
1681 gtk_tree_store_append(store, &tab, &group);
1682 gtk_tree_store_set(store, &tab, 0, _("2D Display/Rendering"), 1, (gpointer)PTAB_2D, -1);
1686 gtk_tree_store_append(store, &tab, &group);
1687 gtk_tree_store_set(store, &tab, 0, _("3D View"), 1, (gpointer)PTAB_CAMERA, -1);
1691 gtk_tree_store_append(store, &tab, &group);
1692 gtk_tree_store_set(store, &tab, 0, _("Texture Settings"), 1, (gpointer)PTAB_TEXTURE, -1);
1698 gtk_tree_store_append(store, &group, NULL);
1699 gtk_tree_store_set(store, &group, 0, _("Interface"), 1, PTAB_FRONT, -1);
1702 gtk_tree_store_append(store, &tab, &group);
1703 gtk_tree_store_set(store, &tab, 0, _("Layout"), 1, (gpointer)PTAB_LAYOUT, -1);
1707 gtk_tree_store_append(store, &tab, &group);
1708 gtk_tree_store_set(store, &tab, 0, _("Mouse"), 1, (gpointer)PTAB_MOUSE, -1);
1712 gtk_tree_store_append(store, &tab, &group);
1713 gtk_tree_store_set(store, &tab, 0, _("Editing"), 1, (gpointer)PTAB_EDITING, -1);
1719 gtk_tree_store_append(store, &group, NULL);
1720 gtk_tree_store_set(store, &group, 0, _("Other"), 1, PTAB_FRONT, -1);
1723 gtk_tree_store_append(store, &tab, &group);
1724 gtk_tree_store_set(store, &tab, 0, _("Startup/Auto save"), 1, (gpointer)PTAB_STARTUP, -1);
1728 gtk_tree_store_append(store, &tab, &group);
1729 gtk_tree_store_set(store, &tab, 0, _("Paths"), 1, (gpointer)PTAB_PATHS, -1);
1733 gtk_tree_store_append(store, &tab, &group);
1734 gtk_tree_store_set(store, &tab, 0, _("Brush"), 1, (gpointer)PTAB_BRUSH, -1);
1738 gtk_tree_store_append(store, &tab, &group);
1739 gtk_tree_store_set(store, &tab, 0, _("Misc"), 1, (gpointer)PTAB_MISC, -1);
1741 if (!g_qeglobals.bBSPFrontendPlugin)
1744 gtk_tree_store_append(store, &tab, &group);
1745 gtk_tree_store_set(store, &tab, 0, _("BSP Monitoring"), 1, (gpointer)PTAB_BSPMONITOR, -1);
1750 gtk_tree_view_expand_all(GTK_TREE_VIEW(view));
1752 g_object_unref(G_OBJECT(store));
1755 /**********************************************************************/
1756 /* build the prefs pages */
1757 /**********************************************************************/
1760 // todo : add something interesting here
1761 // NOTE TTimo: tip of the day? or a logo?
1762 preflabel = gtk_label_new(_("Front Page"));
1763 gtk_widget_show(preflabel);
1764 pageframe = gtk_frame_new(NULL);
1765 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
1766 gtk_widget_show(pageframe);
1767 vbox = gtk_vbox_new(FALSE, 5);
1768 gtk_widget_show(vbox);
1769 gtk_widget_set_usize(GTK_WIDGET(vbox), 350, -2);
1770 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1771 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
1773 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
1775 /******** global preferences group ****************************/
1776 preflabel = gtk_label_new(_("Globals"));
1777 gtk_widget_show(preflabel);
1779 pageframe = mGamesDialog.GetGlobalFrame();
1780 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
1782 /******** 2D prefs group (xy views/rendering options) *********/
1783 preflabel = gtk_label_new(_("2D Display"));
1784 gtk_widget_show(preflabel);
1785 pageframe = gtk_frame_new(_("2D Display"));
1786 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
1787 gtk_widget_show(pageframe);
1788 vbox = gtk_vbox_new(FALSE, 5);
1789 gtk_widget_show(vbox);
1790 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1791 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
1793 // OpenGL Display Lists
1794 check = gtk_check_button_new_with_label(_("OpenGL Display Lists"));
1795 gtk_widget_show(check);
1796 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
1797 AddDialogData(check, &m_bDisplayLists, DLG_CHECK_BOOL);
1799 // Antialiased points & lines
1800 // Fishman - Add antialiazed points and lines support. 09/03/00
1801 check = gtk_check_button_new_with_label (_("OpenGL antialiased points and lines"));
1802 gtk_widget_show (check);
1803 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1804 AddDialogData (check, &m_bAntialiasedPointsAndLines, DLG_CHECK_BOOL);
1806 // Solid selection boxes
1807 check = gtk_check_button_new_with_label (_("Solid selection boxes"));
1808 gtk_widget_show (check);
1809 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1810 AddDialogData (check, &m_bNoStipple, DLG_CHECK_BOOL);
1812 // Display size info
1813 check = gtk_check_button_new_with_label (_("Display size info"));
1814 gtk_widget_show (check);
1815 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
1816 AddDialogData (check, &m_bSizePaint, DLG_CHECK_BOOL);
1818 // Alternate vertex/edge handles
1819 // Gef: Kyro GL_POINT work around 25-aug-2001
1820 check = gtk_check_button_new_with_label (_("Alternate vertex/edge handles"));
1821 gtk_widget_show(check);
1822 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
1823 AddDialogData(check, &m_bGlPtWorkaround, DLG_CHECK_BOOL);
1825 g_list_free (combo_list);
1829 check = gtk_check_button_new_with_label (_("ATI cards with broken drivers - bug #802"));
1830 gtk_widget_show(check);
1831 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
1832 AddDialogData(check, &m_bGlATIHack, DLG_CHECK_BOOL);
1835 // Add the page to the notebook
1836 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
1838 /******** 3D Camera view group *********/
1839 preflabel = gtk_label_new(_("3D View"));
1840 gtk_widget_show(preflabel);
1841 pageframe = gtk_frame_new(_("3D View"));
1842 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
1843 gtk_widget_show(pageframe);
1844 vbox = gtk_vbox_new(FALSE, 5);
1845 gtk_widget_show(vbox);
1846 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1847 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
1849 // Directional velocity (Movement Velocity)
1851 hbox2 = gtk_hbox_new (FALSE, 0);
1852 gtk_widget_show (hbox2);
1853 gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
1856 label = gtk_label_new(_("Movement Velocity"));
1857 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
1858 gtk_widget_show(label);
1859 gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
1862 adj = gtk_adjustment_new(100, 50, 300, 1, 10, 10);
1863 AddDialogData(adj, &m_nMoveSpeed, DLG_ADJ_INT);
1866 scale = gtk_hscale_new(GTK_ADJUSTMENT(adj));
1867 gtk_widget_show(scale);
1868 gtk_box_pack_start(GTK_BOX (vbox), scale, FALSE, TRUE, 2);
1870 gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
1872 // Angular velocity (Rotational Velocity)
1874 hbox2 = gtk_hbox_new (FALSE, 0);
1875 gtk_widget_show (hbox2);
1876 gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
1879 label = gtk_label_new (_("Rotational Velocity"));
1880 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
1881 gtk_widget_show (label);
1882 gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
1885 adj = gtk_adjustment_new (3, 1, 180, 1, 10, 10); // value, low, high, step, page_step, page_size
1886 AddDialogData (adj, &m_nAngleSpeed, DLG_ADJ_INT);
1889 scale = gtk_hscale_new (GTK_ADJUSTMENT (adj));
1890 gtk_widget_show (scale);
1891 gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, TRUE, 2);
1892 gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
1894 // Text under the velocity sliders
1896 hbox2 = gtk_hbox_new (FALSE, 0);
1897 gtk_widget_show (hbox2);
1898 gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
1901 label = gtk_label_new (_("slow"));
1902 gtk_widget_show (label);
1903 gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
1906 label = gtk_label_new (_("fast"));
1907 gtk_widget_show (label);
1908 gtk_box_pack_end (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
1910 // Allow drag to select multiple faces/brushes
1912 table = gtk_table_new(2, 1, FALSE);
1913 gtk_widget_show(table);
1914 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
1915 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
1916 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
1918 label = gtk_label_new (_("Use paint-select in camera view:"));
1919 gtk_widget_show (label);
1920 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
1921 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
1922 (GtkAttachOptions) (0),
1923 (GtkAttachOptions) (0), 0, 0);
1926 combo_list = g_list_append (combo_list, (void *)_("No"));
1927 combo_list = g_list_append (combo_list, (void *)_("Yes"));
1928 combo_list = g_list_append (combo_list, (void *)_("Yes (Classic Key Setup)"));
1930 combo = gtk_combo_new ();
1931 gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list);
1932 gtk_widget_show (combo);
1933 gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 0, 1,
1934 (GtkAttachOptions) (GTK_FILL),
1935 (GtkAttachOptions) (0), 0, 0);
1936 gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
1937 AddDialogData (combo, &m_nCamDragMultiSelect, DLG_COMBO_INT);
1939 // Freelook in Camera view
1940 check = gtk_check_button_new_with_label (_("Freelook in Camera view"));
1941 gtk_widget_show (check);
1942 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1943 gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT);
1944 AddDialogData (check, &m_bCamFreeLook, DLG_CHECK_BOOL);
1946 // Freelook in Camera view w/ forward & back strafing instead of up and down looking
1947 check = gtk_check_button_new_with_label (_("Freelook strafes Forward and Back"));
1948 gtk_widget_show (check);
1949 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1950 gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT);
1951 AddDialogData (check, &m_bCamFreeLookStrafe, DLG_CHECK_BOOL);
1953 // Invert mouse in freelook
1954 check = gtk_check_button_new_with_label (_("Invert mouse in freelook"));
1955 gtk_widget_show (check);
1956 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1957 gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT);
1958 AddDialogData (check, &m_bCamInverseMouse, DLG_CHECK_BOOL);
1960 // Discrete movement
1961 check = gtk_check_button_new_with_label (_("Discrete movement"));
1962 gtk_widget_show (check);
1963 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1964 gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT);
1965 AddDialogData (check, &m_bCamDiscrete, DLG_CHECK_BOOL);
1967 // Update XY views on camera move
1968 check = gtk_check_button_new_with_label (_("Update XY views on camera move"));
1969 gtk_widget_show (check);
1970 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1971 gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT);
1972 AddDialogData (check, &m_bCamXYUpdate, DLG_CHECK_BOOL);
1974 // Add the page to the notebook
1975 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
1977 /******** Texture group *********/
1978 preflabel = gtk_label_new(_("Textures"));
1979 gtk_widget_show(preflabel);
1980 pageframe = gtk_frame_new(_("Textures"));
1981 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
1982 gtk_widget_show(pageframe);
1983 vbox = gtk_vbox_new(FALSE, 6);
1984 gtk_widget_show(vbox);
1985 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1986 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
1988 // Texture quality slider
1990 label = gtk_label_new (_("Texture quality"));
1991 gtk_widget_show (label);
1992 gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
1993 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
1994 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
1997 adj = gtk_adjustment_new (0, 0, 4, 1, 1, 1);
1998 AddDialogData (adj, &m_nLatchedTextureQuality, DLG_ADJ_INT);
2001 scale = gtk_hscale_new (GTK_ADJUSTMENT (adj));
2002 gtk_widget_show (scale);
2003 gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
2004 gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
2006 // text under the texture slider
2007 hbox2 = gtk_hbox_new (FALSE, 0);
2008 gtk_widget_show (hbox2);
2009 gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
2010 label = gtk_label_new (_("low"));
2011 gtk_widget_show (label);
2012 gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
2013 label = gtk_label_new (_("high"));
2014 gtk_widget_show (label);
2015 gtk_box_pack_end (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
2018 check = gtk_check_button_new_with_label (_("Texture subsets"));
2019 gtk_widget_show (check);
2020 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2021 AddDialogData (check, &m_bTextureWindow, DLG_CHECK_BOOL);
2023 // texture scrollbar
2024 check = gtk_check_button_new_with_label (_("Texture scrollbar"));
2025 gtk_widget_show (check);
2026 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2027 AddDialogData (check, &m_bTextureScrollbar, DLG_CHECK_BOOL);
2029 // texture increment matches grid
2030 check = gtk_check_button_new_with_label (_("Tex increment matches grid"));
2031 gtk_widget_show (check);
2032 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2033 AddDialogData (check, &m_bSnapTToGrid, DLG_CHECK_BOOL);
2036 // Texture compression choice label
2038 table = gtk_table_new(2, 1, FALSE);
2039 gtk_widget_show(table);
2040 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2041 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2042 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2044 label = gtk_label_new (_("Texture Compression (if available):"));
2045 gtk_widget_show (label);
2046 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
2047 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
2048 (GtkAttachOptions) (0),
2049 (GtkAttachOptions) (0), 0, 0);
2050 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
2052 // Texture compression choice label
2054 // NONE will always be in pos 0
2055 combo_list = g_list_append (combo_list, (void *)_("None"));
2057 // if OpenGL compression is enabled it will always be
2059 if (g_qeglobals.m_bOpenGLCompressionSupported)
2061 combo_list = g_list_append (combo_list, (void *)_("OpenGL ARB"));
2064 // If S3 is enabled offer all 3 valid compression schemes in RGBA
2065 if (g_qeglobals.m_bS3CompressionSupported)
2067 combo_list = g_list_append (combo_list, (void *)_("S3TC DXT1"));
2068 combo_list = g_list_append (combo_list, (void *)_("S3TC DXT3"));
2069 combo_list = g_list_append (combo_list, (void *)_("S3TC DXT5"));
2072 combo = gtk_combo_new ();
2073 gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list);
2074 gtk_widget_show (combo);
2075 gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 0, 1,
2076 (GtkAttachOptions) (GTK_FILL),
2077 (GtkAttachOptions) (0), 0, 0);
2078 gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
2079 AddDialogData (combo, &m_nTextureCompressionFormat, DLG_COMBO_INT);
2080 g_list_free (combo_list);
2083 table = gtk_table_new(2, 1, FALSE);
2084 gtk_widget_show(table);
2085 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2086 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2087 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2091 label = gtk_label_new (_("Startup Shaders:"));
2092 gtk_widget_show (label);
2093 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
2094 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
2095 (GtkAttachOptions) (0),
2096 (GtkAttachOptions) (0), 0, 0);
2097 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
2101 combo_list = g_list_append (combo_list, (void *)_("None"));
2102 if (g_pGameDescription->mGameFile == "jk2.game" || g_pGameDescription->mGameFile == "ja.game")
2103 combo_list = g_list_append (combo_list, (void *)_("System"));
2104 else if (g_pGameDescription->mGameFile == "sof2.game")
2105 combo_list = g_list_append (combo_list, (void *)("Tools"));
2107 combo_list = g_list_append (combo_list, (void *)_("Common"));
2108 combo_list = g_list_append (combo_list, (void *)_("All"));
2109 combo = gtk_combo_new ();
2110 gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list);
2111 gtk_widget_show (combo);
2112 gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 0, 1,
2113 (GtkAttachOptions) (GTK_FILL),
2114 (GtkAttachOptions) (0), 0, 0);
2115 gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
2116 AddDialogData (combo, &m_nLatchedShader, DLG_COMBO_INT);
2117 g_list_free (combo_list);
2119 // Add the page to the notebook
2120 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2122 /******** Layout group *********/
2123 preflabel = gtk_label_new(_("Layout"));
2124 gtk_widget_show(preflabel);
2125 pageframe = gtk_frame_new(_("Layout"));
2126 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2127 gtk_widget_show(pageframe);
2128 vbox = gtk_vbox_new(FALSE, 5);
2129 gtk_widget_show(vbox);
2130 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2131 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2135 table = gtk_table_new (2, 4, FALSE);
2136 gtk_widget_show (table);
2137 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2138 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2139 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2142 pixmap = new_pixmap (g_pParentWnd->m_pWidget, "window1.bmp");
2143 gtk_widget_show (pixmap);
2144 gtk_table_attach (GTK_TABLE (table), pixmap, 0, 1, 0, 1,
2145 (GtkAttachOptions) (0),
2146 (GtkAttachOptions) (0), 0, 0);
2149 pixmap = new_pixmap (g_pParentWnd->m_pWidget, "window2.bmp");
2150 gtk_widget_show (pixmap);
2151 gtk_table_attach (GTK_TABLE (table), pixmap, 1, 2, 0, 1,
2152 (GtkAttachOptions) (0),
2153 (GtkAttachOptions) (0), 0, 0);
2156 pixmap = new_pixmap (g_pParentWnd->m_pWidget, "window3.bmp");
2157 gtk_widget_show (pixmap);
2158 gtk_table_attach (GTK_TABLE (table), pixmap, 2, 3, 0, 1,
2159 (GtkAttachOptions) (0),
2160 (GtkAttachOptions) (0), 0, 0);
2163 pixmap = new_pixmap (g_pParentWnd->m_pWidget, "window4.bmp");
2164 gtk_widget_show (pixmap);
2165 gtk_table_attach (GTK_TABLE (table), pixmap, 3, 4, 0, 1,
2166 (GtkAttachOptions) (0),
2167 (GtkAttachOptions) (0), 0, 0);
2169 // view type 1 selector
2170 radio = gtk_radio_button_new (NULL);
2171 gtk_widget_show (radio);
2172 gtk_table_attach (GTK_TABLE (table), radio, 0, 1, 1, 2,
2173 (GtkAttachOptions) (0),
2174 (GtkAttachOptions) (0), 0, 0);
2176 // view type 2 selector
2177 radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (radio));
2178 gtk_widget_show (radio);
2179 gtk_table_attach (GTK_TABLE (table), radio, 1, 2, 1, 2,
2180 (GtkAttachOptions) (0),
2181 (GtkAttachOptions) (0), 0, 0);
2183 // view type 3 selector
2184 radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (radio));
2185 gtk_widget_show (radio);
2186 gtk_table_attach (GTK_TABLE (table), radio, 2, 3, 1, 2,
2187 (GtkAttachOptions) (0),
2188 (GtkAttachOptions) (0), 0, 0);
2190 // view type 4 selector
2191 radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (radio));
2192 gtk_widget_show (radio);
2193 gtk_table_attach (GTK_TABLE (table), radio, 3, 4, 1, 2,
2194 (GtkAttachOptions) (0),
2195 (GtkAttachOptions) (0), 0, 0);
2196 AddDialogData (radio, &m_nLatchedView, DLG_RADIO_INT);
2198 // Floating Z window
2199 check = gtk_check_button_new_with_label (_("Floating Z Window"));
2200 gtk_widget_show (check);
2201 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2202 AddDialogData (check, &m_bLatchedFloatingZ, DLG_CHECK_BOOL);
2204 // show menu tear-off seperators
2205 check = gtk_check_button_new_with_label (_("Detachable Menus"));
2206 gtk_widget_show (check);
2207 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2208 AddDialogData (check, &m_bLatchedDetachableMenus, DLG_CHECK_BOOL);
2210 if (!g_pGameDescription->mNoPatch)
2212 // show patch toolbar
2213 check = gtk_check_button_new_with_label (_("Patch Toolbar"));
2214 gtk_widget_show (check);
2215 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2216 g_object_set_data (G_OBJECT (dialog), "check_patchtoolbar", check); // Allow to be disabled for Q1/Q2
2217 AddDialogData (check, &m_bLatchedPatchToolbar, DLG_CHECK_BOOL);
2221 check = gtk_check_button_new_with_label (_("Wide Toolbar"));
2222 gtk_widget_show (check);
2223 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2224 AddDialogData (check, &m_bLatchedWideToolbar, DLG_CHECK_BOOL);
2226 // use plugin toolbar
2227 check = gtk_check_button_new_with_label (_("Plugin Toolbar"));
2228 gtk_widget_show (check);
2229 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2230 AddDialogData (check, &m_bLatchedPluginToolbar, DLG_CHECK_BOOL);
2233 // win32 file dialog
2234 check = gtk_check_button_new_with_label (_("Use win32 file dialog (hacky)"));
2235 gtk_widget_show (check);
2236 // gtk_container_add (GTK_CONTAINER (vbox), check);
2237 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2238 AddDialogData (check, &m_bNativeGUI, DLG_CHECK_BOOL);
2240 // position on primary monitor
2241 check = gtk_check_button_new_with_label (_("Start on Primary Monitor"));
2242 gtk_widget_show (check);
2243 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2244 g_object_set_data (G_OBJECT (dialog), "check_startonprimary", check);
2245 gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateSensitivity), this );
2246 AddDialogData (check, &m_bStartOnPrimMon, DLG_CHECK_BOOL);
2249 // Add the page to the notebook
2250 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2252 /******** Mouse group *********/
2253 preflabel = gtk_label_new(_("Mouse"));
2254 gtk_widget_show(preflabel);
2255 pageframe = gtk_frame_new(_("Mouse"));
2256 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2257 gtk_widget_show(pageframe);
2258 vbox = gtk_vbox_new(FALSE, 5);
2259 gtk_widget_show(vbox);
2260 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2261 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2265 hbox2 = gtk_hbox_new (FALSE, 5);
2266 gtk_widget_show (hbox2);
2267 gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0);
2270 radio = gtk_radio_button_new_with_label (NULL, _("2 button"));
2271 gtk_widget_show (radio);
2272 gtk_box_pack_start (GTK_BOX (hbox2), radio, FALSE, FALSE, 0);
2275 radio = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio), _("3 button"));
2276 gtk_widget_show (radio);
2277 gtk_box_pack_start (GTK_BOX (hbox2), radio, FALSE, FALSE, 0);
2278 AddDialogData (radio, &m_nMouse, DLG_RADIO_INT);
2280 // right click to drop entity
2281 check = gtk_check_button_new_with_label (_("Right click to drop entities"));
2282 gtk_widget_show (check);
2283 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2284 AddDialogData (check, &m_bRightClick, DLG_CHECK_BOOL);
2286 // Mouse chaser (and this does what?)
2287 check = gtk_check_button_new_with_label (_("Mouse chaser"));
2288 gtk_widget_show (check);
2289 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2290 AddDialogData (check, &m_bChaseMouse, DLG_CHECK_BOOL);
2293 check = gtk_check_button_new_with_label (_("ALT + multi-drag"));
2294 gtk_widget_show (check);
2295 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2296 AddDialogData (check, &m_bALTEdge, DLG_CHECK_BOOL);
2298 // Mouse wheel increments
2300 hbox2 = gtk_hbox_new (FALSE, 5);
2301 gtk_widget_show (hbox2);
2302 gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0);
2305 label = gtk_label_new (_("Wheel Mouse inc:"));
2306 gtk_widget_show (label);
2307 gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
2310 entry = gtk_entry_new ();
2311 gtk_widget_show (entry);
2312 gtk_widget_set_usize (entry, 40, -2);
2313 gtk_box_pack_start (GTK_BOX (hbox2), entry, FALSE, FALSE, 0);
2314 AddDialogData (entry, &m_nWheelInc, DLG_ENTRY_INT);
2316 // Add the page to the notebook
2317 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2319 /******** Editing group *********/
2320 preflabel = gtk_label_new(_("Editing"));
2321 gtk_widget_show(preflabel);
2322 pageframe = gtk_frame_new(_("Editing"));
2323 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2324 gtk_widget_show(pageframe);
2325 vbox = gtk_vbox_new(FALSE, 5);
2326 gtk_widget_show(vbox);
2327 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2328 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2330 // Vertex editing splits faces
2331 check = gtk_check_button_new_with_label (_("Vertex editing splits face"));
2332 gtk_widget_show (check);
2333 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2334 AddDialogData (check, &m_bVertexSplit, DLG_CHECK_BOOL);
2336 // Fix target/targetname collisions
2337 check = gtk_check_button_new_with_label (_("Fix target/targetname collisions"));
2338 gtk_widget_show (check);
2339 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2340 AddDialogData (check, &m_bDoTargetFix, DLG_CHECK_BOOL);
2342 // Clipper tool uses caulk
2343 check = gtk_check_button_new_with_label (_("Clipper tool uses caulk"));
2344 gtk_widget_show (check);
2345 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2346 AddDialogData (check, &m_bClipCaulk, DLG_CHECK_BOOL);
2348 // Don't clamp plane points
2349 check = gtk_check_button_new_with_label (_("Don't clamp plane points"));
2350 gtk_widget_show (check);
2351 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2352 AddDialogData (check, &m_bNoClamp, DLG_CHECK_BOOL);
2355 check = gtk_check_button_new_with_label (_("Snap to grid"));
2356 gtk_widget_show (check);
2357 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2358 AddDialogData (check, &m_bSnap, DLG_CHECK_BOOL);
2360 // Select patch by bounding box
2361 check = gtk_check_button_new_with_label (_("Select patches by bounding box"));
2362 gtk_widget_show (check);
2363 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2364 AddDialogData (check, &m_bPatchBBoxSelect, DLG_CHECK_BOOL);
2366 // Rotation increment
2368 table = gtk_table_new (2, 3, FALSE);
2369 gtk_widget_show (table);
2370 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2371 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2372 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2375 label = gtk_label_new (_("Rotation increment:"));
2376 gtk_widget_show (label);
2377 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
2378 (GtkAttachOptions) (0),
2379 (GtkAttachOptions) (0), 0, 0);
2382 entry = gtk_entry_new ();
2383 gtk_widget_show (entry);
2384 gtk_widget_set_usize (entry, 60, -2);
2385 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1,
2386 (GtkAttachOptions) (GTK_FILL),
2387 (GtkAttachOptions) (0), 0, 0);
2388 AddDialogData (entry, &m_nRotation, DLG_ENTRY_INT);
2392 label = gtk_label_new (_("Undo Levels:"));
2393 gtk_widget_show (label);
2394 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
2395 (GtkAttachOptions) (0),
2396 (GtkAttachOptions) (0), 0, 0);
2398 // spinner (allows undo levels to be set to zero)
2399 spin = gtk_spin_button_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0, 64, 1, 10, 10)), 1, 0);
2400 gtk_widget_show (spin);
2401 gtk_table_attach (GTK_TABLE (table), spin, 1, 2, 1, 2,
2402 (GtkAttachOptions) (GTK_FILL),
2403 (GtkAttachOptions) (0), 0, 0);
2404 gtk_widget_set_usize (spin, 60, -2);
2405 AddDialogData (spin, &m_nUndoLevels, DLG_SPIN_INT);
2407 // Patch subdivisions
2409 label = gtk_label_new (_("Patch subdivisions:"));
2410 gtk_widget_show (label);
2411 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
2412 (GtkAttachOptions) (0),
2413 (GtkAttachOptions) (0), 0, 0);
2415 // entry (spinner perhaps? [2-16])
2416 entry = gtk_entry_new ();
2417 gtk_widget_show (entry);
2418 gtk_widget_set_usize (entry, 60, -2);
2419 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 2, 3,
2420 (GtkAttachOptions) (GTK_FILL),
2421 (GtkAttachOptions) (0), 0, 0);
2422 AddDialogData (entry, &m_nSubdivisions, DLG_ENTRY_INT);
2424 // Add the page to the notebook
2425 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2427 /******** Save/Load group *********/
2428 preflabel = gtk_label_new(_("Startup/Auto save"));
2429 gtk_widget_show(preflabel);
2430 pageframe = gtk_frame_new(_("Startup/Auto save"));
2431 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2432 gtk_widget_show(pageframe);
2433 vbox = gtk_vbox_new(FALSE, 5);
2434 gtk_widget_show(vbox);
2435 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2436 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2439 check = gtk_check_button_new_with_label (_("Snapshots"));
2440 gtk_widget_show (check);
2441 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2442 AddDialogData (check, &m_bSnapShots, DLG_CHECK_BOOL);
2444 // load last project on open
2445 check = gtk_check_button_new_with_label (_("Load last project on open"));
2446 gtk_widget_show (check);
2447 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2448 AddDialogData (check, &m_bLoadLast, DLG_CHECK_BOOL);
2450 // load last map on open
2451 check = gtk_check_button_new_with_label (_("Load last map on open"));
2452 gtk_widget_show (check);
2453 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2454 AddDialogData (check, &m_bLoadLastMap, DLG_CHECK_BOOL);
2458 hbox2 = gtk_hbox_new (FALSE, 5);
2459 gtk_widget_show (hbox2);
2460 gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0);
2461 gtk_container_set_border_width (GTK_CONTAINER (hbox2), 0);
2464 check = gtk_check_button_new_with_label (_("Auto save every"));
2465 gtk_widget_show (check);
2466 gtk_box_pack_start (GTK_BOX (hbox2), check, FALSE, FALSE, 0);
2467 AddDialogData (check, &m_bAutoSave, DLG_CHECK_BOOL);
2470 spin = gtk_spin_button_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 1, 60, 1, 10, 10)), 1, 0);
2471 gtk_widget_show (spin);
2472 gtk_box_pack_start (GTK_BOX (hbox2), spin, FALSE, FALSE, 0);
2473 gtk_widget_set_usize (spin, 60, -2);
2474 AddDialogData (spin, &m_nAutoSave, DLG_SPIN_INT);
2477 label = gtk_label_new (_("minutes"));
2478 gtk_widget_show (label);
2479 gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
2481 // Add the page to the notebook
2482 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2484 /******** Paths group *********/
2485 preflabel = gtk_label_new(_("Paths"));
2486 gtk_widget_show(preflabel);
2487 pageframe = gtk_frame_new(_("Paths"));
2488 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2489 gtk_widget_show(pageframe);
2490 vbox = gtk_vbox_new(FALSE, 5);
2491 gtk_widget_show(vbox);
2492 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2493 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2497 table = gtk_table_new (3, 3, FALSE);
2498 gtk_widget_show (table);
2499 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2500 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2501 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2504 label = gtk_label_new (_("Prefab path:"));
2505 gtk_widget_show (label);
2506 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
2507 (GtkAttachOptions) (0),
2508 (GtkAttachOptions) (0), 0, 0);
2509 gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
2512 entry = gtk_entry_new ();
2513 gtk_widget_show (entry);
2514 gtk_widget_set_usize(GTK_WIDGET(entry), 240, -2);
2515 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1,
2516 (GtkAttachOptions) (GTK_FILL),
2517 (GtkAttachOptions) (0), 1, 0);
2518 AddDialogData (entry, &m_strPrefabPath, DLG_ENTRY_TEXT);
2522 button = gtk_button_new_with_label ("...");
2523 gtk_widget_show (button);
2524 gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (OnBtnBrowseprefab), this);
2525 gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1,
2526 (GtkAttachOptions) (0),
2527 (GtkAttachOptions) (0), 0, 0);
2532 label = gtk_label_new (_("User INI path:"));
2533 gtk_widget_show (label);
2534 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
2535 (GtkAttachOptions) (0),
2536 (GtkAttachOptions) (0), 0, 0);
2537 gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
2539 // user ini path entry
2540 entry = gtk_entry_new ();
2541 gtk_widget_show (entry);
2542 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 1, 2,
2543 (GtkAttachOptions) (GTK_FILL),
2544 (GtkAttachOptions) (0), 1, 0);
2545 AddDialogData (entry, &m_strUserPath, DLG_ENTRY_TEXT);
2547 // user ini browse button
2548 button = gtk_button_new_with_label ("...");
2549 gtk_widget_show (button);
2550 gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (OnBtnBrowseuserini), this);
2551 gtk_table_attach (GTK_TABLE (table), button, 2, 3, 1, 2,
2552 (GtkAttachOptions) (0),
2553 (GtkAttachOptions) (0), 0, 0);
2555 // Add the page to the notebook
2556 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2558 /******** Brush group ********/
2559 preflabel = gtk_label_new(_("Brush"));
2560 gtk_widget_show(preflabel);
2561 pageframe = gtk_frame_new(_("Brush"));
2562 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2563 gtk_widget_show(pageframe);
2564 vbox = gtk_vbox_new(FALSE, 5);
2565 gtk_widget_show(vbox);
2566 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2567 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2569 // default texture scale
2571 table = gtk_table_new(2, 1, FALSE); // I believe that the 2 and 1 are switched here, and this is
2572 // intentional to be consistent with other calls to gtk_table_new()
2573 // [that are probably also switched].
2574 gtk_widget_show(table);
2575 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, TRUE, 0);
2576 gtk_table_set_row_spacings(GTK_TABLE(table), 5);
2577 gtk_table_set_col_spacings(GTK_TABLE(table), 5);
2580 label = gtk_label_new(_("Default texture scale:"));
2581 gtk_widget_show(label);
2582 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
2583 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
2584 (GtkAttachOptions) (0),
2585 (GtkAttachOptions) (0), 0, 0);
2588 entry = gtk_entry_new();
2589 gtk_widget_show(entry);
2590 gtk_widget_set_usize(GTK_WIDGET(entry), 60, -2);
2591 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1,
2592 (GtkAttachOptions) (GTK_FILL),
2593 (GtkAttachOptions) (0), 0, 0);
2594 AddDialogData(entry, &m_fDefTextureScale, DLG_ENTRY_FLOAT);
2596 // Add the page to the notebook
2597 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2599 /******** Misc group *********/
2600 preflabel = gtk_label_new(_("Misc"));
2601 gtk_widget_show(preflabel);
2602 pageframe = gtk_frame_new(_("Misc"));
2603 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2604 gtk_widget_show(pageframe);
2605 vbox = gtk_vbox_new(FALSE, 5);
2606 gtk_widget_show(vbox);
2607 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2608 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2611 check = gtk_check_button_new_with_label (_("Light drawing"));
2612 gtk_widget_show (check);
2613 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2614 AddDialogData (check, &m_bNewLightDraw, DLG_CHECK_BOOL);
2618 table = gtk_table_new(2, 1, FALSE);
2619 gtk_widget_show(table);
2620 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2621 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2622 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2624 label = gtk_label_new (_("Light radiuses:"));
2625 gtk_widget_show (label);
2626 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
2627 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
2628 (GtkAttachOptions) (0),
2629 (GtkAttachOptions) (0), 0, 0);
2632 combo_list = g_list_append (combo_list, (void *)_("Disabled"));
2633 combo_list = g_list_append (combo_list, (void *)_("True Q3Map2 Style"));
2634 combo_list = g_list_append (combo_list, (void *)_("Classic Style"));
2636 combo = gtk_combo_new ();
2637 gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list);
2638 gtk_widget_show (combo);
2639 gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 0, 1,
2640 (GtkAttachOptions) (GTK_FILL),
2641 (GtkAttachOptions) (0), 0, 0);
2642 gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
2643 AddDialogData (combo, &m_nLightRadiuses, DLG_COMBO_INT);
2646 check = gtk_check_button_new_with_label (_("Use win32 file associations to open text files instead of builtin editor"));
2647 gtk_widget_show(check);
2648 gtk_box_pack_start(GTK_BOX (vbox), check, FALSE, FALSE, 0);
2649 AddDialogData (check, &g_PrefsDlg.m_bUseWin32Editor, DLG_CHECK_BOOL);
2651 // use custom shader editor
2652 check = gtk_check_button_new_with_label (_("Use Custom Shader Editor"));
2653 gtk_widget_show(check);
2654 gtk_box_pack_start(GTK_BOX (vbox), check, FALSE, FALSE, 0);
2655 gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateEditorSensitivity), this);
2656 g_object_set_data (G_OBJECT(dialog), "check_customeditor", check);
2657 AddDialogData (check, &g_PrefsDlg.m_bUseCustomEditor, DLG_CHECK_BOOL);
2659 // custom shader editor executable
2661 table = gtk_table_new (3, 1, FALSE);
2662 gtk_widget_show (table);
2663 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2664 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2665 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2668 label = gtk_label_new(_("Custom Editor Command"));
2669 gtk_widget_show(label);
2670 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
2671 (GtkAttachOptions) (0),
2672 (GtkAttachOptions) (0), 0, 0);
2673 gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
2674 g_object_set_data (G_OBJECT(dialog), "label_customeditor", label);
2675 gtk_widget_set_sensitive (label, g_PrefsDlg.m_bUseCustomEditor);
2677 // custom editor command entry
2678 entry = gtk_entry_new ();
2679 gtk_widget_show (entry);
2680 gtk_widget_set_usize(GTK_WIDGET(entry), 240, -2);
2681 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1,
2682 (GtkAttachOptions) (GTK_FILL),
2683 (GtkAttachOptions) (0), 1, 0);
2684 AddDialogData (entry, &m_strEditorCommand, DLG_ENTRY_TEXT);
2685 gtk_widget_set_sensitive (entry, g_PrefsDlg.m_bUseCustomEditor);
2686 g_object_set_data (G_OBJECT(dialog), "entry_customeditor", entry);
2689 button = gtk_button_new_with_label (_("..."));
2690 gtk_widget_show (button);
2691 gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (OnBtnBrowseEditor), this);
2692 gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1,
2693 (GtkAttachOptions) (0),
2694 (GtkAttachOptions) (0), 0, 0);
2695 g_object_set_data (G_OBJECT(dialog), "button_customeditor", button);
2696 gtk_widget_set_sensitive (button, g_PrefsDlg.m_bUseCustomEditor);
2699 // Add the page to the notebook
2700 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2702 /******** BSP Monitoring group *********/
2703 // this is never displayed if the plugin isn't available
2704 preflabel = gtk_label_new(_("BSP Monitoring"));
2705 gtk_widget_show(preflabel);
2706 pageframe = gtk_frame_new(_("BSP Monitoring"));
2707 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2708 gtk_widget_show(pageframe);
2709 vbox = gtk_vbox_new(FALSE, 5);
2710 gtk_widget_show(vbox);
2711 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2712 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2714 // Enable BSP process monitoring
2715 check = gtk_check_button_new_with_label (_("Enable BSP process monitoring"));
2716 gtk_widget_show (check);
2717 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2718 g_object_set_data (G_OBJECT (dialog), "check_monitorbsp", check);
2719 gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateSensitivity), this );
2720 AddDialogData (check, &g_PrefsDlg.m_bWatchBSP, DLG_CHECK_BOOL);
2723 check = gtk_check_button_new_with_label (_("Stop compilation on leak"));
2724 gtk_widget_show (check);
2725 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2726 g_object_set_data (G_OBJECT (dialog), "check_leakstop", check);
2727 AddDialogData (check, &g_PrefsDlg.m_bLeakStop, DLG_CHECK_BOOL);
2729 // engine after compile
2730 check = gtk_check_button_new_with_label (_("Run engine after compile"));
2731 gtk_widget_show (check);
2732 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2733 g_object_set_data (G_OBJECT (dialog), "check_runengine", check);
2734 gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateSensitivity), this );
2735 AddDialogData( check, &g_PrefsDlg.m_bRunQuake, DLG_CHECK_BOOL );
2737 // sleep mode when running engine
2738 check = gtk_check_button_new_with_label (_("Activate sleep mode when running the engine"));
2739 gtk_widget_show (check);
2740 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2741 g_object_set_data (G_OBJECT (dialog), "check_sleep", check);
2742 AddDialogData( check, &g_PrefsDlg.m_bDoSleep, DLG_CHECK_BOOL );
2744 // use q3map2's texture projection
2745 check = gtk_check_button_new_with_label (_("Texturing compatible with q3map2"));
2746 gtk_widget_show (check);
2747 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2748 g_object_set_data (G_OBJECT (dialog), "check_q3map2", check);
2749 AddDialogData( check, &g_PrefsDlg.m_bQ3Map2Texturing, DLG_CHECK_BOOL );
2751 // Add the page to the notebook
2752 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2754 gtk_notebook_set_page(GTK_NOTEBOOK(notebook), PTAB_FRONT);
2759 // end new prefs dialog
2761 void PrefsDlg::LoadTexdefPref(texdef_t* pTexdef, char* pName)
2765 memset(pTexdef, 0, sizeof(texdef_t));
2767 sprintf(buffer, "%s%s", pName, TD_SCALE1_KEY);
2768 mLocalPrefs.GetPref(buffer, &pTexdef->scale[0], 0.5f);
2770 sprintf(buffer, "%s%s", pName, TD_SCALE2_KEY);
2771 mLocalPrefs.GetPref(buffer, &pTexdef->scale[1], 0.5f);
2773 sprintf(buffer, "%s%s", pName, TD_SHIFT1_KEY);
2774 mLocalPrefs.GetPref(buffer, &pTexdef->shift[0], 8.f);
2776 sprintf(buffer, "%s%s", pName, TD_SHIFT2_KEY);
2777 mLocalPrefs.GetPref(buffer, &pTexdef->shift[1], 8.f);
2779 sprintf(buffer, "%s%s", pName, TD_ROTATE_KEY);
2780 mLocalPrefs.GetPref(buffer, &pTexdef->rotate, 45);
2783 void PrefsDlg::UpdateTextureCompression()
2785 // if OpenGL is not ready yet, don't do anything
2786 if (!g_qeglobals.m_bOpenGLReady) {
2787 Sys_Printf("OpenGL not ready - postpone texture compression capability check\n");
2791 if (g_qeglobals.bTextureCompressionSupported)
2793 if (m_nTextureCompressionFormat >= 2 && !g_qeglobals.m_bS3CompressionSupported)
2795 Sys_Printf("Inconsistant pref setting for texture compression (%d), rolling back\n", m_nTextureCompressionFormat);
2796 m_nTextureCompressionFormat = 1; // if this is not supported either, see below
2798 if (m_nTextureCompressionFormat == 1 && !g_qeglobals.m_bOpenGLCompressionSupported)
2800 Sys_Printf("Inconsistant pref setting for texture compression (GL_COMPRESSED_RGBA), rolling back\n");
2801 m_nTextureCompressionFormat = 0;
2803 switch (m_nTextureCompressionFormat)
2807 g_qeglobals.texture_components = GL_RGBA;
2808 Sys_Printf("texture compression disabled by preferences settings\n");
2813 g_qeglobals.texture_components = GL_COMPRESSED_RGBA;
2814 Sys_Printf("OpenGL texture compression enabled\n");
2819 g_qeglobals.texture_components = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
2820 Sys_Printf("S3TC DXT1 texture compression enabled\n");
2825 g_qeglobals.texture_components = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
2826 Sys_Printf("S3TC DXT3 texture compression enabled\n");
2831 g_qeglobals.texture_components = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
2832 Sys_Printf("S3TC DXT5 texture compression enabled\n");
2839 Sys_Printf("texture compression is not supported by your current graphic card/drivers\n");
2840 g_qeglobals.texture_components = GL_RGBA;
2841 m_nTextureCompressionFormat = 0;
2846 void PrefsDlg::UpdateATIHack() {
2847 // if OpenGL is not ready yet, don't do anything
2848 if (!g_qeglobals.m_bOpenGLReady) {
2849 Sys_Printf("OpenGL not ready - postpone ATI bug workaround setup\n");
2854 qglCullFace = &qglCullFace_ATIHack;
2855 qglDisable = &qglDisable_ATIHack;
2856 qglEnable = &qglEnable_ATIHack;
2857 qglPolygonMode = &qglPolygonMode_ATIHack;
2858 Sys_Printf("ATI bug workaround enabled\n");
2860 qglCullFace = qglCullFace_real;
2861 qglDisable = qglDisable_real;
2862 qglEnable = qglEnable_real;
2863 qglPolygonMode = qglPolygonMode_real;
2864 Sys_Printf("ATI bug workaround disabled\n");
2869 // TTimo: m_strEnginePath has a special status, if not found in registry we need to
2870 // initiliaze it for sure. It is not totally failsafe but we can use the same
2871 // code than in q3map, expecting to find some "quake" above us. If not, we prompt
2872 // for the engine executable path
2873 void PrefsDlg::LoadPrefs ()
2877 // first things first, load prefs from global prefs
2878 mGamesDialog.LoadPrefs();
2880 // if we already have a document loaded, we will free and reload from file
2881 if (mLocalPrefs.InUse()) {
2882 mLocalPrefs.Clear();
2885 // load local.pref file
2886 mLocalPrefs.ReadXMLFile(m_inipath->str);
2888 mLocalPrefs.GetPref(PATCHSHOWBOUNDS_KEY, &g_bPatchShowBounds, FALSE);
2889 mLocalPrefs.GetPref(MOUSE_KEY, &m_nMouse, MOUSE_DEF);
2890 m_nMouseButtons = m_nMouse ? 3 : 2;
2893 // if it's not found here, mainframe.cpp will take care of finding one
2894 mLocalPrefs.GetPref(LASTPROJ_KEY, &m_strLastProject, "");
2895 mLocalPrefs.GetPref(LASTPROJVER_KEY, &m_nLastProjectVer, -1);
2898 // NOTE TTimo: I'm not sure why this is in prefs
2899 // should probably be a project setting
2900 // and I'm not sure that we really have a way to set this reliably either
2902 strPrefab = g_qeglobals.m_strHomeGame.GetBuffer();
2903 strPrefab += g_pGameDescription->mBaseGame.GetBuffer();
2904 strPrefab += "/prefabs/";
2905 mLocalPrefs.GetPref(PREFAB_KEY, &m_strPrefabPath, strPrefab);
2907 mLocalPrefs.GetPref(LASTLIGHTINTENSITY_KEY, &m_iLastLightIntensity, 300);
2908 mLocalPrefs.GetPref(TLOCK_KEY, &m_bTextureLock, TLOCK_DEF);
2909 mLocalPrefs.GetPref(RLOCK_KEY, &m_bRotateLock, TLOCK_DEF);
2910 mLocalPrefs.GetPref(LASTMAP_KEY, &m_strLastMap, "");
2911 mLocalPrefs.GetPref(LOADLAST_KEY, &m_bLoadLast, LOADLAST_DEF);
2912 mLocalPrefs.GetPref(BSP_KEY, &m_bInternalBSP, FALSE);
2913 mLocalPrefs.GetPref(RCLICK_KEY, &m_bRightClick, TRUE);
2914 mLocalPrefs.GetPref(AUTOSAVE_KEY, &m_bAutoSave, TRUE);
2915 mLocalPrefs.GetPref(LOADLASTMAP_KEY, &m_bLoadLastMap, FALSE);
2916 mLocalPrefs.GetPref(TINYBRUSH_KEY, &m_bCleanTiny, FALSE);
2917 mLocalPrefs.GetPref(TINYSIZE_KEY, &m_fTinySize, 0.5f);
2918 mLocalPrefs.GetPref(AUTOSAVETIME_KEY, &m_nAutoSave, 5);
2919 mLocalPrefs.GetPref(SNAPSHOT_KEY, &m_bSnapShots, FALSE);
2920 mLocalPrefs.GetPref(MOVESPEED_KEY, &m_nMoveSpeed, 100);
2921 mLocalPrefs.GetPref(ANGLESPEED_KEY, &m_nAngleSpeed, 3);
2922 mLocalPrefs.GetPref(SETGAME_KEY, &m_bSetGame, FALSE);
2923 mLocalPrefs.GetPref(CAMXYUPDATE_KEY, &m_bCamXYUpdate, TRUE);
2924 mLocalPrefs.GetPref(CAMDRAGMULTISELECT_KEY, &m_nCamDragMultiSelect, TRUE);
2925 mLocalPrefs.GetPref(CAMFREELOOK_KEY, &m_bCamFreeLook, TRUE);
2926 mLocalPrefs.GetPref(CAMINVERSEMOUSE_KEY, &m_bCamInverseMouse, FALSE);
2927 mLocalPrefs.GetPref(CAMDISCRETE_KEY, &m_bCamDiscrete, TRUE);
2928 mLocalPrefs.GetPref(LIGHTDRAW_KEY, &m_bNewLightDraw, TRUE);
2929 mLocalPrefs.GetPref(CUBICCLIP_KEY, &m_bCubicClipping, TRUE);
2930 mLocalPrefs.GetPref(CUBICSCALE_KEY, &m_nCubicScale, 13);
2931 mLocalPrefs.GetPref(ALTEDGE_KEY, &m_bALTEdge, FALSE);
2932 mLocalPrefs.GetPref(FACECOLORS_KEY, &m_bFaceColors, FALSE);
2933 mLocalPrefs.GetPref(XZVIS_KEY, &m_bXZVis, FALSE);
2934 mLocalPrefs.GetPref(YZVIS_KEY, &m_bYZVis, FALSE);
2935 mLocalPrefs.GetPref(ZVIS_KEY, &m_bZVis, FALSE);
2936 mLocalPrefs.GetPref(SIZEPAINT_KEY, &m_bSizePaint, FALSE);
2937 mLocalPrefs.GetPref(DLLENTITIES_KEY, &m_bDLLEntities, FALSE);
2939 mLocalPrefs.GetPref(DETACHABLEMENUS_KEY, &m_bLatchedDetachableMenus, TRUE);
2940 m_bDetachableMenus = m_bLatchedDetachableMenus;
2942 if (g_pGameDescription->mNoPatch)
2944 m_bPatchToolbar = false;
2948 mLocalPrefs.GetPref(PATCHTOOLBAR_KEY, &m_bLatchedPatchToolbar, TRUE);
2949 m_bPatchToolbar = m_bLatchedPatchToolbar;
2952 mLocalPrefs.GetPref(WIDETOOLBAR_KEY, &m_bLatchedWideToolbar, TRUE);
2953 m_bWideToolbar = m_bLatchedWideToolbar;
2955 mLocalPrefs.GetPref(PLUGINTOOLBAR_KEY, &m_bLatchedPluginToolbar, TRUE);
2956 m_bPluginToolbar = m_bLatchedPluginToolbar;
2958 mLocalPrefs.GetPref(WINDOW_KEY, (int*)&m_nLatchedView, WINDOW_DEF);
2959 m_nView = m_nLatchedView;
2961 mLocalPrefs.GetPref(FLOATINGZ_KEY, &m_bLatchedFloatingZ, FALSE);
2962 m_bFloatingZ = m_bLatchedFloatingZ;
2964 mLocalPrefs.GetPref(TEXTUREQUALITY_KEY, &m_nLatchedTextureQuality, 3);
2965 m_nTextureQuality = m_nLatchedTextureQuality;
2967 mLocalPrefs.GetPref(LOADSHADERS_KEY, &m_nLatchedShader, 0);
2968 m_nShader = m_nLatchedShader;
2970 mLocalPrefs.GetPref(NOCLAMP_KEY, &m_bNoClamp, FALSE);
2971 mLocalPrefs.GetPref(SNAP_KEY, &m_bSnap, TRUE);
2972 mLocalPrefs.GetPref(USERINI_KEY, &m_strUserPath, "");
2973 mLocalPrefs.GetPref(ROTATION_KEY, &m_nRotation, 45);
2974 mLocalPrefs.GetPref(CHASEMOUSE_KEY, &m_bChaseMouse, TRUE);
2975 mLocalPrefs.GetPref(ENTITYSHOW_KEY, &m_nEntityShowState, ENTITY_SKINNED_BOXED);
2977 // this will probably need to be 75 or 100 for Q1.
2978 mLocalPrefs.GetPref(TEXTURESCALE_KEY, &m_nTextureScale, 50);
2980 // FIXME: Hydra - actually, this stuff is Q1,Q2 and HL specific.
2981 if ( (g_pGameDescription->mGameFile == "hl.game") )
2983 // No BSP monitoring in the default compiler tools for Half-life (yet)
2984 mLocalPrefs.GetPref(WATCHBSP_KEY, &m_bWatchBSP, FALSE);
2986 // Texture subset on by default (HL specific really, because of halflife.wad's size)
2987 mLocalPrefs.GetPref(TEXTURE_KEY, &m_bTextureWindow, TRUE);
2989 else if (g_pGameDescription->quake2)
2991 // BSP monitoring is implemented in Quake2 and Heretic2 tools
2992 mLocalPrefs.GetPref(WATCHBSP_KEY, &m_bWatchBSP, TRUE);
2994 // Texture subset on by default (HL specific really, because of halflife.wad's size)
2995 mLocalPrefs.GetPref(TEXTURE_KEY, &m_bTextureWindow, TRUE);
2999 mLocalPrefs.GetPref(WATCHBSP_KEY, &m_bWatchBSP, WATCHBSP_DEF);
3000 mLocalPrefs.GetPref(TEXTURE_KEY, &m_bTextureWindow, FALSE);
3004 mLocalPrefs.GetPref(TEXTURESCROLLBAR_KEY, &m_bTextureScrollbar, TRUE);
3005 mLocalPrefs.GetPref(DISPLAYLISTS_KEY, &m_bDisplayLists, TRUE);
3006 mLocalPrefs.GetPref(ANTIALIASEDLINES_KEY, &m_bAntialiasedPointsAndLines, FALSE);
3007 mLocalPrefs.GetPref(SWITCHCLIP_KEY, &m_bSwitchClip, TRUE);
3008 mLocalPrefs.GetPref(SELWHOLEENTS_KEY, &m_bSelectWholeEntities, TRUE);
3009 mLocalPrefs.GetPref(SHOWSHADERS_KEY, &m_bShowShaders, TRUE);
3010 mLocalPrefs.GetPref(GLLIGHTING_KEY, &m_bGLLighting, FALSE);
3011 mLocalPrefs.GetPref(NOSTIPPLE_KEY, &m_bNoStipple, FALSE);
3012 mLocalPrefs.GetPref(UNDOLEVELS_KEY, &m_nUndoLevels, 30);
3013 mLocalPrefs.GetPref(VERTEXMODE_KEY, &m_bVertexSplit, TRUE);
3014 mLocalPrefs.GetPref(RUNQ2_KEY, &m_bRunQuake, RUNQ2_DEF);
3015 mLocalPrefs.GetPref(LEAKSTOP_KEY, &m_bLeakStop, TRUE);
3016 mLocalPrefs.GetPref(DOSLEEP_KEY, &m_bDoSleep, FALSE);
3017 mLocalPrefs.GetPref(SELECTCURVES_KEY, &m_bSelectCurves, TRUE);
3018 mLocalPrefs.GetPref(SELECTMODELS_KEY, &m_bSelectModels, TRUE);
3019 mLocalPrefs.GetPref(SHADERLISTONLY_KEY, &m_bTexturesShaderlistOnly, FALSE);
3020 mLocalPrefs.GetPref(DEFAULTTEXURESCALE_KEY, &m_fDefTextureScale, g_pGameDescription->mTextureDefaultScale);
3021 mLocalPrefs.GetPref(SUBDIVISIONS_KEY, &m_nSubdivisions, SUBDIVISIONS_DEF);
3022 mLocalPrefs.GetPref(CLIPCAULK_KEY, &m_bClipCaulk, FALSE);
3023 mLocalPrefs.GetPref(SNAPTTOGRID_KEY, &m_bSnapTToGrid, FALSE);
3024 mLocalPrefs.GetPref(TARGETFIX_KEY, &m_bDoTargetFix, TRUE);
3025 mLocalPrefs.GetPref(WHEELINC_KEY, &m_nWheelInc, 64);
3026 mLocalPrefs.GetPref(PATCHBBOXSEL_KEY, &m_bPatchBBoxSelect, FALSE);
3028 // Gef: Kyro GL_POINT workaround
3029 mLocalPrefs.GetPref(GLPOINTWORKAROUND_KEY, &m_bGlPtWorkaround, FALSE);
3031 // window positioning
3032 mLocalPrefs.GetPref(ENTITYSPLIT1_KEY, &mWindowInfo.nEntitySplit1, -1);
3033 mLocalPrefs.GetPref(ENTITYSPLIT2_KEY, &mWindowInfo.nEntitySplit2, -1);
3035 mLocalPrefs.GetPref(POSITIONX_KEY, &mWindowInfo.position.x, -1);
3036 mLocalPrefs.GetPref(POSITIONY_KEY, &mWindowInfo.position.y, -1);
3037 mLocalPrefs.GetPref(WIDTH_KEY, &mWindowInfo.position.w, -1);
3038 mLocalPrefs.GetPref(HEIGHT_KEY, &mWindowInfo.position.h, 450);
3040 const window_position_t default_window_pos = { 0, 0, 200, 200, };
3042 mLocalPrefs.GetPref(ENTITYWND_KEY, &mWindowInfo.posEntityWnd, default_window_pos);
3043 mLocalPrefs.GetPref(MAPINFOWND_KEY, &mWindowInfo.posMapInfoWnd, default_window_pos);
3044 mLocalPrefs.GetPref(CAMWND_KEY, &mWindowInfo.posCamWnd, default_window_pos);
3045 mLocalPrefs.GetPref(ZWND_KEY, &mWindowInfo.posZWnd, default_window_pos);
3046 mLocalPrefs.GetPref(XYWND_KEY, &mWindowInfo.posXYWnd, default_window_pos);
3047 mLocalPrefs.GetPref(YZWND_KEY, &mWindowInfo.posYZWnd, default_window_pos);
3048 mLocalPrefs.GetPref(XZWND_KEY, &mWindowInfo.posXZWnd, default_window_pos);
3049 mLocalPrefs.GetPref(PATCHWND_KEY, &mWindowInfo.posPatchWnd, default_window_pos);
3050 mLocalPrefs.GetPref(SURFACEWND_KEY, &mWindowInfo.posSurfaceWnd, default_window_pos);
3051 mLocalPrefs.GetPref(ENTITYINFOWND_KEY, &mWindowInfo.posEntityInfoWnd, default_window_pos);
3053 mLocalPrefs.GetPref(ZWIDTH_KEY, &mWindowInfo.nZWidth, 30);
3054 mLocalPrefs.GetPref(XYHEIGHT_KEY, &mWindowInfo.nXYHeight, 300);
3055 mLocalPrefs.GetPref(XYWIDTH_KEY, &mWindowInfo.nXYWidth, 300);
3056 mLocalPrefs.GetPref(CAMWIDTH_KEY, &mWindowInfo.nCamWidth, 200);
3057 mLocalPrefs.GetPref(CAMHEIGHT_KEY, &mWindowInfo.nCamHeight, 200);
3058 mLocalPrefs.GetPref(ZFLOATWIDTH_KEY, &mWindowInfo.nZFloatWidth, 300);
3060 mLocalPrefs.GetPref(STATE_KEY, &mWindowInfo.nState, SW_SHOW);
3064 mLocalPrefs.GetPref(COUNT_KEY, &m_nMRUCount, 0);
3065 for(i = 0; i < 4; i++)
3068 sprintf (buf, "%s%d", FILE_KEY, i);
3069 mLocalPrefs.GetPref(buf, &m_strMRUFiles[i], "");
3072 // some platform specific prefs
3074 mLocalPrefs.GetPref(NATIVEGUI_KEY, &m_bNativeGUI, TRUE);
3075 mLocalPrefs.GetPref(STARTONPRIMMON_KEY, &m_bStartOnPrimMon, FALSE);
3078 mLocalPrefs.GetPref(SI_TEXMENU_KEY, &g_qeglobals.d_savedinfo.iTexMenu, ID_VIEW_BILINEARMIPMAP);
3079 mLocalPrefs.GetPref(SI_GAMMA_KEY, &g_qeglobals.d_savedinfo.fGamma, 1.0f);
3080 mLocalPrefs.GetPref(SI_EXCLUDE_KEY, &g_qeglobals.d_savedinfo.exclude, 0); // nothing filtered by default
3081 mLocalPrefs.GetPref(SI_INCLUDE_KEY, &g_qeglobals.d_savedinfo.include, INCLUDE_NAMES | INCLUDE_COORDS | INCLUDE_ANGLES | INCLUDE_CAMERATINT);
3082 mLocalPrefs.GetPref(SI_SHOWNAMES_KEY, &g_qeglobals.d_savedinfo.show_names, FALSE);
3083 mLocalPrefs.GetPref(SI_SHOWCOORDS_KEY, &g_qeglobals.d_savedinfo.show_coordinates, TRUE);
3084 mLocalPrefs.GetPref(SI_SHOWANGLES_KEY, &g_qeglobals.d_savedinfo.show_angles, TRUE);
3085 mLocalPrefs.GetPref(SI_SHOWOUTLINES_KEY, &g_qeglobals.d_savedinfo.show_outline, FALSE);
3086 mLocalPrefs.GetPref(SI_SHOWAXIS_KEY, &g_qeglobals.d_savedinfo.show_axis, TRUE);
3087 mLocalPrefs.GetPref(SI_NOSELOUTLINES_KEY, &g_qeglobals.d_savedinfo.bNoSelectedOutlines, FALSE);
3089 mLocalPrefs.GetPref(SI_OUTLINESTYLE_KEY, &g_qeglobals.d_savedinfo.iSelectedOutlinesStyle, OUTLINE_ZBUF|OUTLINE_BSEL);
3091 LoadTexdefPref(&g_qeglobals.d_savedinfo.m_SIIncrement, SI_SURFACE_TEXDEF_KEY);
3092 LoadTexdefPref(&g_qeglobals.d_savedinfo.m_PIIncrement, SI_PATCH_TEXDEF_KEY);
3094 // text editor binding
3096 mLocalPrefs.GetPref(CUSTOMSHADEREDITOR_KEY, &m_bUseWin32Editor, TRUE);
3098 mLocalPrefs.GetPref(CUSTOMSHADEREDITOR_KEY, &m_bUseCustomEditor, FALSE);
3099 mLocalPrefs.GetPref(CUSTOMSHADEREDITORCOMMAND_KEY, &m_strEditorCommand, "");
3103 vec3_t vDefaultAxisColours[3] = {
3109 for(i = 0; i < 3; i++) {
3111 sprintf(buf, "%s%d", SI_AXISCOLORS_KEY, i);
3112 mLocalPrefs.GetPref(buf, g_qeglobals.d_savedinfo.AxisColors[i], vDefaultAxisColours[i]);
3115 vec3_t vDefaultColours[COLOR_LAST] = {
3116 {0.25f, 0.25f, 0.25f},
3118 {0.75f, 0.75f, 0.75f},
3120 {0.25f, 0.25f, 0.25f},
3133 for(i = 0; i < COLOR_LAST; i++) {
3135 sprintf(buf, "%s%d", SI_COLORS_KEY, i);
3136 mLocalPrefs.GetPref(buf, g_qeglobals.d_savedinfo.colors[i], vDefaultColours[i]);
3139 mLocalPrefs.GetPref(TEXTURECOMPRESSIONFORMAT_KEY, &m_nTextureCompressionFormat, 1);
3141 mLocalPrefs.GetPref(LIGHTRADIUS_KEY, &m_nLightRadiuses, TRUE);
3143 mLocalPrefs.GetPref(Q3MAP2TEX_KEY, &m_bQ3Map2Texturing, TRUE);
3146 mLocalPrefs.GetPref(ATIHACK_KEY, &m_bGlATIHack, FALSE);
3149 Undo_SetMaxSize(m_nUndoLevels); // set it internally as well / FIXME: why not just have one global value?
3151 UpdateTextureCompression();
3157 if (mLocalPrefs.mbEmpty)
3159 mLocalPrefs.mbEmpty = false;
3160 Sys_Printf("Saving local.pref with default pref values\n");
3165 void PrefsDlg::SavePrefs ()
3167 if (g_qeglobals.disable_ini)
3171 Sys_Printf("PrefsDlg::SavePrefs\n");
3174 // this will take care of copying back from the dialog to the variables
3175 // NOTE: it may be overkill to call systematically before a SavePrefs, but it's safer
3176 // this will also cause an UpdateData for the mGamesDialog
3179 mGamesDialog.SavePrefs();
3181 // update the tree and save it
3182 mLocalPrefs.UpdatePrefTree();
3183 if (!mLocalPrefs.WriteXMLFile(m_inipath->str))
3184 Sys_FPrintf(SYS_ERR, "Error occured while saving local prefs file '%s'\n", m_inipath->str);
3186 if ( m_nMouse == 0 ) {
3187 m_nMouseButtons = 2;
3189 m_nMouseButtons = 3;
3194 void PrefsDlg::PostModal (int code)
3199 // make sure the logfile is ok
3205 g_pParentWnd->SetGridStatus();
3206 Sys_UpdateWindows(W_ALL);
3207 if (m_nUndoLevels != 0)
3208 Undo_SetMaxSize(m_nUndoLevels);
3212 void PrefsDlg::DoEditorSensitivity()
3214 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(g_object_get_data (G_OBJECT(m_pWidget), "check_customeditor"))))
3216 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "label_customeditor")), TRUE);
3217 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "entry_customeditor")), TRUE);
3218 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "button_customeditor")), TRUE);
3222 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "label_customeditor")), FALSE);
3223 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "entry_customeditor")), FALSE);
3224 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "button_customeditor")), FALSE);
3228 void PrefsDlg::DoSensitivity()
3231 // first, look at the project file version ... will monitoring work?
3232 // project files now XML, guaranteed to be at least version 2
3233 if (0)//IntForKey( g_qeglobals.d_project_entity, "version" ) < 2)
3238 Msg = "The current project file (";
3239 Msg += g_PrefsDlg.m_strLastProject;
3240 Msg += ") is not at least version 2.\nI need version 2 or above to setup BSP monitoring correctly.";
3241 gtk_MessageBox(m_pWidget, Msg.GetBuffer(), MB_OK );
3246 // go ahead, disable everybuddy
3247 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_leakstop" )), FALSE );
3248 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_monitorbsp" )), FALSE );
3249 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_runengine" )), FALSE );
3250 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_sleep" )), FALSE );
3257 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_leakstop" )), TRUE );
3258 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_monitorbsp" )), TRUE );
3259 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_runengine" )), TRUE );
3260 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_sleep" )), TRUE );
3262 if ( ! gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( g_object_get_data( G_OBJECT(m_pWidget), "check_monitorbsp" ) ) ) )
3264 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_leakstop" )), FALSE );
3265 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_runengine" )), FALSE );
3266 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_sleep" )), FALSE );
3267 } else if (! gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( g_object_get_data( G_OBJECT(m_pWidget), "check_runengine" ) ) ) )
3269 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_sleep" )), FALSE );
3274 ============================================================
3276 ============================================================
3279 CGameInstall::CGameInstall() {
3280 memset( m_availGames, 0, sizeof( m_availGames ) );
3283 void CGameInstall::OnBtnBrowseEngine( GtkWidget *widget, gpointer data ) {
3284 Sys_Printf( "OnBtnBrowseEngine\n" );
3286 CGameInstall* i = static_cast<CGameInstall*>( data );
3287 char *dir = dir_dialog( i->m_pWidget, _("Select game directory"), NULL );
3289 i->UpdateData( TRUE );
3291 if ( dir != NULL ) {
3292 i->m_strEngine = dir;
3293 i->UpdateData( FALSE );
3298 void CGameInstall::OnGameSelectChanged( GtkWidget *widget, gpointer data ) {
3299 Sys_Printf( "OnGameSelectChanged\n" );
3301 CGameInstall* i = static_cast<CGameInstall*>( data );
3302 i->UpdateData( TRUE );
3303 i->m_strName = gtk_combo_box_get_active_text( GTK_COMBO_BOX( widget ) );
3304 i->UpdateData( FALSE );
3307 void CGameInstall::BuildDialog() {
3308 GtkWidget *dlg, *vbox1, *button, *text, *combo, *entry, *hbox;
3311 gtk_window_set_title( GTK_WINDOW( dlg ), _("Configure games") );
3313 vbox1 = gtk_vbox_new( FALSE, 0 );
3314 gtk_widget_show( vbox1 );
3315 gtk_container_add( GTK_CONTAINER( dlg ), vbox1 );
3317 text = gtk_label_new( _("Select the game to configure") );
3318 gtk_widget_show( text );
3319 gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 );
3321 combo = gtk_combo_box_new_text();
3322 gtk_widget_show( combo );
3323 gtk_box_pack_start( GTK_BOX( vbox1 ), combo, FALSE, FALSE, 0 );
3325 // GList *combo_list = NULL;
3327 while ( m_availGames[ iGame ] != GAME_NONE ) {
3328 switch ( m_availGames[ iGame ] ) {
3330 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Quake II") );
3333 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Quake III Arena and mods") );
3336 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Urban Terror (standalone)") );
3339 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("UFO: Alien Invasion") );
3342 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Quake2World") );
3345 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Warsow") );
3348 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Nexuiz") );
3350 case GAME_TREMULOUS:
3351 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Tremulous") );
3354 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Jedi Academy and mods") );
3357 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Reaction Quake 3") );
3362 AddDialogData( combo, &m_nComboSelect, DLG_COMBO_BOX_INT );
3363 gtk_signal_connect( GTK_OBJECT( combo ), "changed", G_CALLBACK( OnGameSelectChanged ), this );
3364 gtk_combo_box_set_active( GTK_COMBO_BOX( combo ), 0 ); // NOTE: will trigger signal
3366 text = gtk_label_new( _("Name:") );
3367 gtk_widget_show( text );
3368 gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 );
3370 entry = gtk_entry_new();
3371 gtk_widget_show( entry );
3372 gtk_box_pack_start( GTK_BOX( vbox1 ), entry, FALSE, FALSE, 0 );
3373 AddDialogData( entry, &m_strName, DLG_ENTRY_TEXT );
3375 text = gtk_label_new( _("Engine directory:") );
3376 gtk_widget_show( text );
3377 gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 );
3379 hbox = gtk_hbox_new( FALSE, 0 );
3380 gtk_widget_show( hbox );
3381 gtk_box_pack_start( GTK_BOX( vbox1 ), hbox, FALSE, FALSE, 0 );
3383 entry = gtk_entry_new();
3384 gtk_widget_show( entry );
3385 gtk_box_pack_start( GTK_BOX( hbox ), entry, FALSE, FALSE, 0 );
3386 AddDialogData( entry, &m_strEngine, DLG_ENTRY_TEXT );
3388 button = gtk_button_new_with_label (_("..."));
3389 gtk_widget_show( button );
3390 gtk_signal_connect( GTK_OBJECT( button ), "clicked", GTK_SIGNAL_FUNC( OnBtnBrowseEngine ), this );
3391 gtk_box_pack_start( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
3393 // this gets done in the project stuff atm
3395 text = gtk_label_new( _("Mod subdirectory:") );
3396 gtk_widget_show( text );
3397 gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 );
3399 entry = gtk_entry_new();
3400 gtk_widget_show( entry );
3401 gtk_box_pack_start( GTK_BOX( vbox1 ), entry, FALSE, FALSE, 0 );
3402 AddDialogData( entry, &m_strMod, DLG_ENTRY_TEXT );
3405 button = gtk_button_new_with_label( _("OK") );
3406 gtk_widget_show( button );
3407 gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 );
3408 AddModalButton( button, IDOK );
3410 button = gtk_button_new_with_label( _("Cancel") );
3411 gtk_widget_show( button );
3412 gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 );
3413 AddModalButton( button, IDCANCEL );
3415 gtk_widget_set_usize( button, 60, -2 );
3418 void CGameInstall::Run() {
3420 if ( m_availGames[0] == GAME_NONE ) {
3423 if ( DoModal() == IDCANCEL ) {
3424 Sys_Printf( "game dialog cancelled\n" );
3427 Sys_Printf( "combo: %d name: %s engine: %s mod: %s\n", m_nComboSelect, m_strName.GetBuffer(), m_strEngine.GetBuffer(), m_strMod.GetBuffer() );
3429 // write out the game file
3430 Str gameFilePath = g_strAppPath.GetBuffer();
3431 gameFilePath += "games/";
3432 gameFilePath += m_strName.GetBuffer();
3433 gameFilePath += ".game";
3434 Sys_Printf( "game file: %s\n", gameFilePath.GetBuffer() );
3436 FILE * fg = fopen( gameFilePath.GetBuffer(), "w" );
3438 Error( "Failed to open %s for writing\n", gameFilePath.GetBuffer() );
3440 fprintf( fg, "<?xml version=\"1.0\" encoding=\"iso-8859-1\" standalone=\"yes\"?>\n<game\n" );
3441 fprintf( fg, " name=\"%s\"\n", m_strName.GetBuffer() );
3442 fprintf( fg, " "ENGINEPATH_ATTRIBUTE"=\"%s\"\n", m_strEngine.GetBuffer() );
3443 switch ( m_availGames[ m_nComboSelect ] ) {
3445 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/Quake2Pack/game\"\n", g_strAppPath.GetBuffer() );
3446 fprintf( fg, " prefix=\".quake2\"\n" );
3447 Str source = g_strAppPath.GetBuffer();
3448 source += "installs/";
3450 source += "/install/";
3451 Str dest = m_strEngine.GetBuffer();
3452 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3453 fprintf( fg, " basegame=\"baseq2\"\n" );
3457 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/Q3Pack/game\"\n", g_strAppPath.GetBuffer() );
3458 fprintf( fg, " prefix=\".q3a\"\n" );
3459 Str source = g_strAppPath.GetBuffer();
3460 source += "installs/";
3462 source += "/install/";
3463 Str dest = m_strEngine.GetBuffer();
3464 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3465 fprintf( fg, " basegame=\"baseq3\"\n" );
3469 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/UrTPack/game\"\n", g_strAppPath.GetBuffer() );
3470 fprintf( fg, " prefix=\".q3a\"\n" );
3471 Str source = g_strAppPath.GetBuffer();
3472 source += "installs/";
3474 source += "/install/";
3475 Str dest = m_strEngine.GetBuffer();
3476 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3477 fprintf( fg, " basegame=\"q3ut4\"\n" );
3481 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/UFOAIPack/game\"\n", g_strAppPath.GetBuffer() );
3482 fprintf( fg, " prefix=\".ufoai\"\n" );
3483 Str source = g_strAppPath.GetBuffer();
3484 source += "installs/";
3485 source += UFOAI_PACK;
3486 source += "/install/";
3487 Str dest = m_strEngine.GetBuffer();
3488 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3489 fprintf( fg, " basegame=\"base\"\n" );
3493 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/Q2WPack/game\"\n", g_strAppPath.GetBuffer() );
3494 fprintf( fg, " prefix=\".quake2world\"\n" );
3495 Str source = g_strAppPath.GetBuffer();
3496 source += "installs/";
3498 source += "/install/";
3499 Str dest = m_strEngine.GetBuffer();
3500 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3501 fprintf( fg, " basegame=\"default\"\n" );
3505 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/WarsowPack/game\"\n", g_strAppPath.GetBuffer() );
3506 fprintf( fg, " prefix=\".warsow\"\n" );
3507 Str source = g_strAppPath.GetBuffer();
3508 source += "installs/";
3509 source += WARSOW_PACK;
3510 source += "/install/";
3511 Str dest = m_strEngine.GetBuffer();
3512 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3513 fprintf( fg, " basegame=\"basewsw\"\n" );
3517 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/NexuizPack/game\"\n", g_strAppPath.GetBuffer() );
3518 fprintf( fg, " prefix=\".nexuiz\"\n" );
3519 Str source = g_strAppPath.GetBuffer();
3520 source += "installs/";
3521 source += NEXUIZ_PACK;
3522 source += "/install/";
3523 Str dest = m_strEngine.GetBuffer();
3524 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3525 fprintf( fg, " basegame=\"data\"\n" );
3528 case GAME_TREMULOUS: {
3529 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/TremulousPack/game\"\n", g_strAppPath.GetBuffer() );
3530 fprintf( fg, " prefix=\".tremulous\"\n" );
3531 Str source = g_strAppPath.GetBuffer();
3532 source += "installs/";
3533 source += TREMULOUS_PACK;
3534 source += "/install/";
3535 Str dest = m_strEngine.GetBuffer();
3536 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3537 fprintf( fg, " basegame=\"base\"\n" );
3541 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/JAPack/game\"\n", g_strAppPath.GetBuffer() );
3542 fprintf( fg, " prefix=\".ja\"\n" );
3543 Str source = g_strAppPath.GetBuffer();
3544 source += "installs/";
3546 source += "/install/";
3547 Str dest = m_strEngine.GetBuffer();
3548 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3549 fprintf( fg, " basegame=\"base\"\n" );
3552 case GAME_REACTION: {
3553 fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/"REACTION_PACK"/game\"\n", g_strAppPath.GetBuffer() );
3554 fprintf( fg, " prefix=\".Reaction\"\n" );
3555 Str source = g_strAppPath.GetBuffer();
3556 source += "installs/";
3557 source += REACTION_PACK;
3558 source += "/install/";
3559 Str dest = m_strEngine.GetBuffer();
3560 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3561 fprintf( fg, " basegame=\"Boomstick\"\n" );
3562 fprintf( fg, " default_scale=\"0.5\"\n" ); // Superfluous because the default is already 0.5,
3563 // but demonstrates how to set the default texture scale
3564 // for a specific game.
3568 fprintf( fg, "/>\n" );
3574 CGameInstall::ScanGames
3575 scan for active games that can be installed, based on the presence
3578 void CGameInstall::ScanGames() {
3579 Str pakPaths = g_strAppPath.GetBuffer();
3581 const char *dirname;
3583 pakPaths += "installs/";
3584 FindFiles fileScan( pakPaths.GetBuffer() );
3585 while ( ( dirname = fileScan.NextFile() ) != NULL ) {
3586 if ( stricmp( dirname, Q3_PACK ) == 0 ) {
3587 m_availGames[ iGame++ ] = GAME_Q3;
3589 if ( stricmp( dirname, URT_PACK ) == 0 ) {
3590 m_availGames[ iGame++ ] = GAME_URT;
3592 if ( stricmp( dirname, UFOAI_PACK ) == 0 ) {
3593 m_availGames[ iGame++ ] = GAME_UFOAI;
3595 if ( stricmp( dirname, Q2W_PACK ) == 0 ) {
3596 m_availGames[ iGame++ ] = GAME_Q2W;
3598 if ( stricmp( dirname, WARSOW_PACK ) == 0 ) {
3599 m_availGames[ iGame++ ] = GAME_WARSOW;
3601 if ( stricmp( dirname, NEXUIZ_PACK ) == 0 ) {
3602 m_availGames[ iGame++ ] = GAME_NEXUIZ;
3604 if ( stricmp( dirname, Q2_PACK ) == 0 ) {
3605 m_availGames[ iGame++ ] = GAME_Q2;
3607 if ( stricmp( dirname, TREMULOUS_PACK ) == 0 ) {
3608 m_availGames[ iGame++ ] = GAME_TREMULOUS;
3610 if ( stricmp( dirname, JA_PACK ) == 0 ) {
3611 m_availGames[ iGame++ ] = GAME_JA;
3613 if ( stricmp( dirname, REACTION_PACK ) == 0 ) {
3614 m_availGames[ iGame++ ] = GAME_REACTION;
3617 Sys_Printf("No installable games found in: %s\n",
3618 pakPaths.GetBuffer() );