]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - contrib/brushexport/plugin.cpp
Merge branch 'NateEag-master-patch-12920' into 'master'
[xonotic/netradiant.git] / contrib / brushexport / plugin.cpp
index 274c840ee70f1947e408e6b360693ff148c78d9b..9b40fd69327bd8665f80c3442ca526382debfa9c 100644 (file)
@@ -24,7 +24,6 @@
 #include "qerplugin.h"
 
 #include <gtk/gtk.h>
-#include <gtk/gtktreeview.h>
 
 #include "debugging/debugging.h"
 #include "string/string.h"
 
 #include "typesystem.h"
 
-void CreateWindow( void );
+#define CMD_ABOUT "About..."
+
+void CreateWindow( ui::Window main_window );
 void DestroyWindow( void );
 bool IsWindowOpen( void );
 
+ui::Widget g_pRadiantWnd{ui::null};
+
 namespace BrushExport
 {
-GtkWindow* g_mainwnd;
+ui::Window g_mainwnd{ui::null};
 
 const char* init( void* hApp, void* pMainWidget ){
-       g_mainwnd = (GtkWindow*)pMainWidget;
-       ASSERT_NOTNULL( g_mainwnd );
+       g_mainwnd = ui::Window::from(pMainWidget);
+       g_pRadiantWnd = ui::Window::from(pMainWidget);
+       ASSERT_TRUE( g_mainwnd );
        return "";
 }
 const char* getName(){
        return "Brush export Plugin";
 }
 const char* getCommandList(){
-       return "Export selected as Wavefront Object;About";
+       return CMD_ABOUT ";-;Export selected as Wavefront Object";
 }
 const char* getCommandTitleList(){
        return "";
 }
 
 void dispatch( const char* command, float* vMin, float* vMax, bool bSingleBrush ){
-       if ( string_equal( command, "About" ) ) {
-               GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_mainwnd ), "Brushexport plugin v 2.0 by namespace (www.codecreator.net)\n"
-                                                                                                                                 "Enjoy!\n\nSend feedback to spam@codecreator.net", "About me...",
-                                                                                eMB_OK,
-                                                                                eMB_ICONDEFAULT );
+       if ( string_equal( command, CMD_ABOUT ) ) {
+               const char *label_text =
+                       PLUGIN_NAME " " PLUGIN_VERSION " for "
+                       RADIANT_NAME " " RADIANT_VERSION "\n\n"
+                       "Written by namespace <spam@codecreator.net>\n\n"
+//                     20200404 dead link
+//                     "http://www.codecreator.net"
+                       "Built against "
+                       RADIANT_NAME " " RADIANT_VERSION_STRING "\n"
+                       __DATE__;
+
+               GlobalRadiant().m_pfnMessageBox( g_mainwnd, label_text,
+                                                                               "About " PLUGIN_NAME,
+                                                                               eMB_OK,
+                                                                               eMB_ICONDEFAULT );
        }
        else if ( string_equal( command, "Export selected as Wavefront Object" ) ) {
                if ( IsWindowOpen() ) {
                        DestroyWindow();
                }
-               CreateWindow();
+               CreateWindow( g_mainwnd );
        }
 }
 }
@@ -102,7 +116,7 @@ class BrushExportModule : public TypeSystemRef
 _QERPluginTable m_plugin;
 public:
 typedef _QERPluginTable Type;
-STRING_CONSTANT( Name, "brushexport2" );
+STRING_CONSTANT( Name, PLUGIN_NAME );
 
 BrushExportModule(){
        m_plugin.m_pfnQERPlug_Init = &BrushExport::init;