]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - contrib/bobtoolz/bobToolz-GTK.cpp
Remove the final gtk headers in headers
[xonotic/netradiant.git] / contrib / bobtoolz / bobToolz-GTK.cpp
index 3df73c4ce6cc6789150449e97f17939098019ac2..6cf91a0be9947d868d0ab628105e0fa95f2a38e8 100644 (file)
-/*\r
-BobToolz plugin for GtkRadiant\r
-Copyright (C) 2001 Gordon Biggans\r
-\r
-This library is free software; you can redistribute it and/or\r
-modify it under the terms of the GNU Lesser General Public\r
-License as published by the Free Software Foundation; either\r
-version 2.1 of the License, or (at your option) any later version.\r
-\r
-This library is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
-Lesser General Public License for more details.\r
-\r
-You should have received a copy of the GNU Lesser General Public\r
-License along with this library; if not, write to the Free Software\r
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
-*/\r
-\r
-#include "StdAfx.h"\r
-\r
-#include "funchandlers.h"\r
-#include "misc.h"\r
-\r
-#include "dialogs/dialogs-gtk.h"\r
-#include "../../libs/cmdlib.h"\r
-\r
-// Radiant function table\r
-_QERFuncTable_1                          g_FuncTable;\r
-_QERAppDataTable                 g_AppDataTable;\r
-_QERBrushTable                   g_BrushTable;\r
-_QERShadersTable                 g_ShadersTable;                       // vvvvvvvvvvvvvvvvvvvv\r
-_QERSelectedFaceTable g_SelectedFaceTable;     // to get texture sizes\r
-_QERQglTable                             g_QglTable;                           // for path plotting (hooking to DBobView)\r
-_QERUITable                                      g_MessageTable;                       // for path plotting (listening for update)\r
-_QEREntityTable                          g_EntityTable;\r
-\r
-// plugin name\r
-char* PLUGIN_NAME = "bobToolz";\r
-\r
-// commands in the menu\r
-static char* PLUGIN_COMMANDS = "About...,-,Reset Textures...,PitOMatic,-,Vis Viewer,Brush Cleanup,Polygon Builder,Caulk Selection,-,Tree Planter,Drop Entity,Plot Splines,-,Merge Patches,Split patches,Turn edge";\r
-\r
-// globals\r
-GtkWidget *g_pRadiantWnd = NULL;\r
-\r
-static const char *PLUGIN_ABOUT =      "bobToolz for SDRadiant\n"\r
-                                                                       "by digibob (digibob@splashdamage.com)\n"\r
-                                                                       "http://www.splashdamage.com\n\n"\r
-                                                                       "Additional Contributors:\n"\r
-                                                                       "MarsMattel, RR2DO2\n";\r
-\r
-extern "C" const char* QERPlug_Init( void* hApp, void* pMainWidget ) {\r
-       g_pRadiantWnd = (GtkWidget*)pMainWidget;\r
-\r
-       return "bobToolz for GTKradiant";\r
-}\r
-\r
-extern "C" const char* QERPlug_GetName() {\r
-       return PLUGIN_NAME;\r
-}\r
-\r
-extern "C" const char* QERPlug_GetCommandList() {\r
-       return PLUGIN_COMMANDS;\r
-}\r
-\r
-extern "C" void QERPlug_Dispatch (const char *p, vec3_t vMin, vec3_t vMax, bool bSingleBrush) {\r
-       LoadLists();\r
-\r
-       if( !stricmp( p, "brush cleanup" ) ) {\r
-    DoFixBrushes();\r
-  } else if( !stricmp( p, "polygon builder" ) ) {\r
-    DoPolygonsTB();\r
-  } else if( !stricmp( p, "caulk selection" ) ) {\r
-    DoCaulkSelection();\r
-  } else if( !stricmp( p, "tree planter" ) ) {\r
-    DoTreePlanter();\r
-  } else if( !stricmp( p, "plot splines" ) ) {\r
-    DoTrainPathPlot();\r
-  } else if( !stricmp( p, "drop entity" ) ) {\r
-    DoDropEnts();\r
-  } else if( !stricmp( p, "merge patches" ) ) {\r
-    DoMergePatches();\r
-  } else if( !stricmp( p, "split patches" ) ) {\r
-    DoSplitPatch();\r
-  } else if( !stricmp( p, "turn edge" ) ) {\r
-    DoFlipTerrain();\r
-  } else if( !stricmp(p, "reset textures...") ) {\r
-               DoResetTextures();\r
-       } else if( !stricmp(p, "pitomatic") ) {\r
-               DoPitBuilder(vMin, vMax);\r
-       } else if( !stricmp(p, "vis viewer") ) {\r
-               DoVisAnalyse();\r
-       } else if( !stricmp(p, "about...") ) {\r
-               DoMessageBox(PLUGIN_ABOUT, "About", IDOK);\r
-       }\r
-}\r
-\r
-#define NUM_TOOLBARBUTTONS 9\r
-\r
-unsigned int ToolbarButtonCount( void ) {\r
-       return NUM_TOOLBARBUTTONS;\r
-}\r
-\r
-// Load a xpm file and return a pixmap widget.\r
-GtkWidget* new_pixmap (char* filename) {\r
-       GdkPixmap *gdkpixmap;\r
-       GdkBitmap *mask;\r
-       GtkWidget *pixmap;\r
-\r
-       g_FuncTable.m_pfnLoadBitmap(filename, (void **)&gdkpixmap, (void **)&mask);     \r
-       pixmap = gtk_pixmap_new (gdkpixmap, mask);\r
-\r
-       gdk_pixmap_unref (gdkpixmap);\r
-       gdk_pixmap_unref (mask);\r
-\r
-       return pixmap;\r
-} \r
-\r
-class CBobtoolzToolbarButton : public IToolbarButton\r
-{\r
-public:\r
-  virtual const char* getImage() const\r
-  {\r
-    switch( mIndex ) {\r
-      case 0: return "bobtoolz_cleanup.bmp";\r
-      case 1: return "bobtoolz_poly.bmp";\r
-      case 2: return "bobtoolz_caulk.bmp";\r
-      case 3: return "bobtoolz_treeplanter.bmp";\r
-      case 4: return "bobtoolz_trainpathplot.bmp";\r
-      case 5: return "bobtoolz_dropent.bmp";\r
-      case 6: return "bobtoolz_merge.bmp";\r
-      case 7: return "bobtoolz_split.bmp";\r
-      case 8: return "bobtoolz_turnedge.bmp";\r
-    }\r
-    return NULL;\r
-  }\r
-  virtual EType getType() const\r
-  {\r
-    switch( mIndex ) {\r
-      case 3: return eToggleButton;\r
-      default: return eButton;\r
-    }    \r
-  }\r
-  virtual const char* getText() const\r
-  {\r
-    switch( mIndex ) {\r
-      case 0: return "Cleanup";\r
-      case 1: return "Polygons";\r
-      case 2: return "Caulk";\r
-      case 3: return "Tree Planter";\r
-      case 4: return "Plot Splines";\r
-      case 5: return "Drop Entity";\r
-      case 6: return "Merge Patches";\r
-      case 7: return "Split Patches";\r
-      case 8: return "Flip Terrain";\r
-    }\r
-    return NULL;\r
-  }\r
-  virtual const char* getTooltip() const\r
-  {\r
-    switch( mIndex ) {\r
-      case 0: return "Brush Cleanup";\r
-      case 1: return "Polygons";\r
-      case 2: return "Caulk selection";\r
-      case 3: return "Tree Planter";\r
-      case 4: return "Plot Splines";\r
-      case 5: return "Drop Entity";\r
-      case 6: return "Merge Patches";\r
-      case 7: return "Split Patches";\r
-      case 8: return "Flip Terrain";\r
-    }\r
-    return NULL;\r
-  }\r
-\r
-  virtual void activate() const\r
-  {\r
-       LoadLists();\r
-\r
-    switch( mIndex ) {\r
-      case 0: DoFixBrushes(); break;\r
-      case 1: DoPolygonsTB(); break;\r
-      case 2: DoCaulkSelection(); break;\r
-      case 3: DoTreePlanter(); break;\r
-      case 4: DoTrainPathPlot(); break;\r
-      case 5: DoDropEnts(); break;\r
-      case 6: DoMergePatches(); break;\r
-      case 7: DoSplitPatch(); break;\r
-      case 8: DoFlipTerrain(); break;\r
-    }\r
-  }\r
-\r
-  int mIndex;\r
-};\r
-\r
-CBobtoolzToolbarButton g_bobtoolzToolbarButtons[NUM_TOOLBARBUTTONS];\r
-\r
-const IToolbarButton* GetToolbarButton(unsigned int index)\r
-{\r
-  g_bobtoolzToolbarButtons[index].mIndex = index;\r
-  return &g_bobtoolzToolbarButtons[index];\r
-}\r
-\r
-// =============================================================================\r
-// SYNAPSE\r
-\r
-class CSynapseClientBobtoolz : public CSynapseClient\r
-{\r
-public:\r
-  // CSynapseClient API\r
-  bool RequestAPI(APIDescriptor_t *pAPI);\r
-  const char* GetInfo();\r
-  \r
-  CSynapseClientBobtoolz() { }\r
-  virtual ~CSynapseClientBobtoolz() { }\r
-};\r
-\r
-\r
-CSynapseServer* g_pSynapseServer = NULL;\r
-CSynapseClientBobtoolz g_SynapseClient;\r
-\r
-extern "C" CSynapseClient* SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces (const char *version, CSynapseServer *pServer)\r
-{\r
-  if (strcmp(version, SYNAPSE_VERSION))\r
-  {\r
-    Syn_Printf("ERROR: synapse API version mismatch: should be '" SYNAPSE_VERSION "', got '%s'\n", version);\r
-    return NULL;\r
-  }\r
-  g_pSynapseServer = pServer;\r
-  g_pSynapseServer->IncRef();\r
-  Set_Syn_Printf(g_pSynapseServer->Get_Syn_Printf());\r
-    \r
-  g_SynapseClient.AddAPI(TOOLBAR_MAJOR, BOBTOOLZ_MINOR, sizeof(_QERPlugToolbarTable));\r
-  g_SynapseClient.AddAPI(PLUGIN_MAJOR, BOBTOOLZ_MINOR, sizeof(_QERPluginTable));\r
-\r
-  g_SynapseClient.AddAPI(DATA_MAJOR, NULL, sizeof(g_AppDataTable), SYN_REQUIRE, &g_AppDataTable);\r
-  g_SynapseClient.AddAPI(BRUSH_MAJOR, NULL, sizeof(g_BrushTable), SYN_REQUIRE, &g_BrushTable);\r
-  g_SynapseClient.AddAPI(SHADERS_MAJOR, "*", sizeof(g_ShadersTable), SYN_REQUIRE, &g_ShadersTable);\r
-  g_SynapseClient.AddAPI(ENTITY_MAJOR, NULL, sizeof(g_EntityTable), SYN_REQUIRE, &g_EntityTable);\r
-  g_SynapseClient.AddAPI(SELECTEDFACE_MAJOR, NULL, sizeof(g_SelectedFaceTable), SYN_REQUIRE, &g_SelectedFaceTable);\r
-  g_SynapseClient.AddAPI(UI_MAJOR, NULL, sizeof(g_MessageTable), SYN_REQUIRE, &g_MessageTable);\r
-  g_SynapseClient.AddAPI(RADIANT_MAJOR, NULL, sizeof(g_FuncTable), SYN_REQUIRE, &g_FuncTable);\r
-  g_SynapseClient.AddAPI(QGL_MAJOR, NULL, sizeof(g_QglTable), SYN_REQUIRE, &g_QglTable);\r
-\r
-  return &g_SynapseClient;\r
-}\r
-\r
-bool CSynapseClientBobtoolz::RequestAPI(APIDescriptor_t *pAPI)\r
-{\r
-  if( !strcmp(pAPI->minor_name, BOBTOOLZ_MINOR) )\r
-  {\r
-    if( !strcmp(pAPI->major_name, PLUGIN_MAJOR) )\r
-    {\r
-      _QERPluginTable* pTable= static_cast<_QERPluginTable*>(pAPI->mpTable);\r
-\r
-      pTable->m_pfnQERPlug_Init = QERPlug_Init;\r
-      pTable->m_pfnQERPlug_GetName = QERPlug_GetName;\r
-      pTable->m_pfnQERPlug_GetCommandList = QERPlug_GetCommandList;\r
-      pTable->m_pfnQERPlug_Dispatch = QERPlug_Dispatch;\r
-\r
-      return true;\r
-    }\r
-    else if( !strcmp(pAPI->major_name, TOOLBAR_MAJOR) )\r
-    {\r
-      _QERPlugToolbarTable* pTable= static_cast<_QERPlugToolbarTable*>(pAPI->mpTable);\r
-\r
-      pTable->m_pfnToolbarButtonCount = &ToolbarButtonCount;\r
-      pTable->m_pfnGetToolbarButton = &GetToolbarButton;\r
-\r
-      return true;\r
-    }\r
-  }\r
-\r
-  Syn_Printf("ERROR: RequestAPI( '%s' ) not found in '%s'\n", pAPI->major_name, GetInfo());\r
-  return false;\r
-}\r
-\r
-#include "version.h"\r
-\r
-const char* CSynapseClientBobtoolz::GetInfo()\r
-{\r
-  return "bobToolz module built " __DATE__ " " RADIANT_VERSION;\r
-}\r
-\r
-char* GetFilename(char* buffer, const char* filename) {\r
-       strcpy(buffer, g_pSynapseServer->GetModuleFilename(&g_SynapseClient));\r
-       StripFilename( buffer );\r
-       strcat(buffer, "/");\r
-       strcat(buffer, filename);\r
-       buffer = UnixToDosPath(buffer);\r
-       return buffer;\r
-}\r
+/*
+   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 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
+ */
+
+
+
+#include "str.h"
+#include "qerplugin.h"
+#include "mathlib.h"
+#include "string/string.h"
+#include "itoolbar.h"
+
+#include "funchandlers.h"
+#include "DBobView.h"
+#include "DVisDrawer.h"
+#include "DTrainDrawer.h"
+#include "DTreePlanter.h"
+
+#include "dialogs/dialogs-gtk.h"
+#include "../../libs/cmdlib.h"
+
+void BobToolz_construct(){
+}
+
+void BobToolz_destroy(){
+       if ( g_PathView ) {
+               delete g_PathView;
+               g_PathView = NULL;
+       }
+       if ( g_VisView ) {
+               delete g_VisView;
+               g_VisView = NULL;
+       }
+       if ( g_TrainView ) {
+               delete g_TrainView;
+               g_TrainView = NULL;
+       }
+       if ( g_TreePlanter ) {
+               delete g_TreePlanter;
+               g_TreePlanter = NULL;
+       }
+}
+
+// plugin name
+char* PLUGIN_NAME = "bobToolz";
+
+// commands in the menu
+static char* PLUGIN_COMMANDS = "About...,-,Reset Textures...,PitOMatic,-,Vis Viewer,Brush Cleanup,Polygon Builder,Caulk Selection,-,Tree Planter,Drop Entity,Plot Splines,-,Merge Patches,Split patches,Split patches cols,Split patches rows,Turn edge";
+
+// globals
+ui::Widget g_pRadiantWnd;
+
+static const char *PLUGIN_ABOUT =   "bobToolz for SDRadiant\n"
+                                                                       "by digibob (digibob@splashdamage.com)\n"
+                                                                       "http://www.splashdamage.com\n\n"
+                                                                       "Additional Contributors:\n"
+                                                                       "MarsMattel, RR2DO2\n";
+
+extern "C" const char* QERPlug_Init( void* hApp, void* pMainWidget ) {
+       g_pRadiantWnd = ui::Widget::from(pMainWidget);
+
+       return "bobToolz for GTKradiant";
+}
+
+extern "C" const char* QERPlug_GetName() {
+       return PLUGIN_NAME;
+}
+
+extern "C" const char* QERPlug_GetCommandList() {
+       return PLUGIN_COMMANDS;
+}
+
+extern "C" void QERPlug_Dispatch( const char *p, vec3_t vMin, vec3_t vMax, bool bSingleBrush ) {
+       LoadLists();
+
+       if ( string_equal_nocase( p, "brush cleanup" ) ) {
+               DoFixBrushes();
+       }
+       else if ( string_equal_nocase( p, "polygon builder" ) ) {
+               DoPolygonsTB();
+       }
+       else if ( string_equal_nocase( p, "caulk selection" ) ) {
+               DoCaulkSelection();
+       }
+       else if ( string_equal_nocase( p, "tree planter" ) ) {
+               DoTreePlanter();
+       }
+       else if ( string_equal_nocase( p, "plot splines" ) ) {
+               DoTrainPathPlot();
+       }
+       else if ( string_equal_nocase( p, "drop entity" ) ) {
+               DoDropEnts();
+       }
+       else if ( string_equal_nocase( p, "merge patches" ) ) {
+               DoMergePatches();
+       }
+       else if ( string_equal_nocase( p, "split patches" ) ) {
+               DoSplitPatch();
+       }
+       else if ( string_equal_nocase( p, "split patches rows" ) ) {
+               DoSplitPatchRows();
+       }
+       else if ( string_equal_nocase( p, "split patches cols" ) ) {
+               DoSplitPatchCols();
+       }
+       else if ( string_equal_nocase( p, "turn edge" ) ) {
+               DoFlipTerrain();
+       }
+       else if ( string_equal_nocase( p, "reset textures..." ) ) {
+               DoResetTextures();
+       }
+       else if ( string_equal_nocase( p, "pitomatic" ) ) {
+               DoPitBuilder();
+       }
+       else if ( string_equal_nocase( p, "vis viewer" ) ) {
+               DoVisAnalyse();
+       }
+       else if ( string_equal_nocase( p, "stair builder..." ) ) {
+               DoBuildStairs();
+       }
+       else if ( string_equal_nocase( p, "door builder..." ) ) {
+               DoBuildDoors();
+       }
+       else if ( string_equal_nocase( p, "intersect..." ) ) {
+               DoIntersect();
+       }
+       else if ( string_equal_nocase( p, "make chain..." ) ) {
+               DoMakeChain();
+       }
+       else if ( string_equal_nocase( p, "path plotter..." ) ) {
+               DoPathPlotter();
+       }
+       else if ( string_equal_nocase( p, "about..." ) ) {
+               DoMessageBox( PLUGIN_ABOUT, "About", eMB_OK );
+       }
+}
+
+const char* QERPlug_GetCommandTitleList(){
+       return "";
+}
+
+
+#define NUM_TOOLBARBUTTONS 14
+
+std::size_t ToolbarButtonCount( void ) {
+       return NUM_TOOLBARBUTTONS;
+}
+
+class CBobtoolzToolbarButton : public IToolbarButton
+{
+public:
+virtual const char* getImage() const {
+       switch ( mIndex ) {
+       case 0: return "bobtoolz_cleanup.png";
+       case 1: return "bobtoolz_poly.png";
+       case 2: return "bobtoolz_caulk.png";
+       case 3: return "";
+       case 4: return "bobtoolz_treeplanter.png";
+       case 5: return "bobtoolz_trainpathplot.png";
+       case 6: return "bobtoolz_dropent.png";
+       case 7: return "";
+       case 8: return "bobtoolz_merge.png";
+       case 9: return "bobtoolz_split.png";
+       case 10: return "bobtoolz_splitrow.png";
+       case 11: return "bobtoolz_splitcol.png";
+       case 12: return "";
+       case 13: return "bobtoolz_turnedge.png";
+       }
+       return NULL;
+}
+virtual EType getType() const {
+       switch ( mIndex ) {
+       case 3: return eSpace;
+       case 4: return eToggleButton;
+       case 7: return eSpace;
+       case 12: return eSpace;
+       default: return eButton;
+       }
+}
+virtual const char* getText() const {
+       switch ( mIndex ) {
+       case 0: return "Cleanup";
+       case 1: return "Polygons";
+       case 2: return "Caulk";
+       case 4: return "Tree Planter";
+       case 5: return "Plot Splines";
+       case 6: return "Drop Entity";
+       case 8: return "Merge 2 Patches";
+       case 9: return "Split Patch";
+       case 10: return "Split Patch Rows";
+       case 11: return "Split Patch Columns";
+       case 13: return "Flip Terrain";
+       }
+       return NULL;
+}
+virtual const char* getTooltip() const {
+       switch ( mIndex ) {
+       case 0: return "Brush Cleanup";
+       case 1: return "Polygons";
+       case 2: return "Caulk selection";
+       case 4: return "Tree Planter";
+       case 5: return "Plot Splines";
+       case 6: return "Drop Entity";
+       case 8: return "Merge 2 Patches";
+       case 9: return "Split Patch";
+       case 10: return "Split Patch Rows";
+       case 11: return "Split Patch Columns";
+       case 13: return "Flip Terrain (Turn Edge)";
+       }
+       return NULL;
+}
+
+virtual void activate() const {
+       LoadLists();
+
+       switch ( mIndex ) {
+       case 0: DoFixBrushes(); break;
+       case 1: DoPolygonsTB(); break;
+       case 2: DoCaulkSelection(); break;
+       case 4: DoTreePlanter(); break;
+       case 5: DoTrainPathPlot(); break;
+       case 6: DoDropEnts(); break;
+       case 8: DoMergePatches(); break;
+       case 9: DoSplitPatch(); break;
+       case 10: DoSplitPatchRows(); break;
+       case 11: DoSplitPatchCols(); break;
+       case 13: DoFlipTerrain(); break;
+       }
+}
+
+std::size_t mIndex;
+};
+
+CBobtoolzToolbarButton g_bobtoolzToolbarButtons[NUM_TOOLBARBUTTONS];
+
+const IToolbarButton* GetToolbarButton( std::size_t index ){
+       g_bobtoolzToolbarButtons[index].mIndex = index;
+       return &g_bobtoolzToolbarButtons[index];
+}
+
+
+#include "modulesystem/singletonmodule.h"
+
+#include "iscenegraph.h"
+#include "irender.h"
+#include "iundo.h"
+#include "ishaders.h"
+#include "ipatch.h"
+#include "ibrush.h"
+#include "ientity.h"
+#include "ieclass.h"
+#include "iglrender.h"
+#include "iplugin.h"
+
+class BobToolzPluginDependencies :
+       public GlobalRadiantModuleRef,
+       public GlobalUndoModuleRef,
+       public GlobalSceneGraphModuleRef,
+       public GlobalSelectionModuleRef,
+       public GlobalEntityModuleRef,
+       public GlobalEntityClassManagerModuleRef,
+       public GlobalShadersModuleRef,
+       public GlobalShaderCacheModuleRef,
+       public GlobalBrushModuleRef,
+       public GlobalPatchModuleRef,
+       public GlobalOpenGLModuleRef,
+       public GlobalOpenGLStateLibraryModuleRef
+{
+public:
+BobToolzPluginDependencies() :
+       GlobalEntityModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "entities" ) ),
+       GlobalShadersModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "shaders" ) ),
+       GlobalBrushModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "brushtypes" ) ),
+       GlobalPatchModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "patchtypes" ) ),
+       GlobalEntityClassManagerModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "entityclass" ) ){
+}
+};
+
+class BobToolzPluginModule : public TypeSystemRef
+{
+_QERPluginTable m_plugin;
+public:
+typedef _QERPluginTable Type;
+STRING_CONSTANT( Name, "bobToolz" );
+
+BobToolzPluginModule(){
+       m_plugin.m_pfnQERPlug_Init = QERPlug_Init;
+       m_plugin.m_pfnQERPlug_GetName = QERPlug_GetName;
+       m_plugin.m_pfnQERPlug_GetCommandList = QERPlug_GetCommandList;
+       m_plugin.m_pfnQERPlug_GetCommandTitleList = QERPlug_GetCommandTitleList;
+       m_plugin.m_pfnQERPlug_Dispatch = QERPlug_Dispatch;
+
+       BobToolz_construct();
+}
+~BobToolzPluginModule(){
+       BobToolz_destroy();
+}
+_QERPluginTable* getTable(){
+       return &m_plugin;
+}
+};
+
+typedef SingletonModule<BobToolzPluginModule, BobToolzPluginDependencies> SingletonBobToolzPluginModule;
+
+SingletonBobToolzPluginModule g_BobToolzPluginModule;
+
+
+class BobToolzToolbarDependencies :
+       public ModuleRef<_QERPluginTable>
+{
+public:
+BobToolzToolbarDependencies() :
+       ModuleRef<_QERPluginTable>( "bobToolz" ){
+}
+};
+
+class BobToolzToolbarModule : public TypeSystemRef
+{
+_QERPlugToolbarTable m_table;
+public:
+typedef _QERPlugToolbarTable Type;
+STRING_CONSTANT( Name, "bobToolz" );
+
+BobToolzToolbarModule(){
+       m_table.m_pfnToolbarButtonCount = ToolbarButtonCount;
+       m_table.m_pfnGetToolbarButton = GetToolbarButton;
+}
+_QERPlugToolbarTable* getTable(){
+       return &m_table;
+}
+};
+
+typedef SingletonModule<BobToolzToolbarModule, BobToolzToolbarDependencies> SingletonBobToolzToolbarModule;
+
+SingletonBobToolzToolbarModule g_BobToolzToolbarModule;
+
+
+extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules( ModuleServer& server ){
+       initialiseModule( server );
+
+       g_BobToolzPluginModule.selfRegister();
+       g_BobToolzToolbarModule.selfRegister();
+}