]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - contrib/shaderplug/shaderplug.cpp
radiant/tools: use RADIANT_NAME instead of hardcoding NetRadiant or Radiant
[xonotic/netradiant.git] / contrib / shaderplug / shaderplug.cpp
index 62e9abe6aa1df261f9bc64515f7783d31690bb05..b71efcb39305ba0f3d9022a3d0538cac13285fc3 100644 (file)
@@ -57,7 +57,7 @@ ShaderPlugPluginDependencies() :
 
 namespace Shaderplug
 {
-GtkWindow* g_window;
+ui::Window g_window{ui::null};
 
 std::vector<const char*> archives;
 std::set<std::string> shaders;
@@ -67,7 +67,7 @@ XmlTagBuilder TagBuilder;
 void CreateTagFile();
 
 const char* init( void* hApp, void* pMainWidget ){
-       g_window = GTK_WINDOW( pMainWidget );
+       g_window = ui::Window::from(pMainWidget);
        return "";
 }
 const char* getName(){
@@ -81,7 +81,7 @@ const char* getCommandTitleList(){
 }
 void dispatch( const char* command, float* vMin, float* vMax, bool bSingleBrush ){
        if ( string_equal( command, "About" ) ) {
-               GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_window ), "Shaderplug (1.0)\n\n"
+               GlobalRadiant().m_pfnMessageBox( g_window, "Shaderplug (1.0)\n\n"
                                                                                                                                 "by Shaderman (shaderman@gmx.net)",
                                                                                 "About",
                                                                                 eMB_OK,
@@ -96,8 +96,6 @@ void loadArchiveFile( const char* filename ){
        archives.push_back( filename );
 }
 
-typedef FreeCaller1<const char*, loadArchiveFile> LoadArchiveFileCaller;
-
 void LoadTextureFile( const char* filename ){
        std::string s_filename = filename;
 
@@ -116,10 +114,8 @@ void LoadTextureFile( const char* filename ){
        }
 }
 
-typedef FreeCaller1<const char*, LoadTextureFile> LoadTextureFileCaller;
-
-void GetTextures( char* extension ){
-       GlobalFileSystem().forEachFile( "textures/", extension, LoadTextureFileCaller(), 0 );
+void GetTextures( const char* extension ){
+       GlobalFileSystem().forEachFile("textures/", extension, makeCallbackF(LoadTextureFile), 0);
 }
 
 void LoadShaderList( const char* filename ){
@@ -128,14 +124,12 @@ void LoadShaderList( const char* filename ){
        }
 }
 
-typedef FreeCaller1<const char*, LoadShaderList> LoadShaderListCaller;
-
 void GetAllShaders(){
-       GlobalShaderSystem().foreachShaderName( LoadShaderListCaller() );
+       GlobalShaderSystem().foreachShaderName(makeCallbackF(LoadShaderList));
 }
 
 void GetArchiveList(){
-       GlobalFileSystem().forEachArchive( LoadArchiveFileCaller() );
+       GlobalFileSystem().forEachArchive(makeCallbackF(loadArchiveFile));
        globalOutputStream() << "Shaderplug: " << (const Unsigned)Shaderplug::archives.size() << " archives found.\n";
 }
 
@@ -178,26 +172,26 @@ void CreateTagFile(){
                char message[256];
                strcpy( message, "Tag file saved to\n" );
                strcat( message, tagFile );
-               strcat( message, "\nPlease restart Radiant now.\n" );
+               strcat( message, "\nPlease restart " RADIANT_NAME " now.\n" );
 
                if ( file_exists( tagFile ) ) {
-                       EMessageBoxReturn result = GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_window ),
+                       EMessageBoxReturn result = GlobalRadiant().m_pfnMessageBox( g_window ,
                                                                                                                                                "WARNING! A tag file already exists! Overwrite it?", "Overwrite tag file?",
                                                                                                                                                eMB_NOYES,
                                                                                                                                                eMB_ICONWARNING );
 
                        if ( result == eIDYES ) {
                                TagBuilder.SaveXmlDoc( tagFile );
-                               GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_window ), message, "INFO", eMB_OK, eMB_ICONASTERISK );
+                               GlobalRadiant().m_pfnMessageBox( g_window, message, "INFO", eMB_OK, eMB_ICONASTERISK );
                        }
                }
                else {
                        TagBuilder.SaveXmlDoc( tagFile );
-                       GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_window ), message, "INFO", eMB_OK, eMB_ICONASTERISK );
+                       GlobalRadiant().m_pfnMessageBox( g_window, message, "INFO", eMB_OK, eMB_ICONASTERISK );
                }
        }
        else {
-               GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_window ),
+               GlobalRadiant().m_pfnMessageBox( g_window,
                                                                                 "No shaders or textures found. No XML tag file created!\n"
                                                                                 "",
                                                                                 "ERROR",