]> git.xonotic.org Git - xonotic/netradiant.git/blob - radiant/mainframe.h
Merge commit 'c92c662abbbbc7ed93f628ad0e0f25e996ab686c' into garux-merge
[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 public:
76 ui::Widget m_vSplit{ui::null};
77 ui::Widget m_hSplit{ui::null};
78 ui::Widget m_vSplit2{ui::null};
79
80 private:
81
82 XYWnd* m_pXYWnd;
83 XYWnd* m_pYZWnd;
84 XYWnd* m_pXZWnd;
85 CamWnd* m_pCamWnd;
86 ZWnd* m_pZWnd;
87 XYWnd* m_pActiveXY;
88
89 bool m_bSleeping;
90
91 void *m_pStatusLabel[c_count_status];
92
93
94 EViewStyle m_nCurrentStyle;
95 WindowPositionTracker m_position_tracker;
96
97 IdleDraw m_idleRedrawStatusText;
98
99 public:
100
101 bool IsSleeping(){
102         return m_bSleeping;
103 }
104 void OnSleep();
105
106 void SetStatusText( CopiedString& status_text, const char* pText );
107 void UpdateStatusText();
108 void RedrawStatusText();
109 typedef MemberCaller<MainFrame, void(), &MainFrame::RedrawStatusText> RedrawStatusTextCaller;
110
111 void SetGridStatus();
112 typedef MemberCaller<MainFrame, void(), &MainFrame::SetGridStatus> SetGridStatusCaller;
113
114 void SetActiveXY( XYWnd* p );
115 XYWnd* ActiveXY(){
116         return m_pActiveXY;
117 };
118 XYWnd* GetXYWnd(){
119         return m_pXYWnd;
120 }
121 XYWnd* GetXZWnd(){
122         return m_pXZWnd;
123 }
124 XYWnd* GetYZWnd(){
125         return m_pYZWnd;
126 }
127 ZWnd* GetZWnd(){
128         return m_pZWnd;
129 }
130 CamWnd* GetCamWnd(){
131         return m_pCamWnd;
132 }
133
134 void ReleaseContexts();
135 void CreateContexts();
136
137 EViewStyle CurrentStyle(){
138         return m_nCurrentStyle;
139 };
140 bool FloatingGroupDialog(){
141         return CurrentStyle() == eFloating || CurrentStyle() == eSplit;
142 };
143 };
144
145 extern MainFrame* g_pParentWnd;
146
147 ui::Window MainFrame_getWindow();
148 /*
149 enum EMouseButtonMode
150 {
151         ETwoButton = 0,
152         EThreeButton = 1,
153 };
154
155 struct glwindow_globals_t
156 {
157         int m_nMouseType;
158
159         glwindow_globals_t() :
160                 m_nMouseType( EThreeButton ){
161         }
162 };
163 */
164 void GLWindow_Construct();
165 void GLWindow_Destroy();
166
167 //extern glwindow_globals_t g_glwindow_globals;
168 template<typename Value>
169 class LatchedValue;
170 extern LatchedValue<bool> g_Layout_enableDetachableMenus;
171
172 void deleteSelection();
173
174
175 void Sys_Status( const char* status );
176
177
178 void ScreenUpdates_Disable( const char* message, const char* title );
179 void ScreenUpdates_Enable();
180 bool ScreenUpdates_Enabled();
181 void ScreenUpdates_process();
182
183 class ScopeDisableScreenUpdates
184 {
185 public:
186 ScopeDisableScreenUpdates( const char* message, const char* title ){
187         ScreenUpdates_Disable( message, title );
188 }
189 ~ScopeDisableScreenUpdates(){
190         ScreenUpdates_Enable();
191 }
192 };
193
194
195 void EnginePath_Realise();
196 void EnginePath_Unrealise();
197
198 class ModuleObserver;
199
200 void Radiant_attachEnginePathObserver( ModuleObserver& observer );
201 void Radiant_detachEnginePathObserver( ModuleObserver& observer );
202
203 void Radiant_attachGameToolsPathObserver( ModuleObserver& observer );
204 void Radiant_detachGameToolsPathObserver( ModuleObserver& observer );
205
206 extern CopiedString g_strEnginePath;
207 void EnginePath_verify();
208 const char* EnginePath_get();
209 const char* QERApp_GetGamePath();
210
211 extern bool g_disableEnginePath;
212 extern bool g_disableHomePath;
213
214 const int g_pakPathCount = 5;
215 extern CopiedString g_strPakPath[g_pakPathCount];
216 const char* PakPath_get( int num );
217
218 extern CopiedString g_strAppPath;
219 const char* AppPath_get();
220
221 extern CopiedString g_strSettingsPath;
222 const char* SettingsPath_get();
223
224 const char* LocalRcPath_get( void );
225
226 const char* const g_pluginsDir = "plugins/"; ///< name of plugins directory, always sub-directory of toolspath
227 const char* const g_modulesDir = "modules/"; ///< name of modules directory, always sub-directory of toolspath
228
229 extern CopiedString g_strGameToolsPath;
230 const char* GameToolsPath_get();
231
232 void Radiant_Initialise();
233 void Radiant_Shutdown();
234
235 void SaveMapAs();
236
237
238 void XY_UpdateAllWindows();
239 void UpdateAllWindows();
240
241
242 void ClipperChangeNotify();
243 void ClipperMode();
244
245 void DefaultMode();
246
247 const char* basegame_get();
248 const char* gamename_get();
249 void gamename_set( const char* gamename );
250 void Radiant_attachGameNameObserver( ModuleObserver& observer );
251 void Radiant_detachGameNameObserver( ModuleObserver& observer );
252 const char* gamemode_get();
253 void gamemode_set( const char* gamemode );
254 void Radiant_attachGameModeObserver( ModuleObserver& observer );
255 void Radiant_detachGameModeObserver( ModuleObserver& observer );
256
257 void VFS_Refresh();
258 void VFS_Restart();
259 void VFS_Construct();
260 void VFS_Destroy();
261
262 void HomePaths_Construct();
263 void HomePaths_Destroy();
264 void Radiant_attachHomePathsObserver( ModuleObserver& observer );
265 void Radiant_detachHomePathsObserver( ModuleObserver& observer );
266
267
268 void MainFrame_Construct();
269 void MainFrame_Destroy();
270
271
272 extern float ( *GridStatus_getGridSize )();
273 extern int ( *GridStatus_getRotateIncrement )();
274 extern int ( *GridStatus_getFarClipDistance )();
275 extern bool ( *GridStatus_getTextureLockEnabled )();
276 void GridStatus_onTextureLockEnabledChanged();
277
278 SignalHandlerId XYWindowDestroyed_connect( const SignalHandler& handler );
279 void XYWindowDestroyed_disconnect( SignalHandlerId id );
280 MouseEventHandlerId XYWindowMouseDown_connect( const MouseEventHandler& handler );
281 void XYWindowMouseDown_disconnect( MouseEventHandlerId id );
282
283 extern ui::Widget g_page_entity;
284
285 void FocusAllViews();
286
287 #endif