From 59d80aad0b99a9abb0372bf2d1ad9aac3cd01e5c Mon Sep 17 00:00:00 2001 From: TimePath Date: Wed, 17 Feb 2016 15:35:29 +1100 Subject: [PATCH] Wrap GtkAdjustment --- contrib/brushexport/callbacks.cpp | 2 +- contrib/camera/dialogs.cpp | 2 +- contrib/gtkgensurf/gendlgs.cpp | 14 ++++++------ contrib/gtkgensurf/view.cpp | 4 ++-- contrib/prtview/ConfigDialog.cpp | 17 +++++++------- contrib/sunplug/sunplug.cpp | 8 +++---- libs/uilib/uilib.cpp | 7 ++++++ libs/uilib/uilib.h | 38 +++++++++++++++++++++---------- radiant/camwindow.cpp | 2 +- radiant/dialog.cpp | 6 ++--- radiant/mainframe.cpp | 2 +- radiant/patchdialog.cpp | 10 ++++---- radiant/select.cpp | 6 ++--- radiant/surfacedialog.cpp | 14 ++++++------ radiant/texwindow.cpp | 4 ++-- radiant/xywindow.cpp | 4 ++-- 16 files changed, 80 insertions(+), 60 deletions(-) diff --git a/contrib/brushexport/callbacks.cpp b/contrib/brushexport/callbacks.cpp index 828ccdea..be8d0bae 100644 --- a/contrib/brushexport/callbacks.cpp +++ b/contrib/brushexport/callbacks.cpp @@ -19,7 +19,7 @@ void OnDestroy( GtkWidget* w, gpointer data ){ void OnExportClicked( GtkButton* button, gpointer user_data ){ ui::Widget window = lookup_widget( GTK_WIDGET( button ), "w_plugplug2" ); - ASSERT_NOTNULL( window ); + ASSERT_TRUE( window ); const char* cpath = GlobalRadiant().m_pfnFileDialog( window, false, "Save as Obj", 0, 0, false, false, true ); if ( !cpath ) { return; diff --git a/contrib/camera/dialogs.cpp b/contrib/camera/dialogs.cpp index 63fde75e..1e5f31b8 100644 --- a/contrib/camera/dialogs.cpp +++ b/contrib/camera/dialogs.cpp @@ -1219,7 +1219,7 @@ GtkWidget *CreateCameraInspectorDialog( void ){ gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 ); gtk_widget_show( hbox ); - g_pTimeLine = GTK_ADJUSTMENT( gtk_adjustment_new( 0, 0, 30000, 100, 250, 0 ) ); + g_pTimeLine = ui::Adjustment( 0, 0, 30000, 100, 250, 0 ); gtk_signal_connect( GTK_OBJECT( g_pTimeLine ), "value_changed", GTK_SIGNAL_FUNC( ci_timeline_changed ), NULL ); w = gtk_hscale_new( g_pTimeLine ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); diff --git a/contrib/gtkgensurf/gendlgs.cpp b/contrib/gtkgensurf/gendlgs.cpp index e4736401..08791cc8 100644 --- a/contrib/gtkgensurf/gendlgs.cpp +++ b/contrib/gtkgensurf/gendlgs.cpp @@ -1514,7 +1514,7 @@ GtkWidget* create_main_dialog(){ g_object_set_data( G_OBJECT( dlg ), "roughness", entry ); g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Roughness ); - adj = gtk_adjustment_new( 1, 1, 32767, 1, 10, 0 ); + adj = ui::Adjustment( 1, 1, 32767, 1, 10, 0 ); g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( general_random ), NULL ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); gtk_widget_show( spin ); @@ -1648,7 +1648,7 @@ GtkWidget* create_main_dialog(){ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); g_object_set_data( G_OBJECT( dlg ), "nv_text", label ); - adj = gtk_adjustment_new( 8, 1, MAX_ROWS, 1, 10, 0 ); + adj = ui::Adjustment( 8, 1, MAX_ROWS, 1, 10, 0 ); g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( extents_nhnv_spin ), &NH ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); gtk_widget_show( spin ); @@ -1658,7 +1658,7 @@ GtkWidget* create_main_dialog(){ gtk_widget_set_usize( spin, 60, -2 ); g_object_set_data( G_OBJECT( dlg ), "nh", spin ); - adj = gtk_adjustment_new( 8, 1, MAX_ROWS, 1, 10, 0 ); + adj = ui::Adjustment( 8, 1, MAX_ROWS, 1, 10, 0 ); g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( extents_nhnv_spin ), &NV ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); gtk_widget_show( spin ); @@ -1680,7 +1680,7 @@ GtkWidget* create_main_dialog(){ gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, TRUE, 0 ); gtk_object_set_data( GTK_OBJECT( dlg ), "snap_text", label ); - adj = gtk_adjustment_new( 8, 0, 256, 1, 10, 0 ); + adj = ui::Adjustment( 8, 0, 256, 1, 10, 0 ); g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( extents_snaptogrid_spin ), &SP ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); gtk_widget_show( spin ); @@ -1697,7 +1697,7 @@ GtkWidget* create_main_dialog(){ gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 ); - adj = gtk_adjustment_new( 0, 0, 110, 1, 10, 0 ); + adj = ui::Adjustment( 0, 0, 110, 1, 10, 0 ); g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( extents_decimate ), NULL ); g_object_set_data( G_OBJECT( dlg ), "decimate_adj", adj ); scale = gtk_hscale_new( GTK_ADJUSTMENT( adj ) ); @@ -1940,7 +1940,7 @@ GtkWidget* create_main_dialog(){ gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); g_object_set_data( G_OBJECT( dlg ), "fix_rate_text", label ); - adj = gtk_adjustment_new( 0, -65536, 65536, 1, 16, 0 ); + adj = ui::Adjustment( 0, -65536, 65536, 1, 16, 0 ); g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( fix_value_changed ), NULL ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); gtk_widget_show( spin ); @@ -2057,7 +2057,7 @@ GtkWidget* create_main_dialog(){ gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 ); - adj = gtk_adjustment_new( 60, 0, 90, 1, 10, 0 ); + adj = ui::Adjustment( 60, 0, 90, 1, 10, 0 ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); gtk_widget_show( spin ); gtk_box_pack_start( GTK_BOX( hbox2 ), spin, FALSE, TRUE, 0 ); diff --git a/contrib/gtkgensurf/view.cpp b/contrib/gtkgensurf/view.cpp index 31a6e16c..fc88bedc 100644 --- a/contrib/gtkgensurf/view.cpp +++ b/contrib/gtkgensurf/view.cpp @@ -393,14 +393,14 @@ void CreateViewWindow(){ gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_box_pack_start( GTK_BOX( hbox ), label, FALSE, TRUE, 0 ); - adj = gtk_adjustment_new( 30, -90, 90, 1, 10, 0 ); + adj = ui::Adjustment( 30, -90, 90, 1, 10, 0 ); gtk_signal_connect( adj, "value_changed", GTK_SIGNAL_FUNC( preview_spin ), &elevation ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( 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 ); - adj = gtk_adjustment_new( 30, 0, 359, 1, 10, 0 ); + adj = ui::Adjustment( 30, 0, 359, 1, 10, 0 ); gtk_signal_connect( adj, "value_changed", GTK_SIGNAL_FUNC( preview_spin ), &azimuth ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); gtk_widget_show( spin ); diff --git a/contrib/prtview/ConfigDialog.cpp b/contrib/prtview/ConfigDialog.cpp index 02457414..51bf9885 100644 --- a/contrib/prtview/ConfigDialog.cpp +++ b/contrib/prtview/ConfigDialog.cpp @@ -245,7 +245,6 @@ void DoConfigDialog(){ GtkWidget *transslider, *translabel, *clipslider, *cliplabel; GtkWidget *show2check, *show3check, *portalcheck; int loop = 1, ret = IDCANCEL; - GtkObject *adj; dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); gtk_window_set_title( GTK_WINDOW( dlg ), "Portal Viewer Configuration" ); @@ -274,7 +273,7 @@ void DoConfigDialog(){ gtk_widget_show( hbox ); gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, TRUE, 0 ); - adj = gtk_adjustment_new( portals.width_3d, 2, 40, 1, 1, 0 ); + auto adj = ui::Adjustment( portals.width_3d, 2, 40, 1, 1, 0 ); lw3slider = gtk_hscale_new( GTK_ADJUSTMENT( adj ) ); gtk_widget_show( lw3slider ); gtk_box_pack_start( GTK_BOX( hbox ), lw3slider, TRUE, TRUE, 0 ); @@ -283,7 +282,7 @@ void DoConfigDialog(){ lw3label = ui::Label( "" ); gtk_widget_show( lw3label ); gtk_box_pack_start( GTK_BOX( hbox ), lw3label, FALSE, TRUE, 0 ); - gtk_signal_connect( adj, "value_changed", GTK_SIGNAL_FUNC( OnScroll3d ), lw3label ); + gtk_signal_connect( GTK_OBJECT(adj), "value_changed", GTK_SIGNAL_FUNC( OnScroll3d ), lw3label ); table = ui::Table( 2, 4, FALSE ); gtk_widget_show( table ); @@ -365,7 +364,7 @@ void DoConfigDialog(){ gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); - adj = gtk_adjustment_new( portals.trans_3d, 0, 100, 1, 1, 0 ); + adj = ui::Adjustment( portals.trans_3d, 0, 100, 1, 1, 0 ); transslider = gtk_hscale_new( GTK_ADJUSTMENT( adj ) ); gtk_widget_show( transslider ); gtk_table_attach( GTK_TABLE( table ), transslider, 0, 1, 0, 1, @@ -379,9 +378,9 @@ void DoConfigDialog(){ (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( translabel ), 0.0, 0.0 ); - gtk_signal_connect( adj, "value_changed", GTK_SIGNAL_FUNC( OnScrollTrans ), translabel ); + gtk_signal_connect( GTK_OBJECT(adj), "value_changed", GTK_SIGNAL_FUNC( OnScrollTrans ), translabel ); - adj = gtk_adjustment_new( portals.clip_range, 1, 128, 1, 1, 0 ); + adj = ui::Adjustment( portals.clip_range, 1, 128, 1, 1, 0 ); clipslider = gtk_hscale_new( GTK_ADJUSTMENT( adj ) ); gtk_widget_show( clipslider ); gtk_table_attach( GTK_TABLE( table ), clipslider, 0, 1, 1, 2, @@ -395,7 +394,7 @@ void DoConfigDialog(){ (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( cliplabel ), 0.0, 0.0 ); - gtk_signal_connect( adj, "value_changed", GTK_SIGNAL_FUNC( OnScrollClip ), cliplabel ); + gtk_signal_connect( GTK_OBJECT(adj), "value_changed", GTK_SIGNAL_FUNC( OnScrollClip ), cliplabel ); hbox = ui::HBox( TRUE, 5 ); gtk_widget_show( hbox ); @@ -424,7 +423,7 @@ void DoConfigDialog(){ gtk_widget_show( hbox ); gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, FALSE, 0 ); - adj = gtk_adjustment_new( portals.width_2d, 2, 40, 1, 1, 0 ); + adj = ui::Adjustment( portals.width_2d, 2, 40, 1, 1, 0 ); lw2slider = gtk_hscale_new( GTK_ADJUSTMENT( adj ) ); gtk_widget_show( lw2slider ); gtk_box_pack_start( GTK_BOX( hbox ), lw2slider, TRUE, TRUE, 0 ); @@ -433,7 +432,7 @@ void DoConfigDialog(){ lw2label = ui::Label( "" ); gtk_widget_show( lw2label ); gtk_box_pack_start( GTK_BOX( hbox ), lw2label, FALSE, TRUE, 0 ); - gtk_signal_connect( adj, "value_changed", GTK_SIGNAL_FUNC( OnScroll2d ), lw2label ); + gtk_signal_connect( GTK_OBJECT(adj), "value_changed", GTK_SIGNAL_FUNC( OnScroll2d ), lw2label ); hbox = ui::HBox( FALSE, 5 ); gtk_widget_show( hbox ); diff --git a/contrib/sunplug/sunplug.cpp b/contrib/sunplug/sunplug.cpp index 5a68dc8a..895ec17c 100644 --- a/contrib/sunplug/sunplug.cpp +++ b/contrib/sunplug/sunplug.cpp @@ -367,10 +367,10 @@ void MapCoordinator(){ globalOutputStream() << "SunPlug: adviced mapcoordsmins=" << minX << " " << maxY << "\n"; // console info about mapcoordsmins globalOutputStream() << "SunPlug: adviced mapcoordsmaxs=" << maxX << " " << minY << "\n"; // console info about mapcoordsmaxs - spinner_adj_MinX = (GtkAdjustment *)gtk_adjustment_new( map_minX, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of minimum x value - spinner_adj_MinY = (GtkAdjustment *)gtk_adjustment_new( map_minY, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of minimum y value - spinner_adj_MaxX = (GtkAdjustment *)gtk_adjustment_new( map_maxX, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of maximum x value - spinner_adj_MaxY = (GtkAdjustment *)gtk_adjustment_new( map_maxY, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of maximum y value + spinner_adj_MinX = ui::Adjustment( map_minX, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of minimum x value + spinner_adj_MinY = ui::Adjustment( map_minY, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of minimum y value + 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 + 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 diff --git a/libs/uilib/uilib.cpp b/libs/uilib/uilib.cpp index 0e735c6d..838832f8 100644 --- a/libs/uilib/uilib.cpp +++ b/libs/uilib/uilib.cpp @@ -84,6 +84,13 @@ namespace ui { return g_signal_connect(G_OBJECT(*this), "key-press-event", (GCallback) +func, &pass); } + Adjustment::Adjustment(double value, + double lower, double upper, + double step_increment, double page_increment, + double page_size) + : Adjustment(GTK_ADJUSTMENT(gtk_adjustment_new(value, lower, upper, step_increment, page_increment, page_size))) + { } + Alignment::Alignment(float xalign, float yalign, float xscale, float yscale) : Alignment(GTK_ALIGNMENT(gtk_alignment_new(xalign, yalign, xscale, yscale))) { } diff --git a/libs/uilib/uilib.h b/libs/uilib/uilib.h index 07c143bb..fb4bbfe6 100644 --- a/libs/uilib/uilib.h +++ b/libs/uilib/uilib.h @@ -3,6 +3,7 @@ #include +using ui_adjustment = struct _GtkAdjustment; using ui_alignment = struct _GtkAlignment; using ui_box = struct _GtkBox; using ui_button = struct _GtkButton; @@ -16,6 +17,7 @@ using ui_label = struct _GtkLabel; using ui_menu = struct _GtkMenu; using ui_menuitem = struct _GtkMenuItem; using ui_modal = struct ModalDialog; +using ui_object = struct _GtkObject; using ui_scrolledwindow = struct _GtkScrolledWindow; using ui_table = struct _GtkTable; using ui_treemodel = struct _GtkTreeModel; @@ -54,21 +56,26 @@ namespace ui { NO, }; - template - class Convertible { - public: - T *handle() const - { return (T *) static_cast(this)->_handle; } + template + struct Convertible; + template + struct Convertible { operator T *() const - { return handle(); } + { return reinterpret_cast(static_cast(this)->_handle); } + }; + + template + struct Convertible { + explicit operator T *() const + { return reinterpret_cast(static_cast(this)->_handle); } }; - class Base { + class Object : public Convertible { public: void *_handle; - Base(void *h) : _handle(h) + Object(void *h) : _handle(h) { } explicit operator bool() const @@ -81,12 +88,12 @@ namespace ui { { return _handle; } }; - static_assert(sizeof(Base) == sizeof(ui_widget *), "object slicing"); + static_assert(sizeof(Object) == sizeof(ui_widget *), "object slicing"); - class Widget : public Base, public Convertible { + class Widget : public Object, public Convertible { public: using native = ui_widget; - explicit Widget(ui_widget *h = nullptr) : Base((void *) h) + explicit Widget(ui_widget *h = nullptr) : Object((void *) h) { } alert_response alert(std::string text, std::string title = "NetRadiant", @@ -97,7 +104,7 @@ namespace ui { bool want_save = false); }; - static_assert(sizeof(Widget) == sizeof(Base), "object slicing"); + static_assert(sizeof(Widget) == sizeof(Object), "object slicing"); extern Widget root; @@ -110,6 +117,13 @@ namespace ui { }; \ static_assert(sizeof(name) == sizeof(super), "object slicing") + WRAP(Adjustment, Widget, ui_adjustment, + Adjustment(double value, + double lower, double upper, + double step_increment, double page_increment, + double page_size); + ); + WRAP(Alignment, Widget, ui_alignment, Alignment(float xalign, float yalign, float xscale, float yscale); ); diff --git a/radiant/camwindow.cpp b/radiant/camwindow.cpp index dd36b064..54c79647 100644 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@ -849,7 +849,7 @@ void selection_motion( gdouble x, gdouble y, guint state, void* data ){ } inline WindowVector windowvector_for_widget_centre( ui::Widget widget ){ - return WindowVector( static_cast( widget.handle()->allocation.width / 2 ), static_cast( widget.handle()->allocation.height / 2 ) ); + return WindowVector( static_cast( GTK_WIDGET(widget)->allocation.width / 2 ), static_cast(GTK_WIDGET(widget)->allocation.height / 2 ) ); } gboolean selection_button_press_freemove( ui::Widget widget, GdkEventButton* event, WindowObserver* observer ){ diff --git a/radiant/dialog.cpp b/radiant/dialog.cpp index a77c29ff..5540be31 100644 --- a/radiant/dialog.cpp +++ b/radiant/dialog.cpp @@ -92,7 +92,7 @@ GtkSpinButton* DialogSpinner_new( double value, double lower, double upper, int { ++digits; } - GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( value, lower, upper, step, 10, 0 ) ), step, digits ) ); + GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( ui::Adjustment( value, lower, upper, step, 10, 0 ), step, digits ) ); gtk_widget_show( GTK_WIDGET( spin ) ); gtk_widget_set_size_request( GTK_WIDGET( spin ), 64, -1 ); return spin; @@ -522,8 +522,8 @@ void Dialog::addSlider( ui::Widget vbox, const char* name, int& data, gboolean d #endif // adjustment - GtkObject* adj = gtk_adjustment_new( value, lower, upper, step_increment, page_increment, 0 ); - AddIntAdjustmentData( *GTK_ADJUSTMENT( adj ), IntImportCaller( data ), IntExportCaller( data ) ); + auto adj = ui::Adjustment( value, lower, upper, step_increment, page_increment, 0 ); + AddIntAdjustmentData( *GTK_ADJUSTMENT(adj), IntImportCaller( data ), IntExportCaller( data ) ); // scale ui::Widget alignment = ui::Alignment( 0.0, 0.5, 1.0, 0.0 ); diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index e5c68ce6..35a7cb72 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -1606,7 +1606,7 @@ void EverySecondTimer_disable(){ } gint window_realize_remove_decoration( ui::Widget widget, gpointer data ){ - gdk_window_set_decorations( widget.handle()->window, (GdkWMDecoration)( GDK_DECOR_ALL | GDK_DECOR_MENU | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE ) ); + gdk_window_set_decorations( GTK_WIDGET(widget)->window, (GdkWMDecoration)( GDK_DECOR_ALL | GDK_DECOR_MENU | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE ) ); return FALSE; } diff --git a/radiant/patchdialog.cpp b/radiant/patchdialog.cpp index 5f921882..0f074114 100644 --- a/radiant/patchdialog.cpp +++ b/radiant/patchdialog.cpp @@ -902,7 +902,7 @@ ui::Window PatchInspector::BuildDialog(){ // so we need to have at least one initialisation somewhere entry_set_float( entry, g_pi_globals.shift[0] ); - GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 1, 1, 0 ) ); + GtkAdjustment* adj = ui::Adjustment( 0, -8192, 8192, 1, 1, 0 ); g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry ); g_object_set_data( G_OBJECT( window ), "hshift_adj", adj ); @@ -923,7 +923,7 @@ ui::Window PatchInspector::BuildDialog(){ gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 ); entry_set_float( entry, g_pi_globals.shift[1] ); - GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 1, 1, 0 ) ); + GtkAdjustment* adj = ui::Adjustment( 0, -8192, 8192, 1, 1, 0 ); g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry ); g_object_set_data( G_OBJECT( window ), "vshift_adj", adj ); @@ -944,7 +944,7 @@ ui::Window PatchInspector::BuildDialog(){ gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 ); entry_set_float( entry, g_pi_globals.scale[0] ); - GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -1000, 1000, 1, 1, 0 ) ); + GtkAdjustment* adj = ui::Adjustment( 0, -1000, 1000, 1, 1, 0 ); g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry ); g_object_set_data( G_OBJECT( window ), "hscale_adj", adj ); @@ -965,7 +965,7 @@ ui::Window PatchInspector::BuildDialog(){ gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 ); entry_set_float( entry, g_pi_globals.scale[1] ); - GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -1000, 1000, 1, 1, 0 ) ); + GtkAdjustment* adj = ui::Adjustment( 0, -1000, 1000, 1, 1, 0 ); g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry ); g_object_set_data( G_OBJECT( window ), "vscale_adj", adj ); @@ -986,7 +986,7 @@ ui::Window PatchInspector::BuildDialog(){ gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 ); entry_set_float( entry, g_pi_globals.rotate ); - GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 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 + GtkAdjustment* 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 ); g_object_set_data( G_OBJECT( window ), "rotate_adj", adj ); diff --git a/radiant/select.cpp b/radiant/select.cpp index b05bbe0d..37f88bfa 100644 --- a/radiant/select.cpp +++ b/radiant/select.cpp @@ -945,7 +945,7 @@ void DoRotateDlg(){ (GtkAttachOptions) ( 0 ), 0, 0 ); } { - GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -359, 359, 1, 10, 0 ) ); + GtkAdjustment* adj = ui::Adjustment( 0, -359, 359, 1, 10, 0 ); GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) ); gtk_widget_show( GTK_WIDGET( spin ) ); gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 0, 1, @@ -959,7 +959,7 @@ void DoRotateDlg(){ g_rotate_dialog.x = spin; } { - GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -359, 359, 1, 10, 0 ) ); + GtkAdjustment* adj = ui::Adjustment( 0, -359, 359, 1, 10, 0 ); GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) ); gtk_widget_show( GTK_WIDGET( spin ) ); gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 1, 2, @@ -971,7 +971,7 @@ void DoRotateDlg(){ g_rotate_dialog.y = spin; } { - GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -359, 359, 1, 10, 0 ) ); + GtkAdjustment* adj = ui::Adjustment( 0, -359, 359, 1, 10, 0 ); GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) ); gtk_widget_show( GTK_WIDGET( spin ) ); gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 2, 3, diff --git a/radiant/surfacedialog.cpp b/radiant/surfacedialog.cpp index cb64e940..07dd1e61 100644 --- a/radiant/surfacedialog.cpp +++ b/radiant/surfacedialog.cpp @@ -640,7 +640,7 @@ ui::Window SurfaceInspector::BuildDialog(){ (GtkAttachOptions) ( 0 ), 0, 0 ); } { - GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 2 ) ); + GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 ) ); m_hshiftIncrement.m_spin = spin; m_hshiftSpinner.connect( spin ); gtk_widget_show( GTK_WIDGET( spin ) ); @@ -676,7 +676,7 @@ ui::Window SurfaceInspector::BuildDialog(){ (GtkAttachOptions) ( 0 ), 0, 0 ); } { - GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 2 ) ); + GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 ) ); m_vshiftIncrement.m_spin = spin; m_vshiftSpinner.connect( spin ); gtk_widget_show( GTK_WIDGET( spin ) ); @@ -712,7 +712,7 @@ ui::Window SurfaceInspector::BuildDialog(){ (GtkAttachOptions) ( 0 ), 0, 0 ); } { - GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 5 ) ); + GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 5 ) ); m_hscaleIncrement.m_spin = spin; m_hscaleSpinner.connect( spin ); gtk_widget_show( GTK_WIDGET( spin ) ); @@ -748,7 +748,7 @@ ui::Window SurfaceInspector::BuildDialog(){ (GtkAttachOptions) ( 0 ), 0, 0 ); } { - GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 5 ) ); + GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 5 ) ); m_vscaleIncrement.m_spin = spin; m_vscaleSpinner.connect( spin ); gtk_widget_show( GTK_WIDGET( spin ) ); @@ -784,7 +784,7 @@ ui::Window SurfaceInspector::BuildDialog(){ (GtkAttachOptions) ( 0 ), 0, 0 ); } { - GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 2 ) ); + GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 ) ); m_rotateIncrement.m_spin = spin; m_rotateSpinner.connect( spin ); gtk_widget_show( GTK_WIDGET( spin ) ); @@ -923,7 +923,7 @@ ui::Window SurfaceInspector::BuildDialog(){ gtk_widget_set_usize( button, 60, -2 ); } { - ui::Widget spin = ui::Widget(gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 0, 1 << 16, 1, 10, 0 ) ), 0, 6 )); + ui::Widget spin = ui::Widget(gtk_spin_button_new( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 )); gtk_widget_show( spin ); gtk_table_attach( GTK_TABLE( table ), spin, 2, 3, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), @@ -932,7 +932,7 @@ ui::Window SurfaceInspector::BuildDialog(){ AddDialogData( *GTK_SPIN_BUTTON( spin ), m_fitHorizontal ); } { - ui::Widget spin = ui::Widget(gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 0, 1 << 16, 1, 10, 0 ) ), 0, 6 )); + ui::Widget spin = ui::Widget(gtk_spin_button_new( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 )); gtk_widget_show( spin ); gtk_table_attach( GTK_TABLE( table ), spin, 3, 4, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index a86d65e4..88d0c002 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -1987,7 +1987,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ gtk_widget_show( GTK_WIDGET( g_TextureBrowser.m_treeViewTree ) ); } { // gl_widget scrollbar - ui::Widget w = ui::Widget(gtk_vscrollbar_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,0,1,1,0 ) ) )); + ui::Widget w = ui::Widget(gtk_vscrollbar_new( ui::Adjustment( 0,0,0,1,1,0 ) )); gtk_table_attach( GTK_TABLE( table ), w, 2, 3, 1, 2, GTK_SHRINK, GTK_FILL, 0, 0 ); gtk_widget_show( w ); g_TextureBrowser.m_texture_scroll = w; @@ -2361,7 +2361,7 @@ void RefreshShaders(){ ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Loading Shaders" ); GlobalShaderSystem().refresh(); UpdateAllWindows(); - GtkTreeSelection* selection = gtk_tree_view_get_selection((GtkTreeView*) GlobalTextureBrowser().m_treeViewTree.handle()); + GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(GlobalTextureBrowser().m_treeViewTree)); GtkTreeModel* model = NULL; GtkTreeIter iter; if ( gtk_tree_selection_get_selected (selection, &model, &iter) ) diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index 4e59f9f7..fafb1dad 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -946,12 +946,12 @@ void XYWnd::Clipper_Crosshair_OnMouseMoved( int x, int y ){ if ( ClipMode() && GlobalClipPoints_Find( mousePosition, (VIEWTYPE)m_viewType, m_fScale ) != 0 ) { GdkCursor *cursor; cursor = gdk_cursor_new( GDK_CROSSHAIR ); - gdk_window_set_cursor( m_gl_widget.handle()->window, cursor ); + gdk_window_set_cursor( GTK_WIDGET(m_gl_widget)->window, cursor ); gdk_cursor_unref( cursor ); } else { - gdk_window_set_cursor( m_gl_widget.handle()->window, 0 ); + gdk_window_set_cursor( GTK_WIDGET(m_gl_widget)->window, 0 ); } } -- 2.39.2