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)
31 #if defined (__linux__) || defined (__APPLE__)
33 #include <sys/types.h>
47 #define PREF_SECTION "Prefs"
48 #define INTERNAL_SECTION "Internals"
49 #define MOUSE_KEY "MouseButtons"
50 #define WINDOW_KEY "QE4StyleWindows"
51 #define LAYOUT_KEY "WindowLayout"
52 #define RUNQ2_KEY "RunQuake2Run"
53 #define TLOCK_KEY "TextureLock"
54 #define RLOCK_KEY "RotateLock"
55 #define LOADLAST_KEY "LoadLast"
56 #define LOADLASTMAP_KEY "LoadLastMap"
57 #define LASTPROJ_KEY "LastProject"
58 #define LASTPROJVER_KEY "LastProjectKey"
59 #define LASTMAP_KEY "LastMap"
60 #define FACE_KEY "NewFaceGrab"
61 #define BSP_KEY "InternalBSP"
62 #define RCLICK_KEY "NewRightClick"
63 #define VERTEX_KEY "NewVertex"
64 #define AUTOSAVE_KEY "Autosave"
65 #define AUTOSAVETIME_KEY "AutosaveMinutes"
66 #define PAK_KEY "UsePAK"
67 #define NEWAPPLY_KEY "ApplyDismissesSurface"
68 #define HACK_KEY "Gatewayescapehack"
69 #define TEXTURE_KEY "NewTextureWindowStuff"
70 #define TINYBRUSH_KEY "CleanTinyBrushes"
71 #define TINYSIZE_KEY "CleanTinyBrusheSize"
72 #define SNAPSHOT_KEY "Snapshots"
73 #define MOVESPEED_KEY "MoveSpeed"
74 #define ANGLESPEED_KEY "AngleSpeed"
75 #define SETGAME_KEY "UseSetGame"
76 #define CAMXYUPDATE_KEY "CamXYUpdate"
77 #define CAMDRAGMULTISELECT_KEY "CamDragMultiSelect"
78 #define CAMFREELOOK_KEY "CamFreeLook"
79 #define CAMINVERSEMOUSE_KEY "CamInverseMouse"
80 #define CAMDISCRETE_KEY "CamDiscrete"
81 #define LIGHTDRAW_KEY "NewLightStyle"
82 #define WHATGAME_KEY "WhichGame"
83 #define CUBICCLIP_KEY "CubicClipping"
84 #define CUBICSCALE_KEY "CubicScale"
85 #define ALTEDGE_KEY "ALTEdgeDrag"
86 #define FACECOLORS_KEY "FaceColors"
87 #define SNAPT_KEY "SnapT"
88 #define XZVIS_KEY "XZVIS"
89 #define YZVIS_KEY "YZVIS"
90 #define ZVIS_KEY "ZVIS"
91 #define SIZEPAINT_KEY "SizePainting"
92 #define DLLENTITIES_KEY "DLLEntities"
93 #define DETACHABLEMENUS_KEY "DetachableMenus"
94 #define PATCHTOOLBAR_KEY "PatchToolBar"
95 #define WIDETOOLBAR_KEY "WideToolBar"
96 #define PLUGINTOOLBAR_KEY "PluginToolBar"
97 #define NOCLAMP_KEY "NoClamp"
98 #define PREFAB_KEY "PrefabPath"
99 #define USERINI_KEY "UserINIPath"
100 #define ROTATION_KEY "Rotation"
101 #define BUGGYICD_KEY "BuggyICD"
102 #define CHASEMOUSE_KEY "ChaseMouse"
103 #define ENTITYSHOW_KEY "EntityShow"
104 #define TEXTURESCALE_KEY "TextureScale"
105 #define TEXTURESCROLLBAR_KEY "TextureScrollbar"
106 #define DISPLAYLISTS_KEY "UseDisplayLists"
107 #define ANTIALIASEDLINES_KEY "UseAntialiasedPointsAndLines" // Fishman - Add antialiazed points and lines support. 09/03/00
108 #define NORMALIZECOLORS_KEY "NormalizeColors"
109 #define SHADERS_KEY "UseShaders"
110 #define SWITCHCLIP_KEY "SwitchClipKey"
111 #define SELWHOLEENTS_KEY "SelectWholeEntitiesKey"
112 #define TEXTURESUBSET_KEY "UseTextureSubsetLoading"
113 #define TEXTUREQUALITY_KEY "TextureQuality"
114 #define SHOWSHADERS_KEY "ShowShaders"
115 #define SHADERTEST_KEY "ShaderTest"
116 #define GLLIGHTING_KEY "UseGLLighting"
117 #define LOADSHADERS_KEY "LoadShaders"
118 #define NOSTIPPLE_KEY "NoStipple"
119 #define UNDOLEVELS_KEY "UndoLevels"
120 #define VERTEXMODE_KEY "VertexSplit"
121 #define ENGINEPATH_KEY "EnginePath"
122 #define ENGINE_KEY "Engine"
123 #define LOGCONSOLE_KEY "LogConsole"
124 #define SELECTCURVES_KEY "SelectCurves"
125 #define SELECTMODELS_KEY "SelectModels"
126 #define SHADERLISTONLY_KEY "ShowShaderlistOnly"
127 #define WATCHBSP_KEY "WatchBSP"
128 #define LEAKSTOP_KEY "LeakStop"
129 #define DOSLEEP_KEY "SleepMode"
130 #define SUBDIVISIONS_KEY "Subdivisions"
131 #define CLIPCAULK_KEY "ClipCaulk"
132 #define PATCHSHOWBOUNDS_KEY "PatchShowBounds"
133 #define NATIVEGUI_KEY "NativeGUI"
134 #define STARTONPRIMMON_KEY "StartOnPrimMon"
135 #define NOSYSMENUPOPUPS_KEY "NoSysMenuPopups"
136 #define SNAPTTOGRID_KEY "SnapTToGrid"
137 #define FLOATINGZ_KEY "FloatingZ"
138 #define TARGETFIX_KEY "TargetFix"
139 #define GLPOINTWORKAROUND_KEY "GlPointWorkaround" // Gef: Workaround for broken Kyro * gl driver 25-aug-2001
140 #define WHEELINC_KEY "WheelMouseInc"
141 #define PATCHBBOXSEL_KEY "PatchBBoxSel"
142 #define LASTLIGHTINTENSITY_KEY "LastLightIntensity"
143 #define CUSTOMSHADEREDITOR_KEY "UseCustomShaderEditor"
144 #define CUSTOMSHADEREDITORCOMMAND_KEY "CustomShaderEditorCommand"
145 #define TEXTURECOMPRESSIONFORMAT_KEY "TextureCompressionFormat"
146 #define LIGHTRADIUS_KEY "LightRadiuses"
147 #define Q3MAP2TEX_KEY "Q3Map2Tex"
148 #define ATIHACK_KEY "ATIHack"
151 #define ENTITYSPLIT1_KEY "EntitySplit1"
152 #define ENTITYSPLIT2_KEY "EntitySplit2"
153 #define POSITIONX_KEY "PositionX"
154 #define POSITIONY_KEY "PositionY"
155 #define ENTITYWND_KEY "EntityWnd"
156 #define MAPINFOWND_KEY "MapInfoDlg"
157 #define CAMWND_KEY "CamWnd"
158 #define ZWND_KEY "ZWnd"
159 #define XYWND_KEY "XYWnd"
160 #define XZWND_KEY "XZWnd"
161 #define YZWND_KEY "YZWnd"
162 #define PATCHWND_KEY "PatchWnd"
163 #define SURFACEWND_KEY "SurfaceWnd"
164 #define ENTITYINFOWND_KEY "EntityInfoDlg"
165 #define WIDTH_KEY "Width"
166 #define HEIGHT_KEY "Height"
167 #define ZWIDTH_KEY "ZWidth"
168 #define XYHEIGHT_KEY "XYHeight"
169 #define XYWIDTH_KEY "XYWidth"
170 #define CAMWIDTH_KEY "CamWidth"
171 #define CAMHEIGHT_KEY "CamHeight"
172 #define ZFLOATWIDTH_KEY "ZWidthFloating"
173 #define STATE_KEY "State"
176 #define COUNT_KEY "Count"
177 #define FILE_KEY "File"
180 #define SI_TEXMENU_KEY "SI_TexMenu"
181 #define SI_GAMMA_KEY "SI_Gamma"
182 #define SI_COLORS_KEY "SI_Colors"
183 #define SI_EXCLUDE_KEY "SI_Exclude"
184 #define SI_INCLUDE_KEY "SI_Include"
185 #define SI_SURFACE_TEXDEF_KEY "SI_SurfaceTexdef"
186 #define SI_PATCH_TEXDEF_KEY "SI_PatchTexdef"
187 #define SI_AXISCOLORS_KEY "SI_AxisColors"
188 #define SI_SHOWNAMES_KEY "SI_ShowNames"
189 #define SI_SHOWCOORDS_KEY "SI_ShowCoords"
190 #define SI_SHOWANGLES_KEY "SI_ShowAngles"
191 #define SI_SHOWOUTLINES_KEY "SI_ShowOutlines"
192 #define SI_SHOWAXIS_KEY "SI_ShowAxis"
193 #define SI_NOSELOUTLINES_KEY "SI_NoSelectedOutlines"
194 #define SI_OUTLINESTYLE_KEY "SI_OutLineStyle"
197 #define TD_SCALE1_KEY "_Scale1"
198 #define TD_SCALE2_KEY "_Scale2"
199 #define TD_SHIFT1_KEY "_Shift1"
200 #define TD_SHIFT2_KEY "_Shift2"
201 #define TD_ROTATE_KEY "_Rotate"
206 #define WATCHBSP_DEF 1
208 #define LOADLAST_DEF 1
210 #define SUBDIVISIONS_DEF 4
212 void WindowPosition_Parse(window_position_t& m_value, const CString& value)
214 if(sscanf(value.GetBuffer(), "%d %d %d %d", &m_value.x, &m_value.y, &m_value.w, &m_value.h) != 4)
215 m_value.x = m_value.y = m_value.w = m_value.h = -1;
218 void WindowPosition_Write(const window_position_t& m_value, CString& value)
221 sprintf(buffer, "%d %d %d %d", m_value.x, m_value.y, m_value.w, m_value.h);
226 CXMLPropertyBag::CXMLPropertyBag() {
232 // generic preference functions
234 void CXMLPropertyBag::PushAssignment(char *name, PrefTypes_t type, void *pV)
236 list<CPrefAssignment>::iterator iAssign;
237 for(iAssign=mPrefAssignments.begin(); iAssign!=mPrefAssignments.end(); iAssign++)
239 if ((*iAssign).mName == name)
241 // we have it already, check anyway
242 if (pV != (*iAssign).mVal)
244 Sys_FPrintf(SYS_ERR, "PushAssignment, '%s' has different mVal\n", name);
249 // ok, it's not in our list yet
250 mPrefAssignments.push_front(CPrefAssignment(name, type, pV));
253 xmlNodePtr CXMLPropertyBag::EpairForName(const char *name)
255 xmlNodePtr ret = NULL;
257 xmlNodePtr pNode = mpDocNode->children;
258 while (pNode != NULL)
260 if(pNode->type == XML_ELEMENT_NODE)
262 xmlAttrPtr tmp_attr_ptr = xmlHasProp(pNode, (xmlChar *)"name");
263 if (tmp_attr_ptr != NULL && !strcmp(name, (char *)tmp_attr_ptr->children->content))
266 Sys_FPrintf( SYS_WRN, "WARNING: dupe property in CXMLPropertyBag::EpairForName '%s'\n", name );
277 void CXMLPropertyBag::GetPref(char *name, Str *pV, char *V)
279 xmlNodePtr pNode = EpairForName( name );
282 if ( pNode->children && pNode->children->content ) {
283 *pV = pNode->children->content;
285 // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=427
286 // means the pref exists, and that the value is ""
292 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)V);
293 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
295 // push the pref assignment if needed
296 PushAssignment(name, PREF_STR, pV);
299 void CXMLPropertyBag::GetPref(char *name, int *pV, int V)
302 if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
304 *pV = atoi((char *)pNode->children->content);
310 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s);
311 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
314 // push the pref assignment if needed
315 PushAssignment(name, PREF_INT, pV);
318 void CXMLPropertyBag::GetPref(char *name, bool *pV, bool V)
321 if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
323 if (!strcmp((char *)pNode->children->content, "true"))
335 V ? strcpy(s, "true") : strcpy(s, "false");
336 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s);
337 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
340 // push the pref assignment
341 PushAssignment(name, PREF_BOOL, pV);
344 void CXMLPropertyBag::GetPref(char *name, float *pV, float V)
347 if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
349 *pV = atof((char *)pNode->children->content);
355 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s);
356 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
359 // push the pref assignment if needed
360 PushAssignment(name, PREF_FLOAT, pV);
363 void CXMLPropertyBag::GetPref(char *name, float* pV, float* V)
366 if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
368 sscanf((char *)pNode->children->content, "%f %f %f", &pV[0], &pV[1], &pV[2]);
373 sprintf(s, "%f %f %f", V[0], V[1], V[2]);
374 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s);
375 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
380 // push the pref assignment if needed
381 PushAssignment(name, PREF_VEC3, pV);
384 void CXMLPropertyBag::GetPref(char *name, window_position_t* pV, window_position_t V)
387 if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
389 WindowPosition_Parse(*pV, CString((xmlChar *)pNode->children->content));
394 WindowPosition_Write(V, str);
395 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)str.GetBuffer());
396 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
399 // push the pref assignment if needed
400 PushAssignment(name, PREF_WNDPOS, pV);
403 void CXMLPropertyBag::UpdatePrefTree()
405 // read the assignments and update the tree
406 list<CPrefAssignment>::iterator iPref;
407 for(iPref = mPrefAssignments.begin(); iPref != mPrefAssignments.end(); iPref++)
409 CPrefAssignment *pPref = &(*iPref);
414 pNode = EpairForName(pPref->mName.GetBuffer());
415 // we never expect that the node could not be found, because this is supposed to happen
416 // after the tree was built with GetPref calls, never on a blank tree
419 Sys_FPrintf(SYS_ERR, "Unexpected EpairForName '%s' not found in UpdatePrefTree\n", pPref->mName.GetBuffer());
422 switch ((*iPref).mType)
425 xmlNodeSetContent(pNode, (const xmlChar *)((Str *)pPref->mVal)->GetBuffer());
428 sprintf(s, "%d", *(int *)pPref->mVal);
429 xmlNodeSetContent(pNode, (xmlChar *)s);
432 sprintf(s, "%f", *(float *)pPref->mVal);
433 xmlNodeSetContent(pNode, (xmlChar *)s);
436 *(bool *)pPref->mVal ? strcpy(s, "true") : strcpy(s, "false");
437 xmlNodeSetContent(pNode, (xmlChar *)s);
441 float* v = (float*)pPref->mVal;
442 sprintf(s, "%f %f %f", v[0], v[1], v[2]);
443 xmlNodeSetContent(pNode, (xmlChar *)s);
449 WindowPosition_Write(*(window_position_t*)pPref->mVal, str);
450 xmlNodeSetContent(pNode, (xmlChar*)str.GetBuffer());
457 void CXMLPropertyBag::Clear()
468 void CXMLPropertyBag::ReadXMLFile(const char* pFilename)
470 mpDoc = xmlParseFile(pFilename);
475 mpDocNode = mpDoc->children;
476 xmlAttrPtr tmp_attr_ptr = xmlHasProp(mpDocNode, (xmlChar *)"version");
477 if (strcmp((char *)mpDocNode->name, "qpref"))
479 Sys_FPrintf(SYS_ERR, "Unrecognized node '%s' in '%s'\n", mpDocNode->name, mpDoc->URL);
483 else if (tmp_attr_ptr != NULL && strcmp((char*)tmp_attr_ptr->children->content, "1"))
485 Sys_FPrintf(SYS_ERR, "Wrong version '%s' in <qpref> node for '%s'\n", (char*)tmp_attr_ptr->children->content, mpDoc->URL);
489 Sys_Printf("Opened XML property file: '%s'\n", pFilename);
495 // no document, create one
496 mpDoc = xmlNewDoc((xmlChar *)"1.0");
497 mpDocNode = xmlNewDocNode(mpDoc, NULL, (xmlChar *)"qpref", NULL);
498 xmlDocSetRootElement(mpDoc, mpDocNode);
499 xmlSetProp(mpDocNode, (xmlChar *)"version", (xmlChar *)"1");
500 Sys_Printf("XML property file '%s' invalid/not found, creating blank properties tree\n", pFilename);
504 qboolean CXMLPropertyBag::WriteXMLFile(const char* pFilename)
506 int res = xmlSaveFormatFile(pFilename, mpDoc, 1);
511 Sys_Printf("Wrote XML property file '%s'\n", pFilename);
515 // =============================================================================
516 // Widget callbacks for PrefsDlg
519 // browse for custom editor executable
520 static void OnBtnBrowseEditor (GtkWidget *widget, gpointer data)
522 PrefsDlg *dlg = (PrefsDlg*)data;
524 const char *filename = file_dialog(g_PrefsDlg.GetWidget(), TRUE, "Executable for Custom Editor");
528 dlg->m_strEditorCommand = filename;
529 dlg->UpdateData(FALSE);
534 static void OnBtnBrowseprefab (GtkWidget *widget, gpointer data)
536 PrefsDlg *dlg = (PrefsDlg*)data;
537 char *path = dlg->m_strPrefabPath;
538 if (strlen (path) == 0)
539 path = g_strGameToolsPath;
540 char *dir = dir_dialog (g_PrefsDlg.GetWidget (), "Set prefab path", path);
541 dlg->UpdateData(TRUE);
548 dlg->m_strPrefabPath = strPath;
549 dlg->UpdateData(FALSE);
554 static void OnBtnBrowseuserini (GtkWidget *widget, gpointer data)
556 PrefsDlg *dlg = (PrefsDlg*)data;
557 char *path = dlg->m_strUserPath;
558 if (strlen (path) == 0)
559 path = g_strGameToolsPath;
561 const char *filename = file_dialog (g_PrefsDlg.GetWidget(), TRUE, "Find INI file", path);
563 if (filename != NULL)
565 dlg->UpdateData(TRUE);
566 dlg->m_strUserPath = filename;
567 dlg->UpdateData(FALSE);
571 static void OnButtonClean (GtkWidget *widget, gpointer data)
573 // make sure this is what the user wants
574 if (gtk_MessageBox (g_PrefsDlg.GetWidget (), "This will close Radiant and clean the corresponding registry entries.\n"
575 "Next time you start Radiant it will be good as new. Do you wish to continue?",
576 "Reset Registry", MB_YESNO) == IDYES)
578 PrefsDlg *dlg = (PrefsDlg*)data;
579 dlg->EndModal (IDCANCEL);
581 g_qeglobals.disable_ini = true;
582 remove (dlg->m_inipath->str);
584 sprintf(buf, "%sSavedInfo.bin", dlg->m_rc_path->str);
586 HandleCommand (NULL, GINT_TO_POINTER (ID_FILE_EXIT));
591 // =============================================================================
594 // IMPORTANT NOTE: the values here don't matter very much
595 // the actual intialization if you start with an empty .ini is done when loading the prefs for the first time
596 // profile_load_int takes an argument to use if the value is not found
597 PrefsDlg::PrefsDlg ()
601 m_nView = MainFrame::eRegular;
603 m_bInternalBSP = FALSE;
604 m_bRightClick = FALSE;
608 m_bLoadLastMap = FALSE;
609 m_bTextureWindow = FALSE;
610 m_bSnapShots = FALSE;
612 m_bCleanTiny = FALSE;
613 m_bCamXYUpdate = TRUE;
614 m_bCamDragMultiSelect = FALSE;
615 m_bCamFreeLook = TRUE;
616 m_bCamFreeLookStrafe = FALSE;
617 m_bCamInverseMouse = FALSE;
618 m_bCamDiscrete = TRUE;
619 m_bNewLightDraw = FALSE;
620 m_strPrefabPath = "";
623 m_bFaceColors = FALSE;
627 m_bSizePaint = FALSE;
628 m_bDLLEntities = FALSE;
630 m_bDetachableMenus = FALSE; // Most win32 users will find detachable menus annoying
632 m_bDetachableMenus = TRUE; // Linux/Apple users are used to them...
634 m_bPatchToolbar = TRUE;
635 m_bWideToolbar = TRUE;
636 m_bPluginToolbar = TRUE;
640 m_bChaseMouse = FALSE;
641 m_bTextureScrollbar = TRUE;
642 m_bDisplayLists = TRUE;
643 m_bAntialiasedPointsAndLines = FALSE; // Fishman - Add antialiazed points and lines support. 09/03/00
644 m_bShowShaders = FALSE;
646 m_bNoStipple = FALSE;
647 m_bVertexSplit = FALSE;
648 m_bSelectCurves = TRUE;
649 m_bSelectModels = TRUE;
650 m_nEntityShowState = ENTITY_SKINNED_BOXED;
652 m_bSwitchClip = FALSE;
653 m_bSelectWholeEntities = TRUE;
654 m_nTextureQuality = 3;
655 m_bShowShaders = TRUE;
656 m_bGLLighting = FALSE;
659 m_bTexturesShaderlistOnly = FALSE;
660 // paths to ini files
670 m_bFloatingZ = FALSE;
671 m_bGlPtWorkaround = FALSE; // Gef: Kyro/GL_POINTS workaround 25-aug-2001
673 m_bNativeGUI = FALSE;
674 m_bStartOnPrimMon = FALSE;
676 m_global_rc_path = NULL;
678 m_bUseWin32Editor = TRUE;
680 // custom shader editor options
681 m_bUseCustomEditor = FALSE;
682 m_strEditorCommand = "";
684 m_nLightRadiuses = 1;
685 m_bQ3Map2Texturing = TRUE;
687 m_bGlATIHack = FALSE;
692 =========================================================
693 Games selection dialog
694 =========================================================
697 CGameDescription::CGameDescription(xmlDocPtr pDoc, const Str &GameFile)
701 // read the user-friendly game name
702 xmlNodePtr pNode = mpDoc->children;
704 while (strcmp((const char*)pNode->name, "game") && pNode != NULL) pNode=pNode->next;
707 ///< \todo add the file name (this node and gametools should all be part of CGameDescription anyway)
708 Error("Didn't find 'game' node in the game description file '%s'\n", pDoc->URL);
710 // on win32, game tools path can now be specified relative to the exe's cwd
711 prop = (char*)xmlGetProp( pNode, (xmlChar*)"gametools" );
712 if ( prop == NULL ) {
713 Error( "Didn't find 'gametools' node in the game description file '%s'\n", pDoc->URL );
718 _fullpath( full, prop, PATH_MAX );
720 strncpy( full, prop, PATH_MAX );
724 for ( p = full; *p != '\0'; p++ ) {
728 mGameToolsPath = full;
729 if ( p != full && *(p-1) != '/' ) {
730 mGameToolsPath += "/";
735 prop = (char*)xmlGetProp(pNode, (xmlChar*)"name");
738 Sys_FPrintf(SYS_WRN, "Warning, 'name' attribute not found in '%s'\n", pDoc->URL);
739 mGameName = pDoc->URL;
747 mGameFile = GameFile;
749 prop = (char*)xmlGetProp(pNode, (xmlChar*)"basegame");
753 mBaseGame = "baseq3";
761 // on win32, engine path can now be specified relative to the exe's cwd
762 prop = (char*)xmlGetProp(pNode, (const xmlChar *)"enginepath");
763 if ( prop != NULL ) {
766 _fullpath( full, prop, PATH_MAX );
768 strncpy( full, prop, PATH_MAX );
772 // process seperators
773 for ( p = full; *p != '\0'; p++ ) {
779 if ( p != full && *(p-1) != '/' ) {
785 // if engine path was not specified in the .game, it implies we can guess it from the gametools path
786 // on win32, and for most game package, the gametools are installed with the game
787 char aux_path[PATH_MAX]; // aux
788 strcpy( aux_path, mGameToolsPath.GetBuffer() );
789 if ( ( aux_path[ strlen(aux_path)-1 ] == '/' ) || ( aux_path[ strlen(aux_path)-1 ] == '\\' ) ) {
790 aux_path[strlen(aux_path)-1] = '\0'; // strip ending '/' if any
792 char up_path[PATH_MAX]; // up one level
793 ExtractFilePath( aux_path, up_path );
794 mEnginePath = up_path;
797 prop = (char*)xmlGetProp(pNode, (xmlChar*)"engine");
801 mEngine = "quake3.exe";
805 mEngine = "Quake3.app";
814 #if defined (__linux__) || defined (__APPLE__)
816 prop = (char*)xmlGetProp(pNode, (const xmlChar *)"prefix");
819 mUserPathPrefix = prop;
823 mShaderPath = xmlGetProp(pNode, (const xmlChar *)"shaderpath");
824 if (!mShaderPath.GetLength())
826 mShaderPath = "scripts/";
827 mShaderlist = "scripts/shaderlist.txt";
831 AddSlash(mShaderPath);
832 mShaderlist = mShaderPath;
833 mShaderlist += "shaderlist.txt";
835 xmlChar* default_scale = xmlGetProp(pNode, (const xmlChar *)"default_scale");
838 mTextureDefaultScale = atof((const char *)default_scale);
839 xmlFree(default_scale);
842 mTextureDefaultScale = 0.5f;
843 xmlChar* eclass_singleload = xmlGetProp(pNode, (const xmlChar*)"eclass_singleload");
844 if (eclass_singleload)
846 mEClassSingleLoad = true;
847 xmlFree(eclass_singleload);
850 mEClassSingleLoad = false;
851 xmlChar* no_patch = xmlGetProp(pNode, (const xmlChar *)"no_patch");
859 xmlChar* caulk_shader = xmlGetProp(pNode, (const xmlChar *)"caulk_shader");
862 mCaulkShader = caulk_shader;
863 xmlFree(caulk_shader);
866 mCaulkShader = "textures/common/caulk";
869 void CGameDescription::Dump()
872 if (CGameDialog::GetNetrun())
873 Sys_Printf("Running in network mode, prefs path set to '%s'\n", g_strTempPath.GetBuffer());
875 Sys_Printf("game name : '%s'\n", mGameName.GetBuffer());
876 Sys_Printf("game file : '%s'\n", mGameFile.GetBuffer());
877 Sys_Printf("game path : '%s'\n", mGameToolsPath.GetBuffer());
878 Sys_Printf("base game : '%s'\n", mBaseGame.GetBuffer());
879 Sys_Printf("engine path : '%s'\n", mEnginePath.GetBuffer());
880 Sys_Printf("engine : '%s'\n", mEngine.GetBuffer());
881 Sys_Printf("shaderlist : '%s'\n", mShaderlist.GetBuffer());
882 Sys_Printf("caulk shader: '%s'\n", mCaulkShader.GetBuffer());
883 #if defined (__linux__) || defined (__APPLE__)
884 Sys_Printf("prefix : '%s'\n", mUserPathPrefix.GetBuffer());
886 Sys_Printf("default texture scale: %g\n", mTextureDefaultScale);
887 Sys_Printf("single eclass load : %s\n", mEClassSingleLoad ? "Yes" : "No");
888 Sys_Printf("patches supported : %s\n", mNoPatch ? "No" : "Yes");
891 CPrefAssignment& CPrefAssignment::operator = (const CPrefAssignment& ass)
902 CPrefAssignment::CPrefAssignment(const CPrefAssignment& ass)
907 void CGameDialog::LoadPrefs()
911 // if we already have a document loaded, we will free and reload from file
912 if (mGlobalPrefs.InUse())
914 Sys_Printf("Reloading global prefs from file\n");
915 mGlobalPrefs.Clear();
918 // load global .pref file
919 CString strGlobalPref = g_PrefsDlg.m_global_rc_path->str;
920 strGlobalPref += "global.pref";
922 mGlobalPrefs.ReadXMLFile(strGlobalPref.GetBuffer());
924 mGlobalPrefs.GetPref("gamefile", &m_sGameFile, ""); // NOTE: there's no default, user HAS to select something
925 mGlobalPrefs.GetPref("autoload", &m_bAutoLoadGame, false);
926 mGlobalPrefs.GetPref("log console", &m_bLogConsole, false);
927 // in a very particular post-.pid startup
928 // we may have the console turned on and want to keep it that way
929 // so we use a latching system
930 if (m_bForceLogConsole)
932 m_bLogConsole = true;
933 Sys_Printf("console logging has been latched on, saving prefs\n");
935 m_bForceLogConsole = false;
938 // console logging: call Sys_LogConsole to check console logging status
939 // it is important that we would log console as early as possible to make it useful
942 if (mGlobalPrefs.mbEmpty)
944 Sys_Printf("Saving global.pref with default pref values\n");
949 void CGameDialog::SavePrefs()
951 // update the tree and save it
952 mGlobalPrefs.UpdatePrefTree();
954 CString strGlobalPref = g_PrefsDlg.m_global_rc_path->str;
955 strGlobalPref += "global.pref";
957 if (!mGlobalPrefs.WriteXMLFile(strGlobalPref.GetBuffer()))
958 Sys_FPrintf(SYS_ERR, "Error occured while saving global prefs file '%s'\n", strGlobalPref.GetBuffer());
961 void CGameDialog::DoGameInstall() {
965 void CGameDialog::DoGameDialog() {
966 // allow looping the game selection dialog with calls to the game configure dialog in between
967 while ( m_bDoGameInstall ) {
969 m_bDoGameInstall = false;
973 if ( m_bDoGameInstall ) {
976 // and we will loop to do another DoModal dialog
980 // unhook so we can use in other places
981 // we manually incref'ed it when creating, it won't be freed (destructor)
982 gtk_container_remove( GTK_CONTAINER( mTopBox ), GetGlobalFrame() );
984 // we save the prefs file
988 GtkWidget* CGameDialog::GetGlobalFrame()
990 GtkWidget *vbox, *text, *combo, *check;
992 if ( mFrame != NULL ) {
996 mFrame = gtk_frame_new( NULL );
997 gtk_container_set_border_width( GTK_CONTAINER( mFrame ), 5 );
998 gtk_widget_show( mFrame );
1000 vbox = gtk_vbox_new( FALSE, 6 );
1001 gtk_widget_show( vbox );
1002 gtk_container_add( GTK_CONTAINER( mFrame ), vbox );
1003 gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
1005 text = gtk_label_new( "Select the game:" );
1006 gtk_widget_show( text );
1007 gtk_box_pack_start( GTK_BOX( vbox ), text, FALSE, FALSE, 0 );
1009 combo = gtk_combo_new();
1010 gtk_widget_show( combo );
1011 gtk_box_pack_start( GTK_BOX( vbox ), combo, FALSE, FALSE, 0 );
1013 // fill in with the game descriptions
1014 GList *combo_list = (GList*)NULL;
1015 list<CGameDescription *>::iterator iGame;
1016 for( iGame = mGames.begin(); iGame != mGames.end(); iGame++ ) {
1017 combo_list = g_list_append( combo_list, (void *)(*iGame)->mGameName.GetBuffer() );
1019 gtk_combo_set_popdown_strings( GTK_COMBO( combo ), combo_list );
1020 g_list_free( combo_list );
1022 AddDialogData( combo, &m_nComboSelect, DLG_COMBO_INT );
1024 check = gtk_check_button_new_with_label( "Auto load selected game on startup" );
1025 gtk_widget_show(check);
1026 gtk_box_pack_start (GTK_BOX(vbox), check, FALSE, FALSE, 0);
1027 AddDialogData (check, &m_bAutoLoadGame, DLG_CHECK_BOOL);
1029 text = gtk_label_new("(this frame is available in the prefs menu if you set auto-select)");
1030 gtk_widget_show(text);
1031 gtk_box_pack_start (GTK_BOX(vbox), text, FALSE, FALSE, 0);
1034 check = gtk_check_button_new_with_label( "Networked install - per-user settings" );
1035 gtk_widget_show( check );
1036 gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 );
1037 AddDialogData( check, &m_bNetRun, DLG_CHECK_BOOL );
1040 check = gtk_check_button_new_with_label( "Log the console to radiant.log" );
1041 gtk_widget_show( check );
1042 gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 );
1043 AddDialogData( check, &m_bLogConsole, DLG_CHECK_BOOL );
1045 // incref it so we can pass it around
1046 gtk_widget_ref( GTK_WIDGET( mFrame ) );
1051 void CGameDialog::UpdateData( bool retrieve ) {
1054 // use m_sGameFile to set m_nComboSelect
1055 list<CGameDescription *>::iterator iGame;
1057 for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++)
1059 if ((*iGame)->mGameFile == m_sGameFile)
1067 UpdateNetrun(false);
1070 Dialog::UpdateData(retrieve);
1073 // use m_nComboSelect to set m_sGameFile
1074 list<CGameDescription *>::iterator iGame = mGames.begin();
1076 for(i=0; i<m_nComboSelect; i++)
1080 m_sGameFile = (*iGame)->mGameFile;
1087 void CGameDialog::SInstallCallback( GtkWidget *widget, gpointer data ) {
1088 CGameDialog *d = static_cast< CGameDialog* >( data );
1089 d->m_bDoGameInstall = true;
1093 void CGameDialog::BuildDialog() {
1094 GtkWidget *dlg, *vbox1, *button, *setup_button;
1097 gtk_window_set_title( GTK_WINDOW( dlg ), "Select Game" );
1099 vbox1 = gtk_vbox_new( FALSE, 0 );
1100 gtk_widget_show( vbox1 );
1101 gtk_container_add( GTK_CONTAINER( dlg ), vbox1 );
1103 gtk_container_add( GTK_CONTAINER( vbox1 ), GetGlobalFrame() );
1106 setup_button = gtk_button_new_with_label( "Configure more games" );
1107 gtk_widget_show( setup_button );
1108 gtk_box_pack_start( GTK_BOX( vbox1 ), setup_button, FALSE, FALSE, 0 );
1109 gtk_signal_connect( GTK_OBJECT( setup_button ), "clicked",
1110 GTK_SIGNAL_FUNC( SInstallCallback ), this );
1112 button = gtk_button_new_with_label( "OK" );
1113 gtk_widget_show( button );
1114 gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 );
1115 AddModalButton( button, IDOK );
1117 gtk_widget_set_usize( button, 60, -2 );
1120 void CGameDialog::ScanForGames()
1125 CString strGamesPath = g_strAppPath.GetBuffer();
1126 strGamesPath += "games";
1127 const char *path = strGamesPath.GetBuffer();
1129 if ( !mGames.empty() ) {
1130 Sys_Printf( "Clearing game list\n" );
1131 list<CGameDescription*>::iterator iGame;
1132 for ( iGame = mGames.begin(); iGame != mGames.end(); iGame++ ) {
1138 Sys_Printf( "Scanning for game description files: %s\n", path );
1142 do we put game description files below g_strAppPath, or in ~/.radiant
1143 i.e. read only or read/write?
1144 my guess .. readonly cause it's an install
1145 we will probably want to add ~/.radiant/<version>/games/ scanning on top of that for developers
1146 (if that's really needed)
1149 // FIXME need to catch the 'no game description' situation and exit with a clean error
1151 dir = g_dir_open(path, 0, NULL);
1157 const gchar* name = g_dir_read_name(dir);
1161 dirlist = g_strdup(name);
1165 char *ext = strrchr (dirlist, '.');
1166 if ((ext == NULL) || (strcmp (ext, ".game") != 0))
1168 strPath.Format("%s/%s", path, dirlist);
1169 Sys_Printf("%s\n", strPath.GetBuffer());
1171 xmlDocPtr pDoc = xmlParseFile(strPath.GetBuffer());
1174 mGames.push_front( new CGameDescription( pDoc, dirlist ) );
1178 Sys_FPrintf(SYS_ERR, "XML parser failed on '%s'\n", strPath.GetBuffer());
1187 CGameDescription* CGameDialog::GameDescriptionForComboItem()
1189 list<CGameDescription *>::iterator iGame;
1191 for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++,i++)
1193 if (i == m_nComboSelect)
1198 return NULL; // not found
1201 void CGameDialog::InitGlobalPrefPath()
1203 GString *global_rc_path;
1204 // configure m_global_rc_path
1205 // this is the g_strTempPath, and it has already been mkdir'ed
1206 global_rc_path = g_string_new(g_strTempPath.GetBuffer());
1207 g_PrefsDlg.m_global_rc_path = global_rc_path;
1210 void CGameDialog::Reset()
1212 if (!g_PrefsDlg.m_global_rc_path)
1213 InitGlobalPrefPath();
1214 CString strGlobalPref = g_PrefsDlg.m_global_rc_path->str;
1215 strGlobalPref += "global.pref";
1216 remove(strGlobalPref.GetBuffer());
1219 void CGameDialog::Init()
1221 InitGlobalPrefPath();
1223 if ( mGames.empty() ) {
1226 if ( mGames.empty() ) {
1227 Error( "No games setup, aborting\n" );
1231 if ( m_bAutoLoadGame ) {
1232 // search by .game name
1233 list<CGameDescription *>::iterator iGame;
1234 for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++)
1236 if ((*iGame)->mGameFile == m_sGameFile)
1238 m_pCurrentGameDescription = (*iGame);
1243 if ( !m_bAutoLoadGame || !m_pCurrentGameDescription ) {
1245 // use m_nComboSelect to identify the game to run as and set the globals
1246 m_pCurrentGameDescription = GameDescriptionForComboItem();
1247 if ( !m_pCurrentGameDescription ) {
1248 Error("Lookup of game description object failed, can't continue\n");
1251 g_pGameDescription = m_pCurrentGameDescription;
1253 g_strGameToolsPath = g_pGameDescription->mGameToolsPath;
1255 // NOTE TTimo: this is moved from QE_LoadProject in 1.2
1256 // (probably broken)
1257 // NOTE Hydra: was broken for win32, we don't use m_strHomeGame or m_strFSBasePath
1258 #if defined (__linux__) || defined (__APPLE__)
1259 g_qeglobals.m_strHomeGame = g_get_home_dir();
1260 g_qeglobals.m_strHomeGame += "/";
1261 g_qeglobals.m_strHomeGame += m_pCurrentGameDescription->mUserPathPrefix.GetBuffer();
1262 g_qeglobals.m_strHomeGame += "/";
1264 g_qeglobals.m_strHomeGame = g_pGameDescription->mEnginePath.GetBuffer();
1267 g_pGameDescription->Dump();
1270 CGameDialog::~CGameDialog()
1274 // NOTE I'm not too sure how reliable this is
1275 gtk_widget_unref(GTK_WIDGET(mFrame));
1277 // free all the game descriptions
1278 list<CGameDescription *>::iterator iGame;
1279 for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++)
1286 void CGameDialog::AddPacksURL(Str &URL)
1288 // add the URLs for the list of game packs installed
1289 // FIXME: this is kinda hardcoded for now..
1290 list<CGameDescription *>::iterator iGame;
1291 for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++)
1293 if ((*iGame)->mGameFile == "q3.game")
1294 URL += "&Games_dlup%5B%5D=1";
1295 else if ((*iGame)->mGameFile == "wolf.game")
1296 URL += "&Games_dlup%5B%5D=2";
1297 else if ((*iGame)->mGameFile == "wolf.game")
1298 URL += "&Games_dlup%5B%5D=3";
1299 else if ((*iGame)->mGameFile == "jk2.game")
1300 URL += "&Games_dlup%5B%5D=4";
1301 else if ((*iGame)->mGameFile == "stvef.game")
1302 URL += "&Games_dlup%5B%5D=5";
1303 else if ((*iGame)->mGameFile == "sof2.game")
1304 URL += "&Games_dlup%5B%5D=6";
1305 else if ((*iGame)->mGameFile == "ja.game")
1306 URL += "&Games_dlup%5B%5D=7";
1312 #define NETRUN_FILENAME "netrun.conf"
1314 bool CGameDialog::m_bNetRun;
1316 void CGameDialog::UpdateNetrun(bool retrieve)
1320 strNetrun = g_strAppPath; strNetrun += NETRUN_FILENAME;
1323 // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=639
1324 // now check if we are running from a network installation
1325 // use a dummy file as the flag
1326 f_netrun = fopen(strNetrun.GetBuffer(), "r");
1339 f_netrun = fopen(strNetrun.GetBuffer(), "w");
1342 Sys_FPrintf(SYS_ERR, "ERROR: Failed to create netrun file '%s'\n", strNetrun.GetBuffer());
1348 Sys_Printf("Created/Checked '%s'\n", strNetrun.GetBuffer());
1353 if (remove(strNetrun.GetBuffer()) == -1)
1355 if (errno != ENOENT)
1356 Sys_FPrintf(SYS_ERR, "Failed to remove netrun file '%s'\n", strNetrun.GetBuffer());
1361 Sys_Printf("Netrun mode is disabled\n");
1367 bool CGameDialog::GetNetrun()
1376 very first prefs init deals with selecting the game and the game tools path
1377 then we can load .ini stuff
1379 using prefs / ini settings:
1383 look in g_strGameToolsPath for .ini
1386 look in ~/.radiant/<version>/gamename
1390 #define PREFS_LOCAL_FILENAME "local.pref"
1392 void PrefsDlg::Init()
1394 mGamesDialog.Init();
1396 // m_global_rc_path has been set above, do m_rc_path with game specific stuff now
1397 // the win32 and linux versions have been unified for network mode
1399 if (!CGameDialog::GetNetrun())
1401 // legacy prefs settings, this goes where the game pack is installed
1402 m_rc_path = g_string_new (g_strGameToolsPath.GetBuffer() );
1403 m_inipath = g_string_new (m_rc_path->str);
1404 g_string_append (m_inipath, PREFS_LOCAL_FILENAME);
1408 // this is common to win32 and Linux init now
1409 m_rc_path = g_string_new (m_global_rc_path->str);
1412 g_string_append (m_rc_path, g_pGameDescription->mGameFile.GetBuffer());
1413 g_string_append (m_rc_path, "/");
1414 Q_mkdir (m_rc_path->str, 0775);
1416 // then the ini file
1417 m_inipath = g_string_new (m_rc_path->str);
1418 g_string_append (m_inipath, PREFS_LOCAL_FILENAME);
1422 void PrefsDlg::UpdateData (bool retrieve)
1424 // leo: the "changed" signal confuses the update function
1425 if (m_pWidget == NULL)
1427 mGamesDialog.UpdateData (retrieve);
1428 Dialog::UpdateData (retrieve);
1432 #define PREFSHSPACE 5
1434 #define PREFSHSPACE 0
1437 static void UpdateSensitivity( GtkWidget *widget, gpointer data )
1439 PrefsDlg *dlg = (PrefsDlg*)data;
1440 dlg->DoSensitivity();
1443 static void UpdateEditorSensitivity(GtkWidget *widget, gpointer data)
1445 PrefsDlg *dlg = (PrefsDlg*)data;
1446 dlg->DoEditorSensitivity();
1449 // start new prefs dialog
1451 /*! Utility function for swapping notebook pages for tree list selections */
1452 void PrefsDlg::showPrefPage(int prefpage)
1454 if(gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook)) != prefpage)
1455 gtk_notebook_set_page(GTK_NOTEBOOK(notebook), prefpage);
1460 static void treeSelection(GtkTreeSelection* selection, gpointer data)
1462 PrefsDlg *dlg = (PrefsDlg*)data;
1464 GtkTreeModel* model;
1465 GtkTreeIter selected;
1466 if(gtk_tree_selection_get_selected(selection, &model, &selected))
1469 gtk_tree_model_get(model, &selected, 1, (gpointer*)&prefpage, -1);
1470 dlg->showPrefPage(prefpage);
1474 void PrefsDlg::BuildDialog ()
1476 // Main Preferences dialog
1477 GtkWidget *dialog, *mainvbox, *hbox, *sc_win, *preflabel;
1479 // Widgets on notebook pages
1480 GtkWidget *check, *label, *scale, *hbox2, *combo,
1481 *table, *spin, *entry, *pixmap,
1482 *radio, *button, *pageframe, *vbox;
1484 GList *combo_list = (GList*)NULL;
1489 gtk_window_set_title(GTK_WINDOW(dialog), "GtkRadiant Preferences");
1490 gtk_widget_realize(dialog);
1492 mainvbox = gtk_vbox_new(FALSE, 5);
1493 gtk_container_add(GTK_CONTAINER(dialog), mainvbox);
1494 gtk_container_set_border_width(GTK_CONTAINER(mainvbox), 5);
1495 gtk_widget_show(mainvbox);
1497 hbox = gtk_hbox_new(FALSE, 5);
1498 gtk_widget_show(hbox);
1499 gtk_box_pack_end(GTK_BOX(mainvbox), hbox, FALSE, TRUE, 0);
1501 button = gtk_button_new_with_label("OK");
1502 gtk_widget_show(button);
1503 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
1504 gtk_widget_set_usize(button, 60, -2);
1505 AddModalButton(button, IDOK);
1507 button = gtk_button_new_with_label("Cancel");
1508 gtk_widget_show(button);
1509 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
1510 gtk_widget_set_usize(button, 60, -2);
1511 AddModalButton(button, IDCANCEL);
1513 button = gtk_button_new_with_label ("Clean");
1514 gtk_widget_show(button);
1515 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(OnButtonClean), this);
1516 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
1517 gtk_widget_set_usize (button, 60, -2);
1519 hbox = gtk_hbox_new(FALSE, 5);
1520 gtk_box_pack_start(GTK_BOX(mainvbox), hbox, TRUE, TRUE, 0);
1521 gtk_widget_show(hbox);
1523 sc_win = gtk_scrolled_window_new(NULL, NULL);
1524 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sc_win), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
1525 gtk_box_pack_start(GTK_BOX(hbox), sc_win, FALSE, FALSE, 0);
1526 gtk_widget_show(sc_win);
1528 // prefs pages notebook
1529 notebook = gtk_notebook_new();
1530 // hide the notebook tabs since its not supposed to look like a notebook
1531 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook), FALSE);
1532 gtk_box_pack_start(GTK_BOX(hbox), notebook, TRUE, TRUE, 0);
1533 gtk_widget_show(notebook);
1535 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sc_win), GTK_SHADOW_IN);
1538 GtkTreeStore* store = gtk_tree_store_new(2, G_TYPE_STRING, G_TYPE_POINTER);
1540 GtkWidget* view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
1541 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE);
1544 GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
1545 GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes("Preferences", renderer, "text", 0, NULL);
1546 gtk_tree_view_append_column(GTK_TREE_VIEW(view), column);
1550 GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
1551 g_signal_connect(G_OBJECT(selection), "changed", G_CALLBACK(treeSelection), this);
1554 gtk_widget_show(view);
1556 gtk_container_add(GTK_CONTAINER (sc_win), view);
1559 /********************************************************************/
1560 /* Add preference tree options */
1561 /********************************************************************/
1564 gtk_tree_store_append(store, &group, NULL);
1565 gtk_tree_store_set(store, &group, 0, "Globals", 1, PTAB_FRONT, -1);
1568 gtk_tree_store_append(store, &tab, &group);
1569 gtk_tree_store_set(store, &tab, 0, "Game settings", 1, (gpointer)PTAB_GAME_SETTINGS, -1);
1575 gtk_tree_store_append(store, &group, NULL);
1576 gtk_tree_store_set(store, &group, 0, "Display", 1, PTAB_FRONT, -1);
1579 gtk_tree_store_append(store, &tab, &group);
1580 gtk_tree_store_set(store, &tab, 0, "2D Display/Rendering", 1, (gpointer)PTAB_2D, -1);
1584 gtk_tree_store_append(store, &tab, &group);
1585 gtk_tree_store_set(store, &tab, 0, "3D View", 1, (gpointer)PTAB_CAMERA, -1);
1589 gtk_tree_store_append(store, &tab, &group);
1590 gtk_tree_store_set(store, &tab, 0, "Texture Settings", 1, (gpointer)PTAB_TEXTURE, -1);
1596 gtk_tree_store_append(store, &group, NULL);
1597 gtk_tree_store_set(store, &group, 0, "Interface", 1, PTAB_FRONT, -1);
1600 gtk_tree_store_append(store, &tab, &group);
1601 gtk_tree_store_set(store, &tab, 0, "Layout", 1, (gpointer)PTAB_LAYOUT, -1);
1605 gtk_tree_store_append(store, &tab, &group);
1606 gtk_tree_store_set(store, &tab, 0, "Mouse", 1, (gpointer)PTAB_MOUSE, -1);
1610 gtk_tree_store_append(store, &tab, &group);
1611 gtk_tree_store_set(store, &tab, 0, "Editing", 1, (gpointer)PTAB_EDITING, -1);
1617 gtk_tree_store_append(store, &group, NULL);
1618 gtk_tree_store_set(store, &group, 0, "Other", 1, PTAB_FRONT, -1);
1621 gtk_tree_store_append(store, &tab, &group);
1622 gtk_tree_store_set(store, &tab, 0, "Startup/Auto save", 1, (gpointer)PTAB_STARTUP, -1);
1626 gtk_tree_store_append(store, &tab, &group);
1627 gtk_tree_store_set(store, &tab, 0, "Paths", 1, (gpointer)PTAB_PATHS, -1);
1631 gtk_tree_store_append(store, &tab, &group);
1632 gtk_tree_store_set(store, &tab, 0, "Misc", 1, (gpointer)PTAB_MISC, -1);
1634 if (!g_qeglobals.bBSPFrontendPlugin)
1637 gtk_tree_store_append(store, &tab, &group);
1638 gtk_tree_store_set(store, &tab, 0, "BSP Monitoring", 1, (gpointer)PTAB_BSPMONITOR, -1);
1643 gtk_tree_view_expand_all(GTK_TREE_VIEW(view));
1645 g_object_unref(G_OBJECT(store));
1648 /**********************************************************************/
1649 /* build the prefs pages */
1650 /**********************************************************************/
1653 // todo : add something interesting here
1654 // NOTE TTimo: tip of the day? or a logo?
1655 preflabel = gtk_label_new("Front Page");
1656 gtk_widget_show(preflabel);
1657 pageframe = gtk_frame_new(NULL);
1658 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
1659 gtk_widget_show(pageframe);
1660 vbox = gtk_vbox_new(FALSE, 5);
1661 gtk_widget_show(vbox);
1662 gtk_widget_set_usize(GTK_WIDGET(vbox), 350, -2);
1663 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1664 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
1666 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
1668 /******** global preferences group ****************************/
1669 preflabel = gtk_label_new("Globals");
1670 gtk_widget_show(preflabel);
1672 pageframe = mGamesDialog.GetGlobalFrame();
1673 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
1675 /******** 2D prefs group (xy views/rendering options) *********/
1676 preflabel = gtk_label_new("2D Display");
1677 gtk_widget_show(preflabel);
1678 pageframe = gtk_frame_new("2D Display");
1679 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
1680 gtk_widget_show(pageframe);
1681 vbox = gtk_vbox_new(FALSE, 5);
1682 gtk_widget_show(vbox);
1683 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1684 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
1686 // OpenGL Display Lists
1687 check = gtk_check_button_new_with_label("OpenGL Display Lists");
1688 gtk_widget_show(check);
1689 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
1690 AddDialogData(check, &m_bDisplayLists, DLG_CHECK_BOOL);
1692 // Antialiased points & lines
1693 // Fishman - Add antialiazed points and lines support. 09/03/00
1694 check = gtk_check_button_new_with_label ("OpenGL antialiased points and lines");
1695 gtk_widget_show (check);
1696 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1697 AddDialogData (check, &m_bAntialiasedPointsAndLines, DLG_CHECK_BOOL);
1699 // Solid selection boxes
1700 check = gtk_check_button_new_with_label ("Solid selection boxes");
1701 gtk_widget_show (check);
1702 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1703 AddDialogData (check, &m_bNoStipple, DLG_CHECK_BOOL);
1705 // Display size info
1706 check = gtk_check_button_new_with_label ("Display size info");
1707 gtk_widget_show (check);
1708 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
1709 AddDialogData (check, &m_bSizePaint, DLG_CHECK_BOOL);
1711 // Alternate vertex/edge handles
1712 // Gef: Kyro GL_POINT work around 25-aug-2001
1713 check = gtk_check_button_new_with_label ("Alternate vertex/edge handles");
1714 gtk_widget_show(check);
1715 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
1716 AddDialogData(check, &m_bGlPtWorkaround, DLG_CHECK_BOOL);
1718 g_list_free (combo_list);
1722 // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=812
1723 check = gtk_check_button_new_with_label ("ATI cards with broken drivers - bug #802");
1724 gtk_widget_show(check);
1725 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
1726 AddDialogData(check, &m_bGlATIHack, DLG_CHECK_BOOL);
1729 // Add the page to the notebook
1730 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
1732 /******** 3D Camera view group *********/
1733 preflabel = gtk_label_new("3D View");
1734 gtk_widget_show(preflabel);
1735 pageframe = gtk_frame_new("3D View");
1736 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
1737 gtk_widget_show(pageframe);
1738 vbox = gtk_vbox_new(FALSE, 5);
1739 gtk_widget_show(vbox);
1740 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1741 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
1743 // Directional velocity (Movement Velocity)
1745 hbox2 = gtk_hbox_new (FALSE, 0);
1746 gtk_widget_show (hbox2);
1747 gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
1750 label = gtk_label_new("Movement Velocity");
1751 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
1752 gtk_widget_show(label);
1753 gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
1756 adj = gtk_adjustment_new(100, 50, 300, 1, 10, 10);
1757 AddDialogData(adj, &m_nMoveSpeed, DLG_ADJ_INT);
1760 scale = gtk_hscale_new(GTK_ADJUSTMENT(adj));
1761 gtk_widget_show(scale);
1762 gtk_box_pack_start(GTK_BOX (vbox), scale, FALSE, TRUE, 2);
1764 gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
1766 // Angular velocity (Rotational Velocity)
1768 hbox2 = gtk_hbox_new (FALSE, 0);
1769 gtk_widget_show (hbox2);
1770 gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
1773 label = gtk_label_new ("Rotational Velocity");
1774 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
1775 gtk_widget_show (label);
1776 gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
1779 adj = gtk_adjustment_new (3, 1, 180, 1, 10, 10); // value, low, high, step, page_step, page_size
1780 AddDialogData (adj, &m_nAngleSpeed, DLG_ADJ_INT);
1783 scale = gtk_hscale_new (GTK_ADJUSTMENT (adj));
1784 gtk_widget_show (scale);
1785 gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, TRUE, 2);
1786 gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
1788 // Text under the velocity sliders
1790 hbox2 = gtk_hbox_new (FALSE, 0);
1791 gtk_widget_show (hbox2);
1792 gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
1795 label = gtk_label_new ("slow");
1796 gtk_widget_show (label);
1797 gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
1800 label = gtk_label_new ("fast");
1801 gtk_widget_show (label);
1802 gtk_box_pack_end (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
1804 // Allow drag to select multiple faces/brushes
1806 table = gtk_table_new(2, 1, FALSE);
1807 gtk_widget_show(table);
1808 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
1809 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
1810 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
1812 label = gtk_label_new ("Use paint-select in camera view:");
1813 gtk_widget_show (label);
1814 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
1815 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
1816 (GtkAttachOptions) (0),
1817 (GtkAttachOptions) (0), 0, 0);
1820 combo_list = g_list_append (combo_list, (void *)"No");
1821 combo_list = g_list_append (combo_list, (void *)"Yes");
1822 combo_list = g_list_append (combo_list, (void *)"Yes (Classic Key Setup)");
1824 combo = gtk_combo_new ();
1825 gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list);
1826 gtk_widget_show (combo);
1827 gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 0, 1,
1828 (GtkAttachOptions) (GTK_FILL),
1829 (GtkAttachOptions) (0), 0, 0);
1830 gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
1831 AddDialogData (combo, &m_nCamDragMultiSelect, DLG_COMBO_INT);
1833 // Freelook in Camera view
1834 check = gtk_check_button_new_with_label ("Freelook in Camera view");
1835 gtk_widget_show (check);
1836 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1837 gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT);
1838 AddDialogData (check, &m_bCamFreeLook, DLG_CHECK_BOOL);
1840 // Freelook in Camera view w/ forward & back strafing instead of up and down looking
1841 check = gtk_check_button_new_with_label ("Freelook strafes Forward and Back");
1842 gtk_widget_show (check);
1843 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1844 gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT);
1845 AddDialogData (check, &m_bCamFreeLookStrafe, DLG_CHECK_BOOL);
1847 // Invert mouse in freelook
1848 check = gtk_check_button_new_with_label ("Invert mouse in freelook");
1849 gtk_widget_show (check);
1850 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1851 gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT);
1852 AddDialogData (check, &m_bCamInverseMouse, DLG_CHECK_BOOL);
1854 // Discrete movement
1855 check = gtk_check_button_new_with_label ("Discrete movement");
1856 gtk_widget_show (check);
1857 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1858 gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT);
1859 AddDialogData (check, &m_bCamDiscrete, DLG_CHECK_BOOL);
1861 // Update XY views on camera move
1862 check = gtk_check_button_new_with_label ("Update XY views on camera move");
1863 gtk_widget_show (check);
1864 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1865 gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT);
1866 AddDialogData (check, &m_bCamXYUpdate, DLG_CHECK_BOOL);
1868 // Add the page to the notebook
1869 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
1871 /******** Texture group *********/
1872 preflabel = gtk_label_new("Textures");
1873 gtk_widget_show(preflabel);
1874 pageframe = gtk_frame_new("Textures");
1875 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
1876 gtk_widget_show(pageframe);
1877 vbox = gtk_vbox_new(FALSE, 6);
1878 gtk_widget_show(vbox);
1879 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1880 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
1882 // Texture quality slider
1884 label = gtk_label_new ("Texture quality");
1885 gtk_widget_show (label);
1886 gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
1887 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
1888 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
1891 adj = gtk_adjustment_new (0, 0, 4, 1, 1, 1);
1892 AddDialogData (adj, &m_nLatchedTextureQuality, DLG_ADJ_INT);
1895 scale = gtk_hscale_new (GTK_ADJUSTMENT (adj));
1896 gtk_widget_show (scale);
1897 gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
1898 gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
1900 // text under the texture slider
1901 hbox2 = gtk_hbox_new (FALSE, 0);
1902 gtk_widget_show (hbox2);
1903 gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
1904 label = gtk_label_new ("low");
1905 gtk_widget_show (label);
1906 gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
1907 label = gtk_label_new ("high");
1908 gtk_widget_show (label);
1909 gtk_box_pack_end (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
1912 check = gtk_check_button_new_with_label ("Texture subsets");
1913 gtk_widget_show (check);
1914 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1915 AddDialogData (check, &m_bTextureWindow, DLG_CHECK_BOOL);
1917 // texture scrollbar
1918 check = gtk_check_button_new_with_label ("Texture scrollbar");
1919 gtk_widget_show (check);
1920 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1921 AddDialogData (check, &m_bTextureScrollbar, DLG_CHECK_BOOL);
1923 // texture increment matches grid
1924 check = gtk_check_button_new_with_label ("Tex increment matches grid");
1925 gtk_widget_show (check);
1926 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
1927 AddDialogData (check, &m_bSnapTToGrid, DLG_CHECK_BOOL);
1930 // Texture compression choice label
1932 table = gtk_table_new(2, 1, FALSE);
1933 gtk_widget_show(table);
1934 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
1935 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
1936 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
1938 label = gtk_label_new ("Texture Compression (if available):");
1939 gtk_widget_show (label);
1940 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
1941 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
1942 (GtkAttachOptions) (0),
1943 (GtkAttachOptions) (0), 0, 0);
1944 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
1946 // Texture compression choice label
1948 // NONE will always be in pos 0
1949 combo_list = g_list_append (combo_list, (void *)"None");
1951 // if OpenGL compression is enabled it will always be
1953 if (g_qeglobals.m_bOpenGLCompressionSupported)
1955 combo_list = g_list_append (combo_list, (void *)"OpenGL ARB");
1958 // If S3 is enabled offer all 3 valid compression schemes in RGBA
1959 if (g_qeglobals.m_bS3CompressionSupported)
1961 combo_list = g_list_append (combo_list, (void *)"S3TC DXT1");
1962 combo_list = g_list_append (combo_list, (void *)"S3TC DXT3");
1963 combo_list = g_list_append (combo_list, (void *)"S3TC DXT5");
1966 combo = gtk_combo_new ();
1967 gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list);
1968 gtk_widget_show (combo);
1969 gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 0, 1,
1970 (GtkAttachOptions) (GTK_FILL),
1971 (GtkAttachOptions) (0), 0, 0);
1972 gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
1973 AddDialogData (combo, &m_nTextureCompressionFormat, DLG_COMBO_INT);
1974 g_list_free (combo_list);
1977 table = gtk_table_new(2, 1, FALSE);
1978 gtk_widget_show(table);
1979 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
1980 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
1981 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
1985 label = gtk_label_new ("Startup Shaders:");
1986 gtk_widget_show (label);
1987 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
1988 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
1989 (GtkAttachOptions) (0),
1990 (GtkAttachOptions) (0), 0, 0);
1991 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
1995 combo_list = g_list_append (combo_list, (void *)"None");
1996 if (g_pGameDescription->mGameFile == "jk2.game" || g_pGameDescription->mGameFile == "ja.game")
1997 combo_list = g_list_append (combo_list, (void *)"System");
1998 else if (g_pGameDescription->mGameFile == "sof2.game")
1999 combo_list = g_list_append (combo_list, (void *)"Tools");
2001 combo_list = g_list_append (combo_list, (void *)"Common");
2002 combo_list = g_list_append (combo_list, (void *)"All");
2003 combo = gtk_combo_new ();
2004 gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list);
2005 gtk_widget_show (combo);
2006 gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 0, 1,
2007 (GtkAttachOptions) (GTK_FILL),
2008 (GtkAttachOptions) (0), 0, 0);
2009 gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
2010 AddDialogData (combo, &m_nLatchedShader, DLG_COMBO_INT);
2011 g_list_free (combo_list);
2013 // Add the page to the notebook
2014 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2016 /******** Layout group *********/
2017 preflabel = gtk_label_new("Layout");
2018 gtk_widget_show(preflabel);
2019 pageframe = gtk_frame_new("Layout");
2020 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2021 gtk_widget_show(pageframe);
2022 vbox = gtk_vbox_new(FALSE, 5);
2023 gtk_widget_show(vbox);
2024 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2025 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2029 table = gtk_table_new (2, 4, FALSE);
2030 gtk_widget_show (table);
2031 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2032 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2033 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2036 pixmap = new_pixmap (g_pParentWnd->m_pWidget, "window1.bmp");
2037 gtk_widget_show (pixmap);
2038 gtk_table_attach (GTK_TABLE (table), pixmap, 0, 1, 0, 1,
2039 (GtkAttachOptions) (0),
2040 (GtkAttachOptions) (0), 0, 0);
2043 pixmap = new_pixmap (g_pParentWnd->m_pWidget, "window2.bmp");
2044 gtk_widget_show (pixmap);
2045 gtk_table_attach (GTK_TABLE (table), pixmap, 1, 2, 0, 1,
2046 (GtkAttachOptions) (0),
2047 (GtkAttachOptions) (0), 0, 0);
2050 pixmap = new_pixmap (g_pParentWnd->m_pWidget, "window3.bmp");
2051 gtk_widget_show (pixmap);
2052 gtk_table_attach (GTK_TABLE (table), pixmap, 2, 3, 0, 1,
2053 (GtkAttachOptions) (0),
2054 (GtkAttachOptions) (0), 0, 0);
2057 pixmap = new_pixmap (g_pParentWnd->m_pWidget, "window4.bmp");
2058 gtk_widget_show (pixmap);
2059 gtk_table_attach (GTK_TABLE (table), pixmap, 3, 4, 0, 1,
2060 (GtkAttachOptions) (0),
2061 (GtkAttachOptions) (0), 0, 0);
2063 // view type 1 selector
2064 radio = gtk_radio_button_new (NULL);
2065 gtk_widget_show (radio);
2066 gtk_table_attach (GTK_TABLE (table), radio, 0, 1, 1, 2,
2067 (GtkAttachOptions) (0),
2068 (GtkAttachOptions) (0), 0, 0);
2070 // view type 2 selector
2071 radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (radio));
2072 gtk_widget_show (radio);
2073 gtk_table_attach (GTK_TABLE (table), radio, 1, 2, 1, 2,
2074 (GtkAttachOptions) (0),
2075 (GtkAttachOptions) (0), 0, 0);
2077 // view type 3 selector
2078 radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (radio));
2079 gtk_widget_show (radio);
2080 gtk_table_attach (GTK_TABLE (table), radio, 2, 3, 1, 2,
2081 (GtkAttachOptions) (0),
2082 (GtkAttachOptions) (0), 0, 0);
2084 // view type 4 selector
2085 radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (radio));
2086 gtk_widget_show (radio);
2087 gtk_table_attach (GTK_TABLE (table), radio, 3, 4, 1, 2,
2088 (GtkAttachOptions) (0),
2089 (GtkAttachOptions) (0), 0, 0);
2090 AddDialogData (radio, &m_nLatchedView, DLG_RADIO_INT);
2092 // Floating Z window
2093 check = gtk_check_button_new_with_label ("Floating Z Window");
2094 gtk_widget_show (check);
2095 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2096 AddDialogData (check, &m_bLatchedFloatingZ, DLG_CHECK_BOOL);
2098 // show menu tear-off seperators
2099 check = gtk_check_button_new_with_label ("Detachable Menus");
2100 gtk_widget_show (check);
2101 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2102 AddDialogData (check, &m_bLatchedDetachableMenus, DLG_CHECK_BOOL);
2104 if (!g_pGameDescription->mNoPatch)
2106 // show patch toolbar
2107 check = gtk_check_button_new_with_label ("Patch Toolbar");
2108 gtk_widget_show (check);
2109 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2110 g_object_set_data (G_OBJECT (dialog), "check_patchtoolbar", check); // Allow to be disabled for Q1/Q2
2111 AddDialogData (check, &m_bLatchedPatchToolbar, DLG_CHECK_BOOL);
2115 check = gtk_check_button_new_with_label ("Wide Toolbar");
2116 gtk_widget_show (check);
2117 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2118 AddDialogData (check, &m_bLatchedWideToolbar, DLG_CHECK_BOOL);
2120 // use plugin toolbar
2121 check = gtk_check_button_new_with_label ("Plugin Toolbar");
2122 gtk_widget_show (check);
2123 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2124 AddDialogData (check, &m_bLatchedPluginToolbar, DLG_CHECK_BOOL);
2127 // win32 file dialog
2128 check = gtk_check_button_new_with_label ("Use win32 file load dialog");
2129 gtk_widget_show (check);
2130 // gtk_container_add (GTK_CONTAINER (vbox), check);
2131 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2132 AddDialogData (check, &m_bNativeGUI, DLG_CHECK_BOOL);
2134 // position on primary monitor
2135 check = gtk_check_button_new_with_label ("Start on Primary Monitor");
2136 gtk_widget_show (check);
2137 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2138 g_object_set_data (G_OBJECT (dialog), "check_startonprimary", check);
2139 gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateSensitivity), this );
2140 AddDialogData (check, &m_bStartOnPrimMon, DLG_CHECK_BOOL);
2143 // Add the page to the notebook
2144 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2146 /******** Mouse group *********/
2147 preflabel = gtk_label_new("Mouse");
2148 gtk_widget_show(preflabel);
2149 pageframe = gtk_frame_new("Mouse");
2150 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2151 gtk_widget_show(pageframe);
2152 vbox = gtk_vbox_new(FALSE, 5);
2153 gtk_widget_show(vbox);
2154 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2155 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2159 hbox2 = gtk_hbox_new (FALSE, 5);
2160 gtk_widget_show (hbox2);
2161 gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0);
2164 radio = gtk_radio_button_new_with_label (NULL, "2 button");
2165 gtk_widget_show (radio);
2166 gtk_box_pack_start (GTK_BOX (hbox2), radio, FALSE, FALSE, 0);
2169 radio = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio), "3 button");
2170 gtk_widget_show (radio);
2171 gtk_box_pack_start (GTK_BOX (hbox2), radio, FALSE, FALSE, 0);
2172 AddDialogData (radio, &m_nMouse, DLG_RADIO_INT);
2174 // right click to drop entity
2175 check = gtk_check_button_new_with_label ("Right click to drop entities");
2176 gtk_widget_show (check);
2177 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2178 AddDialogData (check, &m_bRightClick, DLG_CHECK_BOOL);
2180 // Mouse chaser (and this does what?)
2181 check = gtk_check_button_new_with_label ("Mouse chaser");
2182 gtk_widget_show (check);
2183 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2184 AddDialogData (check, &m_bChaseMouse, DLG_CHECK_BOOL);
2187 check = gtk_check_button_new_with_label ("ALT + multi-drag");
2188 gtk_widget_show (check);
2189 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2190 AddDialogData (check, &m_bALTEdge, DLG_CHECK_BOOL);
2192 // Mouse wheel increments
2194 hbox2 = gtk_hbox_new (FALSE, 5);
2195 gtk_widget_show (hbox2);
2196 gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0);
2199 label = gtk_label_new ("Wheel Mouse inc:");
2200 gtk_widget_show (label);
2201 gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
2204 entry = gtk_entry_new ();
2205 gtk_widget_show (entry);
2206 gtk_widget_set_usize (entry, 40, -2);
2207 gtk_box_pack_start (GTK_BOX (hbox2), entry, FALSE, FALSE, 0);
2208 AddDialogData (entry, &m_nWheelInc, DLG_ENTRY_INT);
2210 // Add the page to the notebook
2211 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2213 /******** Editing group *********/
2214 preflabel = gtk_label_new("Editing");
2215 gtk_widget_show(preflabel);
2216 pageframe = gtk_frame_new("Editing");
2217 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2218 gtk_widget_show(pageframe);
2219 vbox = gtk_vbox_new(FALSE, 5);
2220 gtk_widget_show(vbox);
2221 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2222 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2224 // Vertex editing splits faces
2225 check = gtk_check_button_new_with_label ("Vertex editing splits face");
2226 gtk_widget_show (check);
2227 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2228 AddDialogData (check, &m_bVertexSplit, DLG_CHECK_BOOL);
2230 // Fix target/targetname collisions
2231 check = gtk_check_button_new_with_label ("Fix target/targetname collisions");
2232 gtk_widget_show (check);
2233 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2234 AddDialogData (check, &m_bDoTargetFix, DLG_CHECK_BOOL);
2236 // Clipper tool uses caulk
2237 check = gtk_check_button_new_with_label ("Clipper tool uses caulk");
2238 gtk_widget_show (check);
2239 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2240 AddDialogData (check, &m_bClipCaulk, DLG_CHECK_BOOL);
2242 // Don't clamp plane points
2243 check = gtk_check_button_new_with_label ("Don't clamp plane points");
2244 gtk_widget_show (check);
2245 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2246 AddDialogData (check, &m_bNoClamp, DLG_CHECK_BOOL);
2248 // Select patch by bounding box
2249 check = gtk_check_button_new_with_label ("Select patches by bounding box");
2250 gtk_widget_show (check);
2251 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2252 AddDialogData (check, &m_bPatchBBoxSelect, DLG_CHECK_BOOL);
2254 // Rotation increment
2256 table = gtk_table_new (2, 3, FALSE);
2257 gtk_widget_show (table);
2258 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2259 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2260 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2263 label = gtk_label_new ("Rotation increment:");
2264 gtk_widget_show (label);
2265 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
2266 (GtkAttachOptions) (0),
2267 (GtkAttachOptions) (0), 0, 0);
2270 entry = gtk_entry_new ();
2271 gtk_widget_show (entry);
2272 gtk_widget_set_usize (entry, 60, -2);
2273 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1,
2274 (GtkAttachOptions) (GTK_FILL),
2275 (GtkAttachOptions) (0), 0, 0);
2276 AddDialogData (entry, &m_nRotation, DLG_ENTRY_INT);
2280 label = gtk_label_new ("Undo Levels:");
2281 gtk_widget_show (label);
2282 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
2283 (GtkAttachOptions) (0),
2284 (GtkAttachOptions) (0), 0, 0);
2286 // spinner (allows undo levels to be set to zero)
2287 spin = gtk_spin_button_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0, 64, 1, 10, 10)), 1, 0);
2288 gtk_widget_show (spin);
2289 gtk_table_attach (GTK_TABLE (table), spin, 1, 2, 1, 2,
2290 (GtkAttachOptions) (GTK_FILL),
2291 (GtkAttachOptions) (0), 0, 0);
2292 gtk_widget_set_usize (spin, 60, -2);
2293 AddDialogData (spin, &m_nUndoLevels, DLG_SPIN_INT);
2295 // Patch subdivisions
2297 label = gtk_label_new ("Patch subdivisions:");
2298 gtk_widget_show (label);
2299 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
2300 (GtkAttachOptions) (0),
2301 (GtkAttachOptions) (0), 0, 0);
2303 // entry (spinner perhaps? [2-16])
2304 entry = gtk_entry_new ();
2305 gtk_widget_show (entry);
2306 gtk_widget_set_usize (entry, 60, -2);
2307 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 2, 3,
2308 (GtkAttachOptions) (GTK_FILL),
2309 (GtkAttachOptions) (0), 0, 0);
2310 AddDialogData (entry, &m_nSubdivisions, DLG_ENTRY_INT);
2312 // Add the page to the notebook
2313 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2315 /******** Save/Load group *********/
2316 preflabel = gtk_label_new("Startup/Auto save");
2317 gtk_widget_show(preflabel);
2318 pageframe = gtk_frame_new("Startup/Auto save");
2319 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2320 gtk_widget_show(pageframe);
2321 vbox = gtk_vbox_new(FALSE, 5);
2322 gtk_widget_show(vbox);
2323 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2324 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2327 check = gtk_check_button_new_with_label ("Snapshots");
2328 gtk_widget_show (check);
2329 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2330 AddDialogData (check, &m_bSnapShots, DLG_CHECK_BOOL);
2332 // load last project on open
2333 check = gtk_check_button_new_with_label ("Load last project on open");
2334 gtk_widget_show (check);
2335 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2336 AddDialogData (check, &m_bLoadLast, DLG_CHECK_BOOL);
2338 // load last map on open
2339 check = gtk_check_button_new_with_label ("Load last map on open");
2340 gtk_widget_show (check);
2341 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2342 AddDialogData (check, &m_bLoadLastMap, DLG_CHECK_BOOL);
2346 hbox2 = gtk_hbox_new (FALSE, 5);
2347 gtk_widget_show (hbox2);
2348 gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0);
2349 gtk_container_set_border_width (GTK_CONTAINER (hbox2), 0);
2352 check = gtk_check_button_new_with_label ("Auto save every");
2353 gtk_widget_show (check);
2354 gtk_box_pack_start (GTK_BOX (hbox2), check, FALSE, FALSE, 0);
2355 AddDialogData (check, &m_bAutoSave, DLG_CHECK_BOOL);
2358 spin = gtk_spin_button_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 1, 60, 1, 10, 10)), 1, 0);
2359 gtk_widget_show (spin);
2360 gtk_box_pack_start (GTK_BOX (hbox2), spin, FALSE, FALSE, 0);
2361 gtk_widget_set_usize (spin, 60, -2);
2362 AddDialogData (spin, &m_nAutoSave, DLG_SPIN_INT);
2365 label = gtk_label_new ("minutes");
2366 gtk_widget_show (label);
2367 gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
2369 // Add the page to the notebook
2370 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2372 /******** Paths group *********/
2373 preflabel = gtk_label_new("Paths");
2374 gtk_widget_show(preflabel);
2375 pageframe = gtk_frame_new("Paths");
2376 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2377 gtk_widget_show(pageframe);
2378 vbox = gtk_vbox_new(FALSE, 5);
2379 gtk_widget_show(vbox);
2380 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2381 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2385 table = gtk_table_new (3, 3, FALSE);
2386 gtk_widget_show (table);
2387 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2388 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2389 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2392 label = gtk_label_new ("Prefab path:");
2393 gtk_widget_show (label);
2394 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
2395 (GtkAttachOptions) (0),
2396 (GtkAttachOptions) (0), 0, 0);
2397 gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
2400 entry = gtk_entry_new ();
2401 gtk_widget_show (entry);
2402 gtk_widget_set_usize(GTK_WIDGET(entry), 240, -2);
2403 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1,
2404 (GtkAttachOptions) (GTK_FILL),
2405 (GtkAttachOptions) (0), 1, 0);
2406 AddDialogData (entry, &m_strPrefabPath, DLG_ENTRY_TEXT);
2408 // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=805
2411 button = gtk_button_new_with_label ("...");
2412 gtk_widget_show (button);
2413 gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (OnBtnBrowseprefab), this);
2414 gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1,
2415 (GtkAttachOptions) (0),
2416 (GtkAttachOptions) (0), 0, 0);
2421 label = gtk_label_new ("User INI path:");
2422 gtk_widget_show (label);
2423 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
2424 (GtkAttachOptions) (0),
2425 (GtkAttachOptions) (0), 0, 0);
2426 gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
2428 // user ini path entry
2429 entry = gtk_entry_new ();
2430 gtk_widget_show (entry);
2431 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 1, 2,
2432 (GtkAttachOptions) (GTK_FILL),
2433 (GtkAttachOptions) (0), 1, 0);
2434 AddDialogData (entry, &m_strUserPath, DLG_ENTRY_TEXT);
2436 // user ini browse button
2437 button = gtk_button_new_with_label ("...");
2438 gtk_widget_show (button);
2439 gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (OnBtnBrowseuserini), this);
2440 gtk_table_attach (GTK_TABLE (table), button, 2, 3, 1, 2,
2441 (GtkAttachOptions) (0),
2442 (GtkAttachOptions) (0), 0, 0);
2444 // Add the page to the notebook
2445 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2447 /******** Misc group *********/
2448 preflabel = gtk_label_new("Misc");
2449 gtk_widget_show(preflabel);
2450 pageframe = gtk_frame_new("Misc");
2451 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2452 gtk_widget_show(pageframe);
2453 vbox = gtk_vbox_new(FALSE, 5);
2454 gtk_widget_show(vbox);
2455 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2456 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2459 check = gtk_check_button_new_with_label ("Light drawing");
2460 gtk_widget_show (check);
2461 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2462 AddDialogData (check, &m_bNewLightDraw, DLG_CHECK_BOOL);
2466 table = gtk_table_new(2, 1, FALSE);
2467 gtk_widget_show(table);
2468 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2469 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2470 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2472 label = gtk_label_new ("Light radiuses:");
2473 gtk_widget_show (label);
2474 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
2475 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
2476 (GtkAttachOptions) (0),
2477 (GtkAttachOptions) (0), 0, 0);
2480 combo_list = g_list_append (combo_list, (void *)"Disabled");
2481 combo_list = g_list_append (combo_list, (void *)"True Q3Map2 Style");
2482 combo_list = g_list_append (combo_list, (void *)"Classic Style");
2484 combo = gtk_combo_new ();
2485 gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list);
2486 gtk_widget_show (combo);
2487 gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 0, 1,
2488 (GtkAttachOptions) (GTK_FILL),
2489 (GtkAttachOptions) (0), 0, 0);
2490 gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
2491 AddDialogData (combo, &m_nLightRadiuses, DLG_COMBO_INT);
2494 check = gtk_check_button_new_with_label ("Use win32 file associations to open text files instead of builtin editor");
2495 gtk_widget_show(check);
2496 gtk_box_pack_start(GTK_BOX (vbox), check, FALSE, FALSE, 0);
2497 AddDialogData (check, &g_PrefsDlg.m_bUseWin32Editor, DLG_CHECK_BOOL);
2499 // use custom shader editor
2500 check = gtk_check_button_new_with_label ("Use Custom Shader Editor");
2501 gtk_widget_show(check);
2502 gtk_box_pack_start(GTK_BOX (vbox), check, FALSE, FALSE, 0);
2503 gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateEditorSensitivity), this);
2504 g_object_set_data (G_OBJECT(dialog), "check_customeditor", check);
2505 AddDialogData (check, &g_PrefsDlg.m_bUseCustomEditor, DLG_CHECK_BOOL);
2507 // custom shader editor executable
2509 table = gtk_table_new (3, 1, FALSE);
2510 gtk_widget_show (table);
2511 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2512 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2513 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2516 label = gtk_label_new("Custom Editor Command");
2517 gtk_widget_show(label);
2518 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
2519 (GtkAttachOptions) (0),
2520 (GtkAttachOptions) (0), 0, 0);
2521 gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
2522 g_object_set_data (G_OBJECT(dialog), "label_customeditor", label);
2523 gtk_widget_set_sensitive (label, g_PrefsDlg.m_bUseCustomEditor);
2525 // custom editor command entry
2526 entry = gtk_entry_new ();
2527 gtk_widget_show (entry);
2528 gtk_widget_set_usize(GTK_WIDGET(entry), 240, -2);
2529 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1,
2530 (GtkAttachOptions) (GTK_FILL),
2531 (GtkAttachOptions) (0), 1, 0);
2532 AddDialogData (entry, &m_strEditorCommand, DLG_ENTRY_TEXT);
2533 gtk_widget_set_sensitive (entry, g_PrefsDlg.m_bUseCustomEditor);
2534 g_object_set_data (G_OBJECT(dialog), "entry_customeditor", entry);
2537 button = gtk_button_new_with_label ("...");
2538 gtk_widget_show (button);
2539 gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (OnBtnBrowseEditor), this);
2540 gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1,
2541 (GtkAttachOptions) (0),
2542 (GtkAttachOptions) (0), 0, 0);
2543 g_object_set_data (G_OBJECT(dialog), "button_customeditor", button);
2544 gtk_widget_set_sensitive (button, g_PrefsDlg.m_bUseCustomEditor);
2547 // Add the page to the notebook
2548 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2550 /******** BSP Monitoring group *********/
2551 // this is never displayed if the plugin isn't available
2552 preflabel = gtk_label_new("BSP Monitoring");
2553 gtk_widget_show(preflabel);
2554 pageframe = gtk_frame_new("BSP Monitoring");
2555 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2556 gtk_widget_show(pageframe);
2557 vbox = gtk_vbox_new(FALSE, 5);
2558 gtk_widget_show(vbox);
2559 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2560 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2562 // Enable BSP process monitoring
2563 check = gtk_check_button_new_with_label ("Enable BSP process monitoring");
2564 gtk_widget_show (check);
2565 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2566 g_object_set_data (G_OBJECT (dialog), "check_monitorbsp", check);
2567 gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateSensitivity), this );
2568 AddDialogData (check, &g_PrefsDlg.m_bWatchBSP, DLG_CHECK_BOOL);
2571 check = gtk_check_button_new_with_label ("Stop compilation on leak");
2572 gtk_widget_show (check);
2573 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2574 g_object_set_data (G_OBJECT (dialog), "check_leakstop", check);
2575 AddDialogData (check, &g_PrefsDlg.m_bLeakStop, DLG_CHECK_BOOL);
2577 // engine after compile
2578 check = gtk_check_button_new_with_label ("Run engine after compile");
2579 gtk_widget_show (check);
2580 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2581 g_object_set_data (G_OBJECT (dialog), "check_runengine", check);
2582 gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateSensitivity), this );
2583 AddDialogData( check, &g_PrefsDlg.m_bRunQuake, DLG_CHECK_BOOL );
2585 // sleep mode when running engine
2586 check = gtk_check_button_new_with_label ("Activate sleep mode when running the engine");
2587 gtk_widget_show (check);
2588 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2589 g_object_set_data (G_OBJECT (dialog), "check_sleep", check);
2590 AddDialogData( check, &g_PrefsDlg.m_bDoSleep, DLG_CHECK_BOOL );
2592 // use q3map2's texture projection
2593 check = gtk_check_button_new_with_label ("Texturing compatible with q3map2");
2594 gtk_widget_show (check);
2595 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2596 g_object_set_data (G_OBJECT (dialog), "check_q3map2", check);
2597 AddDialogData( check, &g_PrefsDlg.m_bQ3Map2Texturing, DLG_CHECK_BOOL );
2599 // Add the page to the notebook
2600 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2602 gtk_notebook_set_page(GTK_NOTEBOOK(notebook), PTAB_FRONT);
2607 // end new prefs dialog
2609 void PrefsDlg::LoadTexdefPref(texdef_t* pTexdef, char* pName)
2613 memset(pTexdef, 0, sizeof(texdef_t));
2615 sprintf(buffer, "%s%s", pName, TD_SCALE1_KEY);
2616 mLocalPrefs.GetPref(buffer, &pTexdef->scale[0], 0.5f);
2618 sprintf(buffer, "%s%s", pName, TD_SCALE2_KEY);
2619 mLocalPrefs.GetPref(buffer, &pTexdef->scale[1], 0.5f);
2621 sprintf(buffer, "%s%s", pName, TD_SHIFT1_KEY);
2622 mLocalPrefs.GetPref(buffer, &pTexdef->shift[0], 8.f);
2624 sprintf(buffer, "%s%s", pName, TD_SHIFT2_KEY);
2625 mLocalPrefs.GetPref(buffer, &pTexdef->shift[1], 8.f);
2627 sprintf(buffer, "%s%s", pName, TD_ROTATE_KEY);
2628 mLocalPrefs.GetPref(buffer, &pTexdef->rotate, 45);
2631 void PrefsDlg::UpdateTextureCompression()
2633 // if OpenGL is not ready yet, don't do anything
2634 if (!g_qeglobals.m_bOpenGLReady) {
2635 Sys_Printf("OpenGL not ready - postpone texture compression capability check\n");
2639 if (g_qeglobals.bTextureCompressionSupported)
2641 if (m_nTextureCompressionFormat >= 2 && !g_qeglobals.m_bS3CompressionSupported)
2643 Sys_Printf("Inconsistant pref setting for texture compression (%d), rolling back\n", m_nTextureCompressionFormat);
2644 m_nTextureCompressionFormat = 1; // if this is not supported either, see below
2646 if (m_nTextureCompressionFormat == 1 && !g_qeglobals.m_bOpenGLCompressionSupported)
2648 Sys_Printf("Inconsistant pref setting for texture compression (GL_COMPRESSED_RGBA), rolling back\n");
2649 m_nTextureCompressionFormat = 0;
2651 switch (m_nTextureCompressionFormat)
2655 g_qeglobals.texture_components = GL_RGBA;
2656 Sys_Printf("texture compression disabled by preferences settings\n");
2661 g_qeglobals.texture_components = GL_COMPRESSED_RGBA;
2662 Sys_Printf("OpenGL texture compression enabled\n");
2667 g_qeglobals.texture_components = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
2668 Sys_Printf("S3TC DXT1 texture compression enabled\n");
2673 g_qeglobals.texture_components = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
2674 Sys_Printf("S3TC DXT3 texture compression enabled\n");
2679 g_qeglobals.texture_components = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
2680 Sys_Printf("S3TC DXT5 texture compression enabled\n");
2687 Sys_Printf("texture compression is not supported by your current graphic card/drivers\n");
2688 g_qeglobals.texture_components = GL_RGBA;
2689 m_nTextureCompressionFormat = 0;
2694 void PrefsDlg::UpdateATIHack() {
2695 // if OpenGL is not ready yet, don't do anything
2696 if (!g_qeglobals.m_bOpenGLReady) {
2697 Sys_Printf("OpenGL not ready - postpone ATI bug workaround setup\n");
2702 qglCullFace = &qglCullFace_ATIHack;
2703 qglDisable = &qglDisable_ATIHack;
2704 qglEnable = &qglEnable_ATIHack;
2705 qglPolygonMode = &qglPolygonMode_ATIHack;
2706 Sys_Printf("ATI bug workaround enabled\n");
2708 qglCullFace = qglCullFace_real;
2709 qglDisable = qglDisable_real;
2710 qglEnable = qglEnable_real;
2711 qglPolygonMode = qglPolygonMode_real;
2712 Sys_Printf("ATI bug workaround disabled\n");
2717 // TTimo: m_strEnginePath has a special status, if not found in registry we need to
2718 // initiliaze it for sure. It is not totally failsafe but we can use the same
2719 // code than in q3map, expecting to find some "quake" above us. If not, we prompt
2720 // for the engine executable path
2721 void PrefsDlg::LoadPrefs ()
2725 // first things first, load prefs from global prefs
2726 mGamesDialog.LoadPrefs();
2728 // if we already have a document loaded, we will free and reload from file
2729 if (mLocalPrefs.InUse()) {
2730 mLocalPrefs.Clear();
2733 // load local.pref file
2734 mLocalPrefs.ReadXMLFile(m_inipath->str);
2736 mLocalPrefs.GetPref(PATCHSHOWBOUNDS_KEY, &g_bPatchShowBounds, FALSE);
2737 mLocalPrefs.GetPref(MOUSE_KEY, &m_nMouse, MOUSE_DEF);
2738 m_nMouseButtons = m_nMouse ? 3 : 2;
2741 // if it's not found here, mainframe.cpp will take care of finding one
2742 mLocalPrefs.GetPref(LASTPROJ_KEY, &m_strLastProject, "");
2743 mLocalPrefs.GetPref(LASTPROJVER_KEY, &m_nLastProjectVer, -1);
2746 // NOTE TTimo: I'm not sure why this is in prefs
2747 // should probably be a project setting
2748 // and I'm not sure that we really have a way to set this reliably either
2750 strPrefab = g_qeglobals.m_strHomeGame.GetBuffer();
2751 strPrefab += g_pGameDescription->mBaseGame.GetBuffer();
2752 strPrefab += "/prefabs/";
2753 mLocalPrefs.GetPref(PREFAB_KEY, &m_strPrefabPath, strPrefab);
2755 mLocalPrefs.GetPref(LASTLIGHTINTENSITY_KEY, &m_iLastLightIntensity, 300);
2756 mLocalPrefs.GetPref(TLOCK_KEY, &m_bTextureLock, TLOCK_DEF);
2757 mLocalPrefs.GetPref(RLOCK_KEY, &m_bRotateLock, TLOCK_DEF);
2758 mLocalPrefs.GetPref(LASTMAP_KEY, &m_strLastMap, "");
2759 mLocalPrefs.GetPref(LOADLAST_KEY, &m_bLoadLast, LOADLAST_DEF);
2760 mLocalPrefs.GetPref(BSP_KEY, &m_bInternalBSP, FALSE);
2761 mLocalPrefs.GetPref(RCLICK_KEY, &m_bRightClick, TRUE);
2762 mLocalPrefs.GetPref(AUTOSAVE_KEY, &m_bAutoSave, TRUE);
2763 mLocalPrefs.GetPref(LOADLASTMAP_KEY, &m_bLoadLastMap, FALSE);
2764 mLocalPrefs.GetPref(TINYBRUSH_KEY, &m_bCleanTiny, FALSE);
2765 mLocalPrefs.GetPref(TINYSIZE_KEY, &m_fTinySize, 0.5f);
2766 mLocalPrefs.GetPref(AUTOSAVETIME_KEY, &m_nAutoSave, 5);
2767 mLocalPrefs.GetPref(SNAPSHOT_KEY, &m_bSnapShots, FALSE);
2768 mLocalPrefs.GetPref(MOVESPEED_KEY, &m_nMoveSpeed, 100);
2769 mLocalPrefs.GetPref(ANGLESPEED_KEY, &m_nAngleSpeed, 3);
2770 mLocalPrefs.GetPref(SETGAME_KEY, &m_bSetGame, FALSE);
2771 mLocalPrefs.GetPref(CAMXYUPDATE_KEY, &m_bCamXYUpdate, TRUE);
2772 mLocalPrefs.GetPref(CAMDRAGMULTISELECT_KEY, &m_nCamDragMultiSelect, TRUE);
2773 mLocalPrefs.GetPref(CAMFREELOOK_KEY, &m_bCamFreeLook, TRUE);
2774 mLocalPrefs.GetPref(CAMINVERSEMOUSE_KEY, &m_bCamInverseMouse, FALSE);
2775 mLocalPrefs.GetPref(CAMDISCRETE_KEY, &m_bCamDiscrete, TRUE);
2776 mLocalPrefs.GetPref(LIGHTDRAW_KEY, &m_bNewLightDraw, TRUE);
2777 mLocalPrefs.GetPref(CUBICCLIP_KEY, &m_bCubicClipping, TRUE);
2778 mLocalPrefs.GetPref(CUBICSCALE_KEY, &m_nCubicScale, 13);
2779 mLocalPrefs.GetPref(ALTEDGE_KEY, &m_bALTEdge, FALSE);
2780 mLocalPrefs.GetPref(FACECOLORS_KEY, &m_bFaceColors, FALSE);
2781 mLocalPrefs.GetPref(XZVIS_KEY, &m_bXZVis, FALSE);
2782 mLocalPrefs.GetPref(YZVIS_KEY, &m_bYZVis, FALSE);
2783 mLocalPrefs.GetPref(ZVIS_KEY, &m_bZVis, FALSE);
2784 mLocalPrefs.GetPref(SIZEPAINT_KEY, &m_bSizePaint, FALSE);
2785 mLocalPrefs.GetPref(DLLENTITIES_KEY, &m_bDLLEntities, FALSE);
2787 mLocalPrefs.GetPref(DETACHABLEMENUS_KEY, &m_bLatchedDetachableMenus, TRUE);
2788 m_bDetachableMenus = m_bLatchedDetachableMenus;
2790 if (g_pGameDescription->mNoPatch)
2792 m_bPatchToolbar = false;
2796 mLocalPrefs.GetPref(PATCHTOOLBAR_KEY, &m_bLatchedPatchToolbar, TRUE);
2797 m_bPatchToolbar = m_bLatchedPatchToolbar;
2800 mLocalPrefs.GetPref(WIDETOOLBAR_KEY, &m_bLatchedWideToolbar, TRUE);
2801 m_bWideToolbar = m_bLatchedWideToolbar;
2803 mLocalPrefs.GetPref(PLUGINTOOLBAR_KEY, &m_bLatchedPluginToolbar, TRUE);
2804 m_bPluginToolbar = m_bLatchedPluginToolbar;
2806 mLocalPrefs.GetPref(WINDOW_KEY, (int*)&m_nLatchedView, WINDOW_DEF);
2807 m_nView = m_nLatchedView;
2809 mLocalPrefs.GetPref(FLOATINGZ_KEY, &m_bLatchedFloatingZ, FALSE);
2810 m_bFloatingZ = m_bLatchedFloatingZ;
2812 mLocalPrefs.GetPref(TEXTUREQUALITY_KEY, &m_nLatchedTextureQuality, 3);
2813 m_nTextureQuality = m_nLatchedTextureQuality;
2815 mLocalPrefs.GetPref(LOADSHADERS_KEY, &m_nLatchedShader, 0);
2816 m_nShader = m_nLatchedShader;
2818 mLocalPrefs.GetPref(NOCLAMP_KEY, &m_bNoClamp, FALSE);
2819 mLocalPrefs.GetPref(USERINI_KEY, &m_strUserPath, "");
2820 mLocalPrefs.GetPref(ROTATION_KEY, &m_nRotation, 45);
2821 mLocalPrefs.GetPref(CHASEMOUSE_KEY, &m_bChaseMouse, TRUE);
2822 mLocalPrefs.GetPref(ENTITYSHOW_KEY, &m_nEntityShowState, ENTITY_SKINNED_BOXED);
2824 // this will probably need to be 75 or 100 for Q1.
2825 mLocalPrefs.GetPref(TEXTURESCALE_KEY, &m_nTextureScale, 50);
2827 // FIXME: Hydra - actually, this stuff is Q1,Q2 and HL specific.
2828 if ( (g_pGameDescription->mGameFile == "hl.game") )
2830 // No BSP monitoring in the default compiler tools for Half-life (yet)
2831 mLocalPrefs.GetPref(WATCHBSP_KEY, &m_bWatchBSP, FALSE);
2833 // Texture subset on by default (HL specific really, because of halflife.wad's size)
2834 mLocalPrefs.GetPref(TEXTURE_KEY, &m_bTextureWindow, TRUE);
2836 else if ( ( g_pGameDescription->mGameFile == "q2.game" ) || ( g_pGameDescription->mGameFile == "heretic2.game" ) )
2838 // BSP monitoring is implemented in Quake2 and Heretic2 tools
2839 mLocalPrefs.GetPref(WATCHBSP_KEY, &m_bWatchBSP, TRUE);
2841 // Texture subset on by default (HL specific really, because of halflife.wad's size)
2842 mLocalPrefs.GetPref(TEXTURE_KEY, &m_bTextureWindow, TRUE);
2846 mLocalPrefs.GetPref(WATCHBSP_KEY, &m_bWatchBSP, WATCHBSP_DEF);
2847 mLocalPrefs.GetPref(TEXTURE_KEY, &m_bTextureWindow, FALSE);
2851 mLocalPrefs.GetPref(TEXTURESCROLLBAR_KEY, &m_bTextureScrollbar, TRUE);
2852 mLocalPrefs.GetPref(DISPLAYLISTS_KEY, &m_bDisplayLists, TRUE);
2853 mLocalPrefs.GetPref(ANTIALIASEDLINES_KEY, &m_bAntialiasedPointsAndLines, FALSE);
2854 mLocalPrefs.GetPref(SWITCHCLIP_KEY, &m_bSwitchClip, TRUE);
2855 mLocalPrefs.GetPref(SELWHOLEENTS_KEY, &m_bSelectWholeEntities, TRUE);
2856 mLocalPrefs.GetPref(SHOWSHADERS_KEY, &m_bShowShaders, TRUE);
2857 mLocalPrefs.GetPref(GLLIGHTING_KEY, &m_bGLLighting, FALSE);
2858 mLocalPrefs.GetPref(NOSTIPPLE_KEY, &m_bNoStipple, FALSE);
2859 mLocalPrefs.GetPref(UNDOLEVELS_KEY, &m_nUndoLevels, 30);
2860 mLocalPrefs.GetPref(VERTEXMODE_KEY, &m_bVertexSplit, TRUE);
2861 mLocalPrefs.GetPref(RUNQ2_KEY, &m_bRunQuake, RUNQ2_DEF);
2862 mLocalPrefs.GetPref(LEAKSTOP_KEY, &m_bLeakStop, TRUE);
2863 mLocalPrefs.GetPref(DOSLEEP_KEY, &m_bDoSleep, FALSE);
2864 mLocalPrefs.GetPref(SELECTCURVES_KEY, &m_bSelectCurves, TRUE);
2865 mLocalPrefs.GetPref(SELECTMODELS_KEY, &m_bSelectModels, TRUE);
2866 mLocalPrefs.GetPref(SHADERLISTONLY_KEY, &m_bTexturesShaderlistOnly, FALSE);
2867 mLocalPrefs.GetPref(SUBDIVISIONS_KEY, &m_nSubdivisions, SUBDIVISIONS_DEF);
2868 mLocalPrefs.GetPref(CLIPCAULK_KEY, &m_bClipCaulk, FALSE);
2869 mLocalPrefs.GetPref(SNAPTTOGRID_KEY, &m_bSnapTToGrid, FALSE);
2870 mLocalPrefs.GetPref(TARGETFIX_KEY, &m_bDoTargetFix, TRUE);
2871 mLocalPrefs.GetPref(WHEELINC_KEY, &m_nWheelInc, 64);
2872 mLocalPrefs.GetPref(PATCHBBOXSEL_KEY, &m_bPatchBBoxSelect, FALSE);
2874 // Gef: Kyro GL_POINT workaround
2875 mLocalPrefs.GetPref(GLPOINTWORKAROUND_KEY, &m_bGlPtWorkaround, FALSE);
2877 // window positioning
2878 mLocalPrefs.GetPref(ENTITYSPLIT1_KEY, &mWindowInfo.nEntitySplit1, -1);
2879 mLocalPrefs.GetPref(ENTITYSPLIT2_KEY, &mWindowInfo.nEntitySplit2, -1);
2881 mLocalPrefs.GetPref(POSITIONX_KEY, &mWindowInfo.position.x, -1);
2882 mLocalPrefs.GetPref(POSITIONY_KEY, &mWindowInfo.position.y, -1);
2883 mLocalPrefs.GetPref(WIDTH_KEY, &mWindowInfo.position.w, -1);
2884 mLocalPrefs.GetPref(HEIGHT_KEY, &mWindowInfo.position.h, 450);
2886 const window_position_t default_window_pos = { 0, 0, 200, 200, };
2888 mLocalPrefs.GetPref(ENTITYWND_KEY, &mWindowInfo.posEntityWnd, default_window_pos);
2889 mLocalPrefs.GetPref(MAPINFOWND_KEY, &mWindowInfo.posMapInfoWnd, default_window_pos);
2890 mLocalPrefs.GetPref(CAMWND_KEY, &mWindowInfo.posCamWnd, default_window_pos);
2891 mLocalPrefs.GetPref(ZWND_KEY, &mWindowInfo.posZWnd, default_window_pos);
2892 mLocalPrefs.GetPref(XYWND_KEY, &mWindowInfo.posXYWnd, default_window_pos);
2893 mLocalPrefs.GetPref(YZWND_KEY, &mWindowInfo.posYZWnd, default_window_pos);
2894 mLocalPrefs.GetPref(XZWND_KEY, &mWindowInfo.posXZWnd, default_window_pos);
2895 mLocalPrefs.GetPref(PATCHWND_KEY, &mWindowInfo.posPatchWnd, default_window_pos);
2896 mLocalPrefs.GetPref(SURFACEWND_KEY, &mWindowInfo.posSurfaceWnd, default_window_pos);
2897 mLocalPrefs.GetPref(ENTITYINFOWND_KEY, &mWindowInfo.posEntityInfoWnd, default_window_pos);
2899 mLocalPrefs.GetPref(ZWIDTH_KEY, &mWindowInfo.nZWidth, 30);
2900 mLocalPrefs.GetPref(XYHEIGHT_KEY, &mWindowInfo.nXYHeight, 300);
2901 mLocalPrefs.GetPref(XYWIDTH_KEY, &mWindowInfo.nXYWidth, 300);
2902 mLocalPrefs.GetPref(CAMWIDTH_KEY, &mWindowInfo.nCamWidth, 200);
2903 mLocalPrefs.GetPref(CAMHEIGHT_KEY, &mWindowInfo.nCamHeight, 200);
2904 mLocalPrefs.GetPref(ZFLOATWIDTH_KEY, &mWindowInfo.nZFloatWidth, 300);
2906 mLocalPrefs.GetPref(STATE_KEY, &mWindowInfo.nState, SW_SHOW);
2910 mLocalPrefs.GetPref(COUNT_KEY, &m_nMRUCount, 0);
2911 for(i = 0; i < 4; i++)
2914 sprintf (buf, "%s%d", FILE_KEY, i);
2915 mLocalPrefs.GetPref(buf, &m_strMRUFiles[i], "");
2918 // some platform specific prefs
2920 mLocalPrefs.GetPref(NATIVEGUI_KEY, &m_bNativeGUI, TRUE);
2921 mLocalPrefs.GetPref(STARTONPRIMMON_KEY, &m_bStartOnPrimMon, FALSE);
2924 mLocalPrefs.GetPref(SI_TEXMENU_KEY, &g_qeglobals.d_savedinfo.iTexMenu, ID_VIEW_BILINEARMIPMAP);
2925 mLocalPrefs.GetPref(SI_GAMMA_KEY, &g_qeglobals.d_savedinfo.fGamma, 1.0f);
2926 mLocalPrefs.GetPref(SI_EXCLUDE_KEY, &g_qeglobals.d_savedinfo.exclude, 0); // nothing filtered by default
2927 mLocalPrefs.GetPref(SI_INCLUDE_KEY, &g_qeglobals.d_savedinfo.include, INCLUDE_NAMES | INCLUDE_COORDS | INCLUDE_ANGLES | INCLUDE_CAMERATINT);
2928 mLocalPrefs.GetPref(SI_SHOWNAMES_KEY, &g_qeglobals.d_savedinfo.show_names, FALSE);
2929 mLocalPrefs.GetPref(SI_SHOWCOORDS_KEY, &g_qeglobals.d_savedinfo.show_coordinates, TRUE);
2930 mLocalPrefs.GetPref(SI_SHOWANGLES_KEY, &g_qeglobals.d_savedinfo.show_angles, TRUE);
2931 mLocalPrefs.GetPref(SI_SHOWOUTLINES_KEY, &g_qeglobals.d_savedinfo.show_outline, FALSE);
2932 mLocalPrefs.GetPref(SI_SHOWAXIS_KEY, &g_qeglobals.d_savedinfo.show_axis, TRUE);
2933 mLocalPrefs.GetPref(SI_NOSELOUTLINES_KEY, &g_qeglobals.d_savedinfo.bNoSelectedOutlines, FALSE);
2935 mLocalPrefs.GetPref(SI_OUTLINESTYLE_KEY, &g_qeglobals.d_savedinfo.iSelectedOutlinesStyle, OUTLINE_ZBUF|OUTLINE_BSEL);
2937 LoadTexdefPref(&g_qeglobals.d_savedinfo.m_SIIncrement, SI_SURFACE_TEXDEF_KEY);
2938 LoadTexdefPref(&g_qeglobals.d_savedinfo.m_PIIncrement, SI_PATCH_TEXDEF_KEY);
2940 // text editor binding
2942 mLocalPrefs.GetPref(CUSTOMSHADEREDITOR_KEY, &m_bUseWin32Editor, TRUE);
2944 mLocalPrefs.GetPref(CUSTOMSHADEREDITOR_KEY, &m_bUseCustomEditor, FALSE);
2945 mLocalPrefs.GetPref(CUSTOMSHADEREDITORCOMMAND_KEY, &m_strEditorCommand, "");
2949 vec3_t vDefaultAxisColours[3] = {
2955 for(i = 0; i < 3; i++) {
2957 sprintf(buf, "%s%d", SI_AXISCOLORS_KEY, i);
2958 mLocalPrefs.GetPref(buf, g_qeglobals.d_savedinfo.AxisColors[i], vDefaultAxisColours[i]);
2961 vec3_t vDefaultColours[COLOR_LAST] = {
2962 {0.25f, 0.25f, 0.25f},
2964 {0.75f, 0.75f, 0.75f},
2966 {0.25f, 0.25f, 0.25f},
2979 for(i = 0; i < COLOR_LAST; i++) {
2981 sprintf(buf, "%s%d", SI_COLORS_KEY, i);
2982 mLocalPrefs.GetPref(buf, g_qeglobals.d_savedinfo.colors[i], vDefaultColours[i]);
2985 mLocalPrefs.GetPref(TEXTURECOMPRESSIONFORMAT_KEY, &m_nTextureCompressionFormat, 1);
2987 mLocalPrefs.GetPref(LIGHTRADIUS_KEY, &m_nLightRadiuses, TRUE);
2989 mLocalPrefs.GetPref(Q3MAP2TEX_KEY, &m_bQ3Map2Texturing, TRUE);
2992 mLocalPrefs.GetPref(ATIHACK_KEY, &m_bGlATIHack, FALSE);
2995 Undo_SetMaxSize(m_nUndoLevels); // set it internally as well / FIXME: why not just have one global value?
2997 UpdateTextureCompression();
3003 if (mLocalPrefs.mbEmpty)
3005 mLocalPrefs.mbEmpty = false;
3006 Sys_Printf("Saving local.pref with default pref values\n");
3011 void PrefsDlg::SavePrefs ()
3013 if (g_qeglobals.disable_ini)
3017 Sys_Printf("PrefsDlg::SavePrefs\n");
3020 // this will take care of copying back from the dialog to the variables
3021 // NOTE: it may be overkill to call systematically before a SavePrefs, but it's safer
3022 // this will also cause an UpdateData for the mGamesDialog
3025 mGamesDialog.SavePrefs();
3027 // update the tree and save it
3028 mLocalPrefs.UpdatePrefTree();
3029 if (!mLocalPrefs.WriteXMLFile(m_inipath->str))
3030 Sys_FPrintf(SYS_ERR, "Error occured while saving local prefs file '%s'\n", m_inipath->str);
3032 if ( m_nMouse == 0 ) {
3033 m_nMouseButtons = 2;
3035 m_nMouseButtons = 3;
3040 void PrefsDlg::PostModal (int code)
3045 // make sure the logfile is ok
3051 g_pParentWnd->SetGridStatus();
3052 Sys_UpdateWindows(W_ALL);
3053 if (m_nUndoLevels != 0)
3054 Undo_SetMaxSize(m_nUndoLevels);
3058 void PrefsDlg::DoEditorSensitivity()
3060 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(g_object_get_data (G_OBJECT(m_pWidget), "check_customeditor"))))
3062 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "label_customeditor")), TRUE);
3063 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "entry_customeditor")), TRUE);
3064 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "button_customeditor")), TRUE);
3068 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "label_customeditor")), FALSE);
3069 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "entry_customeditor")), FALSE);
3070 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "button_customeditor")), FALSE);
3074 void PrefsDlg::DoSensitivity()
3077 // first, look at the project file version ... will monitoring work?
3078 // project files now XML, guaranteed to be at least version 2
3079 if (0)//IntForKey( g_qeglobals.d_project_entity, "version" ) < 2)
3084 Msg = "The current project file (";
3085 Msg += g_PrefsDlg.m_strLastProject;
3086 Msg += ") is not at least version 2.\nI need version 2 or above to setup BSP monitoring correctly.";
3087 gtk_MessageBox(m_pWidget, Msg.GetBuffer(), MB_OK );
3092 // go ahead, disable everybuddy
3093 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_leakstop" )), FALSE );
3094 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_monitorbsp" )), FALSE );
3095 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_runengine" )), FALSE );
3096 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_sleep" )), FALSE );
3103 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_leakstop" )), TRUE );
3104 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_monitorbsp" )), TRUE );
3105 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_runengine" )), TRUE );
3106 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_sleep" )), TRUE );
3108 if ( ! gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( g_object_get_data( G_OBJECT(m_pWidget), "check_monitorbsp" ) ) ) )
3110 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_leakstop" )), FALSE );
3111 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_runengine" )), FALSE );
3112 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_sleep" )), FALSE );
3113 } else if (! gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( g_object_get_data( G_OBJECT(m_pWidget), "check_runengine" ) ) ) )
3115 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_sleep" )), FALSE );
3120 ============================================================
3122 ============================================================
3125 void CGameInstall::BuildDialog() {
3126 GtkWidget *dlg, *vbox1, *button, *text, *combo, *entry;
3129 gtk_window_set_title( GTK_WINDOW( dlg ), "Configure games" );
3131 vbox1 = gtk_vbox_new( FALSE, 0 );
3132 gtk_widget_show( vbox1 );
3133 gtk_container_add( GTK_CONTAINER( dlg ), vbox1 );
3135 text = gtk_label_new( "Select the game to configure" );
3136 gtk_widget_show( text );
3137 gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 );
3139 combo = gtk_combo_new();
3140 gtk_widget_show( combo );
3141 gtk_box_pack_start( GTK_BOX( vbox1 ), combo, FALSE, FALSE, 0 );
3143 GList *combo_list = NULL;
3144 combo_list = g_list_append( combo_list, "Quake III Arena and mods" );
3145 combo_list = g_list_append( combo_list, "Urban Terror standalone" );
3146 combo_list = g_list_append( combo_list, "Warsaw" );
3147 gtk_combo_set_popdown_strings( GTK_COMBO( combo ), combo_list );
3148 g_list_free( combo_list );
3149 AddDialogData( combo, &m_nComboSelect, DLG_COMBO_INT );
3151 text = gtk_label_new( "Name:" );
3152 gtk_widget_show( text );
3153 gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 );
3155 entry = gtk_entry_new();
3156 gtk_widget_show( entry );
3157 gtk_box_pack_start( GTK_BOX( vbox1 ), entry, FALSE, FALSE, 0 );
3158 AddDialogData( entry, &m_strName, DLG_ENTRY_TEXT );
3160 text = gtk_label_new( "Engine directory:" );
3161 gtk_widget_show( text );
3162 gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 );
3164 entry = gtk_entry_new();
3165 gtk_widget_show( entry );
3166 gtk_box_pack_start( GTK_BOX( vbox1 ), entry, FALSE, FALSE, 0 );
3167 AddDialogData( entry, &m_strEngine, DLG_ENTRY_TEXT );
3169 // this gets done in the project stuff atm
3171 text = gtk_label_new( "Mod subdirectory:" );
3172 gtk_widget_show( text );
3173 gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 );
3175 entry = gtk_entry_new();
3176 gtk_widget_show( entry );
3177 gtk_box_pack_start( GTK_BOX( vbox1 ), entry, FALSE, FALSE, 0 );
3178 AddDialogData( entry, &m_strMod, DLG_ENTRY_TEXT );
3181 button = gtk_button_new_with_label( "OK" );
3182 gtk_widget_show( button );
3183 gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 );
3184 AddModalButton( button, IDOK );
3186 gtk_widget_set_usize( button, 60, -2 );
3189 void CGameInstall::Run() {
3191 Sys_Printf( "combo: %d name: %s engine: %s mod: %s\n", m_nComboSelect, m_strName.GetBuffer(), m_strEngine.GetBuffer(), m_strMod.GetBuffer() );
3193 // write out the game file
3194 Str gameFilePath = g_strAppPath.GetBuffer();
3195 gameFilePath += "games/";
3196 gameFilePath += m_strName.GetBuffer();
3197 gameFilePath += ".game";
3198 Sys_Printf( "game file: %s\n", gameFilePath.GetBuffer() );
3200 FILE *fg = fopen( gameFilePath.GetBuffer(), "w" );
3202 Error( "Failed to open %s for writing\n", gameFilePath.GetBuffer() );
3204 fprintf( fg, "<?xml version=\"1.0\" encoding=\"iso-8859-1\" standalone=\"yes\"?>\n<game\n" );
3205 fprintf( fg, " name=\"%s\"\n", m_strName.GetBuffer() );
3206 fprintf( fg, " gametools=\"%sgames\"\n", g_strAppPath.GetBuffer() );
3207 fprintf( fg, " enginepath=\"%s\"\n", m_strEngine.GetBuffer() );
3208 switch ( m_nComboSelect ) {
3210 fprintf( fg, " basegame=\"baseq3\"\n" );
3213 fprintf( fg, " basegame=\"q3ut4\"\n" );
3216 fprintf( fg, " basegame=\"basewsw\"\n" );
3219 fprintf( fg, "/>\n" );