]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/patchdialog.cpp
GTK: wrap gtk_widget_set_size_request
[xonotic/netradiant.git] / radiant / patchdialog.cpp
index 96e60eac73ecd3e2c77defc0cb46f123043f9c72..b4af86de07045c6523188238cab88a6254f95ac6 100644 (file)
@@ -171,15 +171,15 @@ void update(){
        if ( subdivisions.m_enabled ) {
                entry_set_int( m_horizontal, static_cast<int>( subdivisions.m_x ) );
                entry_set_int( m_vertical, static_cast<int>( subdivisions.m_y ) );
-               gtk_widget_set_sensitive( GTK_WIDGET( m_horizontal ), TRUE );
-               gtk_widget_set_sensitive( GTK_WIDGET( m_vertical ), TRUE );
+               gtk_widget_set_sensitive( m_horizontal , TRUE );
+               gtk_widget_set_sensitive( m_vertical , TRUE );
        }
        else
        {
-               gtk_entry_set_text( m_horizontal, "" );
-               gtk_entry_set_text( m_vertical, "" );
-               gtk_widget_set_sensitive( GTK_WIDGET( m_horizontal ), FALSE );
-               gtk_widget_set_sensitive( GTK_WIDGET( m_vertical ), FALSE );
+               m_horizontal.text("");
+               m_vertical.text("");
+               gtk_widget_set_sensitive( m_horizontal , FALSE );
+               gtk_widget_set_sensitive( m_vertical , FALSE );
        }
 }
 void cancel(){
@@ -256,7 +256,7 @@ PatchInspector() :
 }
 
 bool visible(){
-       return gtk_widget_get_visible( GetWidget() );
+       return GetWidget().visible();
 }
 
 //  void UpdateInfo();
@@ -571,16 +571,16 @@ ui::Window PatchInspector::BuildDialog(){
                {
                        auto hbox = ui::HBox( FALSE, 5 );
                        hbox.show();
-                       gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox ), TRUE, TRUE, 0 );
+                       vbox.pack_start( hbox, TRUE, TRUE, 0 );
                        {
                                auto vbox2 = ui::VBox( FALSE, 0 );
                                gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 0 );
                                vbox2.show();
