From 465884e260039bad1a333c51b6013edd361a63cd Mon Sep 17 00:00:00 2001 From: TimePath Date: Sat, 22 Jul 2017 21:00:58 +1000 Subject: [PATCH] Wrap g_signal_connect --- contrib/bkgrnd2d/dialog.cpp | 23 +-- contrib/bobtoolz/dialogs/dialogs-gtk.cpp | 226 +++++++++++------------ contrib/brushexport/interface.cpp | 25 +-- contrib/camera/dialogs.cpp | 76 ++++---- contrib/gtkgensurf/gendlgs.cpp | 94 +++++----- contrib/gtkgensurf/view.cpp | 21 +-- contrib/hydratoolz/plugin.cpp | 20 +- contrib/prtview/AboutDialog.cpp | 10 +- contrib/prtview/ConfigDialog.cpp | 75 ++++---- contrib/prtview/LoadPortalFileDialog.cpp | 14 +- contrib/sunplug/sunplug.cpp | 22 +-- libs/gtkutil/accelerator.cpp | 22 +-- libs/gtkutil/cursor.cpp | 2 +- libs/gtkutil/dialog.cpp | 6 +- libs/gtkutil/glwidget.cpp | 6 +- libs/gtkutil/messagebox.cpp | 2 +- libs/gtkutil/nonmodal.cpp | 20 +- libs/gtkutil/paned.cpp | 16 +- libs/gtkutil/widget.cpp | 8 +- libs/gtkutil/window.cpp | 18 +- libs/uilib/CMakeLists.txt | 4 + libs/uilib/uilib.h | 16 ++ plugins/entity/CMakeLists.txt | 4 + plugins/mapq3/CMakeLists.txt | 4 + plugins/textool/2DView.cpp | 8 +- plugins/textool/TexTool.cpp | 32 ++-- radiant/build.cpp | 11 +- radiant/camwindow.cpp | 24 +-- radiant/console.cpp | 6 +- radiant/dialog.cpp | 4 +- radiant/entityinspector.cpp | 36 ++-- radiant/entitylist.cpp | 4 +- radiant/feedback.cpp | 4 +- radiant/findtexturedialog.cpp | 8 +- radiant/groupdialog.cpp | 2 +- radiant/gtkdlgs.cpp | 8 +- radiant/gtkmisc.cpp | 6 +- radiant/mainframe.cpp | 14 +- radiant/patchdialog.cpp | 42 ++--- radiant/pluginmenu.cpp | 2 +- radiant/plugintoolbar.cpp | 4 +- radiant/preferences.cpp | 8 +- radiant/surfacedialog.cpp | 32 ++-- radiant/texwindow.cpp | 38 ++-- radiant/windowobservers.cpp | 10 +- radiant/xywindow.cpp | 20 +- 46 files changed, 527 insertions(+), 530 deletions(-) diff --git a/contrib/bkgrnd2d/dialog.cpp b/contrib/bkgrnd2d/dialog.cpp index 7ec945b4..f66fb6fb 100644 --- a/contrib/bkgrnd2d/dialog.cpp +++ b/contrib/bkgrnd2d/dialog.cpp @@ -213,15 +213,13 @@ CBackgroundDialogPage::CBackgroundDialogPage( VIEWTYPE vt ){ gtk_widget_show( m_pFileLabel ); w = ui::Button( "Browse..." ); - g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( browse_callback ), - ( gpointer ) this ); + w.connect( "clicked", G_CALLBACK( browse_callback ), ( gpointer ) this ); gtk_box_pack_start( GTK_BOX( hbox ),w, FALSE, FALSE, 5 ); gtk_tooltips_set_tip( pTooltips, w, "Select a file", NULL ); gtk_widget_show( w ); w = ui::Button( "Reload" ); - g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( reload_callback ), - ( gpointer ) this ); + w.connect( "clicked", G_CALLBACK( reload_callback ), ( gpointer ) this ); // TODO disable until we have file // gtk_widget_set_sensitive(w,FALSE); gtk_tooltips_set_tip( pTooltips, w, "Reload current file", NULL ); @@ -246,8 +244,7 @@ CBackgroundDialogPage::CBackgroundDialogPage( VIEWTYPE vt ){ w = ui::HScale( 0.0, 1.0, 0.01 ); gtk_range_set_value( GTK_RANGE( w ),0.5 ); gtk_scale_set_value_pos( GTK_SCALE( w ),GTK_POS_LEFT ); - g_signal_connect( G_OBJECT( w ), "value-changed", - G_CALLBACK( alpha_adjust_callback ), ( gpointer ) this ); + w.connect( "value-changed", G_CALLBACK( alpha_adjust_callback ), ( gpointer ) this ); gtk_box_pack_start( GTK_BOX( hbox ),w, TRUE, TRUE, 5 ); gtk_tooltips_set_tip( pTooltips, w, "Set image transparancy", NULL ); gtk_widget_show( w ); @@ -265,16 +262,14 @@ CBackgroundDialogPage::CBackgroundDialogPage( VIEWTYPE vt ){ w = ui::Button( "from selection" ); gtk_box_pack_start( GTK_BOX( hbox ),w, TRUE, FALSE, 5 ); - g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( size_sel_callback ), - ( gpointer ) this ); + w.connect( "clicked", G_CALLBACK( size_sel_callback ), ( gpointer ) this ); gtk_tooltips_set_tip( pTooltips, w, "Set the size of the image to the bounding rectangle of all selected brushes and entities", NULL ); gtk_widget_show( w ); if ( m_vt == XY ) { w = ui::Button( "from map mins/maxs" ); gtk_box_pack_start( GTK_BOX( hbox ),w, TRUE, FALSE, 2 ); - g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( size_mm_callback ), - ( gpointer ) this ); + w.connect( "clicked", G_CALLBACK( size_mm_callback ), ( gpointer ) this ); gtk_tooltips_set_tip( pTooltips, w, "Set the size of the image using the mapcoordsmins and mapcoordsmaxs keys of the worldspawn entity", NULL ); gtk_widget_show( w ); } @@ -318,11 +313,9 @@ void InitBackgroundDialog(){ // GTK_STOCK_CLOSE, // GTK_RESPONSE_CLOSE, NULL ); - g_signal_connect( GTK_OBJECT( pDialogWnd ), "delete_event", - G_CALLBACK( close_callback ), NULL ); - g_signal_connect( GTK_OBJECT( pDialogWnd ), "response", - G_CALLBACK( response_callback ), NULL ); -// g_signal_connect( GTK_OBJECT (pDialogWnd), "expose_event", G_CALLBACK( ci_expose ), NULL ); + pDialogWnd.connect( "delete_event", G_CALLBACK( close_callback ), NULL ); + pDialogWnd.connect( "response", G_CALLBACK( response_callback ), NULL ); +// pDialogWnd.connect( "expose_event", G_CALLBACK( ci_expose ), NULL ); pTooltips = gtk_tooltips_new(); diff --git a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp index 954747bc..183d163a 100644 --- a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp +++ b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp @@ -34,17 +34,17 @@ ---------------------------------*/ typedef struct { - GtkWidget *cbTexChange; - GtkWidget *editTexOld, *editTexNew; + ui::Widget cbTexChange; + ui::Widget editTexOld, editTexNew; - GtkWidget *cbScaleHor, *cbScaleVert; - GtkWidget *editScaleHor, *editScaleVert; + ui::Widget cbScaleHor, cbScaleVert; + ui::Widget editScaleHor, editScaleVert; - GtkWidget *cbShiftHor, *cbShiftVert; - GtkWidget *editShiftHor, *editShiftVert; + ui::Widget cbShiftHor, cbShiftVert; + ui::Widget editShiftHor, editShiftVert; - GtkWidget *cbRotation; - GtkWidget *editRotation; + ui::Widget cbRotation; + ui::Widget editRotation; }dlg_texReset_t; dlg_texReset_t dlgTexReset; @@ -214,10 +214,8 @@ EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMess int loop = 1; auto window = ui::Window( ui::window_type::TOP ); - g_signal_connect( GTK_OBJECT( window ), "delete_event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( GTK_OBJECT( window ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); + window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); + window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); gtk_window_set_title( GTK_WINDOW( window ), lpCaption ); gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); g_object_set_data( G_OBJECT( window ), "loop", &loop ); @@ -244,8 +242,7 @@ EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMess if ( type == eMB_OK ) { w = ui::Button( "Ok" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); gtk_widget_set_can_default(w, true); gtk_widget_grab_default( w ); gtk_widget_show( w ); @@ -254,38 +251,33 @@ EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMess else if ( type == eMB_OKCANCEL ) { w = ui::Button( "Ok" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); w = ui::Button( "Cancel" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); gtk_widget_show( w ); ret = eIDCANCEL; } else if ( type == eMB_YESNOCANCEL ) { w = ui::Button( "Yes" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) ); gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); w = ui::Button( "No" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) ); gtk_widget_show( w ); w = ui::Button( "Cancel" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); gtk_widget_show( w ); ret = eIDCANCEL; } @@ -293,16 +285,14 @@ EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMess { w = ui::Button( "Yes" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) ); gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); w = ui::Button( "No" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) ); gtk_widget_show( w ); ret = eIDNO; } @@ -321,15 +311,15 @@ EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMess } EMessageBoxReturn DoIntersectBox( IntersectRS* rs ){ - GtkWidget *w, *hbox; + GtkWidget *hbox; GtkWidget *check1, *check2; EMessageBoxReturn ret; int loop = 1; auto window = ui::Window( ui::window_type::TOP ); - g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); + window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); + window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); gtk_window_set_title( GTK_WINDOW( window ), "Intersect" ); gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); @@ -356,9 +346,9 @@ EMessageBoxReturn DoIntersectBox( IntersectRS* rs ){ gtk_box_pack_start( GTK_BOX( vbox ), radio2, FALSE, FALSE, 2 ); gtk_widget_show( radio2 ); - w = gtk_hseparator_new(); - gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 ); - gtk_widget_show( w ); + auto hsep = ui::Widget(gtk_hseparator_new()); + gtk_box_pack_start( GTK_BOX( vbox ), hsep, FALSE, FALSE, 2 ); + hsep.show(); check1 = ui::CheckButton( "Include Detail Brushes" ); gtk_box_pack_start( GTK_BOX( vbox ), check1, FALSE, FALSE, 0 ); @@ -374,9 +364,9 @@ EMessageBoxReturn DoIntersectBox( IntersectRS* rs ){ // ---- hbox ---- ok/cancel buttons - w = ui::Button( "Ok" ); + auto w = ui::Button( "Ok" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); @@ -384,7 +374,7 @@ EMessageBoxReturn DoIntersectBox( IntersectRS* rs ){ w = ui::Button( "Cancel" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); gtk_widget_show( w ); ret = eIDCANCEL; @@ -416,7 +406,7 @@ EMessageBoxReturn DoIntersectBox( IntersectRS* rs ){ } EMessageBoxReturn DoPolygonBox( PolygonRS* rs ){ - GtkWidget *w, *hbox, *vbox2, *hbox2; + GtkWidget *hbox, *vbox2, *hbox2; GtkWidget *check1, *check2, *check3; GtkWidget *text1, *text2; @@ -426,8 +416,8 @@ EMessageBoxReturn DoPolygonBox( PolygonRS* rs ){ auto window = ui::Window( ui::window_type::TOP ); - g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); + window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); + window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); gtk_window_set_title( GTK_WINDOW( window ), "Polygon Builder" ); gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); @@ -469,10 +459,10 @@ EMessageBoxReturn DoPolygonBox( PolygonRS* rs ){ gtk_box_pack_start( GTK_BOX( hbox2 ), text1, FALSE, FALSE, 2 ); gtk_widget_show( text1 ); - w = ui::Label( "Number Of Sides" ); - gtk_box_pack_start( GTK_BOX( hbox2 ), w, FALSE, FALSE, 2 ); - gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT ); - gtk_widget_show( w ); + auto l = ui::Label( "Number Of Sides" ); + gtk_box_pack_start( GTK_BOX( hbox2 ), l, FALSE, FALSE, 2 ); + gtk_label_set_justify( GTK_LABEL( l ), GTK_JUSTIFY_LEFT ); + gtk_widget_show( l ); // ---- /hbox2 ---- @@ -487,10 +477,10 @@ EMessageBoxReturn DoPolygonBox( PolygonRS* rs ){ gtk_box_pack_start( GTK_BOX( hbox2 ), text2, FALSE, FALSE, 2 ); gtk_widget_show( text2 ); - w = ui::Label( "Border Width" ); - gtk_box_pack_start( GTK_BOX( hbox2 ), w, FALSE, FALSE, 2 ); - gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT ); - gtk_widget_show( w ); + l = ui::Label( "Border Width" ); + gtk_box_pack_start( GTK_BOX( hbox2 ), l, FALSE, FALSE, 2 ); + gtk_label_set_justify( GTK_LABEL( l ), GTK_JUSTIFY_LEFT ); + gtk_widget_show( l ); // ---- /hbox2 ---- @@ -528,9 +518,9 @@ EMessageBoxReturn DoPolygonBox( PolygonRS* rs ){ // ---- hbox ---- - w = ui::Button( "Ok" ); + auto w = ui::Button( "Ok" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); @@ -538,7 +528,7 @@ EMessageBoxReturn DoPolygonBox( PolygonRS* rs ){ w = ui::Button( "Cancel" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); gtk_widget_show( w ); ret = eIDCANCEL; @@ -586,7 +576,6 @@ EMessageBoxReturn DoPolygonBox( PolygonRS* rs ){ // for stair builder stuck as close as i could to the MFC version // obviously feel free to change it at will :) EMessageBoxReturn DoBuildStairsBox( BuildStairsRS* rs ){ - GtkWidget *w; GtkWidget *textStairHeight, *textRiserTex, *textMainTex; GtkWidget *radioNorth, *radioSouth, *radioEast, *radioWest; // i'm guessing we can't just abuse 'w' for these if we're getting a value GtkWidget *radioOldStyle, *radioBobStyle, *radioCornerStyle; @@ -599,8 +588,8 @@ EMessageBoxReturn DoBuildStairsBox( BuildStairsRS* rs ){ auto window = ui::Window( ui::window_type::TOP ); - g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); + window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); + window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); gtk_window_set_title( GTK_WINDOW( window ), "Stair Builder" ); @@ -621,11 +610,11 @@ EMessageBoxReturn DoBuildStairsBox( BuildStairsRS* rs ){ gtk_widget_show( hbox ); // dunno if you want this text or not ... - w = ui::Label( text ); + ui::Widget w = ui::Label( text ); gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 ); // not entirely sure on all the parameters / what they do ... gtk_widget_show( w ); - w = gtk_hseparator_new(); + w = ui::Widget(gtk_hseparator_new()); gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 ); gtk_widget_show( w ); @@ -761,7 +750,7 @@ EMessageBoxReturn DoBuildStairsBox( BuildStairsRS* rs ){ gtk_widget_show( w ); // -------------------------- // - w = gtk_hseparator_new(); + w = ui::Widget(gtk_hseparator_new()); gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 ); gtk_widget_show( w ); @@ -771,14 +760,14 @@ EMessageBoxReturn DoBuildStairsBox( BuildStairsRS* rs ){ w = ui::Button( "OK" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); w = ui::Button( "Cancel" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); gtk_widget_show( w ); ret = eIDCANCEL; @@ -842,11 +831,10 @@ EMessageBoxReturn DoBuildStairsBox( BuildStairsRS* rs ){ } EMessageBoxReturn DoDoorsBox( DoorRS* rs ){ - GtkWidget *hbox, *w; + GtkWidget *hbox; GtkWidget *textFrontBackTex, *textTrimTex; GtkWidget *checkScaleMainH, *checkScaleMainV, *checkScaleTrimH, *checkScaleTrimV; GtkWidget *comboMain, *comboTrim; - GtkWidget *buttonSetMain, *buttonSetTrim; GtkWidget *radioNS, *radioEW; GSList *radioOrientation; TwinWidget tw1, tw2; @@ -855,8 +843,8 @@ EMessageBoxReturn DoDoorsBox( DoorRS* rs ){ auto window = ui::Window( ui::window_type::TOP ); - g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); + window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); + window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); gtk_window_set_title( GTK_WINDOW( window ), "Door Builder" ); @@ -888,7 +876,7 @@ EMessageBoxReturn DoDoorsBox( DoorRS* rs ){ gtk_box_pack_start( GTK_BOX( hbox ), textFrontBackTex, FALSE, FALSE, 0 ); gtk_widget_show( textFrontBackTex ); - w = ui::Label( "Door Front/Back Texture" ); + ui::Widget w = ui::Label( "Door Front/Back Texture" ); gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 ); gtk_widget_show( w ); @@ -955,8 +943,8 @@ EMessageBoxReturn DoDoorsBox( DoorRS* rs ){ tw1.one = textFrontBackTex; tw1.two = GTK_COMBO_BOX(comboMain); - buttonSetMain = ui::Button( "Set As Main Texture" ); - g_signal_connect( GTK_OBJECT( buttonSetMain ), "clicked", G_CALLBACK( dialog_button_callback_settex ), &tw1 ); + auto buttonSetMain = ui::Button( "Set As Main Texture" ); + buttonSetMain.connect( "clicked", G_CALLBACK( dialog_button_callback_settex ), &tw1 ); gtk_box_pack_start( GTK_BOX( hbox ), buttonSetMain, FALSE, FALSE, 0 ); gtk_widget_show( buttonSetMain ); @@ -974,8 +962,8 @@ EMessageBoxReturn DoDoorsBox( DoorRS* rs ){ tw2.one = textTrimTex; tw2.two = GTK_COMBO_BOX(comboTrim); - buttonSetTrim = ui::Button( "Set As Trim Texture" ); - g_signal_connect( GTK_OBJECT( buttonSetTrim ), "clicked", G_CALLBACK( dialog_button_callback_settex ), &tw2 ); + auto buttonSetTrim = ui::Button( "Set As Trim Texture" ); + buttonSetTrim.connect( "clicked", G_CALLBACK( dialog_button_callback_settex ), &tw2 ); gtk_box_pack_start( GTK_BOX( hbox ), buttonSetTrim, FALSE, FALSE, 0 ); gtk_widget_show( buttonSetTrim ); @@ -1002,7 +990,7 @@ EMessageBoxReturn DoDoorsBox( DoorRS* rs ){ // ----------------- // - w = gtk_hseparator_new(); + w = ui::Widget(gtk_hseparator_new()); gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 ); gtk_widget_show( w ); @@ -1014,14 +1002,14 @@ EMessageBoxReturn DoDoorsBox( DoorRS* rs ){ w = ui::Button( "OK" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); w = ui::Button( "Cancel" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); gtk_widget_show( w ); ret = eIDCANCEL; @@ -1058,18 +1046,18 @@ EMessageBoxReturn DoDoorsBox( DoorRS* rs ){ } EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){ - GtkWidget *w, *hbox; + ui::Widget w, hbox; - GtkWidget *text1, *text2, *text3; - GtkWidget *check1, *check2; + ui::Entry text1, text2, text3; + ui::Widget check1, check2; EMessageBoxReturn ret; int loop = 1; auto window = ui::Window( ui::window_type::TOP ); - g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); + window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); + window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); gtk_window_set_title( GTK_WINDOW( window ), "Texture Reset" ); gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); @@ -1094,7 +1082,7 @@ EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){ // ---- hbox ---- text1 = ui::Entry( 256 ); - gtk_entry_set_text( (GtkEntry*)text1, "25" ); + gtk_entry_set_text( text1, "25" ); gtk_box_pack_start( GTK_BOX( hbox ), text1, FALSE, FALSE, 2 ); gtk_widget_show( text1 ); @@ -1112,7 +1100,7 @@ EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){ // ---- hbox ---- text2 = ui::Entry( 256 ); - gtk_entry_set_text( (GtkEntry*)text2, "3" ); + gtk_entry_set_text( text2, "3" ); gtk_box_pack_start( GTK_BOX( hbox ), text2, FALSE, FALSE, 2 ); gtk_widget_show( text2 ); @@ -1135,7 +1123,7 @@ EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){ // ---- hbox ---- text3 = ui::Entry( 256 ); - gtk_entry_set_text( (GtkEntry*)text3, "-800" ); + gtk_entry_set_text( text3, "-800" ); gtk_box_pack_start( GTK_BOX( hbox ), text3, FALSE, FALSE, 2 ); gtk_widget_show( text3 ); @@ -1146,7 +1134,7 @@ EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){ // ---- /hbox ---- - w = gtk_hseparator_new(); + w = ui::Widget(gtk_hseparator_new()); gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 ); gtk_widget_show( w ); @@ -1163,7 +1151,7 @@ EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){ // ----------------- // - w = gtk_hseparator_new(); + w = ui::Widget(gtk_hseparator_new()); gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 ); gtk_widget_show( w ); @@ -1175,7 +1163,7 @@ EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){ w = ui::Button( "Enable" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) ); gtk_widget_show( w ); gtk_widget_set_can_default( w, true ); @@ -1183,12 +1171,12 @@ EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){ w = ui::Button( "Disable" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) ); gtk_widget_show( w ); w = ui::Button( "Cancel" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); gtk_widget_show( w ); ret = eIDCANCEL; @@ -1233,14 +1221,14 @@ EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){ } EMessageBoxReturn DoCTFColourChangeBox(){ - GtkWidget *w, *hbox; + ui::Widget w, hbox; EMessageBoxReturn ret; int loop = 1; auto window = ui::Window( ui::window_type::TOP ); - g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); + window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); + window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); gtk_window_set_title( GTK_WINDOW( window ), "CTF Colour Changer" ); gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); @@ -1266,7 +1254,7 @@ EMessageBoxReturn DoCTFColourChangeBox(){ w = ui::Button( "Red->Blue" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); @@ -1274,12 +1262,12 @@ EMessageBoxReturn DoCTFColourChangeBox(){ w = ui::Button( "Blue->Red" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) ); gtk_widget_show( w ); w = ui::Button( "Cancel" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); gtk_widget_show( w ); ret = eIDCANCEL; @@ -1303,15 +1291,15 @@ EMessageBoxReturn DoCTFColourChangeBox(){ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ Str texSelected; - GtkWidget *w, *hbox; + ui::Widget w, hbox; EMessageBoxReturn ret; int loop = 1; auto window = ui::Window( ui::window_type::TOP ); - g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); + window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); + window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); gtk_window_set_title( GTK_WINDOW( window ), "Texture Reset" ); gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); @@ -1357,7 +1345,7 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ // ---- frame ---- dlgTexReset.cbTexChange = ui::CheckButton( "Enabled" ); - g_signal_connect( GTK_OBJECT( dlgTexReset.cbTexChange ), "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL ); + dlgTexReset.cbTexChange.connect( "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL ); gtk_widget_show( dlgTexReset.cbTexChange ); gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbTexChange, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), @@ -1405,7 +1393,7 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ // ---- frame ---- dlgTexReset.cbScaleHor = ui::CheckButton( "Enabled" ); - g_signal_connect( GTK_OBJECT( dlgTexReset.cbScaleHor ), "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL ); + dlgTexReset.cbScaleHor.connect( "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL ); gtk_widget_show( dlgTexReset.cbScaleHor ); gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbScaleHor, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), @@ -1426,7 +1414,7 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ dlgTexReset.cbScaleVert = ui::CheckButton( "Enabled" ); - g_signal_connect( GTK_OBJECT( dlgTexReset.cbScaleVert ), "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL ); + dlgTexReset.cbScaleVert.connect( "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL ); gtk_widget_show( dlgTexReset.cbScaleVert ); gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbScaleVert, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), @@ -1461,7 +1449,7 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ // ---- frame ---- dlgTexReset.cbShiftHor = ui::CheckButton( "Enabled" ); - g_signal_connect( GTK_OBJECT( dlgTexReset.cbShiftHor ), "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL ); + dlgTexReset.cbShiftHor.connect( "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL ); gtk_widget_show( dlgTexReset.cbShiftHor ); gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbShiftHor, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), @@ -1482,7 +1470,7 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ dlgTexReset.cbShiftVert = ui::CheckButton( "Enabled" ); - g_signal_connect( GTK_OBJECT( dlgTexReset.cbShiftVert ), "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL ); + dlgTexReset.cbShiftVert.connect( "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL ); gtk_widget_show( dlgTexReset.cbShiftVert ); gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbShiftVert, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), @@ -1545,7 +1533,7 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ w = ui::Button( "Use Selected Brushes" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); @@ -1553,12 +1541,12 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ w = ui::Button( "Use All Brushes" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) ); gtk_widget_show( w ); w = ui::Button( "Cancel" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); gtk_widget_show( w ); ret = eIDCANCEL; @@ -1634,20 +1622,20 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){ Str texSelected; - GtkWidget *w, *hbox; + ui::Widget w, hbox; - GtkWidget *radiusX, *radiusY; - GtkWidget *angleStart, *angleEnd; - GtkWidget *heightStart, *heightEnd; - GtkWidget *numPoints; + ui::Widget radiusX, radiusY; + ui::Widget angleStart, angleEnd; + ui::Widget heightStart, heightEnd; + ui::Widget numPoints; EMessageBoxReturn ret; int loop = 1; auto window = ui::Window( ui::window_type::TOP ); - g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); + window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); + window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); gtk_window_set_title( GTK_WINDOW( window ), "Train Thing" ); gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); @@ -1832,7 +1820,7 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){ w = ui::Button( "Ok" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); @@ -1840,7 +1828,7 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){ w = ui::Button( "Cancel" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); gtk_widget_show( w ); ret = eIDCANCEL; @@ -1900,8 +1888,8 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){ // ailmanki // add a simple input for the MakeChain thing.. EMessageBoxReturn DoMakeChainBox( MakeChainRS* rs ){ - GtkWidget *w; - GtkWidget *textlinkNum, *textlinkName; + ui::Widget w; + ui::Entry textlinkNum, textlinkName; EMessageBoxReturn ret; int loop = 1; @@ -1909,8 +1897,8 @@ EMessageBoxReturn DoMakeChainBox( MakeChainRS* rs ){ auto window = ui::Window( ui::window_type::TOP ); - g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); + window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); + window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); gtk_window_set_title( GTK_WINDOW( window ), "Make Chain" ); @@ -1935,7 +1923,7 @@ EMessageBoxReturn DoMakeChainBox( MakeChainRS* rs ){ gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 ); gtk_widget_show( w ); - w = gtk_hseparator_new(); + w = ui::Widget(gtk_hseparator_new()); gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 ); gtk_widget_show( w ); @@ -1971,14 +1959,14 @@ EMessageBoxReturn DoMakeChainBox( MakeChainRS* rs ){ w = ui::Button( "OK" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); w = ui::Button( "Cancel" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); gtk_widget_show( w ); ret = eIDCANCEL; @@ -1997,8 +1985,8 @@ EMessageBoxReturn DoMakeChainBox( MakeChainRS* rs ){ dialogError = FALSE; if ( ret == eIDOK ) { - strcpy( rs->linkName, gtk_entry_get_text( (GtkEntry*)textlinkName ) ); - if ( !ValidateTextInt( gtk_entry_get_text( (GtkEntry*)textlinkNum ), "Elements", &rs->linkNum ) ) { + strcpy( rs->linkName, gtk_entry_get_text( textlinkName ) ); + if ( !ValidateTextInt( gtk_entry_get_text( textlinkNum ), "Elements", &rs->linkNum ) ) { dialogError = TRUE; } } diff --git a/contrib/brushexport/interface.cpp b/contrib/brushexport/interface.cpp index 131883ed..83bc5be3 100644 --- a/contrib/brushexport/interface.cpp +++ b/contrib/brushexport/interface.cpp @@ -22,15 +22,10 @@ create_w_plugplug2( void ){ GtkWidget *r_collapsebymaterial; GtkWidget *r_nocollapse; GtkWidget *vbox3; - GtkWidget *b_export; - GtkWidget *b_close; GtkWidget *vbox2; GtkWidget *label1; GtkWidget *ed_materialname; GtkWidget *hbox1; - GtkWidget *b_addmaterial; - GtkWidget *b_removematerial; - GtkWidget *t_exportmaterials; GtkWidget *t_limitmatnames; GtkWidget *t_objects; @@ -86,13 +81,13 @@ create_w_plugplug2( void ){ gtk_widget_show( vbox3 ); gtk_box_pack_start( GTK_BOX( hbox2 ), vbox3, FALSE, FALSE, 0 ); - b_export = gtk_button_new_from_stock( "gtk-save" ); + auto b_export = ui::Button(GTK_BUTTON(gtk_button_new_from_stock( "gtk-save" ))); gtk_widget_set_name( b_export, "b_export" ); gtk_widget_show( b_export ); gtk_box_pack_start( GTK_BOX( vbox3 ), b_export, TRUE, FALSE, 0 ); gtk_container_set_border_width( GTK_CONTAINER( b_export ), 5 ); - b_close = gtk_button_new_from_stock( "gtk-cancel" ); + auto b_close = ui::Button(GTK_BUTTON(gtk_button_new_from_stock( "gtk-cancel" ))); gtk_widget_set_name( b_close, "b_close" ); gtk_widget_show( b_close ); gtk_box_pack_start( GTK_BOX( vbox3 ), b_close, TRUE, FALSE, 0 ); @@ -133,12 +128,12 @@ create_w_plugplug2( void ){ gtk_widget_show( hbox1 ); gtk_box_pack_start( GTK_BOX( vbox2 ), hbox1, FALSE, FALSE, 0 ); - b_addmaterial = gtk_button_new_from_stock( "gtk-add" ); + auto b_addmaterial = ui::Button(GTK_BUTTON(gtk_button_new_from_stock( "gtk-add" ))); gtk_widget_set_name( b_addmaterial, "b_addmaterial" ); gtk_widget_show( b_addmaterial ); gtk_box_pack_start( GTK_BOX( hbox1 ), b_addmaterial, FALSE, FALSE, 0 ); - b_removematerial = gtk_button_new_from_stock( "gtk-remove" ); + auto b_removematerial = ui::Button(GTK_BUTTON(gtk_button_new_from_stock( "gtk-remove" ))); gtk_widget_set_name( b_removematerial, "b_removematerial" ); gtk_widget_show( b_removematerial ); gtk_box_pack_start( GTK_BOX( hbox1 ), b_removematerial, FALSE, FALSE, 0 ); @@ -153,20 +148,20 @@ create_w_plugplug2( void ){ gtk_widget_show( t_objects ); gtk_box_pack_end( GTK_BOX( vbox2 ), t_objects, FALSE, FALSE, 0 ); - t_exportmaterials = gtk_check_button_new_with_mnemonic( "Create material information (.mtl file)" ); + auto t_exportmaterials = ui::CheckButton(GTK_CHECK_BUTTON(gtk_check_button_new_with_mnemonic( "Create material information (.mtl file)" ))); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( t_exportmaterials ), true ); gtk_widget_set_name( t_exportmaterials, "t_exportmaterials" ); gtk_widget_show( t_exportmaterials ); gtk_box_pack_end( GTK_BOX( vbox2 ), t_exportmaterials, FALSE, FALSE, 10 ); using namespace callbacks; - g_signal_connect( G_OBJECT( w_plugplug2 ), "destroy", G_CALLBACK( OnDestroy ), NULL ); + w_plugplug2.connect( "destroy", G_CALLBACK( OnDestroy ), NULL ); g_signal_connect_swapped( G_OBJECT( b_close ), "clicked", G_CALLBACK( OnDestroy ), NULL ); - g_signal_connect( ( gpointer )b_export, "clicked", G_CALLBACK( OnExportClicked ), NULL ); - g_signal_connect( ( gpointer )b_addmaterial, "clicked", G_CALLBACK( OnAddMaterial ), NULL ); - g_signal_connect( ( gpointer )b_removematerial, "clicked", G_CALLBACK( OnRemoveMaterial ), NULL ); - g_signal_connect( ( gpointer )t_exportmaterials, "clicked", G_CALLBACK( OnExportMatClicked ), NULL ); + b_export.connect( "clicked", G_CALLBACK( OnExportClicked ), NULL ); + b_addmaterial.connect( "clicked", G_CALLBACK( OnAddMaterial ), NULL ); + b_removematerial.connect( "clicked", G_CALLBACK( OnRemoveMaterial ), NULL ); + t_exportmaterials.connect( "clicked", G_CALLBACK( OnExportMatClicked ), NULL ); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF( w_plugplug2, w_plugplug2, "w_plugplug2" ); diff --git a/contrib/camera/dialogs.cpp b/contrib/camera/dialogs.cpp index a3b8423d..9425521d 100644 --- a/contrib/camera/dialogs.cpp +++ b/contrib/camera/dialogs.cpp @@ -71,8 +71,8 @@ static gint ci_new( GtkWidget *widget, gpointer data ){ // create the window auto window = ui::Window( ui::window_type::TOP ); gtk_window_set_title( GTK_WINDOW( window ), "New Camera" ); - g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); + window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); + window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pCameraInspectorWnd ) ); g_object_set_data( G_OBJECT( window ), "loop", &loop ); @@ -131,7 +131,7 @@ static gint ci_new( GtkWidget *widget, gpointer data ){ w = ui::Button( "Ok" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); gtk_widget_show( w ); gtk_widget_set_can_default( w, true ); @@ -139,7 +139,7 @@ static gint ci_new( GtkWidget *widget, gpointer data ){ w = ui::Button( "Cancel" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); gtk_widget_show( w ); ret = eIDCANCEL; @@ -364,8 +364,8 @@ static gint ci_rename( GtkWidget *widget, gpointer data ){ // create the window auto window = ui::Window( ui::window_type::TOP ); gtk_window_set_title( GTK_WINDOW( window ), "Rename Path" ); - g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); + window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); + window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pCameraInspectorWnd ) ); g_object_set_data( G_OBJECT( window ), "loop", &loop ); @@ -413,7 +413,7 @@ static gint ci_rename( GtkWidget *widget, gpointer data ){ w = ui::Button( "Ok" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); gtk_widget_show( w ); gtk_widget_set_can_default( w, true ); @@ -421,7 +421,7 @@ static gint ci_rename( GtkWidget *widget, gpointer data ){ w = ui::Button( "Cancel" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); gtk_widget_show( w ); ret = eIDCANCEL; @@ -483,8 +483,8 @@ static gint ci_add_target( GtkWidget *widget, gpointer data ){ // create the window auto window = ui::Window( ui::window_type::TOP ); gtk_window_set_title( GTK_WINDOW( window ), "Add Target" ); - g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); + window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); + window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pCameraInspectorWnd ) ); g_object_set_data( G_OBJECT( window ), "loop", &loop ); @@ -560,7 +560,7 @@ static gint ci_add_target( GtkWidget *widget, gpointer data ){ w = ui::Button( "Ok" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); gtk_widget_show( w ); gtk_widget_set_can_default( w, true ); @@ -568,7 +568,7 @@ static gint ci_add_target( GtkWidget *widget, gpointer data ){ w = ui::Button( "Cancel" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); gtk_widget_show( w ); ret = eIDCANCEL; @@ -831,8 +831,8 @@ static gint ci_add( GtkWidget *widget, gpointer data ){ // create the window auto window = ui::Window( ui::window_type::TOP ); gtk_window_set_title( GTK_WINDOW( window ), "Add Event" ); - g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); + window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); + window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pCameraInspectorWnd ) ); g_object_set_data( G_OBJECT( window ), "loop", &loop ); @@ -900,7 +900,7 @@ static gint ci_add( GtkWidget *widget, gpointer data ){ w = ui::Button( "Ok" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); gtk_widget_show( w ); gtk_widget_set_can_default( w, true ); @@ -908,7 +908,7 @@ static gint ci_add( GtkWidget *widget, gpointer data ){ w = ui::Button( "Cancel" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); gtk_widget_show( w ); ret = eIDCANCEL; @@ -997,9 +997,9 @@ GtkWidget *CreateCameraInspectorDialog( void ){ // create the window auto window = ui::Window( ui::window_type::TOP ); gtk_window_set_title( GTK_WINDOW( window ), "Camera Inspector" ); - g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( ci_close ), NULL ); - g_signal_connect( GTK_OBJECT( window ), "expose_event", G_CALLBACK( ci_expose ), NULL ); - // g_signal_connect( GTK_OBJECT (window), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); + window.connect( "delete_event", G_CALLBACK( ci_close ), NULL ); + window.connect( "expose_event", G_CALLBACK( ci_expose ), NULL ); + // window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pRadiantWnd ) ); // don't use show, as you don't want to have it displayed on startup ;-) @@ -1066,7 +1066,7 @@ GtkWidget *CreateCameraInspectorDialog( void ){ RefreshCamListCombo(); gtk_editable_set_editable( GTK_EDITABLE( GTK_COMBO( g_pCamListCombo )->entry ), FALSE ); - g_signal_connect( GTK_OBJECT( GTK_COMBO( g_pCamListCombo )->entry ), "changed", G_CALLBACK( ci_camlist_changed ), NULL ); + ( GTK_COMBO( g_pCamListCombo )->entry ).connect( "changed", G_CALLBACK( ci_camlist_changed ), NULL ); // -------------------------- // @@ -1098,7 +1098,7 @@ GtkWidget *CreateCameraInspectorDialog( void ){ RefreshPathListCombo(); gtk_editable_set_editable( GTK_EDITABLE( GTK_COMBO( g_pPathListCombo )->entry ), FALSE ); - g_signal_connect( GTK_OBJECT( GTK_COMBO( g_pPathListCombo )->entry ), "changed", G_CALLBACK( ci_pathlist_changed ), NULL ); + ( GTK_COMBO( g_pPathListCombo )->entry ).connect( "changed", G_CALLBACK( ci_pathlist_changed ), NULL ); // -------------------------- // @@ -1111,14 +1111,14 @@ GtkWidget *CreateCameraInspectorDialog( void ){ gtk_widget_show( g_pEditModeEditRadioButton ); g_pEditTypeRadio = gtk_radio_button_get_group( GTK_RADIO_BUTTON( g_pEditModeEditRadioButton ) ); - g_signal_connect( GTK_OBJECT( g_pEditModeEditRadioButton ), "clicked", G_CALLBACK( ci_editmode_edit ), NULL ); + g_pEditModeEditRadioButton.connect( "clicked", G_CALLBACK( ci_editmode_edit ), NULL ); g_pEditModeAddRadioButton = gtk_radio_button_new_with_label( g_pEditTypeRadio, "Add Points" ); gtk_box_pack_start( GTK_BOX( hbox ), g_pEditModeAddRadioButton, FALSE, FALSE, 3 ); gtk_widget_show( g_pEditModeAddRadioButton ); g_pEditTypeRadio = gtk_radio_button_get_group( GTK_RADIO_BUTTON( g_pEditModeAddRadioButton ) ); - g_signal_connect( GTK_OBJECT( g_pEditModeAddRadioButton ), "clicked", G_CALLBACK( ci_editmode_add ), NULL ); + g_pEditModeAddRadioButton.connect( "clicked", G_CALLBACK( ci_editmode_add ), NULL ); // see if we should use a different default if ( g_iEditMode == 1 ) { @@ -1143,23 +1143,23 @@ GtkWidget *CreateCameraInspectorDialog( void ){ w = ui::Button( "Rename..." ); gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_rename ), NULL ); + w.connect( "clicked", G_CALLBACK( ci_rename ), NULL ); gtk_widget_show( w ); w = ui::Button( "Add Target..." ); gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_add_target ), NULL ); + w.connect( "clicked", G_CALLBACK( ci_add_target ), NULL ); gtk_widget_show( w ); // not available in splines library /*w = gtk_button_new_with_label( "Delete Selected" ); gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, TRUE, 0); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_delete_selected ), NULL ); + w.connect( "clicked", G_CALLBACK( ci_delete_selected ), NULL ); gtk_widget_show( w ); w = gtk_button_new_with_label( "Select All" ); gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, TRUE, 0); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_select_all ), NULL ); + w.connect( "clicked", G_CALLBACK( ci_select_all ), NULL ); gtk_widget_show( w );*/ // -------------------------- // @@ -1220,7 +1220,7 @@ GtkWidget *CreateCameraInspectorDialog( void ){ gtk_widget_show( hbox ); g_pTimeLine = ui::Adjustment( 0, 0, 30000, 100, 250, 0 ); - g_signal_connect( GTK_OBJECT( g_pTimeLine ), "value_changed", G_CALLBACK( ci_timeline_changed ), NULL ); + g_pTimeLine.connect( "value_changed", G_CALLBACK( ci_timeline_changed ), NULL ); w = ui::HScale( g_pTimeLine ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); gtk_widget_show( w ); @@ -1260,7 +1260,7 @@ GtkWidget *CreateCameraInspectorDialog( void ){ g_pEventsList = gtk_clist_new( 3 ); scr.add(g_pEventsList); - //g_signal_connect( GTK_OBJECT(g_pEventsList), "select_row", G_CALLBACK (proplist_select_row), NULL); + //g_pEventsList.connect( "select_row", G_CALLBACK (proplist_select_row), NULL); gtk_clist_set_selection_mode( GTK_CLIST( g_pEventsList ), GTK_SELECTION_BROWSE ); gtk_clist_column_titles_hide( GTK_CLIST( g_pEventsList ) ); gtk_clist_set_column_auto_resize( GTK_CLIST( g_pEventsList ), 0, TRUE ); @@ -1274,12 +1274,12 @@ GtkWidget *CreateCameraInspectorDialog( void ){ w = ui::Button( "Add..." ); gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_add ), NULL ); + w.connect( "clicked", G_CALLBACK( ci_add ), NULL ); gtk_widget_show( w ); w = ui::Button( "Del" ); gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_del ), NULL ); + w.connect( "clicked", G_CALLBACK( ci_del ), NULL ); gtk_widget_show( w ); // -------------------------- // @@ -1301,12 +1301,12 @@ GtkWidget *CreateCameraInspectorDialog( void ){ w = gtk_button_new_with_label( "New..." ); gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_new ), NULL ); + w.connect( "clicked", G_CALLBACK( ci_new ), NULL ); gtk_widget_show( w ); w = gtk_button_new_with_label( "Load..." ); gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_load ), NULL ); + w.connect( "clicked", G_CALLBACK( ci_load ), NULL ); gtk_widget_show( w ); // -------------------------- // @@ -1319,12 +1319,12 @@ GtkWidget *CreateCameraInspectorDialog( void ){ w = gtk_button_new_with_label( "Save..." ); gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_save ), NULL ); + w.connect( "clicked", G_CALLBACK( ci_save ), NULL ); gtk_widget_show( w ); w = gtk_button_new_with_label( "Unload" ); gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_unload ), NULL ); + w.connect( "clicked", G_CALLBACK( ci_unload ), NULL ); gtk_widget_show( w ); hbox = gtk_hbox_new( FALSE, 5 ); @@ -1333,12 +1333,12 @@ GtkWidget *CreateCameraInspectorDialog( void ){ w = gtk_button_new_with_label( "Apply" ); gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_apply ), NULL ); + w.connect( "clicked", G_CALLBACK( ci_apply ), NULL ); gtk_widget_show( w ); w = gtk_button_new_with_label( "Preview" ); gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_preview ), NULL ); + w.connect( "clicked", G_CALLBACK( ci_preview ), NULL ); gtk_widget_show( w ); // -------------------------- // @@ -1355,7 +1355,7 @@ GtkWidget *CreateCameraInspectorDialog( void ){ w = gtk_button_new_with_label( "Close" ); gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_close ), NULL ); + w.connect( "clicked", G_CALLBACK( ci_close ), NULL ); gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); diff --git a/contrib/gtkgensurf/gendlgs.cpp b/contrib/gtkgensurf/gendlgs.cpp index fe41d935..881de8af 100644 --- a/contrib/gtkgensurf/gendlgs.cpp +++ b/contrib/gtkgensurf/gendlgs.cpp @@ -1357,8 +1357,8 @@ GtkWidget* create_main_dialog(){ auto dlg = g_pWnd = ui::Window( ui::window_type::TOP ); gtk_window_set_title( GTK_WINDOW( dlg ), gszCaption ); - g_signal_connect( G_OBJECT( dlg ), "delete_event", G_CALLBACK( main_close ), NULL ); - // g_signal_connect (G_OBJECT (dlg), "destroy", G_CALLBACK (gtk_widget_destroy), NULL); + dlg.connect( "delete_event", G_CALLBACK( main_close ), NULL ); + // dlg.connect( "destroy", G_CALLBACK (gtk_widget_destroy), NULL); gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( g_pRadiantWnd ) ); auto hbox = ui::HBox( FALSE, 5 ); @@ -1369,7 +1369,7 @@ GtkWidget* create_main_dialog(){ notebook = gtk_notebook_new(); gtk_widget_show( notebook ); gtk_box_pack_start( GTK_BOX( hbox ), notebook, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( notebook ), "switch_page", + notebook.connect( "switch_page", G_CALLBACK( switch_page ), NULL ); gtk_notebook_set_tab_pos( GTK_NOTEBOOK( notebook ), GTK_POS_TOP ); g_object_set_data( G_OBJECT( dlg ), "notebook", notebook ); @@ -1402,7 +1402,7 @@ GtkWidget* create_main_dialog(){ gtk_box_pack_start( GTK_BOX( vbox ), radio, TRUE, TRUE, 0 ); group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radio ) ); game_radios[i] = radio; - g_signal_connect( G_OBJECT( radio ), "toggled", G_CALLBACK( general_game ), GINT_TO_POINTER( i ) ); + radio.connect( "toggled", G_CALLBACK( general_game ), GINT_TO_POINTER( i ) ); } frame = ui::Frame( "Waveform" ); @@ -1423,7 +1423,7 @@ GtkWidget* create_main_dialog(){ gtk_box_pack_start( GTK_BOX( vbox ), radio, TRUE, TRUE, 0 ); group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radio ) ); wave_radios[i] = radio; - g_signal_connect( G_OBJECT( radio ), "toggled", G_CALLBACK( general_wave ), GINT_TO_POINTER( i ) ); + radio.connect( "toggled", G_CALLBACK( general_wave ), GINT_TO_POINTER( i ) ); } frame = ui::Frame( "Orientation" ); @@ -1444,7 +1444,7 @@ GtkWidget* create_main_dialog(){ gtk_box_pack_start( GTK_BOX( vbox ), radio, TRUE, TRUE, 0 ); group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radio ) ); plane_radios[i] = radio; - g_signal_connect( G_OBJECT( radio ), "toggled", G_CALLBACK( general_plane ), GINT_TO_POINTER( i ) ); + radio.connect( "toggled", G_CALLBACK( general_plane ), GINT_TO_POINTER( i ) ); } table2 = ui::Table( 4, 2, FALSE ); @@ -1494,7 +1494,7 @@ GtkWidget* create_main_dialog(){ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); gtk_widget_set_size_request( entry, 50, -1 ); g_object_set_data( G_OBJECT( dlg ), "wavelength", entry ); - g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &WaveLength ); + entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &WaveLength ); entry = ui::Entry(); gtk_widget_show( entry ); @@ -1503,7 +1503,7 @@ GtkWidget* create_main_dialog(){ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); gtk_widget_set_size_request( entry, 50, -1 ); g_object_set_data( G_OBJECT( dlg ), "amplitude", entry ); - g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Amplitude ); + entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Amplitude ); entry = ui::Entry(); gtk_widget_show( entry ); @@ -1512,10 +1512,10 @@ GtkWidget* create_main_dialog(){ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); gtk_widget_set_size_request( entry, 50, -1 ); g_object_set_data( G_OBJECT( dlg ), "roughness", entry ); - g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Roughness ); + entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Roughness ); adj = ui::Adjustment( 1, 1, 32767, 1, 10, 0 ); - g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( general_random ), NULL ); + adj.connect( "value_changed", G_CALLBACK( general_random ), NULL ); spin = ui::SpinButton( adj, 1, 0 ); gtk_widget_show( spin ); gtk_table_attach( GTK_TABLE( table2 ), spin, 1, 2, 3, 4, @@ -1594,7 +1594,7 @@ GtkWidget* create_main_dialog(){ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); gtk_widget_set_size_request( entry, 50, -1 ); g_object_set_data( G_OBJECT( dlg ), "hmin", entry ); - g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Hll ); + entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Hll ); entry = ui::Entry(); gtk_widget_show( entry ); @@ -1603,7 +1603,7 @@ GtkWidget* create_main_dialog(){ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); gtk_widget_set_size_request( entry, 50, -1 ); g_object_set_data( G_OBJECT( dlg ), "hmax", entry ); - g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Hur ); + entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Hur ); entry = ui::Entry(); gtk_widget_show( entry ); @@ -1612,7 +1612,7 @@ GtkWidget* create_main_dialog(){ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); gtk_widget_set_size_request( entry, 50, -1 ); g_object_set_data( G_OBJECT( dlg ), "vmin", entry ); - g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Vll ); + entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Vll ); entry = ui::Entry(); gtk_widget_show( entry ); @@ -1621,7 +1621,7 @@ GtkWidget* create_main_dialog(){ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); gtk_widget_set_size_request( entry, 50, -1 ); g_object_set_data( G_OBJECT( dlg ), "vmax", entry ); - g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Vur ); + entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Vur ); frame = ui::Frame( "Divisions" ); gtk_widget_show( frame ); @@ -1649,7 +1649,7 @@ GtkWidget* create_main_dialog(){ g_object_set_data( G_OBJECT( dlg ), "nv_text", label ); adj = ui::Adjustment( 8, 1, MAX_ROWS, 1, 10, 0 ); - g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( extents_nhnv_spin ), &NH ); + adj.connect( "value_changed", G_CALLBACK( extents_nhnv_spin ), &NH ); spin = ui::SpinButton( adj, 1, 0 ); gtk_widget_show( spin ); gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 0, 1, @@ -1659,7 +1659,7 @@ GtkWidget* create_main_dialog(){ g_object_set_data( G_OBJECT( dlg ), "nh", spin ); adj = ui::Adjustment( 8, 1, MAX_ROWS, 1, 10, 0 ); - g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( extents_nhnv_spin ), &NV ); + adj.connect( "value_changed", G_CALLBACK( extents_nhnv_spin ), &NV ); spin = ui::SpinButton( adj, 1, 0 ); gtk_widget_show( spin ); gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 1, 2, @@ -1672,7 +1672,7 @@ GtkWidget* create_main_dialog(){ gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, TRUE, 0 ); g_object_set_data( G_OBJECT( dlg ), "use_patches", check ); - g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( extents_use_patches ), NULL ); + check.connect( "toggled", G_CALLBACK( extents_use_patches ), NULL ); // ^Fishman - Snap to grid, replaced scroll bar with a texbox. label = ui::Label( "Snap to grid:" ); @@ -1681,7 +1681,7 @@ GtkWidget* create_main_dialog(){ gtk_object_set_data( GTK_OBJECT( dlg ), "snap_text", label ); adj = ui::Adjustment( 8, 0, 256, 1, 10, 0 ); - g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( extents_snaptogrid_spin ), &SP ); + adj.connect( "value_changed", G_CALLBACK( extents_snaptogrid_spin ), &SP ); spin = ui::SpinButton( adj, 1, 0 ); gtk_widget_show( spin ); gtk_box_pack_start( GTK_BOX( vbox ), spin, FALSE, TRUE, 0 ); @@ -1698,7 +1698,7 @@ GtkWidget* create_main_dialog(){ gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 ); adj = ui::Adjustment( 0, 0, 110, 1, 10, 0 ); - g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( extents_decimate ), NULL ); + adj.connect( "value_changed", G_CALLBACK( extents_decimate ), NULL ); g_object_set_data( G_OBJECT( dlg ), "decimate_adj", adj ); scale = ui::HScale( adj ); gtk_widget_show( scale ); @@ -1749,7 +1749,7 @@ GtkWidget* create_main_dialog(){ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); gtk_widget_set_size_request( entry, 50, -1 ); g_object_set_data( G_OBJECT( dlg ), "z01", entry ); - g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Z01 ); + entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Z01 ); entry = ui::Entry(); gtk_widget_show( entry ); @@ -1758,7 +1758,7 @@ GtkWidget* create_main_dialog(){ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); gtk_widget_set_size_request( entry, 50, -1 ); g_object_set_data( G_OBJECT( dlg ), "z00", entry ); - g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Z00 ); + entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Z00 ); entry = ui::Entry(); gtk_widget_show( entry ); @@ -1767,7 +1767,7 @@ GtkWidget* create_main_dialog(){ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); gtk_widget_set_size_request( entry, 50, -1 ); g_object_set_data( G_OBJECT( dlg ), "z11", entry ); - g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Z11 ); + entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Z11 ); entry = ui::Entry(); gtk_widget_show( entry ); @@ -1776,7 +1776,7 @@ GtkWidget* create_main_dialog(){ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); gtk_widget_set_size_request( entry, 50, -1 ); g_object_set_data( G_OBJECT( dlg ), "z10", entry ); - g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Z10 ); + entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Z10 ); check = ui::CheckButton( "Linear borders" ); gtk_widget_show( check ); @@ -1784,7 +1784,7 @@ GtkWidget* create_main_dialog(){ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); g_object_set_data( G_OBJECT( dlg ), "linearborder", check ); - g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( extents_linearborder ), NULL ); + check.connect( "toggled", G_CALLBACK( extents_linearborder ), NULL ); vbox = ui::VBox( FALSE, 10 ); gtk_widget_show( vbox ); @@ -1819,7 +1819,7 @@ GtkWidget* create_main_dialog(){ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); g_object_set_data( G_OBJECT( dlg ), "bmp_file", entry ); - g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( bitmap_file_entryfocusout ), NULL ); + entry.connect( "focus_out_event", G_CALLBACK( bitmap_file_entryfocusout ), NULL ); hbox2 = ui::HBox( TRUE, 5 ); gtk_widget_show( hbox2 ); @@ -1832,14 +1832,14 @@ GtkWidget* create_main_dialog(){ gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 ); gtk_widget_set_size_request( button, 60, -1 ); g_object_set_data( G_OBJECT( dlg ), "bmp_file_browse", button ); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( bitmap_browse ), NULL ); + button.connect( "clicked", G_CALLBACK( bitmap_browse ), NULL ); button = ui::Button( "Reload" ); gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 ); gtk_widget_set_size_request( button, 60, -1 ); g_object_set_data( G_OBJECT( dlg ), "bmp_reload", button ); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( bitmap_reload ), NULL ); + button.connect( "clicked", G_CALLBACK( bitmap_reload ), NULL ); table = ui::Table( 2, 2, TRUE ); gtk_widget_show( table ); @@ -1877,7 +1877,7 @@ GtkWidget* create_main_dialog(){ gtk_box_pack_start( GTK_BOX( hbox2 ), entry, FALSE, FALSE, 0 ); gtk_widget_set_size_request( entry, 50, -1 ); g_object_set_data( G_OBJECT( dlg ), "bmp_black", entry ); - g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &gbmp.black_value ); + entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &gbmp.black_value ); hbox2 = ui::HBox( FALSE, 5 ); gtk_widget_show( hbox2 ); @@ -1890,7 +1890,7 @@ GtkWidget* create_main_dialog(){ gtk_box_pack_start( GTK_BOX( hbox2 ), entry, FALSE, FALSE, 0 ); gtk_widget_set_size_request( entry, 50, -1 ); g_object_set_data( G_OBJECT( dlg ), "bmp_white", entry ); - g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &gbmp.white_value ); + entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &gbmp.white_value ); vbox = ui::VBox( FALSE, 10 ); gtk_widget_show( vbox ); @@ -1941,7 +1941,7 @@ GtkWidget* create_main_dialog(){ g_object_set_data( G_OBJECT( dlg ), "fix_rate_text", label ); adj = ui::Adjustment( 0, -65536, 65536, 1, 16, 0 ); - g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( fix_value_changed ), NULL ); + adj.connect( "value_changed", G_CALLBACK( fix_value_changed ), NULL ); spin = ui::SpinButton( adj, 1, 0 ); gtk_widget_show( spin ); gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 0, 1, @@ -1949,7 +1949,7 @@ GtkWidget* create_main_dialog(){ (GtkAttachOptions) ( GTK_EXPAND ), 0, 0 ); gtk_widget_set_size_request( spin, 60, -1 ); g_object_set_data( G_OBJECT( dlg ), "fix_value", spin ); - g_signal_connect( G_OBJECT( spin ), "focus_out_event", G_CALLBACK( fix_value_entryfocusout ), NULL ); + spin.connect( "focus_out_event", G_CALLBACK( fix_value_entryfocusout ), NULL ); entry = ui::Entry(); gtk_widget_show( entry ); @@ -1958,7 +1958,7 @@ GtkWidget* create_main_dialog(){ (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); gtk_widget_set_size_request( entry, 60, -1 ); g_object_set_data( G_OBJECT( dlg ), "fix_range", entry ); - g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( fix_range_entryfocusout ), NULL ); + entry.connect( "focus_out_event", G_CALLBACK( fix_range_entryfocusout ), NULL ); entry = ui::Entry(); gtk_widget_show( entry ); @@ -1967,7 +1967,7 @@ GtkWidget* create_main_dialog(){ (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); gtk_widget_set_size_request( entry, 60, -1 ); g_object_set_data( G_OBJECT( dlg ), "fix_rate", entry ); - g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( fix_rate_entryfocusout ), NULL ); + entry.connect( "focus_out_event", G_CALLBACK( fix_rate_entryfocusout ), NULL ); button = ui::Button( "Free" ); gtk_widget_show( button ); @@ -1976,7 +1976,7 @@ GtkWidget* create_main_dialog(){ (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); gtk_widget_set_size_request( button, 60, -1 ); g_object_set_data( G_OBJECT( dlg ), "fix_free", button ); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( fix_free ), NULL ); + button.connect( "clicked", G_CALLBACK( fix_free ), NULL ); button = ui::Button( "Free All" ); gtk_widget_show( button ); @@ -1985,7 +1985,7 @@ GtkWidget* create_main_dialog(){ (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); gtk_widget_set_size_request( button, 60, -1 ); g_object_set_data( G_OBJECT( dlg ), "fix_freeall", button ); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( fix_freeall ), NULL ); + button.connect( "clicked", G_CALLBACK( fix_freeall ), NULL ); vbox = ui::VBox( FALSE, 10 ); gtk_widget_show( vbox ); @@ -2030,7 +2030,7 @@ GtkWidget* create_main_dialog(){ (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); gtk_widget_set_size_request( entry, 60, -1 ); g_object_set_data( G_OBJECT( dlg ), "texture1", entry ); - g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( texture_entryfocusout ), GINT_TO_POINTER( 0 ) ); + entry.connect( "focus_out_event", G_CALLBACK( texture_entryfocusout ), GINT_TO_POINTER( 0 ) ); entry = ui::Entry(); gtk_widget_show( entry ); @@ -2039,7 +2039,7 @@ GtkWidget* create_main_dialog(){ (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); gtk_widget_set_size_request( entry, 60, -1 ); g_object_set_data( G_OBJECT( dlg ), "texture2", entry ); - g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( texture_entryfocusout ), GINT_TO_POINTER( 1 ) ); + entry.connect( "focus_out_event", G_CALLBACK( texture_entryfocusout ), GINT_TO_POINTER( 1 ) ); entry = ui::Entry(); gtk_widget_show( entry ); @@ -2119,20 +2119,20 @@ GtkWidget* create_main_dialog(){ gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, TRUE, 0 ); g_object_set_data( G_OBJECT( dlg ), "detail", check ); - g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( texture_detail ), NULL ); + check.connect( "toggled", G_CALLBACK( texture_detail ), NULL ); check = ui::CheckButton( "Detail hint brushes" ); gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, TRUE, 0 ); g_object_set_data( G_OBJECT( dlg ), "hint", check ); - g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( texture_hint ), NULL ); + check.connect( "toggled", G_CALLBACK( texture_hint ), NULL ); // ^Fishman - Add terrain key to func_group. check = ui::CheckButton( "Add terrain key" ); gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, TRUE, 0 ); g_object_set_data( G_OBJECT( dlg ), "terrain_ent", check ); - g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( texture_terrainent ), NULL ); + check.connect( "toggled", G_CALLBACK( texture_terrainent ), NULL ); vbox = ui::VBox( FALSE, 5 ); gtk_widget_show( vbox ); @@ -2143,7 +2143,7 @@ GtkWidget* create_main_dialog(){ gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, TRUE, 0 ); gtk_widget_set_size_request( button, 60, -1 ); g_object_set_data( G_OBJECT( dlg ), "go", button ); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( main_go ), NULL ); + button.connect( "clicked", G_CALLBACK( main_go ), NULL ); label = ui::Label( "Settings:" ); gtk_widget_show( label ); @@ -2153,29 +2153,29 @@ GtkWidget* create_main_dialog(){ gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, TRUE, 0 ); g_object_set_data( G_OBJECT( dlg ), "open", button ); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( main_open ), NULL ); + button.connect( "clicked", G_CALLBACK( main_open ), NULL ); button = ui::Button( "Save as..." ); gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, TRUE, 0 ); g_object_set_data( G_OBJECT( dlg ), "save", button ); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( main_save ), NULL ); + button.connect( "clicked", G_CALLBACK( main_save ), NULL ); button = ui::Button( "Defaults" ); gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, TRUE, 0 ); g_object_set_data( G_OBJECT( dlg ), "defaults", button ); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( main_defaults ), NULL ); + button.connect( "clicked", G_CALLBACK( main_defaults ), NULL ); button = ui::Button( "About..." ); gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, TRUE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( main_about ), NULL ); + button.connect( "clicked", G_CALLBACK( main_about ), NULL ); check = ui::CheckButton( "Preview" ); gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, TRUE, 0 ); - g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( main_preview ), NULL ); + check.connect( "toggled", G_CALLBACK( main_preview ), NULL ); g_object_set_data( G_OBJECT( dlg ), "main_preview", check ); // ^Fishman - Antializing for the preview window. @@ -2183,7 +2183,7 @@ GtkWidget* create_main_dialog(){ gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, TRUE, 0 ); g_object_set_data( G_OBJECT( dlg ), "main_antialiasing", check ); - g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( main_antialiasing ), NULL ); + check.connect( "toggled", G_CALLBACK( main_antialiasing ), NULL ); for ( i = 0; i < 5; i++ ) SetDlgValues( i ); diff --git a/contrib/gtkgensurf/view.cpp b/contrib/gtkgensurf/view.cpp index da39689e..65ffc964 100644 --- a/contrib/gtkgensurf/view.cpp +++ b/contrib/gtkgensurf/view.cpp @@ -364,7 +364,6 @@ static void preview_spin( GtkAdjustment *adj, double *data ){ void CreateViewWindow(){ GtkWidget *hbox, *label, *spin; - GtkObject *adj; #ifndef ISOMETRIC elevation = PI / 6.; @@ -373,8 +372,8 @@ void CreateViewWindow(){ auto dlg = g_pWndPreview = ui::Window( ui::window_type::TOP ); gtk_window_set_title( GTK_WINDOW( dlg ), "GtkGenSurf Preview" ); - g_signal_connect( GTK_OBJECT( dlg ), "delete_event", G_CALLBACK( preview_close ), NULL ); - g_signal_connect( GTK_OBJECT( dlg ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); + dlg.connect( "delete_event", G_CALLBACK( preview_close ), NULL ); + dlg.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( g_pWnd ) ); gtk_window_set_default_size( GTK_WINDOW( dlg ), 300, 400 ); @@ -393,15 +392,15 @@ void CreateViewWindow(){ gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_box_pack_start( GTK_BOX( hbox ), label, FALSE, TRUE, 0 ); - adj = ui::Adjustment( 30, -90, 90, 1, 10, 0 ); - g_signal_connect( adj, "value_changed", G_CALLBACK( preview_spin ), &elevation ); + auto adj = ui::Adjustment( 30, -90, 90, 1, 10, 0 ); + adj.connect( "value_changed", G_CALLBACK( preview_spin ), &elevation ); spin = ui::SpinButton( adj, 1, 0 ); gtk_widget_show( spin ); gtk_box_pack_start( GTK_BOX( hbox ), spin, FALSE, TRUE, 0 ); - g_signal_connect( G_OBJECT( spin ), "focus_out_event", G_CALLBACK( doublevariable_spinfocusout ), &elevation ); + spin.connect( "focus_out_event", G_CALLBACK( doublevariable_spinfocusout ), &elevation ); adj = ui::Adjustment( 30, 0, 359, 1, 10, 0 ); - g_signal_connect( adj, "value_changed", G_CALLBACK( preview_spin ), &azimuth ); + adj.connect( "value_changed", G_CALLBACK( preview_spin ), &azimuth ); spin = ui::SpinButton( adj, 1, 0 ); gtk_widget_show( spin ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), TRUE ); @@ -411,7 +410,7 @@ void CreateViewWindow(){ gtk_widget_show( label ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_box_pack_end( GTK_BOX( hbox ), label, FALSE, TRUE, 0 ); - g_signal_connect( G_OBJECT( spin ), "focus_out_event", G_CALLBACK( doublevariable_spinfocusout ), &azimuth ); + spin.connect( "focus_out_event", G_CALLBACK( doublevariable_spinfocusout ), &azimuth ); #endif auto frame = ui::Frame( nullptr ); @@ -422,9 +421,9 @@ void CreateViewWindow(){ g_pPreviewWidget = g_UIGtkTable.m_pfn_glwidget_new( FALSE, NULL ); gtk_widget_set_events( g_pPreviewWidget, GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK ); - g_signal_connect( GTK_OBJECT( g_pPreviewWidget ), "expose_event", G_CALLBACK( expose ), NULL ); - g_signal_connect( GTK_OBJECT( g_pPreviewWidget ), "motion_notify_event", G_CALLBACK( motion ), NULL ); - g_signal_connect( GTK_OBJECT( g_pPreviewWidget ), "button_press_event", + g_pPreviewWidget.connect( "expose_event", G_CALLBACK( expose ), NULL ); + g_pPreviewWidget.connect( "motion_notify_event", G_CALLBACK( motion ), NULL ); + g_pPreviewWidget.connect( "button_press_event", G_CALLBACK( button_press ), NULL ); gtk_widget_show( g_pPreviewWidget ); diff --git a/contrib/hydratoolz/plugin.cpp b/contrib/hydratoolz/plugin.cpp index 71e7ab68..5ca4fad1 100644 --- a/contrib/hydratoolz/plugin.cpp +++ b/contrib/hydratoolz/plugin.cpp @@ -85,9 +85,9 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ int mode = ( uType & MB_TYPEMASK ), ret, loop = 1; auto window = ui::Window( ui::window_type::TOP ); - g_signal_connect( GTK_OBJECT( window ), "delete_event", + window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( GTK_OBJECT( window ), "destroy", + window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); gtk_window_set_title( GTK_WINDOW( window ), lpCaption ); gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); @@ -115,7 +115,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ if ( mode == MB_OK ) { w = ui::Button( "Ok" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); @@ -125,7 +125,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ else if ( mode == MB_OKCANCEL ) { w = ui::Button( "Ok" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); @@ -133,7 +133,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ w = ui::Button( "Cancel" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); gtk_widget_show( w ); ret = IDCANCEL; @@ -141,7 +141,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ else if ( mode == MB_YESNOCANCEL ) { w = ui::Button( "Yes" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDYES ) ); gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); @@ -149,13 +149,13 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ w = ui::Button( "No" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDNO ) ); gtk_widget_show( w ); w = ui::Button( "Cancel" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); gtk_widget_show( w ); ret = IDCANCEL; @@ -164,7 +164,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ { w = ui::Button( "Yes" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDYES ) ); gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); @@ -172,7 +172,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ w = ui::Button( "No" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDNO ) ); gtk_widget_show( w ); ret = IDNO; diff --git a/contrib/prtview/AboutDialog.cpp b/contrib/prtview/AboutDialog.cpp index a0dd6834..70067e0c 100644 --- a/contrib/prtview/AboutDialog.cpp +++ b/contrib/prtview/AboutDialog.cpp @@ -50,14 +50,14 @@ static gint dialog_delete_callback( GtkWidget *widget, GdkEvent* event, gpointer } void DoAboutDlg(){ - GtkWidget *vbox, *button, *label; + GtkWidget *vbox, *label; int loop = 1, ret = IDCANCEL; auto dlg = ui::Window( ui::window_type::TOP ); gtk_window_set_title( GTK_WINDOW( dlg ), "About Portal Viewer" ); - g_signal_connect( GTK_OBJECT( dlg ), "delete_event", + dlg.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( GTK_OBJECT( dlg ), "destroy", + dlg.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); @@ -80,10 +80,10 @@ void DoAboutDlg(){ gtk_widget_show( vbox ); gtk_box_pack_start( GTK_BOX( hbox ), vbox, FALSE, FALSE, 0 ); - button = ui::Button( "OK" ); + auto button = ui::Button( "OK" ); gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( GTK_OBJECT( button ), "clicked", + button.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); gtk_widget_set_size_request( button, 60, -1 ); diff --git a/contrib/prtview/ConfigDialog.cpp b/contrib/prtview/ConfigDialog.cpp index dc89bf49..391c1e6f 100644 --- a/contrib/prtview/ConfigDialog.cpp +++ b/contrib/prtview/ConfigDialog.cpp @@ -54,7 +54,6 @@ static gint dialog_delete_callback( GtkWidget *widget, GdkEvent* event, gpointer // Color selection dialog static int DoColor( PackedColour *c ){ - GtkWidget* dlg; GdkColor clr; int loop = 1, ret = IDCANCEL; @@ -62,20 +61,16 @@ static int DoColor( PackedColour *c ){ clr.blue = (guint16) (GetGValue(*c) * (65535 / 255)); clr.green = (guint16) (GetBValue(*c) * (65535 / 255)); - dlg = gtk_color_selection_dialog_new( "Choose Color" ); + auto dlg = ui::Widget(gtk_color_selection_dialog_new( "Choose Color" )); gtk_color_selection_set_current_color( GTK_COLOR_SELECTION( gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(dlg)) ), &clr ); - g_signal_connect( GTK_OBJECT( dlg ), "delete_event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( GTK_OBJECT( dlg ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); + dlg.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); + dlg.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); GtkWidget *ok_button, *cancel_button; g_object_get(dlg, "ok-button", &ok_button, "cancel-button", &cancel_button, nullptr); - g_signal_connect( GTK_OBJECT(ok_button), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - g_signal_connect( GTK_OBJECT(cancel_button), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); + ui::Widget(ok_button).connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); + ui::Widget(cancel_button).connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); @@ -243,18 +238,16 @@ static void OnClip( GtkWidget *widget, gpointer data ){ } void DoConfigDialog(){ - GtkWidget *hbox, *button, *table; + GtkWidget *hbox, *table; GtkWidget *lw3slider, *lw3label, *lw2slider, *lw2label, *item; - GtkWidget *aa2check, *aa3check, *depthcheck, *linescheck, *polyscheck; GtkWidget *transslider, *translabel, *clipslider, *cliplabel; - GtkWidget *show2check, *show3check, *portalcheck; int loop = 1, ret = IDCANCEL; auto dlg = ui::Window( ui::window_type::TOP ); gtk_window_set_title( GTK_WINDOW( dlg ), "Portal Viewer Configuration" ); - g_signal_connect( GTK_OBJECT( dlg ), "delete_event", + dlg.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( GTK_OBJECT( dlg ), "destroy", + dlg.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); @@ -286,7 +279,7 @@ void DoConfigDialog(){ lw3label = ui::Label( "" ); gtk_widget_show( lw3label ); gtk_box_pack_start( GTK_BOX( hbox ), lw3label, FALSE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT(adj), "value_changed", G_CALLBACK( OnScroll3d ), lw3label ); + adj.connect( "value_changed", G_CALLBACK( OnScroll3d ), lw3label ); table = ui::Table( 2, 4, FALSE ); gtk_widget_show( table ); @@ -294,47 +287,47 @@ void DoConfigDialog(){ gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); - button = ui::Button( "Color" ); + auto button = ui::Button( "Color" ); gtk_widget_show( button ); gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - g_signal_connect( GTK_OBJECT( button ), "clicked", G_CALLBACK( OnColor3d ), NULL ); + button.connect( "clicked", G_CALLBACK( OnColor3d ), NULL ); button = ui::Button( "Depth Color" ); gtk_widget_show( button ); gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - g_signal_connect( GTK_OBJECT( button ), "clicked", G_CALLBACK( OnColorFog ), NULL ); + button.connect( "clicked", G_CALLBACK( OnColorFog ), NULL ); - aa3check = ui::CheckButton( "Anti-Alias (May not work on some video cards)" ); + auto aa3check = ui::CheckButton( "Anti-Alias (May not work on some video cards)" ); gtk_widget_show( aa3check ); gtk_table_attach( GTK_TABLE( table ), aa3check, 1, 4, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - g_signal_connect( GTK_OBJECT( aa3check ), "toggled", G_CALLBACK( OnAntiAlias3d ), NULL ); + aa3check.connect( "toggled", G_CALLBACK( OnAntiAlias3d ), NULL ); - depthcheck = ui::CheckButton( "Depth Cue" ); + auto depthcheck = ui::CheckButton( "Depth Cue" ); gtk_widget_show( depthcheck ); gtk_table_attach( GTK_TABLE( table ), depthcheck, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - g_signal_connect( GTK_OBJECT( depthcheck ), "toggled", G_CALLBACK( OnFog ), NULL ); + depthcheck.connect( "toggled", G_CALLBACK( OnFog ), NULL ); - linescheck = ui::CheckButton( "Lines" ); + auto linescheck = ui::CheckButton( "Lines" ); gtk_widget_show( linescheck ); gtk_table_attach( GTK_TABLE( table ), linescheck, 2, 3, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - g_signal_connect( GTK_OBJECT( linescheck ), "toggled", G_CALLBACK( OnLines ), NULL ); + linescheck.connect( "toggled", G_CALLBACK( OnLines ), NULL ); - polyscheck = ui::CheckButton( "Polygons" ); + auto polyscheck = ui::CheckButton( "Polygons" ); gtk_widget_show( polyscheck ); gtk_table_attach( GTK_TABLE( table ), polyscheck, 3, 4, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - g_signal_connect( GTK_OBJECT( polyscheck ), "toggled", G_CALLBACK( OnPoly ), NULL ); + polyscheck.connect( "toggled", G_CALLBACK( OnPoly ), NULL ); auto zlist = ui::ComboBoxText(); gtk_widget_show( zlist ); @@ -344,7 +337,7 @@ void DoConfigDialog(){ gtk_combo_box_text_append_text(zlist, "Z-Buffer Test Only (recommended for transparent polygons)"); gtk_combo_box_text_append_text(zlist, "Z-Buffer Off"); - g_signal_connect(G_OBJECT(zlist), "changed", G_CALLBACK(+[](GtkComboBox *self, void *) { + zlist.connect("changed", G_CALLBACK(+[](GtkComboBox *self, void *) { OnSelchangeZbuffer(GTK_WIDGET(self), GINT_TO_POINTER(gtk_combo_box_get_active(self))); }), nullptr); @@ -368,7 +361,7 @@ void DoConfigDialog(){ (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( translabel ), 0.0, 0.0 ); - g_signal_connect( GTK_OBJECT(adj), "value_changed", G_CALLBACK( OnScrollTrans ), translabel ); + adj.connect( "value_changed", G_CALLBACK( OnScrollTrans ), translabel ); adj = ui::Adjustment( portals.clip_range, 1, 128, 1, 1, 0 ); clipslider = ui::HScale( adj ); @@ -384,21 +377,21 @@ void DoConfigDialog(){ (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( cliplabel ), 0.0, 0.0 ); - g_signal_connect( GTK_OBJECT(adj), "value_changed", G_CALLBACK( OnScrollClip ), cliplabel ); + adj.connect( "value_changed", G_CALLBACK( OnScrollClip ), cliplabel ); hbox = ui::HBox( TRUE, 5 ); gtk_widget_show( hbox ); gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, FALSE, 0 ); - show3check = ui::CheckButton( "Show" ); + auto show3check = ui::CheckButton( "Show" ); gtk_widget_show( show3check ); gtk_box_pack_start( GTK_BOX( hbox ), show3check, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( show3check ), "toggled", G_CALLBACK( OnConfig3d ), NULL ); + show3check.connect( "toggled", G_CALLBACK( OnConfig3d ), NULL ); - portalcheck = ui::CheckButton( "Portal cubic clipper" ); + auto portalcheck = ui::CheckButton( "Portal cubic clipper" ); gtk_widget_show( portalcheck ); gtk_box_pack_start( GTK_BOX( hbox ), portalcheck, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( portalcheck ), "toggled", G_CALLBACK( OnClip ), NULL ); + portalcheck.connect( "toggled", G_CALLBACK( OnClip ), NULL ); frame = ui::Frame( "2D View" ); gtk_widget_show( frame ); @@ -422,7 +415,7 @@ void DoConfigDialog(){ lw2label = ui::Label( "" ); gtk_widget_show( lw2label ); gtk_box_pack_start( GTK_BOX( hbox ), lw2label, FALSE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT(adj), "value_changed", G_CALLBACK( OnScroll2d ), lw2label ); + adj.connect( "value_changed", G_CALLBACK( OnScroll2d ), lw2label ); hbox = ui::HBox( FALSE, 5 ); gtk_widget_show( hbox ); @@ -431,22 +424,22 @@ void DoConfigDialog(){ button = ui::Button( "Color" ); gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( GTK_OBJECT( button ), "clicked", G_CALLBACK( OnColor2d ), NULL ); + button.connect( "clicked", G_CALLBACK( OnColor2d ), NULL ); gtk_widget_set_size_request( button, 60, -1 ); - aa2check = ui::CheckButton( "Anti-Alias (May not work on some video cards)" ); + auto aa2check = ui::CheckButton( "Anti-Alias (May not work on some video cards)" ); gtk_widget_show( aa2check ); gtk_box_pack_start( GTK_BOX( hbox ), aa2check, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( aa2check ), "toggled", G_CALLBACK( OnAntiAlias2d ), NULL ); + aa2check.connect( "toggled", G_CALLBACK( OnAntiAlias2d ), NULL ); hbox = ui::HBox( FALSE, 5 ); gtk_widget_show( hbox ); gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, FALSE, 0 ); - show2check = ui::CheckButton( "Show" ); + auto show2check = ui::CheckButton( "Show" ); gtk_widget_show( show2check ); gtk_box_pack_start( GTK_BOX( hbox ), show2check, FALSE, FALSE, 0 ); - g_signal_connect( GTK_OBJECT( show2check ), "toggled", G_CALLBACK( OnConfig2d ), NULL ); + show2check.connect( "toggled", G_CALLBACK( OnConfig2d ), NULL ); hbox = ui::HBox( FALSE, 5 ); gtk_widget_show( hbox ); @@ -455,7 +448,7 @@ void DoConfigDialog(){ button = ui::Button( "OK" ); gtk_widget_show( button ); gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( GTK_OBJECT( button ), "clicked", + button.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); gtk_widget_set_size_request( button, 60, -1 ); diff --git a/contrib/prtview/LoadPortalFileDialog.cpp b/contrib/prtview/LoadPortalFileDialog.cpp index 4e64faf8..f6f024c8 100644 --- a/contrib/prtview/LoadPortalFileDialog.cpp +++ b/contrib/prtview/LoadPortalFileDialog.cpp @@ -80,14 +80,14 @@ static void change_clicked( GtkWidget *widget, gpointer data ){ } int DoLoadPortalFileDialog(){ - GtkWidget *hbox, *button, *entry, *check2d, *check3d; + GtkWidget *hbox, *entry, *check2d, *check3d; int loop = 1, ret = IDCANCEL; auto dlg = ui::Window( ui::window_type::TOP ); gtk_window_set_title( GTK_WINDOW( dlg ), "Load .prt" ); - g_signal_connect( GTK_OBJECT( dlg ), "delete_event", + dlg.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( GTK_OBJECT( dlg ), "destroy", + dlg.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); @@ -114,10 +114,10 @@ int DoLoadPortalFileDialog(){ gtk_widget_show( check2d ); gtk_box_pack_start( GTK_BOX( hbox ), check2d, FALSE, FALSE, 0 ); - button = ui::Button( "Change" ); + auto button = ui::Button( "Change" ); gtk_widget_show( button ); gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( GTK_OBJECT( button ), "clicked", G_CALLBACK( change_clicked ), entry ); + button.connect( "clicked", G_CALLBACK( change_clicked ), entry ); gtk_widget_set_size_request( button, 60, -1 ); hbox = ui::HBox( FALSE, 5 ); @@ -127,14 +127,14 @@ int DoLoadPortalFileDialog(){ button = ui::Button( "Cancel" ); gtk_widget_show( button ); gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( GTK_OBJECT( button ), "clicked", + button.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); gtk_widget_set_size_request( button, 60, -1 ); button = ui::Button( "OK" ); gtk_widget_show( button ); gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( GTK_OBJECT( button ), "clicked", + button.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); gtk_widget_set_size_request( button, 60, -1 ); diff --git a/contrib/sunplug/sunplug.cpp b/contrib/sunplug/sunplug.cpp index 974429df..6895bf22 100644 --- a/contrib/sunplug/sunplug.cpp +++ b/contrib/sunplug/sunplug.cpp @@ -257,8 +257,8 @@ void about_plugin_window(){ auto window = ui::Window( ui::window_type::TOP ); // create a window gtk_window_set_transient_for( GTK_WINDOW( window ), SunPlug::main_window ); // make the window to stay in front of the main window - g_signal_connect( G_OBJECT( window ), "delete_event", G_CALLBACK( delete_event ), NULL ); // connect the delete event - g_signal_connect( G_OBJECT( window ), "destroy", G_CALLBACK( destroy ), NULL ); // connect the destroy event for the window + window.connect( "delete_event", G_CALLBACK( delete_event ), NULL ); // connect the delete event + window.connect( "destroy", G_CALLBACK( destroy ), NULL ); // connect the destroy event for the window gtk_window_set_title( GTK_WINDOW( window ), "About SunPlug" ); // set the title of the window for the window gtk_window_set_resizable( GTK_WINDOW( window ), FALSE ); // don't let the user resize the window gtk_window_set_modal( GTK_WINDOW( window ), TRUE ); // force the user not to do something with the other windows @@ -314,7 +314,7 @@ void GetOptimalCoordinates( AABB *levelBoundingBox ){ // MapCoordinator dialog window void MapCoordinator(){ - GtkWidget *table, *label, *spinnerMinX, *spinnerMinY, *spinnerMaxX, *spinnerMaxY, *button; + GtkWidget *table, *label, *spinnerMinX, *spinnerMinY, *spinnerMaxX, *spinnerMaxY; Entity *theWorldspawn = NULL; const char *buffer; char line[20]; @@ -322,8 +322,8 @@ void MapCoordinator(){ // in any case we need a window to show the user what to do auto window = ui::Window( ui::window_type::TOP ); // create the window gtk_window_set_transient_for( GTK_WINDOW( window ), SunPlug::main_window ); // make the window to stay in front of the main window - g_signal_connect( G_OBJECT( window ), "delete_event", G_CALLBACK( delete_event ), NULL ); // connect the delete event for the window - g_signal_connect( G_OBJECT( window ), "destroy", G_CALLBACK( destroy ), NULL ); // connect the destroy event for the window + window.connect( "delete_event", G_CALLBACK( delete_event ), NULL ); // connect the delete event for the window + window.connect( "destroy", G_CALLBACK( destroy ), NULL ); // connect the destroy event for the window gtk_window_set_title( GTK_WINDOW( window ), "ET-MapCoordinator" ); // set the title of the window for the window gtk_window_set_resizable( GTK_WINDOW( window ), FALSE ); // don't let the user resize the window gtk_window_set_modal( GTK_WINDOW( window ), TRUE ); // force the user not to do something with the other windows @@ -370,8 +370,8 @@ void MapCoordinator(){ auto spinner_adj_MaxX = ui::Adjustment( map_maxX, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of maximum x value auto spinner_adj_MaxY = ui::Adjustment( map_maxY, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of maximum y value - button = ui::Button( "Get optimal mapcoords" ); // create button with text - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( input_optimal ), NULL ); // connect button with callback function + auto button = ui::Button( "Get optimal mapcoords" ); // create button with text + button.connect( "clicked", G_CALLBACK( input_optimal ), NULL ); // connect button with callback function gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 2 ); // insert button into vbox gtk_box_pack_start( GTK_BOX( vbox ), gtk_hseparator_new(), FALSE, FALSE, 2 ); // insert separator into vbox @@ -417,11 +417,11 @@ void MapCoordinator(){ msp.worldspawn = theWorldspawn; button = ui::Button( "Set" ); // create button with text - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( set_coordinates ), NULL ); // connect button with callback function + 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 button = ui::Button( "Cancel" ); // create button with text - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( close_window ), NULL ); // connect button with callback function + 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 } else { @@ -431,8 +431,8 @@ void MapCoordinator(){ gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); // text align left gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, FALSE, 2 ); // insert the label in the box - button = ui::Button( "OK" ); // create a button with text - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( close_window ), NULL ); // connect the click event to close the window + auto button = ui::Button( "OK" ); // create a button with text + button.connect( "clicked", G_CALLBACK( close_window ), NULL ); // connect the click event to close the window gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 2 ); // insert the button in the box } diff --git a/libs/gtkutil/accelerator.cpp b/libs/gtkutil/accelerator.cpp index 59ec317c..e55ff5fc 100644 --- a/libs/gtkutil/accelerator.cpp +++ b/libs/gtkutil/accelerator.cpp @@ -304,9 +304,9 @@ gboolean PressedButtons_focus_out( GtkWidget* widget, GdkEventFocus* event, Pres } void PressedButtons_connect( PressedButtons& pressedButtons, ui::Widget widget ){ - g_signal_connect( G_OBJECT( widget ), "button_press_event", G_CALLBACK( PressedButtons_button_press ), &pressedButtons ); - g_signal_connect( G_OBJECT( widget ), "button_release_event", G_CALLBACK( PressedButtons_button_release ), &pressedButtons ); - g_signal_connect( G_OBJECT( widget ), "focus_out_event", G_CALLBACK( PressedButtons_focus_out ), &pressedButtons ); + widget.connect( "button_press_event", G_CALLBACK( PressedButtons_button_press ), &pressedButtons ); + widget.connect( "button_release_event", G_CALLBACK( PressedButtons_button_release ), &pressedButtons ); + widget.connect( "focus_out_event", G_CALLBACK( PressedButtons_focus_out ), &pressedButtons ); } PressedButtons g_pressedButtons; @@ -379,12 +379,12 @@ void GlobalPressedKeys_releaseAll(){ } void GlobalPressedKeys_connect( ui::Window window ){ - unsigned int key_press_handler = g_signal_connect( G_OBJECT( window ), "key_press_event", G_CALLBACK( PressedKeys_key_press ), &g_pressedKeys ); - unsigned int key_release_handler = g_signal_connect( G_OBJECT( window ), "key_release_event", G_CALLBACK( PressedKeys_key_release ), &g_pressedKeys ); + unsigned int key_press_handler = window.connect( "key_press_event", G_CALLBACK( PressedKeys_key_press ), &g_pressedKeys ); + unsigned int key_release_handler = window.connect( "key_release_event", G_CALLBACK( PressedKeys_key_release ), &g_pressedKeys ); g_object_set_data( G_OBJECT( window ), "key_press_handler", gint_to_pointer( key_press_handler ) ); g_object_set_data( G_OBJECT( window ), "key_release_handler", gint_to_pointer( key_release_handler ) ); - unsigned int focus_in_handler = g_signal_connect( G_OBJECT( window ), "focus_in_event", G_CALLBACK( PressedKeys_focus_in ), &g_pressedKeys ); - unsigned int focus_out_handler = g_signal_connect( G_OBJECT( window ), "focus_out_event", G_CALLBACK( PressedKeys_focus_out ), &g_pressedKeys ); + unsigned int focus_in_handler = window.connect( "focus_in_event", G_CALLBACK( PressedKeys_focus_in ), &g_pressedKeys ); + unsigned int focus_out_handler = window.connect( "focus_out_event", G_CALLBACK( PressedKeys_focus_out ), &g_pressedKeys ); g_object_set_data( G_OBJECT( window ), "focus_in_handler", gint_to_pointer( focus_in_handler ) ); g_object_set_data( G_OBJECT( window ), "focus_out_handler", gint_to_pointer( focus_out_handler ) ); } @@ -496,16 +496,16 @@ static gboolean override_global_accelerators( ui::Window window, GdkEventKey* ev void global_accel_connect_window( ui::Window window ){ #if 1 - unsigned int override_handler = g_signal_connect( G_OBJECT( window ), "key_press_event", G_CALLBACK( override_global_accelerators ), 0 ); + unsigned int override_handler = window.connect( "key_press_event", G_CALLBACK( override_global_accelerators ), 0 ); g_object_set_data( G_OBJECT( window ), "override_handler", gint_to_pointer( override_handler ) ); - unsigned int special_key_press_handler = g_signal_connect( G_OBJECT( window ), "key_press_event", G_CALLBACK( accelerator_key_event ), &g_special_accelerators ); + unsigned int special_key_press_handler = window.connect( "key_press_event", G_CALLBACK( accelerator_key_event ), &g_special_accelerators ); g_object_set_data( G_OBJECT( window ), "special_key_press_handler", gint_to_pointer( special_key_press_handler ) ); GlobalPressedKeys_connect( window ); #else - unsigned int key_press_handler = g_signal_connect( G_OBJECT( window ), "key_press_event", G_CALLBACK( accelerator_key_event ), &g_keydown_accelerators ); - unsigned int key_release_handler = g_signal_connect( G_OBJECT( window ), "key_release_event", G_CALLBACK( accelerator_key_event ), &g_keyup_accelerators ); + unsigned int key_press_handler = window.connect( "key_press_event", G_CALLBACK( accelerator_key_event ), &g_keydown_accelerators ); + unsigned int key_release_handler = window.connect( "key_release_event", G_CALLBACK( accelerator_key_event ), &g_keyup_accelerators ); g_object_set_data( G_OBJECT( window ), "key_press_handler", gint_to_pointer( key_press_handler ) ); g_object_set_data( G_OBJECT( window ), "key_release_handler", gint_to_pointer( key_release_handler ) ); #endif diff --git a/libs/gtkutil/cursor.cpp b/libs/gtkutil/cursor.cpp index c524e5ea..69e95e88 100644 --- a/libs/gtkutil/cursor.cpp +++ b/libs/gtkutil/cursor.cpp @@ -110,7 +110,7 @@ void FreezePointer::freeze_pointer(ui::Window window, FreezePointer::MotionDelta m_function = function; m_data = data; - handle_motion = g_signal_connect( G_OBJECT( window ), "motion_notify_event", G_CALLBACK( motion_delta ), this ); + handle_motion = window.connect( "motion_notify_event", G_CALLBACK( motion_delta ), this ); } void FreezePointer::unfreeze_pointer(ui::Window window) diff --git a/libs/gtkutil/dialog.cpp b/libs/gtkutil/dialog.cpp index 54d275cb..f87bbeeb 100644 --- a/libs/gtkutil/dialog.cpp +++ b/libs/gtkutil/dialog.cpp @@ -60,7 +60,7 @@ ui::Button create_dialog_button( const char* label, GCallback func, gpointer dat auto button = ui::Button( label ); gtk_widget_set_size_request( GTK_WIDGET( button ), 64, -1 ); button.show(); - g_signal_connect( G_OBJECT( button ), "clicked", func, data ); + button.connect( "clicked", func, data ); return button; } @@ -68,7 +68,7 @@ ui::Window create_dialog_window( ui::Window parent, const char* title, GCallback ui::Window window = create_floating_window( title, parent ); gtk_window_set_default_size( window, default_w, default_h ); gtk_window_set_position( window, GTK_WIN_POS_CENTER_ON_PARENT ); - g_signal_connect( G_OBJECT( window ), "delete_event", func, data ); + window.connect( "delete_event", func, data ); return window; } @@ -231,7 +231,7 @@ void BrowsedPathEntry_clicked( ui::Widget widget, BrowsedPathEntry* self ){ BrowsedPathEntry::BrowsedPathEntry( const BrowseCallback& browse ) : m_entry( PathEntry_new() ), m_browse( browse ){ - g_signal_connect( G_OBJECT( m_entry.m_button ), "clicked", G_CALLBACK( BrowsedPathEntry_clicked ), this ); + m_entry.m_button.connect( "clicked", G_CALLBACK( BrowsedPathEntry_clicked ), this ); } diff --git a/libs/gtkutil/glwidget.cpp b/libs/gtkutil/glwidget.cpp index 8661e4ef..8a7a7339 100644 --- a/libs/gtkutil/glwidget.cpp +++ b/libs/gtkutil/glwidget.cpp @@ -231,10 +231,10 @@ ui::Widget glwidget_new( gboolean zbuffer ){ g_object_set_data( G_OBJECT( widget ), "zbuffer", gint_to_pointer( zbuffer ) ); - g_signal_connect( G_OBJECT( widget ), "hierarchy-changed", G_CALLBACK( glwidget_enable_gl ), 0 ); + widget.connect( "hierarchy-changed", G_CALLBACK( glwidget_enable_gl ), 0 ); - g_signal_connect( G_OBJECT( widget ), "realize", G_CALLBACK( glwidget_context_created ), 0 ); - g_signal_connect( G_OBJECT( widget ), "unrealize", G_CALLBACK( glwidget_context_destroyed ), 0 ); + widget.connect( "realize", G_CALLBACK( glwidget_context_created ), 0 ); + widget.connect( "unrealize", G_CALLBACK( glwidget_context_destroyed ), 0 ); return widget; } diff --git a/libs/gtkutil/messagebox.cpp b/libs/gtkutil/messagebox.cpp index 3913d11b..ca3fb321 100644 --- a/libs/gtkutil/messagebox.cpp +++ b/libs/gtkutil/messagebox.cpp @@ -63,7 +63,7 @@ EMessageBoxReturn gtk_MessageBox( ui::Widget parent, const char* text, const cha ui::Window window = create_fixedsize_modal_dialog_window( parentWindow, title, dialog, 400, 100 ); if ( parentWindow ) { - //g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(floating_window_delete_present), parent); + //window.connect( "delete_event", G_CALLBACK(floating_window_delete_present), parent); gtk_window_deiconify( parentWindow ); } diff --git a/libs/gtkutil/nonmodal.cpp b/libs/gtkutil/nonmodal.cpp index f14d72d3..ef05f26e 100644 --- a/libs/gtkutil/nonmodal.cpp +++ b/libs/gtkutil/nonmodal.cpp @@ -14,7 +14,7 @@ gboolean escape_clear_focus_widget(ui::Widget widget, GdkEventKey *event, gpoint void widget_connect_escape_clear_focus_widget(ui::Widget widget) { - g_signal_connect(G_OBJECT(widget), "key_press_event", G_CALLBACK(escape_clear_focus_widget), 0); + widget.connect("key_press_event", G_CALLBACK(escape_clear_focus_widget), 0); } gboolean NonModalEntry::focus_in(ui::Entry entry, GdkEventFocus *event, NonModalEntry *self) @@ -62,11 +62,11 @@ gboolean NonModalEntry::escape(ui::Entry entry, GdkEventKey *event, NonModalEntr void NonModalEntry::connect(ui::Entry entry) { - g_signal_connect(G_OBJECT(entry), "focus_in_event", G_CALLBACK(focus_in), this); - g_signal_connect(G_OBJECT(entry), "focus_out_event", G_CALLBACK(focus_out), this); - g_signal_connect(G_OBJECT(entry), "key_press_event", G_CALLBACK(enter), this); - g_signal_connect(G_OBJECT(entry), "key_press_event", G_CALLBACK(escape), this); - g_signal_connect(G_OBJECT(entry), "changed", G_CALLBACK(changed), this); + entry.connect("focus_in_event", G_CALLBACK(focus_in), this); + entry.connect("focus_out_event", G_CALLBACK(focus_out), this); + entry.connect("key_press_event", G_CALLBACK(enter), this); + entry.connect("key_press_event", G_CALLBACK(escape), this); + entry.connect("changed", G_CALLBACK(changed), this); } gboolean NonModalSpinner::changed(ui::SpinButton spin, NonModalSpinner *self) @@ -96,11 +96,11 @@ gboolean NonModalSpinner::escape(ui::SpinButton spin, GdkEventKey *event, NonMod void NonModalSpinner::connect(ui::SpinButton spin) { - guint handler = g_signal_connect(G_OBJECT(gtk_spin_button_get_adjustment(spin)), "value_changed", - G_CALLBACK(changed), this); + auto adj = ui::Adjustment(gtk_spin_button_get_adjustment(spin)); + guint handler = adj.connect("value_changed", G_CALLBACK(changed), this); g_object_set_data(G_OBJECT(spin), "handler", gint_to_pointer(handler)); - g_signal_connect(G_OBJECT(spin), "key_press_event", G_CALLBACK(enter), this); - g_signal_connect(G_OBJECT(spin), "key_press_event", G_CALLBACK(escape), this); + spin.connect("key_press_event", G_CALLBACK(enter), this); + spin.connect("key_press_event", G_CALLBACK(escape), this); } void NonModalRadio::connect(ui::RadioButton radio) diff --git a/libs/gtkutil/paned.cpp b/libs/gtkutil/paned.cpp index f409fd1f..a09df803 100644 --- a/libs/gtkutil/paned.cpp +++ b/libs/gtkutil/paned.cpp @@ -65,27 +65,27 @@ ui::HPaned create_split_views( ui::Widget topleft, ui::Widget topright, ui::Widg auto hsplit = ui::HPaned(); hsplit.show(); - g_signal_connect( G_OBJECT( hsplit ), "size_allocate", G_CALLBACK( hpaned_allocate ), &g_hpaned ); - g_signal_connect( G_OBJECT( hsplit ), "notify::position", G_CALLBACK( paned_position ), &g_hpaned ); + hsplit.connect( "size_allocate", G_CALLBACK( hpaned_allocate ), &g_hpaned ); + hsplit.connect( "notify::position", G_CALLBACK( paned_position ), &g_hpaned ); { - GtkVPaned* vsplit = ui::VPaned(); + auto vsplit = ui::VPaned(); gtk_paned_add1( GTK_PANED( hsplit ), GTK_WIDGET( vsplit ) ); gtk_widget_show( GTK_WIDGET( vsplit ) ); - g_signal_connect( G_OBJECT( vsplit ), "size_allocate", G_CALLBACK( vpaned_allocate ), &g_vpaned1 ); - g_signal_connect( G_OBJECT( vsplit ), "notify::position", G_CALLBACK( paned_position ), &g_vpaned1 ); + vsplit.connect( "size_allocate", G_CALLBACK( vpaned_allocate ), &g_vpaned1 ); + vsplit.connect( "notify::position", G_CALLBACK( paned_position ), &g_vpaned1 ); gtk_paned_add1( GTK_PANED( vsplit ), GTK_WIDGET( create_framed_widget( topleft ) ) ); gtk_paned_add2( GTK_PANED( vsplit ), GTK_WIDGET( create_framed_widget( topright ) ) ); } { - GtkVPaned* vsplit = ui::VPaned(); + auto vsplit = ui::VPaned(); gtk_paned_add2( GTK_PANED( hsplit ), GTK_WIDGET( vsplit ) ); gtk_widget_show( GTK_WIDGET( vsplit ) ); - g_signal_connect( G_OBJECT( vsplit ), "size_allocate", G_CALLBACK( vpaned_allocate ), &g_vpaned2 ); - g_signal_connect( G_OBJECT( vsplit ), "notify::position", G_CALLBACK( paned_position ), &g_vpaned2 ); + vsplit.connect( "size_allocate", G_CALLBACK( vpaned_allocate ), &g_vpaned2 ); + vsplit.connect( "notify::position", G_CALLBACK( paned_position ), &g_vpaned2 ); gtk_paned_add1( GTK_PANED( vsplit ), GTK_WIDGET( create_framed_widget( botleft ) ) ); gtk_paned_add2( GTK_PANED( vsplit ), GTK_WIDGET( create_framed_widget( botright ) ) ); diff --git a/libs/gtkutil/widget.cpp b/libs/gtkutil/widget.cpp index 83782920..be5f63d4 100644 --- a/libs/gtkutil/widget.cpp +++ b/libs/gtkutil/widget.cpp @@ -76,8 +76,8 @@ void ToggleShown::connect(ui::Widget widget) { m_widget = widget; widget_set_visible(m_widget, m_shownDeferred); - g_signal_connect(G_OBJECT(m_widget), "notify::visible", G_CALLBACK(notify_visible), this); - g_signal_connect(G_OBJECT(m_widget), "destroy", G_CALLBACK(destroy), this); + m_widget.connect("notify::visible", G_CALLBACK(notify_visible), this); + m_widget.connect("destroy", G_CALLBACK(destroy), this); update(); } @@ -95,6 +95,6 @@ gboolean WidgetFocusPrinter::focus_out(ui::Widget widget, GdkEventFocus *event, void WidgetFocusPrinter::connect(ui::Widget widget) { - g_signal_connect(G_OBJECT(widget), "focus_in_event", G_CALLBACK(focus_in), this); - g_signal_connect(G_OBJECT(widget), "focus_out_event", G_CALLBACK(focus_out), this); + widget.connect("focus_in_event", G_CALLBACK(focus_in), this); + widget.connect("focus_out_event", G_CALLBACK(focus_out), this); } diff --git a/libs/gtkutil/window.cpp b/libs/gtkutil/window.cpp index 77708216..bbeed5b9 100644 --- a/libs/gtkutil/window.cpp +++ b/libs/gtkutil/window.cpp @@ -51,7 +51,7 @@ static gboolean main_window_iconified( ui::Widget widget, GdkEventWindowState* e } unsigned int connect_floating( ui::Window main_window, ui::Window floating ){ - return g_signal_connect( G_OBJECT( main_window ), "window_state_event", G_CALLBACK( main_window_iconified ), floating ); + return main_window.connect( "window_state_event", G_CALLBACK( main_window_iconified ), floating ); } gboolean destroy_disconnect_floating( ui::Window widget, gpointer data ){ @@ -67,7 +67,7 @@ gboolean floating_window_delete_present( ui::Window floating, GdkEventFocus *eve } guint connect_floating_window_delete_present( ui::Window floating, ui::Window main_window ){ - return g_signal_connect( G_OBJECT( floating ), "delete_event", G_CALLBACK( floating_window_delete_present ), main_window ); + return floating.connect( "delete_event", G_CALLBACK( floating_window_delete_present ), main_window ); } gboolean floating_window_destroy_present( ui::Window floating, ui::Window main_window ){ @@ -78,7 +78,7 @@ gboolean floating_window_destroy_present( ui::Window floating, ui::Window main_w } guint connect_floating_window_destroy_present( ui::Window floating, ui::Window main_window ){ - return g_signal_connect( G_OBJECT( floating ), "destroy", G_CALLBACK( floating_window_destroy_present ), main_window ); + return floating.connect( "destroy", G_CALLBACK( floating_window_destroy_present ), main_window ); } ui::Window create_floating_window( const char* title, ui::Window parent ){ @@ -89,7 +89,7 @@ ui::Window create_floating_window( const char* title, ui::Window parent ){ gtk_window_set_transient_for( window, parent ); connect_floating_window_destroy_present( window, parent ); g_object_set_data( G_OBJECT( window ), "floating_handler", gint_to_pointer( connect_floating( parent, window ) ) ); - g_signal_connect( G_OBJECT( window ), "destroy", G_CALLBACK( destroy_disconnect_floating ), parent ); + window.connect( "destroy", G_CALLBACK( destroy_disconnect_floating ), parent ); } return window; @@ -115,11 +115,11 @@ ui::Window create_persistent_floating_window( const char* title, ui::Window main gtk_widget_set_events( GTK_WIDGET( window ), GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK ); connect_floating_window_delete_present( window, main_window ); - g_signal_connect( G_OBJECT( window ), "delete_event", G_CALLBACK( persistent_floating_window_delete ), 0 ); + window.connect( "delete_event", G_CALLBACK( persistent_floating_window_delete ), 0 ); #if 0 if ( g_multimon_globals.m_bStartOnPrimMon && g_multimon_globals.m_bNoSysMenuPopups ) { - g_signal_connect( G_OBJECT( window ), "realize", G_CALLBACK( window_realize_remove_sysmenu ), 0 ); + window.connect( "realize", G_CALLBACK( window_realize_remove_sysmenu ), 0 ); } #endif @@ -132,7 +132,7 @@ gint window_realize_remove_minmax( ui::Widget widget, gpointer data ){ } void window_remove_minmax( ui::Window window ){ - g_signal_connect( G_OBJECT( window ), "realize", G_CALLBACK( window_realize_remove_minmax ), 0 ); + window.connect( "realize", G_CALLBACK( window_realize_remove_minmax ), 0 ); } @@ -153,7 +153,7 @@ gboolean window_focus_in_clear_focus_widget(ui::Widget widget, GdkEventKey *even guint window_connect_focus_in_clear_focus_widget(ui::Window window) { - return g_signal_connect( G_OBJECT( window ), "focus_in_event", G_CALLBACK( window_focus_in_clear_focus_widget ), NULL ); + return window.connect( "focus_in_event", G_CALLBACK( window_focus_in_clear_focus_widget ), NULL ); } void window_get_position(ui::Window window, WindowPosition &position) @@ -223,7 +223,7 @@ void WindowPositionTracker::sync(ui::Window window) void WindowPositionTracker::connect(ui::Window window) { sync( window ); - g_signal_connect( G_OBJECT( window ), "configure_event", G_CALLBACK( configure ), this ); + window.connect( "configure_event", G_CALLBACK( configure ), this ); } const WindowPosition &WindowPositionTracker::getPosition() const diff --git a/libs/uilib/CMakeLists.txt b/libs/uilib/CMakeLists.txt index f10ee3ad..68e5ee0f 100644 --- a/libs/uilib/CMakeLists.txt +++ b/libs/uilib/CMakeLists.txt @@ -8,3 +8,7 @@ target_link_libraries(uilib PUBLIC ${${GTK_NS}_LIBRARIES}) target_include_directories(uilib PUBLIC gtkutil) target_link_libraries(uilib PUBLIC gtkutil) + +find_package(GLIB REQUIRED) +target_include_directories(uilib PUBLIC ${GLIB_INCLUDE_DIRS}) +target_link_libraries(uilib PUBLIC ${GLIB_LIBRARIES}) diff --git a/libs/uilib/uilib.h b/libs/uilib/uilib.h index 3fca43c7..6a35f461 100644 --- a/libs/uilib/uilib.h +++ b/libs/uilib/uilib.h @@ -2,6 +2,7 @@ #define INCLUDED_UILIB_H #include +#include struct _GdkEventKey; struct _GtkAccelGroup; @@ -54,6 +55,7 @@ struct _GtkToolButton; struct _GtkToolItem; struct _GtkTreeModel; struct _GtkTreePath; +struct _GtkTreeSelection; struct _GtkTreeView; struct _GtkTreeViewColumn; struct _GtkVBox; @@ -161,6 +163,7 @@ namespace ui { public details::Convertible, public details::Convertible { public: + using self = Object *; using native = _GtkObject *; native _handle; @@ -172,6 +175,9 @@ namespace ui { explicit operator void *() const { return _handle; } + + template + gulong connect(char const *detailed_signal, Lambda &&c_handler, void *data); }; static_assert(sizeof(Object) == sizeof(Object::native), "object slicing"); @@ -506,6 +512,10 @@ namespace ui { void clear(); ); + WRAP(TreeSelection, Object, _GtkTreeSelection, (), + , + ); + // GBoxed WRAP(TreePath, Object, _GtkTreePath, (), @@ -527,6 +537,12 @@ namespace ui { #define this (*static_cast(this)) + template + gulong Object::connect(char const *detailed_signal, Lambda &&c_handler, void *data) + { + return g_signal_connect(G_OBJECT(this), detailed_signal, c_handler, data); + } + template void IContainer::foreach(Lambda &&lambda) { diff --git a/plugins/entity/CMakeLists.txt b/plugins/entity/CMakeLists.txt index 8799a3ec..8e359919 100644 --- a/plugins/entity/CMakeLists.txt +++ b/plugins/entity/CMakeLists.txt @@ -23,3 +23,7 @@ radiant_plugin(entity skincache.cpp skincache.h targetable.cpp targetable.h ) + +target_include_directories(entity + PRIVATE $ +) diff --git a/plugins/mapq3/CMakeLists.txt b/plugins/mapq3/CMakeLists.txt index 9b1136ea..880b653d 100644 --- a/plugins/mapq3/CMakeLists.txt +++ b/plugins/mapq3/CMakeLists.txt @@ -3,3 +3,7 @@ radiant_plugin(mapq3 plugin.cpp write.cpp write.h ) + +target_include_directories(mapq3 + PRIVATE $ +) diff --git a/plugins/textool/2DView.cpp b/plugins/textool/2DView.cpp index a01172a1..f6e10185 100644 --- a/plugins/textool/2DView.cpp +++ b/plugins/textool/2DView.cpp @@ -117,22 +117,22 @@ bool C2DView::OnRButtonUp( int x, int y ){ menu = ui::Menu(); item = ui::MenuItem( "Validate (RETURN)" ); - g_signal_connect( GTK_OBJECT( item ), "activate", G_CALLBACK( Textool_Validate ), NULL ); + item.connect( "activate", G_CALLBACK( Textool_Validate ), NULL ); gtk_widget_show( item ); gtk_menu_append( GTK_MENU( menu ), item ); item = ui::MenuItem( "Zoom in (INSERT)" ); - g_signal_connect( GTK_OBJECT( item ), "activate", G_CALLBACK( view_ZoomIn ), this ); + item.connect( "activate", G_CALLBACK( view_ZoomIn ), this ); gtk_widget_show( item ); gtk_menu_append( GTK_MENU( menu ), item ); item = ui::MenuItem( "Zoom out (DELETE)" ); - g_signal_connect( GTK_OBJECT( item ), "activate", G_CALLBACK( view_ZoomOut ), this ); + item.connect( "activate", G_CALLBACK( view_ZoomOut ), this ); gtk_widget_show( item ); gtk_menu_append( GTK_MENU( menu ), item ); item = ui::MenuItem( "Cancel (ESC)" ); - g_signal_connect( GTK_OBJECT( item ), "activate", G_CALLBACK( Textool_Cancel ), NULL ); + item.connect( "activate", G_CALLBACK( Textool_Cancel ), NULL ); gtk_widget_show( item ); gtk_menu_append( GTK_MENU( menu ), item ); diff --git a/plugins/textool/TexTool.cpp b/plugins/textool/TexTool.cpp index 22f5a6e3..1a251b05 100644 --- a/plugins/textool/TexTool.cpp +++ b/plugins/textool/TexTool.cpp @@ -55,9 +55,9 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ int mode = ( uType & MB_TYPEMASK ), ret, loop = 1; auto window = ui::Window( ui::window_type::TOP ); - g_signal_connect( GTK_OBJECT( window ), "delete_event", + window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( GTK_OBJECT( window ), "destroy", + window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); gtk_window_set_title( GTK_WINDOW( window ), lpCaption ); gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); @@ -85,7 +85,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ if ( mode == MB_OK ) { w = ui::Button( "Ok" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); @@ -95,7 +95,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ else if ( mode == MB_OKCANCEL ) { w = ui::Button( "Ok" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); @@ -103,7 +103,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ w = ui::Button( "Cancel" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); gtk_widget_show( w ); ret = IDCANCEL; @@ -111,7 +111,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ else if ( mode == MB_YESNOCANCEL ) { w = ui::Button( "Yes" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDYES ) ); gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); @@ -119,13 +119,13 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ w = ui::Button( "No" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDNO ) ); gtk_widget_show( w ); w = ui::Button( "Cancel" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); gtk_widget_show( w ); ret = IDCANCEL; @@ -134,7 +134,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ { w = ui::Button( "Yes" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDYES ) ); gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); @@ -142,7 +142,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ w = ui::Button( "No" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( GTK_OBJECT( w ), "clicked", + w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDNO ) ); gtk_widget_show( w ); ret = IDNO; @@ -643,16 +643,16 @@ static GtkWidget* CreateOpenGLWidget(){ GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK ); // Connect signal handlers - g_signal_connect( GTK_OBJECT( g_pToolWidget ), "expose_event", G_CALLBACK( expose ), NULL ); - g_signal_connect( GTK_OBJECT( g_pToolWidget ), "motion_notify_event", + g_pToolWidget.connect( "expose_event", G_CALLBACK( expose ), NULL ); + g_pToolWidget.connect( "motion_notify_event", G_CALLBACK( motion ), NULL ); - g_signal_connect( GTK_OBJECT( g_pToolWidget ), "button_press_event", + g_pToolWidget.connect( "button_press_event", G_CALLBACK( button_press ), NULL ); - g_signal_connect( GTK_OBJECT( g_pToolWidget ), "button_release_event", + g_pToolWidget.connect( "button_release_event", G_CALLBACK( button_release ), NULL ); - g_signal_connect( GTK_OBJECT( g_pToolWnd ), "delete_event", G_CALLBACK( close ), NULL ); - g_signal_connect( GTK_OBJECT( g_pToolWnd ), "key_press_event", + g_pToolWnd.connect( "delete_event", G_CALLBACK( close ), NULL ); + g_pToolWnd.connect( "key_press_event", G_CALLBACK( keypress ), NULL ); return g_pToolWidget; diff --git a/radiant/build.cpp b/radiant/build.cpp index 7d9d6300..a2b80dec 100644 --- a/radiant/build.cpp +++ b/radiant/build.cpp @@ -876,7 +876,7 @@ ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi auto renderer = ui::CellRendererText(); object_set_boolean_property( G_OBJECT( renderer ), "editable", TRUE ); - g_signal_connect( G_OBJECT(renderer), "edited", G_CALLBACK( project_cell_edited ), &projectList ); + renderer.connect("edited", G_CALLBACK( project_cell_edited ), &projectList ); GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); @@ -890,7 +890,7 @@ ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi projectList.m_store = store; scr.add(view); - g_signal_connect( G_OBJECT( view ), "key_press_event", G_CALLBACK( project_key_press ), &projectList ); + view.connect( "key_press_event", G_CALLBACK( project_key_press ), &projectList ); g_object_unref( G_OBJECT( store ) ); } @@ -913,7 +913,7 @@ ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi auto renderer = ui::CellRendererText(); object_set_boolean_property( G_OBJECT( renderer ), "editable", TRUE ); - g_signal_connect( G_OBJECT(renderer), "edited", G_CALLBACK( commands_cell_edited ), store ); + renderer.connect( "edited", G_CALLBACK( commands_cell_edited ), store ); GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); @@ -927,9 +927,10 @@ ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi g_object_unref( G_OBJECT( store ) ); - g_signal_connect( G_OBJECT( view ), "key_press_event", G_CALLBACK( commands_key_press ), store ); + view.connect( "key_press_event", G_CALLBACK( commands_key_press ), store ); - g_signal_connect( G_OBJECT( gtk_tree_view_get_selection( GTK_TREE_VIEW( buildView ) ) ), "changed", G_CALLBACK( project_selection_changed ), store ); + auto sel = ui::TreeSelection(gtk_tree_view_get_selection( GTK_TREE_VIEW( buildView ) )); + sel.connect( "changed", G_CALLBACK( project_selection_changed ), store ); } } } diff --git a/radiant/camwindow.cpp b/radiant/camwindow.cpp index cf5bc385..f64691a2 100644 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@ -1082,11 +1082,11 @@ void CamWnd_Move_Discrete_Import( bool value ){ void CamWnd_Add_Handlers_Move( CamWnd& camwnd ){ - camwnd.m_selection_button_press_handler = g_signal_connect( G_OBJECT( camwnd.m_gl_widget ), "button_press_event", G_CALLBACK( selection_button_press ), camwnd.m_window_observer ); - camwnd.m_selection_button_release_handler = g_signal_connect( G_OBJECT( camwnd.m_gl_widget ), "button_release_event", G_CALLBACK( selection_button_release ), camwnd.m_window_observer ); - camwnd.m_selection_motion_handler = g_signal_connect( G_OBJECT( camwnd.m_gl_widget ), "motion_notify_event", G_CALLBACK( DeferredMotion::gtk_motion ), &camwnd.m_deferred_motion ); + camwnd.m_selection_button_press_handler = camwnd.m_gl_widget.connect( "button_press_event", G_CALLBACK( selection_button_press ), camwnd.m_window_observer ); + camwnd.m_selection_button_release_handler = camwnd.m_gl_widget.connect( "button_release_event", G_CALLBACK( selection_button_release ), camwnd.m_window_observer ); + camwnd.m_selection_motion_handler = camwnd.m_gl_widget.connect( "motion_notify_event", G_CALLBACK( DeferredMotion::gtk_motion ), &camwnd.m_deferred_motion ); - camwnd.m_freelook_button_press_handler = g_signal_connect( G_OBJECT( camwnd.m_gl_widget ), "button_press_event", G_CALLBACK( enable_freelook_button_press ), &camwnd ); + camwnd.m_freelook_button_press_handler = camwnd.m_gl_widget.connect( "button_press_event", G_CALLBACK( enable_freelook_button_press ), &camwnd ); if ( g_camwindow_globals_private.m_bCamDiscrete ) { CamWnd_Move_Discrete_Enable( camwnd ); @@ -1114,11 +1114,11 @@ void CamWnd_Remove_Handlers_Move( CamWnd& camwnd ){ } void CamWnd_Add_Handlers_FreeMove( CamWnd& camwnd ){ - camwnd.m_selection_button_press_handler = g_signal_connect( G_OBJECT( camwnd.m_gl_widget ), "button_press_event", G_CALLBACK( selection_button_press_freemove ), camwnd.m_window_observer ); - camwnd.m_selection_button_release_handler = g_signal_connect( G_OBJECT( camwnd.m_gl_widget ), "button_release_event", G_CALLBACK( selection_button_release_freemove ), camwnd.m_window_observer ); - camwnd.m_selection_motion_handler = g_signal_connect( G_OBJECT( camwnd.m_gl_widget ), "motion_notify_event", G_CALLBACK( selection_motion_freemove ), camwnd.m_window_observer ); + camwnd.m_selection_button_press_handler = camwnd.m_gl_widget.connect( "button_press_event", G_CALLBACK( selection_button_press_freemove ), camwnd.m_window_observer ); + camwnd.m_selection_button_release_handler = camwnd.m_gl_widget.connect( "button_release_event", G_CALLBACK( selection_button_release_freemove ), camwnd.m_window_observer ); + camwnd.m_selection_motion_handler = camwnd.m_gl_widget.connect( "motion_notify_event", G_CALLBACK( selection_motion_freemove ), camwnd.m_window_observer ); - camwnd.m_freelook_button_press_handler = g_signal_connect( G_OBJECT( camwnd.m_gl_widget ), "button_press_event", G_CALLBACK( disable_freelook_button_press ), &camwnd ); + camwnd.m_freelook_button_press_handler = camwnd.m_gl_widget.connect( "button_press_event", G_CALLBACK( disable_freelook_button_press ), &camwnd ); KeyEvent_connect( "CameraFreeMoveForward" ); KeyEvent_connect( "CameraFreeMoveBack" ); @@ -1170,8 +1170,8 @@ CamWnd::CamWnd() : gtk_widget_set_events( 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( m_gl_widget, true ); - m_sizeHandler = g_signal_connect( G_OBJECT( m_gl_widget ), "size_allocate", G_CALLBACK( camera_size_allocate ), this ); - m_exposeHandler = g_signal_connect( G_OBJECT( m_gl_widget ), "expose_event", G_CALLBACK( camera_expose ), this ); + m_sizeHandler = m_gl_widget.connect( "size_allocate", G_CALLBACK( camera_size_allocate ), this ); + m_exposeHandler = m_gl_widget.connect( "expose_event", G_CALLBACK( camera_expose ), this ); Map_addValidCallback( g_map, DeferredDrawOnMapValidChangedCaller( m_deferredDraw ) ); @@ -1179,7 +1179,7 @@ CamWnd::CamWnd() : CamWnd_Add_Handlers_Move( *this ); - g_signal_connect( G_OBJECT( m_gl_widget ), "scroll_event", G_CALLBACK( wheelmove_scroll ), this ); + m_gl_widget.connect( "scroll_event", G_CALLBACK( wheelmove_scroll ), this ); AddSceneChangeCallback( ReferenceCaller( *this ) ); @@ -1299,7 +1299,7 @@ void CamWnd::EnableFreeMove(){ CamWnd_Add_Handlers_FreeMove( *this ); gtk_window_set_focus( m_parent, m_gl_widget ); - m_freemove_handle_focusout = g_signal_connect( G_OBJECT( m_gl_widget ), "focus_out_event", G_CALLBACK( camwindow_freemove_focusout ), this ); + m_freemove_handle_focusout = m_gl_widget.connect( "focus_out_event", G_CALLBACK( camwindow_freemove_focusout ), this ); m_freezePointer.freeze_pointer( m_parent, Camera_motionDelta, &m_Camera ); CamWnd_Update( *this ); diff --git a/radiant/console.cpp b/radiant/console.cpp index 1f31fb3d..d4202247 100644 --- a/radiant/console.cpp +++ b/radiant/console.cpp @@ -92,7 +92,7 @@ void console_populate_popup( GtkTextView* textview, ui::Menu menu, gpointer user menu_separator( menu ); ui::Widget item(ui::MenuItem( "Clear" )); - g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( console_clear ), 0 ); + item.connect( "activate", G_CALLBACK( console_clear ), 0 ); item.show(); menu.add(item); } @@ -125,8 +125,8 @@ ui::Widget Console_constructWindow( ui::Window toplevel ){ //g_consoleWidgetFocusPrinter.connect(g_console); - g_signal_connect( G_OBJECT( g_console ), "populate-popup", G_CALLBACK( console_populate_popup ), 0 ); - g_signal_connect( G_OBJECT( g_console ), "destroy", G_CALLBACK( destroy_set_null ), &g_console ); + g_console.connect( "populate-popup", G_CALLBACK( console_populate_popup ), 0 ); + g_console.connect( "destroy", G_CALLBACK( destroy_set_null ), &g_console ); } gtk_container_set_focus_chain( GTK_CONTAINER( scr ), NULL ); diff --git a/radiant/dialog.cpp b/radiant/dialog.cpp index 84b2ee2a..01e58f7c 100644 --- a/radiant/dialog.cpp +++ b/radiant/dialog.cpp @@ -332,7 +332,7 @@ void Dialog::Create(){ ASSERT_MESSAGE( !m_window, "dialog cannot be constructed" ); m_window = BuildDialog(); - g_signal_connect( G_OBJECT( m_window ), "delete_event", G_CALLBACK( delete_event_callback ), this ); + m_window.connect( "delete_event", G_CALLBACK( delete_event_callback ), this ); } void Dialog::Destroy(){ @@ -606,7 +606,7 @@ ui::Widget Dialog::addFloatEntry( ui::Widget vbox, const char* name, const Float ui::Widget Dialog::addPathEntry( ui::Widget vbox, const char* name, bool browse_directory, const StringImportCallback& importViewer, const StringExportCallback& exportViewer ){ PathEntry pathEntry = PathEntry_new(); - g_signal_connect( G_OBJECT( pathEntry.m_button ), "clicked", G_CALLBACK( browse_directory ? button_clicked_entry_browse_directory : button_clicked_entry_browse_file ), pathEntry.m_entry ); + pathEntry.m_button.connect( "clicked", G_CALLBACK( browse_directory ? button_clicked_entry_browse_directory : button_clicked_entry_browse_file ), pathEntry.m_entry ); AddTextEntryData( *GTK_ENTRY(pathEntry.m_entry), importViewer, exportViewer ); diff --git a/radiant/entityinspector.cpp b/radiant/entityinspector.cpp index 75a1c8fd..800ee919 100644 --- a/radiant/entityinspector.cpp +++ b/radiant/entityinspector.cpp @@ -127,7 +127,7 @@ BooleanAttribute( const char* key ) : m_check = check; - guint handler = g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( toggled ), this ); + guint handler = check.connect( "toggled", G_CALLBACK( toggled ), this ); g_object_set_data( G_OBJECT( check ), "handler", gint_to_pointer( handler ) ); update(); @@ -640,10 +640,10 @@ static gboolean changed( GtkComboBox *widget, NonModalComboBox* self ){ public: NonModalComboBox( const Callback& changed ) : m_changed( changed ), m_changedHandler( 0 ){ } -void connect( GtkComboBox* combo ){ - m_changedHandler = g_signal_connect( G_OBJECT( combo ), "changed", G_CALLBACK( changed ), this ); +void connect( ui::ComboBox combo ){ + m_changedHandler = combo.connect( "changed", G_CALLBACK( changed ), this ); } -void setActive( GtkComboBox* combo, int value ){ +void setActive( ui::ComboBox combo, int value ){ g_signal_handler_disconnect( G_OBJECT( combo ), m_changedHandler ); gtk_combo_box_set_active( combo, value ); connect( combo ); @@ -653,7 +653,7 @@ void setActive( GtkComboBox* combo, int value ){ class ListAttribute : public EntityAttribute { CopiedString m_key; -GtkComboBox* m_combo; +ui::ComboBox m_combo; NonModalComboBox m_nonModal; const ListAttributeType& m_type; public: @@ -1293,7 +1293,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ vbox.show(); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 2 ); - g_signal_connect( G_OBJECT( vbox ), "destroy", G_CALLBACK( EntityInspector_destroyWindow ), 0 ); + vbox.connect( "destroy", G_CALLBACK( EntityInspector_destroyWindow ), 0 ); { ui::Widget split1 = ui::VPaned(); @@ -1323,8 +1323,8 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ auto view = ui::TreeView( ui::TreeModel( GTK_TREE_MODEL( store ) )); gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), FALSE ); gtk_tree_view_set_headers_visible( view, FALSE ); - g_signal_connect( G_OBJECT( view ), "button_press_event", G_CALLBACK( EntityClassList_button_press ), 0 ); - g_signal_connect( G_OBJECT( view ), "key_press_event", G_CALLBACK( EntityClassList_keypress ), 0 ); + view.connect( "button_press_event", G_CALLBACK( EntityClassList_button_press ), 0 ); + view.connect( "key_press_event", G_CALLBACK( EntityClassList_keypress ), 0 ); { auto renderer = ui::CellRendererText(); @@ -1333,8 +1333,8 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ } { - GtkTreeSelection* selection = gtk_tree_view_get_selection( view ); - g_signal_connect( G_OBJECT( selection ), "changed", G_CALLBACK( EntityClassList_selection_changed ), 0 ); + auto selection = ui::TreeSelection(gtk_tree_view_get_selection( view )); + selection.connect( "changed", G_CALLBACK( EntityClassList_selection_changed ), 0 ); } view.show(); @@ -1386,9 +1386,9 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ for ( int i = 0; i < MAX_FLAGS; i++ ) { - GtkCheckButton* check = ui::CheckButton( "" ); + auto check = ui::CheckButton( "" ); g_object_ref( GTK_WIDGET( check ) ); - g_object_set_data( G_OBJECT( check ), "handler", gint_to_pointer( g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( SpawnflagCheck_toggled ), 0 ) ) ); + g_object_set_data( G_OBJECT( check ), "handler", gint_to_pointer( check.connect( "toggled", G_CALLBACK( SpawnflagCheck_toggled ), 0 ) ) ); g_entitySpawnflagsCheck[i] = check; } } @@ -1421,8 +1421,8 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ } { - GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) ); - g_signal_connect( G_OBJECT( selection ), "changed", G_CALLBACK( EntityProperties_selection_changed ), 0 ); + auto selection = ui::TreeSelection(gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) )); + selection.connect( "changed", G_CALLBACK( EntityProperties_selection_changed ), 0 ); } view.show(); @@ -1450,7 +1450,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); gtk_widget_set_events( GTK_WIDGET( entry ), GDK_KEY_PRESS_MASK ); - g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( EntityEntry_keypress ), 0 ); + entry.connect( "key_press_event", G_CALLBACK( EntityEntry_keypress ), 0 ); g_entityKeyEntry = entry; } @@ -1461,7 +1461,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); gtk_widget_set_events( GTK_WIDGET( entry ), GDK_KEY_PRESS_MASK ); - g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( EntityEntry_keypress ), 0 ); + entry.connect( "key_press_event", G_CALLBACK( EntityEntry_keypress ), 0 ); g_entityValueEntry = entry; } @@ -1492,13 +1492,13 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ { auto button = ui::Button( "Clear All" ); button.show(); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( EntityInspector_clearAllKeyValues ), 0 ); + button.connect( "clicked", G_CALLBACK( EntityInspector_clearAllKeyValues ), 0 ); gtk_box_pack_start( hbox, GTK_WIDGET( button ), TRUE, TRUE, 0 ); } { auto button = ui::Button( "Delete Key" ); button.show(); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( EntityInspector_clearKeyValue ), 0 ); + button.connect( "clicked", G_CALLBACK( EntityInspector_clearKeyValue ), 0 ); gtk_box_pack_start( hbox, GTK_WIDGET( button ), TRUE, TRUE, 0 ); } } diff --git a/radiant/entitylist.cpp b/radiant/entitylist.cpp index e3d176a0..35cbc847 100644 --- a/radiant/entitylist.cpp +++ b/radiant/entitylist.cpp @@ -307,8 +307,8 @@ void EntityList_constructWindow( ui::Window main_window ){ GtkTreeSelection* select = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) ); gtk_tree_selection_set_mode( select, GTK_SELECTION_MULTIPLE ); - g_signal_connect( G_OBJECT( view ), "row_expanded", G_CALLBACK( entitylist_treeview_row_expanded ), 0 ); - g_signal_connect( G_OBJECT( view ), "row_collapsed", G_CALLBACK( entitylist_treeview_rowcollapsed ), 0 ); + view.connect( "row_expanded", G_CALLBACK( entitylist_treeview_row_expanded ), 0 ); + view.connect( "row_collapsed", G_CALLBACK( entitylist_treeview_rowcollapsed ), 0 ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); diff --git a/radiant/feedback.cpp b/radiant/feedback.cpp index 4ef14154..5a106879 100644 --- a/radiant/feedback.cpp +++ b/radiant/feedback.cpp @@ -312,9 +312,9 @@ ui::Window CDbgDlg::BuildDialog(){ } { - GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) ); + auto selection = ui::TreeSelection(gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) )); gtk_tree_selection_set_mode( selection, GTK_SELECTION_BROWSE ); - g_signal_connect( G_OBJECT( selection ), "changed", G_CALLBACK( feedback_selection_changed ), NULL ); + selection.connect( "changed", G_CALLBACK( feedback_selection_changed ), NULL ); } view.show(); diff --git a/radiant/findtexturedialog.cpp b/radiant/findtexturedialog.cpp index 04983314..e1879ea3 100644 --- a/radiant/findtexturedialog.cpp +++ b/radiant/findtexturedialog.cpp @@ -168,7 +168,7 @@ ui::Window FindTextureDialog::BuildDialog(){ 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", + entry.connect( "focus_in_event", G_CALLBACK( find_focus_in ), 0 ); AddDialogData( *GTK_ENTRY(entry), m_strFind ); GlobalTextureEntryCompletion::instance().connect( entry ); @@ -178,7 +178,7 @@ ui::Window FindTextureDialog::BuildDialog(){ 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", + entry.connect( "focus_in_event", G_CALLBACK( replace_focus_in ), 0 ); AddDialogData( *GTK_ENTRY(entry), m_strReplace ); GlobalTextureEntryCompletion::instance().connect( entry ); @@ -195,14 +195,14 @@ ui::Window FindTextureDialog::BuildDialog(){ button = ui::Button( "Apply" ); button.show(); gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", + button.connect( "clicked", G_CALLBACK( OnApply ), 0 ); gtk_widget_set_size_request( button, 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", + button.connect( "clicked", G_CALLBACK( OnClose ), 0 ); gtk_widget_set_size_request( button, 60, -1 ); diff --git a/radiant/groupdialog.cpp b/radiant/groupdialog.cpp index 1e076c1a..7a301ce8 100644 --- a/radiant/groupdialog.cpp +++ b/radiant/groupdialog.cpp @@ -117,7 +117,7 @@ void GroupDlg::Create( ui::Window parent ){ gtk_notebook_set_tab_pos( GTK_NOTEBOOK( notebook ), GTK_POS_BOTTOM ); m_pNotebook = notebook; - g_signal_connect( G_OBJECT(notebook), "switch_page", G_CALLBACK( switch_page ), (gpointer) window ); + notebook.connect( "switch_page", G_CALLBACK( switch_page ), (gpointer) window ); } } diff --git a/radiant/gtkdlgs.cpp b/radiant/gtkdlgs.cpp index 2ba4ea3d..c3ebca2e 100644 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@ -252,7 +252,7 @@ ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - g_signal_connect( G_OBJECT( dialog.game_combo.game_select ), "changed", G_CALLBACK( OnSelchangeComboWhatgame ), &dialog.game_combo ); + dialog.game_combo.game_select.connect( "changed", G_CALLBACK( OnSelchangeComboWhatgame ), &dialog.game_combo ); } { @@ -746,7 +746,7 @@ static void CreateGtkTextEditor(){ auto dlg = ui::Window( ui::window_type::TOP ); - g_signal_connect( G_OBJECT( dlg ), "delete_event", + dlg.connect( "delete_event", G_CALLBACK( editor_delete ), 0 ); gtk_window_set_default_size( GTK_WINDOW( dlg ), 600, 300 ); @@ -774,14 +774,14 @@ static void CreateGtkTextEditor(){ button = ui::Button( "Close" ); button.show(); gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", + button.connect( "clicked", G_CALLBACK( editor_close ), dlg ); gtk_widget_set_size_request( button, 60, -1 ); button = ui::Button( "Save" ); button.show(); gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", + button.connect( "clicked", G_CALLBACK( editor_save ), dlg ); gtk_widget_set_size_request( button, 60, -1 ); diff --git a/radiant/gtkmisc.cpp b/radiant/gtkmisc.cpp index 9035dbd2..693d569f 100644 --- a/radiant/gtkmisc.cpp +++ b/radiant/gtkmisc.cpp @@ -104,11 +104,11 @@ bool color_dialog( ui::Widget parent, Vector3& color, const char* title ){ dlg = ui::Widget(gtk_color_selection_dialog_new( title )); gtk_color_selection_set_current_color( GTK_COLOR_SELECTION( gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG( dlg )) ), &clr ); - g_signal_connect( G_OBJECT( dlg ), "delete_event", G_CALLBACK( dialog_delete_callback ), &dialog ); + dlg.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), &dialog ); GtkWidget *ok_button, *cancel_button; g_object_get(dlg, "ok-button", &ok_button, "cancel-button", &cancel_button, nullptr); - g_signal_connect( ok_button, "clicked", G_CALLBACK( dialog_button_ok ), &dialog ); - g_signal_connect( cancel_button, "clicked", G_CALLBACK( dialog_button_cancel ), &dialog ); + ui::Widget(ok_button).connect( "clicked", G_CALLBACK( dialog_button_ok ), &dialog ); + ui::Widget(cancel_button).connect( "clicked", G_CALLBACK( dialog_button_cancel ), &dialog ); if ( parent ) { gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( parent ) ); diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 4af997f9..27364c08 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -1621,7 +1621,7 @@ WaitDialog create_wait_dialog( const char* title, const char* text ){ gtk_container_set_border_width( GTK_CONTAINER( dialog.m_window ), 0 ); gtk_window_set_position( dialog.m_window, GTK_WIN_POS_CENTER_ON_PARENT ); - g_signal_connect( G_OBJECT( dialog.m_window ), "realize", G_CALLBACK( window_realize_remove_decoration ), 0 ); + dialog.m_window.connect( "realize", G_CALLBACK( window_realize_remove_decoration ), 0 ); { dialog.m_label = ui::Label( text ); @@ -2453,10 +2453,10 @@ public: WindowFocusPrinter( const char* name ) : m_name( name ){ } void connect( ui::Window toplevel_window ){ - g_signal_connect( G_OBJECT( toplevel_window ), "notify::has_toplevel_focus", G_CALLBACK( notify ), this ); - g_signal_connect( G_OBJECT( toplevel_window ), "notify::is_active", G_CALLBACK( notify ), this ); - g_signal_connect( G_OBJECT( toplevel_window ), "keys_changed", G_CALLBACK( keys_changed ), this ); - g_signal_connect( G_OBJECT( toplevel_window ), "frame_event", G_CALLBACK( frame_event ), this ); + toplevel_window.connect( "notify::has_toplevel_focus", G_CALLBACK( notify ), this ); + toplevel_window.connect( "notify::is_active", G_CALLBACK( notify ), this ); + toplevel_window.connect( "keys_changed", G_CALLBACK( keys_changed ), this ); + toplevel_window.connect( "frame_event", G_CALLBACK( frame_event ), this ); } }; @@ -2475,7 +2475,7 @@ static gboolean notify( ui::Window window, gpointer dummy, MainWindowActive* sel } public: void connect( ui::Window toplevel_window ){ - g_signal_connect( G_OBJECT( toplevel_window ), "notify::is-active", G_CALLBACK( notify ), this ); + toplevel_window.connect( "notify::is-active", G_CALLBACK( notify ), this ); } }; @@ -2721,7 +2721,7 @@ void MainFrame::Create(){ #endif gtk_widget_add_events( GTK_WIDGET( window ), GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK ); - g_signal_connect( G_OBJECT( window ), "delete_event", G_CALLBACK( mainframe_delete ), this ); + window.connect( "delete_event", G_CALLBACK( mainframe_delete ), this ); m_position_tracker.connect( window ); diff --git a/radiant/patchdialog.cpp b/radiant/patchdialog.cpp index c13280c4..a44fc103 100644 --- a/radiant/patchdialog.cpp +++ b/radiant/patchdialog.cpp @@ -608,7 +608,7 @@ ui::Window PatchInspector::BuildDialog(){ } { auto combo = ui::ComboBoxText(); - g_signal_connect( G_OBJECT( combo ), "changed", G_CALLBACK( OnSelchangeComboColRow ), this ); + combo.connect( "changed", G_CALLBACK( OnSelchangeComboColRow ), this ); AddDialogData( *GTK_COMBO_BOX(combo), m_nRow ); combo.show(); @@ -621,7 +621,7 @@ ui::Window PatchInspector::BuildDialog(){ { auto combo = ui::ComboBoxText(); - g_signal_connect( G_OBJECT( combo ), "changed", G_CALLBACK( OnSelchangeComboColRow ), this ); + combo.connect( "changed", G_CALLBACK( OnSelchangeComboColRow ), this ); AddDialogData( *GTK_COMBO_BOX(combo), m_nCol ); combo.show(); @@ -680,7 +680,7 @@ ui::Window PatchInspector::BuildDialog(){ (GtkAttachOptions)( 0 ), 0, 0 ); AddDialogData( *GTK_ENTRY(entry), m_fX ); - g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 ); + entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 ); } { auto entry = ui::Entry(); @@ -690,7 +690,7 @@ ui::Window PatchInspector::BuildDialog(){ (GtkAttachOptions)( 0 ), 0, 0 ); AddDialogData( *GTK_ENTRY(entry), m_fY ); - g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 ); + entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 ); } { auto entry = ui::Entry(); @@ -700,7 +700,7 @@ ui::Window PatchInspector::BuildDialog(){ (GtkAttachOptions)( 0 ), 0, 0 ); AddDialogData( *GTK_ENTRY(entry), m_fZ ); - g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 ); + entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 ); } { auto entry = ui::Entry(); @@ -710,7 +710,7 @@ ui::Window PatchInspector::BuildDialog(){ (GtkAttachOptions)( 0 ), 0, 0 ); AddDialogData( *GTK_ENTRY(entry), m_fS ); - g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 ); + entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 ); } { auto entry = ui::Entry(); @@ -720,7 +720,7 @@ ui::Window PatchInspector::BuildDialog(){ (GtkAttachOptions)( 0 ), 0, 0 ); AddDialogData( *GTK_ENTRY(entry), m_fT ); - g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 ); + entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 ); } } } @@ -753,7 +753,7 @@ ui::Window PatchInspector::BuildDialog(){ (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); m_subdivisions.m_enabled = check; - guint handler_id = g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( &Subdivisions::applyGtk ), &m_subdivisions ); + 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 ) ); } { @@ -815,7 +815,7 @@ ui::Window PatchInspector::BuildDialog(){ gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( entry ), TRUE, TRUE, 0 ); AddDialogData( *GTK_ENTRY(entry), m_strName ); - g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 ); + entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 ); } { auto table = ui::Table( 5, 4, FALSE ); @@ -853,7 +853,7 @@ ui::Window PatchInspector::BuildDialog(){ gtk_table_attach( table, GTK_WIDGET( button ), 3, 4, 2, 3, (GtkAttachOptions)( GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchFlipX ), 0 ); + button.connect( "clicked", G_CALLBACK( OnBtnPatchFlipX ), 0 ); gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 ); } { @@ -870,7 +870,7 @@ ui::Window PatchInspector::BuildDialog(){ gtk_table_attach( table, GTK_WIDGET( button ), 3, 4, 3, 4, (GtkAttachOptions)( GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchFlipY ), 0 ); + button.connect( "clicked", G_CALLBACK( OnBtnPatchFlipY ), 0 ); gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 ); } { @@ -894,7 +894,7 @@ ui::Window PatchInspector::BuildDialog(){ entry_set_float( entry, g_pi_globals.shift[0] ); auto adj = ui::Adjustment( 0, -8192, 8192, 1, 1, 0 ); - g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), (gpointer) entry ); + adj.connect( "value_changed", G_CALLBACK( OnSpinChanged ), (gpointer) entry ); g_object_set_data( G_OBJECT( window ), "hshift_adj", (gpointer) adj ); auto spin = ui::SpinButton( adj, 1, 0 ); @@ -915,7 +915,7 @@ ui::Window PatchInspector::BuildDialog(){ entry_set_float( entry, g_pi_globals.shift[1] ); auto adj = ui::Adjustment( 0, -8192, 8192, 1, 1, 0 ); - g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry ); + adj.connect( "value_changed", G_CALLBACK( OnSpinChanged ), entry ); g_object_set_data( G_OBJECT( window ), "vshift_adj", (gpointer) adj ); auto spin = ui::SpinButton( adj, 1, 0 ); @@ -936,7 +936,7 @@ ui::Window PatchInspector::BuildDialog(){ entry_set_float( entry, g_pi_globals.scale[0] ); auto adj = ui::Adjustment( 0, -1000, 1000, 1, 1, 0 ); - g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry ); + adj.connect( "value_changed", G_CALLBACK( OnSpinChanged ), entry ); g_object_set_data( G_OBJECT( window ), "hscale_adj", (gpointer) adj ); auto spin = ui::SpinButton( adj, 1, 0 ); @@ -957,7 +957,7 @@ ui::Window PatchInspector::BuildDialog(){ entry_set_float( entry, g_pi_globals.scale[1] ); auto adj = ui::Adjustment( 0, -1000, 1000, 1, 1, 0 ); - g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry ); + adj.connect( "value_changed", G_CALLBACK( OnSpinChanged ), entry ); g_object_set_data( G_OBJECT( window ), "vscale_adj", (gpointer) adj ); auto spin = ui::SpinButton( adj, 1, 0 ); @@ -978,7 +978,7 @@ ui::Window PatchInspector::BuildDialog(){ entry_set_float( entry, g_pi_globals.rotate ); auto adj = ui::Adjustment( 0, -1000, 1000, 1, 1, 0 ); // NOTE: Arnout - this really should be 360 but can't change it anymore as it could break existing maps - g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry ); + adj.connect( "value_changed", G_CALLBACK( OnSpinChanged ), entry ); g_object_set_data( G_OBJECT( window ), "rotate_adj", (gpointer) adj ); auto spin = ui::SpinButton( adj, 1, 0 ); @@ -997,35 +997,35 @@ ui::Window PatchInspector::BuildDialog(){ auto button = ui::Button( "Auto Cap" ); button.show(); gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchAutoCap ), 0 ); + button.connect( "clicked", G_CALLBACK( OnBtnPatchAutoCap ), 0 ); gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 ); } { auto button = ui::Button( "CAP" ); button.show(); gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchdetails ), 0 ); + button.connect( "clicked", G_CALLBACK( OnBtnPatchdetails ), 0 ); gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 ); } { auto button = ui::Button( "Set..." ); button.show(); gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchreset ), 0 ); + button.connect( "clicked", G_CALLBACK( OnBtnPatchreset ), 0 ); gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 ); } { auto button = ui::Button( "Natural" ); button.show(); gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchnatural ), 0 ); + button.connect( "clicked", G_CALLBACK( OnBtnPatchnatural ), 0 ); gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 ); } { auto button = ui::Button( "Fit" ); button.show(); gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchfit ), 0 ); + button.connect( "clicked", G_CALLBACK( OnBtnPatchfit ), 0 ); gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 ); } } diff --git a/radiant/pluginmenu.cpp b/radiant/pluginmenu.cpp index 4227bba1..d463aea7 100644 --- a/radiant/pluginmenu.cpp +++ b/radiant/pluginmenu.cpp @@ -101,7 +101,7 @@ void PlugInMenu_Add( ui::Menu plugin_menu, IPlugIn* pPlugIn ){ { item = ui::MenuItem( menuText ); g_object_set_data( G_OBJECT( item ),"command", const_cast( static_cast( menuCommand ) ) ); - g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( plugin_activated ), gint_to_pointer( m_nNextPlugInID ) ); + item.connect( "activate", G_CALLBACK( plugin_activated ), gint_to_pointer( m_nNextPlugInID ) ); } item.show(); menu.add(item); diff --git a/radiant/plugintoolbar.cpp b/radiant/plugintoolbar.cpp index 5753e76b..66deb284 100644 --- a/radiant/plugintoolbar.cpp +++ b/radiant/plugintoolbar.cpp @@ -66,7 +66,7 @@ void toolbar_insert( ui::Toolbar toolbar, const char* icon, const char* text, co auto button = ui::ToolButton(GTK_TOOL_BUTTON(gtk_tool_button_new(GTK_WIDGET(new_plugin_image(icon)), text))); gtk_widget_set_tooltip_text(button, tooltip); gtk_widget_show_all(button); - g_signal_connect(button, "clicked", G_CALLBACK(handler), data); + button.connect("clicked", G_CALLBACK(handler), data); toolbar.add(button); return; } @@ -76,7 +76,7 @@ void toolbar_insert( ui::Toolbar toolbar, const char* icon, const char* text, co gtk_tool_button_set_label(button, text); gtk_widget_set_tooltip_text(button, tooltip); gtk_widget_show_all(button); - g_signal_connect(button, "toggled", G_CALLBACK(handler), data); + button.connect("toggled", G_CALLBACK(handler), data); toolbar.add(button); return; } diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index 82100d61..6af5d58e 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -622,8 +622,8 @@ void ToggleButton_state_changed_Widget_updateDependency( ui::Widget toggleButton } void Widget_connectToggleDependency( ui::Widget self, ui::Widget toggleButton ){ - g_signal_connect( G_OBJECT( toggleButton ), "state_changed", G_CALLBACK( ToggleButton_state_changed_Widget_updateDependency ), self ); - g_signal_connect( G_OBJECT( toggleButton ), "toggled", G_CALLBACK( ToggleButton_toggled_Widget_updateDependency ), self ); + toggleButton.connect( "state_changed", G_CALLBACK( ToggleButton_state_changed_Widget_updateDependency ), self ); + toggleButton.connect( "toggled", G_CALLBACK( ToggleButton_toggled_Widget_updateDependency ), self ); Widget_updateDependency( self, toggleButton ); } @@ -742,8 +742,8 @@ ui::Window PrefsDlg::BuildDialog(){ } { - GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) ); - g_signal_connect( G_OBJECT( selection ), "changed", G_CALLBACK( treeSelection ), this ); + auto selection = ui::TreeSelection(gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) )); + selection.connect( "changed", G_CALLBACK( treeSelection ), this ); } view.show(); diff --git a/radiant/surfacedialog.cpp b/radiant/surfacedialog.cpp index ab0fc4fc..64ab34aa 100644 --- a/radiant/surfacedialog.cpp +++ b/radiant/surfacedialog.cpp @@ -813,7 +813,7 @@ ui::Window SurfaceInspector::BuildDialog(){ gtk_table_attach( GTK_TABLE( table ), button, 2, 4, 5, 6, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnMatchGrid ), 0 ); + button.connect( "clicked", G_CALLBACK( OnBtnMatchGrid ), 0 ); } } @@ -862,7 +862,7 @@ ui::Window SurfaceInspector::BuildDialog(){ gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", + button.connect( "clicked", G_CALLBACK( OnBtnAxial ), 0 ); gtk_widget_set_size_request( button, 60, -1 ); } @@ -872,7 +872,7 @@ ui::Window SurfaceInspector::BuildDialog(){ gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", + button.connect( "clicked", G_CALLBACK( OnBtnFaceFit ), 0 ); gtk_widget_set_size_request( button, 60, -1 ); } @@ -882,7 +882,7 @@ ui::Window SurfaceInspector::BuildDialog(){ gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 3, 4, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", + button.connect( "clicked", G_CALLBACK( OnBtnPatchdetails ), 0 ); gtk_widget_set_size_request( button, 60, -1 ); } @@ -892,7 +892,7 @@ ui::Window SurfaceInspector::BuildDialog(){ gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 3, 4, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", + button.connect( "clicked", G_CALLBACK( OnBtnPatchreset ), 0 ); gtk_widget_set_size_request( button, 60, -1 ); } @@ -902,7 +902,7 @@ ui::Window SurfaceInspector::BuildDialog(){ gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 3, 4, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", + button.connect( "clicked", G_CALLBACK( OnBtnPatchnatural ), 0 ); gtk_widget_set_size_request( button, 60, -1 ); } @@ -912,7 +912,7 @@ ui::Window SurfaceInspector::BuildDialog(){ gtk_table_attach( GTK_TABLE( table ), button, 3, 4, 3, 4, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", + button.connect( "clicked", G_CALLBACK( OnBtnPatchFit ), 0 ); gtk_widget_set_size_request( button, 60, -1 ); } @@ -1050,11 +1050,11 @@ ui::Window SurfaceInspector::BuildDialog(){ gtk_widget_set_size_request( TexTool::g_textoolWin, -1, 240 ); //Yeah! frame.add(TexTool::g_textoolWin); - g_signal_connect( G_OBJECT( TexTool::g_textoolWin ), "size_allocate", G_CALLBACK( TexTool::size_allocate ), NULL ); - g_signal_connect( G_OBJECT( TexTool::g_textoolWin ), "expose_event", G_CALLBACK( TexTool::expose ), NULL ); - g_signal_connect( G_OBJECT( TexTool::g_textoolWin ), "button_press_event", G_CALLBACK( TexTool::button_press ), NULL ); - g_signal_connect( G_OBJECT( TexTool::g_textoolWin ), "button_release_event", G_CALLBACK( TexTool::button_release ), NULL ); - g_signal_connect( G_OBJECT( TexTool::g_textoolWin ), "motion_notify_event", G_CALLBACK( TexTool::motion ), NULL ); + TexTool::g_textoolWin.connect( "size_allocate", G_CALLBACK( TexTool::size_allocate ), NULL ); + TexTool::g_textoolWin.connect( "expose_event", G_CALLBACK( TexTool::expose ), NULL ); + TexTool::g_textoolWin.connect( "button_press_event", G_CALLBACK( TexTool::button_press ), NULL ); + TexTool::g_textoolWin.connect( "button_release_event", G_CALLBACK( TexTool::button_release ), NULL ); + TexTool::g_textoolWin.connect( "motion_notify_event", G_CALLBACK( TexTool::motion ), NULL ); } { ui::Widget hbox = ui::HBox( FALSE, 5 ); @@ -1073,11 +1073,11 @@ ui::Window SurfaceInspector::BuildDialog(){ // frame.add(hbox); //Hmm. Do we really need g_object_set_data? Mebbe not... And we don't! :-) -// g_object_set_data(G_OBJECT(flipX), "handler", gint_to_pointer(g_signal_connect(G_OBJECT(flipX), "toggled", G_CALLBACK(TexTool::flipX), 0))); -// g_object_set_data(G_OBJECT(flipY), "handler", gint_to_pointer(g_signal_connect(G_OBJECT(flipY), "toggled", G_CALLBACK(TexTool::flipY), 0))); +// g_object_set_data(G_OBJECT(flipX), "handler", gint_to_pointer(flipX.connect("toggled", G_CALLBACK(TexTool::flipX), 0))); +// g_object_set_data(G_OBJECT(flipY), "handler", gint_to_pointer(flipY.connect("toggled", G_CALLBACK(TexTool::flipY), 0))); //Instead, just do: - g_signal_connect( G_OBJECT( flipX ), "toggled", G_CALLBACK( TexTool::flipX ), NULL ); - g_signal_connect( G_OBJECT( flipY ), "toggled", G_CALLBACK( TexTool::flipY ), NULL ); + flipX.connect( "toggled", G_CALLBACK( TexTool::flipX ), NULL ); + flipY.connect( "toggled", G_CALLBACK( TexTool::flipY ), NULL ); } } #endif diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index 3ab5900c..880347f5 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -1591,7 +1591,7 @@ void TextureBrowser_createTreeViewTree(){ gtk_tree_view_set_enable_search( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), FALSE ); gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), FALSE ); - g_signal_connect( g_TextureBrowser.m_treeViewTree, "row-activated", (GCallback) TreeView_onRowActivated, NULL ); + g_TextureBrowser.m_treeViewTree.connect( "row-activated", (GCallback) TreeView_onRowActivated, NULL ); auto renderer = ui::CellRendererText(); gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), -1, "", renderer, "text", 0, NULL ); @@ -1607,15 +1607,15 @@ void TextureBrowser_createContextMenu( ui::Widget treeview, GdkEventButton *even ui::Widget menu = ui::Menu(); ui::Widget menuitem = ui::MenuItem( "Add tag" ); - g_signal_connect( menuitem, "activate", (GCallback)TextureBrowser_addTag, treeview ); + menuitem.connect( "activate", (GCallback)TextureBrowser_addTag, treeview ); gtk_menu_shell_append( GTK_MENU_SHELL( menu ), menuitem ); menuitem = ui::MenuItem( "Rename tag" ); - g_signal_connect( menuitem, "activate", (GCallback)TextureBrowser_renameTag, treeview ); + menuitem.connect( "activate", (GCallback)TextureBrowser_renameTag, treeview ); gtk_menu_shell_append( GTK_MENU_SHELL( menu ), menuitem ); menuitem = ui::MenuItem( "Delete tag" ); - g_signal_connect( menuitem, "activate", (GCallback)TextureBrowser_deleteTag, treeview ); + menuitem.connect( "activate", (GCallback)TextureBrowser_deleteTag, treeview ); gtk_menu_shell_append( GTK_MENU_SHELL( menu ), menuitem ); gtk_widget_show_all( menu ); @@ -1646,7 +1646,7 @@ void TextureBrowser_createTreeViewTags(){ g_TextureBrowser.m_treeViewTags = ui::TreeView(); gtk_tree_view_set_enable_search( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), FALSE ); - g_signal_connect( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), "button-press-event", (GCallback)TreeViewTags_onButtonPressed, NULL ); + g_TextureBrowser.m_treeViewTags.connect( "button-press-event", (GCallback)TreeViewTags_onButtonPressed, NULL ); gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), FALSE ); @@ -1933,7 +1933,7 @@ void TextureBrowser_constructTagNotebook(){ gtk_notebook_append_page( GTK_NOTEBOOK( g_TextureBrowser.m_tag_notebook ), g_TextureBrowser.m_scr_win_tree, labelTextures ); gtk_notebook_append_page( GTK_NOTEBOOK( g_TextureBrowser.m_tag_notebook ), g_TextureBrowser.m_scr_win_tags, labelTags ); - g_signal_connect( G_OBJECT( g_TextureBrowser.m_tag_notebook ), "switch-page", G_CALLBACK( TextureBrowser_toggleSearchButton ), NULL ); + g_TextureBrowser.m_tag_notebook.connect( "switch-page", G_CALLBACK( TextureBrowser_toggleSearchButton ), NULL ); gtk_widget_show_all( g_TextureBrowser.m_tag_notebook ); } @@ -1941,7 +1941,7 @@ void TextureBrowser_constructTagNotebook(){ void TextureBrowser_constructSearchButton(){ ui::Widget image = ui::Widget(gtk_image_new_from_stock( GTK_STOCK_FIND, GTK_ICON_SIZE_SMALL_TOOLBAR )); g_TextureBrowser.m_search_button = ui::Button(); - g_signal_connect( G_OBJECT( g_TextureBrowser.m_search_button ), "clicked", G_CALLBACK( TextureBrowser_searchTags ), NULL ); + g_TextureBrowser.m_search_button.connect( "clicked", G_CALLBACK( TextureBrowser_searchTags ), NULL ); gtk_widget_set_tooltip_text(g_TextureBrowser.m_search_button, "Search with selected tags"); g_TextureBrowser.m_search_button.add(image); } @@ -2050,8 +2050,8 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ w.show(); g_TextureBrowser.m_texture_scroll = w; - GtkAdjustment *vadjustment = gtk_range_get_adjustment( GTK_RANGE( g_TextureBrowser.m_texture_scroll ) ); - g_signal_connect( G_OBJECT( vadjustment ), "value_changed", G_CALLBACK( TextureBrowser_verticalScroll ), &g_TextureBrowser ); + auto vadjustment = ui::Adjustment(gtk_range_get_adjustment( GTK_RANGE( g_TextureBrowser.m_texture_scroll ) )); + vadjustment.connect( "value_changed", G_CALLBACK( TextureBrowser_verticalScroll ), &g_TextureBrowser ); widget_set_visible( g_TextureBrowser.m_texture_scroll, g_TextureBrowser.m_showTextureScrollbar ); } @@ -2065,13 +2065,13 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ gtk_table_attach_defaults( GTK_TABLE( table ), g_TextureBrowser.m_gl_widget, 1, 2, 1, 2 ); g_TextureBrowser.m_gl_widget.show(); - g_TextureBrowser.m_sizeHandler = g_signal_connect( G_OBJECT( g_TextureBrowser.m_gl_widget ), "size_allocate", G_CALLBACK( TextureBrowser_size_allocate ), &g_TextureBrowser ); - g_TextureBrowser.m_exposeHandler = g_signal_connect( G_OBJECT( g_TextureBrowser.m_gl_widget ), "expose_event", G_CALLBACK( TextureBrowser_expose ), &g_TextureBrowser ); + g_TextureBrowser.m_sizeHandler = g_TextureBrowser.m_gl_widget.connect( "size_allocate", G_CALLBACK( TextureBrowser_size_allocate ), &g_TextureBrowser ); + g_TextureBrowser.m_exposeHandler = g_TextureBrowser.m_gl_widget.connect( "expose_event", G_CALLBACK( TextureBrowser_expose ), &g_TextureBrowser ); - g_signal_connect( G_OBJECT( g_TextureBrowser.m_gl_widget ), "button_press_event", G_CALLBACK( TextureBrowser_button_press ), &g_TextureBrowser ); - g_signal_connect( G_OBJECT( g_TextureBrowser.m_gl_widget ), "button_release_event", G_CALLBACK( TextureBrowser_button_release ), &g_TextureBrowser ); - g_signal_connect( G_OBJECT( g_TextureBrowser.m_gl_widget ), "motion_notify_event", G_CALLBACK( TextureBrowser_motion ), &g_TextureBrowser ); - g_signal_connect( G_OBJECT( g_TextureBrowser.m_gl_widget ), "scroll_event", G_CALLBACK( TextureBrowser_scroll ), &g_TextureBrowser ); + g_TextureBrowser.m_gl_widget.connect( "button_press_event", G_CALLBACK( TextureBrowser_button_press ), &g_TextureBrowser ); + g_TextureBrowser.m_gl_widget.connect( "button_release_event", G_CALLBACK( TextureBrowser_button_release ), &g_TextureBrowser ); + g_TextureBrowser.m_gl_widget.connect( "motion_notify_event", G_CALLBACK( TextureBrowser_motion ), &g_TextureBrowser ); + g_TextureBrowser.m_gl_widget.connect( "scroll_event", G_CALLBACK( TextureBrowser_scroll ), &g_TextureBrowser ); } // tag stuff @@ -2140,7 +2140,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ g_TextureBrowser.m_assigned_tree = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( g_TextureBrowser.m_assigned_store ) )); g_object_unref( G_OBJECT( g_TextureBrowser.m_assigned_store ) ); - g_signal_connect( g_TextureBrowser.m_assigned_tree, "row-activated", (GCallback) TextureBrowser_removeTags, NULL ); + g_TextureBrowser.m_assigned_tree.connect( "row-activated", (GCallback) TextureBrowser_removeTags, NULL ); gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_assigned_tree ), FALSE ); GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( g_TextureBrowser.m_assigned_tree ) ); @@ -2168,7 +2168,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ g_TextureBrowser.m_available_tree = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( g_TextureBrowser.m_available_store ) )); g_object_unref( G_OBJECT( g_TextureBrowser.m_available_store ) ); - g_signal_connect( g_TextureBrowser.m_available_tree, "row-activated", (GCallback) TextureBrowser_assignTags, NULL ); + g_TextureBrowser.m_available_tree.connect( "row-activated", (GCallback) TextureBrowser_assignTags, NULL ); gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_available_tree ), FALSE ); GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( g_TextureBrowser.m_available_tree ) ); @@ -2198,8 +2198,8 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ 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 ); - g_signal_connect( G_OBJECT( m_btn_left ), "clicked", G_CALLBACK( TextureBrowser_assignTags ), NULL ); - g_signal_connect( G_OBJECT( m_btn_right ), "clicked", G_CALLBACK( TextureBrowser_removeTags ), NULL ); + m_btn_left.connect( "clicked", G_CALLBACK( TextureBrowser_assignTags ), NULL ); + m_btn_right.connect( "clicked", G_CALLBACK( TextureBrowser_removeTags ), NULL ); m_btn_left.show(); m_btn_right.show(); diff --git a/radiant/windowobservers.cpp b/radiant/windowobservers.cpp index d30d0e3c..eafd725b 100644 --- a/radiant/windowobservers.cpp +++ b/radiant/windowobservers.cpp @@ -140,12 +140,12 @@ void GlobalWindowObservers_add( WindowObserver* observer ){ } void GlobalWindowObservers_connectTopLevel( ui::Window window ){ - g_signal_connect( G_OBJECT( window ), "key_press_event", G_CALLBACK( selection_modifier_key_press ), &g_window_observers ); - g_signal_connect( G_OBJECT( window ), "key_release_event", G_CALLBACK( selection_modifier_key_release ), &g_window_observers ); + window.connect( "key_press_event", G_CALLBACK( selection_modifier_key_press ), &g_window_observers ); + window.connect( "key_release_event", G_CALLBACK( selection_modifier_key_release ), &g_window_observers ); } void GlobalWindowObservers_connectWidget( ui::Widget widget ){ - g_signal_connect( G_OBJECT( widget ), "button_press_event", G_CALLBACK( modifiers_button_press ), &g_window_observers ); - g_signal_connect( G_OBJECT( widget ), "button_release_event", G_CALLBACK( modifiers_button_release ), &g_window_observers ); - g_signal_connect( G_OBJECT( widget ), "motion_notify_event", G_CALLBACK( modifiers_motion ), &g_window_observers ); + widget.connect( "button_press_event", G_CALLBACK( modifiers_button_press ), &g_window_observers ); + widget.connect( "button_release_event", G_CALLBACK( modifiers_button_release ), &g_window_observers ); + widget.connect( "motion_notify_event", G_CALLBACK( modifiers_motion ), &g_window_observers ); } diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index d375ef8e..81b6d3d0 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -833,15 +833,15 @@ XYWnd::XYWnd() : gtk_widget_set_events( 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( m_gl_widget, true ); - m_sizeHandler = g_signal_connect( G_OBJECT( m_gl_widget ), "size_allocate", G_CALLBACK( xywnd_size_allocate ), this ); - m_exposeHandler = g_signal_connect( G_OBJECT( m_gl_widget ), "expose_event", G_CALLBACK( xywnd_expose ), this ); + m_sizeHandler = m_gl_widget.connect( "size_allocate", G_CALLBACK( xywnd_size_allocate ), this ); + m_exposeHandler = m_gl_widget.connect( "expose_event", G_CALLBACK( xywnd_expose ), this ); - g_signal_connect( G_OBJECT( m_gl_widget ), "button_press_event", G_CALLBACK( xywnd_button_press ), this ); - g_signal_connect( G_OBJECT( m_gl_widget ), "button_release_event", G_CALLBACK( xywnd_button_release ), this ); - g_signal_connect( G_OBJECT( m_gl_widget ), "focus_in_event", G_CALLBACK( xywnd_focus_in ), this ); - g_signal_connect( G_OBJECT( m_gl_widget ), "motion_notify_event", G_CALLBACK( DeferredMotion::gtk_motion ), &m_deferred_motion ); + m_gl_widget.connect( "button_press_event", G_CALLBACK( xywnd_button_press ), this ); + m_gl_widget.connect( "button_release_event", G_CALLBACK( xywnd_button_release ), this ); + m_gl_widget.connect( "focus_in_event", G_CALLBACK( xywnd_focus_in ), this ); + m_gl_widget.connect( "motion_notify_event", G_CALLBACK( DeferredMotion::gtk_motion ), &m_deferred_motion ); - g_signal_connect( G_OBJECT( m_gl_widget ), "scroll_event", G_CALLBACK( xywnd_wheel_scroll ), this ); + m_gl_widget.connect( "scroll_event", G_CALLBACK( xywnd_wheel_scroll ), this ); Map_addValidCallback( g_map, DeferredDrawOnMapValidChangedCaller( m_deferredDraw ) ); @@ -1078,7 +1078,7 @@ void entitycreate_activated( ui::Widget item ){ void EntityClassMenu_addItem( ui::Menu menu, const char* name ){ auto item = ui::MenuItem( name ); - g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( entitycreate_activated ), item ); + item.connect( "activate", G_CALLBACK( entitycreate_activated ), item ); item.show(); menu_add_item( menu, item ); } @@ -1185,7 +1185,7 @@ void XYWnd::Move_Begin(){ } m_move_started = true; g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), XYWnd_moveDelta, this ); - m_move_focusOut = g_signal_connect( G_OBJECT( m_gl_widget ), "focus_out_event", G_CALLBACK( XYWnd_Move_focusOut ), this ); + m_move_focusOut = m_gl_widget.connect( "focus_out_event", G_CALLBACK( XYWnd_Move_focusOut ), this ); } void XYWnd::Move_End(){ @@ -1231,7 +1231,7 @@ void XYWnd::Zoom_Begin(){ m_zoom_started = true; g_dragZoom = 0; g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), XYWnd_zoomDelta, this ); - m_zoom_focusOut = g_signal_connect( G_OBJECT( m_gl_widget ), "focus_out_event", G_CALLBACK( XYWnd_Zoom_focusOut ), this ); + m_zoom_focusOut = m_gl_widget.connect( "focus_out_event", G_CALLBACK( XYWnd_Zoom_focusOut ), this ); } void XYWnd::Zoom_End(){ -- 2.39.2