X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=radiant%2Ffindtexturedialog.cpp;h=d74fc6578ac7dcabc442a1ee328a58019e839659;hb=80b20450bbbf8e35a83167c468b39f65044f5ff2;hp=57cce140d252703bb2388e308fbd011579a2b8da;hpb=e2b92e121264da56e42426150f338c6e2220fc09;p=xonotic%2Fnetradiant.git diff --git a/radiant/findtexturedialog.cpp b/radiant/findtexturedialog.cpp index 57cce140..d74fc657 100644 --- a/radiant/findtexturedialog.cpp +++ b/radiant/findtexturedialog.cpp @@ -27,6 +27,8 @@ #include "findtexturedialog.h" +#include + #include "debugging/debugging.h" #include "ishaders.h" @@ -48,7 +50,7 @@ static void setReplaceStr( const char* name ); static void setFindStr( const char* name ); static bool isOpen(); static void show(); -typedef FreeCaller<&FindTextureDialog::show> ShowCaller; +typedef FreeCaller ShowCaller; static void updateTextures( const char* name ); FindTextureDialog(); @@ -88,12 +90,12 @@ static void OnApply( ui::Widget widget, gpointer data ){ FindTextureDialog_apply(); } -static void OnFind( GtkWidget* widget, gpointer data ){ +static void OnFind( ui::Widget widget, gpointer data ){ g_FindTextureDialog.exportData(); FindTextureDialog_apply(); } -static void OnOK( GtkWidget* widget, gpointer data ){ +static void OnOK( ui::Widget widget, gpointer data ){ g_FindTextureDialog.exportData(); FindTextureDialog_apply(); g_FindTextureDialog.HideDlg(); @@ -126,82 +128,75 @@ FindTextureDialog::~FindTextureDialog(){ } ui::Window FindTextureDialog::BuildDialog(){ - ui::Widget vbox, hbox, table, label; - ui::Widget button, check, entry; + ui::Widget label{ui::null}; + ui::Widget button{ui::null}; + ui::Entry entry{ui::null}; - ui::Window dlg = ui::Window(create_floating_window( "Find / Replace Texture(s)", m_parent )); + auto dlg = ui::Window(create_floating_window( "Find / Replace Texture(s)", m_parent )); - hbox = ui::HBox( FALSE, 5 ); + auto hbox = ui::HBox( FALSE, 5 ); hbox.show(); - gtk_container_add( GTK_CONTAINER( dlg ), GTK_WIDGET( hbox ) ); + dlg.add(hbox); gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 ); - vbox = ui::VBox( FALSE, 5 ); + auto vbox = ui::VBox( FALSE, 5 ); vbox.show(); - gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 ); + hbox.pack_start( vbox, TRUE, TRUE, 0 ); - table = ui::Table( 2, 2, FALSE ); + auto table = ui::Table(2, 2, FALSE); table.show(); - gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 ); - gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); - gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + vbox.pack_start( table, TRUE, TRUE, 0 ); + 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(); + 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 ); - g_signal_connect( G_OBJECT( entry ), "focus_in_event", + 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 ); - GlobalTextureEntryCompletion::instance().connect( GTK_ENTRY( entry ) ); + AddDialogData( entry, m_strFind ); + GlobalTextureEntryCompletion::instance().connect( entry ); - entry = ui::Entry(); + 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 ); - g_signal_connect( G_OBJECT( entry ), "focus_in_event", + 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 ); - GlobalTextureEntryCompletion::instance().connect( GTK_ENTRY( entry ) ); + AddDialogData( entry, m_strReplace ); + GlobalTextureEntryCompletion::instance().connect( entry ); - check = ui::CheckButton( "Within selected brushes only" ); + auto check = ui::CheckButton( "Within selected brushes only" ); check.show(); - gtk_box_pack_start( GTK_BOX( vbox ), check, TRUE, TRUE, 0 ); - AddDialogData( *GTK_TOGGLE_BUTTON( check ), m_bSelectedOnly ); + vbox.pack_start( check, TRUE, TRUE, 0 ); + AddDialogData( check, m_bSelectedOnly ); vbox = ui::VBox( FALSE, 5 ); vbox.show(); - gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), FALSE, FALSE, 0 ); + hbox.pack_start( vbox, FALSE, FALSE, 0 ); button = ui::Button( "Apply" ); button.show(); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", + vbox.pack_start( button, FALSE, FALSE, 0 ); + button.connect( "clicked", G_CALLBACK( OnApply ), 0 ); - gtk_widget_set_size_request( button, 60, -1 ); + button.dimensions(60, -1); button = ui::Button( "Close" ); button.show(); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", + vbox.pack_start( button, FALSE, FALSE, 0 ); + button.connect( "clicked", G_CALLBACK( OnClose ), 0 ); - gtk_widget_set_size_request( button, 60, -1 ); + button.dimensions(60, -1); return dlg; } @@ -219,7 +214,7 @@ void FindTextureDialog::updateTextures( const char* name ){ } bool FindTextureDialog::isOpen(){ - return gtk_widget_get_visible( g_FindTextureDialog.GetWidget() ) == TRUE; + return g_FindTextureDialog.GetWidget().visible(); } void FindTextureDialog::setFindStr( const char* name ){