-DGTK_DISABLE_SINGLE_INCLUDES
-DGSEAL_ENABLE
-DGDK_DISABLE_DEPRECATED
- #-DGTK_DISABLE_DEPRECATED
+ -DGTK_DISABLE_DEPRECATED
)
if(NOT WIN32)
#include "dialogs-gtk.h"
#include "../funchandlers.h"
-#include <cstdlib>
#include "str.h"
-#include <list>
-#include <gtk/gtk.h>
#include "gtkutil/pointer.h"
#include "../lists.h"
GtkEntry* entry = GTK_ENTRY( tw->one );
auto* combo = tw->two;
- const gchar* tex = gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo));
+ const gchar *tex = gtk_entry_get_text(GTK_ENTRY (gtk_bin_get_child(GTK_BIN(combo))));
gtk_entry_set_text( entry, tex );
}
g_signal_connect( GTK_OBJECT( window ), "destroy",
G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( GTK_WINDOW( window ), lpCaption );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret );
gtk_widget_realize( window );
g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( GTK_WINDOW( window ), "Intersect" );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret );
g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( GTK_WINDOW( window ), "Polygon Builder" );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret );
gtk_window_set_title( GTK_WINDOW( window ), "Stair Builder" );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret );
gtk_window_set_title( GTK_WINDOW( window ), "Door Builder" );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret );
g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( GTK_WINDOW( window ), "Texture Reset" );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret );
g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( GTK_WINDOW( window ), "CTF Colour Changer" );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret );
g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( GTK_WINDOW( window ), "Texture Reset" );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret );
g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( GTK_WINDOW( window ), "Train Thing" );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
- gtk_object_set_data( GTK_OBJECT( window ), "loop", &loop );
- gtk_object_set_data( GTK_OBJECT( window ), "ret", &ret );
+ g_object_set_data( G_OBJECT( window ), "loop", &loop );
+ g_object_set_data( G_OBJECT( window ), "ret", &ret );
gtk_widget_realize( window );
gtk_window_set_title( GTK_WINDOW( window ), "Make Chain" );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret );
GtkWidget *t_exportmaterials;
GtkWidget *t_limitmatnames;
GtkWidget *t_objects;
- GtkTooltips *tooltips;
-
- tooltips = gtk_tooltips_new();
w_plugplug2 = ui::Window( ui::window_type::TOP );
gtk_widget_set_name( w_plugplug2, "w_plugplug2" );
r_collapse = gtk_radio_button_new_with_mnemonic( NULL, "Collapse mesh" );
gtk_widget_set_name( r_collapse, "r_collapse" );
- gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), r_collapse, "Collapse all brushes into a single group", "Collapse all brushes into a single group" );
+ gtk_widget_set_tooltip_text(r_collapse, "Collapse all brushes into a single group");
gtk_widget_show( r_collapse );
gtk_box_pack_start( GTK_BOX( vbox4 ), r_collapse, FALSE, FALSE, 0 );
gtk_radio_button_set_group( GTK_RADIO_BUTTON( r_collapse ), r_collapse_group );
r_collapsebymaterial = gtk_radio_button_new_with_mnemonic( NULL, "Collapse by material" );
gtk_widget_set_name( r_collapsebymaterial, "r_collapsebymaterial" );
- gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), r_collapsebymaterial, "Collapse into groups by material", "Collapse into groups by material" );
+ gtk_widget_set_tooltip_text(r_collapsebymaterial, "Collapse into groups by material");
gtk_widget_show( r_collapsebymaterial );
gtk_box_pack_start( GTK_BOX( vbox4 ), r_collapsebymaterial, FALSE, FALSE, 0 );
gtk_radio_button_set_group( GTK_RADIO_BUTTON( r_collapsebymaterial ), r_collapse_group );
r_nocollapse = gtk_radio_button_new_with_mnemonic( NULL, "Don't collapse" );
gtk_widget_set_name( r_nocollapse, "r_nocollapse" );
- gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), r_nocollapse, "Every brush is stored in its own group", "Every brush is stored in its own group" );
+ gtk_widget_set_tooltip_text(r_nocollapse, "Every brush is stored in its own group");
gtk_widget_show( r_nocollapse );
gtk_box_pack_start( GTK_BOX( vbox4 ), r_nocollapse, FALSE, FALSE, 0 );
gtk_radio_button_set_group( GTK_RADIO_BUTTON( r_nocollapse ), r_collapse_group );
g_signal_connect( GTK_OBJECT( window ), "destroy",
G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( GTK_WINDOW( window ), lpCaption );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
gtk_object_set_data( GTK_OBJECT( window ), "loop", &loop );
gtk_object_set_data( GTK_OBJECT( window ), "ret", &ret );
gtk_widget_realize( window );
static int DoColor( PackedColour *c ){
GtkWidget* dlg;
- double clr[4];
+ GdkColor clr;
int loop = 1, ret = IDCANCEL;
- clr[0] = ( (double)GetRValue( *c ) ) / 255.0;
- clr[1] = ( (double)GetGValue( *c ) ) / 255.0;
- clr[2] = ( (double)GetBValue( *c ) ) / 255.0;
+ clr.red = (guint16) (GetRValue(*c) * (65535 / 255));
+ clr.blue = (guint16) (GetGValue(*c) * (65535 / 255));
+ clr.green = (guint16) (GetBValue(*c) * (65535 / 255));
dlg = gtk_color_selection_dialog_new( "Choose Color" );
- gtk_color_selection_set_color( GTK_COLOR_SELECTION( gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(dlg)) ), clr );
+ gtk_color_selection_set_current_color( GTK_COLOR_SELECTION( gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(dlg)) ), &clr );
g_signal_connect( GTK_OBJECT( dlg ), "delete_event",
G_CALLBACK( dialog_delete_callback ), NULL );
g_signal_connect( GTK_OBJECT( dlg ), "destroy",
while ( loop )
gtk_main_iteration();
- gtk_color_selection_get_color( GTK_COLOR_SELECTION( gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(dlg)) ), clr );
+ gtk_color_selection_get_current_color( GTK_COLOR_SELECTION( gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(dlg)) ), &clr );
gtk_grab_remove( dlg );
gtk_widget_destroy( dlg );
if ( ret == IDOK ) {
- *c = RGB( clr[0] * 255, clr[1] * 255, clr[2] * 255 );
+ *c = RGB( clr.red / (65535 / 255), clr.green / (65535 / 255), clr.blue / (65535 / 255));
}
return ret;
void DoConfigDialog(){
GtkWidget *dlg, *hbox, *vbox, *vbox2, *button, *table, *frame;
- GtkWidget *lw3slider, *lw3label, *lw2slider, *lw2label, *zlist, *menu, *item;
+ GtkWidget *lw3slider, *lw3label, *lw2slider, *lw2label, *item;
GtkWidget *aa2check, *aa3check, *depthcheck, *linescheck, *polyscheck;
GtkWidget *transslider, *translabel, *clipslider, *cliplabel;
GtkWidget *show2check, *show3check, *portalcheck;
(GtkAttachOptions) ( 0 ), 0, 0 );
g_signal_connect( GTK_OBJECT( polyscheck ), "toggled", G_CALLBACK( OnPoly ), NULL );
- zlist = gtk_option_menu_new();
+ auto zlist = ui::ComboBoxText();
gtk_widget_show( zlist );
gtk_box_pack_start( GTK_BOX( vbox2 ), zlist, TRUE, FALSE, 0 );
- menu = ui::Menu();
- gtk_widget_show( menu );
- gtk_option_menu_set_menu( GTK_OPTION_MENU( zlist ), menu );
+ gtk_combo_box_text_append_text(zlist, "Z-Buffer Test and Write (recommended for solid or no polygons)");
+ gtk_combo_box_text_append_text(zlist, "Z-Buffer Test Only (recommended for transparent polygons)");
+ gtk_combo_box_text_append_text(zlist, "Z-Buffer Off");
- item = ui::MenuItem( "Z-Buffer Test and Write (recommended for solid or no polygons)" );
- gtk_widget_show( item );
- g_signal_connect( GTK_OBJECT( item ), "activate",
- G_CALLBACK( OnSelchangeZbuffer ), GINT_TO_POINTER( 0 ) );
- gtk_menu_append( GTK_MENU( menu ), item );
-
- item = ui::MenuItem( "Z-Buffer Test Only (recommended for transparent polygons)" );
- gtk_widget_show( item );
- g_signal_connect( GTK_OBJECT( item ), "activate",
- G_CALLBACK( OnSelchangeZbuffer ), GINT_TO_POINTER( 1 ) );
- gtk_menu_append( GTK_MENU( menu ), item );
-
- item = ui::MenuItem( "Z-Buffer Off" );
- gtk_widget_show( item );
- g_signal_connect( GTK_OBJECT( item ), "activate",
- G_CALLBACK( OnSelchangeZbuffer ), GINT_TO_POINTER( 2 ) );
- gtk_menu_append( GTK_MENU( menu ), item );
+ g_signal_connect(G_OBJECT(zlist), "changed", G_CALLBACK(+[](GtkComboBox *self, void *) {
+ OnSelchangeZbuffer(GTK_WIDGET(self), GINT_TO_POINTER(gtk_combo_box_get_active(self)));
+ }), nullptr);
table = ui::Table( 2, 2, FALSE );
gtk_widget_show( table );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( polyscheck ), portals.polygons );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( linescheck ), portals.lines );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( aa3check ), portals.aa_3d );
- gtk_option_menu_set_history( GTK_OPTION_MENU( zlist ), portals.zbuffer );
+ gtk_combo_box_set_active(zlist, portals.zbuffer);
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( portalcheck ), portals.clip );
Set3DText( lw3label );
return TRUE;
}
-static void file_sel_callback( GtkWidget *widget, gpointer data ){
- GtkWidget *parent;
- int *loop;
- char **filename;
-
- parent = gtk_widget_get_toplevel( widget );
- loop = (int*)g_object_get_data( G_OBJECT( parent ), "loop" );
- filename = (char**)g_object_get_data( G_OBJECT( parent ), "filename" );
-
- *loop = 0;
- if ( gpointer_to_int( data ) == IDOK ) {
- *filename = g_strdup( gtk_file_selection_get_filename( GTK_FILE_SELECTION( parent ) ) );
- }
-}
-
static void change_clicked( GtkWidget *widget, gpointer data ){
GtkWidget* file_sel;
char* filename = NULL;
- int loop = 1;
-
- file_sel = gtk_file_selection_new( "Locate portal (.prt) file" );
- g_signal_connect( GTK_OBJECT( GTK_FILE_SELECTION( file_sel )->ok_button ), "clicked",
- G_CALLBACK( file_sel_callback ), GINT_TO_POINTER( IDOK ) );
- g_signal_connect( GTK_OBJECT( GTK_FILE_SELECTION( file_sel )->cancel_button ), "clicked",
- G_CALLBACK( file_sel_callback ), GINT_TO_POINTER( IDCANCEL ) );
- g_signal_connect( GTK_OBJECT( file_sel ), "delete_event",
- G_CALLBACK( dialog_delete_callback ), NULL );
- gtk_file_selection_hide_fileop_buttons( GTK_FILE_SELECTION( file_sel ) );
- g_object_set_data( G_OBJECT( file_sel ), "loop", &loop );
- g_object_set_data( G_OBJECT( file_sel ), "filename", &filename );
- gtk_file_selection_set_filename( GTK_FILE_SELECTION( file_sel ), portals.fn );
+ file_sel = gtk_file_chooser_dialog_new ( "Locate portal (.prt) file", nullptr, GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+ nullptr);
- gtk_grab_add( file_sel );
- gtk_widget_show( file_sel );
+ gtk_file_chooser_set_filename( GTK_FILE_CHOOSER(file_sel), portals.fn );
- while ( loop )
- gtk_main_iteration();
-
- gtk_grab_remove( file_sel );
- gtk_widget_destroy( file_sel );
+ if (gtk_dialog_run (GTK_DIALOG (file_sel)) == GTK_RESPONSE_ACCEPT)
+ {
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_sel));
+ }
+ gtk_widget_destroy (file_sel);
if ( filename != NULL ) {
strcpy( portals.fn, filename );
g_signal_connect( GTK_OBJECT( window ), "destroy",
G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( GTK_WINDOW( window ), lpCaption );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret );
gtk_widget_realize( window );