Merge pull request #50 from merlin1991/ETPack
[xonotic/netradiant.git] / radiant / mainframe.h
1 /*
2    Copyright (C) 1999-2007 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 #ifndef _MAINFRAME_H_
23 #define _MAINFRAME_H_
24
25 #include "xywindow.h"
26 #include "texwindow.h"
27 #include "zwindow.h"
28 #include "camwindow.h"
29 #include "watchbsp.h"
30
31 #include "pluginmanager.h"
32 #include "plugin.h"
33
34 #include "gtkr_vector.h"
35
36 #ifdef __APPLE__
37 #define __toascii( c )    ( ( c ) & 0x7f )
38 #endif
39
40 const int RAD_SHIFT =   0x01;
41 const int RAD_ALT =     0x02;
42 const int RAD_CONTROL = 0x04;
43 const int RAD_PRESS   = 0x08;
44
45 struct SCommandInfo
46 {
47         char* m_strCommand;
48         unsigned int m_nKey;
49         unsigned int m_nModifiers;
50         unsigned int m_nCommand;
51         char* m_strMenu;
52 };
53
54 struct SKeyInfo
55 {
56         const char* m_strName;
57         unsigned int m_nVKKey;
58 };
59
60 #define ID_FILE_NEW 0xE100
61 #define ID_FILE_OPEN 0xE101
62 #define ID_FILE_SAVE 0xE103
63 #define ID_EDIT_UNDO 0xE12B
64 #define ID_EDIT_REDO 0xE12C
65 #define ID_HELP 0xE146
66 #define ID_FILE_RECENT1 0xE110
67 #define ID_FILE_RECENT2 0xE111
68 #define ID_FILE_RECENT3 0xE112
69 #define ID_FILE_RECENT4 0xE113
70
71 #define IDC_BTN_FACEFIT                 1143
72 #define ID_ENTITY_START                 22800
73 #define ID_ENTITY_END                   32000 //leo
74 //#define ID_ENTITY_END                   33500
75 #define ID_VIEW_XY                      32772
76 #define ID_VIEW_SIDE                    32773
77 #define ID_VIEW_FRONT                   32774
78 #define ID_CAMERATOGGLE                 32775
79 #define ID_VIEW_CAMERATOGGLE            32776
80 #define ID_BUTTON32777                  32777
81 #define ID_BUTTON32778                  32778
82 #define ID_TEXTURES_POPUP               32780
83 #define ID_POPUP_SELECTION              32782
84 #define ID_VIEW_CHANGE                  32783
85 #define ID_VIEW_CAMERAUPDATE            32784
86 #define ID_VIEW_CLIPPER                 32785
87 #define ID_PREFS                        32786
88 #define ID_TOGGLE_LOCK                  32787
89 #define ID_EDIT_MAPINFO                 32788
90 #define ID_EDIT_ENTITYINFO              32789
91 #define ID_BRUSH_SCRIPTS                32790
92 #define ID_VIEW_NEXTVIEW                32791
93 #define ID_HELP_COMMANDLIST             32792
94 #define ID_FILE_NEWPROJECT              32793
95 #define ID_SNAPTOGRID                   32795
96 #define ID_VIEW_CENTERVIEW              32796
97 #define ID_SPLIT_SELECTED               32823
98 #define ID_CLIP_SELECTED                32824
99 #define ID_FLIP_CLIP                    32825
100 #define ID_TOGGLEVIEW_YZ                32831
101 #define ID_TOGGLEVIEW_XZ                32832
102 #define ID_COLORS_GRIDTEXT              32833
103 #define ID_COLORS_BRUSH                 32834
104 #define ID_COLORS_SELECTEDBRUSH         32835
105 #define ID_COLORS_CLIPPER               32836
106 #define ID_COLORS_GRIDBLOCK             32837
107 #define ID_COLORS_VIEWNAME              32838
108 #define ID_COLOR_SETORIGINAL            32839
109 #define ID_COLOR_SETQER                 32840
110 #define ID_COLOR_SETBLACK               32841
111 #define ID_COLOR_SETYDNAR               37001  /* ydnar */
112 #define ID_BYEBYE                       32842
113 #define ID_SELECT_SCALE                 32843
114 #define ID_SELECT_MOUSEROTATE           32844
115 #define ID_COLORS_SELECTEDBRUSH3D       32845
116 #define ID_COLORS_CAMERABACK            32846
117 #define ID_TEXTURE_REPLACESELECTED      32859
118 #define ID_TEXTURE_REPLACEALL           32860
119 #define ID_SELECT_MOUSESCALE            32866
120 #define ID_SCALELOCKX                   32867
121 #define ID_SCALELOCKY                   32868
122 #define ID_SCALELOCKZ                   32869
123 #define ID_VIEW_CUBICCLIPPING           32870
124 #define ID_FILE_PROJECTSETTINGS         32875
125 #define ID_VIEW_CUBEOUT                 32876
126 #define ID_VIEW_CUBEIN                  32877
127 #define ID_NODES_LOADNODES              32878
128 #define ID_NODES_SHOWNODES              32879
129 #define ID_NODES_SHOWLINKS              32880
130 #define ID_NODES_REMOVEALLNODES         32881
131 #define ID_NODES_COUNTNODES             32882
132 #define ID_NODES_GIVEMONEYTONELNO       32883
133 #define ID_FILE_SAVEREGION              32887
134 #define ID_FILE_LOADREGION              32888
135 #define ID_SELECTION_MOVEDOWN           32890
136 #define ID_TOOLBAR_MAIN                 32891
137 #define ID_SELECTION_MOVEUP             32892
138 //#define ID_TOOLBAR_TEXTURE              32892
139 #define ID_BRUSH_MAKECONE               32896
140 #define ID_TEXTURES_LOAD                32897
141 #define ID_TOGGLE_ROTATELOCK            32898
142 #define ID_FILE_IMPORTMAP               32911
143 #define ID_FILE_EXPORTMAP               32912
144 #define ID_EDIT_LOADPREFAB              32913
145 #define ID_SELECTION_SELECT_NUDGELEFT   32916
146 #define ID_SELECTION_SELECT_NUDGERIGHT  32917
147 #define ID_SELECTION_SELECT_NUDGEUP     32918
148 #define ID_SELECTION_SELECT_NUDGEDOWN   32919
149 #define ID_TEXTURES_LOADLIST            32920
150 #define ID_DONTSELECTCURVE              32923
151 #define ID_CONVERTCURVES                32924
152 #define ID_PATCH_SHOWBOUNDINGBOX        32926
153 #define ID_CURVE_SIMPLEPATCHMESH        32927
154 #define ID_PATCH_WIREFRAME              32928
155 #define ID_PATCH_WELD                   32929
156 #define ID_CURVE_PATCHTUBE              32930
157 #define ID_CURVE_PATCHCONE              32931
158 #define ID_CURVE_PATCHENDCAP            32932
159 #define ID_CURVE_PATCHBEVEL             32933
160 #define ID_PATCH_DRILLDOWN              32936
161 #define ID_CURVE_LOADPATCHFILE          32937
162 #define ID_CURVE_INSERTROW              32938
163 #define ID_CURVE_INSERTCOLUMN           32939
164 #define ID_CURVE_DELETEROW              32940
165 #define ID_CURVE_DELETECOLUMN           32941
166 #define ID_BUTTON32942                  32942
167 //#define ID_PATCH_INSDEL                 32942
168 #define ID_CURVE_INSERT_ADDCOLUMN       32943
169 #define ID_CURVE_INSERT_INSERTCOLUMN    32944
170 #define ID_CURVE_INSERT_ADDROW          32945
171 #define ID_CURVE_INSERT_INSERTROW       32946
172 #define ID_CURVE_DELETE_FIRSTCOLUMN     32947
173 #define ID_CURVE_DELETE_LASTCOLUMN      32948
174 #define ID_CURVE_DELETE_FIRSTROW        32949
175 #define ID_CURVE_DELETE_LASTROW         32950
176 #define ID_CURVE_NEGATIVE               32951
177 #define ID_PATCH_BEND                   32952
178 #define ID_CURVE_PATCHDENSETUBE         32955
179 #define ID_CURVE_PATCHVERYDENSETUBE     32956
180 #define ID_CURVE_CAP                    32957
181 #define ID_CURVE_REDISPERSE_ROWS        32961
182 #define ID_PATCH_NATURALIZE             32963
183 #define ID_CURVE_PATCHSQUARE            32964
184 #define ID_BRUSH_PRIMITIVES_SPHERE      32965
185 #define ID_BRUSH_PRIMITIVES_TORUS       32966
186 #define ID_TEXTURES_TEXTUREWINDOWSCALE_200 32967
187 #define ID_TEXTURES_TEXTUREWINDOWSCALE_100 32968
188 #define ID_TEXTURES_TEXTUREWINDOWSCALE_50 32969
189 #define ID_TEXTURES_TEXTUREWINDOWSCALE_25 32970
190 #define ID_TEXTURES_TEXTUREWINDOWSCALE_10 32971
191 #define ID_CURVE_NEGATIVETEXTUREX       32972
192 #define ID_TEXTURES_FLUSH               32973
193 #define ID_CURVE_OVERLAY_SET            32974
194 #define ID_CURVE_OVERLAY_CLEAR          32975
195 #define ID_CURVE_NEGATIVETEXTUREY       32976
196 #define ID_CURVE_THICKEN                32977
197 #define ID_CURVE_CYCLECAP               32978
198 #define ID_CURVE_MATRIX_TRANSPOSE       32981
199 #define ID_PLUGINS_REFRESH              32982
200 #define ID_TEXTURES_RELOADSHADERS       32983
201 #define ID_VIEW_ENTITIESAS_BOUNDINGBOX  32984
202 #define ID_VIEW_ENTITIESAS_WRITEFRAME   32985
203 #define ID_VIEW_ENTITIESAS_SELECTEDWIREFRAME 32986
204 #define ID_VIEW_ENTITIESAS_SELECTEDSKINNED 32987
205 #define ID_VIEW_ENTITIESAS_SKINNED      32988
206 #define ID_VIEW_ENTITIESAS_SKINNEDANDBOXED 32989
207 #define ID_SHOW_ENTITIES                32990
208 #define ID_VIEW_ENTITIESAS_WIREFRAME    32991
209 #define ID_VIEW_OPENGLLIGHTING          32998
210 #define ID_EDIT_SAVEPREFAB              33001
211 #define ID_CURVE_MOREENDCAPSBEVELS_SQUAREENDCAP 33002
212 #define ID_CURVE_MOREENDCAPSBEVELS_SQUAREBEVEL 33003
213 #define ID_CURVE_PRIMITIVES_SPHERE      33005
214 #define ID_VIEW_HIDESHOW_HIDESELECTED   33006
215 #define ID_VIEW_HIDESHOW_SHOWHIDDEN     33007
216 #define ID_TEXTURES_SHADERS_SHOW        33008
217 //#define ID_SELECTION_CSGADD             33009
218 #define ID_SELECTION_CSGMERGE           33011
219 #define ID_TEXTURES_FLUSH_UNUSED        33014
220 #define ID_DROP_GROUP_REMOVE            33016
221 #define ID_DROP_GROUP_ADDTO_WORLD       33017
222 #define ID_DROP_GROUP_NEWGROUP          33018
223 #define ID_DROP_GROUP_NAME              33019
224 #define ID_DROP_GROUP_ADDTO             33020
225 #define ID_VIEW_SHOWANGLES              33021
226 #define ID_VIEW_SHOWWORKZONE            33022
227 #define ID_TEXTURE_FLUSH                33023
228 #define ID_TEXTURES_SHOWSHADERS         33025
229 #define ID_DONTSELECTMODEL              33027
230 #define ID_TEXTURES_SHADERLISTONLY      33030
231 #define ID_PLUGIN_START                 33800
232 #define ID_PLUGIN_END                   33999
233 #define ID_FILE_EXIT                    40002
234 #define ID_FILE_SAVEAS                  40004
235 #define ID_VIEW_CENTER                  40005
236 #define ID_VIEW_UPFLOOR                 40006
237 #define ID_VIEW_DOWNFLOOR               40007
238 #define ID_BRUSH_FLIPX                  40008
239 #define ID_BRUSH_FLIPY                  40009
240 #define ID_BRUSH_FLIPZ                  40010
241 #define ID_BRUSH_ROTATEX                40011
242 #define ID_BRUSH_ROTATEY                40012
243 #define ID_BRUSH_ROTATEZ                40013
244 #define ID_BSP_FULLVIS                  40016
245 #define ID_BSP_FASTVIS                  40017
246 #define ID_BSP_NOVIS                    40018
247 #define ID_BSP_RELIGHT                  40019
248 #define ID_BSP_ENTITIES                 40020
249 #define ID_FILE_POINTFILE               40021
250 #define ID_VIEW_100                     40022
251 #define ID_VIEW_75                      40023
252 #define ID_VIEW_50                      40024
253 #define ID_VIEW_25                      40025
254 #define ID_VIEW_12                      40026
255 #define ID_TEXTURES_SHOWALL             40033
256 #define ID_TEXTURES_SHOWINUSE           40034
257 #define ID_TEXTURES_TOGGLEVIEW          40037
258 #define ID_SELECTION_CREATEENTITY       40039
259 #define ID_SELECTION_EDITENTITY         40040
260 #define ID_MISC_BENCHMARK               40041
261 #define ID_REGION_OFF                   40043
262 #define ID_REGION_SETXY                 40044
263 #define ID_REGION_SETBRUSH              40045
264 #define ID_SELECTION_MAKEHOLLOW         40046
265 #define ID_SELECTION_SELECTPARTIALTALL  40047
266 #define ID_SELECTION_SELECTCOMPLETETALL 40048
267 #define ID_SELECTION_CSGSUBTRACT        40049
268 #define ID_SELECTION_SELECTTOUCHING     40050
269 #define ID_VIEW_NEAREST                 40052
270 #define ID_VIEW_NEARESTMIPMAP           40053
271 #define ID_VIEW_LINEAR                  40054
272 #define ID_VIEW_BILINEAR                40055
273 #define ID_VIEW_BILINEARMIPMAP          40056
274 #define ID_VIEW_TRILINEAR               40057
275 #define ID_TEXTURES_WIREFRAME           40058
276 #define ID_TEXTURES_FLATSHADE           40059
277 #define ID_VIEW_SHOWNAMES               40060
278 #define ID_VIEW_ZOOMIN                  40061
279 #define ID_VIEW_ZOOMOUT                 40062
280 #define ID_VIEW_SHOWCOORDINATES         40063
281 #define ID_VIEW_Z100                    40064
282 #define ID_VIEW_ZZOOMIN                 40065
283 #define ID_VIEW_ZZOOMOUT                40066
284 #define ID_SELECTION_CLONE              40067
285 #define ID_SELECTION_DESELECT           40068
286 #define ID_SELECTION_DELETE             40069
287 #define ID_BUTTON40068                  40070
288 #define ID_SELECTION_DRAGVERTECIES      40074
289 #define ID_SELECTION_DRAGEDGES          40075
290 #define ID_REGION_SETTALLBRUSH          40076
291 #define ID_SELECTION_SELECTINSIDE       40092
292 #define ID_PROJECT_RELEAD               40094
293 #define ID_PROJECT_CHANGE               40095
294 #define ID_MISC_GAMMA                   40097
295 #define ID_MISC_TEXTUREBACKGROUN        40104
296 #define ID_TEXTUREBK                    40105
297 #define ID_COLORS_XYBK                  40106
298 #define ID_FILE_ABOUT                   40107
299 #define ID_VIEW_CONSOLE                 40108
300 #define ID_VIEW_ENTITY                  40109
301 #define ID_VIEW_TEXTURE                 40110
302 #define ID_COLORS_MAJOR                 40111
303 #define ID_COLORS_MINOR                 40113
304 #define ID_SELECTION_CONNECT            40114
305 #define ID_FILE_LOADPROJECT             40115
306 #define ID_MISC_FINDBRUSH               40116
307 #define ID_MISC_NEXTLEAKSPOT            40117
308 #define ID_MISC_PREVIOUSLEAKSPOT        40118
309 #define ID_BRUSH_3SIDED                 40119
310 #define ID_BRUSH_4SIDED                 40120
311 #define ID_BRUSH_5SIDED                 40121
312 #define ID_BRUSH_6SIDED                 40122
313 #define ID_BRUSH_7SIDED                 40123
314 #define ID_BRUSH_8SIDED                 40124
315 #define ID_BRUSH_9SIDED                 40125
316 #define ID_SELECTION_ARBITRARYROTATION  40126
317 #define ID_BRUSH_ARBITRARYSIDED         40127
318 #define ID_SELECTION_UNGROUPENTITY      40130
319 #define ID_MISC_SELECTENTITYCOLOR       40131
320 #define ID_MISC_PRINTXY                 40132
321 #define ID_HELP_ABOUT                   40134
322 #define ID_EDIT_COPYBRUSH               40135
323 #define ID_EDIT_PASTEBRUSH              40136
324 #define ID_TEXTURES_INSPECTOR           40137
325 #define ID_SELECTION_MAKE_DETAIL        40139
326 #define ID_SELECTION_MAKE_STRUCTURAL    40140
327 #define ID_REGION_SETSELECTION          40141
328 #define ID_VIEW_SHOWBLOCKS              40142
329 #define ID_CAMERA_UP                    40152
330 #define ID_CAMERA_DOWN                  40153
331 #define ID_CAMERA_LEFT                  40154
332 #define ID_CAMERA_RIGHT                 40155
333 #define ID_CAMERA_FORWARD               40156
334 #define ID_CAMERA_BACK                  40157
335 #define ID_CAMERA_ANGLEUP               40158
336 #define ID_CAMERA_ANGLEDOWN             40159
337 #define ID_CAMERA_STRAFELEFT            40160
338 #define ID_CAMERA_STRAFERIGHT           40161
339 #define ID_GRID_TOGGLE                  40162
340 #define ID_ENTITYLIST                   40163
341 #define ID_MAPINFO                      40164
342 #define ID_TOGGLECONSOLE                40165
343 #define ID_TOGGLECAMERA                 40166
344 #define ID_TOGGLEZ                      40167
345 #define ID_TOGGLEVIEW                   40168
346 #define ID_SELECTION_TEXTURE_FIT        40171
347 #define ID_SELECTION_TEXTURE_ROTATECLOCK 40172
348 #define ID_SELECTION_TEXTURE_ROTATECOUNTER 40173
349 #define ID_SELECTION_TEXTURE_SCALEUP    40174
350 #define ID_SELECTION_TEXTURE_SCALEDOWN  40175
351 #define ID_SELECTION_TEXTURE_SHIFTLEFT  40176
352 #define ID_SELECTION_TEXTURE_SHIFTRIGHT 40177
353 #define ID_SELECTION_TEXTURE_SHIFTUP    40178
354 #define ID_SELECTION_TEXTURE_SHIFTDOWN  40179
355 #define ID_GRID_NEXT                    40180
356 #define ID_GRID_PREV                    40181
357 #define ID_SELECTION_TEXTURE_SCALELEFT  40182
358 #define ID_SELECTION_TEXTURE_SCALERIGHT 40183
359 #define ID_SELECTION_PRINT              40184
360 #define ID_SELECTION_TOGGLESIZEPAINT    40185
361 #define ID_PATCH_TAB                    40186
362 #define ID_PATCH_ENTER                  40187
363 #define ID_SELECT_SNAPTOGRID            40188
364 #define ID_PATCH_INSPECTOR              40189
365 #define ID_SELECT_ALL                   40190
366 #define ID_CURVE_FREEZE                 40191
367 #define ID_CURVE_UNFREEZE               40192
368 #define ID_CURVE_UNFREEZEALL            40193
369 #define ID_SELECT_RESELECT              40194
370 #define ID_FITFACE                      40196
371 #define ID_VIEW_CROSSHAIR               40197
372 #define ID_SELECTION_INVERT             40198
373 #define ID_VIEW_GROUPS                  40199
374 #define ID_FILE_SLEEP                   40200
375 #define ID_HELP_LINKS                   40201
376 #define ID_VIEW_SHOWOUTLINE             40202 // TTimo: outline as in colored outline around the window to quickly guess the orientation
377 #define ID_VIEW_SHOWAXES                40203
378 #define ID_SELECTION_NOOUTLINE          40204 // TTimo: outline as in zbuffered outline toggle on camera view (TA Q3Radiant 200f addition)
379 #define ID_SELECTION_OUTLINESTYLE       40205 // Arnout: cycles through selection styles (extended 'nooutline')
380 #define ID_SELECTION_SEPERATE           40206 // TTimo: split brushes out of an entity back into worldspawn
381 #define ID_SELECTION_MERGE              40207 // TTimo: merge brushes from worldspawn into entity
382 #define ID_HELP_BUGREPORT               40208
383
384 #define ID_FILTER_WORLD                 40209
385 #define ID_FILTER_PATCHES               40210
386 #define ID_FILTER_DETAILS               40211
387 #define ID_FILTER_ENTITIES              40212
388 #define ID_FILTER_MODELS                40213
389 #define ID_FILTER_HINTSSKIPS            40214
390 #define ID_FILTER_CLIPS                 40215
391 #define ID_FILTER_LIQUIDS               40216
392 #define ID_FILTER_TRIGGERS              40217
393 #define ID_FILTER_AREAPORTALS           40218
394 #define ID_FILTER_TRANSLUCENT           40219
395 #define ID_FILTER_CAULK                 40220
396 #define ID_FILTER_LIGHTS                40221
397 #define ID_FILTER_PATHS                 40223
398 #define ID_FILTER_CLUSTERPORTALS        40224
399 #define ID_FILTER_LIGHTGRID             40225
400 #define ID_FILTER_STRUCTURAL            40226
401 #define ID_FILTER_BOTCLIPS                          40227
402
403 #define ID_CURVE_REDISPERSE_INTERMEDIATE_COLS   40230
404 #define ID_CURVE_REDISPERSE_INTERMEDIATE_ROWS   40231
405 #define ID_EDIT_PASTEBRUSHTOCAMERA      40232
406
407 #define ID_COLORS_MINOR_ALT             40230
408 #define ID_COLORS_MAJOR_ALT             40231
409
410 #define ID_SELECT_FUNC_GROUP            40233
411
412 // those must have their own ID chunk ID_GRID_025 <= ID_GRID <= ID_GRID_256
413 #define ID_GRID_025                     40300
414 #define ID_GRID_05                      40301
415 #define ID_GRID_1                       40302
416 #define ID_GRID_2                       40303
417 #define ID_GRID_4                       40304
418 #define ID_GRID_8                       40305
419 #define ID_GRID_16                      40306
420 #define ID_GRID_32                      40307
421 #define ID_GRID_64                      40308
422 #define ID_GRID_128                     40309
423 #define ID_GRID_256                     40310
424
425 #define ID_FILE_CHECKUPDATE             40320
426
427 #define ID_TEXTUREWINDOW_SCALEUP        40321
428 #define ID_TEXTUREWINDOW_SCALEDOWN      40322
429
430 class CSynapseClientRadiant : public CSynapseClient
431 {
432 public:
433 bool RequestAPI( APIDescriptor_t *pAPI );
434 const char* GetInfo();
435 const char* GetName();
436
437 void ImportMap( IDataStream *in, CPtrArray *ents, const char *type );
438 void ExportMap( CPtrArray *ents, IDataStream *out, const char *type );
439
440 CSynapseClientRadiant() { }
441 virtual ~CSynapseClientRadiant() { }
442 };
443
444 class MainFrame
445 {
446 public:
447 enum EViewStyle
448 {
449         eRegular,
450         eFloating,
451         eSplit,
452         eRegularLeft,
453 };
454
455 MainFrame();
456 GtkWidget *m_pWidget;
457
458 /*!
459    called to fire up the help links
460  */
461 void handle_help_command( int id );
462
463 protected:
464
465 /*!
466    the urls to fire up in the game packs help menus
467  */
468 vector<Str *> mHelpURLs;
469
470 /*!
471    scan the .game files for game install packs
472    look there for help description nodes
473    build the corresponding menus in Radiant
474  */
475 void create_game_help_menu( GtkWidget *menu, GtkAccelGroup *accel );
476
477 /*!
478    build the menu once the filename is found
479  */
480 void process_xlink( Str &FileName, const char *menu_name, const char *base_url, GtkWidget *menu, GtkAccelGroup *accel );
481
482 void Create();
483 void create_main_menu( GtkWidget *window, GtkWidget *vbox );
484 void create_main_toolbar( GtkWidget *window, GtkWidget *vbox );
485 void create_plugin_toolbar( GtkWidget *window, GtkWidget *vbox );
486 void create_main_statusbar( GtkWidget *window, GtkWidget *vbox );
487 GtkWidget *m_pStatusLabel[6];
488 GtkWidget *m_pSplits[4];
489 XYWnd* m_pXYWnd;
490 XYWnd* m_pYZWnd;
491 XYWnd* m_pXZWnd;
492 CamWnd* m_pCamWnd;
493 TexWnd* m_pTexWnd;
494 ZWnd* m_pZWnd;
495 CWatchBSP* m_pWatchBSP;
496
497 XYWnd* m_pActiveXY;
498 bool m_bCamPreview;
499 CPlugInManager m_PlugInMgr;
500 int m_nNextPlugInID;
501 guint m_nTimer;
502 bool m_bSleeping;
503
504 CString m_strStatus[15];
505 bool m_bNeedStatusUpdate;
506
507 /*!
508    synapse server
509    deals with dynamically loading the modules, initializing them, requesting the APIs
510  */
511 CSynapseServer m_SynapseServer;
512 /*!
513    we are also a synapse client in that we provide and require some APIs as well
514  */
515 CSynapseClientRadiant m_SynapseClient;
516
517 public:
518
519 // BSP window
520 // trigger network listen
521 void DoWatchBSP();
522 bool IsSleeping()
523 { return m_bSleeping; }
524
525 void UpdatePatchToolbarButtons();
526 // Gef: Changed to float for sub-integer grid size
527 void NudgeSelection( int nDirection, float nAmount );
528 void SetButtonMenuStates();
529 void SetGridStatus();
530 void RoutineProcessing();
531 XYWnd* ActiveXY() { return m_pActiveXY; };
532 void UpdateWindows( int nBits );
533 void SetStatusText( int nPane, const char* pText );
534 void UpdateStatusText();
535 void SetWindowStyle( int nStyle );
536 virtual ~MainFrame();
537 XYWnd* GetXYWnd() {return m_pXYWnd; }
538 XYWnd* GetXZWnd() {return m_pXZWnd; }
539 XYWnd* GetYZWnd() {return m_pYZWnd; }
540 ZWnd* GetZWnd() {return m_pZWnd; }
541 CamWnd* GetCamWnd() {return m_pCamWnd; }
542 TexWnd* GetTexWnd() {return m_pTexWnd; }
543 CWatchBSP *GetWatchBSP() { return m_pWatchBSP; }
544 void ReleaseContexts();
545 void CreateContexts();
546
547 void SetActiveXY( XYWnd* p ){
548         if ( m_pActiveXY ) {
549                 m_pActiveXY->SetActive( false );
550         }
551
552         m_pActiveXY = p;
553
554         if ( m_pActiveXY ) {
555                 m_pActiveXY->SetActive( true );
556         }
557
558 };
559
560 EViewStyle CurrentStyle(){
561         return m_nCurrentStyle;
562 };
563
564 bool FloatingGroupDialog(){
565         return CurrentStyle() == eFloating || CurrentStyle() == eSplit;
566 };
567
568 #ifdef _WIN32
569 const GdkRectangle & GetPrimaryMonitorRect( void ) const { return primaryMonitorRect; }
570 const int GetGDKOffsetX( void ) const { return gdk_offset_x; }
571 const int GetGDKOffsetY( void ) const { return gdk_offset_y; }
572 #endif
573
574 protected:
575 bool m_bDoLoop;
576 bool m_bSplittersOK;
577 void CreateQEChildren();
578 void LoadCommandMap();
579 void ShowMenuItemKeyBindings( GtkWidget* window );
580
581 public:
582 void Copy();
583 void Paste();
584 void Nudge( int nDim, float fNudge );
585 CPlugInManager &GetPlugInMgr() {return m_PlugInMgr; };
586 CSynapseServer &GetSynapseServer() {return m_SynapseServer; };
587 CSynapseClientRadiant &GetSynapseClient() {return m_SynapseClient; };
588 void AddPlugInToolbarButton( const IToolbarButton* button );
589 void AddPlugInMenuItem( IPlugIn* pPlugIn );
590 void CleanPlugInMenu();
591
592 // these are public so i can easily reflect messages
593 // from child windows..
594 void OnTimer();
595 void OnDelete();
596 void OnDestroy();
597 void ToggleCamera();
598
599 void OnFileExit();
600 void OnFileLoadproject();
601 void OnFileNew();
602 void OnFileOpen();
603 void OnFilePointfile();
604 void OnFileSave();
605 void OnFileSaveas();
606 void OnFileCheckUpdate();
607 void OnView100();
608 void OnViewCenter();
609 void OnViewConsole();
610 void OnViewDownfloor();
611 void OnViewEntity();
612 void OnViewFront();
613 void OnViewShowblocks();
614 void OnViewShowclip();
615 void OnViewShowcoordinates();
616 void OnViewShowOutline();
617 void OnViewShowAxes();
618 void OnViewShowdetail();
619 void OnViewShowent();
620 void OnViewShowlights();
621 void OnViewShownames();
622 void OnViewShowpath();
623 void OnViewShowwater();
624 void OnViewShowworld();
625 void OnViewTexture();
626 void OnViewUpfloor();
627 void OnViewXy();
628 void OnViewZ100();
629 void OnViewZoomin();
630 void OnViewZoomout();
631 void OnViewZzoomin();
632 void OnViewZzoomout();
633 void OnViewSide();
634 void OnTexturesShowinuse();
635 void OnTexturesInspector();
636 void OnMiscBenchmark();
637 void OnMiscFindbrush();
638 void OnMiscGamma();
639 void OnMiscNextleakspot();
640 void OnMiscPreviousleakspot();
641 void OnMiscPrintxy();
642 void OnMiscSelectentitycolor();
643 void OnTexturebk();
644 void OnColorsMajor();
645 void OnColorsMinor();
646 void OnColorsMajor_Alt();
647 void OnColorsMinor_Alt();
648 void OnColorsXybk();
649 void OnBrush3sided();
650 void OnBrush4sided();
651 void OnBrush5sided();
652 void OnBrush6sided();
653 void OnBrush7sided();
654 void OnBrush8sided();
655 void OnBrush9sided();
656 void OnBrushArbitrarysided();
657 void OnBrushFlipx();
658 void OnBrushFlipy();
659 void OnBrushFlipz();
660 void OnBrushRotatex();
661 void OnBrushRotatey();
662 void OnBrushRotatez();
663 void OnRegionOff();
664 void OnRegionSetbrush();
665 void OnRegionSetselection();
666 void OnRegionSettallbrush();
667 void OnRegionSetxy();
668 void OnSelectionArbitraryrotation();
669 void OnSelectionClone();
670 void OnSelectionConnect();
671 void OnSelectionCsgsubtract();
672 void OnSelectionCsgmerge();
673 void OnSelectionNoOutline();
674 void OnSelectionOutlineStyle();
675 void OnSelectionDelete();
676 void OnSelectionDeselect();
677 void OnSelectionDragedges();
678 void OnSelectionDragvertecies();
679 void OnSelectionMakeDetail();
680 void OnSelectionMakeStructural();
681 void OnSelectionMakehollow();
682 void OnSelectionSelectcompletetall();
683 void OnSelectionSelectinside();
684 void OnSelectionSelectpartialtall();
685 void OnSelectionSelecttouching();
686 void OnSelectionUngroupentity();
687 void OnSelectionMergeentity();
688 void OnSelectionGroupworld();
689 void OnTexturesPopup();
690 void OnPopupSelection();
691 void OnViewChange();
692 void OnViewCameraupdate();
693 void OnHelpAbout();
694 void OnHelp();
695 void OnHelpLinks();
696 void OnHelpBugreport();
697 void OnViewClipper();
698 void OnCameraAngledown();
699 void OnCameraAngleup();
700 void OnCameraBack( bool keydown );
701 void OnCameraDown();
702 void OnCameraForward( bool keydown );
703 void OnCameraLeft( bool keydown );
704 void OnCameraRight( bool keydown );
705 void OnCameraStrafeleft( bool keydown );
706 void OnCameraStraferight( bool keydown );
707 void OnCameraUp();
708 void OnGridToggle();
709 void OnPrefs();
710 void OnTogglecamera();
711 void OnToggleconsole();
712 void OnToggleview();
713 void OnTogglez();
714 void OnToggleLock();
715 void OnEditMapinfo();
716 void OnEditEntityinfo();
717 void OnBrushScripts();
718 void OnViewCenterview();
719 void OnViewNextview();
720 void OnHelpCommandlist();
721 void OnFileNewproject();
722 void OnFlipClip();
723 void OnClipSelected();
724 void OnSplitSelected();
725 void OnToggleviewXz();
726 void OnToggleviewYz();
727 void OnColorsBrush();
728 void OnColorsClipper();
729 void OnColorsGridtext();
730 void OnColorsSelectedbrush();
731 void OnColorsSelectedbrush3D();
732 void OnColorsCameraBack();
733 void OnColorsGridblock();
734 void OnColorsViewname();
735 void OnColorSetoriginal();
736 void OnColorSetqer();
737 void OnColorSetblack();
738 void OnColorSetydnar();    /* ydnar */
739 void OnSnaptogrid();
740 void OnSelectScale();
741 void OnSelectMouserotate();
742 void OnEditCopybrush();
743 void OnEditPastebrush();
744 void OnEditPastebrushToCamera();
745 void OnEditUndo();
746 void OnEditRedo();
747 void OnSelectionInvert();
748 //  void OnSelectionTextureDec();
749 void OnSelectionTextureFit();
750 //  void OnSelectionTextureInc();
751 void OnSelectionTextureRotateclock();
752 void OnSelectionTextureRotatecounter();
753 void OnSelectionTextureScaledown();
754 void OnSelectionTextureScaleup();
755 void OnSelectionTextureShiftdown();
756 void OnSelectionTextureShiftleft();
757 void OnSelectionTextureShiftright();
758 void OnSelectionTextureShiftup();
759 void OnGridNext();
760 void OnGridPrev();
761 void OnSelectionTextureScaleLeft();
762 void OnSelectionTextureScaleRight();
763 void OnTextureReplaceall();
764 void OnScalelockx();
765 void OnScalelocky();
766 void OnScalelockz();
767 void OnSelectMousescale();
768 void OnViewCubicclipping();
769 void OnFileProjectsettings();
770 void OnViewCubein();
771 void OnViewCubeout();
772 void OnFileSaveregion();
773 void OnSelectionMovedown();
774 void OnSelectionMoveup();
775 void OnToolbarMain();
776 void OnToolbarTexture();
777 void OnSelectionPrint();
778 void OnSelectionTogglesizepaint();
779 void OnBrushMakecone();
780 void OnTexturesLoad();
781 void OnToggleRotatelock();
782 void OnFileImportmap();
783 void OnFileExportmap();
784 void OnEditLoadprefab();
785 void OnSelectionSelectNudgedown();
786 void OnSelectionSelectNudgeleft();
787 void OnSelectionSelectNudgeright();
788 void OnSelectionSelectNudgeup();
789 void OnTexturesLoadlist();
790 void OnDontselectcurve();
791 void OnConvertcurves();
792 void OnCurveSimplepatchmesh();
793 void OnPatchToggleBox();
794 void OnPatchWireframe();
795 void OnCurvePatchcone();
796 void OnCurvePatchtube();
797 void OnPatchWeld();
798 void OnCurvePatchbevel();
799 void OnCurvePatchendcap();
800 void OnPatchDrilldown();
801 void OnCurveInsertcolumn();
802 void OnCurveInsertrow();
803 void OnCurveDeletecolumn();
804 void OnCurveDeleterow();
805 void OnCurveInsertAddcolumn();
806 void OnCurveInsertAddrow();
807 void OnCurveInsertInsertcolumn();
808 void OnCurveInsertInsertrow();
809 void OnCurveNegative();
810 void OnCurveNegativeTextureX();
811 void OnCurveNegativeTextureY();
812 void OnCurveDeleteFirstcolumn();
813 void OnCurveDeleteFirstrow();
814 void OnCurveDeleteLastcolumn();
815 void OnCurveDeleteLastrow();
816 void OnPatchBend();
817 //  void OnPatchInsdel();
818 void OnPatchEnter();
819 void OnPatchTab();
820 void OnCurvePatchdensetube();
821 void OnCurvePatchverydensetube();
822 void OnCurveCap();
823 void OnCurveCapInvertedbevel();
824 void OnCurveCapInvertedendcap();
825 void OnCurveRedisperseRows();
826 void OnCurveRedisperseIntermediateCols();
827 void OnCurveRedisperseIntermediateRows();
828 void OnPatchNaturalize();
829 void OnSnapToGrid();
830 void OnCurvePatchsquare();
831 void OnTexturewindowScaleup();
832 void OnTexturewindowScaledown();
833 void OnCurveOverlayClear();
834 void OnCurveOverlaySet();
835 void OnCurveThicken();
836 void OnCurveCyclecap();
837 void OnCurveMatrixTranspose();
838 void OnTexturesReloadshaders();
839 void OnShowEntities();
840 // will set the view mode right, don't set the value for mode if you only want to update the radio item
841 void OnEntitiesSetViewAs( int mode = 0 );
842 void OnPluginsRefresh();
843 void OnTexturesShowall();
844 void OnPatchInspector();
845 void OnViewOpengllighting();
846 void OnSelectAll();
847 void OnCurveFreeze();
848 void OnCurveUnFreeze();
849 void OnCurveUnFreezeAll();
850 void OnSelectReselect();
851 void OnEditSaveprefab();
852 void OnCurveMoreendcapsbevelsSquarebevel();
853 void OnCurveMoreendcapsbevelsSquareendcap();
854 void OnBrushPrimitivesSphere();
855 void OnViewCrosshair();
856 void OnViewHideshowHideselected();
857 void OnViewHideshowShowhidden();
858 void OnTexturesShadersShow();
859 void OnViewGroups();
860 void OnDropGroupAddtoWorld();
861 void OnDropGroupName();
862 void OnDropGroupNewgroup();
863 void OnDropGroupRemove();
864 void OnViewShowWorkzone();
865 void OnViewShowAngles();
866 void OnMru( unsigned int nID );
867 void OnViewNearest( unsigned int nID );
868 void OnTextureWad( unsigned int nID );
869 void OnBspCommand( unsigned int nID );
870 void OnGrid( unsigned int nID );
871 void OnPlugIn( unsigned int nID, char *str );
872 void OnFaceFit();
873 void SetTextureScale( int id );
874 void OnDontselectmodel();
875 void OnTexturesShaderlistonly();
876 void OnSleep();
877 void OnFilterAreaportals();
878 void OnFilterCaulk();
879 void OnFilterStructural();
880 void OnFilterClips();
881 void OnFilterBotClips();
882 void OnFilterDetails();
883 void OnFilterEntities();
884 void OnFilterHintsskips();
885 void OnFilterLights();
886 void OnFilterLiquids();
887 void OnFilterModels();
888 void OnFilterPatches();
889 void OnFilterTranslucent();
890 void OnFilterTriggers();
891 void OnFilterWorld();
892 void OnFilterPaths();
893 void OnFilterClusterportals();
894 void OnFilterLightgrid();
895 void OnSelectFuncGroup();
896
897 private:
898 EViewStyle m_nCurrentStyle;
899
900 #ifdef _WIN32
901 GdkRectangle primaryMonitorRect;
902 int gdk_offset_x;
903 int gdk_offset_y;
904 #endif
905
906 };
907
908 // some C API to the mainframe functions
909 void WINAPI QERApp_Sleep();
910
911 // Checks whether a given filename ends in .map
912 const bool IsMap(const char* filename);
913
914 #endif // _MAINFRAME_H_