]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - contrib/bobtoolz/ctfToolz-GTK.cpp
- Radiant is now Vista compatible (Aero must be disabled)
[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 GtkRadiant\n"
43                                   "by djbob\n"
44                                                                   "http://www.planetquake.com/toolz\n\n";
45
46 extern "C" LPVOID WINAPI QERPlug_GetFuncTable()
47 {
48   return &g_FuncTable;
49 }
50
51 extern "C" LPCSTR WINAPI QERPlug_Init(HMODULE hApp, GtkWidget* pMainWidget)
52 {
53         g_pRadiantWnd = pMainWidget;
54         memset(&g_FuncTable, 0, sizeof(_QERFuncTable_1));
55         g_FuncTable.m_fVersion = QER_PLUG_VERSION;
56         g_FuncTable.m_nSize = sizeof(_QERFuncTable_1);
57
58         return "ctfToolz for GTKradiant";
59 }
60
61 extern "C" LPCSTR WINAPI QERPlug_GetName()
62 {
63         return (char*)PLUGIN_NAME;
64 }
65
66 extern "C" LPCSTR WINAPI QERPlug_GetCommandList()
67 {
68         return (char*)PLUGIN_COMMANDS;
69 }
70
71 extern "C" void WINAPI QERPlug_Dispatch (LPCSTR p, vec3_t vMin, vec3_t vMax, bool bSingleBrush)
72 {
73         LoadLists();
74
75         if (!g_bBSPInitDone)
76         {
77                 g_BSPTable.m_nSize = sizeof(_QERAppBSPFrontendTable);
78                 if ( g_FuncTable.m_pfnRequestInterface( QERAppBSPFrontendTable_GUID, static_cast<LPVOID>(&g_BSPTable) ) )
79                         g_bBSPInitDone = TRUE;
80                 else
81                 {
82                         Sys_ERROR("_QERAppBSPFrontendTable interface request failed\n");
83                         return;
84                 }
85         }
86                 
87         if(!strcmp(p, "About..."))
88                 DoMessageBox(PLUGIN_ABOUT, "About", IDOK);
89         else if(!strcmp(p, "Colour Changer..."))
90                 DoCTFColourChanger();
91         else if(!strcmp(p, "Swap Light Colours"))
92                 DoSwapLights();
93         else if(!strcmp(p, "Change Angles 180"))
94                 DoChangeAngles();
95         else if(!strcmp(p, "Swap Spawn Points"))
96                 DoSwapSpawns();
97 }