]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/patchmanip.cpp
Make About window message more explicit about maintainer and latest build
[xonotic/netradiant.git] / radiant / patchmanip.cpp
index 38c68e51e23d5b90b067e71cddaebece7dd45bdb..bd9d378beee07b6bda85c8b517278827648fb7cc 100644 (file)
@@ -147,17 +147,6 @@ void Patch_makeCaps( Patch& patch, scene::Instance& instance, EPatchCap type, co
 
 typedef std::vector<scene::Instance*> InstanceVector;
 
-class PatchStoreInstance
-{
-InstanceVector& m_instances;
-public:
-PatchStoreInstance( InstanceVector& instances ) : m_instances( instances ){
-}
-void operator()( PatchInstance& patch ) const {
-       m_instances.push_back( &patch );
-}
-};
-
 enum ECapDialog {
        PATCHCAP_BEVEL = 0,
        PATCHCAP_ENDCAP,
@@ -196,7 +185,9 @@ void Scene_PatchDoCap_Selected( scene::Graph& graph, const char* shader ){
                }
 
                InstanceVector instances;
-               Scene_forEachVisibleSelectedPatchInstance( PatchStoreInstance( instances ) );
+               Scene_forEachVisibleSelectedPatchInstance([&](PatchInstance &patch) {
+                       instances.push_back(&patch);
+               });
                for ( InstanceVector::const_iterator i = instances.begin(); i != instances.end(); ++i )
                {
                        Patch_makeCaps( *Node_getPatch( ( *i )->path().top() ), *( *i ), eType, shader );
@@ -215,132 +206,62 @@ Patch* Scene_GetUltimateSelectedVisiblePatch(){
 }
 
 
-class PatchCapTexture
-{
-public:
-void operator()( Patch& patch ) const {
-       patch.ProjectTexture( Patch::m_CycleCapIndex );
-}
-};
-
 void Scene_PatchCapTexture_Selected( scene::Graph& graph ){
-       Scene_forEachVisibleSelectedPatch( PatchCapTexture() );
+       Scene_forEachVisibleSelectedPatch([&](Patch &patch) {
+               patch.ProjectTexture(Patch::m_CycleCapIndex);
+       });
        Patch::m_CycleCapIndex = ( Patch::m_CycleCapIndex == 0 ) ? 1 : ( Patch::m_CycleCapIndex == 1 ) ? 2 : 0;
        SceneChangeNotify();
 }
 
-class PatchFlipTexture
-{
-int m_axis;
-public:
-PatchFlipTexture( int axis ) : m_axis( axis ){
-}
-void operator()( Patch& patch ) const {
-       patch.FlipTexture( m_axis );
-}
-};
-
 void Scene_PatchFlipTexture_Selected( scene::Graph& graph, int axis ){
-       Scene_forEachVisibleSelectedPatch( PatchFlipTexture( axis ) );
+       Scene_forEachVisibleSelectedPatch([&](Patch &patch) {
+               patch.FlipTexture(axis);
+       });
 }
 
-class PatchNaturalTexture
-{
-public:
-void operator()( Patch& patch ) const {
-       patch.NaturalTexture();
-}
-};
-
 void Scene_PatchNaturalTexture_Selected( scene::Graph& graph ){
-       Scene_forEachVisibleSelectedPatch( PatchNaturalTexture() );
+       Scene_forEachVisibleSelectedPatch([&](Patch &patch) {
+               patch.NaturalTexture();
+       });
        SceneChangeNotify();
 }
 
 
-class PatchInsertRemove
-{
-bool m_insert, m_column, m_first;
-public:
-PatchInsertRemove( bool insert, bool column, bool first ) : m_insert( insert ), m_column( column ), m_first( first ){
-}
-void operator()( Patch& patch ) const {
-       patch.InsertRemove( m_insert, m_column, m_first );
-}
-};
-
 void Scene_PatchInsertRemove_Selected( scene::Graph& graph, bool bInsert, bool bColumn, bool bFirst ){
-       Scene_forEachVisibleSelectedPatch( PatchInsertRemove( bInsert, bColumn, bFirst ) );
+       Scene_forEachVisibleSelectedPatch([&](Patch &patch) {
+               patch.InsertRemove(bInsert, bColumn, bFirst);
+       });
 }
 
-class PatchInvertMatrix
-{
-public:
-void operator()( Patch& patch ) const {
-       patch.InvertMatrix();
-}
-};
-
 void Scene_PatchInvert_Selected( scene::Graph& graph ){
-       Scene_forEachVisibleSelectedPatch( PatchInvertMatrix() );
+       Scene_forEachVisibleSelectedPatch([&](Patch &patch) {
+               patch.InvertMatrix();
+       });
 }
 
-class PatchRedisperse
-{
-EMatrixMajor m_major;
-public:
-PatchRedisperse( EMatrixMajor major ) : m_major( major ){
-}
-void operator()( Patch& patch ) const {
-       patch.Redisperse( m_major );
-}
-};
-
 void Scene_PatchRedisperse_Selected( scene::Graph& graph, EMatrixMajor major ){
-       Scene_forEachVisibleSelectedPatch( PatchRedisperse( major ) );
-}
-
-class PatchSmooth
-{
-EMatrixMajor m_major;
-public:
-PatchSmooth( EMatrixMajor major ) : m_major( major ){
+       Scene_forEachVisibleSelectedPatch([&](Patch &patch) {
+               patch.Redisperse(major);
+       });
 }
-void operator()( Patch& patch ) const {
-       patch.Smooth( m_major );
-}
-};
 
 void Scene_PatchSmooth_Selected( scene::Graph& graph, EMatrixMajor major ){
-       Scene_forEachVisibleSelectedPatch( PatchSmooth( major ) );
+       Scene_forEachVisibleSelectedPatch([&](Patch &patch) {
+               patch.Smooth(major);
+       });
 }
 
-class PatchTransposeMatrix
-{
-public:
-void operator()( Patch& patch ) const {
-       patch.TransposeMatrix();
-}
-};
-
 void Scene_PatchTranspose_Selected( scene::Graph& graph ){
-       Scene_forEachVisibleSelectedPatch( PatchTransposeMatrix() );
+       Scene_forEachVisibleSelectedPatch([&](Patch &patch) {
+               patch.TransposeMatrix();
+       });
 }
 
-class PatchSetShader
-{
-const char* m_name;
-public:
-PatchSetShader( const char* name )
-       : m_name( name ){
-}
-void operator()( Patch& patch ) const {
-       patch.SetShader( m_name );
-}
-};
-
 void Scene_PatchSetShader_Selected( scene::Graph& graph, const char* name ){
-       Scene_forEachVisibleSelectedPatch( PatchSetShader( name ) );
+       Scene_forEachVisibleSelectedPatch([&](Patch &patch) {
+               patch.SetShader(name);
+       });
        SceneChangeNotify();
 }
 
@@ -351,45 +272,29 @@ void Scene_PatchGetShader_Selected( scene::Graph& graph, CopiedString& name ){
        }
 }
 
-class PatchSelectByShader
-{
-const char* m_name;
-public:
-inline PatchSelectByShader( const char* name )
-       : m_name( name ){
-}
-void operator()( PatchInstance& patch ) const {
-       if ( shader_equal( patch.getPatch().GetShader(), m_name ) ) {
-               patch.setSelected( true );
-       }
-}
-};
-
 void Scene_PatchSelectByShader( scene::Graph& graph, const char* name ){
-       Scene_forEachVisiblePatchInstance( PatchSelectByShader( name ) );
+       Scene_forEachVisiblePatchInstance([&](PatchInstance &patch) {
+               if (shader_equal(patch.getPatch().GetShader(), name)) {
+                       patch.setSelected(true);
+               }
+       });
 }
 
 
-class PatchFindReplaceShader
-{
-const char* m_find;
-const char* m_replace;
-public:
-PatchFindReplaceShader( const char* find, const char* replace ) : m_find( find ), m_replace( replace ){
-}
-void operator()( Patch& patch ) const {
-       if ( shader_equal( patch.GetShader(), m_find ) ) {
-               patch.SetShader( m_replace );
-       }
-}
-};
-
 void Scene_PatchFindReplaceShader( scene::Graph& graph, const char* find, const char* replace ){
-       Scene_forEachVisiblePatch( PatchFindReplaceShader( find, replace ) );
+       Scene_forEachVisiblePatch([&](Patch &patch) {
+               if (shader_equal(patch.GetShader(), find)) {
+                       patch.SetShader(replace);
+               }
+       });
 }
 
 void Scene_PatchFindReplaceShader_Selected( scene::Graph& graph, const char* find, const char* replace ){
-       Scene_forEachVisibleSelectedPatch( PatchFindReplaceShader( find, replace ) );
+       Scene_forEachVisibleSelectedPatch([&](Patch &patch) {
+               if (shader_equal(patch.GetShader(), find)) {
+                       patch.SetShader(replace);
+               }
+       });
 }
 
 
@@ -695,55 +600,55 @@ void Patch_constructPage( PreferenceGroup& group ){
        Patch_constructPreferences( page );
 }
 void Patch_registerPreferencesPage(){
-       PreferencesDialog_addDisplayPage( FreeCaller1<PreferenceGroup&, Patch_constructPage>() );
+       PreferencesDialog_addDisplayPage( makeCallbackF(Patch_constructPage) );
 }
 
 
 #include "preferencesystem.h"
 
 void PatchPreferences_construct(){
-       GlobalPreferenceSystem().registerPreference( "Subdivisions", IntImportStringCaller( g_PatchSubdivideThreshold ), IntExportStringCaller( g_PatchSubdivideThreshold ) );
+       GlobalPreferenceSystem().registerPreference( "Subdivisions", make_property_string( g_PatchSubdivideThreshold ) );
 }
 
 
 #include "generic/callback.h"
 
 void Patch_registerCommands(){
-       GlobalCommands_insert( "InvertCurveTextureX", FreeCaller<Patch_FlipTextureX>(), Accelerator( 'I', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
-       GlobalCommands_insert( "InvertCurveTextureY", FreeCaller<Patch_FlipTextureY>(), Accelerator( 'I', (GdkModifierType)GDK_SHIFT_MASK ) );
-       GlobalCommands_insert( "NaturalizePatch", FreeCaller<Patch_NaturalTexture>(), Accelerator( 'N', (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "PatchCylinder", FreeCaller<Patch_Cylinder>() );
-       GlobalCommands_insert( "PatchDenseCylinder", FreeCaller<Patch_DenseCylinder>() );
-       GlobalCommands_insert( "PatchVeryDenseCylinder", FreeCaller<Patch_VeryDenseCylinder>() );
-       GlobalCommands_insert( "PatchSquareCylinder", FreeCaller<Patch_SquareCylinder>() );
-       GlobalCommands_insert( "PatchXactCylinder", FreeCaller<Patch_XactCylinder>() );
-       GlobalCommands_insert( "PatchXactSphere", FreeCaller<Patch_XactSphere>() );
-       GlobalCommands_insert( "PatchXactCone", FreeCaller<Patch_XactCone>() );
-       GlobalCommands_insert( "PatchEndCap", FreeCaller<Patch_Endcap>() );
-       GlobalCommands_insert( "PatchBevel", FreeCaller<Patch_Bevel>() );
-       GlobalCommands_insert( "PatchSquareBevel", FreeCaller<Patch_SquareBevel>() );
-       GlobalCommands_insert( "PatchSquareEndcap", FreeCaller<Patch_SquareEndcap>() );
-       GlobalCommands_insert( "PatchCone", FreeCaller<Patch_Cone>() );
-       GlobalCommands_insert( "PatchSphere", FreeCaller<Patch_Sphere>() );
-       GlobalCommands_insert( "SimplePatchMesh", FreeCaller<Patch_Plane>(), Accelerator( 'P', (GdkModifierType)GDK_SHIFT_MASK ) );
-       GlobalCommands_insert( "PatchInsertInsertColumn", FreeCaller<Patch_InsertInsertColumn>(), Accelerator( GDK_KEY_KP_Add, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
-       GlobalCommands_insert( "PatchInsertAddColumn", FreeCaller<Patch_InsertAddColumn>() );
-       GlobalCommands_insert( "PatchInsertInsertRow", FreeCaller<Patch_InsertInsertRow>(), Accelerator( GDK_KEY_KP_Add, (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "PatchInsertAddRow", FreeCaller<Patch_InsertAddRow>() );
-       GlobalCommands_insert( "PatchDeleteFirstColumn", FreeCaller<Patch_DeleteFirstColumn>() );
-       GlobalCommands_insert( "PatchDeleteLastColumn", FreeCaller<Patch_DeleteLastColumn>(), Accelerator( GDK_KEY_KP_Subtract, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
-       GlobalCommands_insert( "PatchDeleteFirstRow", FreeCaller<Patch_DeleteFirstRow>(), Accelerator( GDK_KEY_KP_Subtract, (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "PatchDeleteLastRow", FreeCaller<Patch_DeleteLastRow>() );
-       GlobalCommands_insert( "InvertCurve", FreeCaller<Patch_Invert>(), Accelerator( 'I', (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "RedisperseRows", FreeCaller<Patch_RedisperseRows>(), Accelerator( 'E', (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "RedisperseCols", FreeCaller<Patch_RedisperseCols>(), Accelerator( 'E', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
-       GlobalCommands_insert( "SmoothRows", FreeCaller<Patch_SmoothRows>(), Accelerator( 'W', (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "SmoothCols", FreeCaller<Patch_SmoothCols>(), Accelerator( 'W', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
-       GlobalCommands_insert( "MatrixTranspose", FreeCaller<Patch_Transpose>(), Accelerator( 'M', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
-       GlobalCommands_insert( "CapCurrentCurve", FreeCaller<Patch_Cap>(), Accelerator( 'C', (GdkModifierType)GDK_SHIFT_MASK ) );
-       GlobalCommands_insert( "CycleCapTexturePatch", FreeCaller<Patch_CycleProjection>(), Accelerator( 'N', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
-       GlobalCommands_insert( "MakeOverlayPatch", FreeCaller<Patch_OverlayOn>(), Accelerator( 'Y' ) );
-       GlobalCommands_insert( "ClearPatchOverlays", FreeCaller<Patch_OverlayOff>(), Accelerator( 'L', (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "InvertCurveTextureX", makeCallbackF(Patch_FlipTextureX), Accelerator( 'I', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+       GlobalCommands_insert( "InvertCurveTextureY", makeCallbackF(Patch_FlipTextureY), Accelerator( 'I', (GdkModifierType)GDK_SHIFT_MASK ) );
+       GlobalCommands_insert( "NaturalizePatch", makeCallbackF(Patch_NaturalTexture), Accelerator( 'N', (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "PatchCylinder", makeCallbackF(Patch_Cylinder) );
+       GlobalCommands_insert( "PatchDenseCylinder", makeCallbackF(Patch_DenseCylinder) );
+       GlobalCommands_insert( "PatchVeryDenseCylinder", makeCallbackF(Patch_VeryDenseCylinder) );
+       GlobalCommands_insert( "PatchSquareCylinder", makeCallbackF(Patch_SquareCylinder) );
+       GlobalCommands_insert( "PatchXactCylinder", makeCallbackF(Patch_XactCylinder) );
+       GlobalCommands_insert( "PatchXactSphere", makeCallbackF(Patch_XactSphere) );
+       GlobalCommands_insert( "PatchXactCone", makeCallbackF(Patch_XactCone) );
+       GlobalCommands_insert( "PatchEndCap", makeCallbackF(Patch_Endcap) );
+       GlobalCommands_insert( "PatchBevel", makeCallbackF(Patch_Bevel) );
+       GlobalCommands_insert( "PatchSquareBevel", makeCallbackF(Patch_SquareBevel) );
+       GlobalCommands_insert( "PatchSquareEndcap", makeCallbackF(Patch_SquareEndcap) );
+       GlobalCommands_insert( "PatchCone", makeCallbackF(Patch_Cone) );
+       GlobalCommands_insert( "PatchSphere", makeCallbackF(Patch_Sphere) );
+       GlobalCommands_insert( "SimplePatchMesh", makeCallbackF(Patch_Plane), Accelerator( 'P', (GdkModifierType)GDK_SHIFT_MASK ) );
+       GlobalCommands_insert( "PatchInsertInsertColumn", makeCallbackF(Patch_InsertInsertColumn), Accelerator( GDK_KEY_KP_Add, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+       GlobalCommands_insert( "PatchInsertAddColumn", makeCallbackF(Patch_InsertAddColumn) );
+       GlobalCommands_insert( "PatchInsertInsertRow", makeCallbackF(Patch_InsertInsertRow), Accelerator( GDK_KEY_KP_Add, (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "PatchInsertAddRow", makeCallbackF(Patch_InsertAddRow) );
+       GlobalCommands_insert( "PatchDeleteFirstColumn", makeCallbackF(Patch_DeleteFirstColumn) );
+       GlobalCommands_insert( "PatchDeleteLastColumn", makeCallbackF(Patch_DeleteLastColumn), Accelerator( GDK_KEY_KP_Subtract, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+       GlobalCommands_insert( "PatchDeleteFirstRow", makeCallbackF(Patch_DeleteFirstRow), Accelerator( GDK_KEY_KP_Subtract, (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "PatchDeleteLastRow", makeCallbackF(Patch_DeleteLastRow) );
+       GlobalCommands_insert( "InvertCurve", makeCallbackF(Patch_Invert), Accelerator( 'I', (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "RedisperseRows", makeCallbackF(Patch_RedisperseRows), Accelerator( 'E', (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "RedisperseCols", makeCallbackF(Patch_RedisperseCols), Accelerator( 'E', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+       GlobalCommands_insert( "SmoothRows", makeCallbackF(Patch_SmoothRows), Accelerator( 'W', (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "SmoothCols", makeCallbackF(Patch_SmoothCols), Accelerator( 'W', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+       GlobalCommands_insert( "MatrixTranspose", makeCallbackF(Patch_Transpose), Accelerator( 'M', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+       GlobalCommands_insert( "CapCurrentCurve", makeCallbackF(Patch_Cap), Accelerator( 'C', (GdkModifierType)GDK_SHIFT_MASK ) );
+       GlobalCommands_insert( "CycleCapTexturePatch", makeCallbackF(Patch_CycleProjection), Accelerator( 'N', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+       GlobalCommands_insert( "MakeOverlayPatch", makeCallbackF(Patch_OverlayOn), Accelerator( 'Y' ) );
+       GlobalCommands_insert( "ClearPatchOverlays", makeCallbackF(Patch_OverlayOff), Accelerator( 'L', (GdkModifierType)GDK_CONTROL_MASK ) );
 }
 
 void Patch_constructToolbar( ui::Toolbar toolbar ){
@@ -845,14 +750,13 @@ void Patch_constructMenu( ui::Menu menu ){
 
 void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows, int defcols, int maxrows, int maxcols ){
        ModalDialog dialog;
-       GtkComboBox* width;
-       GtkComboBox* height;
 
        ui::Window window = MainFrame_getWindow().create_dialog_window("Patch density", G_CALLBACK(dialog_delete_callback ), &dialog );
 
        auto accel = ui::AccelGroup(ui::New);
        window.add_accel_group( accel );
-
+       auto width = ui::ComboBoxText(ui::New);
+       auto height = ui::ComboBoxText(ui::New);
        {
                auto hbox = create_dialog_hbox( 4, 4 );
                window.add(hbox);
@@ -873,7 +777,7 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows,
                        }
 
                        {
-                               auto combo = ui::ComboBoxText(ui::New);
+                               auto combo = width;
 #define D_ITEM( x ) if ( x >= mincols && ( !maxcols || x <= maxcols ) ) gtk_combo_box_text_append_text( combo, #x )
                                D_ITEM( 3 );
                                D_ITEM( 5 );
@@ -893,11 +797,9 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows,
 #undef D_ITEM
                                combo.show();
                 table.attach(combo, {1, 2, 0, 1}, {GTK_EXPAND | GTK_FILL, 0});
-
-                               width = combo;
                        }
                        {
-                               auto combo = ui::ComboBoxText(ui::New);
+                               auto combo = height;
 #define D_ITEM( x ) if ( x >= minrows && ( !maxrows || x <= maxrows ) ) gtk_combo_box_text_append_text( combo, #x )
                                D_ITEM( 3 );
                                D_ITEM( 5 );
@@ -917,8 +819,6 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows,
 #undef D_ITEM
                                combo.show();
                 table.attach(combo, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
-
-                               height = combo;
                        }
                }
 
@@ -1016,7 +916,7 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){
 
                                GSList* group = 0;
                                {
-                                       ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Bevel" ));
+                                       ui::Widget button = ui::Widget::from(gtk_radio_button_new_with_label( group, "Bevel" ));
                                        button.show();
                     table.attach(button, {1, 2, 0, 1}, {GTK_FILL | GTK_EXPAND, 0});
                                        group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( button ) );
@@ -1024,7 +924,7 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){
                                        bevel = button;
                                }
                                {
-                                       ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Endcap" ));
+                                       ui::Widget button = ui::Widget::from(gtk_radio_button_new_with_label( group, "Endcap" ));
                                        button.show();
                     table.attach(button, {1, 2, 1, 2}, {GTK_FILL | GTK_EXPAND, 0});
                                        group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( button ) );
@@ -1032,7 +932,7 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){
                                        endcap = button;
                                }
                                {
-                                       ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Inverted Bevel" ));
+                                       ui::Widget button = ui::Widget::from(gtk_radio_button_new_with_label( group, "Inverted Bevel" ));
                                        button.show();
                     table.attach(button, {1, 2, 2, 3}, {GTK_FILL | GTK_EXPAND, 0});
                                        group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( button ) );
@@ -1040,7 +940,7 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){
                                        ibevel = button;
                                }
                                {
-                                       ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Inverted Endcap" ));
+                                       ui::Widget button = ui::Widget::from(gtk_radio_button_new_with_label( group, "Inverted Endcap" ));
                                        button.show();
                     table.attach(button, {1, 2, 3, 4}, {GTK_FILL | GTK_EXPAND, 0});
                                        group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( button ) );
@@ -1048,7 +948,7 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){
                                        iendcap = button;
                                }
                                {
-                                       ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Cylinder" ));
+                                       ui::Widget button = ui::Widget::from(gtk_radio_button_new_with_label( group, "Cylinder" ));
                                        button.show();
                     table.attach(button, {1, 2, 4, 5}, {GTK_FILL | GTK_EXPAND, 0});
                                        group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( button ) );