ABToSVK commit
[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   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, 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   {
549     if (m_pActiveXY)
550       m_pActiveXY->SetActive(false);
551
552     m_pActiveXY = p;
553
554     if (m_pActiveXY)
555       m_pActiveXY->SetActive(true);
556
557   };
558
559   EViewStyle CurrentStyle()
560   {
561     return m_nCurrentStyle;
562   };
563
564   bool FloatingGroupDialog()
565   {
566     return CurrentStyle() == eFloating || CurrentStyle() == eSplit;
567   };
568
569 #ifdef _WIN32
570   const GdkRectangle & GetPrimaryMonitorRect( void ) const { return primaryMonitorRect; }
571   const int GetGDKOffsetX( void ) const { return gdk_offset_x; }
572   const int GetGDKOffsetY( void ) const { return gdk_offset_y; }
573 #endif
574
575 protected:
576   bool m_bDoLoop;
577   bool m_bSplittersOK;
578   void CreateQEChildren();
579   void LoadCommandMap();
580   void ShowMenuItemKeyBindings(GtkWidget* window);
581
582 public:
583   void Copy();
584   void Paste();
585   void Nudge(int nDim, float fNudge);
586   CPlugInManager &GetPlugInMgr() {return m_PlugInMgr;};
587   CSynapseServer &GetSynapseServer() {return m_SynapseServer;};
588   CSynapseClientRadiant &GetSynapseClient() {return m_SynapseClient;};
589   void AddPlugInToolbarButton(const IToolbarButton* button);
590   void AddPlugInMenuItem(IPlugIn* pPlugIn);
591   void CleanPlugInMenu();
592
593   // these are public so i can easily reflect messages
594   // from child windows..
595   void OnTimer();
596   void OnDelete();
597   void OnDestroy();
598   void ToggleCamera();
599
600   void OnFileExit();
601   void OnFileLoadproject();
602   void OnFileNew();
603   void OnFileOpen();
604   void OnFilePointfile();
605   void OnFileSave();
606   void OnFileSaveas();
607   void OnFileCheckUpdate();
608   void OnView100();
609   void OnViewCenter();
610   void OnViewConsole();
611   void OnViewDownfloor();
612   void OnViewEntity();
613   void OnViewFront();
614   void OnViewShowblocks();
615   void OnViewShowclip();
616   void OnViewShowcoordinates();
617   void OnViewShowOutline();
618   void OnViewShowAxes();
619   void OnViewShowdetail();
620   void OnViewShowent();
621   void OnViewShowlights();
622   void OnViewShownames();
623   void OnViewShowpath();
624   void OnViewShowwater();
625   void OnViewShowworld();
626   void OnViewTexture();
627   void OnViewUpfloor();
628   void OnViewXy();
629   void OnViewZ100();
630   void OnViewZoomin();
631   void OnViewZoomout();
632   void OnViewZzoomin();
633   void OnViewZzoomout();
634   void OnViewSide();
635   void OnTexturesShowinuse();
636   void OnTexturesInspector();
637   void OnMiscBenchmark();
638   void OnMiscFindbrush();
639   void OnMiscGamma();
640   void OnMiscNextleakspot();
641   void OnMiscPreviousleakspot();
642   void OnMiscPrintxy();
643   void OnMiscSelectentitycolor();
644   void OnTexturebk();
645   void OnColorsMajor();
646   void OnColorsMinor();
647   void OnColorsMajor_Alt();
648   void OnColorsMinor_Alt();
649   void OnColorsXybk();
650   void OnBrush3sided();
651   void OnBrush4sided();
652   void OnBrush5sided();
653   void OnBrush6sided();
654   void OnBrush7sided();
655   void OnBrush8sided();
656   void OnBrush9sided();
657   void OnBrushArbitrarysided();
658   void OnBrushFlipx();
659   void OnBrushFlipy();
660   void OnBrushFlipz();
661   void OnBrushRotatex();
662   void OnBrushRotatey();
663   void OnBrushRotatez();
664   void OnRegionOff();
665   void OnRegionSetbrush();
666   void OnRegionSetselection();
667   void OnRegionSettallbrush();
668   void OnRegionSetxy();
669   void OnSelectionArbitraryrotation();
670   void OnSelectionClone();
671   void OnSelectionConnect();
672   void OnSelectionCsgsubtract();
673   void OnSelectionCsgmerge();
674   void OnSelectionNoOutline();
675   void OnSelectionOutlineStyle();
676   void OnSelectionDelete();
677   void OnSelectionDeselect();
678   void OnSelectionDragedges();
679   void OnSelectionDragvertecies();
680   void OnSelectionMakeDetail();
681   void OnSelectionMakeStructural();
682   void OnSelectionMakehollow();
683   void OnSelectionSelectcompletetall();
684   void OnSelectionSelectinside();
685   void OnSelectionSelectpartialtall();
686   void OnSelectionSelecttouching();
687   void OnSelectionUngroupentity();
688   void OnSelectionMergeentity();
689   void OnSelectionGroupworld();
690   void OnTexturesPopup();
691   void OnPopupSelection();
692   void OnViewChange();
693   void OnViewCameraupdate();
694   void OnHelpAbout();
695   void OnHelp();
696   void OnHelpLinks();
697   void OnHelpBugreport();
698   void OnViewClipper();
699   void OnCameraAngledown();
700   void OnCameraAngleup();
701   void OnCameraBack(bool keydown);
702   void OnCameraDown();
703   void OnCameraForward(bool keydown);
704   void OnCameraLeft(bool keydown);
705   void OnCameraRight(bool keydown);
706   void OnCameraStrafeleft(bool keydown);
707   void OnCameraStraferight(bool keydown);
708   void OnCameraUp();
709   void OnGridToggle();
710   void OnPrefs();
711   void OnTogglecamera();
712   void OnToggleconsole();
713   void OnToggleview();
714   void OnTogglez();
715   void OnToggleLock();
716   void OnEditMapinfo();
717   void OnEditEntityinfo();
718   void OnBrushScripts();
719   void OnViewCenterview();
720   void OnViewNextview();
721   void OnHelpCommandlist();
722   void OnFileNewproject();
723   void OnFlipClip();
724   void OnClipSelected();
725   void OnSplitSelected();
726   void OnToggleviewXz();
727   void OnToggleviewYz();
728   void OnColorsBrush();
729   void OnColorsClipper();
730   void OnColorsGridtext();
731   void OnColorsSelectedbrush();
732   void OnColorsSelectedbrush3D();
733   void OnColorsCameraBack();
734   void OnColorsGridblock();
735   void OnColorsViewname();
736   void OnColorSetoriginal();
737   void OnColorSetqer();
738   void OnColorSetblack();
739   void OnColorSetydnar();  /* ydnar */
740   void OnSnaptogrid();
741   void OnSelectScale();
742   void OnSelectMouserotate();
743   void OnEditCopybrush();
744   void OnEditPastebrush();
745   void OnEditPastebrushToCamera();
746   void OnEditUndo();
747   void OnEditRedo();
748   void OnSelectionInvert();
749 //  void OnSelectionTextureDec();
750   void OnSelectionTextureFit();
751 //  void OnSelectionTextureInc();
752   void OnSelectionTextureRotateclock();
753   void OnSelectionTextureRotatecounter();
754   void OnSelectionTextureScaledown();
755   void OnSelectionTextureScaleup();
756   void OnSelectionTextureShiftdown();
757   void OnSelectionTextureShiftleft();
758   void OnSelectionTextureShiftright();
759   void OnSelectionTextureShiftup();
760   void OnGridNext();
761   void OnGridPrev();
762   void OnSelectionTextureScaleLeft();
763   void OnSelectionTextureScaleRight();
764   void OnTextureReplaceall();
765   void OnScalelockx();
766   void OnScalelocky();
767   void OnScalelockz();
768   void OnSelectMousescale();
769   void OnViewCubicclipping();
770   void OnFileProjectsettings();
771   void OnViewCubein();
772   void OnViewCubeout();
773   void OnFileSaveregion();
774   void OnSelectionMovedown();
775   void OnSelectionMoveup();
776   void OnToolbarMain();
777   void OnToolbarTexture();
778   void OnSelectionPrint();
779   void OnSelectionTogglesizepaint();
780   void OnBrushMakecone();
781   void OnTexturesLoad();
782   void OnToggleRotatelock();
783   void OnFileImportmap();
784   void OnFileExportmap();
785   void OnEditLoadprefab();
786   void OnSelectionSelectNudgedown();
787   void OnSelectionSelectNudgeleft();
788   void OnSelectionSelectNudgeright();
789   void OnSelectionSelectNudgeup();
790   void OnTexturesLoadlist();
791   void OnDontselectcurve();
792   void OnConvertcurves();
793   void OnCurveSimplepatchmesh();
794   void OnPatchToggleBox();
795   void OnPatchWireframe();
796   void OnCurvePatchcone();
797   void OnCurvePatchtube();
798   void OnPatchWeld();
799   void OnCurvePatchbevel();
800   void OnCurvePatchendcap();
801   void OnPatchDrilldown();
802   void OnCurveInsertcolumn();
803   void OnCurveInsertrow();
804   void OnCurveDeletecolumn();
805   void OnCurveDeleterow();
806   void OnCurveInsertAddcolumn();
807   void OnCurveInsertAddrow();
808   void OnCurveInsertInsertcolumn();
809   void OnCurveInsertInsertrow();
810   void OnCurveNegative();
811   void OnCurveNegativeTextureX();
812   void OnCurveNegativeTextureY();
813   void OnCurveDeleteFirstcolumn();
814   void OnCurveDeleteFirstrow();
815   void OnCurveDeleteLastcolumn();
816   void OnCurveDeleteLastrow();
817   void OnPatchBend();
818 //  void OnPatchInsdel();
819   void OnPatchEnter();
820   void OnPatchTab();
821   void OnCurvePatchdensetube();
822   void OnCurvePatchverydensetube();
823   void OnCurveCap();
824   void OnCurveCapInvertedbevel();
825   void OnCurveCapInvertedendcap();
826   void OnCurveRedisperseRows();
827   void OnCurveRedisperseIntermediateCols();
828   void OnCurveRedisperseIntermediateRows();
829   void OnPatchNaturalize();
830   void OnSnapToGrid();
831   void OnCurvePatchsquare();
832   void OnTexturewindowScaleup();
833   void OnTexturewindowScaledown();
834   void OnCurveOverlayClear();
835   void OnCurveOverlaySet();
836   void OnCurveThicken();
837   void OnCurveCyclecap();
838   void OnCurveMatrixTranspose();
839   void OnTexturesReloadshaders();
840   void OnShowEntities();
841   // will set the view mode right, don't set the value for mode if you only want to update the radio item
842   void OnEntitiesSetViewAs(int mode = 0);
843   void OnPluginsRefresh();
844   void OnTexturesShowall();
845   void OnPatchInspector();
846   void OnViewOpengllighting();
847   void OnSelectAll();
848   void OnCurveFreeze();
849   void OnCurveUnFreeze();
850   void OnCurveUnFreezeAll();
851   void OnSelectReselect();
852   void OnEditSaveprefab();
853   void OnCurveMoreendcapsbevelsSquarebevel();
854   void OnCurveMoreendcapsbevelsSquareendcap();
855   void OnBrushPrimitivesSphere();
856   void OnViewCrosshair();
857   void OnViewHideshowHideselected();
858   void OnViewHideshowShowhidden();
859   void OnTexturesShadersShow();
860   void OnViewGroups();
861   void OnDropGroupAddtoWorld();
862   void OnDropGroupName();
863   void OnDropGroupNewgroup();
864   void OnDropGroupRemove();
865   void OnViewShowWorkzone();
866   void OnViewShowAngles();
867   void OnMru(unsigned int nID);
868   void OnViewNearest(unsigned int nID);
869   void OnTextureWad(unsigned int nID);
870   void OnBspCommand(unsigned int nID);
871   void OnGrid(unsigned int nID);
872   void OnPlugIn(unsigned int nID, char *str);
873   void OnFaceFit();
874   void SetTextureScale(int id);
875   void OnDontselectmodel();
876   void OnTexturesShaderlistonly();
877   void OnSleep();
878   void OnFilterAreaportals();
879   void OnFilterCaulk();
880   void OnFilterStructural();
881   void OnFilterClips();
882   void OnFilterBotClips();
883   void OnFilterDetails();
884   void OnFilterEntities();
885   void OnFilterHintsskips();
886   void OnFilterLights();
887   void OnFilterLiquids();
888   void OnFilterModels();
889   void OnFilterPatches();
890   void OnFilterTranslucent();
891   void OnFilterTriggers();
892   void OnFilterWorld();
893   void OnFilterPaths();
894   void OnFilterClusterportals();
895   void OnFilterLightgrid();
896   void OnSelectFuncGroup();
897
898 private:
899   EViewStyle m_nCurrentStyle;
900
901 #ifdef _WIN32
902   GdkRectangle primaryMonitorRect;
903   int gdk_offset_x;
904   int gdk_offset_y;
905 #endif
906
907 };
908
909 // some C API to the mainframe functions
910 void WINAPI QERApp_Sleep();
911
912 #endif // _MAINFRAME_H_