]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - radiant/mainframe.h
radiant: add optional pakpath support
[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 const int g_pakPathCount = 5;
209 extern CopiedString g_strPakPath[g_pakPathCount];
210 const char* PakPath_get( int num );
211
212 extern CopiedString g_strAppPath;
213 const char* AppPath_get();
214
215 extern CopiedString g_strSettingsPath;
216 const char* SettingsPath_get();
217
218 const char* LocalRcPath_get( void );
219
220 const char* const g_pluginsDir = "plugins/"; ///< name of plugins directory, always sub-directory of toolspath
221 const char* const g_modulesDir = "modules/"; ///< name of modules directory, always sub-directory of toolspath
222
223 extern CopiedString g_strGameToolsPath;
224 const char* GameToolsPath_get();
225
226 void Radiant_Initialise();
227 void Radiant_Shutdown();
228
229 void SaveMapAs();
230
231
232 void XY_UpdateAllWindows();
233 void UpdateAllWindows();
234
235
236 void ClipperChangeNotify();
237
238 void DefaultMode();
239
240 const char* basegame_get();
241 const char* gamename_get();
242 void gamename_set( const char* gamename );
243 void Radiant_attachGameNameObserver( ModuleObserver& observer );
244 void Radiant_detachGameNameObserver( ModuleObserver& observer );
245 const char* gamemode_get();
246 void gamemode_set( const char* gamemode );
247 void Radiant_attachGameModeObserver( ModuleObserver& observer );
248 void Radiant_detachGameModeObserver( ModuleObserver& observer );
249
250 void VFS_Refresh();
251 void VFS_Restart();
252 void VFS_Construct();
253 void VFS_Destroy();
254
255 void HomePaths_Construct();
256 void HomePaths_Destroy();
257 void Radiant_attachHomePathsObserver( ModuleObserver& observer );
258 void Radiant_detachHomePathsObserver( ModuleObserver& observer );
259
260
261 void MainFrame_Construct();
262 void MainFrame_Destroy();
263
264
265 extern float ( *GridStatus_getGridSize )();
266 extern int ( *GridStatus_getRotateIncrement )();
267 extern int ( *GridStatus_getFarClipDistance )();
268 extern bool ( *GridStatus_getTextureLockEnabled )();
269 void GridStatus_onTextureLockEnabledChanged();
270
271 SignalHandlerId XYWindowDestroyed_connect( const SignalHandler& handler );
272 void XYWindowDestroyed_disconnect( SignalHandlerId id );
273 MouseEventHandlerId XYWindowMouseDown_connect( const MouseEventHandler& handler );
274 void XYWindowMouseDown_disconnect( MouseEventHandlerId id );
275
276 extern ui::Widget g_page_entity;
277
278 #endif