]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
Wrap GtkAdjustment
authorTimePath <andrew.hardaker1995@gmail.com>
Wed, 17 Feb 2016 04:35:29 +0000 (15:35 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Wed, 17 Feb 2016 04:35:29 +0000 (15:35 +1100)
16 files changed:
contrib/brushexport/callbacks.cpp
contrib/camera/dialogs.cpp
contrib/gtkgensurf/gendlgs.cpp
contrib/gtkgensurf/view.cpp
contrib/prtview/ConfigDialog.cpp
contrib/sunplug/sunplug.cpp
libs/uilib/uilib.cpp
libs/uilib/uilib.h
radiant/camwindow.cpp
radiant/dialog.cpp
radiant/mainframe.cpp
radiant/patchdialog.cpp
radiant/select.cpp
radiant/surfacedialog.cpp
radiant/texwindow.cpp
radiant/xywindow.cpp

index 828ccdea180dec94e12d592c679dd98ffbd35544..be8d0bae54f45be693f482c9620fe9fa685a8f1f 100644 (file)
@@ -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;
index 63fde75e03d74a8df7d371797305b5130e07696d..1e5f31b8b81f9ff73e14476e8f63f754d32fea5a 100644 (file)
@@ -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 );
index e4736401fb41bf9eca43d0a695f1546a2eb554f1..08791cc8535c707b34ece783fee0f27cbb45f07d 100644 (file)
@@ -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 );
index 31a6e16c6819523dfd3e1bc427d6008650f9c4ec..fc88bedc0e7643f59880e0515af71110ffcd30b9 100644 (file)
@@ -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 );
index 02457414baadd45b09a72795185cf071e04d5b2a..51bf98855f22a68daeaa2dadb1cbbeafafe0c00b 100644 (file)
@@ -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 );
index 5a68dc8ac13f9bb312b96615d8e5eb11ca5ad6fd..895ec17c27ff55a67d5e036ad8a7621e738a022d 100644 (file)
@@ -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
index 0e735c6db5a2894698b08a6c97e14ffd5ac998b9..838832f8cd68c39ad15218f2772bcce2c63656dc 100644 (file)
@@ -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)))
     { }
index 07c143bb23bf7c6124b7175317cfc728fec66722..fb4bbfe6d0ca79d2a547488604bb8e031b2c2b9f 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <string>
 
+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 Self, class T>
-    class Convertible {
-    public:
-        T *handle() const
-        { return (T *) static_cast<const Self *>(this)->_handle; }
+    template<class Self, class T, bool implicit = true>
+    struct Convertible;
 
+    template<class Self, class T>
+    struct Convertible<Self, T, true> {
         operator T *() const
-        { return handle(); }
+        { return reinterpret_cast<T *>(static_cast<const Self *>(this)->_handle); }
+    };
+
+    template<class Self, class T>
+    struct Convertible<Self, T, false> {
+        explicit operator T *() const
+        { return reinterpret_cast<T *>(static_cast<const Self *>(this)->_handle); }
     };
 
-    class Base {
+    class Object : public Convertible<Object, ui_object, false> {
     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<Widget, ui_widget> {
+    class Widget : public Object, public Convertible<Widget, ui_widget> {
     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);
     );
index dd36b0644235eaa8ac5de366470ef34e0e2f8b4e..54c79647fad19c07797e26fb7b130d12ac94be20 100644 (file)
@@ -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<float>( widget.handle()->allocation.width / 2 ), static_cast<float>( widget.handle()->allocation.height / 2 ) );
+       return WindowVector( static_cast<float>( GTK_WIDGET(widget)->allocation.width / 2 ), static_cast<float>(GTK_WIDGET(widget)->allocation.height / 2 ) );
 }
 
 gboolean selection_button_press_freemove( ui::Widget widget, GdkEventButton* event, WindowObserver* observer ){
index a77c29ff5e3acfffcdb8db12697b9db7187e4b47..5540be31d9c222730acd2172959b449791e00d31 100644 (file)
@@ -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 );
index e5c68ce6ba5c9880d5003e4db05bf31aa1ee6807..35a7cb723d1991933d15750beac272bb7363f507 100644 (file)
@@ -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;
 }
 
index 5f921882b593f36566807d2fe18dd3c26fb3839e..0f074114cf4d7239e9076cd0cf5b06285f290c9b 100644 (file)
@@ -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 );
 
index b05bbe0d39bf20fbc71835ca17096d384b732c8a..37f88bfaf84e8076115e94e9b495728009b5fc68 100644 (file)
@@ -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,
index cb64e9401a0015e9cd693f35562ed1ca72887e89..07dd1e6136a348b51d4e24013c7ed829164c7057 100644 (file)
@@ -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 ),
index a86d65e4a798555138b7bf6e2d57159f2f80697f..88d0c00206cc83a23a68bc677d98fc0228e70f1e 100644 (file)
@@ -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) )
index 4e59f9f7ffbc0b165451284516c2cf939c46c711..fafb1dad417304a3e0386d4a25a0443707c1b838 100644 (file)
@@ -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 );
        }
 }