]> git.xonotic.org Git - xonotic/netradiant.git/blob - contrib/bobtoolz/ctfToolz-GTK.cpp
54a5efcaec8aff8473cb6969af42348fcd5f3fd5
[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 #define PLUGIN_NAME "ctfTools"
28 #define CMD_ABOUT = "About..."
29
30 // Radiant function table
31 _QERFuncTable_1 g_FuncTable;
32 _QERAppBSPFrontendTable g_BSPTable;             // for map name
33
34 BOOL g_bBSPInitDone                 = FALSE;
35
36 // commands in the menu
37 static const char *PLUGIN_COMMANDS = ABOUT_CMD ",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 =
43                         PLUGIN_NAME for " RADIANT_NAME "\n\n"
44                         "Written by djbob\n\n"
45 //                      20190605 dead link
46 //                      "http://www.planetquake.com/toolz\n\n"
47 //                      http://web.archive.org/web/20140109083123/http://planetquake.gamespy.com/toolz
48                         "Built against "
49                         RADIANT_NAME " " RADIANT_VERSION "\n"
50                         __DATE__;
51
52 extern "C" LPVOID WINAPI QERPlug_GetFuncTable(){
53         return &g_FuncTable;
54 }
55
56 extern "C" LPCSTR WINAPI QERPlug_Init( HMODULE hApp, GtkWidget* pMainWidget ){
57         g_pRadiantWnd = pMainWidget;
58         memset( &g_FuncTable, 0, sizeof( _QERFuncTable_1 ) );
59         g_FuncTable.m_fVersion = QER_PLUG_VERSION;
60         g_FuncTable.m_nSize = sizeof( _QERFuncTable_1 );
61
62         return "ctfToolz for GTKradiant";
63 }
64
65 extern "C" LPCSTR WINAPI QERPlug_GetName(){
66         return (char*)PLUGIN_NAME;
67 }
68
69 extern "C" LPCSTR WINAPI QERPlug_GetCommandList(){
70         return (char*)PLUGIN_COMMANDS;
71 }
72
73 extern "C" void WINAPI QERPlug_Dispatch( LPCSTR p, vec3_t vMin, vec3_t vMax, bool bSingleBrush ){
74         LoadLists();
75
76         if ( !g_bBSPInitDone ) {
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                 }
81                 else
82                 {
83                         Sys_ERROR( "_QERAppBSPFrontendTable interface request failed\n" );
84                         return;
85                 }
86         }
87
88         if ( !strcmp( p, CMD_ABOUT ) ) {
89                 DoMessageBox( PLUGIN_ABOUT, "About", IDOK );
90         }
91         else if ( !strcmp( p, "Colour Changer..." ) ) {
92                 DoCTFColourChanger();
93         }
94         else if ( !strcmp( p, "Swap Light Colours" ) ) {
95                 DoSwapLights();
96         }
97         else if ( !strcmp( p, "Change Angles 180" ) ) {
98                 DoChangeAngles();
99         }
100         else if ( !strcmp( p, "Swap Spawn Points" ) ) {
101                 DoSwapSpawns();
102         }
103 }