]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - radiant/mainframe.h
Merge branch 'transfilterfix' into 'master'
[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
35 class IToolbarButton;
36
37 class XYWnd;
38
39 class CamWnd;
40
41 class ZWnd;
42
43
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;
50
51 class MainFrame {
52 public:
53     enum EViewStyle {
54         eRegular = 0,
55         eFloating = 1,
56         eSplit = 2,
57         eRegularLeft = 3,
58     };
59
60     MainFrame();
61
62     ~MainFrame();
63
64     ui::Window m_window{ui::null};
65
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;
71 private:
72
73     void Create();
74
75     void SaveWindowInfo();
76
77     void Shutdown();
78
79     ui::Widget m_vSplit{ui::null};
80     ui::Widget m_hSplit{ui::null};
81     ui::Widget m_vSplit2{ui::null};
82
83     XYWnd *m_pXYWnd;
84     XYWnd *m_pYZWnd;
85     XYWnd *m_pXZWnd;
86     CamWnd *m_pCamWnd;
87     ZWnd *m_pZWnd;
88     XYWnd *m_pActiveXY;
89
90     bool m_bSleeping;
91
92     void *m_pStatusLabel[c_count_status];
93
94
95     EViewStyle m_nCurrentStyle;
96     WindowPositionTracker m_position_tracker;
97
98     IdleDraw m_idleRedrawStatusText;
99
100 public:
101
102     bool IsSleeping()
103     {
104         return m_bSleeping;
105     }
106
107     void OnSleep();
108
109     void SetStatusText(CopiedString &status_text, const char *pText);
110
111     void UpdateStatusText();
112
113     void RedrawStatusText();
114
115     typedef MemberCaller<MainFrame, void(), &MainFrame::RedrawStatusText> RedrawStatusTextCaller;
116
117     void SetGridStatus();
118
119     typedef MemberCaller<MainFrame, void(), &MainFrame::SetGridStatus> SetGridStatusCaller;
120
121     void SetActiveXY(XYWnd *p);
122
123     XYWnd *ActiveXY()
124     {
125         return m_pActiveXY;
126     };
127
128     XYWnd *GetXYWnd()
129     {
130         return m_pXYWnd;
131     }
132
133     XYWnd *GetXZWnd()
134     {
135         return m_pXZWnd;
136     }
137
138     XYWnd *GetYZWnd()
139     {
140         return m_pYZWnd;
141     }
142
143     ZWnd *GetZWnd()
144     {
145         return m_pZWnd;
146     }
147
148     CamWnd *GetCamWnd()
149     {
150         return m_pCamWnd;
151     }
152
153     void ReleaseContexts();
154
155     void CreateContexts();
156
157     EViewStyle CurrentStyle()
158     {
159         return m_nCurrentStyle;
160     };
161
162     bool FloatingGroupDialog()
163     {
164         return CurrentStyle() == eFloating || CurrentStyle() == eSplit;
165     };
166 };
167
168 extern MainFrame *g_pParentWnd;
169
170 ui::Window MainFrame_getWindow();
171
172 enum EMouseButtonMode {
173     ETwoButton = 0,
174     EThreeButton = 1,
175 };
176
177 struct glwindow_globals_t {
178     int m_nMouseType;
179
180     glwindow_globals_t() :
181             m_nMouseType(EThreeButton)
182     {
183     }
184 };
185
186 void GLWindow_Construct();
187
188 void GLWindow_Destroy();
189
190 extern glwindow_globals_t g_glwindow_globals;
191
192 template<typename Value>
193 class LatchedValue;
194
195 extern LatchedValue<bool> g_Layout_enableDetachableMenus;
196
197 void deleteSelection();
198
199
200 void Sys_Status(const char *status);
201
202
203 void ScreenUpdates_Disable(const char *message, const char *title);
204
205 void ScreenUpdates_Enable();
206
207 bool ScreenUpdates_Enabled();
208
209 void ScreenUpdates_process();
210
211 class ScopeDisableScreenUpdates {
212 public:
213     ScopeDisableScreenUpdates(const char *message, const char *title)
214     {
215         ScreenUpdates_Disable(message, title);
216     }
217
218     ~ScopeDisableScreenUpdates()
219     {
220         ScreenUpdates_Enable();
221     }
222 };
223
224
225 void EnginePath_Realise();
226
227 void EnginePath_Unrealise();
228
229 class ModuleObserver;
230
231 void Radiant_attachEnginePathObserver(ModuleObserver &observer);
232
233 void Radiant_detachEnginePathObserver(ModuleObserver &observer);
234
235 void Radiant_attachGameToolsPathObserver(ModuleObserver &observer);
236
237 void Radiant_detachGameToolsPathObserver(ModuleObserver &observer);
238
239 extern CopiedString g_strEnginePath;
240
241 void EnginePath_verify();
242
243 const char *EnginePath_get();
244
245 const char *QERApp_GetGamePath();
246
247 extern bool g_disableEnginePath;
248 extern bool g_disableHomePath;
249
250 const int g_pakPathCount = 5;
251 extern CopiedString g_strPakPath[g_pakPathCount];
252
253 const char *PakPath_get(int num);
254
255 extern CopiedString g_strAppPath;
256
257 const char *AppPath_get();
258
259 extern CopiedString g_strSettingsPath;
260
261 const char *SettingsPath_get();
262
263 const char *LocalRcPath_get(void);
264
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
267
268 extern CopiedString g_strGameToolsPath;
269
270 const char *GameToolsPath_get();
271
272 void Radiant_Initialise();
273
274 void Radiant_Shutdown();
275
276 void SaveMapAs();
277
278
279 void XY_UpdateAllWindows();
280
281 void UpdateAllWindows();
282
283
284 void ClipperChangeNotify();
285
286 void DefaultMode();
287
288 const char *basegame_get();
289
290 const char *gamename_get();
291
292 void gamename_set(const char *gamename);
293
294 void Radiant_attachGameNameObserver(ModuleObserver &observer);
295
296 void Radiant_detachGameNameObserver(ModuleObserver &observer);
297
298 const char *gamemode_get();
299
300 void gamemode_set(const char *gamemode);
301
302 void Radiant_attachGameModeObserver(ModuleObserver &observer);
303
304 void Radiant_detachGameModeObserver(ModuleObserver &observer);
305
306 void VFS_Refresh();
307
308 void VFS_Restart();
309
310 void VFS_Construct();
311
312 void VFS_Destroy();
313
314 void HomePaths_Construct();
315
316 void HomePaths_Destroy();
317
318 void Radiant_attachHomePathsObserver(ModuleObserver &observer);
319
320 void Radiant_detachHomePathsObserver(ModuleObserver &observer);
321
322
323 void MainFrame_Construct();
324
325 void MainFrame_Destroy();
326
327
328 extern float ( *GridStatus_getGridSize )();
329
330 extern int ( *GridStatus_getRotateIncrement )();
331
332 extern int ( *GridStatus_getFarClipDistance )();
333
334 extern bool ( *GridStatus_getTextureLockEnabled )();
335
336 void GridStatus_onTextureLockEnabledChanged();
337
338 SignalHandlerId XYWindowDestroyed_connect(const SignalHandler &handler);
339
340 void XYWindowDestroyed_disconnect(SignalHandlerId id);
341
342 MouseEventHandlerId XYWindowMouseDown_connect(const MouseEventHandler &handler);
343
344 void XYWindowMouseDown_disconnect(MouseEventHandlerId id);
345
346 extern ui::Widget g_page_entity;
347
348 #endif