]> git.xonotic.org Git - xonotic/netradiant.git/blob - radiant/mainframe.h
Radiant:
[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 "gtkutil/window.h"
26 #include "gtkutil/idledraw.h"
27 #include "gtkutil/widget.h"
28 #include "string/string.h"
29
30 #include "qerplugin.h"
31
32 class IPlugIn;
33 class IToolbarButton;
34
35 class XYWnd;
36 class CamWnd;
37 class ZWnd;
38
39 typedef struct _GtkWidget GtkWidget;
40 typedef struct _GtkWindow GtkWindow;
41
42 const int c_command_status = 0;
43 const int c_position_status = 1;
44 const int c_brushcount_status = 2;
45 const int c_texture_status = 3;
46 const int c_grid_status = 4;
47 const int c_count_status = 5;
48
49 class MainFrame
50 {
51 public:
52 enum EViewStyle
53 {
54         eRegular = 0,
55         eFloating = 1,
56         eSplit = 2,
57         eRegularLeft = 3,
58 };
59
60 MainFrame();
61 ~MainFrame();
62
63 GtkWindow* m_window;
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 public:
77 GtkWidget* m_vSplit;
78 GtkWidget* m_hSplit;
79 GtkWidget* m_vSplit2;
80
81 private:
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 GtkWidget *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         return m_bSleeping;
104 }
105 void OnSleep();
106
107 void SetStatusText( CopiedString& status_text, const char* pText );
108 void UpdateStatusText();
109 void RedrawStatusText();
110 typedef MemberCaller<MainFrame, &MainFrame::RedrawStatusText> RedrawStatusTextCaller;
111
112 void SetGridStatus();
113 typedef MemberCaller<MainFrame, &MainFrame::SetGridStatus> SetGridStatusCaller;
114
115 void SetActiveXY( XYWnd* p );
116 XYWnd* ActiveXY(){
117         return m_pActiveXY;
118 };
119 XYWnd* GetXYWnd(){
120         return m_pXYWnd;
121 }
122 XYWnd* GetXZWnd(){
123         return m_pXZWnd;
124 }
125 XYWnd* GetYZWnd(){
126         return m_pYZWnd;
127 }
128 ZWnd* GetZWnd(){
129         return m_pZWnd;
130 }
131 CamWnd* GetCamWnd(){
132         return m_pCamWnd;
133 }
134
135 void ReleaseContexts();
136 void CreateContexts();
137
138 EViewStyle CurrentStyle(){
139         return m_nCurrentStyle;
140 };
141 bool FloatingGroupDialog(){
142         return CurrentStyle() == eFloating || CurrentStyle() == eSplit;
143 };
144 };
145
146 extern MainFrame* g_pParentWnd;
147
148 GtkWindow* MainFrame_getWindow();
149 /*
150 enum EMouseButtonMode
151 {
152         ETwoButton = 0,
153         EThreeButton = 1,
154 };
155
156 struct glwindow_globals_t
157 {
158         int m_nMouseType;
159
160         glwindow_globals_t() :
161                 m_nMouseType( EThreeButton ){
162         }
163 };
164 */
165 void GLWindow_Construct();
166 void GLWindow_Destroy();
167
168 //extern glwindow_globals_t g_glwindow_globals;
169 template<typename Value>
170 class LatchedValue;
171 typedef LatchedValue<bool> LatchedBool;
172 extern LatchedBool g_Layout_enableDetachableMenus;
173
174 void deleteSelection();
175
176
177 void Sys_Status( const char* status );
178
179
180 void ScreenUpdates_Disable( const char* message, const char* title );
181 void ScreenUpdates_Enable();
182 bool ScreenUpdates_Enabled();
183 void ScreenUpdates_process();
184
185 class ScopeDisableScreenUpdates
186 {
187 public:
188 ScopeDisableScreenUpdates( const char* message, const char* title ){
189         ScreenUpdates_Disable( message, title );
190 }
191 ~ScopeDisableScreenUpdates(){
192         ScreenUpdates_Enable();
193 }
194 };
195
196
197 void EnginePath_Realise();
198 void EnginePath_Unrealise();
199
200 class ModuleObserver;
201
202 void Radiant_attachEnginePathObserver( ModuleObserver& observer );
203 void Radiant_detachEnginePathObserver( ModuleObserver& observer );
204
205 void Radiant_attachGameToolsPathObserver( ModuleObserver& observer );
206 void Radiant_detachGameToolsPathObserver( ModuleObserver& observer );
207
208 extern CopiedString g_strEnginePath;
209 void EnginePath_verify();
210 const char* EnginePath_get();
211 const char* QERApp_GetGamePath();
212
213 extern CopiedString g_strAppPath;
214 const char* AppPath_get();
215
216 extern CopiedString g_strSettingsPath;
217 const char* SettingsPath_get();
218
219 const char* LocalRcPath_get( void );
220
221 const char* const g_pluginsDir = "plugins/"; ///< name of plugins directory, always sub-directory of toolspath
222 const char* const g_modulesDir = "modules/"; ///< name of modules directory, always sub-directory of toolspath
223
224 extern CopiedString g_strGameToolsPath;
225 const char* GameToolsPath_get();
226
227 void Radiant_Initialise();
228 void Radiant_Shutdown();
229
230 void SaveMapAs();
231
232
233 void XY_UpdateAllWindows();
234 void UpdateAllWindows();
235
236
237 void ClipperChangeNotify();
238 void ClipperMode();
239
240 void DefaultMode();
241
242 const char* basegame_get();
243 const char* gamename_get();
244 void gamename_set( const char* gamename );
245 void Radiant_attachGameNameObserver( ModuleObserver& observer );
246 void Radiant_detachGameNameObserver( ModuleObserver& observer );
247 const char* gamemode_get();
248 void gamemode_set( const char* gamemode );
249 void Radiant_attachGameModeObserver( ModuleObserver& observer );
250 void Radiant_detachGameModeObserver( ModuleObserver& observer );
251
252
253
254 void VFS_Construct();
255 void VFS_Destroy();
256
257 void HomePaths_Construct();
258 void HomePaths_Destroy();
259 void Radiant_attachHomePathsObserver( ModuleObserver& observer );
260 void Radiant_detachHomePathsObserver( ModuleObserver& observer );
261
262
263 void MainFrame_Construct();
264 void MainFrame_Destroy();
265
266
267 extern float ( *GridStatus_getGridSize )();
268 extern int ( *GridStatus_getRotateIncrement )();
269 extern int ( *GridStatus_getFarClipDistance )();
270 extern bool ( *GridStatus_getTextureLockEnabled )();
271 void GridStatus_onTextureLockEnabledChanged();
272
273 SignalHandlerId XYWindowDestroyed_connect( const SignalHandler& handler );
274 void XYWindowDestroyed_disconnect( SignalHandlerId id );
275 MouseEventHandlerId XYWindowMouseDown_connect( const MouseEventHandler& handler );
276 void XYWindowMouseDown_disconnect( MouseEventHandlerId id );
277
278 extern GtkWidget* g_page_entity;
279
280 #endif