2 Copyright (C) 1999-2006 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
22 #if !defined(INCLUDED_MAINFRAME_H)
23 #define INCLUDED_MAINFRAME_H
25 #include "gtkutil/window.h"
26 #include "gtkutil/idledraw.h"
27 #include "gtkutil/widget.h"
28 #include "string/string.h"
30 #include "qerplugin.h"
39 typedef struct _GtkWidget GtkWidget;
40 typedef struct _GtkWindow GtkWindow;
42 const int c_command_status = 0;
43 const int c_position_status = 1;
44 const int c_brushcount_status = 2;
45 const int c_texture_status = 3;
46 const int c_grid_status = 4;
47 const int c_count_status = 5;
65 CopiedString m_command_status;
66 CopiedString m_position_status;
67 CopiedString m_brushcount_status;
68 CopiedString m_texture_status;
69 CopiedString m_grid_status;
73 void SaveWindowInfo();
89 GtkWidget *m_pStatusLabel[c_count_status];
92 EViewStyle m_nCurrentStyle;
93 WindowPositionTracker m_position_tracker;
95 IdleDraw m_idleRedrawStatusText;
105 void SetStatusText(CopiedString& status_text, const char* pText);
106 void UpdateStatusText();
107 void RedrawStatusText();
108 typedef MemberCaller<MainFrame, &MainFrame::RedrawStatusText> RedrawStatusTextCaller;
110 void SetGridStatus();
111 typedef MemberCaller<MainFrame, &MainFrame::SetGridStatus> SetGridStatusCaller;
113 void SetActiveXY(XYWnd* p);
139 void ReleaseContexts();
140 void CreateContexts();
142 EViewStyle CurrentStyle()
144 return m_nCurrentStyle;
146 bool FloatingGroupDialog()
148 return CurrentStyle() == eFloating || CurrentStyle() == eSplit;
152 extern MainFrame* g_pParentWnd;
154 GtkWindow* MainFrame_getWindow();
156 enum EMouseButtonMode
162 struct glwindow_globals_t
166 glwindow_globals_t() :
167 m_nMouseType(EThreeButton)
172 void GLWindow_Construct();
173 void GLWindow_Destroy();
175 extern glwindow_globals_t g_glwindow_globals;
176 template<typename Value>
178 typedef LatchedValue<bool> LatchedBool;
179 extern LatchedBool g_Layout_enableDetachableMenus;
181 void deleteSelection();
184 void Sys_Status(const char* status);
187 void ScreenUpdates_Disable(const char* message, const char* title = "");
188 void ScreenUpdates_Enable();
189 bool ScreenUpdates_Enabled();
190 void ScreenUpdates_process();
192 class ScopeDisableScreenUpdates
195 ScopeDisableScreenUpdates(const char* message, const char* title = "")
197 ScreenUpdates_Disable(message, title);
199 ~ScopeDisableScreenUpdates()
201 ScreenUpdates_Enable();
206 void EnginePath_Realise();
207 void EnginePath_Unrealise();
209 class ModuleObserver;
211 void Radiant_attachEnginePathObserver(ModuleObserver& observer);
212 void Radiant_detachEnginePathObserver(ModuleObserver& observer);
214 void Radiant_attachGameToolsPathObserver(ModuleObserver& observer);
215 void Radiant_detachGameToolsPathObserver(ModuleObserver& observer);
217 extern CopiedString g_strEnginePath;
218 void EnginePath_verify();
219 const char* EnginePath_get();
220 const char* QERApp_GetGamePath();
222 extern CopiedString g_strAppPath;
223 const char* AppPath_get();
225 extern CopiedString g_strSettingsPath;
226 const char* SettingsPath_get();
228 const char* const g_pluginsDir = "plugins/"; ///< name of plugins directory, always sub-directory of toolspath
229 const char* const g_modulesDir = "modules/"; ///< name of modules directory, always sub-directory of toolspath
231 extern CopiedString g_strGameToolsPath;
232 const char* GameToolsPath_get();
234 void Radiant_Initialise();
235 void Radiant_Shutdown();
240 void XY_UpdateAllWindows();
241 void UpdateAllWindows();
244 void ClipperChangeNotify();
248 const char* basegame_get();
249 const char* gamename_get();
250 void gamename_set(const char* gamename);
251 void Radiant_attachGameNameObserver(ModuleObserver& observer);
252 void Radiant_detachGameNameObserver(ModuleObserver& observer);
253 const char* gamemode_get();
254 void gamemode_set(const char* gamemode);
255 void Radiant_attachGameModeObserver(ModuleObserver& observer);
256 void Radiant_detachGameModeObserver(ModuleObserver& observer);
260 void VFS_Construct();
263 void HomePaths_Construct();
264 void HomePaths_Destroy();
265 void Radiant_attachHomePathsObserver(ModuleObserver& observer);
266 void Radiant_detachHomePathsObserver(ModuleObserver& observer);
269 void MainFrame_Construct();
270 void MainFrame_Destroy();
273 extern float (*GridStatus_getGridSize)();
274 extern int (*GridStatus_getRotateIncrement)();
275 extern int (*GridStatus_getFarClipDistance)();
276 extern bool (*GridStatus_getTextureLockEnabled)();
277 void GridStatus_onTextureLockEnabledChanged();
279 SignalHandlerId XYWindowDestroyed_connect(const SignalHandler& handler);
280 void XYWindowDestroyed_disconnect(SignalHandlerId id);
281 MouseEventHandlerId XYWindowMouseDown_connect(const MouseEventHandler& handler);
282 void XYWindowMouseDown_disconnect(MouseEventHandlerId id);