]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - radiant/mainframe.h
radiant: replace StringBuffer with std::string
[xonotic/netradiant.git] / radiant / mainframe.h
1 /*
2    Copyright (C) 1999-2006 Id Software, Inc. and contributors.
3    For a list of contributors, see the accompanying CONTRIBUTORS file.
4
5    This file is part of GtkRadiant.
6
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.
11
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.
16
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
20  */
21
22 #if !defined( INCLUDED_MAINFRAME_H )
23 #define INCLUDED_MAINFRAME_H
24
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"
30
31 #include "qerplugin.h"
32
33 class IPlugIn;
34 class IToolbarButton;
35
36 class XYWnd;
37 class CamWnd;
38 class ZWnd;
39
40
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;
47
48 class MainFrame
49 {
50 public:
51 enum EViewStyle
52 {
53         eRegular = 0,
54         eFloating = 1,
55         eSplit = 2,
56         eRegularLeft = 3,
57 };
58
59 MainFrame();
60 ~MainFrame();
61
62 ui::Window m_window{ui::null};
63
64 CopiedString m_command_status;
65 CopiedString m_position_status;
66 CopiedString m_brushcount_status;
67 CopiedString m_texture_status;
68 CopiedString m_grid_status;
69 private:
70
71 void Create();
72 void SaveWindowInfo();
73 void Shutdown();
74
75 ui::Widget m_vSplit{ui::null};
76 ui::Widget m_hSplit{ui::null};
77 ui::Widget m_vSplit2{ui::null};
78
79 XYWnd* m_pXYWnd;
80 XYWnd* m_pYZWnd;
81 XYWnd* m_pXZWnd;
82 CamWnd* m_pCamWnd;
83 ZWnd* m_pZWnd;
84 XYWnd* m_pActiveXY;
85
86 bool m_bSleeping;
87
88 void *m_pStatusLabel[c_count_status];
89
90
91 EViewStyle m_nCurrentStyle;
92 WindowPositionTracker m_position_tracker;
93
94 IdleDraw m_idleRedrawStatusText;
95
96 public:
97
98 bool IsSleeping(){
99         return m_bSleeping;
100 }
101 void OnSleep();
102
103 void SetStatusText( CopiedString& status_text, const char* pText );
104 void UpdateStatusText();
105 void RedrawStatusText();
106 typedef MemberCaller<MainFrame, void(), &MainFrame::RedrawStatusText> RedrawStatusTextCaller;
107
108 void SetGridStatus();
109 typedef MemberCaller<MainFrame, void(), &MainFrame::SetGridStatus> SetGridStatusCaller;
110
111 void SetActiveXY( XYWnd* p );
112 XYWnd* ActiveXY(){
113         return m_pActiveXY;
114 };
115 XYWnd* GetXYWnd(){
116         return m_pXYWnd;
117 }
118 XYWnd* GetXZWnd(){
119         return m_pXZWnd;
120 }
121 XYWnd* GetYZWnd(){
122         return m_pYZWnd;
123 }
124 ZWnd* GetZWnd(){
125         return m_pZWnd;
126 }
127 CamWnd* GetCamWnd(){
128         return m_pCamWnd;
129 }
130
131 void ReleaseContexts();
132 void CreateContexts();
133
134 EViewStyle CurrentStyle(){
135         return m_nCurrentStyle;
136 };
137 bool FloatingGroupDialog(){
138         return CurrentStyle() == eFloating || CurrentStyle() == eSplit;
139 };
140 };
141
142 extern MainFrame* g_pParentWnd;
143
144 ui::Window MainFrame_getWindow();
145
146 enum EMouseButtonMode
147 {
148         ETwoButton = 0,
149         EThreeButton = 1,
150 };
151
152 struct glwindow_globals_t
153 {
154         int m_nMouseType;
155
156         glwindow_globals_t() :
157                 m_nMouseType( EThreeButton ){
158         }
159 };
160
161 void GLWindow_Construct();
162 void GLWindow_Destroy();
163
164 extern glwindow_globals_t g_glwindow_globals;
165 template<typename Value>
166 class LatchedValue;
167 extern LatchedValue<bool> g_Layout_enableDetachableMenus;
168
169 void deleteSelection();
170
171
172 void Sys_Status( const char* status );
173
174
175 void ScreenUpdates_Disable( const char* message, const char* title );
176 void ScreenUpdates_Enable();
177 bool ScreenUpdates_Enabled();
178 void ScreenUpdates_process();
179
180 class ScopeDisableScreenUpdates
181 {
182 public:
183 ScopeDisableScreenUpdates( const char* message, const char* title ){
184         ScreenUpdates_Disable( message, title );
185 }
186 ~ScopeDisableScreenUpdates(){
187         ScreenUpdates_Enable();
188 }
189 };
190
191
192 void EnginePath_Realise();
193 void EnginePath_Unrealise();
194
195 class ModuleObserver;
196
197 void Radiant_attachEnginePathObserver( ModuleObserver& observer );
198 void Radiant_detachEnginePathObserver( ModuleObserver& observer );
199
200 void Radiant_attachGameToolsPathObserver( ModuleObserver& observer );
201 void Radiant_detachGameToolsPathObserver( ModuleObserver& observer );
202
203 extern CopiedString g_strEnginePath;
204 void EnginePath_verify();
205 const char* EnginePath_get();
206 const char* QERApp_GetGamePath();
207
208 extern bool g_disableEnginePath;
209 extern bool g_disableHomePath;
210
211 const int g_pakPathCount = 5;
212 extern CopiedString g_strPakPath[g_pakPathCount];
213 const char* PakPath_get( int num );
214
215 extern CopiedString g_strAppFilePath;
216 extern CopiedString g_strAppPath;
217 extern CopiedString g_strLibPath;
218 extern CopiedString g_strDataPath;
219
220 const char* AppFilePath_get();
221 const char* AppPath_get();
222 const char *LibPath_get();
223 const char *DataPath_get();
224
225 extern CopiedString g_strSettingsPath;
226 const char* SettingsPath_get();
227
228 const char* LocalRcPath_get( void );
229
230 const char* const g_pluginsDir = "plugins/"; ///< name of plugins directory, always sub-directory of toolspath
231 const char* const g_modulesDir = "modules/"; ///< name of modules directory, always sub-directory of toolspath
232
233 extern CopiedString g_strGameToolsPath;
234 const char* GameToolsPath_get();
235
236 void Radiant_Initialise();
237 void Radiant_Shutdown();
238
239 void SaveMapAs();
240
241
242 void XY_UpdateAllWindows();
243 void UpdateAllWindows();
244
245
246 void ClipperChangeNotify();
247
248 void DefaultMode();
249
250 const char* basegame_get();
251 const char* gamename_get();
252 void gamename_set( const char* gamename );
253 void Radiant_attachGameNameObserver( ModuleObserver& observer );
254 void Radiant_detachGameNameObserver( ModuleObserver& observer );
255 const char* gamemode_get();
256 void gamemode_set( const char* gamemode );
257 void Radiant_attachGameModeObserver( ModuleObserver& observer );
258 void Radiant_detachGameModeObserver( ModuleObserver& observer );
259
260 void VFS_Refresh();
261 void VFS_Restart();
262 void VFS_Construct();
263 void VFS_Destroy();
264
265 void HomePaths_Construct();
266 void HomePaths_Destroy();
267 void Radiant_attachHomePathsObserver( ModuleObserver& observer );
268 void Radiant_detachHomePathsObserver( ModuleObserver& observer );
269
270
271 void MainFrame_Construct();
272 void MainFrame_Destroy();
273
274 extern char **environ;
275 void Radiant_Restart();
276
277 extern float ( *GridStatus_getGridSize )();
278 extern int ( *GridStatus_getRotateIncrement )();
279 extern int ( *GridStatus_getFarClipDistance )();
280 extern bool ( *GridStatus_getTextureLockEnabled )();
281 void GridStatus_onTextureLockEnabledChanged();
282
283 SignalHandlerId XYWindowDestroyed_connect( const SignalHandler& handler );
284 void XYWindowDestroyed_disconnect( SignalHandlerId id );
285 MouseEventHandlerId XYWindowMouseDown_connect( const MouseEventHandler& handler );
286 void XYWindowMouseDown_disconnect( MouseEventHandlerId id );
287
288 extern ui::Widget g_page_entity;
289
290 #endif