#include <stdio.h>
#include <gtk/gtk.h>
#include <uilib/uilib.h>
+#include "gtkutil/dialog.h"
#include "gtkutil/pointer.h"
#include "iscenegraph.h"
#include "prtview.h"
#include "portals.h"
+ui::Window config_dialog{ui::null};
+
static void dialog_button_callback( ui::Widget widget, gpointer data ){
int *loop, *ret;
*ret = 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;
clr.green = (guint16) (GetBValue(*c) * (65535 / 255));
auto dlg = ui::Widget::from(gtk_color_selection_dialog_new( "Choose Color" ));
+ gtk_window_set_transient_for( GTK_WINDOW( dlg ), config_dialog );
gtk_color_selection_set_current_color( GTK_COLOR_SELECTION( gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(dlg)) ), &clr );
dlg.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
dlg.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
SceneChangeNotify();
}
-void DoConfigDialog(){
+void DoConfigDialog( ui::Window main_window ){
int loop = 1, ret = IDCANCEL;
+ ModalDialog dialog;
- auto dlg = ui::Window( ui::window_type::TOP );
- gtk_window_set_title( dlg, "Portal Viewer Configuration" );
- dlg.connect( "delete_event",
- G_CALLBACK( dialog_delete_callback ), NULL );
- dlg.connect( "destroy",
- G_CALLBACK( gtk_widget_destroy ), NULL );
+ auto dlg = main_window.create_dialog_window( "Portal Viewer Configuration", G_CALLBACK( custom_dialog_delete_callback ), &dialog );
+
+ dlg.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
g_object_set_data( G_OBJECT( dlg ), "loop", &loop );
g_object_set_data( G_OBJECT( dlg ), "ret", &ret );
+ config_dialog = dlg;
auto vbox = ui::VBox( FALSE, 5 );
vbox.show();
const char *CLIP_RANGE = "ClipRange";
const char *CLIP = "Clip";
-ui::Window main_window{ui::null};
+static ui::Window main_window{ui::null};
void PrtView_construct(){
StringOutputStream tmp( 64 );
}
}
else if ( !strcmp( p,Q3R_CMD_OPTIONS ) ) {
- DoConfigDialog();
+ DoConfigDialog( main_window );
SaveConfig();
SceneChangeNotify();