]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - contrib/ufoaiplug/ufoai.cpp
Merge branch 'max' into 'master'
[xonotic/netradiant.git] / contrib / ufoaiplug / ufoai.cpp
index bb11866430e1068f9012759f8703c4aa1eefd881..33b6d3be9be9b74ed5588d9afad99a7d548d1e11 100644 (file)
 
 #include "iplugin.h"
 
-#include "version.h"
-
 #include "string/string.h"
 #include "modulesystem/singletonmodule.h"
 
 #include <gtk/gtk.h>
 
-#define PLUGIN_VERSION "0.4"
-
 #include "ifilter.h"
 #include "ibrush.h"
 #include "iundo.h"       // declaration of undo system
@@ -43,6 +39,8 @@
 #include "qerplugin.h"   // declaration to use other interfaces as a plugin
 #include "ieclass.h"
 
+#define CMD_ABOUT "About..."
+
 class UFOAIPluginDependencies :
        public GlobalRadiantModuleRef,  // basic class for all other module refs
        public GlobalUndoModuleRef,     // used to say radiant that something has changed and to undo that
@@ -59,27 +57,36 @@ UFOAIPluginDependencies( void ) :
 
 namespace UFOAI
 {
-GtkWindow* g_mainwnd;
+       ui::Window g_mainwnd{ui::null};
 
 const char* init( void* hApp, void* pMainWidget ){
-       g_mainwnd = GTK_WINDOW( pMainWidget );
+       g_mainwnd = ui::Window::from(pMainWidget);
        return "Initializing GTKRadiant UFOAI plugin";
 }
 const char* getName(){
-       return "UFO:AI";
+       return PLUGIN_NAME;
 }
 const char* getCommandList(){
        /*GlobalRadiant().getGameName()*/
-       return "About;-;Worldspawn reset;Worldspawn;Perform check;-;Level 1;Level 2;Level 3;Level 4;Level 5;Level 6;Level 7;Level 8;-;StepOn;ActorClip;WeaponClip;Nodraw";
+       return CMD_ABOUT ";-;Worldspawn reset;Worldspawn;Perform check;-;Level 1;Level 2;Level 3;Level 4;Level 5;Level 6;Level 7;Level 8;-;StepOn;ActorClip;WeaponClip;Nodraw";
 }
 const char* getCommandTitleList(){
        return "";
 }
 void dispatch( const char* command, float* vMin, float* vMax, bool bSingleBrush ){
-       char *message = NULL;
-       if ( string_equal( command, "About" ) ) {
-               GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_mainwnd ),
-                                                                                "UFO:AI Plugin (http://ufoai.sf.net)\nBuild: " __DATE__ "\nRadiant version: " RADIANT_VERSION "\nPlugin version: " PLUGIN_VERSION "\nAuthor: Martin Gerhardy (tlh2000/mattn)\n", "About",
+       char const *message = NULL;
+       if ( string_equal( command, CMD_ABOUT ) ) {
+               const char *label_text = 
+                       PLUGIN_NAME " " PLUGIN_VERSION " for "
+                       RADIANT_NAME " " RADIANT_VERSION "\n\n"
+                       "Written by Martin Gerhardy (tlh2000/mattn)\n"
+                       "for the UFO:AI project (http://ufoai.org)\n\n"
+                       "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, "Level 1" ) ) {
@@ -129,7 +136,7 @@ void dispatch( const char* command, float* vMin, float* vMax, bool bSingleBrush
        }
 
        if ( message != NULL ) {
-               GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_mainwnd ),
+               GlobalRadiant().m_pfnMessageBox( g_mainwnd,
                                                                                 message, "Note",
                                                                                 eMB_OK, eMB_ICONDEFAULT );
        }