From e6ffa8c04f8bd4e501210652daf88b52a366a338 Mon Sep 17 00:00:00 2001 From: TimePath Date: Sat, 30 Dec 2017 14:36:21 +1100 Subject: [PATCH] GTK: wrap gtk_table_attach --- contrib/bobtoolz/dialogs/dialogs-gtk.cpp | 168 ++++--------- contrib/camera/dialogs.cpp | 28 +-- contrib/gtkgensurf/gendlgs.cpp | 288 +++++++---------------- contrib/prtview/ConfigDialog.cpp | 48 ++-- contrib/sunplug/sunplug.cpp | 41 ++-- libs/gtkutil/dialog.cpp | 8 +- libs/uilib/uilib.cpp | 8 + libs/uilib/uilib.h | 15 ++ radiant/build.cpp | 12 +- radiant/dialog.cpp | 16 +- radiant/entityinspector.cpp | 26 +- radiant/findtexturedialog.cpp | 24 +- radiant/gtkdlgs.cpp | 72 ++---- radiant/mainframe.cpp | 6 +- radiant/map.cpp | 32 +-- radiant/patchdialog.cpp | 148 +++--------- radiant/patchmanip.cpp | 56 ++--- radiant/select.cpp | 48 +--- radiant/surfacedialog.cpp | 160 ++++--------- radiant/texwindow.cpp | 27 +-- 20 files changed, 374 insertions(+), 857 deletions(-) diff --git a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp index e6016ddf..10a012c1 100644 --- a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp +++ b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp @@ -1315,8 +1315,8 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ auto table = ui::Table( 2, 3, TRUE ); table.show(); frame.add(table); - 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); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); // ---- frame ---- @@ -1324,34 +1324,24 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ dlgTexReset.cbTexChange = ui::CheckButton( "Enabled" ); dlgTexReset.cbTexChange.connect( "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL ); dlgTexReset.cbTexChange.show(); - gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbTexChange, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(dlgTexReset.cbTexChange, {0, 1, 0, 1}, {GTK_FILL, 0}); w = ui::Label( "Old Name: " ); - gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(w, {1, 2, 0, 1}, {GTK_FILL, 0}); w.show(); dlgTexReset.editTexOld = ui::Entry( 256 ); gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editTexOld ), rs->textureName ); - gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editTexOld, 2, 3, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(dlgTexReset.editTexOld, {2, 3, 0, 1}, {GTK_FILL, 0}); dlgTexReset.editTexOld.show(); w = ui::Label( "New Name: " ); - gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(w, {1, 2, 1, 2}, {GTK_FILL, 0}); w.show(); dlgTexReset.editTexNew = ui::Entry( 256 ); gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editTexNew ), rs->textureName ); - gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editTexNew, 2, 3, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(dlgTexReset.editTexNew, {2, 3, 1, 2}, {GTK_FILL, 0}); dlgTexReset.editTexNew.show(); // ---- /frame ---- @@ -1363,8 +1353,8 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ table = ui::Table( 2, 3, TRUE ); table.show(); frame.add(table); - 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); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); // ---- frame ---- @@ -1372,42 +1362,30 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ dlgTexReset.cbScaleHor = ui::CheckButton( "Enabled" ); dlgTexReset.cbScaleHor.connect( "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL ); dlgTexReset.cbScaleHor.show(); - gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbScaleHor, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(dlgTexReset.cbScaleHor, {0, 1, 0, 1}, {GTK_FILL, 0}); w = ui::Label( "New Horizontal Scale: " ); - gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(w, {1, 2, 0, 1}, {GTK_FILL, 0}); w.show(); dlgTexReset.editScaleHor = ui::Entry( 256 ); gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editScaleHor ), "0.5" ); - gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editScaleHor, 2, 3, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(dlgTexReset.editScaleHor, {2, 3, 0, 1}, {GTK_FILL, 0}); dlgTexReset.editScaleHor.show(); dlgTexReset.cbScaleVert = ui::CheckButton( "Enabled" ); dlgTexReset.cbScaleVert.connect( "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL ); dlgTexReset.cbScaleVert.show(); - gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbScaleVert, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(dlgTexReset.cbScaleVert, {0, 1, 1, 2}, {GTK_FILL, 0}); w = ui::Label( "New Vertical Scale: " ); - gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(w, {1, 2, 1, 2}, {GTK_FILL, 0}); w.show(); dlgTexReset.editScaleVert = ui::Entry( 256 ); gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editScaleVert ), "0.5" ); - gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editScaleVert, 2, 3, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(dlgTexReset.editScaleVert, {2, 3, 1, 2}, {GTK_FILL, 0}); dlgTexReset.editScaleVert.show(); // ---- /frame ---- @@ -1419,8 +1397,8 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ table = ui::Table( 2, 3, TRUE ); table.show(); frame.add(table); - 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); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); // ---- frame ---- @@ -1428,42 +1406,30 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ dlgTexReset.cbShiftHor = ui::CheckButton( "Enabled" ); dlgTexReset.cbShiftHor.connect( "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL ); dlgTexReset.cbShiftHor.show(); - gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbShiftHor, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(dlgTexReset.cbShiftHor, {0, 1, 0, 1}, {GTK_FILL, 0}); w = ui::Label( "New Horizontal Shift: " ); - gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(w, {1, 2, 0, 1}, {GTK_FILL, 0}); w.show(); dlgTexReset.editShiftHor = ui::Entry( 256 ); gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editShiftHor ), "0" ); - gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editShiftHor, 2, 3, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(dlgTexReset.editShiftHor, {2, 3, 0, 1}, {GTK_FILL, 0}); dlgTexReset.editShiftHor.show(); dlgTexReset.cbShiftVert = ui::CheckButton( "Enabled" ); dlgTexReset.cbShiftVert.connect( "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL ); dlgTexReset.cbShiftVert.show(); - gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbShiftVert, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(dlgTexReset.cbShiftVert, {0, 1, 1, 2}, {GTK_FILL, 0}); w = ui::Label( "New Vertical Shift: " ); - gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(w, {1, 2, 1, 2}, {GTK_FILL, 0}); w.show(); dlgTexReset.editShiftVert = ui::Entry( 256 ); gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editShiftVert ), "0" ); - gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editShiftVert, 2, 3, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(dlgTexReset.editShiftVert, {2, 3, 1, 2}, {GTK_FILL, 0}); dlgTexReset.editShiftVert.show(); // ---- /frame ---- @@ -1475,29 +1441,23 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ table = ui::Table( 1, 3, TRUE ); table.show(); frame.add(table); - 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); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); // ---- frame ---- dlgTexReset.cbRotation = ui::CheckButton( "Enabled" ); dlgTexReset.cbRotation.show(); - gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbRotation, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(dlgTexReset.cbRotation, {0, 1, 0, 1}, {GTK_FILL, 0}); w = ui::Label( "New Rotation Value: " ); - gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(w, {1, 2, 0, 1}, {GTK_FILL, 0}); w.show(); dlgTexReset.editRotation = ui::Entry( 256 ); gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editRotation ), "0" ); - gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editRotation, 2, 3, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(dlgTexReset.editRotation, {2, 3, 0, 1}, {GTK_FILL, 0}); dlgTexReset.editRotation.show(); // ---- /frame ---- @@ -1641,38 +1601,30 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){ auto table = ui::Table( 2, 3, TRUE ); table.show(); frame.add(table); - 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); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); // ---- frame ---- w = ui::Label( "X: " ); - gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(w, {0, 1, 0, 1}, {GTK_FILL, 0}); w.show(); radiusX = ui::Entry( 256 ); gtk_entry_set_text( GTK_ENTRY( radiusX ), "100" ); - gtk_table_attach( GTK_TABLE( table ), radiusX, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(radiusX, {1, 2, 0, 1}, {GTK_FILL, 0}); radiusX.show(); w = ui::Label( "Y: " ); - gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(w, {0, 1, 1, 2}, {GTK_FILL, 0}); w.show(); radiusY = ui::Entry( 256 ); gtk_entry_set_text( GTK_ENTRY( radiusY ), "100" ); - gtk_table_attach( GTK_TABLE( table ), radiusY, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(radiusY, {1, 2, 1, 2}, {GTK_FILL, 0}); radiusY.show(); @@ -1684,38 +1636,30 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){ table = ui::Table( 2, 3, TRUE ); table.show(); frame.add(table); - 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); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); // ---- frame ---- w = ui::Label( "Start: " ); - gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(w, {0, 1, 0, 1}, {GTK_FILL, 0}); w.show(); angleStart = ui::Entry( 256 ); gtk_entry_set_text( GTK_ENTRY( angleStart ), "0" ); - gtk_table_attach( GTK_TABLE( table ), angleStart, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(angleStart, {1, 2, 0, 1}, {GTK_FILL, 0}); angleStart.show(); w = ui::Label( "End: " ); - gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(w, {0, 1, 1, 2}, {GTK_FILL, 0}); w.show(); angleEnd = ui::Entry( 256 ); gtk_entry_set_text( GTK_ENTRY( angleEnd ), "90" ); - gtk_table_attach( GTK_TABLE( table ), angleEnd, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(angleEnd, {1, 2, 1, 2}, {GTK_FILL, 0}); angleEnd.show(); @@ -1726,38 +1670,30 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){ table = ui::Table( 2, 3, TRUE ); table.show(); frame.add(table); - 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); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); // ---- frame ---- w = ui::Label( "Start: " ); - gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(w, {0, 1, 0, 1}, {GTK_FILL, 0}); w.show(); heightStart = ui::Entry( 256 ); gtk_entry_set_text( GTK_ENTRY( heightStart ), "0" ); - gtk_table_attach( GTK_TABLE( table ), heightStart, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(heightStart, {1, 2, 0, 1}, {GTK_FILL, 0}); heightStart.show(); w = ui::Label( "End: " ); - gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(w, {0, 1, 1, 2}, {GTK_FILL, 0}); w.show(); heightEnd = ui::Entry( 256 ); gtk_entry_set_text( GTK_ENTRY( heightEnd ), "0" ); - gtk_table_attach( GTK_TABLE( table ), heightEnd, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(heightEnd, {1, 2, 1, 2}, {GTK_FILL, 0}); heightEnd.show(); @@ -1769,23 +1705,19 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){ table = ui::Table( 2, 3, TRUE ); table.show(); frame.add(table); - 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); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); // ---- frame ---- w = ui::Label( "Number: " ); - gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(w, {0, 1, 0, 1}, {GTK_FILL, 0}); w.show(); numPoints = ui::Entry( 256 ); gtk_entry_set_text( GTK_ENTRY( numPoints ), "0" ); - gtk_table_attach( GTK_TABLE( table ), numPoints, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(numPoints, {1, 2, 0, 1}, {GTK_FILL, 0}); numPoints.show(); diff --git a/contrib/camera/dialogs.cpp b/contrib/camera/dialogs.cpp index 7ca99e91..5c998b49 100644 --- a/contrib/camera/dialogs.cpp +++ b/contrib/camera/dialogs.cpp @@ -1014,17 +1014,15 @@ GtkWidget *CreateCameraInspectorDialog( void ){ table.show(); window.add(table); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); - 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); // the properties column // -------------------------- // vbox = ui::VBox( FALSE, 5 ); vbox.show(); - gtk_table_attach( GTK_TABLE( table ), vbox, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(vbox, {0, 1, 0, 1}, {GTK_EXPAND | GTK_FILL, GTK_FILL}); // -------------------------- // @@ -1072,9 +1070,7 @@ GtkWidget *CreateCameraInspectorDialog( void ){ auto frame = ui::Frame( "Path and Target editing" ); frame.show(); - gtk_table_attach( GTK_TABLE( table ), frame, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(frame, {0, 1, 1, 2}, {GTK_EXPAND | GTK_FILL, GTK_FILL}); auto vbox = ui::VBox( FALSE, 5 ); frame.add(vbox); @@ -1166,9 +1162,7 @@ GtkWidget *CreateCameraInspectorDialog( void ){ frame = ui::Frame( "Time" ); frame.show(); - gtk_table_attach( GTK_TABLE( table ), frame, 0, 1, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(frame, {0, 1, 2, 3}, {GTK_EXPAND | GTK_FILL, GTK_FILL}); vbox = ui::VBox( FALSE, 5 ); frame.add(vbox); @@ -1295,9 +1289,7 @@ GtkWidget *CreateCameraInspectorDialog( void ){ vbox = gtk_vbox_new( FALSE, 5 ); vbox.show(); - gtk_table_attach( GTK_TABLE( table ), vbox, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(vbox, {1, 2, 0, 1}, {GTK_FILL, GTK_FILL}); w = gtk_button_new_with_label( "New..." ); vbox.pack_start( w, FALSE, FALSE, 0 ); @@ -1313,9 +1305,7 @@ GtkWidget *CreateCameraInspectorDialog( void ){ vbox = gtk_vbox_new( FALSE, 5 ); vbox.show(); - gtk_table_attach( GTK_TABLE( table ), vbox, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach( vbox, {1, 2, 1, 2}, {GTK_FILL, GTK_FILL}); w = gtk_button_new_with_label( "Save..." ); vbox.pack_start( w, FALSE, FALSE, 0 ); @@ -1345,9 +1335,7 @@ GtkWidget *CreateCameraInspectorDialog( void ){ vbox = gtk_vbox_new( FALSE, 5 ); vbox.show(); - gtk_table_attach( GTK_TABLE( table ), vbox, 1, 2, 2, 3, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(vbox, {1, 2, 2, 3}, {GTK_FILL, GTK_FILL}); hbox = gtk_hbox_new( FALSE, 5 ); vbox.pack_start( hbox, TRUE, TRUE, 0 ); diff --git a/contrib/gtkgensurf/gendlgs.cpp b/contrib/gtkgensurf/gendlgs.cpp index 75d9740e..5f49a545 100644 --- a/contrib/gtkgensurf/gendlgs.cpp +++ b/contrib/gtkgensurf/gendlgs.cpp @@ -1377,8 +1377,8 @@ GtkWidget* create_main_dialog(){ table = ui::Table( 2, 2, FALSE ); table.show(); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); - 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); label = ui::Label( "General" ); label.show(); @@ -1386,9 +1386,7 @@ GtkWidget* create_main_dialog(){ auto frame = ui::Frame( "Game" ); frame.show(); - gtk_table_attach( GTK_TABLE( table ), frame, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table.attach(frame, {0, 1, 0, 1}); auto vbox = ui::VBox( TRUE, 5 ); vbox.show(); @@ -1407,9 +1405,7 @@ GtkWidget* create_main_dialog(){ frame = ui::Frame( "Waveform" ); frame.show(); - gtk_table_attach( GTK_TABLE( table ), frame, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table.attach(frame, {1, 2, 0, 1}); vbox = ui::VBox( TRUE, 5 ); vbox.show(); @@ -1428,9 +1424,7 @@ GtkWidget* create_main_dialog(){ frame = ui::Frame( "Orientation" ); frame.show(); - gtk_table_attach( GTK_TABLE( table ), frame, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table.attach(frame, {0, 1, 1, 2}); vbox = ui::VBox( TRUE, 5 ); vbox.show(); @@ -1449,67 +1443,51 @@ GtkWidget* create_main_dialog(){ table2 = ui::Table( 4, 2, FALSE ); table2.show(); - gtk_table_set_row_spacings( GTK_TABLE( table2 ), 5 ); - gtk_table_set_col_spacings( GTK_TABLE( table2 ), 5 ); - gtk_table_attach( GTK_TABLE( table ), table2, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + gtk_table_set_row_spacings(table2, 5); + gtk_table_set_col_spacings(table2, 5); + table.attach(table2, {1, 2, 1, 2}); label = ui::Label( "Wavelength:" ); label.show(); - gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table2.attach(label, {0, 1, 0, 1}); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT ); label = ui::Label( "Max. amplitude:" ); label.show(); - gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table2.attach(label, {0, 1, 1, 2}); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT ); label = ui::Label( "Roughness:" ); label.show(); - gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table2.attach(label, {0, 1, 2, 3}); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT ); label = ui::Label( "Random seed:" ); label.show(); - gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 3, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table2.attach(label, {0, 1, 3, 4}); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT ); entry = ui::Entry(); entry.show(); - gtk_table_attach( GTK_TABLE( table2 ), entry, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table2.attach(entry, {1, 2, 0, 1}); gtk_widget_set_size_request( entry, 50, -1 ); g_object_set_data( G_OBJECT( dlg ), "wavelength", entry ); entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &WaveLength ); entry = ui::Entry(); entry.show(); - gtk_table_attach( GTK_TABLE( table2 ), entry, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table2.attach(entry, {1, 2, 1, 2}); gtk_widget_set_size_request( entry, 50, -1 ); g_object_set_data( G_OBJECT( dlg ), "amplitude", entry ); entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Amplitude ); entry = ui::Entry(); entry.show(); - gtk_table_attach( GTK_TABLE( table2 ), entry, 1, 2, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table2.attach(entry, {1, 2, 2, 3}); gtk_widget_set_size_request( entry, 50, -1 ); g_object_set_data( G_OBJECT( dlg ), "roughness", entry ); entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Roughness ); @@ -1518,9 +1496,7 @@ GtkWidget* create_main_dialog(){ adj.connect( "value_changed", G_CALLBACK( general_random ), NULL ); spin = ui::SpinButton( adj, 1, 0 ); spin.show(); - gtk_table_attach( GTK_TABLE( table2 ), spin, 1, 2, 3, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table2.attach(spin, {1, 2, 3, 4}); gtk_widget_set_size_request( spin, 60, -1 ); g_object_set_data( G_OBJECT( dlg ), "random", spin ); @@ -1544,81 +1520,61 @@ GtkWidget* create_main_dialog(){ table.show(); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); frame.add(table); - 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); label = ui::Label( "X:" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach( label, {0, 1, 1, 2}, {GTK_FILL, GTK_FILL}); g_object_set_data( G_OBJECT( dlg ), "hmin_text", label ); label = ui::Label( "X:" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(label, {2, 3, 1, 2}, {GTK_FILL, GTK_FILL}); g_object_set_data( G_OBJECT( dlg ), "hmax_text", label ); label = ui::Label( "Y:" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(label, {0, 1, 2, 3}, {GTK_FILL, GTK_FILL}); g_object_set_data( G_OBJECT( dlg ), "vmin_text", label ); label = ui::Label( "Y:" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 2, 3, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(label, {2, 3, 2, 3}, {GTK_FILL, GTK_FILL}); g_object_set_data( G_OBJECT( dlg ), "vmax_text", label ); label = ui::Label( "Lower-left" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(label, {1, 2, 0, 1}, {GTK_FILL, GTK_FILL}); label = ui::Label( "Upper-right" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 3, 4, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(label, {3, 4, 0, 1},, {GTK_FILL, GTK_FILL}); entry = ui::Entry(); entry.show(); - gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table.attach(entry, {1, 2, 1, 2}); gtk_widget_set_size_request( entry, 50, -1 ); g_object_set_data( G_OBJECT( dlg ), "hmin", entry ); entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Hll ); entry = ui::Entry(); entry.show(); - gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table.attach(entry, {3, 4, 1, 2}); gtk_widget_set_size_request( entry, 50, -1 ); g_object_set_data( G_OBJECT( dlg ), "hmax", entry ); entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Hur ); entry = ui::Entry(); entry.show(); - gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table.attach(entry, {1, 2, 2, 3}); gtk_widget_set_size_request( entry, 50, -1 ); g_object_set_data( G_OBJECT( dlg ), "vmin", entry ); entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Vll ); entry = ui::Entry(); entry.show(); - gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table.attach(entry, {3, 4, 2, 3}); gtk_widget_set_size_request( entry, 50, -1 ); g_object_set_data( G_OBJECT( dlg ), "vmax", entry ); entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Vur ); @@ -1631,30 +1587,24 @@ GtkWidget* create_main_dialog(){ table.show(); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); frame.add(table); - 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); label = ui::Label( "X:" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table.attach(label, {0, 1, 0, 1}, {GTK_FILL, GTK_EXPAND | GTK_FILL}); g_object_set_data( G_OBJECT( dlg ), "nh_text", label ); label = ui::Label( "Y:" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table.attach(label, {0, 1, 1, 2}, {GTK_FILL, GTK_EXPAND | GTK_FILL}); g_object_set_data( G_OBJECT( dlg ), "nv_text", label ); adj = ui::Adjustment( 8, 1, MAX_ROWS, 1, 10, 0 ); adj.connect( "value_changed", G_CALLBACK( extents_nhnv_spin ), &NH ); spin = ui::SpinButton( adj, 1, 0 ); spin.show(); - gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table.attach(spin, {1, 2, 0, 1}); gtk_widget_set_size_request( spin, 60, -1 ); g_object_set_data( G_OBJECT( dlg ), "nh", spin ); @@ -1662,9 +1612,7 @@ GtkWidget* create_main_dialog(){ adj.connect( "value_changed", G_CALLBACK( extents_nhnv_spin ), &NV ); spin = ui::SpinButton( adj, 1, 0 ); spin.show(); - gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table.attach(spin, {1, 2, 1, 2}); gtk_widget_set_size_request( spin, 60, -1 ); g_object_set_data( G_OBJECT( dlg ), "nv", spin ); @@ -1715,74 +1663,56 @@ GtkWidget* create_main_dialog(){ table.show(); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); frame.add(table); - 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); label = ui::Label( "Upper-left:" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(label, {0, 1, 0, 1}, {GTK_FILL, GTK_FILL}); label = ui::Label( "Lower-left:" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(label, {0, 1, 1, 2}, {GTK_FILL, GTK_FILL}); label = ui::Label( "Upper-right:" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(label, {2, 3, 0, 1}, {GTK_FILL, GTK_FILL}); label = ui::Label( "Lower-right:" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(label, {2, 3, 1, 2}, {GTK_FILL, GTK_FILL}); entry = ui::Entry(); entry.show(); - gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table.attach(entry, {1, 2, 0, 1}); gtk_widget_set_size_request( entry, 50, -1 ); g_object_set_data( G_OBJECT( dlg ), "z01", entry ); entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Z01 ); entry = ui::Entry(); entry.show(); - gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table.attach(entry, {1, 2, 1, 2}); gtk_widget_set_size_request( entry, 50, -1 ); g_object_set_data( G_OBJECT( dlg ), "z00", entry ); entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Z00 ); entry = ui::Entry(); entry.show(); - gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table.attach(entry, {3, 4, 0, 1}); gtk_widget_set_size_request( entry, 50, -1 ); g_object_set_data( G_OBJECT( dlg ), "z11", entry ); entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Z11 ); entry = ui::Entry(); entry.show(); - gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table.attach(entry, {3, 4, 1, 2}); gtk_widget_set_size_request( entry, 50, -1 ); g_object_set_data( G_OBJECT( dlg ), "z10", entry ); entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Z10 ); check = ui::CheckButton( "Linear borders" ); check.show(); - gtk_table_attach( GTK_TABLE( table ), check, 0, 4, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table.attach(check, {0, 4, 2, 3}); g_object_set_data( G_OBJECT( dlg ), "linearborder", check ); check.connect( "toggled", G_CALLBACK( extents_linearborder ), NULL ); @@ -1803,29 +1733,23 @@ GtkWidget* create_main_dialog(){ table.show(); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); vbox.pack_start( table, FALSE, 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); label = ui::Label( "Filename:" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(label, {0, 1, 0, 1}, {GTK_FILL, GTK_FILL}); g_object_set_data( G_OBJECT( dlg ), "bmp_text1", label ); entry = ui::Entry(); entry.show(); - gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(entry, {1, 2, 0, 1}, {GTK_EXPAND | GTK_FILL, GTK_FILL}); g_object_set_data( G_OBJECT( dlg ), "bmp_file", entry ); entry.connect( "focus_out_event", G_CALLBACK( bitmap_file_entryfocusout ), NULL ); hbox2 = ui::HBox( TRUE, 5 ); hbox2.show(); - gtk_table_attach( GTK_TABLE( table ), hbox2, 1, 2, 1, 2, - (GtkAttachOptions) ( 0 ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table.attach(hbox2, {1, 2, 1, 2}, {0, GTK_EXPAND | GTK_FILL}); button = ui::Button( "Browse..." ); button.show(); @@ -1845,32 +1769,26 @@ GtkWidget* create_main_dialog(){ table.show(); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); vbox.pack_start( table, FALSE, 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); label = ui::Label( "Map color 0 to:" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(label, {0, 1, 0, 1}, {GTK_FILL | GTK_EXPAND, GTK_FILL}); g_object_set_data( G_OBJECT( dlg ), "bmp_text2", label ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT ); label = ui::Label( "Map color 255 to:" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(label, {0, 1, 1, 2}, {GTK_FILL | GTK_EXPAND, GTK_FILL}); g_object_set_data( G_OBJECT( dlg ), "bmp_text3", label ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT ); hbox2 = ui::HBox( FALSE, 5 ); hbox2.show(); - gtk_table_attach( GTK_TABLE( table ), hbox2, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table.attach(hbox2, {1, 2, 0, 1}); entry = ui::Entry(); entry.show(); @@ -1881,9 +1799,7 @@ GtkWidget* create_main_dialog(){ hbox2 = ui::HBox( FALSE, 5 ); hbox2.show(); - gtk_table_attach( GTK_TABLE( table ), hbox2, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table.attach(hbox2, {1, 2, 1, 2}); entry = ui::Entry(); entry.show(); @@ -1913,30 +1829,24 @@ GtkWidget* create_main_dialog(){ table.show(); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); vbox.pack_start( table, FALSE, 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); label = ui::Label( "Value:" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(label, {0, 1, 0, 1}, {GTK_FILL, GTK_FILL}); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); g_object_set_data( G_OBJECT( dlg ), "fix_value_text", label ); label = ui::Label( "Range affected:" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(label, {0, 1, 1, 2}, {GTK_FILL, GTK_FILL}); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); g_object_set_data( G_OBJECT( dlg ), "fix_range_text", label ); label = ui::Label( "Rate of change:" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(label, {0, 1, 2, 3}, {GTK_FILL, GTK_FILL}); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); g_object_set_data( G_OBJECT( dlg ), "fix_rate_text", label ); @@ -1944,45 +1854,35 @@ GtkWidget* create_main_dialog(){ adj.connect( "value_changed", G_CALLBACK( fix_value_changed ), NULL ); spin = ui::SpinButton( adj, 1, 0 ); spin.show(); - gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND ), - (GtkAttachOptions) ( GTK_EXPAND ), 0, 0 ); + table.attach(spin, {1, 2, 0, 1}, {GTK_EXPAND, GTK_EXPAND}); gtk_widget_set_size_request( spin, 60, -1 ); g_object_set_data( G_OBJECT( dlg ), "fix_value", spin ); spin.connect( "focus_out_event", G_CALLBACK( fix_value_entryfocusout ), NULL ); entry = ui::Entry(); entry.show(); - gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(entry, {1, 2, 1, 2}, {GTK_EXPAND, GTK_FILL}); gtk_widget_set_size_request( entry, 60, -1 ); g_object_set_data( G_OBJECT( dlg ), "fix_range", entry ); entry.connect( "focus_out_event", G_CALLBACK( fix_range_entryfocusout ), NULL ); entry = ui::Entry(); entry.show(); - gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(entry, {1, 2, 2, 3}, {GTK_EXPAND, GTK_FILL}); gtk_widget_set_size_request( entry, 60, -1 ); g_object_set_data( G_OBJECT( dlg ), "fix_rate", entry ); entry.connect( "focus_out_event", G_CALLBACK( fix_rate_entryfocusout ), NULL ); button = ui::Button( "Free" ); button.show(); - gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(button, {2, 3, 0, 1}, {GTK_EXPAND, GTK_FILL}); gtk_widget_set_size_request( button, 60, -1 ); g_object_set_data( G_OBJECT( dlg ), "fix_free", button ); button.connect( "clicked", G_CALLBACK( fix_free ), NULL ); button = ui::Button( "Free All" ); button.show(); - gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(button, {2, 3, 1, 2}, {GTK_EXPAND, GTK_FILL}); gtk_widget_set_size_request( button, 60, -1 ); g_object_set_data( G_OBJECT( dlg ), "fix_freeall", button ); button.connect( "clicked", G_CALLBACK( fix_freeall ), NULL ); @@ -1999,53 +1899,41 @@ GtkWidget* create_main_dialog(){ table = ui::Table( 5, 2, FALSE ); table.show(); vbox.pack_start( table, FALSE, 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); label = ui::Label( "Surface:" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(label, {0, 1, 0, 1}, {GTK_FILL, GTK_FILL}); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); label = ui::Label( "Other:" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(label, {0, 1, 1, 2}, {GTK_FILL, GTK_FILL}); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); label = ui::Label( "Steep:" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(label, {0, 1, 2, 3}, {GTK_FILL, GTK_FILL}); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); entry = ui::Entry(); entry.show(); - gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(entry, {1, 2, 0, 1}, {GTK_EXPAND | GTK_FILL, GTK_FILL}); gtk_widget_set_size_request( entry, 60, -1 ); g_object_set_data( G_OBJECT( dlg ), "texture1", entry ); entry.connect( "focus_out_event", G_CALLBACK( texture_entryfocusout ), GINT_TO_POINTER( 0 ) ); entry = ui::Entry(); entry.show(); - gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(entry, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, GTK_FILL}); gtk_widget_set_size_request( entry, 60, -1 ); g_object_set_data( G_OBJECT( dlg ), "texture2", entry ); entry.connect( "focus_out_event", G_CALLBACK( texture_entryfocusout ), GINT_TO_POINTER( 1 ) ); entry = ui::Entry(); entry.show(); - gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(entry, {1, 2, 2, 3}, {GTK_EXPAND | GTK_FILL, GTK_FILL}); gtk_widget_set_size_request( entry, 60, -1 ); g_object_set_data( G_OBJECT( dlg ), "texture3", entry ); @@ -2066,50 +1954,38 @@ GtkWidget* create_main_dialog(){ table = ui::Table( 2, 4, TRUE ); table.show(); vbox.pack_start( table, FALSE, 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); label = ui::Label( "Offset " ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 0, 2, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(label, {0, 2, 0, 1}, {GTK_FILL, GTK_FILL}); label = ui::Label( "Scale " ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 2, 4, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(label, {2, 4, 0, 1}, {GTK_FILL, GTK_FILL}); entry = ui::Entry(); entry.show(); - gtk_table_attach( GTK_TABLE( table ), entry, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(entry, {0, 1, 1, 2}, {GTK_EXPAND | GTK_FILL, GTK_FILL}); gtk_widget_set_size_request( entry, 60, -1 ); g_object_set_data( G_OBJECT( dlg ), "texoffsetx", entry ); entry = ui::Entry(); entry.show(); - gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(entry, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, GTK_FILL}); gtk_widget_set_size_request( entry, 60, -1 ); g_object_set_data( G_OBJECT( dlg ), "texoffsety", entry ); entry = ui::Entry(); entry.show(); - gtk_table_attach( GTK_TABLE( table ), entry, 2, 3, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(entry, {2, 3, 1, 2}, {GTK_EXPAND | GTK_FILL, GTK_FILL}); gtk_widget_set_size_request( entry, 60, -1 ); g_object_set_data( G_OBJECT( dlg ), "texscalex", entry ); entry = ui::Entry(); entry.show(); - gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table.attach(entry, {3, 4, 1, 2}, {GTK_EXPAND | GTK_FILL, GTK_FILL}); gtk_widget_set_size_request( entry, 60, -1 ); g_object_set_data( G_OBJECT( dlg ), "texscaley", entry ); diff --git a/contrib/prtview/ConfigDialog.cpp b/contrib/prtview/ConfigDialog.cpp index f4c22b98..64f539c7 100644 --- a/contrib/prtview/ConfigDialog.cpp +++ b/contrib/prtview/ConfigDialog.cpp @@ -277,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); @@ -337,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 ); diff --git a/contrib/sunplug/sunplug.cpp b/contrib/sunplug/sunplug.cpp index 589299b2..25ba558a 100644 --- a/contrib/sunplug/sunplug.cpp +++ b/contrib/sunplug/sunplug.cpp @@ -313,7 +313,6 @@ void GetOptimalCoordinates( AABB *levelBoundingBox ){ // MapCoordinator dialog window void MapCoordinator(){ - GtkWidget *spinnerMinX, *spinnerMinY, *spinnerMaxX, *spinnerMaxY; Entity *theWorldspawn = NULL; const char *buffer; char line[20]; @@ -376,52 +375,52 @@ void MapCoordinator(){ vbox.pack_start( ui::Widget(gtk_hseparator_new()), FALSE, FALSE, 2 ); // insert separator into vbox auto table = ui::Table( 4, 3, TRUE ); // create table - gtk_table_set_row_spacings( GTK_TABLE( table ), 8 ); // set row spacings - gtk_table_set_col_spacings( GTK_TABLE( table ), 8 ); // set column spacings + gtk_table_set_row_spacings(table, 8); // set row spacings + gtk_table_set_col_spacings(table, 8); // set column spacings vbox.pack_start( table, FALSE, FALSE, 2 ); // insert table into vbox auto label = ui::Label( "x" ); // create label gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); // align text to the left side - gtk_table_attach_defaults( GTK_TABLE( table ), label, 1, 2, 0, 1 ); // insert label into table + table.attach(label, {1, 2, 0, 1}); // insert label into table label = ui::Label( "y" ); // create label gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); // align text to the left side - gtk_table_attach_defaults( GTK_TABLE( table ), label, 2, 3, 0, 1 ); // insert label into table + table.attach(label, {2, 3, 0, 1}); // insert label into table label = ui::Label( "mapcoordsmins" ); // create label gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); // align text to the left side - gtk_table_attach_defaults( GTK_TABLE( table ), label, 0, 1, 1, 2 ); // insert label into table + table.attach(label, {0, 1, 1, 2}); // insert label into table - spinnerMinX = ui::SpinButton( spinner_adj_MinX, 1.0, 0 ); // create textbox wiht value spin, value and value range - gtk_table_attach_defaults( GTK_TABLE( table ), spinnerMinX, 1, 2, 1, 2 ); // insert spinbox into table + auto spinnerMinX = ui::SpinButton(spinner_adj_MinX, 1.0, 0); // create textbox wiht value spin, value and value range + table.attach(spinnerMinX, {1, 2, 1, 2}); // insert spinbox into table - spinnerMinY = ui::SpinButton( spinner_adj_MinY, 1.0, 0 ); // create textbox wiht value spin, value and value range - gtk_table_attach_defaults( GTK_TABLE( table ), spinnerMinY, 2, 3, 1, 2 ); // insert spinbox into table + auto spinnerMinY = ui::SpinButton(spinner_adj_MinY, 1.0, 0); // create textbox wiht value spin, value and value range + table.attach(spinnerMinY, {2, 3, 1, 2}); // insert spinbox into table label = ui::Label( "mapcoordsmaxs" ); // create label gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); // align text to the left side - gtk_table_attach_defaults( GTK_TABLE( table ), label, 0, 1, 2, 3 ); // insert label into table + table.attach(label, {0, 1, 2, 3}); // insert label into table - spinnerMaxX = ui::SpinButton( spinner_adj_MaxX, 1.0, 0 ); // create textbox wiht value spin, value and value range - gtk_table_attach_defaults( GTK_TABLE( table ), spinnerMaxX, 1, 2, 2, 3 ); // insert spinbox into table + auto spinnerMaxX = ui::SpinButton(spinner_adj_MaxX, 1.0, 0); // create textbox wiht value spin, value and value range + table.attach(spinnerMaxX, {1, 2, 2, 3}); // insert spinbox into table - spinnerMaxY = ui::SpinButton( spinner_adj_MaxY, 1.0, 0 ); // create textbox wiht value spin, value and value range - gtk_table_attach_defaults( GTK_TABLE( table ), spinnerMaxY, 2, 3, 2, 3 ); // insert spinbox into table + auto spinnerMaxY = ui::SpinButton(spinner_adj_MaxY, 1.0, 0); // create textbox wiht value spin, value and value range + table.attach(spinnerMaxY, {2, 3, 2, 3}); // insert spinbox into table // put the references to the spinboxes and the worldspawn into the global exchange - msp.spinner1 = GTK_SPIN_BUTTON( spinnerMinX ); - msp.spinner2 = GTK_SPIN_BUTTON( spinnerMinY ); - msp.spinner3 = GTK_SPIN_BUTTON( spinnerMaxX ); - msp.spinner4 = GTK_SPIN_BUTTON( spinnerMaxY ); + msp.spinner1 = spinnerMinX; + msp.spinner2 = spinnerMinY; + msp.spinner3 = spinnerMaxX; + msp.spinner4 = spinnerMaxY; msp.worldspawn = theWorldspawn; button = ui::Button( "Set" ); // create button with text button.connect( "clicked", G_CALLBACK( set_coordinates ), NULL ); // connect button with callback function - gtk_table_attach_defaults( GTK_TABLE( table ), button, 1, 2, 3, 4 ); // insert button into table + table.attach(button, {1, 2, 3, 4}); // insert button into table button = ui::Button( "Cancel" ); // create button with text button.connect( "clicked", G_CALLBACK( close_window ), NULL ); // connect button with callback function - gtk_table_attach_defaults( GTK_TABLE( table ), button, 2, 3, 3, 4 ); // insert button into table + table.attach(button, {2, 3, 3, 4}); // insert button into table } else { globalOutputStream() << "SunPlug: no worldspawn found!\n"; // output error to console diff --git a/libs/gtkutil/dialog.cpp b/libs/gtkutil/dialog.cpp index 73e241ab..4c50e7b9 100644 --- a/libs/gtkutil/dialog.cpp +++ b/libs/gtkutil/dialog.cpp @@ -251,13 +251,9 @@ ui::Table DialogRow_new( const char* name, ui::Widget widget ){ gtk_table_set_col_spacings( table, 4 ); gtk_table_set_row_spacings( table, 0 ); - gtk_table_attach( table, DialogLabel_new( name ), 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(DialogLabel_new(name), {0, 1, 0, 1}, {GTK_EXPAND | GTK_FILL, 0}); - gtk_table_attach( table, widget, 1, 3, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(widget, {1, 3, 0, 1}, {GTK_EXPAND | GTK_FILL, 0}); return table; } diff --git a/libs/uilib/uilib.cpp b/libs/uilib/uilib.cpp index cb44edb2..82127e9f 100644 --- a/libs/uilib/uilib.cpp +++ b/libs/uilib/uilib.cpp @@ -305,6 +305,14 @@ namespace ui { ) {} + void ITable::attach(Widget child, TableAttach attach, TableAttachOptions options, TablePadding padding) { + gtk_table_attach(this, child, + attach.left, attach.right, attach.top, attach.bottom, + static_cast(options.x), static_cast(options.y), + padding.x, padding.y + ); + } + IMPL(TextView, GTK_TEXT_VIEW); TextView::TextView(ui::New_t) : TextView(GTK_TEXT_VIEW(gtk_text_view_new())) diff --git a/libs/uilib/uilib.h b/libs/uilib/uilib.h index f02a5172..fe03b9d8 100644 --- a/libs/uilib/uilib.h +++ b/libs/uilib/uilib.h @@ -439,9 +439,24 @@ namespace ui { , ); + struct TableAttach { + unsigned int left, right, top, bottom; + }; + + struct TableAttachOptions { + // todo: type safety + unsigned int x, y; + }; + + struct TablePadding { + unsigned int x, y; + }; + WRAP(Table, Container, _GtkTable, (), Table(std::size_t rows, std::size_t columns, bool homogenous); , + // 5 = expand | fill + void attach(Widget child, TableAttach attach, TableAttachOptions options = {5, 5}, TablePadding padding = {0, 0}); ); WRAP(TextView, Container, _GtkTextView, (), diff --git a/radiant/build.cpp b/radiant/build.cpp index d4285bf4..666e04b5 100644 --- a/radiant/build.cpp +++ b/radiant/build.cpp @@ -839,9 +839,7 @@ ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi window.add(table1); { auto vbox = create_dialog_vbox( 4 ); - gtk_table_attach( table1, vbox , 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table1.attach(vbox, {1, 2, 0, 1}, {GTK_FILL, GTK_FILL}); { auto button = create_dialog_button( "OK", G_CALLBACK( dialog_button_ok ), &modal ); vbox.pack_start( button, FALSE, FALSE, 0 ); @@ -853,9 +851,7 @@ ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi } { auto frame = create_dialog_frame( "Build menu" ); - gtk_table_attach( table1, frame , 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table1.attach(frame, {0, 1, 0, 1}); { auto scr = create_scrolled_window( ui::Policy::NEVER, ui::Policy::AUTOMATIC, 4 ); frame.add(scr); @@ -890,9 +886,7 @@ ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi } { auto frame = create_dialog_frame( "Commandline" ); - gtk_table_attach( table1, frame , 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + table1.attach(frame, {0, 1, 1, 2}); { auto scr = create_scrolled_window( ui::Policy::NEVER, ui::Policy::AUTOMATIC, 4 ); frame.add(scr); diff --git a/radiant/dialog.cpp b/radiant/dialog.cpp index 2a6e4138..769b4e67 100644 --- a/radiant/dialog.cpp +++ b/radiant/dialog.cpp @@ -548,11 +548,11 @@ void Dialog::addRadio( ui::VBox vbox, const char* name, int& data, StringArrayRa } void Dialog::addRadioIcons( ui::VBox vbox, const char* name, StringArrayRange icons, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){ - ui::Widget table = ui::Table( 2, icons.last - icons.first, FALSE ); - table.show();; + auto table = ui::Table(2, icons.last - icons.first, FALSE); + table.show(); - 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); GSList* group = 0; ui::RadioButton radio{ui::null}; @@ -561,15 +561,11 @@ void Dialog::addRadioIcons( ui::VBox vbox, const char* name, StringArrayRange ic guint pos = static_cast( icon - icons.first ); auto image = new_local_image( *icon ); image.show(); - gtk_table_attach( GTK_TABLE( table ), image , pos, pos + 1, 0, 1, - (GtkAttachOptions) ( 0 ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(image, {pos, pos + 1, 0, 1}, {0, 0}); radio = ui::RadioButton(GTK_RADIO_BUTTON(gtk_radio_button_new( group ))); radio.show(); - gtk_table_attach( GTK_TABLE( table ), radio, pos, pos + 1, 1, 2, - (GtkAttachOptions) ( 0 ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(radio, {pos, pos + 1, 1, 2}, {0, 0}); group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radio ) ); } diff --git a/radiant/entityinspector.cpp b/radiant/entityinspector.cpp index 4aa63242..2aefe7d1 100644 --- a/radiant/entityinspector.cpp +++ b/radiant/entityinspector.cpp @@ -730,7 +730,7 @@ int g_spawnflag_count; int spawn_table[MAX_FLAGS]; // we change the layout depending on how many spawn flags we need to display // the table is a 4x4 in which we need to put the comment box g_entityClassComment and the spawn flags.. -GtkTable* g_spawnflagsTable; +ui::Table g_spawnflagsTable{ui::null}; ui::VBox g_attributeBox{ui::null}; typedef std::vector EntityAttributes; @@ -840,7 +840,7 @@ void SurfaceFlags_setEntityClass( EntityClass* eclass ){ g_current_flags = eclass; - int spawnflag_count = 0; + unsigned int spawnflag_count = 0; { // do a first pass to count the spawn flags, don't touch the widgets, we don't know in what state they are @@ -870,7 +870,7 @@ void SurfaceFlags_setEntityClass( EntityClass* eclass ){ g_spawnflag_count = spawnflag_count; { - for ( int i = 0; i < g_spawnflag_count; ++i ) + for (unsigned int i = 0; (int) i < g_spawnflag_count; ++i) { auto widget = ui::CheckButton(g_entitySpawnflagsCheck[i] ); widget.show(); @@ -878,9 +878,7 @@ void SurfaceFlags_setEntityClass( EntityClass* eclass ){ StringOutputStream str( 16 ); str << LowerCase( eclass->flagnames[spawn_table[i]] ); - gtk_table_attach( g_spawnflagsTable, widget, i % 4, i % 4 + 1, i / 4, i / 4 + 1, - (GtkAttachOptions)( GTK_FILL ), - (GtkAttachOptions)( GTK_FILL ), 0, 0 ); + g_spawnflagsTable.attach(widget, {i % 4, i % 4 + 1, i / 4, i / 4 + 1}, {GTK_FILL, GTK_FILL}); widget.unref(); auto label = ui::Label(GTK_LABEL(gtk_bin_get_child(GTK_BIN(widget)) )); @@ -1444,9 +1442,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, entry , 1, 2, 0, 1, - (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(entry, {1, 2, 0, 1}, {GTK_EXPAND | GTK_FILL, 0}); gtk_widget_set_events( entry , GDK_KEY_PRESS_MASK ); entry.connect( "key_press_event", G_CALLBACK( EntityEntry_keypress ), 0 ); g_entityKeyEntry = entry; @@ -1455,9 +1451,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, entry , 1, 2, 1, 2, - (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(entry, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0}); gtk_widget_set_events( entry , GDK_KEY_PRESS_MASK ); entry.connect( "key_press_event", G_CALLBACK( EntityEntry_keypress ), 0 ); g_entityValueEntry = entry; @@ -1466,18 +1460,14 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ { auto label = ui::Label( "Value" ); label.show(); - gtk_table_attach( table, label , 0, 1, 1, 2, - (GtkAttachOptions)( GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(label, {0, 1, 1, 2}, {GTK_FILL, 0}); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); } { auto label = ui::Label( "Key" ); label.show(); - gtk_table_attach( table, label , 0, 1, 0, 1, - (GtkAttachOptions)( GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(label, {0, 1, 0, 1}, {GTK_FILL, 0}); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); } } diff --git a/radiant/findtexturedialog.cpp b/radiant/findtexturedialog.cpp index 3be09fdb..14dc5406 100644 --- a/radiant/findtexturedialog.cpp +++ b/radiant/findtexturedialog.cpp @@ -128,7 +128,7 @@ FindTextureDialog::~FindTextureDialog(){ } ui::Window FindTextureDialog::BuildDialog(){ - ui::Widget table{ui::null}, label{ui::null}; + ui::Widget label{ui::null}; ui::Widget button{ui::null}; ui::Entry entry{ui::null}; @@ -143,31 +143,25 @@ ui::Window FindTextureDialog::BuildDialog(){ vbox.show(); hbox.pack_start( vbox, TRUE, TRUE, 0 ); - table = ui::Table( 2, 2, FALSE ); + auto table = ui::Table(2, 2, FALSE); table.show(); vbox.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); label = ui::Label( "Find:" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {0, 1, 0, 1}, {GTK_FILL, 0}); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); label = ui::Label( "Replace:" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {0, 1, 1, 2}, {GTK_FILL, 0}); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(entry, {1, 2, 0, 1}, {GTK_EXPAND | GTK_FILL, 0}); entry.connect( "focus_in_event", G_CALLBACK( find_focus_in ), 0 ); AddDialogData( *GTK_ENTRY(entry), m_strFind ); @@ -175,9 +169,7 @@ ui::Window FindTextureDialog::BuildDialog(){ entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(entry, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0}); entry.connect( "focus_in_event", G_CALLBACK( replace_focus_in ), 0 ); AddDialogData( *GTK_ENTRY(entry), m_strReplace ); diff --git a/radiant/gtkdlgs.cpp b/radiant/gtkdlgs.cpp index 9f07e893..fdecfc99 100644 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@ -210,9 +210,7 @@ ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal window.add(table1); { auto vbox = create_dialog_vbox( 4 ); - gtk_table_attach( table1, vbox , 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table1.attach(vbox, {1, 2, 0, 1}, {GTK_FILL, GTK_FILL}); { auto button = create_dialog_button( "OK", G_CALLBACK( dialog_button_ok ), &modal ); vbox.pack_start( button, FALSE, FALSE, 0 ); @@ -224,9 +222,7 @@ ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal } { auto frame = create_dialog_frame( "Project settings" ); - gtk_table_attach( table1, frame , 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + table1.attach(frame, {0, 1, 0, 1}, {GTK_EXPAND | GTK_FILL, GTK_FILL}); { auto table2 = create_dialog_table( ( globalMappingMode().do_mapping_mode ) ? 4 : 3, 2, 4, 4, 4 ); frame.add(table2); @@ -234,9 +230,7 @@ ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal { auto label = ui::Label( "Select mod" ); label.show(); - gtk_table_attach( table2, label , 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table2.attach(label, {0, 1, 0, 1}, {GTK_FILL, 0}); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); } { @@ -249,9 +243,7 @@ ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal gtk_combo_box_text_append_text( dialog.game_combo.game_select, globalGameComboConfiguration().custom ); dialog.game_combo.game_select.show(); - gtk_table_attach( table2, dialog.game_combo.game_select , 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table2.attach(dialog.game_combo.game_select, {1, 2, 0, 1}, {GTK_EXPAND | GTK_FILL, 0}); dialog.game_combo.game_select.connect( "changed", G_CALLBACK( OnSelchangeComboWhatgame ), &dialog.game_combo ); } @@ -259,17 +251,13 @@ ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal { auto label = ui::Label( "fs_game" ); label.show(); - gtk_table_attach( table2, label , 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table2.attach(label, {0, 1, 1, 2}, {GTK_FILL, 0}); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table2, entry , 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table2.attach(entry, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0}); dialog.game_combo.fsgame_entry = entry; } @@ -277,9 +265,7 @@ ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal if ( globalMappingMode().do_mapping_mode ) { auto label = ui::Label( "Mapping mode" ); label.show(); - gtk_table_attach( table2, label , 0, 1, 3, 4, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table2.attach(label, {0, 1, 3, 4}, {GTK_FILL, 0}); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); auto combo = ui::ComboBoxText(ui::New); @@ -287,9 +273,7 @@ ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal gtk_combo_box_text_append_text( combo, globalMappingMode().mp_mapping_mode ); combo.show(); - gtk_table_attach( table2, combo , 1, 2, 3, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table2.attach(combo, {1, 2, 3, 4}, {GTK_EXPAND | GTK_FILL, 0}); dialog.gamemode_combo = combo; } @@ -514,49 +498,37 @@ void DoAbout(){ { auto label = ui::Label( "Vendor:" ); label.show(); - gtk_table_attach( table, label , 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {0, 1, 0, 1}, {GTK_FILL, 0}); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); } { auto label = ui::Label( "Version:" ); label.show(); - gtk_table_attach( table, label , 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {0, 1, 1, 2}, {GTK_FILL, 0}); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); } { auto label = ui::Label( "Renderer:" ); label.show(); - gtk_table_attach( table, label , 0, 1, 2, 3, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {0, 1, 2, 3}, {GTK_FILL, 0}); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); } { auto label = ui::Label( reinterpret_cast( glGetString( GL_VENDOR ) ) ); label.show(); - gtk_table_attach( table, label , 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {1, 2, 0, 1}, {GTK_FILL, 0}); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); } { auto label = ui::Label( reinterpret_cast( glGetString( GL_VERSION ) ) ); label.show(); - gtk_table_attach( table, label , 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {1, 2, 1, 2}, {GTK_FILL, 0}); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); } { auto label = ui::Label( reinterpret_cast( glGetString( GL_RENDERER ) ) ); label.show(); - gtk_table_attach( table, label , 1, 2, 2, 3, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {1, 2, 2, 3}, {GTK_FILL, 0}); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); } } @@ -625,34 +597,26 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){ { auto label = ui::Label( "Texture x:" ); label.show(); - gtk_table_attach( table, label , 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {0, 1, 0, 1}, {GTK_FILL, 0}); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); } { auto label = ui::Label( "Texture y:" ); label.show(); - gtk_table_attach( table, label , 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {0, 1, 1, 2}, {GTK_FILL, 0}); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, entry , 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(entry, {1, 2, 0, 1}, {GTK_EXPAND | GTK_FILL, 0}); x = entry; } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, entry , 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(entry, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0}); y = entry; } diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index a40a923c..eae58cdd 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -2402,15 +2402,15 @@ ui::Widget create_main_statusbar( ui::Widget pStatusLabel[c_count_status] ){ gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); gtk_misc_set_padding( GTK_MISC( label ), 4, 2 ); label.show(); - gtk_table_attach_defaults( table, label , 0, 1, 0, 1 ); + table.attach(label, {0, 1, 0, 1}); pStatusLabel[c_command_status] = ui::Widget(label ); } - for ( int i = 1; i < c_count_status; ++i ) + for (unsigned int i = 1; (int) i < c_count_status; ++i) { auto frame = ui::Frame(); frame.show(); - gtk_table_attach_defaults( table, frame , i, i + 1, 0, 1 ); + table.attach(frame, {i, i + 1, 0, 1}); gtk_frame_set_shadow_type( frame, GTK_SHADOW_IN ); auto label = ui::Label( "Label" ); diff --git a/radiant/map.cpp b/radiant/map.cpp index 8da86544..6ed505fa 100644 --- a/radiant/map.cpp +++ b/radiant/map.cpp @@ -786,9 +786,7 @@ void DoMapInfo(){ { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, entry , 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(entry, {1, 2, 0, 1}, {GTK_EXPAND | GTK_FILL, 0}); gtk_editable_set_editable( GTK_EDITABLE(entry), FALSE ); brushes_entry = entry; @@ -796,9 +794,7 @@ void DoMapInfo(){ { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, entry , 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(entry, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0}); gtk_editable_set_editable( GTK_EDITABLE(entry), FALSE ); entities_entry = entry; @@ -806,17 +802,13 @@ void DoMapInfo(){ { ui::Widget label = ui::Label( "Total Brushes" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {0, 1, 0, 1}, {GTK_FILL, 0}); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); } { ui::Widget label = ui::Label( "Total Entities" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {0, 1, 1, 2}, {GTK_FILL, 0}); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); } } @@ -2051,32 +2043,24 @@ void DoFind(){ { ui::Widget label = ui::Label( "Entity number" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, - (GtkAttachOptions) ( 0 ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + (table).attach(label, {0, 1, 0, 1}, {0, 0}); } { ui::Widget label = ui::Label( "Brush number" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, - (GtkAttachOptions) ( 0 ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + (table).attach(label, {0, 1, 1, 2}, {0, 0}); } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, entry , 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(entry, {1, 2, 0, 1}, {GTK_EXPAND | GTK_FILL, 0}); gtk_widget_grab_focus( entry ); entity = entry; } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, entry , 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(entry, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0}); brush = entry; } diff --git a/radiant/patchdialog.cpp b/radiant/patchdialog.cpp index 77ea3a65..c38469e3 100644 --- a/radiant/patchdialog.cpp +++ b/radiant/patchdialog.cpp @@ -595,16 +595,12 @@ ui::Window PatchInspector::BuildDialog(){ { auto label = ui::Label( "Row:" ); label.show(); - gtk_table_attach( table, label , 0, 1, 0, 1, - (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(label, {0, 1, 0, 1}, {(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0)}, {0, 0}); } { auto label = ui::Label( "Column:" ); label.show(); - gtk_table_attach( table, label , 1, 2, 0, 1, - (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(label, {1, 2, 0, 1}, {(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0)}, {0, 0}); } { auto combo = ui::ComboBoxText(ui::New); @@ -612,9 +608,7 @@ ui::Window PatchInspector::BuildDialog(){ AddDialogData( *GTK_COMBO_BOX(combo), m_nRow ); combo.show(); - gtk_table_attach( table, combo , 0, 1, 1, 2, - (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(combo, {0, 1, 1, 2}, {(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0)}, {0, 0}); gtk_widget_set_size_request( combo , 60, -1 ); m_pRowCombo = combo; } @@ -625,9 +619,7 @@ ui::Window PatchInspector::BuildDialog(){ AddDialogData( *GTK_COMBO_BOX(combo), m_nCol ); combo.show(); - gtk_table_attach( table, combo , 1, 2, 1, 2, - (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(combo, {1, 2, 1, 2}, {(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0)}, {0, 0}); gtk_widget_set_size_request( combo , 60, -1 ); m_pColCombo = combo; } @@ -640,44 +632,32 @@ ui::Window PatchInspector::BuildDialog(){ { auto label = ui::Label( "X:" ); label.show(); - gtk_table_attach( table, label , 0, 1, 0, 1, - (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(label, {0, 1, 0, 1}, {GTK_EXPAND | GTK_FILL, 0}); } { auto label = ui::Label( "Y:" ); label.show(); - gtk_table_attach( table, label , 0, 1, 1, 2, - (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(label, {0, 1, 1, 2}, {GTK_EXPAND | GTK_FILL, 0}); } { auto label = ui::Label( "Z:" ); label.show(); - gtk_table_attach( table, label , 0, 1, 2, 3, - (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(label, {0, 1, 2, 3}, {GTK_EXPAND | GTK_FILL, 0}); } { auto label = ui::Label( "S:" ); label.show(); - gtk_table_attach( table, label , 0, 1, 3, 4, - (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(label, {0, 1, 3, 4}, {GTK_EXPAND | GTK_FILL, 0}); } { auto label = ui::Label( "T:" ); label.show(); - gtk_table_attach( table, label , 0, 1, 4, 5, - (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(label, {0, 1, 4, 5}, {GTK_EXPAND | GTK_FILL, 0}); } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, entry , 1, 2, 0, 1, - (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(entry, {1, 2, 0, 1}, {GTK_EXPAND | GTK_FILL, 0}); AddDialogData( *GTK_ENTRY(entry), m_fX ); entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 ); @@ -685,9 +665,7 @@ ui::Window PatchInspector::BuildDialog(){ { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, entry , 1, 2, 1, 2, - (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(entry, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0}); AddDialogData( *GTK_ENTRY(entry), m_fY ); entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 ); @@ -695,9 +673,7 @@ ui::Window PatchInspector::BuildDialog(){ { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, entry , 1, 2, 2, 3, - (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(entry, {1, 2, 2, 3}, {GTK_EXPAND | GTK_FILL, 0}); AddDialogData( *GTK_ENTRY(entry), m_fZ ); entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 ); @@ -705,9 +681,7 @@ ui::Window PatchInspector::BuildDialog(){ { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, entry , 1, 2, 3, 4, - (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(entry, {1, 2, 3, 4}, {GTK_EXPAND | GTK_FILL, 0}); AddDialogData( *GTK_ENTRY(entry), m_fS ); entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 ); @@ -715,9 +689,7 @@ ui::Window PatchInspector::BuildDialog(){ { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, entry , 1, 2, 4, 5, - (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(entry, {1, 2, 4, 5}, {GTK_EXPAND | GTK_FILL, 0}); AddDialogData( *GTK_ENTRY(entry), m_fT ); entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 ); @@ -742,16 +714,12 @@ ui::Window PatchInspector::BuildDialog(){ { auto label = ui::Label( "Fixed" ); label.show(); - gtk_table_attach( table, label , 0, 1, 0, 1, - (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(label, {0, 1, 0, 1}, {GTK_EXPAND | GTK_FILL, 0}); } { auto check = ui::CheckButton(GTK_CHECK_BUTTON( gtk_check_button_new() )); check.show(); - gtk_table_attach( table, check , 1, 2, 0, 1, - (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(check, {1, 2, 0, 1}, {GTK_EXPAND | GTK_FILL, 0}); m_subdivisions.m_enabled = check; guint handler_id = check.connect( "toggled", G_CALLBACK( &Subdivisions::applyGtk ), &m_subdivisions ); g_object_set_data( G_OBJECT( check ), "handler", gint_to_pointer( handler_id ) ); @@ -759,32 +727,24 @@ ui::Window PatchInspector::BuildDialog(){ { auto label = ui::Label( "Horizontal" ); label.show(); - gtk_table_attach( table, label , 0, 1, 1, 2, - (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(label, {0, 1, 1, 2}, {GTK_EXPAND | GTK_FILL, 0}); } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, entry , 1, 2, 1, 2, - (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(entry, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0}); m_subdivisions.m_horizontal = entry; m_horizontalSubdivisionsEntry.connect( entry ); } { auto label = ui::Label( "Vertical" ); label.show(); - gtk_table_attach( table, label , 0, 1, 2, 3, - (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(label, {0, 1, 2, 3}, {GTK_EXPAND | GTK_FILL, 0}); } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, entry , 1, 2, 2, 3, - (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(entry, {1, 2, 2, 3}, {GTK_EXPAND | GTK_FILL, 0}); m_subdivisions.m_vertical = entry; m_verticalSubdivisionsEntry.connect( entry ); } @@ -826,67 +786,51 @@ ui::Window PatchInspector::BuildDialog(){ { auto label = ui::Label( "Horizontal Shift Step" ); label.show(); - gtk_table_attach( table, label , 2, 4, 0, 1, - (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(label, {2, 4, 0, 1}, {GTK_FILL | GTK_EXPAND, 0}); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); } { auto label = ui::Label( "Vertical Shift Step" ); label.show(); - gtk_table_attach( table, label , 2, 4, 1, 2, - (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(label, {2, 4, 1, 2}, {GTK_FILL | GTK_EXPAND, 0}); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); } { auto label = ui::Label( "Horizontal Stretch Step" ); label.show(); - gtk_table_attach( table, label , 2, 3, 2, 3, - (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(label, {2, 3, 2, 3}, {GTK_FILL | GTK_EXPAND, 0}); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); } { auto button = ui::Button( "Flip" ); button.show(); - gtk_table_attach( table, button , 3, 4, 2, 3, - (GtkAttachOptions)( GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(button, {3, 4, 2, 3}, {GTK_FILL, 0}); button.connect( "clicked", G_CALLBACK( OnBtnPatchFlipX ), 0 ); gtk_widget_set_size_request( button , 60, -1 ); } { auto label = ui::Label( "Vertical Stretch Step" ); label.show(); - gtk_table_attach( table, label , 2, 3, 3, 4, - (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(label, {2, 3, 3, 4}, {GTK_FILL | GTK_EXPAND, 0}); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); } { auto button = ui::Button( "Flip" ); button.show(); - gtk_table_attach( table, button , 3, 4, 3, 4, - (GtkAttachOptions)( GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(button, {3, 4, 3, 4}, {GTK_FILL, 0}); button.connect( "clicked", G_CALLBACK( OnBtnPatchFlipY ), 0 ); gtk_widget_set_size_request( button , 60, -1 ); } { auto label = ui::Label( "Rotate Step" ); label.show(); - gtk_table_attach( table, label , 2, 4, 4, 5, - (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(label, {2, 4, 4, 5}, {GTK_FILL | GTK_EXPAND, 0}); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, entry , 0, 1, 0, 1, - (GtkAttachOptions)( GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(entry, {0, 1, 0, 1}, {GTK_FILL, 0}); gtk_widget_set_size_request( entry , 50, -1 ); g_object_set_data( G_OBJECT( window ), "hshift_entry", (void *) entry ); // we fill in this data, if no patch is selected the widgets are unmodified when the inspector is raised @@ -899,18 +843,14 @@ ui::Window PatchInspector::BuildDialog(){ auto spin = ui::SpinButton( adj, 1, 0 ); spin.show(); - gtk_table_attach( table, spin , 1, 2, 0, 1, - (GtkAttachOptions)( 0 ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(spin, {1, 2, 0, 1}, {0, 0}); gtk_widget_set_size_request( spin , 10, -1 ); gtk_widget_set_can_focus( spin, false ); } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, entry , 0, 1, 1, 2, - (GtkAttachOptions)( GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(entry, {0, 1, 1, 2}, {GTK_FILL, 0}); gtk_widget_set_size_request( entry , 50, -1 ); entry_set_float( entry, g_pi_globals.shift[1] ); @@ -920,18 +860,14 @@ ui::Window PatchInspector::BuildDialog(){ auto spin = ui::SpinButton( adj, 1, 0 ); spin.show(); - gtk_table_attach( table, spin , 1, 2, 1, 2, - (GtkAttachOptions)( 0 ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(spin, {1, 2, 1, 2}, {0, 0}); gtk_widget_set_size_request( spin , 10, -1 ); gtk_widget_set_can_focus( spin, false ); } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, entry , 0, 1, 2, 3, - (GtkAttachOptions)( GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(entry, {0, 1, 2, 3}, {GTK_FILL, 0}); gtk_widget_set_size_request( entry , 50, -1 ); entry_set_float( entry, g_pi_globals.scale[0] ); @@ -941,18 +877,14 @@ ui::Window PatchInspector::BuildDialog(){ auto spin = ui::SpinButton( adj, 1, 0 ); spin.show(); - gtk_table_attach( table, spin , 1, 2, 2, 3, - (GtkAttachOptions)( 0 ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(spin, {1, 2, 2, 3}, {0, 0}); gtk_widget_set_size_request( spin , 10, -1 ); gtk_widget_set_can_focus( spin, false ); } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, entry , 0, 1, 3, 4, - (GtkAttachOptions)( GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(entry, {0, 1, 3, 4}, {GTK_FILL, 0}); gtk_widget_set_size_request( entry , 50, -1 ); entry_set_float( entry, g_pi_globals.scale[1] ); @@ -962,18 +894,14 @@ ui::Window PatchInspector::BuildDialog(){ auto spin = ui::SpinButton( adj, 1, 0 ); spin.show(); - gtk_table_attach( table, spin , 1, 2, 3, 4, - (GtkAttachOptions)( 0 ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(spin, {1, 2, 3, 4}, {0, 0}); gtk_widget_set_size_request( spin , 10, -1 ); gtk_widget_set_can_focus( spin, false ); } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, entry , 0, 1, 4, 5, - (GtkAttachOptions)( GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(entry, {0, 1, 4, 5}, {GTK_FILL, 0}); gtk_widget_set_size_request( entry , 50, -1 ); entry_set_float( entry, g_pi_globals.rotate ); @@ -983,9 +911,7 @@ ui::Window PatchInspector::BuildDialog(){ auto spin = ui::SpinButton( adj, 1, 0 ); spin.show(); - gtk_table_attach( table, spin , 1, 2, 4, 5, - (GtkAttachOptions)( 0 ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(spin, {1, 2, 4, 5}, {0, 0}); gtk_widget_set_size_request( spin , 10, -1 ); gtk_widget_set_can_focus( spin, false ); } diff --git a/radiant/patchmanip.cpp b/radiant/patchmanip.cpp index dc0772e4..38c68e51 100644 --- a/radiant/patchmanip.cpp +++ b/radiant/patchmanip.cpp @@ -862,17 +862,13 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows, { auto label = ui::Label( "Width:" ); label.show(); - gtk_table_attach( table, label , 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {0, 1, 0, 1}, {GTK_FILL, 0}); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); } { auto label = ui::Label( "Height:" ); label.show(); - gtk_table_attach( table, label , 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {0, 1, 1, 2}, {GTK_FILL, 0}); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); } @@ -896,9 +892,7 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows, D_ITEM( 31 ); // MAX_PATCH_SIZE is 32, so we should be able to do 31... #undef D_ITEM combo.show(); - gtk_table_attach( table, combo , 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(combo, {1, 2, 0, 1}, {GTK_EXPAND | GTK_FILL, 0}); width = combo; } @@ -922,9 +916,7 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows, D_ITEM( 31 ); // MAX_PATCH_SIZE is 32, so we should be able to do 31... #undef D_ITEM combo.show(); - gtk_table_attach( table, combo , 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(combo, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0}); height = combo; } @@ -999,46 +991,34 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){ { auto image = new_local_image( "cap_bevel.png" ); image.show(); - gtk_table_attach( table, image , 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(image, {0, 1, 0, 1}, {GTK_FILL, 0}); } { auto image = new_local_image( "cap_endcap.png" ); image.show(); - gtk_table_attach( table, image , 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(image, {0, 1, 1, 2}, {GTK_FILL, 0}); } { auto image = new_local_image( "cap_ibevel.png" ); image.show(); - gtk_table_attach( table, image , 0, 1, 2, 3, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(image, {0, 1, 2, 3}, {GTK_FILL, 0}); } { auto image = new_local_image( "cap_iendcap.png" ); image.show(); - gtk_table_attach( table, image , 0, 1, 3, 4, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(image, {0, 1, 3, 4}, {GTK_FILL, 0}); } { auto image = new_local_image( "cap_cylinder.png" ); image.show(); - gtk_table_attach( table, image , 0, 1, 4, 5, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(image, {0, 1, 4, 5}, {GTK_FILL, 0}); } GSList* group = 0; { ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Bevel" )); button.show(); - gtk_table_attach( table, button, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(button, {1, 2, 0, 1}, {GTK_FILL | GTK_EXPAND, 0}); group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( button ) ); bevel = button; @@ -1046,9 +1026,7 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){ { ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Endcap" )); button.show(); - gtk_table_attach( table, button, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(button, {1, 2, 1, 2}, {GTK_FILL | GTK_EXPAND, 0}); group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( button ) ); endcap = button; @@ -1056,9 +1034,7 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){ { ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Inverted Bevel" )); button.show(); - gtk_table_attach( table, button, 1, 2, 2, 3, - (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(button, {1, 2, 2, 3}, {GTK_FILL | GTK_EXPAND, 0}); group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( button ) ); ibevel = button; @@ -1066,9 +1042,7 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){ { ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Inverted Endcap" )); button.show(); - gtk_table_attach( table, button, 1, 2, 3, 4, - (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(button, {1, 2, 3, 4}, {GTK_FILL | GTK_EXPAND, 0}); group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( button ) ); iendcap = button; @@ -1076,9 +1050,7 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){ { ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Cylinder" )); button.show(); - gtk_table_attach( table, button, 1, 2, 4, 5, - (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(button, {1, 2, 4, 5}, {GTK_FILL | GTK_EXPAND, 0}); group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( button ) ); cylinder = button; diff --git a/radiant/select.cpp b/radiant/select.cpp index 26547427..98565705 100644 --- a/radiant/select.cpp +++ b/radiant/select.cpp @@ -924,31 +924,23 @@ void DoRotateDlg(){ { ui::Widget label = ui::Label( " X " ); label.show(); - gtk_table_attach( table, label, 0, 1, 0, 1, - (GtkAttachOptions) ( 0 ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {0, 1, 0, 1}, {0, 0}); } { ui::Widget label = ui::Label( " Y " ); label.show(); - gtk_table_attach( table, label, 0, 1, 1, 2, - (GtkAttachOptions) ( 0 ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {0, 1, 1, 2}, {0, 0}); } { ui::Widget label = ui::Label( " Z " ); label.show(); - gtk_table_attach( table, label, 0, 1, 2, 3, - (GtkAttachOptions) ( 0 ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {0, 1, 2, 3}, {0, 0}); } { auto adj = ui::Adjustment( 0, -359, 359, 1, 10, 0 ); auto spin = ui::SpinButton( adj, 1, 0 ); spin.show(); - gtk_table_attach( table, spin , 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(spin, {1, 2, 0, 1}, {GTK_EXPAND | GTK_FILL, 0}); gtk_widget_set_size_request( spin , 64, -1 ); gtk_spin_button_set_wrap( spin, TRUE ); @@ -960,9 +952,7 @@ void DoRotateDlg(){ auto adj = ui::Adjustment( 0, -359, 359, 1, 10, 0 ); auto spin = ui::SpinButton( adj, 1, 0 ); spin.show(); - gtk_table_attach( table, spin , 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(spin, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0}); gtk_widget_set_size_request( spin , 64, -1 ); gtk_spin_button_set_wrap( spin, TRUE ); @@ -972,9 +962,7 @@ void DoRotateDlg(){ auto adj = ui::Adjustment( 0, -359, 359, 1, 10, 0 ); auto spin = ui::SpinButton( adj, 1, 0 ); spin.show(); - gtk_table_attach( table, spin , 1, 2, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(spin, {1, 2, 2, 3}, {GTK_EXPAND | GTK_FILL, 0}); gtk_widget_set_size_request( spin , 64, -1 ); gtk_spin_button_set_wrap( spin, TRUE ); @@ -1077,31 +1065,23 @@ void DoScaleDlg(){ { ui::Widget label = ui::Label( " X " ); label.show(); - gtk_table_attach( table, label, 0, 1, 0, 1, - (GtkAttachOptions) ( 0 ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {0, 1, 0, 1}, {0, 0}); } { ui::Widget label = ui::Label( " Y " ); label.show(); - gtk_table_attach( table, label, 0, 1, 1, 2, - (GtkAttachOptions) ( 0 ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {0, 1, 1, 2}, {0, 0}); } { ui::Widget label = ui::Label( " Z " ); label.show(); - gtk_table_attach( table, label, 0, 1, 2, 3, - (GtkAttachOptions) ( 0 ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {0, 1, 2, 3}, {0, 0}); } { auto entry = ui::Entry(ui::New); entry.text("1.0"); entry.show(); - gtk_table_attach( table, entry, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(entry, {1, 2, 0, 1}, {GTK_EXPAND | GTK_FILL, 0}); g_scale_dialog.x = entry; } @@ -1109,9 +1089,7 @@ void DoScaleDlg(){ auto entry = ui::Entry(ui::New); entry.text("1.0"); entry.show(); - gtk_table_attach( table, entry, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(entry, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0}); g_scale_dialog.y = entry; } @@ -1119,9 +1097,7 @@ void DoScaleDlg(){ auto entry = ui::Entry(ui::New); entry.text("1.0"); entry.show(); - gtk_table_attach( table, entry, 1, 2, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(entry, {1, 2, 2, 3}, {GTK_EXPAND | GTK_FILL, 0}); g_scale_dialog.z = entry; } diff --git a/radiant/surfacedialog.cpp b/radiant/surfacedialog.cpp index bef61cae..ccf5663b 100644 --- a/radiant/surfacedialog.cpp +++ b/radiant/surfacedialog.cpp @@ -620,43 +620,35 @@ ui::Window SurfaceInspector::BuildDialog(){ { - ui::Widget table = ui::Table( 6, 4, FALSE ); + auto table = ui::Table(6, 4, FALSE); table.show(); vbox.pack_start( table, FALSE, FALSE, 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); { ui::Widget label = ui::Label( "Horizontal shift" ); label.show(); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {0, 1, 0, 1}, {GTK_FILL, 0}); } { auto spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 ); m_hshiftIncrement.m_spin = spin; m_hshiftSpinner.connect( spin ); spin.show(); - gtk_table_attach( GTK_TABLE( table ), spin , 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(spin, {1, 2, 0, 1}, {GTK_EXPAND | GTK_FILL, 0}); gtk_widget_set_size_request( spin , 60, -1 ); } { ui::Widget label = ui::Label( "Step" ); label.show(); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); - gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {2, 3, 0, 1}, {GTK_FILL, 0}); } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( GTK_TABLE( table ), entry , 3, 4, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(entry, {3, 4, 0, 1}, {GTK_EXPAND | GTK_FILL, 0}); gtk_widget_set_size_request( entry , 50, -1 ); m_hshiftIncrement.m_entry = entry; m_hshiftEntry.connect( entry ); @@ -665,34 +657,26 @@ ui::Window SurfaceInspector::BuildDialog(){ ui::Widget label = ui::Label( "Vertical shift" ); label.show(); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {0, 1, 1, 2}, {GTK_FILL, 0}); } { auto spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 ); m_vshiftIncrement.m_spin = spin; m_vshiftSpinner.connect( spin ); spin.show(); - gtk_table_attach( GTK_TABLE( table ), spin , 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(spin, {1, 2, 1, 2}, {GTK_FILL, 0}); gtk_widget_set_size_request( spin , 60, -1 ); } { ui::Widget label = ui::Label( "Step" ); label.show(); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); - gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {2, 3, 1, 2}, {GTK_FILL, 0}); } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( GTK_TABLE( table ), entry , 3, 4, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(entry, {3, 4, 1, 2}, {GTK_FILL, 0}); gtk_widget_set_size_request( entry , 50, -1 ); m_vshiftIncrement.m_entry = entry; m_vshiftEntry.connect( entry ); @@ -701,34 +685,26 @@ ui::Window SurfaceInspector::BuildDialog(){ ui::Widget label = ui::Label( "Horizontal stretch" ); label.show(); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {0, 1, 2, 3}, {GTK_FILL, 0}); } { auto spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 5 ); m_hscaleIncrement.m_spin = spin; m_hscaleSpinner.connect( spin ); spin.show(); - gtk_table_attach( GTK_TABLE( table ), spin , 1, 2, 2, 3, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(spin, {1, 2, 2, 3}, {GTK_FILL, 0}); gtk_widget_set_size_request( spin , 60, -1 ); } { ui::Widget label = ui::Label( "Step" ); label.show(); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); - gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 2, 3, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 2, 3 ); + table.attach(label, {2, 3, 2, 3}, {GTK_FILL, 0}); } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( GTK_TABLE( table ), entry , 3, 4, 2, 3, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 2, 3 ); + table.attach(entry, {3, 4, 2, 3}, {GTK_FILL, 0}); gtk_widget_set_size_request( entry , 50, -1 ); m_hscaleIncrement.m_entry = entry; m_hscaleEntry.connect( entry ); @@ -737,34 +713,26 @@ ui::Window SurfaceInspector::BuildDialog(){ ui::Widget label = ui::Label( "Vertical stretch" ); label.show(); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 3, 4, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {0, 1, 3, 4}, {GTK_FILL, 0}); } { auto spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 5 ); m_vscaleIncrement.m_spin = spin; m_vscaleSpinner.connect( spin ); spin.show(); - gtk_table_attach( GTK_TABLE( table ), spin , 1, 2, 3, 4, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(spin, {1, 2, 3, 4}, {GTK_FILL, 0}); gtk_widget_set_size_request( spin , 60, -1 ); } { ui::Widget label = ui::Label( "Step" ); label.show(); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); - gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 3, 4, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {2, 3, 3, 4}, {GTK_FILL, 0}); } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( GTK_TABLE( table ), entry , 3, 4, 3, 4, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(entry, {3, 4, 3, 4}, {GTK_FILL, 0}); gtk_widget_set_size_request( entry , 50, -1 ); m_vscaleIncrement.m_entry = entry; m_vscaleEntry.connect( entry ); @@ -773,18 +741,14 @@ ui::Window SurfaceInspector::BuildDialog(){ ui::Widget label = ui::Label( "Rotate" ); label.show(); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 4, 5, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {0, 1, 4, 5}, {GTK_FILL, 0}); } { auto spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 ); m_rotateIncrement.m_spin = spin; m_rotateSpinner.connect( spin ); spin.show(); - gtk_table_attach( GTK_TABLE( table ), spin , 1, 2, 4, 5, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(spin, {1, 2, 4, 5}, {GTK_FILL, 0}); gtk_widget_set_size_request( spin , 60, -1 ); gtk_spin_button_set_wrap( spin, TRUE ); } @@ -792,16 +756,12 @@ ui::Window SurfaceInspector::BuildDialog(){ ui::Widget label = ui::Label( "Step" ); label.show(); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); - gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 4, 5, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {2, 3, 4, 5}, {GTK_FILL, 0}); } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( GTK_TABLE( table ), entry , 3, 4, 4, 5, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(entry, {3, 4, 4, 5}, {GTK_FILL, 0}); gtk_widget_set_size_request( entry , 50, -1 ); m_rotateIncrement.m_entry = entry; m_rotateEntry.connect( entry ); @@ -810,9 +770,7 @@ ui::Window SurfaceInspector::BuildDialog(){ // match grid button ui::Widget button = ui::Button( "Match Grid" ); button.show(); - gtk_table_attach( GTK_TABLE( table ), button, 2, 4, 5, 6, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(button, {2, 4, 5, 6}, {GTK_EXPAND | GTK_FILL, 0}); button.connect( "clicked", G_CALLBACK( OnBtnMatchGrid ), 0 ); } } @@ -822,46 +780,36 @@ ui::Window SurfaceInspector::BuildDialog(){ frame.show(); vbox.pack_start( frame, FALSE, FALSE, 0 ); { - ui::Widget table = ui::Table( 4, 4, FALSE ); + auto table = ui::Table(4, 4, FALSE); table.show(); frame.add(table); - 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); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); { ui::Widget label = ui::Label( "Brush" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {0, 1, 0, 1}, {GTK_FILL, 0}); } { ui::Widget label = ui::Label( "Patch" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {0, 1, 2, 3}, {GTK_FILL, 0}); } { ui::Widget label = ui::Label( "Width" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {2, 3, 0, 1}, {GTK_FILL, 0}); } { ui::Widget label = ui::Label( "Height" ); label.show(); - gtk_table_attach( GTK_TABLE( table ), label, 3, 4, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(label, {3, 4, 0, 1}, {GTK_FILL, 0}); } { ui::Widget button = ui::Button( "Axial" ); button.show(); - gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(button, {0, 1, 1, 2}, {GTK_EXPAND | GTK_FILL, 0}); button.connect( "clicked", G_CALLBACK( OnBtnAxial ), 0 ); gtk_widget_set_size_request( button, 60, -1 ); @@ -869,9 +817,7 @@ ui::Window SurfaceInspector::BuildDialog(){ { ui::Widget button = ui::Button( "Fit" ); button.show(); - gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(button, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0}); button.connect( "clicked", G_CALLBACK( OnBtnFaceFit ), 0 ); gtk_widget_set_size_request( button, 60, -1 ); @@ -879,9 +825,7 @@ ui::Window SurfaceInspector::BuildDialog(){ { ui::Widget button = ui::Button( "CAP" ); button.show(); - gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 3, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(button, {0, 1, 3, 4}, {GTK_EXPAND | GTK_FILL, 0}); button.connect( "clicked", G_CALLBACK( OnBtnPatchdetails ), 0 ); gtk_widget_set_size_request( button, 60, -1 ); @@ -889,9 +833,7 @@ ui::Window SurfaceInspector::BuildDialog(){ { ui::Widget button = ui::Button( "Set..." ); button.show(); - gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 3, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(button, {1, 2, 3, 4}, {GTK_EXPAND | GTK_FILL, 0}); button.connect( "clicked", G_CALLBACK( OnBtnPatchreset ), 0 ); gtk_widget_set_size_request( button, 60, -1 ); @@ -899,9 +841,7 @@ ui::Window SurfaceInspector::BuildDialog(){ { ui::Widget button = ui::Button( "Natural" ); button.show(); - gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 3, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(button, {2, 3, 3, 4}, {GTK_EXPAND | GTK_FILL, 0}); button.connect( "clicked", G_CALLBACK( OnBtnPatchnatural ), 0 ); gtk_widget_set_size_request( button, 60, -1 ); @@ -909,9 +849,7 @@ ui::Window SurfaceInspector::BuildDialog(){ { ui::Widget button = ui::Button( "Fit" ); button.show(); - gtk_table_attach( GTK_TABLE( table ), button, 3, 4, 3, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(button, {3, 4, 3, 4}, {GTK_EXPAND | GTK_FILL, 0}); button.connect( "clicked", G_CALLBACK( OnBtnPatchFit ), 0 ); gtk_widget_set_size_request( button, 60, -1 ); @@ -919,18 +857,14 @@ ui::Window SurfaceInspector::BuildDialog(){ { auto spin = ui::SpinButton( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 ); spin.show(); - gtk_table_attach( GTK_TABLE( table ), spin, 2, 3, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(spin, {2, 3, 1, 2}, {GTK_EXPAND | GTK_FILL, 0}); gtk_widget_set_size_request( spin, 60, -1 ); AddDialogData( *GTK_SPIN_BUTTON( spin ), m_fitHorizontal ); } { auto spin = ui::SpinButton( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 ); spin.show(); - gtk_table_attach( GTK_TABLE( table ), spin, 3, 4, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + table.attach(spin, {3, 4, 1, 2}, {GTK_EXPAND | GTK_FILL, 0}); gtk_widget_set_size_request( spin, 60, -1 ); AddDialogData( *GTK_SPIN_BUTTON( spin ), m_fitVertical ); } @@ -955,15 +889,13 @@ ui::Window SurfaceInspector::BuildDialog(){ GtkCheckButton** p = m_surfaceFlags; - for ( int c = 0; c != 4; ++c ) + for (unsigned int c = 0; c != 4; ++c) { - for ( int r = 0; r != 8; ++r ) + for (unsigned int r = 0; r != 8; ++r) { auto check = ui::CheckButton( getSurfaceFlagName( c * 8 + r ) ); check.show(); - gtk_table_attach( table, check , c, c + 1, r, r + 1, - (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(check, {c, c + 1, r, r + 1}, {GTK_EXPAND | GTK_FILL, 0}); *p++ = check; guint handler_id = togglebutton_connect_toggled( GTK_TOGGLE_BUTTON( check ), ApplyFlagsCaller( *this ) ); g_object_set_data( G_OBJECT( check ), "handler", gint_to_pointer( handler_id ) ); @@ -991,15 +923,13 @@ ui::Window SurfaceInspector::BuildDialog(){ GtkCheckButton** p = m_contentFlags; - for ( int c = 0; c != 4; ++c ) + for (unsigned int c = 0; c != 4; ++c) { - for ( int r = 0; r != 8; ++r ) + for (unsigned int r = 0; r != 8; ++r) { auto check = ui::CheckButton( getContentFlagName( c * 8 + r ) ); check.show(); - gtk_table_attach( table, check , c, c + 1, r, r + 1, - (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions)( 0 ), 0, 0 ); + table.attach(check, {c, c + 1, r, r + 1}, {GTK_EXPAND | GTK_FILL, 0}); *p++ = check; guint handler_id = togglebutton_connect_toggled( GTK_TOGGLE_BUTTON( check ), ApplyFlagsCaller( *this ) ); g_object_set_data( G_OBJECT( check ), "handler", gint_to_pointer( handler_id ) ); diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index cf623b69..9c89d0b8 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -2001,10 +2001,9 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ g_TextureBrowser.m_parent = toplevel; - ui::Widget table = ui::Table( 3, 3, FALSE ); - ui::Widget frame_table{ui::null}; + auto table = ui::Table(3, 3, FALSE); auto vbox = ui::VBox(FALSE, 0); - gtk_table_attach( GTK_TABLE( table ), vbox, 0, 1, 1, 3, GTK_FILL, GTK_FILL, 0, 0 ); + table.attach(vbox, {0, 1, 1, 3}, {GTK_FILL, GTK_FILL}); vbox.show(); ui::Widget menu_bar{ui::null}; @@ -2021,7 +2020,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ gtk_menu_item_set_submenu( GTK_MENU_ITEM( tools_item ), menu_tools ); gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), tools_item ); - gtk_table_attach( GTK_TABLE( table ), menu_bar, 0, 3, 0, 1, GTK_FILL, GTK_SHRINK, 0, 0 ); + table.attach(menu_bar, {0, 3, 0, 1}, {GTK_FILL, GTK_SHRINK}); menu_bar.show(); } { // Texture TreeView @@ -2040,7 +2039,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ } { // gl_widget scrollbar ui::Widget w = ui::Widget(gtk_vscrollbar_new( ui::Adjustment( 0,0,0,1,1,0 ) )); - gtk_table_attach( GTK_TABLE( table ), w, 2, 3, 1, 2, GTK_SHRINK, GTK_FILL, 0, 0 ); + table.attach(w, {2, 3, 1, 2}, {GTK_SHRINK, GTK_FILL}); w.show(); g_TextureBrowser.m_texture_scroll = w; @@ -2056,7 +2055,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ gtk_widget_set_events( g_TextureBrowser.m_gl_widget, GDK_DESTROY | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK ); gtk_widget_set_can_focus( g_TextureBrowser.m_gl_widget, true ); - gtk_table_attach_defaults( GTK_TABLE( table ), g_TextureBrowser.m_gl_widget, 1, 2, 1, 2 ); + table.attach(g_TextureBrowser.m_gl_widget, {1, 2, 1, 2}); g_TextureBrowser.m_gl_widget.show(); g_TextureBrowser.m_sizeHandler = g_TextureBrowser.m_gl_widget.connect( "size_allocate", G_CALLBACK( TextureBrowser_size_allocate ), &g_TextureBrowser ); @@ -2107,14 +2106,14 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ TextureBrowser_constructSearchButton(); vbox.pack_end(g_TextureBrowser.m_search_button, FALSE, FALSE, 0); } + auto frame_table = ui::Table(3, 3, FALSE); { // Tag frame - frame_table = ui::Table( 3, 3, FALSE ); g_TextureBrowser.m_tag_frame = ui::Frame( "Tag assignment" ); gtk_frame_set_label_align( GTK_FRAME( g_TextureBrowser.m_tag_frame ), 0.5, 0.5 ); gtk_frame_set_shadow_type( GTK_FRAME( g_TextureBrowser.m_tag_frame ), GTK_SHADOW_NONE ); - gtk_table_attach( GTK_TABLE( table ), g_TextureBrowser.m_tag_frame, 1, 3, 2, 3, GTK_FILL, GTK_SHRINK, 0, 0 ); + table.attach(g_TextureBrowser.m_tag_frame, {1, 3, 2, 3}, {GTK_FILL, GTK_SHRINK}); frame_table.show(); @@ -2147,7 +2146,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ scrolled_win.show(); gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( scrolled_win ), g_TextureBrowser.m_assigned_tree ); - gtk_table_attach( GTK_TABLE( frame_table ), scrolled_win, 0, 1, 1, 3, GTK_FILL, GTK_FILL, 0, 0 ); + frame_table.attach(scrolled_win, {0, 1, 1, 3}, {GTK_FILL, GTK_FILL}); } { // available tag list ui::Widget scrolled_win = ui::ScrolledWindow(ui::New); @@ -2175,7 +2174,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ scrolled_win.show(); gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( scrolled_win ), g_TextureBrowser.m_available_tree ); - gtk_table_attach( GTK_TABLE( frame_table ), scrolled_win, 2, 3, 1, 3, GTK_FILL, GTK_FILL, 0, 0 ); + frame_table.attach(scrolled_win, {2, 3, 1, 3}, {GTK_FILL, GTK_FILL}); } { // tag arrow buttons auto m_btn_left = ui::Button(ui::New); @@ -2189,8 +2188,8 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ gtk_widget_set_size_request( m_arrow_left, -1, 68 ); gtk_widget_set_size_request( m_arrow_right, -1, 68 ); - gtk_table_attach( GTK_TABLE( frame_table ), m_btn_left, 1, 2, 1, 2, GTK_SHRINK, GTK_EXPAND, 0, 0 ); - gtk_table_attach( GTK_TABLE( frame_table ), m_btn_right, 1, 2, 2, 3, GTK_SHRINK, GTK_EXPAND, 0, 0 ); + frame_table.attach(m_btn_left, {1, 2, 1, 2}, {GTK_SHRINK, GTK_EXPAND}); + frame_table.attach(m_btn_right, {1, 2, 2, 3}, {GTK_SHRINK, GTK_EXPAND}); m_btn_left.connect( "clicked", G_CALLBACK( TextureBrowser_assignTags ), NULL ); m_btn_right.connect( "clicked", G_CALLBACK( TextureBrowser_removeTags ), NULL ); @@ -2204,8 +2203,8 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ ui::Widget m_lbl_assigned = ui::Label( "Assigned" ); ui::Widget m_lbl_unassigned = ui::Label( "Available" ); - gtk_table_attach( GTK_TABLE( frame_table ), m_lbl_assigned, 0, 1, 0, 1, GTK_EXPAND, GTK_SHRINK, 0, 0 ); - gtk_table_attach( GTK_TABLE( frame_table ), m_lbl_unassigned, 2, 3, 0, 1, GTK_EXPAND, GTK_SHRINK, 0, 0 ); + frame_table.attach(m_lbl_assigned, {0, 1, 0, 1}, {GTK_EXPAND, GTK_SHRINK}); + frame_table.attach(m_lbl_unassigned, {2, 3, 0, 1}, {GTK_EXPAND, GTK_SHRINK}); m_lbl_assigned.show(); m_lbl_unassigned.show(); -- 2.39.2