]> git.xonotic.org Git - xonotic/netradiant.git/blob - contrib/bobtoolz/ctfToolz-GTK.cpp
reformat code! now the code is only ugly on the *inside*
[xonotic/netradiant.git] / contrib / bobtoolz / ctfToolz-GTK.cpp
1 /*
2    BobToolz plugin for GtkRadiant
3    Copyright (C) 2001 Gordon Biggans
4
5    This library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9
10    This library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14
15    You should have received a copy of the GNU Lesser General Public
16    License along with this library; if not, write to the Free Software
17    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  */
19
20 #include "StdAfx.h"
21
22 #include "funchandlers.h"
23 #include "misc.h"
24
25 #include "dialogs/dialogs-gtk.h"
26
27 // Radiant function table
28 _QERFuncTable_1 g_FuncTable;
29 _QERAppBSPFrontendTable g_BSPTable;             // for map name
30
31 BOOL g_bBSPInitDone = FALSE;
32
33 // plugin name
34 static const char *PLUGIN_NAME = "ctfToolz";
35
36 // commands in the menu
37 static const char *PLUGIN_COMMANDS = "About...,Colour Changer...,Swap Light Colours,Change Angles 180,Swap Spawn Points";
38
39 // globals
40 GtkWidget *g_pRadiantWnd = NULL;
41
42 static const char *PLUGIN_ABOUT = "ctfToolz for NetRadiant\n"
43         "by djbob\n"
44         "http://www.planetquake.com/toolz\n\n";
45
46 extern "C" LPVOID WINAPI
47
48 QERPlug_GetFuncTable()
49 {
50     return &g_FuncTable;
51 }
52
53 extern "C" LPCSTR WINAPI
54 QERPlug_Init( HMODULE
55 hApp,
56 GtkWidget *pMainWidget
57 ){
58 g_pRadiantWnd = pMainWidget;
59 memset( &g_FuncTable,
60 0, sizeof( _QERFuncTable_1 ));
61 g_FuncTable.
62 m_fVersion = QER_PLUG_VERSION;
63 g_FuncTable.
64 m_nSize = sizeof(_QERFuncTable_1);
65
66 return "ctfToolz for GTKradiant";
67 }
68
69 extern "C" LPCSTR WINAPI
70
71 QERPlug_GetName()
72 {
73     return (char *) PLUGIN_NAME;
74 }
75
76 extern "C" LPCSTR WINAPI
77
78 QERPlug_GetCommandList()
79 {
80     return (char *) PLUGIN_COMMANDS;
81 }
82
83 extern "C" void WINAPI
84 QERPlug_Dispatch( LPCSTR
85 p,
86 vec3_t vMin, vec3_t
87 vMax,
88 bool bSingleBrush
89 ){
90 LoadLists();
91
92 if ( !g_bBSPInitDone ) {
93 g_BSPTable.
94 m_nSize = sizeof(_QERAppBSPFrontendTable);
95 if ( g_FuncTable.
96 m_pfnRequestInterface( QERAppBSPFrontendTable_GUID,
97 static_cast
98 <LPVOID>( &g_BSPTable )
99 )) {
100 g_bBSPInitDone = TRUE;
101 }
102 else
103 {
104 Sys_ERROR( "_QERAppBSPFrontendTable interface request failed\n" );
105 return;
106 }
107 }
108
109 if ( !
110 strcmp( p,
111 "About..." )) {
112 DoMessageBox( PLUGIN_ABOUT,
113 "About", IDOK );
114 }
115 else if ( !
116 strcmp( p,
117 "Colour Changer..." )) {
118 DoCTFColourChanger();
119
120 }
121 else if ( !
122 strcmp( p,
123 "Swap Light Colours" )) {
124 DoSwapLights();
125
126 }
127 else if ( !
128 strcmp( p,
129 "Change Angles 180" )) {
130 DoChangeAngles();
131
132 }
133 else if ( !
134 strcmp( p,
135 "Swap Spawn Points" )) {
136 DoSwapSpawns();
137
138 }
139 }