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 <uilib/uilib.h>
26 #include "gtkutil/window.h"
27 #include "gtkutil/idledraw.h"
28 #include "gtkutil/widget.h"
29 #include "string/string.h"
31 #include "qerplugin.h"
44 const int c_command_status = 0;
45 const int c_position_status = 1;
46 const int c_brushcount_status = 2;
47 const int c_texture_status = 3;
48 const int c_grid_status = 4;
49 const int c_count_status = 5;
64 ui::Window m_window{ui::null};
66 CopiedString m_command_status;
67 CopiedString m_position_status;
68 CopiedString m_brushcount_status;
69 CopiedString m_texture_status;
70 CopiedString m_grid_status;
75 void SaveWindowInfo();
79 ui::Widget m_vSplit{ui::null};
80 ui::Widget m_hSplit{ui::null};
81 ui::Widget m_vSplit2{ui::null};
92 void *m_pStatusLabel[c_count_status];
95 EViewStyle m_nCurrentStyle;
96 WindowPositionTracker m_position_tracker;
98 IdleDraw m_idleRedrawStatusText;
109 void SetStatusText(CopiedString &status_text, const char *pText);
111 void UpdateStatusText();
113 void RedrawStatusText();
115 typedef MemberCaller<MainFrame, void(), &MainFrame::RedrawStatusText> RedrawStatusTextCaller;
117 void SetGridStatus();
119 typedef MemberCaller<MainFrame, void(), &MainFrame::SetGridStatus> SetGridStatusCaller;
121 void SetActiveXY(XYWnd *p);
153 void ReleaseContexts();
155 void CreateContexts();
157 EViewStyle CurrentStyle()
159 return m_nCurrentStyle;
162 bool FloatingGroupDialog()
164 return CurrentStyle() == eFloating || CurrentStyle() == eSplit;
168 extern MainFrame *g_pParentWnd;
170 ui::Window MainFrame_getWindow();
172 enum EMouseButtonMode {
177 struct glwindow_globals_t {
180 glwindow_globals_t() :
181 m_nMouseType(EThreeButton)
186 void GLWindow_Construct();
188 void GLWindow_Destroy();
190 extern glwindow_globals_t g_glwindow_globals;
192 template<typename Value>
195 extern LatchedValue<bool> g_Layout_enableDetachableMenus;
197 void deleteSelection();
200 void Sys_Status(const char *status);
203 void ScreenUpdates_Disable(const char *message, const char *title);
205 void ScreenUpdates_Enable();
207 bool ScreenUpdates_Enabled();
209 void ScreenUpdates_process();
211 class ScopeDisableScreenUpdates {
213 ScopeDisableScreenUpdates(const char *message, const char *title)
215 ScreenUpdates_Disable(message, title);
218 ~ScopeDisableScreenUpdates()
220 ScreenUpdates_Enable();
225 void EnginePath_Realise();
227 void EnginePath_Unrealise();
229 class ModuleObserver;
231 void Radiant_attachEnginePathObserver(ModuleObserver &observer);
233 void Radiant_detachEnginePathObserver(ModuleObserver &observer);
235 void Radiant_attachGameToolsPathObserver(ModuleObserver &observer);
237 void Radiant_detachGameToolsPathObserver(ModuleObserver &observer);
239 extern CopiedString g_strEnginePath;
241 void EnginePath_verify();
243 const char *EnginePath_get();
245 const char *QERApp_GetGamePath();
247 extern bool g_disableEnginePath;
248 extern bool g_disableHomePath;
250 const int g_pakPathCount = 5;
251 extern CopiedString g_strPakPath[g_pakPathCount];
253 const char *PakPath_get(int num);
255 extern CopiedString g_strAppPath;
257 const char *AppPath_get();
259 extern CopiedString g_strSettingsPath;
261 const char *SettingsPath_get();
263 const char *LocalRcPath_get(void);
265 const char *const g_pluginsDir = "plugins/"; ///< name of plugins directory, always sub-directory of toolspath
266 const char *const g_modulesDir = "modules/"; ///< name of modules directory, always sub-directory of toolspath
268 extern CopiedString g_strGameToolsPath;
270 const char *GameToolsPath_get();
272 void Radiant_Initialise();
274 void Radiant_Shutdown();
279 void XY_UpdateAllWindows();
281 void UpdateAllWindows();
284 void ClipperChangeNotify();
288 const char *basegame_get();
290 const char *gamename_get();
292 void gamename_set(const char *gamename);
294 void Radiant_attachGameNameObserver(ModuleObserver &observer);
296 void Radiant_detachGameNameObserver(ModuleObserver &observer);
298 const char *gamemode_get();
300 void gamemode_set(const char *gamemode);
302 void Radiant_attachGameModeObserver(ModuleObserver &observer);
304 void Radiant_detachGameModeObserver(ModuleObserver &observer);
310 void VFS_Construct();
314 void HomePaths_Construct();
316 void HomePaths_Destroy();
318 void Radiant_attachHomePathsObserver(ModuleObserver &observer);
320 void Radiant_detachHomePathsObserver(ModuleObserver &observer);
323 void MainFrame_Construct();
325 void MainFrame_Destroy();
328 extern float ( *GridStatus_getGridSize )();
330 extern int ( *GridStatus_getRotateIncrement )();
332 extern int ( *GridStatus_getFarClipDistance )();
334 extern bool ( *GridStatus_getTextureLockEnabled )();
336 void GridStatus_onTextureLockEnabledChanged();
338 SignalHandlerId XYWindowDestroyed_connect(const SignalHandler &handler);
340 void XYWindowDestroyed_disconnect(SignalHandlerId id);
342 MouseEventHandlerId XYWindowMouseDown_connect(const MouseEventHandler &handler);
344 void XYWindowMouseDown_disconnect(MouseEventHandlerId id);
346 extern ui::Widget g_page_entity;