-                               gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox2 ), TRUE, TRUE, 0 );
+                               hbox.pack_start( vbox2, TRUE, TRUE, 0 );
                                {
                                        auto frame = ui::Frame( "Details" );
                                        frame.show();
-                                       gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
+                                       vbox2.pack_start( frame, TRUE, TRUE, 0 );
                                        {
                                                auto vbox3 = ui::VBox( FALSE, 5 );
                                                gtk_container_set_border_width( GTK_CONTAINER( vbox3 ), 5 );
@@ -589,135 +589,107 @@ ui::Window PatchInspector::BuildDialog(){
                                                {
                                                        auto table = ui::Table( 2, 2, FALSE );
                                                        table.show();
-                                                       gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
+                                                       vbox3.pack_start( table, TRUE, TRUE, 0 );
                                                        gtk_table_set_row_spacings( table, 5 );
                                                        gtk_table_set_col_spacings( table, 5 );
                                                        {
                                                                auto label = ui::Label( "Row:" );
                                                                label.show();
-                                                               gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
-                                                                                                 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
-                                                                                                 (GtkAttachOptions)( 0 ), 0, 0 );
+                                table.attach(label, {0, 1, 0, 1}, {(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0)}, {0, 0});
                                                        }
                                                        {
                                                                auto label = ui::Label( "Column:" );
                                                                label.show();
-                                                               gtk_table_attach( table, GTK_WIDGET( label ), 1, 2, 0, 1,
-                                                                                                 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
-                                                                                                 (GtkAttachOptions)( 0 ), 0, 0 );
+                                table.attach(label, {1, 2, 0, 1}, {(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0)}, {0, 0});
                                                        }
                                                        {
-                                                               auto combo = ui::ComboBoxText();
+                                                               auto combo = ui::ComboBoxText(ui::New);
                                                                combo.connect( "changed", G_CALLBACK( OnSelchangeComboColRow ), this );
                                                                AddDialogData( *GTK_COMBO_BOX(combo), m_nRow );
 
                                                                combo.show();
-                                                               gtk_table_attach( table, GTK_WIDGET( combo ), 0, 1, 1, 2,
-                                                                                                 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
-                                                                                                 (GtkAttachOptions)( 0 ), 0, 0 );
-                                                               gtk_widget_set_size_request( GTK_WIDGET( combo ), 60, -1 );
+                                table.attach(combo, {0, 1, 1, 2}, {(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0)}, {0, 0});
+                                                               combo.dimensions(60, -1);
                                                                m_pRowCombo = combo;
                                                        }
 
                                                        {
-                                                               auto combo = ui::ComboBoxText();
+                                                               auto combo = ui::ComboBoxText(ui::New);
                                                                combo.connect( "changed", G_CALLBACK( OnSelchangeComboColRow ), this );
                                                                AddDialogData( *GTK_COMBO_BOX(combo), m_nCol );
 
                                                                combo.show();
-                                                               gtk_table_attach( table, GTK_WIDGET( combo ), 1, 2, 1, 2,
-                                                                                                 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
-                                                                                                 (GtkAttachOptions)( 0 ), 0, 0 );
-                                                               gtk_widget_set_size_request( GTK_WIDGET( combo ), 60, -1 );
+                                table.attach(combo, {1, 2, 1, 2}, {(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0)}, {0, 0});
+                                                               combo.dimensions(60, -1);
                                                                m_pColCombo = combo;
                                                        }
                                                }
                                                auto table = ui::Table( 5, 2, FALSE );
                                                table.show();
-                                               gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
+                                               vbox3.pack_start( table, TRUE, TRUE, 0 );
                                                gtk_table_set_row_spacings( table, 5 );
                                                gtk_table_set_col_spacings( table, 5 );
                                                {
                                                        auto label = ui::Label( "X:" );
                                                        label.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
-                                                                                         (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
+                            table.attach(label, {0, 1, 0, 1}, {GTK_EXPAND | GTK_FILL, 0});
                                                }
                                                {
                                                        auto label = ui::Label( "Y:" );
                                                        label.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
-                                                                                         (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
+                            table.attach(label, {0, 1, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
                                                }
                                                {
                                                        auto label = ui::Label( "Z:" );
                                                        label.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 2, 3,
-                                                                                         (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
+                            table.attach(label, {0, 1, 2, 3}, {GTK_EXPAND | GTK_FILL, 0});
                                                }
                                                {
                                                        auto label = ui::Label( "S:" );
                                                        label.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 3, 4,
-                                                                                         (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
+                            table.attach(label, {0, 1, 3, 4}, {GTK_EXPAND | GTK_FILL, 0});
                                                }
                                                {
                                                        auto label = ui::Label( "T:" );
                                                        label.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 4, 5,
-                                                                                         (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
+                            table.attach(label, {0, 1, 4, 5}, {GTK_EXPAND | GTK_FILL, 0});
                                                }
                                                {
-                                                       auto entry = ui::Entry();
+                                                       auto entry = ui::Entry(ui::New);
                                                        entry.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1,
-                                                                                         (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
+                            table.attach(entry, {1, 2, 0, 1}, {GTK_EXPAND | GTK_FILL, 0});
                                                        AddDialogData( *GTK_ENTRY(entry), m_fX );
 
                                                        entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
                                                }
                                                {
-                                                       auto entry = ui::Entry();
+                                                       auto entry = ui::Entry(ui::New);
                                                        entry.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2,
-                                                                                         (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
+                            table.attach(entry, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
                                                        AddDialogData( *GTK_ENTRY(entry), m_fY );
 
                                                        entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
                                                }
                                                {
-                                                       auto entry = ui::Entry();
+                                                       auto entry = ui::Entry(ui::New);
                                                        entry.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 2, 3,
-                                                                                         (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
+                            table.attach(entry, {1, 2, 2, 3}, {GTK_EXPAND | GTK_FILL, 0});
                                                        AddDialogData( *GTK_ENTRY(entry), m_fZ );
 
                                                        entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
                                                }
                                                {
-                                                       auto entry = ui::Entry();
+                                                       auto entry = ui::Entry(ui::New);
                                                        entry.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 3, 4,
-                                                                                         (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
+                            table.attach(entry, {1, 2, 3, 4}, {GTK_EXPAND | GTK_FILL, 0});
                                                        AddDialogData( *GTK_ENTRY(entry), m_fS );
 
                                                        entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
                                                }
                                                {
-                                                       auto entry = ui::Entry();
+                                                       auto entry = ui::Entry(ui::New);
                                                        entry.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 4, 5,
-                                                                                         (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
+                            table.attach(entry, {1, 2, 4, 5}, {GTK_EXPAND | GTK_FILL, 0});
                                                        AddDialogData( *GTK_ENTRY(entry), m_fT );
 
                                                        entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
@@ -727,7 +699,7 @@ ui::Window PatchInspector::BuildDialog(){
                                if ( g_pGameDescription->mGameType == "doom3" ) {
                                        auto frame = ui::Frame( "Tesselation" );
                                        frame.show();
-                                       gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
+                                       vbox2.pack_start( frame, TRUE, TRUE, 0 );
                                        {
                                                auto vbox3 = ui::VBox( FALSE, 5 );
                                                gtk_container_set_border_width( GTK_CONTAINER( vbox3 ), 5 );
@@ -736,22 +708,18 @@ ui::Window PatchInspector::BuildDialog(){
                                                {
                                                        auto table = ui::Table( 3, 2, FALSE );
                                                        table.show();
-                                                       gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
+                                                       vbox3.pack_start( table, TRUE, TRUE, 0 );
                                                        gtk_table_set_row_spacings( table, 5 );
                                                        gtk_table_set_col_spacings( table, 5 );
                                                        {
                                                                auto label = ui::Label( "Fixed" );
                                                                label.show();
-                                                               gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
-                                                                                                 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
-                                                                                                 (GtkAttachOptions)( 0 ), 0, 0 );
+                                table.attach(label, {0, 1, 0, 1}, {GTK_EXPAND | GTK_FILL, 0});
                                                        }
                                                        {
                                                                auto check = ui::CheckButton(GTK_CHECK_BUTTON( gtk_check_button_new() ));
                                                                check.show();
-                                                               gtk_table_attach( table, GTK_WIDGET( check ), 1, 2, 0, 1,
-                                                                                                 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
-                                                                                                 (GtkAttachOptions)( 0 ), 0, 0 );
+                                table.attach(check, {1, 2, 0, 1}, {GTK_EXPAND | GTK_FILL, 0});
                                                                m_subdivisions.m_enabled = check;
                                                                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 ) );
@@ -759,32 +727,24 @@ ui::Window PatchInspector::BuildDialog(){
                                                        {
                                                                auto label = ui::Label( "Horizontal" );
                                                                label.show();
-                                                               gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
-                                                                                                 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
-                                                                                                 (GtkAttachOptions)( 0 ), 0, 0 );
+                                table.attach(label, {0, 1, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
                                                        }
                                                        {
-                                                               auto entry = ui::Entry();
+                                                               auto entry = ui::Entry(ui::New);
                                                                entry.show();
-                                                               gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2,
-                                                                                                 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
-                                                                                                 (GtkAttachOptions)( 0 ), 0, 0 );
+                                table.attach(entry, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
                                                                m_subdivisions.m_horizontal = entry;
                                                                m_horizontalSubdivisionsEntry.connect( entry );
                                                        }
                                                        {
                                                                auto label = ui::Label( "Vertical" );
                                                                label.show();
-                                                               gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 2, 3,
-                                                                                                 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
-                                                                                                 (GtkAttachOptions)( 0 ), 0, 0 );
+                                table.attach(label, {0, 1, 2, 3}, {GTK_EXPAND | GTK_FILL, 0});
                                                        }
                                                        {
-                                                               auto entry = ui::Entry();
+                                                               auto entry = ui::Entry(ui::New);
                                                                entry.show();
-                                                               gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 2, 3,
-                                                                                                 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
-                                                                                                 (GtkAttachOptions)( 0 ), 0, 0 );
+                                table.attach(entry, {1, 2, 2, 3}, {GTK_EXPAND | GTK_FILL, 0});
                                                                m_subdivisions.m_vertical = entry;
                                                                m_verticalSubdivisionsEntry.connect( entry );
                                                        }
@@ -795,7 +755,7 @@ ui::Window PatchInspector::BuildDialog(){
                        {
                                auto frame = ui::Frame( "Texturing" );
                                frame.show();
-                               gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
+                               hbox.pack_start( frame, TRUE, TRUE, 0 );
                                {
                                        auto vbox2 = ui::VBox( FALSE, 5 );
                                        vbox2.show();
@@ -804,15 +764,15 @@ ui::Window PatchInspector::BuildDialog(){
                                        {
                                                auto label = ui::Label( "Name:" );
                                                label.show();
-                                               gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( label ), TRUE, TRUE, 0 );
+                                               vbox2.pack_start( label, TRUE, TRUE, 0 );
                                                gtk_label_set_justify( label, GTK_JUSTIFY_LEFT );
                                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                        }
                                        {
-                                               auto entry = ui::Entry();
+                                               auto entry = ui::Entry(ui::New);
                                                //  gtk_editable_set_editable (GTK_ENTRY (entry), false);
                                                entry.show();
-                                               gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
+                                               vbox2.pack_start( entry, TRUE, TRUE, 0 );
                                                AddDialogData( *GTK_ENTRY(entry), m_strName );
 
                                                entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
@@ -820,74 +780,58 @@ ui::Window PatchInspector::BuildDialog(){
                                        {
                                                auto table = ui::Table( 5, 4, FALSE );
                                                table.show();
-                                               gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
+                                               vbox2.pack_start( table, TRUE, TRUE, 0 );
                                                gtk_table_set_row_spacings( table, 5 );
                                                gtk_table_set_col_spacings( table, 5 );
                                                {
                                                        auto label = ui::Label( "Horizontal Shift Step" );
                                                        label.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( label ), 2, 4, 0, 1,
-                                                                                         (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
+                            table.attach(label, {2, 4, 0, 1}, {GTK_FILL | GTK_EXPAND, 0});
                                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                                }
                                                {
                                                        auto label = ui::Label( "Vertical Shift Step" );
                                                        label.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( label ), 2, 4, 1, 2,
-                                                                                         (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
+                            table.attach(label, {2, 4, 1, 2}, {GTK_FILL | GTK_EXPAND, 0});
                                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                                }
                                                {
                                                        auto label = ui::Label( "Horizontal Stretch Step" );
                                                        label.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( label ), 2, 3, 2, 3,
-                                                                                         (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
+                            table.attach(label, {2, 3, 2, 3}, {GTK_FILL | GTK_EXPAND, 0});
                                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                                }
                                                {
                                                        auto button = ui::Button( "Flip" );
                                                        button.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( button ), 3, 4, 2, 3,
-                                                                                         (GtkAttachOptions)( GTK_FILL ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
+                            table.attach(button, {3, 4, 2, 3}, {GTK_FILL, 0});
                                                        button.connect( "clicked", G_CALLBACK( OnBtnPatchFlipX ), 0 );
-                                                       gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
+                                                       button.dimensions(60, -1);
                                                }
                                                {
                                                        auto label = ui::Label( "Vertical Stretch Step" );
                                                        label.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( label ), 2, 3, 3, 4,
-                                                                                         (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
+                            table.attach(label, {2, 3, 3, 4}, {GTK_FILL | GTK_EXPAND, 0});
                                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                                }
                                                {
                                                        auto button = ui::Button( "Flip" );
                                                        button.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( button ), 3, 4, 3, 4,
-                                                                                         (GtkAttachOptions)( GTK_FILL ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
+                            table.attach(button, {3, 4, 3, 4}, {GTK_FILL, 0});
                                                        button.connect( "clicked", G_CALLBACK( OnBtnPatchFlipY ), 0 );
-                                                       gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
+                                                       button.dimensions(60, -1);
                                                }
                                                {
                                                        auto label = ui::Label( "Rotate Step" );
                                                        label.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( label ), 2, 4, 4, 5,
-                                                                                         (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
+                            table.attach(label, {2, 4, 4, 5}, {GTK_FILL | GTK_EXPAND, 0});
                                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                                }
                                                {
-                                                       auto entry = ui::Entry();
+                                                       auto entry = ui::Entry(ui::New);
                                                        entry.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 0, 1,
-                                                                                         (GtkAttachOptions)( GTK_FILL ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
-                                                       gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
+                            table.attach(entry, {0, 1, 0, 1}, {GTK_FILL, 0});
+                                                       entry.dimensions(50, -1);
                                                        g_object_set_data( G_OBJECT( window ), "hshift_entry", (void *) entry );
                                                        // we fill in this data, if no patch is selected the widgets are unmodified when the inspector is raised
                                                        // so we need to have at least one initialisation somewhere
@@ -899,19 +843,15 @@ ui::Window PatchInspector::BuildDialog(){
 
                                                        auto spin = ui::SpinButton( adj, 1, 0 );
                                                        spin.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 0, 1,
-                                                                                         (GtkAttachOptions)( 0 ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
-                                                       gtk_widget_set_size_request( GTK_WIDGET( spin ), 10, -1 );
+                            table.attach(spin, {1, 2, 0, 1}, {0, 0});
+                                                       spin.dimensions(10, -1);
                                                        gtk_widget_set_can_focus( spin, false );
                                                }
                                                {
-                                                       auto entry = ui::Entry();
+                                                       auto entry = ui::Entry(ui::New);
                                                        entry.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 1, 2,
-                                                                                         (GtkAttachOptions)( GTK_FILL ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
-                                                       gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
+                            table.attach(entry, {0, 1, 1, 2}, {GTK_FILL, 0});
+                                                       entry.dimensions(50, -1);
                                                        entry_set_float( entry, g_pi_globals.shift[1] );
 
                                                        auto adj = ui::Adjustment( 0, -8192, 8192, 1, 1, 0 );
@@ -920,19 +860,15 @@ ui::Window PatchInspector::BuildDialog(){
 
                                                        auto spin = ui::SpinButton( adj, 1, 0 );
                                                        spin.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 1, 2,
-                                                                                         (GtkAttachOptions)( 0 ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
-                                                       gtk_widget_set_size_request( GTK_WIDGET( spin ), 10, -1 );
+                            table.attach(spin, {1, 2, 1, 2}, {0, 0});
+                                                       spin.dimensions(10, -1);
                                                        gtk_widget_set_can_focus( spin, false );
                                                }
                                                {
-                                                       auto entry = ui::Entry();
+                                                       auto entry = ui::Entry(ui::New);
                                                        entry.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 2, 3,
-                                                                                         (GtkAttachOptions)( GTK_FILL ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
-                                                       gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
+                            table.attach(entry, {0, 1, 2, 3}, {GTK_FILL, 0});
+                                                       entry.dimensions(50, -1);
                                                        entry_set_float( entry, g_pi_globals.scale[0] );
 
                                                        auto adj = ui::Adjustment( 0, -1000, 1000, 1, 1, 0 );
@@ -941,19 +877,15 @@ ui::Window PatchInspector::BuildDialog(){
 
                                                        auto spin = ui::SpinButton( adj, 1, 0 );
                                                        spin.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 2, 3,
-                                                                                         (GtkAttachOptions)( 0 ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
-                                                       gtk_widget_set_size_request( GTK_WIDGET( spin ), 10, -1 );
+                            table.attach(spin, {1, 2, 2, 3}, {0, 0});
+                                                       spin.dimensions(10, -1);
                                                        gtk_widget_set_can_focus( spin, false );
                                                }
                                                {
-                                                       auto entry = ui::Entry();
+                                                       auto entry = ui::Entry(ui::New);
                                                        entry.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 3, 4,
-                                                                                         (GtkAttachOptions)( GTK_FILL ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
-                                                       gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
+                            table.attach(entry, {0, 1, 3, 4}, {GTK_FILL, 0});
+                                                       entry.dimensions(50, -1);
                                                        entry_set_float( entry, g_pi_globals.scale[1] );
 
                                                        auto adj = ui::Adjustment( 0, -1000, 1000, 1, 1, 0 );
@@ -962,19 +894,15 @@ ui::Window PatchInspector::BuildDialog(){
 
                                                        auto spin = ui::SpinButton( adj, 1, 0 );
                                                        spin.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 3, 4,
-                                                                                         (GtkAttachOptions)( 0 ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
-                                                       gtk_widget_set_size_request( GTK_WIDGET( spin ), 10, -1 );
+                            table.attach(spin, {1, 2, 3, 4}, {0, 0});
+                                                       spin.dimensions(10, -1);
                                                        gtk_widget_set_can_focus( spin, false );
                                                }
                                                {
-                                                       auto entry = ui::Entry();
+                                                       auto entry = ui::Entry(ui::New);
                                                        entry.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 4, 5,
-                                                                                         (GtkAttachOptions)( GTK_FILL ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
-                                                       gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
+                            table.attach(entry, {0, 1, 4, 5}, {GTK_FILL, 0});
+                                                       entry.dimensions(50, -1);
                                                        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
@@ -983,50 +911,48 @@ ui::Window PatchInspector::BuildDialog(){
 
                                                        auto spin = ui::SpinButton( adj, 1, 0 );
                                                        spin.show();
-                                                       gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 4, 5,
-                                                                                         (GtkAttachOptions)( 0 ),
-                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
-                                                       gtk_widget_set_size_request( GTK_WIDGET( spin ), 10, -1 );
+                            table.attach(spin, {1, 2, 4, 5}, {0, 0});
+                                                       spin.dimensions(10, -1);
                                                        gtk_widget_set_can_focus( spin, false );
                                                }
                                        }
                                        auto hbox2 = ui::HBox( TRUE, 5 );
                                        hbox2.show();
-                                       gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( hbox2 ), TRUE, FALSE, 0 );
+                                       vbox2.pack_start( hbox2, TRUE, FALSE, 0 );
                                        {
                                                auto button = ui::Button( "Auto Cap" );
                                                button.show();
-                                               gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
+                                               hbox2.pack_end(button, TRUE, FALSE, 0);
                                                button.connect( "clicked", G_CALLBACK( OnBtnPatchAutoCap ), 0 );
-                                               gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
+                                               button.dimensions(60, -1);
                                        }
                                        {
                                                auto button = ui::Button( "CAP" );
                                                button.show();
-                                               gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
+                                               hbox2.pack_end(button, TRUE, FALSE, 0);
                                                button.connect( "clicked", G_CALLBACK( OnBtnPatchdetails ), 0 );
-                                               gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
+                                               button.dimensions(60, -1);
                                        }
                                        {
                                                auto button = ui::Button( "Set..." );
                                                button.show();
-                                               gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
+                                               hbox2.pack_end(button, TRUE, FALSE, 0);
                                                button.connect( "clicked", G_CALLBACK( OnBtnPatchreset ), 0 );
-                                               gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
+                                               button.dimensions(60, -1);
                                        }
                                        {
                                                auto button = ui::Button( "Natural" );
                                                button.show();
-                                               gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
+                                               hbox2.pack_end(button, TRUE, FALSE, 0);
                                                button.connect( "clicked", G_CALLBACK( OnBtnPatchnatural ), 0 );
-                                               gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
+                                               button.dimensions(60, -1);
                                        }
                                        {
                                                auto button = ui::Button( "Fit" );
                                                button.show();
-                                               gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
+                                               hbox2.pack_end(button, TRUE, FALSE, 0);
                                                button.connect( "clicked", G_CALLBACK( OnBtnPatchfit ), 0 );
-                                               gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
+                                               button.dimensions(60, -1);
                                        }
                                }
                        }