]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
contrib/brushexport: center export window on main window
authorThomas Debesse <dev@illwieckz.net>
Sat, 4 Apr 2020 04:41:46 +0000 (06:41 +0200)
committerThomas Debesse <dev@illwieckz.net>
Sat, 4 Apr 2020 07:54:55 +0000 (09:54 +0200)
contrib/brushexport/interface.cpp
contrib/brushexport/plugin.cpp

index d464a02a810e96c89520c0ad2276b8252be99c42..068325ea2bbf88b6a56d00026bfaa5806e162822 100644 (file)
@@ -4,6 +4,7 @@
 #include "debugging/debugging.h"
 #include "callbacks.h"
 #include "support.h"
+#include "gtkutil/dialog.h"
 
 #define GLADE_HOOKUP_OBJECT( component,widget,name ) \
        g_object_set_data_full( G_OBJECT( component ), name, \
        g_object_set_data( G_OBJECT( component ), name, (void *) widget )
 
 // created by glade
-ui::Widget create_w_plugplug2( void ){
+ui::Widget create_w_plugplug2( ui::Window main_window ){
        GSList *r_collapse_group = NULL;
+       ModalDialog dialog;
 
-       auto w_plugplug2 = ui::Window( ui::window_type::TOP );
+       auto w_plugplug2 = main_window.create_dialog_window( "BrushExport", G_CALLBACK( dialog_delete_callback ), &dialog );
        gtk_widget_set_name( w_plugplug2, "w_plugplug2" );
-       gtk_window_set_title( w_plugplug2, "BrushExport-Plugin 3.0 by namespace" );
-       gtk_window_set_position( w_plugplug2, GTK_WIN_POS_CENTER );
        gtk_window_set_destroy_with_parent( w_plugplug2, TRUE );
 
        auto vbox1 = ui::VBox( FALSE, 0 );
@@ -180,10 +180,10 @@ ui::Widget create_w_plugplug2( void ){
 ui::Widget g_brushexp_window{ui::null};
 
 // spawn plugin window (and make sure it got destroyed first or never created)
-void CreateWindow( void ){
+void CreateWindow( ui::Window main_window ){
        ASSERT_TRUE( !g_brushexp_window );
 
-       ui::Widget wnd = create_w_plugplug2();
+       ui::Widget wnd = create_w_plugplug2( main_window );
 
        // column & renderer
     auto col = ui::TreeViewColumn::from(gtk_tree_view_column_new());
index da30d3394b98a67c5c15fb95656f30c557d1c789..3e7c10f1e39d2bc5634147cb0a2d78c8255fe497 100644 (file)
@@ -45,7 +45,7 @@
 
 #define CMD_ABOUT "About..."
 
-void CreateWindow( void );
+void CreateWindow( ui::Window main_window );
 void DestroyWindow( void );
 bool IsWindowOpen( void );
 
@@ -87,7 +87,7 @@ void dispatch( const char* command, float* vMin, float* vMax, bool bSingleBrush
                if ( IsWindowOpen() ) {
                        DestroyWindow();
                }
-               CreateWindow();
+               CreateWindow( g_mainwnd );
        }
 }
 }