Add plugin parent widget

This commit is contained in:
Pan7 2017-04-04 22:54:03 +02:00
parent 16453c6ac2
commit c34edd31b9
3 changed files with 12 additions and 3 deletions

View file

@ -339,11 +339,14 @@ const char *PLUGIN_COMMANDS = "About...;Create/Update WAD keypair";
const char *PLUGIN_ABOUT = "HydraToolz v1.0 for GTKRadiant\n\n" const char *PLUGIN_ABOUT = "HydraToolz v1.0 for GTKRadiant\n\n"
"By Hydra!"; "By Hydra!";
void *g_pMainWidget = NULL;
extern "C" void* WINAPI QERPlug_GetFuncTable(){ extern "C" void* WINAPI QERPlug_GetFuncTable(){
return &g_FuncTable; return &g_FuncTable;
} }
const char* QERPlug_Init( void* hApp, void *pWidget ){ const char* QERPlug_Init( void* hApp, void *pWidget ){
g_pMainWidget = pWidget;
return "HydraToolz for GTKRadiant"; // do we need this ? hmmm return "HydraToolz for GTKRadiant"; // do we need this ? hmmm
} }
@ -360,7 +363,7 @@ extern "C" void QERPlug_Dispatch( const char* p, vec3_t vMin, vec3_t vMax, bool
UpdateWadKeyPair(); UpdateWadKeyPair();
} }
else if ( !strcmp( p, "About..." ) ) { else if ( !strcmp( p, "About..." ) ) {
g_FuncTable.m_pfnMessageBox( NULL, PLUGIN_ABOUT, "About", MB_OK, NULL ); g_FuncTable.m_pfnMessageBox( g_pMainWidget, PLUGIN_ABOUT, "About", MB_OK, NULL );
} }
} }

View file

@ -155,7 +155,10 @@ static const char *PLUGIN_NAME = "Model loading module";
static const char *PLUGIN_COMMANDS = "About;-;Flush & Reload Models;Flush & Reload Selected"; static const char *PLUGIN_COMMANDS = "About;-;Flush & Reload Models;Flush & Reload Selected";
static const char *PLUGIN_ABOUT = "Model Module v1.0 for GtkRadiant\nby Arnout van Meer (rr2do2@splashdamage.com)\n\nBased on the MD3Model Module by SPoG\nPicoModel Library Copyright (c) 2002, Randy Reddig & seaw0lf\n\nSupported models:\n"; static const char *PLUGIN_ABOUT = "Model Module v1.0 for GtkRadiant\nby Arnout van Meer (rr2do2@splashdamage.com)\n\nBased on the MD3Model Module by SPoG\nPicoModel Library Copyright (c) 2002, Randy Reddig & seaw0lf\n\nSupported models:\n";
void *g_pMainWidget = NULL;
extern "C" const char* QERPlug_Init( void *hApp, void* pMainWidget ){ extern "C" const char* QERPlug_Init( void *hApp, void* pMainWidget ){
g_pMainWidget = pMainWidget;
init_filetypes(); init_filetypes();
return (char *) PLUGIN_NAME; return (char *) PLUGIN_NAME;
} }
@ -188,7 +191,7 @@ extern "C" void QERPlug_Dispatch( const char *p, vec3_t vMin, vec3_t vMax, bool
strncat( about_buf, module->copyright, sizeof( about_buf ) - 1 ); strncat( about_buf, module->copyright, sizeof( about_buf ) - 1 );
strncat( about_buf, "\n", sizeof( about_buf ) - 1 ); strncat( about_buf, "\n", sizeof( about_buf ) - 1 );
} }
g_FuncTable.m_pfnMessageBox( NULL, about_buf, "About", MB_OK, NULL ); g_FuncTable.m_pfnMessageBox( g_pMainWidget, about_buf, "About", MB_OK, NULL );
} }
} }

View file

@ -155,6 +155,8 @@ static const char *PLUGIN_ABOUT = "Sprite Model loading module v0.2 for GTKRadia
const char *supportedmodelformats[] = {"spr","bmp","tga","jpg","hlw",NULL}; // NULL is list delimiter const char *supportedmodelformats[] = {"spr","bmp","tga","jpg","hlw",NULL}; // NULL is list delimiter
void *g_pMainWidget = NULL;
static void add_model_apis( CSynapseClient& client ){ static void add_model_apis( CSynapseClient& client ){
const char **ext; const char **ext;
for ( ext = supportedmodelformats; *ext != NULL; ext++ ) for ( ext = supportedmodelformats; *ext != NULL; ext++ )
@ -183,6 +185,7 @@ void init_filetypes(){
} }
extern "C" const char* QERPlug_Init( void *hApp, void* pMainWidget ){ extern "C" const char* QERPlug_Init( void *hApp, void* pMainWidget ){
g_pMainWidget = pMainWidget;
init_filetypes(); // see todo list above. init_filetypes(); // see todo list above.
return (char *) PLUGIN_NAME; return (char *) PLUGIN_NAME;
} }
@ -198,7 +201,7 @@ extern "C" const char* QERPlug_GetCommandList(){
extern "C" void QERPlug_Dispatch( const char *p, vec3_t vMin, vec3_t vMax, bool bSingleBrush ){ extern "C" void QERPlug_Dispatch( const char *p, vec3_t vMin, vec3_t vMax, bool bSingleBrush ){
// NOTE: this never happens in a module // NOTE: this never happens in a module
if ( !strcmp( p, "About..." ) ) { if ( !strcmp( p, "About..." ) ) {
g_FuncTable.m_pfnMessageBox( NULL, PLUGIN_ABOUT, "About", MB_OK, NULL ); g_FuncTable.m_pfnMessageBox( g_pMainWidget, PLUGIN_ABOUT, "About", MB_OK, NULL );
} }
} }