X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=contrib%2Fbobtoolz%2FctfToolz-GTK.cpp;h=66b852d997f0041d0ff7de8df7411be19379582c;hb=04236f5bd863c69814ee58414d99da818f62a60d;hp=271931abae6d95eb7cb2a9e2eb56582efca2f862;hpb=107765f0e4b543dfc346851ee5b4605cc17eb1c6;p=xonotic%2Fnetradiant.git diff --git a/contrib/bobtoolz/ctfToolz-GTK.cpp b/contrib/bobtoolz/ctfToolz-GTK.cpp index 271931ab..66b852d9 100644 --- a/contrib/bobtoolz/ctfToolz-GTK.cpp +++ b/contrib/bobtoolz/ctfToolz-GTK.cpp @@ -1,21 +1,21 @@ /* -BobToolz plugin for GtkRadiant -Copyright (C) 2001 Gordon Biggans + BobToolz plugin for GtkRadiant + Copyright (C) 2001 Gordon Biggans -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #include "StdAfx.h" @@ -24,74 +24,82 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "dialogs/dialogs-gtk.h" -// Radiant function table -_QERFuncTable_1 g_FuncTable; -_QERAppBSPFrontendTable g_BSPTable; // for map name +#define PLUGIN_NAME "ctfTools" +#define CMD_ABOUT = "About..." -BOOL g_bBSPInitDone = FALSE; +// Radiant function table +_QERFuncTable_1 g_FuncTable; +_QERAppBSPFrontendTable g_BSPTable; // for map name -// plugin name -static const char *PLUGIN_NAME = "ctfToolz"; +BOOL g_bBSPInitDone = FALSE; // commands in the menu -static const char *PLUGIN_COMMANDS = "About...,Colour Changer...,Swap Light Colours,Change Angles 180,Swap Spawn Points"; +static const char *PLUGIN_COMMANDS = ABOUT_CMD ",Colour Changer...,Swap Light Colours,Change Angles 180,Swap Spawn Points"; // globals -GtkWidget *g_pRadiantWnd=NULL; - -static const char *PLUGIN_ABOUT = "ctfToolz for GtkRadiant\n" - "by djbob\n" - "http://www.planetquake.com/toolz\n\n"; +GtkWidget *g_pRadiantWnd = NULL; -extern "C" LPVOID WINAPI QERPlug_GetFuncTable() -{ - return &g_FuncTable; +extern "C" LPVOID WINAPI QERPlug_GetFuncTable(){ + return &g_FuncTable; } -extern "C" LPCSTR WINAPI QERPlug_Init(HMODULE hApp, GtkWidget* pMainWidget) -{ +extern "C" LPCSTR WINAPI QERPlug_Init( HMODULE hApp, GtkWidget* pMainWidget ){ g_pRadiantWnd = pMainWidget; - memset(&g_FuncTable, 0, sizeof(_QERFuncTable_1)); + memset( &g_FuncTable, 0, sizeof( _QERFuncTable_1 ) ); g_FuncTable.m_fVersion = QER_PLUG_VERSION; - g_FuncTable.m_nSize = sizeof(_QERFuncTable_1); + g_FuncTable.m_nSize = sizeof( _QERFuncTable_1 ); return "ctfToolz for GTKradiant"; } -extern "C" LPCSTR WINAPI QERPlug_GetName() -{ +extern "C" LPCSTR WINAPI QERPlug_GetName(){ return (char*)PLUGIN_NAME; } -extern "C" LPCSTR WINAPI QERPlug_GetCommandList() -{ +extern "C" LPCSTR WINAPI QERPlug_GetCommandList(){ return (char*)PLUGIN_COMMANDS; } -extern "C" void WINAPI QERPlug_Dispatch (LPCSTR p, vec3_t vMin, vec3_t vMax, bool bSingleBrush) -{ +extern "C" void WINAPI QERPlug_Dispatch( LPCSTR p, vec3_t vMin, vec3_t vMax, bool bSingleBrush ){ LoadLists(); - if (!g_bBSPInitDone) - { - g_BSPTable.m_nSize = sizeof(_QERAppBSPFrontendTable); - if ( g_FuncTable.m_pfnRequestInterface( QERAppBSPFrontendTable_GUID, static_cast(&g_BSPTable) ) ) + if ( !g_bBSPInitDone ) { + g_BSPTable.m_nSize = sizeof( _QERAppBSPFrontendTable ); + if ( g_FuncTable.m_pfnRequestInterface( QERAppBSPFrontendTable_GUID, static_cast( &g_BSPTable ) ) ) { g_bBSPInitDone = TRUE; + } else { - Sys_ERROR("_QERAppBSPFrontendTable interface request failed\n"); + Sys_ERROR( "_QERAppBSPFrontendTable interface request failed\n" ); return; } } - - if(!strcmp(p, "About...")) - DoMessageBox(PLUGIN_ABOUT, "About", IDOK); - else if(!strcmp(p, "Colour Changer...")) + + if ( !strcmp( p, CMD_ABOUT ) ) { + const char *label_text = + PLUGIN_NAME for " RADIANT_NAME "\n\n" + "Written by djbob\n\n" +// 20190605 dead link +// "http://www.planetquake.com/toolz\n\n" + "Built against " + RADIANT_NAME " " RADIANT_VERSION "\n" + __DATE__; + + GlobalRadiant().m_pfnMessageBox( g_pRadiantWnd, label_text, + "About " PLUGIN_NAME, + eMB_OK, + eMB_ICONDEFAULT ); + } + else if ( !strcmp( p, "Colour Changer..." ) ) { DoCTFColourChanger(); - else if(!strcmp(p, "Swap Light Colours")) + } + else if ( !strcmp( p, "Swap Light Colours" ) ) { DoSwapLights(); - else if(!strcmp(p, "Change Angles 180")) + } + else if ( !strcmp( p, "Change Angles 180" ) ) { DoChangeAngles(); - else if(!strcmp(p, "Swap Spawn Points")) + } + else if ( !strcmp( p, "Swap Spawn Points" ) ) { DoSwapSpawns(); + } }