static const char* PLUGIN_COMMANDS = "About...,-,Reset Textures...,PitOMatic,-,Vis Viewer,Brush Cleanup,Polygon Builder,Caulk Selection,-,Tree Planter,Drop Entity,Plot Splines,-,Merge Patches,Split patches,Split patches cols,Split patches rows,Turn edge";
// globals
-ui::Window g_pRadiantWnd{ui::null};
+static ui::Window g_pRadiantWnd{ui::null};
extern "C" const char* QERPlug_Init( void* hApp, void* pMainWidget ) {
g_pRadiantWnd = ui::Window::from(pMainWidget);
DoFlipTerrain();
}
else if ( string_equal_nocase( p, "reset textures..." ) ) {
- DoResetTextures();
+ DoResetTextures( main_window );
}
else if ( string_equal_nocase( p, "pitomatic" ) ) {
DoPitBuilder();
DoMakeChain();
}
else if ( string_equal_nocase( p, "path plotter..." ) ) {
- DoPathPlotter();
+ DoPathPlotter( main_window );
}
else if ( string_equal_nocase( p, "about..." ) ) {
static const char *label_text =
#include <list>
#include <gtk/gtk.h>
#include "gtkutil/pointer.h"
+#include "gtkutil/dialog.h"
#include "../lists.h"
#include "../misc.h"
*ret = (EMessageBoxReturn)gpointer_to_int( data );
}
-static gint dialog_delete_callback( ui::Widget widget, GdkEvent* event, gpointer data ){
+static gint custom_dialog_delete_callback( ui::Widget widget, GdkEvent* event, gpointer data ){
widget.hide();
int *loop = (int *) g_object_get_data(G_OBJECT(widget), "loop");
*loop = 0;
int loop = 1;
auto window = ui::Window( ui::window_type::TOP );
- window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+ window.connect( "delete_event", G_CALLBACK( custom_dialog_delete_callback ), NULL );
window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( window, lpCaption );
gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
auto window = ui::Window( ui::window_type::TOP );
- window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+ window.connect( "delete_event", G_CALLBACK( custom_dialog_delete_callback ), NULL );
window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( window, "Intersect" );
auto window = ui::Window( ui::window_type::TOP );
- window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+ window.connect( "delete_event", G_CALLBACK( custom_dialog_delete_callback ), NULL );
window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( window, "Polygon Builder" );
auto window = ui::Window( ui::window_type::TOP );
- window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+ window.connect( "delete_event", G_CALLBACK( custom_dialog_delete_callback ), NULL );
window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( window, "Stair Builder" );
auto window = ui::Window( ui::window_type::TOP );
- window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+ window.connect( "delete_event", G_CALLBACK( custom_dialog_delete_callback ), NULL );
window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( window, "Door Builder" );
//-djbob
}
-EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){
+EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs, ui::Window main_window ){
ui::Widget w{ui::null};
+ ModalDialog dialog;
EMessageBoxReturn ret;
int loop = 1;
- auto window = ui::Window( ui::window_type::TOP );
+ auto window = main_window.create_dialog_window( "Path Plotter", G_CALLBACK( custom_dialog_delete_callback ), &dialog );
- window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
- gtk_window_set_title( window, "Texture Reset" );
gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
auto window = ui::Window( ui::window_type::TOP );
- window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+ window.connect( "delete_event", G_CALLBACK( custom_dialog_delete_callback ), NULL );
window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( window, "CTF Colour Changer" );
return ret;
}
-EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){
+EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs, ui::Window main_window ){
Str texSelected;
ui::Widget w{ui::null};
+ ModalDialog dialog;
EMessageBoxReturn ret;
int loop = 1;
- auto window = ui::Window( ui::window_type::TOP );
+ auto window = main_window.create_dialog_window( "Texture Reset", G_CALLBACK( custom_dialog_delete_callback ), &dialog );
- window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
- gtk_window_set_title( window, "Texture Reset" );
gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
// ---- /vbox ----
- gtk_window_set_position( window, GTK_WIN_POS_CENTER );
window.show();
gtk_grab_add( window );
auto window = ui::Window( ui::window_type::TOP );
- window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+ window.connect( "delete_event", G_CALLBACK( custom_dialog_delete_callback ), NULL );
window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( window, "Train Thing" );
auto window = ui::Window( ui::window_type::TOP );
- window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+ window.connect( "delete_event", G_CALLBACK( custom_dialog_delete_callback ), NULL );
window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( window, "Make Chain" );