]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
-DGTK_DISABLE_DEPRECATED
authorTimePath <andrew.hardaker1995@gmail.com>
Thu, 18 Feb 2016 03:47:37 +0000 (14:47 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Thu, 18 Feb 2016 03:47:37 +0000 (14:47 +1100)
CMakeLists.txt
contrib/bobtoolz/dialogs/dialogs-gtk.cpp
contrib/brushexport/interface.cpp
contrib/hydratoolz/plugin.cpp
contrib/prtview/ConfigDialog.cpp
contrib/prtview/LoadPortalFileDialog.cpp
plugins/textool/TexTool.cpp

index 141b62b65facdc0977d6a8f1887f253c61908d1c..5bf7ef2f33705334f45e085aba5e08d83575c87a 100644 (file)
@@ -67,7 +67,7 @@ add_definitions(
         -DGTK_DISABLE_SINGLE_INCLUDES
         -DGSEAL_ENABLE
         -DGDK_DISABLE_DEPRECATED
-        #-DGTK_DISABLE_DEPRECATED
+        -DGTK_DISABLE_DEPRECATED
 )
 
 if(NOT WIN32)
index f4c28b979c80ca76e98b5b5cdae5a31154a86801..1b2ba6c854966909c00f452bd23dc9e2cd3676e2 100644 (file)
 #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"
@@ -107,7 +104,7 @@ static void dialog_button_callback_settex( GtkWidget *widget, gpointer data ){
 
        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 );
 }
 
@@ -219,7 +216,7 @@ EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMess
        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 );
@@ -332,7 +329,7 @@ EMessageBoxReturn DoIntersectBox( IntersectRS* rs ){
        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 );
@@ -430,7 +427,7 @@ EMessageBoxReturn DoPolygonBox( PolygonRS* rs ){
        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 );
@@ -605,7 +602,7 @@ EMessageBoxReturn DoBuildStairsBox( BuildStairsRS* rs ){
 
        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 );
@@ -861,7 +858,7 @@ EMessageBoxReturn DoDoorsBox( DoorRS* rs ){
 
        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 );
@@ -1073,7 +1070,7 @@ EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){
        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 );
@@ -1244,7 +1241,7 @@ EMessageBoxReturn DoCTFColourChangeBox(){
        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 );
@@ -1315,7 +1312,7 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){
        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 );
@@ -1651,10 +1648,10 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){
        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 );
 
@@ -1915,7 +1912,7 @@ EMessageBoxReturn DoMakeChainBox( MakeChainRS* rs ){
 
        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 );
index a2405aa5604567d5116a3124ecd69b3cc7068948..c0f18c82b29db4d62370e5d9a7183fc6940a6097 100644 (file)
@@ -37,9 +37,6 @@ create_w_plugplug2( void ){
        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" );
@@ -66,7 +63,7 @@ create_w_plugplug2( void ){
 
        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 );
@@ -74,7 +71,7 @@ create_w_plugplug2( void ){
 
        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 );
@@ -82,7 +79,7 @@ create_w_plugplug2( void ){
 
        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 );
index 934bd208ed104b281556c2a3dc7c598c01924fff..f2e3d89b7d434abf83bdfe260a28ac57dacbbfd2 100644 (file)
@@ -90,7 +90,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){
        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 );
index 8a3e28a3729f1cad5e03d9d2b052f70bb5d19597..acb9f5b588c2e8f9321a27b6a0d890d6d1ffb89b 100644 (file)
@@ -55,15 +55,15 @@ static gint dialog_delete_callback( GtkWidget *widget, GdkEvent* event, gpointer
 
 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",
@@ -85,13 +85,13 @@ static int DoColor( PackedColour *c ){
        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;
@@ -244,7 +244,7 @@ static void OnClip( GtkWidget *widget, gpointer data ){
 
 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;
@@ -336,31 +336,17 @@ void DoConfigDialog(){
                                          (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 );
@@ -483,7 +469,7 @@ void DoConfigDialog(){
        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 );
index ff63a88568aed23785b7c3379c4eba26dbe6eb98..eaee56c4a13a953b2e7a1a22583c12252cda353d 100644 (file)
@@ -55,47 +55,22 @@ static gint dialog_delete_callback( GtkWidget *widget, GdkEvent* event, gpointer
        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 );
index a4c1815f9f0c6b5e18a0f8a47395bbdb2437c0f9..63f77b7f91585c999afc86548608fa812f27a929 100644 (file)
@@ -60,7 +60,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){
        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 );