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"
40 const int c_command_status = 0;
41 const int c_position_status = 1;
42 const int c_brushcount_status = 2;
43 const int c_texture_status = 3;
44 const int c_grid_status = 4;
45 const int c_count_status = 5;
63 std::string m_command_status;
64 std::string m_position_status;
65 std::string m_brushcount_status;
66 std::string m_texture_status;
67 std::string m_grid_status;
71 void SaveWindowInfo();
87 ui::Widget m_pStatusLabel[c_count_status];
90 EViewStyle m_nCurrentStyle;
91 WindowPositionTracker m_position_tracker;
93 IdleDraw m_idleRedrawStatusText;
102 void SetStatusText( std::string& status_text, const char* pText );
103 void UpdateStatusText();
104 void RedrawStatusText();
105 typedef MemberCaller<MainFrame, &MainFrame::RedrawStatusText> RedrawStatusTextCaller;
107 void SetGridStatus();
108 typedef MemberCaller<MainFrame, &MainFrame::SetGridStatus> SetGridStatusCaller;
110 void SetActiveXY( XYWnd* p );
130 void ReleaseContexts();
131 void CreateContexts();
133 EViewStyle CurrentStyle(){
134 return m_nCurrentStyle;
136 bool FloatingGroupDialog(){
137 return CurrentStyle() == eFloating || CurrentStyle() == eSplit;
141 extern MainFrame* g_pParentWnd;
143 ui::Window MainFrame_getWindow();
145 enum EMouseButtonMode
151 struct glwindow_globals_t
155 glwindow_globals_t() :
156 m_nMouseType( EThreeButton ){
160 void GLWindow_Construct();
161 void GLWindow_Destroy();
163 extern glwindow_globals_t g_glwindow_globals;
164 template<typename Value>
166 typedef LatchedValue<bool> LatchedBool;
167 extern LatchedBool g_Layout_enableDetachableMenus;
169 void deleteSelection();
172 void Sys_Status( const char* status );
175 void ScreenUpdates_Disable( const char* message, const char* title );
176 void ScreenUpdates_Enable();
177 bool ScreenUpdates_Enabled();
178 void ScreenUpdates_process();
180 class ScopeDisableScreenUpdates
183 ScopeDisableScreenUpdates( const char* message, const char* title ){
184 ScreenUpdates_Disable( message, title );
186 ~ScopeDisableScreenUpdates(){
187 ScreenUpdates_Enable();
192 void EnginePath_Realise();
193 void EnginePath_Unrealise();
195 class ModuleObserver;
197 void Radiant_attachEnginePathObserver( ModuleObserver& observer );
198 void Radiant_detachEnginePathObserver( ModuleObserver& observer );
200 void Radiant_attachGameToolsPathObserver( ModuleObserver& observer );
201 void Radiant_detachGameToolsPathObserver( ModuleObserver& observer );
203 extern std::string g_strEnginePath;
204 void EnginePath_verify();
205 const char* EnginePath_get();
206 const char* QERApp_GetGamePath();
208 extern std::string g_strAppPath;
209 const char* AppPath_get();
211 extern std::string g_strSettingsPath;
212 const char* SettingsPath_get();
214 const char* LocalRcPath_get( void );
216 const char* const g_pluginsDir = "plugins/"; ///< name of plugins directory, always sub-directory of toolspath
217 const char* const g_modulesDir = "modules/"; ///< name of modules directory, always sub-directory of toolspath
219 extern std::string g_strGameToolsPath;
220 const char* GameToolsPath_get();
222 void Radiant_Initialise();
223 void Radiant_Shutdown();
228 void XY_UpdateAllWindows();
229 void UpdateAllWindows();
232 void ClipperChangeNotify();
236 const char* basegame_get();
237 const char* gamename_get();
238 void gamename_set( const char* gamename );
239 void Radiant_attachGameNameObserver( ModuleObserver& observer );
240 void Radiant_detachGameNameObserver( ModuleObserver& observer );
241 const char* gamemode_get();
242 void gamemode_set( const char* gamemode );
243 void Radiant_attachGameModeObserver( ModuleObserver& observer );
244 void Radiant_detachGameModeObserver( ModuleObserver& observer );
248 void VFS_Construct();
251 void HomePaths_Construct();
252 void HomePaths_Destroy();
253 void Radiant_attachHomePathsObserver( ModuleObserver& observer );
254 void Radiant_detachHomePathsObserver( ModuleObserver& observer );
257 void MainFrame_Construct();
258 void MainFrame_Destroy();
261 extern float ( *GridStatus_getGridSize )();
262 extern int ( *GridStatus_getRotateIncrement )();
263 extern int ( *GridStatus_getFarClipDistance )();
264 extern bool ( *GridStatus_getTextureLockEnabled )();
265 void GridStatus_onTextureLockEnabledChanged();
267 SignalHandlerId XYWindowDestroyed_connect( const SignalHandler& handler );
268 void XYWindowDestroyed_disconnect( SignalHandlerId id );
269 MouseEventHandlerId XYWindowMouseDown_connect( const MouseEventHandler& handler );
270 void XYWindowMouseDown_disconnect( MouseEventHandlerId id );
272 extern ui::Widget g_page_entity;