]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - contrib/bobtoolz/bobToolz-GTK.cpp
* applied patch by StefanV (from mailinglist) that fixes an error in config.py (broke...
[xonotic/netradiant.git] / contrib / bobtoolz / bobToolz-GTK.cpp
index 08cd00dd0855501d048d0e832250b528be409e6b..d824df5402b7d040dcb33a64d15ac7d681001309 100644 (file)
@@ -17,33 +17,29 @@ 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 "libxml/parser.h"
-
 #include "StdAfx.h"
 
-#include "str.h"
-//#include "gtkr_list.h"
-
 #include "funchandlers.h"
-//#include "misc.h"
+#include "misc.h"
 
 #include "dialogs/dialogs-gtk.h"
 #include "../../libs/cmdlib.h"
 
 // Radiant function table
-_QERFuncTable_1                          __QERTABLENAME;
-_QERShadersTable                 __SHADERSTABLENAME;                   // vvvvvvvvvvvvvvvvvvvv
-_QERQglTable                             __QGLTABLENAME;                               // for path plotting (hooking to DBobView)
+_QERFuncTable_1                          g_FuncTable;
+_QERAppDataTable                 g_AppDataTable;
+_QERBrushTable                   g_BrushTable;
+_QERShadersTable                 g_ShadersTable;                       // vvvvvvvvvvvvvvvvvvvv
+_QERSelectedFaceTable g_SelectedFaceTable;     // to get texture sizes
+_QERQglTable                             g_QglTable;                           // for path plotting (hooking to DBobView)
 _QERUITable                                      g_MessageTable;                       // for path plotting (listening for update)
-_QEREntityTable                          __ENTITYTABLENAME;
-_QERBrushTable                   __BRUSHTABLENAME;
-_QERPatchTable                   __PATCHTABLENAME;
+_QEREntityTable                          g_EntityTable;
 
 // plugin name
-char* PLUGIN_NAME = "bobToolz";
+const 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,Turn edge";
+static const 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";
 
 // globals
 GtkWidget *g_pRadiantWnd = NULL;
@@ -92,11 +88,11 @@ extern "C" void QERPlug_Dispatch (const char *p, vec3_t vMin, vec3_t vMax, bool
   } else if( !stricmp(p, "reset textures...") ) {
                DoResetTextures();
        } else if( !stricmp(p, "pitomatic") ) {
-               DoPitBuilder();
+               DoPitBuilder(vMin, vMax);
        } else if( !stricmp(p, "vis viewer") ) {
                DoVisAnalyse();
        } else if( !stricmp(p, "about...") ) {
-               DoMessageBox(PLUGIN_ABOUT, "About", eMB_OK);
+               DoMessageBox(PLUGIN_ABOUT, "About", IDOK);
        }
 }
 
@@ -112,14 +108,14 @@ GtkWidget* new_pixmap (char* filename) {
        GdkBitmap *mask;
        GtkWidget *pixmap;
 
-       g_FuncTable.m_pfnLoadBitmap(filename, (void **)&gdkpixmap, (void **)&mask);     
+       g_FuncTable.m_pfnLoadBitmap(filename, (void **)&gdkpixmap, (void **)&mask);
        pixmap = gtk_pixmap_new (gdkpixmap, mask);
 
        gdk_pixmap_unref (gdkpixmap);
        gdk_pixmap_unref (mask);
 
        return pixmap;
-} 
+}
 
 class CBobtoolzToolbarButton : public IToolbarButton
 {
@@ -144,7 +140,7 @@ public:
     switch( mIndex ) {
       case 3: return eToggleButton;
       default: return eButton;
-    }    
+    }
   }
   virtual const char* getText() const
   {
@@ -208,15 +204,13 @@ const IToolbarButton* GetToolbarButton(unsigned int index)
 // =============================================================================
 // SYNAPSE
 
-#include "synapse.h"
-
 class CSynapseClientBobtoolz : public CSynapseClient
 {
 public:
   // CSynapseClient API
   bool RequestAPI(APIDescriptor_t *pAPI);
   const char* GetInfo();
-  
+
   CSynapseClientBobtoolz() { }
   virtual ~CSynapseClientBobtoolz() { }
 };
@@ -225,8 +219,13 @@ public:
 CSynapseServer* g_pSynapseServer = NULL;
 CSynapseClientBobtoolz g_SynapseClient;
 
-extern "C" CSynapseClient* SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces (const char *version, CSynapseServer *pServer)
-{
+#if __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+extern "C" CSynapseClient* SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces( const char *version, CSynapseServer *pServer ) {
+#if __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
   if (strcmp(version, SYNAPSE_VERSION))
   {
     Syn_Printf("ERROR: synapse API version mismatch: should be '" SYNAPSE_VERSION "', got '%s'\n", version);
@@ -235,17 +234,17 @@ extern "C" CSynapseClient* SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces (const
   g_pSynapseServer = pServer;
   g_pSynapseServer->IncRef();
   Set_Syn_Printf(g_pSynapseServer->Get_Syn_Printf());
-    
+
   g_SynapseClient.AddAPI(TOOLBAR_MAJOR, BOBTOOLZ_MINOR, sizeof(_QERPlugToolbarTable));
   g_SynapseClient.AddAPI(PLUGIN_MAJOR, BOBTOOLZ_MINOR, sizeof(_QERPluginTable));
 
-  g_SynapseClient.AddAPI(BRUSH_MAJOR, NULL, sizeof(__BRUSHTABLENAME), SYN_REQUIRE, &g_BrushTable);
-  g_SynapseClient.AddAPI(PATCH_MAJOR, NULL, sizeof(__PATCHTABLENAME), SYN_REQUIRE, &g_BrushTable);
+  g_SynapseClient.AddAPI(DATA_MAJOR, NULL, sizeof(g_AppDataTable), SYN_REQUIRE, &g_AppDataTable);
+  g_SynapseClient.AddAPI(BRUSH_MAJOR, NULL, sizeof(g_BrushTable), SYN_REQUIRE, &g_BrushTable);
   g_SynapseClient.AddAPI(SHADERS_MAJOR, "*", sizeof(g_ShadersTable), SYN_REQUIRE, &g_ShadersTable);
   g_SynapseClient.AddAPI(ENTITY_MAJOR, NULL, sizeof(g_EntityTable), SYN_REQUIRE, &g_EntityTable);
   g_SynapseClient.AddAPI(SELECTEDFACE_MAJOR, NULL, sizeof(g_SelectedFaceTable), SYN_REQUIRE, &g_SelectedFaceTable);
   g_SynapseClient.AddAPI(UI_MAJOR, NULL, sizeof(g_MessageTable), SYN_REQUIRE, &g_MessageTable);
-  g_SynapseClient.AddAPI(RADIANT_MAJOR, NULL, sizeof(__QERTABLENAME), SYN_REQUIRE, &g_FuncTable);
+  g_SynapseClient.AddAPI(RADIANT_MAJOR, NULL, sizeof(g_FuncTable), SYN_REQUIRE, &g_FuncTable);
   g_SynapseClient.AddAPI(QGL_MAJOR, NULL, sizeof(g_QglTable), SYN_REQUIRE, &g_QglTable);
 
   return &g_SynapseClient;
@@ -293,6 +292,6 @@ char* GetFilename(char* buffer, const char* filename) {
        StripFilename( buffer );
        strcat(buffer, "/");
        strcat(buffer, filename);
-       //buffer = UnixToDosPath(buffer);
+       buffer = UnixToDosPath(buffer);
        return buffer;
 }