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