From cc755135469ecdcf10701d8426c9ac412fa9a438 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Fri, 31 Mar 2017 13:56:34 +0200 Subject: [PATCH] Main app window for surface plugins --- plugins/surface/surfacedialog.cpp | 3 +++ plugins/surface/surfdlg_plugin.cpp | 10 ++++++++++ plugins/surface_idtech2/surfacedialog.cpp | 3 +++ plugins/surface_idtech2/surfdlg_plugin.cpp | 10 ++++++++++ 4 files changed, 26 insertions(+) diff --git a/plugins/surface/surfacedialog.cpp b/plugins/surface/surfacedialog.cpp index bd55b465..60aae252 100644 --- a/plugins/surface/surfacedialog.cpp +++ b/plugins/surface/surfacedialog.cpp @@ -102,6 +102,8 @@ bool g_bListenChanged = true; // turn on/off listening of the update messages bool g_bListenUpdate = true; +extern void *g_pMainWidget; + GtkWidget* create_SurfaceInspector( void ); GtkWidget *SurfaceInspector = NULL; @@ -644,6 +646,7 @@ GtkWidget* create_SurfaceInspector( void ){ GtkSizeGroup *size_group; SurfaceInspector = gtk_window_new( GTK_WINDOW_TOPLEVEL ); + gtk_window_set_transient_for( GTK_WINDOW( SurfaceInspector ), GTK_WINDOW( g_pMainWidget ) ); gtk_container_set_border_width( GTK_CONTAINER( SurfaceInspector ), 4 ); gtk_window_set_title( GTK_WINDOW( SurfaceInspector ), _( "Surface Inspector" ) ); diff --git a/plugins/surface/surfdlg_plugin.cpp b/plugins/surface/surfdlg_plugin.cpp index dcf860f1..d2d75093 100644 --- a/plugins/surface/surfdlg_plugin.cpp +++ b/plugins/surface/surfdlg_plugin.cpp @@ -34,6 +34,9 @@ #include "synapse.h" +void *g_pMainWidget; +const char* QERPlug_Init( void* hApp, void *pWidget ); + class CSynapseClient_SurfDLG : public CSynapseClient { public: @@ -118,3 +121,10 @@ const char* CSynapseClient_SurfDLG::GetName(){ bool CSynapseClient_SurfDLG::OnActivate(){ return true; } + +const char* QERPlug_Init( void* hApp, void *pWidget ){ + + g_pMainWidget = pWidget; + + return "Quake3 Surface Dialog for Radiant"; +} diff --git a/plugins/surface_idtech2/surfacedialog.cpp b/plugins/surface_idtech2/surfacedialog.cpp index e82e95aa..59dfc2dd 100644 --- a/plugins/surface_idtech2/surfacedialog.cpp +++ b/plugins/surface_idtech2/surfacedialog.cpp @@ -80,6 +80,8 @@ bool g_bListenChanged = TRUE; // turn on/off listening of the update messages bool g_bListenUpdate = TRUE; +extern void *g_pMainWidget; + GtkWidget* create_SurfaceInspector( void ); GtkWidget *SurfaceInspector = NULL; @@ -551,6 +553,7 @@ GtkWidget* create_SurfaceInspector( void ){ GtkWidget *hbox1; SurfaceInspector = gtk_window_new( GTK_WINDOW_TOPLEVEL ); + gtk_window_set_transient_for( GTK_WINDOW( SurfaceInspector ), GTK_WINDOW( g_pMainWidget ) ); gtk_container_set_border_width( GTK_CONTAINER( SurfaceInspector ), 4 ); gtk_window_set_title( GTK_WINDOW( SurfaceInspector ), _( "Surface Inspector" ) ); diff --git a/plugins/surface_idtech2/surfdlg_plugin.cpp b/plugins/surface_idtech2/surfdlg_plugin.cpp index 241ccc8a..9ab74f92 100644 --- a/plugins/surface_idtech2/surfdlg_plugin.cpp +++ b/plugins/surface_idtech2/surfdlg_plugin.cpp @@ -34,6 +34,9 @@ #include "synapse.h" +void *g_pMainWidget; +const char* QERPlug_Init( void* hApp, void *pWidget ); + _QERFuncTable_1 g_FuncTable; _QERUndoTable g_UndoTable; _QERAppSurfaceTable g_AppSurfaceTable; @@ -107,3 +110,10 @@ bool CSynapseClient_SurfDLG::RequestAPI( APIDescriptor_t *pAPI ) { const char *CSynapseClient_SurfDLG::GetInfo(){ return "Surface Dialog (idTech2) module built " __DATE__ " " RADIANT_VERSION; } + +const char* QERPlug_Init( void* hApp, void *pWidget ){ + + g_pMainWidget = pWidget; + + return "idTech2 Surface Dialog for Radiant"; +}