X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=contrib%2Fprtview%2FConfigDialog.cpp;h=64f539c7da33112418f7a8c492d2c8f94aef1e1a;hb=e6ffa8c04f8bd4e501210652daf88b52a366a338;hp=6e2489775e6533f7164da50aede1d6a49d1ba7d3;hpb=69b4f74e6c95e22d6c6ce10d0e137c875fd83cc4;p=xonotic%2Fnetradiant.git diff --git a/contrib/prtview/ConfigDialog.cpp b/contrib/prtview/ConfigDialog.cpp index 6e248977..64f539c7 100644 --- a/contrib/prtview/ConfigDialog.cpp +++ b/contrib/prtview/ConfigDialog.cpp @@ -28,11 +28,10 @@ #include "prtview.h" #include "portals.h" -static void dialog_button_callback( GtkWidget *widget, gpointer data ){ - GtkWidget *parent; +static void dialog_button_callback( ui::Widget widget, gpointer data ){ int *loop, *ret; - parent = gtk_widget_get_toplevel( widget ); + auto parent = widget.window(); loop = (int*)g_object_get_data( G_OBJECT( parent ), "loop" ); ret = (int*)g_object_get_data( G_OBJECT( parent ), "ret" ); @@ -238,7 +237,7 @@ void DoConfigDialog(){ int loop = 1, ret = IDCANCEL; auto dlg = ui::Window( ui::window_type::TOP ); - gtk_window_set_title( GTK_WINDOW( dlg ), "Portal Viewer Configuration" ); + gtk_window_set_title( dlg, "Portal Viewer Configuration" ); dlg.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); dlg.connect( "destroy", @@ -278,49 +277,37 @@ void DoConfigDialog(){ auto table = ui::Table( 2, 4, FALSE ); table.show(); vbox2.pack_start( table, TRUE, TRUE, 0 ); - gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); - gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_table_set_row_spacings(table, 5); + gtk_table_set_col_spacings(table, 5); auto button = ui::Button( "Color" ); button.show(); - gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(button, {0, 1, 0, 1}, {GTK_FILL, 0}); button.connect( "clicked", G_CALLBACK( OnColor3d ), NULL ); button = ui::Button( "Depth Color" ); button.show(); - gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(button, {0, 1, 1, 2}, {GTK_FILL, 0}); button.connect( "clicked", G_CALLBACK( OnColorFog ), NULL ); auto aa3check = ui::CheckButton( "Anti-Alias (May not work on some video cards)" ); aa3check.show(); - gtk_table_attach( GTK_TABLE( table ), aa3check, 1, 4, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(aa3check, {1, 4, 0, 1}, {GTK_EXPAND | GTK_FILL, 0}); aa3check.connect( "toggled", G_CALLBACK( OnAntiAlias3d ), NULL ); auto depthcheck = ui::CheckButton( "Depth Cue" ); depthcheck.show(); - gtk_table_attach( GTK_TABLE( table ), depthcheck, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(depthcheck, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0}); depthcheck.connect( "toggled", G_CALLBACK( OnFog ), NULL ); auto linescheck = ui::CheckButton( "Lines" ); linescheck.show(); - gtk_table_attach( GTK_TABLE( table ), linescheck, 2, 3, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(linescheck, {2, 3, 1, 2}, {GTK_EXPAND | GTK_FILL, 0}); linescheck.connect( "toggled", G_CALLBACK( OnLines ), NULL ); auto polyscheck = ui::CheckButton( "Polygons" ); polyscheck.show(); - gtk_table_attach( GTK_TABLE( table ), polyscheck, 3, 4, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(polyscheck, {3, 4, 1, 2}, {GTK_EXPAND | GTK_FILL, 0}); polyscheck.connect( "toggled", G_CALLBACK( OnPoly ), NULL ); auto zlist = ui::ComboBoxText(ui::New); @@ -338,38 +325,30 @@ void DoConfigDialog(){ table = ui::Table( 2, 2, FALSE ); table.show(); vbox2.pack_start( table, TRUE, TRUE, 0 ); - gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); - gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_table_set_row_spacings(table, 5); + gtk_table_set_col_spacings(table, 5); adj = ui::Adjustment( portals.trans_3d, 0, 100, 1, 1, 0 ); auto transslider = ui::HScale( adj ); transslider.show(); - gtk_table_attach( GTK_TABLE( table ), transslider, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(transslider, {0, 1, 0, 1}, {GTK_EXPAND | GTK_FILL, 0}); gtk_scale_set_draw_value( GTK_SCALE( transslider ), FALSE ); auto translabel = ui::Label( "" ); translabel.show(); - gtk_table_attach( GTK_TABLE( table ), translabel, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(translabel, {1, 2, 0, 1}, {GTK_FILL, 0}); gtk_misc_set_alignment( GTK_MISC( translabel ), 0.0, 0.0 ); adj.connect( "value_changed", G_CALLBACK( OnScrollTrans ), translabel ); adj = ui::Adjustment( portals.clip_range, 1, 128, 1, 1, 0 ); auto clipslider = ui::HScale( adj ); clipslider.show(); - gtk_table_attach( GTK_TABLE( table ), clipslider, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(clipslider, {0, 1, 1, 2}, {GTK_EXPAND | GTK_FILL, 0}); gtk_scale_set_draw_value( GTK_SCALE( clipslider ), FALSE ); auto cliplabel = ui::Label( "" ); cliplabel.show(); - gtk_table_attach( GTK_TABLE( table ), cliplabel, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(cliplabel, {1, 2, 1, 2}, {GTK_FILL, 0}); gtk_misc_set_alignment( GTK_MISC( cliplabel ), 0.0, 0.0 ); adj.connect( "value_changed", G_CALLBACK( OnScrollClip ), cliplabel );