X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fnetradiant.git;a=blobdiff_plain;f=radiant%2Fpatchmanip.cpp;h=2bb141a1670c1e0c1cf738f328cd57649cc61fa5;hp=6baad5ecd695be70682ca9113fc019ce43ae2089;hb=6e9818d9cddf3880d001a544770c8c2c5187676f;hpb=771bab14ffa4b131540b125aff6554265662f874 diff --git a/radiant/patchmanip.cpp b/radiant/patchmanip.cpp index 6baad5ec..2bb141a1 100644 --- a/radiant/patchmanip.cpp +++ b/radiant/patchmanip.cpp @@ -19,9 +19,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include #include "patchmanip.h" +#include +#include + #include "debugging/debugging.h" @@ -848,26 +850,26 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows, ui::Window window = MainFrame_getWindow().create_dialog_window("Patch density", G_CALLBACK(dialog_delete_callback ), &dialog ); - auto accel = ui::AccelGroup(); + auto accel = ui::AccelGroup(ui::New); window.add_accel_group( accel ); { - GtkHBox* hbox = create_dialog_hbox( 4, 4 ); - gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( hbox ) ); + auto hbox = create_dialog_hbox( 4, 4 ); + window.add(hbox); { GtkTable* table = create_dialog_table( 2, 2, 4, 4 ); gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 ); { - GtkLabel* label = GTK_LABEL( ui::Label( "Width:" ) ); - gtk_widget_show( GTK_WIDGET( label ) ); + auto label = ui::Label( "Width:" ); + label.show(); gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); } { - GtkLabel* label = GTK_LABEL( ui::Label( "Height:" ) ); - gtk_widget_show( GTK_WIDGET( label ) ); + auto label = ui::Label( "Height:" ); + label.show(); gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); @@ -875,8 +877,8 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows, } { - auto combo = ui::ComboBoxText(); -#define D_ITEM( x ) if ( x >= mincols && ( !maxcols || x <= maxcols ) ) gtk_combo_box_text_append_text( combo, # x ) + auto combo = ui::ComboBoxText(ui::New); +#define D_ITEM( x ) if ( x >= mincols && ( !maxcols || x <= maxcols ) ) gtk_combo_box_text_append_text( combo, #x ) D_ITEM( 3 ); D_ITEM( 5 ); D_ITEM( 7 ); @@ -893,7 +895,7 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows, D_ITEM( 29 ); D_ITEM( 31 ); // MAX_PATCH_SIZE is 32, so we should be able to do 31... #undef D_ITEM - gtk_widget_show( GTK_WIDGET( combo ) ); + combo.show(); gtk_table_attach( table, GTK_WIDGET( combo ), 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); @@ -901,8 +903,8 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows, width = combo; } { - auto combo = ui::ComboBoxText(); -#define D_ITEM( x ) if ( x >= minrows && ( !maxrows || x <= maxrows ) ) gtk_combo_box_text_append_text( combo, # x ) + auto combo = ui::ComboBoxText(ui::New); +#define D_ITEM( x ) if ( x >= minrows && ( !maxrows || x <= maxrows ) ) gtk_combo_box_text_append_text( combo, #x ) D_ITEM( 3 ); D_ITEM( 5 ); D_ITEM( 7 ); @@ -919,7 +921,7 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows, D_ITEM( 29 ); D_ITEM( 31 ); // MAX_PATCH_SIZE is 32, so we should be able to do 31... #undef D_ITEM - gtk_widget_show( GTK_WIDGET( combo ) ); + combo.show(); gtk_table_attach( table, GTK_WIDGET( combo ), 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); @@ -936,12 +938,12 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows, gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 ); widget_make_default( button ); gtk_widget_grab_focus( GTK_WIDGET( button ) ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); + gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); } { GtkButton* button = create_dialog_button( "Cancel", G_CALLBACK( dialog_button_cancel ), &dialog ); gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); + gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); } } } @@ -957,7 +959,7 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows, Scene_PatchConstructPrefab( GlobalSceneGraph(), PatchCreator_getBounds(), TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ), prefab, GlobalXYWnd_getCurrentViewType(), w, h ); } - gtk_widget_destroy( GTK_WIDGET( window ) ); + window.destroy(); } @@ -967,64 +969,64 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){ ModalDialog dialog; ModalDialogButton ok_button( dialog, eIDOK ); ModalDialogButton cancel_button( dialog, eIDCANCEL ); - ui::Widget bevel; - ui::Widget ibevel; - ui::Widget endcap; - ui::Widget iendcap; - ui::Widget cylinder; + ui::Widget bevel{ui::null}; + ui::Widget ibevel{ui::null}; + ui::Widget endcap{ui::null}; + ui::Widget iendcap{ui::null}; + ui::Widget cylinder{ui::null}; ui::Window window = MainFrame_getWindow().create_modal_dialog_window( "Cap", dialog ); - auto accel_group = ui::AccelGroup(); + auto accel_group = ui::AccelGroup(ui::New); window.add_accel_group( accel_group ); { - GtkHBox* hbox = create_dialog_hbox( 4, 4 ); - gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( hbox ) ); + auto hbox = create_dialog_hbox( 4, 4 ); + window.add(hbox); { // Gef: Added a vbox to contain the toggle buttons - GtkVBox* radio_vbox = create_dialog_vbox( 4 ); - gtk_container_add( GTK_CONTAINER( hbox ), GTK_WIDGET( radio_vbox ) ); + auto radio_vbox = create_dialog_vbox( 4 ); + hbox.add(radio_vbox); { - GtkTable* table = ui::Table( 5, 2, FALSE ); - gtk_widget_show( GTK_WIDGET( table ) ); + auto table = ui::Table( 5, 2, FALSE ); + table.show(); gtk_box_pack_start( GTK_BOX( radio_vbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 ); gtk_table_set_row_spacings( table, 5 ); gtk_table_set_col_spacings( table, 5 ); { - GtkImage* image = new_local_image( "cap_bevel.png" ); - gtk_widget_show( GTK_WIDGET( image ) ); + auto image = new_local_image( "cap_bevel.png" ); + image.show(); gtk_table_attach( table, GTK_WIDGET( image ), 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); } { - GtkImage* image = new_local_image( "cap_endcap.png" ); - gtk_widget_show( GTK_WIDGET( image ) ); + auto image = new_local_image( "cap_endcap.png" ); + image.show(); gtk_table_attach( table, GTK_WIDGET( image ), 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); } { - GtkImage* image = new_local_image( "cap_ibevel.png" ); - gtk_widget_show( GTK_WIDGET( image ) ); + auto image = new_local_image( "cap_ibevel.png" ); + image.show(); gtk_table_attach( table, GTK_WIDGET( image ), 0, 1, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); } { - GtkImage* image = new_local_image( "cap_iendcap.png" ); - gtk_widget_show( GTK_WIDGET( image ) ); + auto image = new_local_image( "cap_iendcap.png" ); + image.show(); gtk_table_attach( table, GTK_WIDGET( image ), 0, 1, 3, 4, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); } { - GtkImage* image = new_local_image( "cap_cylinder.png" ); - gtk_widget_show( GTK_WIDGET( image ) ); + auto image = new_local_image( "cap_cylinder.png" ); + image.show(); gtk_table_attach( table, GTK_WIDGET( image ), 0, 1, 4, 5, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); @@ -1033,7 +1035,7 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){ GSList* group = 0; { ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Bevel" )); - gtk_widget_show( button ); + button.show(); gtk_table_attach( table, button, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), (GtkAttachOptions) ( 0 ), 0, 0 ); @@ -1043,7 +1045,7 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){ } { ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Endcap" )); - gtk_widget_show( button ); + button.show(); gtk_table_attach( table, button, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), (GtkAttachOptions) ( 0 ), 0, 0 ); @@ -1053,7 +1055,7 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){ } { ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Inverted Bevel" )); - gtk_widget_show( button ); + button.show(); gtk_table_attach( table, button, 1, 2, 2, 3, (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), (GtkAttachOptions) ( 0 ), 0, 0 ); @@ -1063,7 +1065,7 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){ } { ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Inverted Endcap" )); - gtk_widget_show( button ); + button.show(); gtk_table_attach( table, button, 1, 2, 3, 4, (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), (GtkAttachOptions) ( 0 ), 0, 0 ); @@ -1073,7 +1075,7 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){ } { ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Cylinder" )); - gtk_widget_show( button ); + button.show(); gtk_table_attach( table, button, 1, 2, 4, 5, (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), (GtkAttachOptions) ( 0 ), 0, 0 ); @@ -1091,12 +1093,12 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){ auto button = create_modal_dialog_button( "OK", ok_button ); gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 ); widget_make_default( button ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_Return, (GdkModifierType)0, GTK_ACCEL_VISIBLE ); + gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_KEY_Return, (GdkModifierType)0, GTK_ACCEL_VISIBLE ); } { GtkButton* button = create_modal_dialog_button( "Cancel", cancel_button ); gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_Escape, (GdkModifierType)0, GTK_ACCEL_VISIBLE ); + gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_KEY_Escape, (GdkModifierType)0, GTK_ACCEL_VISIBLE ); } } } @@ -1123,7 +1125,7 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){ } } - gtk_widget_destroy( GTK_WIDGET( window ) ); + window.destroy(); return ret; }