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"
41 const int c_command_status = 0;
42 const int c_position_status = 1;
43 const int c_brushcount_status = 2;
44 const int c_texture_status = 3;
45 const int c_grid_status = 4;
46 const int c_count_status = 5;
63 ui::Window m_window{ui::null};
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();
77 ui::Widget m_vSplit{ui::null};
78 ui::Widget m_hSplit{ui::null};
79 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;
107 void SetStatusText( CopiedString& status_text, const char* pText );
108 void UpdateStatusText();
109 void RedrawStatusText();
110 typedef MemberCaller<MainFrame, void(), &MainFrame::RedrawStatusText> RedrawStatusTextCaller;
112 void SetGridStatus();
113 typedef MemberCaller<MainFrame, void(), &MainFrame::SetGridStatus> SetGridStatusCaller;
115 void SetActiveXY( XYWnd* p );
135 void ReleaseContexts();
136 void CreateContexts();
138 EViewStyle CurrentStyle(){
139 return m_nCurrentStyle;
141 bool FloatingGroupDialog(){
142 return CurrentStyle() == eFloating || CurrentStyle() == eSplit;
146 extern MainFrame* g_pParentWnd;
148 ui::Window MainFrame_getWindow();
150 enum EMouseButtonMode
156 struct glwindow_globals_t
160 glwindow_globals_t() :
161 m_nMouseType( EThreeButton ){
165 void GLWindow_Construct();
166 void GLWindow_Destroy();
168 //extern glwindow_globals_t g_glwindow_globals;
169 template<typename Value>
171 extern LatchedValue<bool> g_Layout_enableDetachableMenus;
173 void deleteSelection();
176 void Sys_Status( const char* status );
179 void ScreenUpdates_Disable( const char* message, const char* title );
180 void ScreenUpdates_Enable();
181 bool ScreenUpdates_Enabled();
182 void ScreenUpdates_process();
184 class ScopeDisableScreenUpdates
187 ScopeDisableScreenUpdates( const char* message, const char* title ){
188 ScreenUpdates_Disable( message, title );
190 ~ScopeDisableScreenUpdates(){
191 ScreenUpdates_Enable();
196 void EnginePath_Realise();
197 void EnginePath_Unrealise();
199 class ModuleObserver;
201 void Radiant_attachEnginePathObserver( ModuleObserver& observer );
202 void Radiant_detachEnginePathObserver( ModuleObserver& observer );
204 void Radiant_attachGameToolsPathObserver( ModuleObserver& observer );
205 void Radiant_detachGameToolsPathObserver( ModuleObserver& observer );
207 extern CopiedString g_strEnginePath;
208 void EnginePath_verify();
209 const char* EnginePath_get();
210 const char* QERApp_GetGamePath();
212 extern bool g_disableEnginePath;
213 extern bool g_disableHomePath;
215 const int g_pakPathCount = 5;
216 extern CopiedString g_strPakPath[g_pakPathCount];
217 const char* PakPath_get( int num );
219 extern CopiedString g_strAppFilePath;
220 extern CopiedString g_strAppPath;
221 extern CopiedString g_strLibPath;
222 extern CopiedString g_strDataPath;
224 const char* AppFilePath_get();
225 const char* AppPath_get();
226 const char *LibPath_get();
227 const char *DataPath_get();
229 extern CopiedString g_strSettingsPath;
230 const char* SettingsPath_get();
232 const char* LocalRcPath_get( void );
234 const char* const g_pluginsDir = "plugins/"; ///< name of plugins directory, always sub-directory of toolspath
235 const char* const g_modulesDir = "modules/"; ///< name of modules directory, always sub-directory of toolspath
237 extern CopiedString g_strGameToolsPath;
238 const char* GameToolsPath_get();
240 void Radiant_Initialise();
241 void Radiant_Shutdown();
246 void XY_UpdateAllWindows();
247 void UpdateAllWindows();
250 void ClipperChangeNotify();
255 const char* basegame_get();
256 const char* gamename_get();
257 void gamename_set( const char* gamename );
258 void Radiant_attachGameNameObserver( ModuleObserver& observer );
259 void Radiant_detachGameNameObserver( ModuleObserver& observer );
260 const char* gamemode_get();
261 void gamemode_set( const char* gamemode );
262 void Radiant_attachGameModeObserver( ModuleObserver& observer );
263 void Radiant_detachGameModeObserver( ModuleObserver& observer );
267 void VFS_Construct();
270 void HomePaths_Construct();
271 void HomePaths_Destroy();
272 void Radiant_attachHomePathsObserver( ModuleObserver& observer );
273 void Radiant_detachHomePathsObserver( ModuleObserver& observer );
276 void MainFrame_Construct();
277 void MainFrame_Destroy();
279 extern char **environ;
280 void Radiant_Restart();
282 extern float ( *GridStatus_getGridSize )();
283 extern int ( *GridStatus_getRotateIncrement )();
284 extern int ( *GridStatus_getFarClipDistance )();
285 extern bool ( *GridStatus_getTextureLockEnabled )();
286 void GridStatus_onTextureLockEnabledChanged();
288 SignalHandlerId XYWindowDestroyed_connect( const SignalHandler& handler );
289 void XYWindowDestroyed_disconnect( SignalHandlerId id );
290 MouseEventHandlerId XYWindowMouseDown_connect( const MouseEventHandler& handler );
291 void XYWindowMouseDown_disconnect( MouseEventHandlerId id );
293 extern ui::Widget g_page_entity;
295 void FocusAllViews();