]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - radiant/mainframe.h
changed doom3/quake4 light creation to use size of selected brushes
[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 class IPlugIn;
31 class IToolbarButton;
32
33 class XYWnd;
34 class CamWnd;
35 class ZWnd;
36
37 typedef struct _GtkWidget GtkWidget;
38 typedef struct _GtkWindow GtkWindow;
39
40 const int c_command_status = 0;
41 const int c_position_status = 1;
42 const int c_brushcount_status = 2;
43 const int c_texture_status = 3;
44 const int c_grid_status = 4;
45 const int c_count_status = 5;
46
47 class MainFrame
48 {
49 public:
50   enum EViewStyle
51   {
52     eRegular = 0,
53     eFloating = 1,
54     eSplit = 2,
55     eRegularLeft = 3,
56   };
57
58   MainFrame();
59   ~MainFrame();
60
61   GtkWindow* m_window;
62
63   CopiedString m_command_status;
64   CopiedString m_position_status;
65   CopiedString m_brushcount_status;
66   CopiedString m_texture_status;
67   CopiedString m_grid_status;
68 private:
69
70   void Create();
71   void SaveWindowInfo();
72   void Shutdown();
73
74   GtkWidget* m_vSplit;
75   GtkWidget* m_hSplit;
76   GtkWidget* m_vSplit2;
77
78   XYWnd* m_pXYWnd;
79   XYWnd* m_pYZWnd;
80   XYWnd* m_pXZWnd;
81   CamWnd* m_pCamWnd;
82   ZWnd* m_pZWnd;
83   XYWnd* m_pActiveXY;
84
85   bool m_bSleeping;
86
87   GtkWidget *m_pStatusLabel[c_count_status];
88
89
90   EViewStyle m_nCurrentStyle;
91   WindowPositionTracker m_position_tracker;
92
93   IdleDraw m_idleRedrawStatusText;
94
95 public:
96
97   bool IsSleeping()
98   {
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, &MainFrame::RedrawStatusText> RedrawStatusTextCaller;
107
108   void SetGridStatus();
109   typedef MemberCaller<MainFrame, &MainFrame::SetGridStatus> SetGridStatusCaller;
110
111   void SetActiveXY(XYWnd* p);
112   XYWnd* ActiveXY()
113   {
114     return m_pActiveXY;
115   };
116   XYWnd* GetXYWnd()
117   {
118     return m_pXYWnd;
119   }
120   XYWnd* GetXZWnd()
121   {
122     return m_pXZWnd;
123   }
124   XYWnd* GetYZWnd()
125   {
126     return m_pYZWnd;
127   }
128   ZWnd* GetZWnd()
129   {
130     return m_pZWnd;
131   }
132   CamWnd* GetCamWnd()
133   {
134     return m_pCamWnd;
135   }
136
137   void ReleaseContexts();
138   void CreateContexts();
139
140   EViewStyle CurrentStyle()
141   {
142     return m_nCurrentStyle;
143   };
144   bool FloatingGroupDialog()
145   {
146     return CurrentStyle() == eFloating || CurrentStyle() == eSplit;
147   };
148 };
149
150 extern MainFrame* g_pParentWnd;
151
152 GtkWindow* MainFrame_getWindow();
153
154 enum EMouseButtonMode
155 {
156   ETwoButton = 0,
157   EThreeButton = 1,
158 };
159
160 struct glwindow_globals_t
161 {
162   int m_nMouseType;
163
164   glwindow_globals_t() :
165     m_nMouseType(EThreeButton)
166   {
167   }
168 };
169
170 void GLWindow_Construct();
171 void GLWindow_Destroy();
172
173 extern glwindow_globals_t g_glwindow_globals;
174 template<typename Value>
175 class LatchedValue;
176 typedef LatchedValue<bool> LatchedBool;
177 extern LatchedBool g_Layout_enableDetachableMenus;
178
179 void deleteSelection();
180
181
182 void Sys_Status(const char* status);
183
184
185 void ScreenUpdates_Disable(const char* message, const char* title = "");
186 void ScreenUpdates_Enable();
187 bool ScreenUpdates_Enabled();
188 void ScreenUpdates_process();
189
190 class ScopeDisableScreenUpdates
191 {
192 public:
193   ScopeDisableScreenUpdates(const char* message, const char* title = "")
194   {
195     ScreenUpdates_Disable(message, title);
196   }
197   ~ScopeDisableScreenUpdates()
198   {
199     ScreenUpdates_Enable();
200   }
201 };
202
203
204 void EnginePath_Realise();
205 void EnginePath_Unrealise();
206
207 class ModuleObserver;
208
209 void Radiant_attachEnginePathObserver(ModuleObserver& observer);
210 void Radiant_detachEnginePathObserver(ModuleObserver& observer);
211
212 void Radiant_attachGameToolsPathObserver(ModuleObserver& observer);
213 void Radiant_detachGameToolsPathObserver(ModuleObserver& observer);
214
215 extern CopiedString g_strEnginePath;
216 void EnginePath_verify();
217 const char* EnginePath_get();
218 const char* QERApp_GetGamePath();
219
220 extern CopiedString g_strAppPath;
221 const char* AppPath_get();
222
223 extern CopiedString g_strSettingsPath;
224 const char* SettingsPath_get();
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
244 void DefaultMode();
245
246 const char* basegame_get();
247 const char* gamename_get();
248 void gamename_set(const char* gamename);
249 void Radiant_attachGameNameObserver(ModuleObserver& observer);
250 void Radiant_detachGameNameObserver(ModuleObserver& observer);
251 const char* gamemode_get();
252 void gamemode_set(const char* gamemode);
253 void Radiant_attachGameModeObserver(ModuleObserver& observer);
254 void Radiant_detachGameModeObserver(ModuleObserver& observer);
255
256
257
258 void VFS_Construct();
259 void VFS_Destroy();
260
261 void HomePaths_Construct();
262 void HomePaths_Destroy();
263 void Radiant_attachHomePathsObserver(ModuleObserver& observer);
264 void Radiant_detachHomePathsObserver(ModuleObserver& observer);
265
266
267 void MainFrame_Construct();
268 void MainFrame_Destroy();
269
270
271 extern float (*GridStatus_getGridSize)();
272 extern int (*GridStatus_getRotateIncrement)();
273 extern int (*GridStatus_getFarClipDistance)();
274 extern bool (*GridStatus_getTextureLockEnabled)();
275 void GridStatus_onTextureLockEnabledChanged();
276
277
278
279 #endif