]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - contrib/bobtoolz/bobToolz-GTK.cpp
* more translateable strings
[xonotic/netradiant.git] / contrib / bobtoolz / bobToolz-GTK.cpp
index b0940e0842a951e48d527a21a4df4d2becc21e41..e0db8f36139b363e9e32183c37c55b7013d8ea97 100644 (file)
@@ -17,32 +17,23 @@ 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 "str.h"
+#include "StdAfx.h"
 
 #include "funchandlers.h"
+#include "misc.h"
 
 #include "dialogs/dialogs-gtk.h"
 #include "../../libs/cmdlib.h"
 
-void BobToolz_construct()
-{
-}
-
-void BobToolz_destroy()
-{
-}
-
 // 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";
@@ -76,32 +67,32 @@ extern "C" const char* QERPlug_GetCommandList() {
 extern "C" void QERPlug_Dispatch (const char *p, vec3_t vMin, vec3_t vMax, bool bSingleBrush) {
        LoadLists();
 
-       if( string_equal_nocase( p, "brush cleanup" ) ) {
+       if( !stricmp( p, "brush cleanup" ) ) {
     DoFixBrushes();
-  } else if( string_equal_nocase( p, "polygon builder" ) ) {
+  } else if( !stricmp( p, "polygon builder" ) ) {
     DoPolygonsTB();
-  } else if( string_equal_nocase( p, "caulk selection" ) ) {
+  } else if( !stricmp( p, "caulk selection" ) ) {
     DoCaulkSelection();
-  } else if( string_equal_nocase( p, "tree planter" ) ) {
+  } else if( !stricmp( p, "tree planter" ) ) {
     DoTreePlanter();
-  } else if( string_equal_nocase( p, "plot splines" ) ) {
+  } else if( !stricmp( p, "plot splines" ) ) {
     DoTrainPathPlot();
-  } else if( string_equal_nocase( p, "drop entity" ) ) {
+  } else if( !stricmp( p, "drop entity" ) ) {
     DoDropEnts();
-  } else if( string_equal_nocase( p, "merge patches" ) ) {
+  } else if( !stricmp( p, "merge patches" ) ) {
     DoMergePatches();
-  } else if( string_equal_nocase( p, "split patches" ) ) {
+  } else if( !stricmp( p, "split patches" ) ) {
     DoSplitPatch();
-  } else if( string_equal_nocase( p, "turn edge" ) ) {
+  } else if( !stricmp( p, "turn edge" ) ) {
     DoFlipTerrain();
-  } else if( string_equal_nocase(p, "reset textures...") ) {
+  } else if( !stricmp(p, "reset textures...") ) {
                DoResetTextures();
-       } else if( string_equal_nocase(p, "pitomatic") ) {
-               DoPitBuilder();
-       } else if( string_equal_nocase(p, "vis viewer") ) {
+       } else if( !stricmp(p, "pitomatic") ) {
+               DoPitBuilder(vMin, vMax);
+       } else if( !stricmp(p, "vis viewer") ) {
                DoVisAnalyse();
-       } else if( string_equal_nocase(p, "about...") ) {
-               DoMessageBox(PLUGIN_ABOUT, "About", eMB_OK);
+       } else if( !stricmp(p, "about...") ) {
+               DoMessageBox(PLUGIN_ABOUT, "About", IDOK);
        }
 }
 
@@ -213,8 +204,6 @@ const IToolbarButton* GetToolbarButton(unsigned int index)
 // =============================================================================
 // SYNAPSE
 
-#include "synapse.h"
-
 class CSynapseClientBobtoolz : public CSynapseClient
 {
 public:
@@ -226,13 +215,17 @@ public:
   virtual ~CSynapseClientBobtoolz() { }
 };
 
-#define BOBTOOLZ_MINOR "bobtoolz"
 
 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);
@@ -245,13 +238,13 @@ extern "C" CSynapseClient* SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces (const
   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;
@@ -294,3 +287,11 @@ const char* CSynapseClientBobtoolz::GetInfo()
   return "bobToolz module built " __DATE__ " " RADIANT_VERSION;
 }
 
+char* GetFilename(char* buffer, const char* filename) {
+       strcpy(buffer, g_pSynapseServer->GetModuleFilename(&g_SynapseClient));
+       StripFilename( buffer );
+       strcat(buffer, "/");
+       strcat(buffer, filename);
+       buffer = UnixToDosPath(buffer);
+       return buffer;
+}