From: Thomas Debesse Date: Mon, 25 May 2020 20:32:22 +0000 (+0200) Subject: Merge commit 'cac514541c3ae6f72c4c00c19c215ff62a023df4' into garux-merge X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e984b9f54a0c733aab34a8ec19724dc4114ade28;p=xonotic%2Fnetradiant.git Merge commit 'cac514541c3ae6f72c4c00c19c215ff62a023df4' into garux-merge --- e984b9f54a0c733aab34a8ec19724dc4114ade28 diff --cc libs/gtkutil/paned.cpp index 4f724eef,a78966e7..89025f62 --- a/libs/gtkutil/paned.cpp +++ b/libs/gtkutil/paned.cpp @@@ -21,8 -21,8 +21,7 @@@ #include "paned.h" -#include -#include +#include - #include #include "frame.h" @@@ -61,34 -61,36 +60,36 @@@ PanedState g_hpaned = { 0.5f, -1, } PanedState g_vpaned1 = { 0.5f, -1, }; PanedState g_vpaned2 = { 0.5f, -1, }; - ui::HPaned create_split_views( ui::Widget topleft, ui::Widget topright, ui::Widget botleft, ui::Widget botright ){ -GtkWidget* create_split_views( GtkWidget* topleft, GtkWidget* botleft, GtkWidget* topright, GtkWidget* botright, GtkWidget*& vsplit1, GtkWidget*& vsplit2 ){ - GtkHPaned* hsplit = GTK_HPANED( gtk_hpaned_new() ); - gtk_widget_show( GTK_WIDGET( hsplit ) ); ++ui::Widget create_split_views( ui::Widget topleft, ui::Widget topright, ui::Widget botleft, ui::Widget botright, ui::Widget& vsplit1, ui::Widget& vsplit2 ){ + auto hsplit = ui::HPaned(ui::New); + hsplit.show(); - g_signal_connect( G_OBJECT( hsplit ), "size_allocate", G_CALLBACK( hpaned_allocate ), &g_hpaned ); - g_signal_connect( G_OBJECT( hsplit ), "notify::position", G_CALLBACK( paned_position ), &g_hpaned ); + hsplit.connect( "size_allocate", G_CALLBACK( hpaned_allocate ), &g_hpaned ); + hsplit.connect( "notify::position", G_CALLBACK( paned_position ), &g_hpaned ); { - GtkVPaned* vsplit = GTK_VPANED( gtk_vpaned_new() ); - vsplit1 = GTK_WIDGET( vsplit ); + auto vsplit = ui::VPaned(ui::New); - gtk_paned_add1( GTK_PANED( hsplit ), vsplit ); - vsplit.show(); ++ vsplit1 = vsplit; + gtk_paned_add1( GTK_PANED( hsplit ), GTK_WIDGET( vsplit ) ); + gtk_widget_show( GTK_WIDGET( vsplit ) ); - g_signal_connect( G_OBJECT( vsplit ), "size_allocate", G_CALLBACK( vpaned_allocate ), &g_vpaned1 ); - g_signal_connect( G_OBJECT( vsplit ), "notify::position", G_CALLBACK( paned_position ), &g_vpaned1 ); + vsplit.connect( "size_allocate", G_CALLBACK( vpaned_allocate ), &g_vpaned1 ); + vsplit.connect( "notify::position", G_CALLBACK( paned_position ), &g_vpaned1 ); - gtk_paned_add1( GTK_PANED( vsplit ), create_framed_widget( topleft ) ); - gtk_paned_add2( GTK_PANED( vsplit ), create_framed_widget( topright ) ); + gtk_paned_add1( GTK_PANED( vsplit ), GTK_WIDGET( create_framed_widget( topleft ) ) ); + gtk_paned_add2( GTK_PANED( vsplit ), GTK_WIDGET( create_framed_widget( botleft ) ) ); } { - GtkVPaned* vsplit = GTK_VPANED( gtk_vpaned_new() ); - vsplit2 = GTK_WIDGET( vsplit ); + auto vsplit = ui::VPaned(ui::New); - gtk_paned_add2( GTK_PANED( hsplit ), vsplit ); - vsplit.show(); ++ vsplit2 = vsplit; + gtk_paned_add2( GTK_PANED( hsplit ), GTK_WIDGET( vsplit ) ); + gtk_widget_show( GTK_WIDGET( vsplit ) ); - g_signal_connect( G_OBJECT( vsplit ), "size_allocate", G_CALLBACK( vpaned_allocate ), &g_vpaned2 ); - g_signal_connect( G_OBJECT( vsplit ), "notify::position", G_CALLBACK( paned_position ), &g_vpaned2 ); + vsplit.connect( "size_allocate", G_CALLBACK( vpaned_allocate ), &g_vpaned2 ); + vsplit.connect( "notify::position", G_CALLBACK( paned_position ), &g_vpaned2 ); - gtk_paned_add1( GTK_PANED( vsplit ), create_framed_widget( botleft ) ); - gtk_paned_add2( GTK_PANED( vsplit ), create_framed_widget( botright ) ); + gtk_paned_add1( GTK_PANED( vsplit ), GTK_WIDGET( create_framed_widget( topright ) ) ); + gtk_paned_add2( GTK_PANED( vsplit ), GTK_WIDGET( create_framed_widget( botright ) ) ); } - return GTK_WIDGET( hsplit ); + return hsplit; } diff --cc libs/gtkutil/paned.h index 842996ef,2c95be41..7bb5dc1b --- a/libs/gtkutil/paned.h +++ b/libs/gtkutil/paned.h @@@ -22,8 -22,8 +22,8 @@@ #if !defined( INCLUDED_GTKUTIL_PANED_H ) #define INCLUDED_GTKUTIL_PANED_H - ui::HPaned create_split_views( ui::Widget topleft, ui::Widget topright, ui::Widget botleft, ui::Widget botright ); -typedef struct _GtkWidget GtkWidget; -typedef struct _GtkHPaned GtkHPaned; -GtkWidget* create_split_views( GtkWidget* topleft, GtkWidget* botleft, GtkWidget* topright, GtkWidget* botright, GtkWidget*& vsplit1, GtkWidget*& vsplit2 ); ++#include ++ ++ui::Widget create_split_views( ui::Widget topleft, ui::Widget botleft, ui::Widget topright, ui::Widget botright, ui::Widget& vsplit1, ui::Widget& vsplit2 ); #endif diff --cc radiant/gtkdlgs.cpp index 1deceec8,e7e60891..53d697f4 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@@ -48,7 -45,23 +48,8 @@@ #include "iselection.h" #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include + #include #include "os/path.h" #include "math/aabb.h" @@@ -356,51 -385,84 +357,84 @@@ void DoProjectSettings() void DoSides( int type, int axis ){ ModalDialog dialog; + //GtkEntry* sides_entry; + GtkWidget* sides_spin; - GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Arbitrary sides", G_CALLBACK( dialog_delete_callback ), &dialog ); + auto window = MainFrame_getWindow().create_dialog_window("Arbitrary sides", G_CALLBACK(dialog_delete_callback ), &dialog ); - GtkAccelGroup* accel = gtk_accel_group_new(); - gtk_window_add_accel_group( window, accel ); + auto accel = ui::AccelGroup(ui::New); + window.add_accel_group( accel ); + auto sides_entry = ui::Entry(ui::New); { - GtkHBox* hbox = create_dialog_hbox( 4, 4 ); - gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( hbox ) ); + auto hbox = create_dialog_hbox( 4, 4 ); + window.add(hbox); { - GtkLabel* label = GTK_LABEL( gtk_label_new( "Sides:" ) ); - gtk_widget_show( GTK_WIDGET( label ) ); - gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 ); + auto label = ui::Label( "Sides:" ); + label.show(); + hbox.pack_start( label, FALSE, FALSE, 0 ); } + // { -// GtkEntry* entry = GTK_ENTRY( gtk_entry_new() ); -// gtk_widget_show( GTK_WIDGET( entry ) ); -// gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( entry ), FALSE, FALSE, 0 ); -// sides_entry = entry; -// gtk_widget_grab_focus( GTK_WIDGET( entry ) ); ++// auto entry = sides_entry; ++// entry.show(); ++// hbox.pack_start( entry, FALSE, FALSE, 0 ); ++// gtk_widget_grab_focus( entry ); + // } { - auto entry = sides_entry; - entry.show(); - hbox.pack_start( entry, FALSE, FALSE, 0 ); - gtk_widget_grab_focus( entry ); + GtkAdjustment* adj; + EBrushPrefab BrushPrefabType = (EBrushPrefab)type; + switch ( BrushPrefabType ) + { + case eBrushPrism : + case eBrushCone : + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 8, 3, 1022, 1, 10, 0 ) ); + break; + case eBrushSphere : + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 8, 3, 31, 1, 10, 0 ) ); + break; + case eBrushRock : + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 32, 10, 1000, 1, 10, 0 ) ); + break; + default: + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 8, 3, 31, 1, 10, 0 ) ); + break; + } + + GtkWidget* spin = gtk_spin_button_new( adj, 1, 0 ); + gtk_widget_show( spin ); + gtk_box_pack_start( GTK_BOX( hbox ), spin, FALSE, FALSE, 0 ); + gtk_widget_set_size_request( spin, 64, -1 ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + + sides_spin = spin; } { - GtkVBox* vbox = create_dialog_vbox( 4 ); - gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 ); + auto vbox = create_dialog_vbox( 4 ); + hbox.pack_start( vbox, TRUE, TRUE, 0 ); { - GtkButton* button = create_dialog_button( "OK", G_CALLBACK( dialog_button_ok ), &dialog ); - gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 ); - widget_make_default( GTK_WIDGET( button ) ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); + auto button = create_dialog_button( "OK", G_CALLBACK( dialog_button_ok ), &dialog ); + vbox.pack_start( button, FALSE, FALSE, 0 ); + widget_make_default( button ); + gtk_widget_add_accelerator( button , "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); } { - GtkButton* button = create_dialog_button( "Cancel", G_CALLBACK( dialog_button_cancel ), &dialog ); - gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); + auto button = create_dialog_button( "Cancel", G_CALLBACK( dialog_button_cancel ), &dialog ); + vbox.pack_start( button, FALSE, FALSE, 0 ); + gtk_widget_add_accelerator( button , "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); } } } if ( modal_dialog_show( window, dialog ) == eIDOK ) { - const char *str = gtk_entry_get_text( sides_entry ); + // const char *str = gtk_entry_get_text( sides_entry ); - Scene_BrushConstructPrefab( GlobalSceneGraph(), (EBrushPrefab)type, atoi( str ), TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ) ); + // Scene_BrushConstructPrefab( GlobalSceneGraph(), (EBrushPrefab)type, atoi( str ), TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ) ); + gtk_spin_button_update ( GTK_SPIN_BUTTON( sides_spin ) ); + int sides = static_cast( gtk_spin_button_get_value( GTK_SPIN_BUTTON( sides_spin ) ) ); + Scene_BrushConstructPrefab( GlobalSceneGraph(), (EBrushPrefab)type, sides, TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ) ); } - gtk_widget_destroy( GTK_WIDGET( window ) ); + window.destroy(); } // ============================================================================= diff --cc radiant/mainframe.cpp index 4bd30a95,8e0c10b7..86bddbe7 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@@ -2306,9 -2157,10 +2306,10 @@@ ui::MenuItem create_misc_menu() create_menu_item_with_mnemonic( menu, "Find brush...", "FindBrush" ); create_menu_item_with_mnemonic( menu, "Map Info...", "MapInfo" ); // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=394 - // create_menu_item_with_mnemonic(menu, "_Print XY View", FreeCaller()); - create_menu_item_with_mnemonic( menu, "_Background select", makeCallbackF(WXY_BackgroundSelect) ); -// create_menu_item_with_mnemonic(menu, "_Print XY View", FreeCaller()); - create_menu_item_with_mnemonic( menu, "_Background image...", FreeCaller() ); ++// create_menu_item_with_mnemonic(menu, "_Print XY View", makeCallbackF( WXY_Print )); ++ create_menu_item_with_mnemonic( menu, "_Background image...", makeCallbackF(WXY_BackgroundSelect) ); create_menu_item_with_mnemonic( menu, "Fullscreen", "Fullscreen" ); + create_menu_item_with_mnemonic( menu, "Maximize view", "MaximizeView" ); return misc_menu_item; } @@@ -3169,15 -3010,16 +3170,19 @@@ void MainFrame::Create() } { - GtkFrame* frame = create_framed_widget( TextureBrowser_constructWindow( GroupDialog_getWindow() ) ); - g_page_textures = GroupDialog_addPage( "Textures", GTK_WIDGET( frame ), TextureBrowserExportTitleCaller() ); + auto frame = create_framed_widget( TextureBrowser_constructWindow( GroupDialog_getWindow() ) ); + g_page_textures = GroupDialog_addPage( "Textures", frame, TextureBrowserExportTitleCaller() ); +#ifndef GARUX_GTK_WORKAROUND /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */ g_object_set_data( G_OBJECT( GroupDialog_getWindow() ), "glwidget", TextureBrowser_getGLWidget() ); +#endif - } - m_vSplit = 0; - m_hSplit = 0; - m_vSplit2 = 0; ++ // FIXME: find a way to do it with newer syntax ++ // m_vSplit = 0; ++ // m_hSplit = 0; ++ // m_vSplit2 = 0; + GroupDialog_show(); } else // 4 way @@@ -3201,18 -3043,16 +3206,18 @@@ m_pXZWnd = new XYWnd(); m_pXZWnd->SetViewType( XZ ); - GtkWidget* xz = m_pXZWnd->GetWidget(); + ui::Widget xz = m_pXZWnd->GetWidget(); - auto split = create_split_views( camera, yz, xy, xz ); - vbox.pack_start( split, TRUE, TRUE, 0 ); + m_hSplit = create_split_views( camera, yz, xy, xz, m_vSplit, m_vSplit2 ); - gtk_box_pack_start( GTK_BOX( vbox ), m_hSplit, TRUE, TRUE, 0 ); ++ vbox.pack_start( m_hSplit, TRUE, TRUE, 0 ); { - GtkFrame* frame = create_framed_widget( TextureBrowser_constructWindow( GroupDialog_getWindow() ) ); - g_page_textures = GroupDialog_addPage( "Textures", GTK_WIDGET( frame ), TextureBrowserExportTitleCaller() ); + auto frame = create_framed_widget( TextureBrowser_constructWindow( GroupDialog_getWindow() ) ); + g_page_textures = GroupDialog_addPage( "Textures", frame, TextureBrowserExportTitleCaller() ); +#ifndef GARUX_GTK_WORKAROUND /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */ g_object_set_data( G_OBJECT( GroupDialog_getWindow() ), "glwidget", TextureBrowser_getGLWidget() ); +#endif } } @@@ -3456,6 -3297,73 +3461,73 @@@ void MainFrame_toggleFullscreen() } } + class MaximizeView + { + public: + MaximizeView(): m_maximized( false ){ + } + void toggle(){ + return m_maximized ? restore() : maximize(); + } + private: + bool m_maximized; + int m_vSplitPos; + int m_vSplit2Pos; + int m_hSplitPos; + + void restore(){ + m_maximized = false; + gtk_paned_set_position( GTK_PANED( g_pParentWnd->m_vSplit ), m_vSplitPos ); + gtk_paned_set_position( GTK_PANED( g_pParentWnd->m_vSplit2 ), m_vSplit2Pos ); + gtk_paned_set_position( GTK_PANED( g_pParentWnd->m_hSplit ), m_hSplitPos ); + } + + void maximize(){ + m_maximized = true; + m_vSplitPos = gtk_paned_get_position( GTK_PANED( g_pParentWnd->m_vSplit ) ); + m_vSplit2Pos = gtk_paned_get_position( GTK_PANED( g_pParentWnd->m_vSplit2 ) ); + m_hSplitPos = gtk_paned_get_position( GTK_PANED( g_pParentWnd->m_hSplit ) ); + + int vSplitX, vSplitY, vSplit2X, vSplit2Y, hSplitX, hSplitY; - gdk_window_get_origin( g_pParentWnd->m_vSplit->window, &vSplitX, &vSplitY ); - gdk_window_get_origin( g_pParentWnd->m_vSplit2->window, &vSplit2X, &vSplit2Y ); - gdk_window_get_origin( g_pParentWnd->m_hSplit->window, &hSplitX, &hSplitY ); ++ gdk_window_get_origin( GTK_WIDGET( g_pParentWnd->m_vSplit )->window, &vSplitX, &vSplitY ); ++ gdk_window_get_origin( GTK_WIDGET( g_pParentWnd->m_vSplit2 )->window, &vSplit2X, &vSplit2Y ); ++ gdk_window_get_origin( GTK_WIDGET( g_pParentWnd->m_hSplit )->window, &hSplitX, &hSplitY ); + + vSplitY += m_vSplitPos; + vSplit2Y += m_vSplit2Pos; + hSplitX += m_hSplitPos; + + int cur_x, cur_y; + Sys_GetCursorPos( MainFrame_getWindow(), &cur_x, &cur_y ); + + if( cur_x > hSplitX ){ + gtk_paned_set_position( GTK_PANED( g_pParentWnd->m_hSplit ), 0 ); + } + else{ + gtk_paned_set_position( GTK_PANED( g_pParentWnd->m_hSplit ), 9999 ); + } + if( cur_y > vSplitY ){ + gtk_paned_set_position( GTK_PANED( g_pParentWnd->m_vSplit ), 0 ); + } + else{ + gtk_paned_set_position( GTK_PANED( g_pParentWnd->m_vSplit ), 9999 ); + } + if( cur_y > vSplit2Y ){ + gtk_paned_set_position( GTK_PANED( g_pParentWnd->m_vSplit2 ), 0 ); + } + else{ + gtk_paned_set_position( GTK_PANED( g_pParentWnd->m_vSplit2 ), 9999 ); + } + } + }; + + MaximizeView g_maximizeview; + + void Maximize_View(){ + if( g_pParentWnd != 0 && g_pParentWnd->m_vSplit != 0 && g_pParentWnd->m_vSplit2 != 0 && g_pParentWnd->m_hSplit != 0 ) + g_maximizeview.toggle(); + } + #include "preferencesystem.h" #include "stringio.h" @@@ -3555,13 -3462,14 +3627,14 @@@ void MainFrame_Construct() GlobalCommands_insert( "ChooseClipperColor", makeCallback( g_ColoursMenu.m_clipper ) ); GlobalCommands_insert( "ChooseOrthoViewNameColor", makeCallback( g_ColoursMenu.m_viewname ) ); - GlobalCommands_insert( "Fullscreen", FreeCaller(), Accelerator( GDK_F11 ) ); - GlobalCommands_insert( "MaximizeView", FreeCaller(), Accelerator( GDK_F12 ) ); + GlobalCommands_insert( "Fullscreen", makeCallbackF( MainFrame_toggleFullscreen ), Accelerator( GDK_F11 ) ); ++ GlobalCommands_insert( "MaximizeView", makeCallbackF( Maximize_View ), Accelerator( GDK_F12 ) ); - GlobalCommands_insert( "CSGSubtract", FreeCaller(), Accelerator( 'U', (GdkModifierType)GDK_SHIFT_MASK ) ); - GlobalCommands_insert( "CSGMerge", FreeCaller(), Accelerator( 'U', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "CSGroom", FreeCaller() ); - GlobalCommands_insert( "CSGTool", FreeCaller() ); + GlobalCommands_insert( "CSGSubtract", makeCallbackF(CSG_Subtract), Accelerator( 'U', (GdkModifierType)GDK_SHIFT_MASK ) ); + GlobalCommands_insert( "CSGMerge", makeCallbackF(CSG_Merge), Accelerator( 'U', (GdkModifierType) GDK_CONTROL_MASK ) ); + GlobalCommands_insert( "CSGRoom", makeCallbackF(CSG_MakeRoom) ); + GlobalCommands_insert( "CSGTool", makeCallbackF(CSG_Tool) ); Grid_registerCommands(); diff --cc radiant/mainframe.h index ca8c79c6,34d925b3..ba9d94b1 --- a/radiant/mainframe.h +++ b/radiant/mainframe.h @@@ -72,10 -73,13 +72,13 @@@ void Create() void SaveWindowInfo(); void Shutdown(); + public: -GtkWidget* m_vSplit; -GtkWidget* m_hSplit; -GtkWidget* m_vSplit2; +ui::Widget m_vSplit{ui::null}; +ui::Widget m_hSplit{ui::null}; +ui::Widget m_vSplit2{ui::null}; + private: + XYWnd* m_pXYWnd; XYWnd* m_pYZWnd; XYWnd* m_pXZWnd; diff --cc radiant/patchmanip.cpp index dae11c60,be74d66a..7e21b4fc --- a/radiant/patchmanip.cpp +++ b/radiant/patchmanip.cpp @@@ -209,15 -188,13 +212,15 @@@ void Patch_deform( Patch& patch, scene: patch.controlPointsChanged(); } - void Scene_PatchDeform( scene::Graph& graph, const int deform ) + void Scene_PatchDeform( scene::Graph& graph, const int deform, const int axis ) { 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_deform( *Node_getPatch( ( *i )->path().top() ), *( *i ), deform ); + Patch_deform( *Node_getPatch( ( *i )->path().top() ), *( *i ), deform, axis ); } } @@@ -775,87 -815,79 +778,79 @@@ void PatchPreferences_construct() #include "generic/callback.h" void Patch_registerCommands(){ - GlobalCommands_insert( "InvertCurveTextureX", FreeCaller(), Accelerator( 'I', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); - GlobalCommands_insert( "InvertCurveTextureY", FreeCaller(), Accelerator( 'I', (GdkModifierType)GDK_SHIFT_MASK ) ); - GlobalCommands_insert( "NaturalizePatch", FreeCaller(), Accelerator( 'N', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "PatchCylinder", FreeCaller() ); -// GlobalCommands_insert( "PatchDenseCylinder", FreeCaller() ); -// GlobalCommands_insert( "PatchVeryDenseCylinder", FreeCaller() ); - GlobalCommands_insert( "PatchSquareCylinder", FreeCaller() ); - GlobalCommands_insert( "PatchXactCylinder", FreeCaller() ); - GlobalCommands_insert( "PatchXactSphere", FreeCaller() ); - GlobalCommands_insert( "PatchXactCone", FreeCaller() ); - GlobalCommands_insert( "PatchEndCap", FreeCaller() ); - GlobalCommands_insert( "PatchBevel", FreeCaller() ); -// GlobalCommands_insert( "PatchSquareBevel", FreeCaller() ); -// GlobalCommands_insert( "PatchSquareEndcap", FreeCaller() ); - GlobalCommands_insert( "PatchCone", FreeCaller() ); - GlobalCommands_insert( "PatchSphere", FreeCaller() ); - GlobalCommands_insert( "SimplePatchMesh", FreeCaller(), Accelerator( 'P', (GdkModifierType)GDK_SHIFT_MASK ) ); - GlobalCommands_insert( "PatchInsertFirstColumn", FreeCaller(), Accelerator( GDK_KP_Add, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); - GlobalCommands_insert( "PatchInsertLastColumn", FreeCaller() ); - GlobalCommands_insert( "PatchInsertFirstRow", FreeCaller(), Accelerator( GDK_KP_Add, (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "PatchInsertLastRow", FreeCaller() ); - GlobalCommands_insert( "PatchDeleteFirstColumn", FreeCaller() ); - GlobalCommands_insert( "PatchDeleteLastColumn", FreeCaller(), Accelerator( GDK_KP_Subtract, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); - GlobalCommands_insert( "PatchDeleteFirstRow", FreeCaller() ); - GlobalCommands_insert( "PatchDeleteLastRow", FreeCaller(), Accelerator( GDK_KP_Subtract, (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "InvertCurve", FreeCaller(), Accelerator( 'I', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "RedisperseRows", FreeCaller(), Accelerator( 'E', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "RedisperseCols", FreeCaller(), Accelerator( 'E', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); - GlobalCommands_insert( "SmoothRows", FreeCaller(), Accelerator( 'W', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "SmoothCols", FreeCaller(), Accelerator( 'W', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); - GlobalCommands_insert( "MatrixTranspose", FreeCaller(), Accelerator( 'M', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); - GlobalCommands_insert( "CapCurrentCurve", FreeCaller(), Accelerator( 'C', (GdkModifierType)GDK_SHIFT_MASK ) ); - GlobalCommands_insert( "CycleCapTexturePatch", FreeCaller(), Accelerator( 'N', (GdkModifierType)GDK_SHIFT_MASK ) ); -// GlobalCommands_insert( "MakeOverlayPatch", FreeCaller(), Accelerator( 'Y' ) ); -// GlobalCommands_insert( "ClearPatchOverlays", FreeCaller(), Accelerator( 'L', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "PatchDeform", FreeCaller() ); - GlobalCommands_insert( "PatchThicken", FreeCaller(), Accelerator( 'T', (GdkModifierType)GDK_CONTROL_MASK ) ); -} - -void Patch_constructToolbar( GtkToolbar* toolbar ){ - toolbar_append_button( toolbar, "Put caps on the current patch (SHIFT + C)", "curve_cap.png", "CapCurrentCurve" ); -} - -void Patch_constructMenu( GtkMenu* menu ){ + 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( "IncPatchColumn", makeCallbackF(Patch_InsertInsertColumn), Accelerator( GDK_KP_Add, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); - GlobalCommands_insert( "IncPatchRow", makeCallbackF(Patch_InsertInsertRow), Accelerator( GDK_KP_Add, (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "DecPatchColumn", makeCallbackF(Patch_DeleteLastColumn), Accelerator( GDK_KP_Subtract, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); - GlobalCommands_insert( "DecPatchRow", makeCallbackF(Patch_DeleteLastRow), Accelerator( GDK_KP_Subtract, (GdkModifierType)GDK_CONTROL_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( "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( "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( "PatchInsertFirstColumn", makeCallbackF(Patch_InsertFirstColumn), Accelerator( GDK_KEY_KP_Add, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); ++ GlobalCommands_insert( "PatchInsertLastColumn", makeCallbackF(Patch_InsertLastColumn) ); ++ GlobalCommands_insert( "PatchInsertFirstRow", makeCallbackF(Patch_InsertFirstRow), Accelerator( GDK_KEY_KP_Add, (GdkModifierType)GDK_CONTROL_MASK ) ); ++ GlobalCommands_insert( "PatchInsertLastRow", makeCallbackF(Patch_InsertLastRow) ); + 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 ) ); ++// GlobalCommands_insert( "MakeOverlayPatch", makeCallbackF(Patch_OverlayOn), Accelerator( 'Y' ) ); ++// GlobalCommands_insert( "ClearPatchOverlays", makeCallbackF(Patch_OverlayOff), Accelerator( 'L', (GdkModifierType)GDK_CONTROL_MASK ) ); + GlobalCommands_insert( "PatchDeform", makeCallbackF(Patch_Deform) ); - GlobalCommands_insert( "PatchThicken", makeCallbackF(Patch_Thicken) ); ++ GlobalCommands_insert( "PatchThicken", makeCallbackF(Patch_Thicken), Accelerator( 'T', (GdkModifierType)GDK_CONTROL_MASK ) ); +} + +void Patch_constructToolbar( ui::Toolbar toolbar ){ + toolbar_append_button( toolbar, "Put caps on the current patch (SHIFT + C)", "cap_curve.png", "CapCurrentCurve" ); +} + +void Patch_constructMenu( ui::Menu menu ){ - create_menu_item_with_mnemonic( menu, "Cylinder", "PatchCylinder" ); - { - auto menu_in_menu = create_sub_menu_with_mnemonic( menu, "More Cylinders" ); - if ( g_Layout_enableDetachableMenus.m_value ) { - menu_tearoff( menu_in_menu ); - } - create_menu_item_with_mnemonic( menu_in_menu, "Dense Cylinder", "PatchDenseCylinder" ); - create_menu_item_with_mnemonic( menu_in_menu, "Very Dense Cylinder", "PatchVeryDenseCylinder" ); - create_menu_item_with_mnemonic( menu_in_menu, "Square Cylinder", "PatchSquareCylinder" ); - create_menu_item_with_mnemonic( menu_in_menu, "Exact Cylinder...", "PatchXactCylinder" ); - } - menu_separator( menu ); - create_menu_item_with_mnemonic( menu, "End cap", "PatchEndCap" ); + create_menu_item_with_mnemonic( menu, "Simple Patch Mesh...", "SimplePatchMesh" ); create_menu_item_with_mnemonic( menu, "Bevel", "PatchBevel" ); - { - // auto menu_in_menu = create_sub_menu_with_mnemonic( menu, "More End caps, Bevels" ); + create_menu_item_with_mnemonic( menu, "End cap", "PatchEndCap" ); + create_menu_item_with_mnemonic( menu, "Cylinder (9x3)", "PatchCylinder" ); + create_menu_item_with_mnemonic( menu, "Square Cylinder (9x3)", "PatchSquareCylinder" ); + create_menu_item_with_mnemonic( menu, "Exact Cylinder...", "PatchXactCylinder" ); + create_menu_item_with_mnemonic( menu, "Cone (9x3)", "PatchCone" ); + create_menu_item_with_mnemonic( menu, "Exact Cone...", "PatchXactCone" ); + create_menu_item_with_mnemonic( menu, "Sphere (9x5)", "PatchSphere" ); + create_menu_item_with_mnemonic( menu, "Exact Sphere...", "PatchXactSphere" ); + // { -// GtkMenu* menu_in_menu = create_sub_menu_with_mnemonic( menu, "More Cylinders" ); ++// ui::Menu menu_in_menu = create_sub_menu_with_mnemonic( menu, "More Cylinders" ); // if ( g_Layout_enableDetachableMenus.m_value ) { // menu_tearoff( menu_in_menu ); // } - create_menu_item_with_mnemonic( menu, "Square Endcap", "PatchSquareBevel" ); - create_menu_item_with_mnemonic( menu, "Square Bevel", "PatchSquareEndcap" ); - } - menu_separator( menu ); - create_menu_item_with_mnemonic( menu, "Cone", "PatchCone" ); - create_menu_item_with_mnemonic( menu, "Exact Cone...", "PatchXactCone" ); - menu_separator( menu ); - create_menu_item_with_mnemonic( menu, "Sphere", "PatchSphere" ); - create_menu_item_with_mnemonic( menu, "Exact Sphere...", "PatchXactSphere" ); + // create_menu_item_with_mnemonic( menu_in_menu, "Dense Cylinder", "PatchDenseCylinder" ); + // create_menu_item_with_mnemonic( menu_in_menu, "Very Dense Cylinder", "PatchVeryDenseCylinder" ); + // create_menu_item_with_mnemonic( menu_in_menu, "Square Cylinder", "PatchSquareCylinder" ); + // } + // { + // //not implemented + // create_menu_item_with_mnemonic( menu, "Square Endcap", "PatchSquareBevel" ); + // create_menu_item_with_mnemonic( menu, "Square Bevel", "PatchSquareEndcap" ); + // } menu_separator( menu ); - create_menu_item_with_mnemonic( menu, "Simple Patch Mesh...", "SimplePatchMesh" ); + create_menu_item_with_mnemonic( menu, "Cap Selection", "CapCurrentCurve" ); menu_separator( menu ); { - auto menu_in_menu = create_sub_menu_with_mnemonic( menu, "Insert" ); - GtkMenu* menu_in_menu = create_sub_menu_with_mnemonic( menu, "Insert/Delete" ); ++ auto menu_in_menu = create_sub_menu_with_mnemonic( menu, "Insert/Delete" ); if ( g_Layout_enableDetachableMenus.m_value ) { menu_tearoff( menu_in_menu ); } @@@ -883,28 -910,19 +873,19 @@@ menu_tearoff( menu_in_menu ); } create_menu_item_with_mnemonic( menu_in_menu, "Invert", "InvertCurve" ); - // auto menu_3 = create_sub_menu_with_mnemonic( menu_in_menu, "Re-disperse" ); - // if ( g_Layout_enableDetachableMenus.m_value ) { - // menu_tearoff( menu_3 ); - // } - menu_separator( menu_in_menu ); - create_menu_item_with_mnemonic( menu, "Rows", "RedisperseRows" ); - create_menu_item_with_mnemonic( menu, "Columns", "RedisperseCols" ); - // auto menu_4 = create_sub_menu_with_mnemonic( menu_in_menu, "Smooth" ); - // if ( g_Layout_enableDetachableMenus.m_value ) { - // menu_tearoff( menu_4 ); - // } - create_menu_item_with_mnemonic( menu, "Rows", "SmoothRows" ); - create_menu_item_with_mnemonic( menu, "Columns", "SmoothCols" ); create_menu_item_with_mnemonic( menu_in_menu, "Transpose", "MatrixTranspose" ); + menu_separator( menu_in_menu ); + create_menu_item_with_mnemonic( menu_in_menu, "Re-disperse Rows", "RedisperseRows" ); + create_menu_item_with_mnemonic( menu_in_menu, "Re-disperse Columns", "RedisperseCols" ); + + menu_separator( menu_in_menu ); + create_menu_item_with_mnemonic( menu_in_menu, "Smooth Rows", "SmoothRows" ); + create_menu_item_with_mnemonic( menu_in_menu, "Smooth Columns", "SmoothCols" ); } menu_separator( menu ); - create_menu_item_with_mnemonic( menu, "Cap Selection", "CapCurrentCurve" ); - create_menu_item_with_mnemonic( menu, "Cycle Cap Texture", "CycleCapTexturePatch" ); - menu_separator( menu ); { - GtkMenu* menu_in_menu = create_sub_menu_with_mnemonic( menu, "Texture" ); + auto menu_in_menu = create_sub_menu_with_mnemonic( menu, "Texture" ); if ( g_Layout_enableDetachableMenus.m_value ) { menu_tearoff( menu_in_menu ); } @@@ -914,15 -932,15 +895,15 @@@ create_menu_item_with_mnemonic( menu_in_menu, "Invert Y", "InvertCurveTextureY" ); } - menu_separator( menu ); - { - auto menu_in_menu = create_sub_menu_with_mnemonic( menu, "Overlay" ); - if ( g_Layout_enableDetachableMenus.m_value ) { - menu_tearoff( menu_in_menu ); - } - create_menu_item_with_mnemonic( menu_in_menu, "Set", "MakeOverlayPatch" ); - create_menu_item_with_mnemonic( menu_in_menu, "Clear", "ClearPatchOverlays" ); - } + // menu_separator( menu ); -// { //unfinished -// GtkMenu* menu_in_menu = create_sub_menu_with_mnemonic( menu, "Overlay" ); ++// { ++// auto menu_in_menu = create_sub_menu_with_mnemonic( menu, "Overlay" ); + // if ( g_Layout_enableDetachableMenus.m_value ) { + // menu_tearoff( menu_in_menu ); + // } + // create_menu_item_with_mnemonic( menu_in_menu, "Set", "MakeOverlayPatch" ); + // create_menu_item_with_mnemonic( menu_in_menu, "Clear", "ClearPatchOverlays" ); + // } menu_separator( menu ); create_menu_item_with_mnemonic( menu, "Deform...", "PatchDeform" ); create_menu_item_with_mnemonic( menu, "Thicken...", "PatchThicken" ); @@@ -934,23 -959,27 +915,24 @@@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows, int defcols, int maxrows, int maxcols ){ ModalDialog dialog; - GtkComboBox* width; - GtkComboBox* height; + GtkWidget* redisperseCheckBox; - GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Patch density", G_CALLBACK( dialog_delete_callback ), &dialog ); - - GtkAccelGroup* accel = gtk_accel_group_new(); - gtk_window_add_accel_group( window, accel ); + 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); { - GtkHBox* hbox = create_dialog_hbox( 4, 4 ); - gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( hbox ) ); + auto hbox = create_dialog_hbox( 4, 4 ); + window.add(hbox); { - auto table = create_dialog_table( 2, 2, 4, 4 ); - GtkTable* table = create_dialog_table( 3, 2, 4, 4 ); - gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 ); ++ auto table = create_dialog_table( 3, 2, 4, 4 ); + hbox.pack_start( table, TRUE, TRUE, 0 ); { - GtkLabel* label = GTK_LABEL( gtk_label_new( "Width:" ) ); - gtk_widget_show( GTK_WIDGET( label ) ); - gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + auto label = ui::Label( "Width:" ); + label.show(); + table.attach(label, {0, 1, 0, 1}, {GTK_FILL, 0}); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); } { @@@ -1001,9 -1036,25 +983,21 @@@ D_ITEM( 29 ); D_ITEM( 31 ); // MAX_PATCH_SIZE is 32, so we should be able to do 31... #undef D_ITEM - gtk_widget_show( GTK_WIDGET( combo ) ); - gtk_table_attach( table, GTK_WIDGET( combo ), 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - - height = combo; + combo.show(); + table.attach(combo, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0}); } + + if( prefab != ePlane ){ + GtkWidget* _redisperseCheckBox = gtk_check_button_new_with_label( "Square" ); + gtk_widget_set_tooltip_text( _redisperseCheckBox, "Redisperse columns & rows" ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( _redisperseCheckBox ), FALSE ); + gtk_widget_show( _redisperseCheckBox ); + gtk_table_attach( table, _redisperseCheckBox, 0, 2, 2, 3, + (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); + redisperseCheckBox = _redisperseCheckBox; + } + } { @@@ -1031,11 -1082,14 +1025,14 @@@ if ( modal_dialog_show( window, dialog ) == eIDOK ) { int w = gtk_combo_box_get_active( width ) * 2 + mincols; int h = gtk_combo_box_get_active( height ) * 2 + minrows; - - Scene_PatchConstructPrefab( GlobalSceneGraph(), PatchCreator_getBounds(), TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ), prefab, GlobalXYWnd_getCurrentViewType(), w, h ); + bool redisperse = false; + if( prefab != ePlane ){ + redisperse = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( redisperseCheckBox ) ) ? true : false; + } + Scene_PatchConstructPrefab( GlobalSceneGraph(), PatchCreator_getBounds(), TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ), prefab, GlobalXYWnd_getCurrentViewType(), w, h, redisperse ); } - gtk_widget_destroy( GTK_WIDGET( window ) ); + window.destroy(); } @@@ -1043,7 -1097,10 +1040,10 @@@ void DoPatchDeformDlg() ModalDialog dialog; GtkWidget* deformW; + GtkWidget* rndY; + GtkWidget* rndX; + - GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Patch deform", G_CALLBACK( dialog_delete_callback ), &dialog ); + ui::Window window = create_dialog_window( MainFrame_getWindow(), "Patch deform", G_CALLBACK( dialog_delete_callback ), &dialog ); GtkAccelGroup* accel = gtk_accel_group_new(); gtk_window_add_accel_group( window, accel ); @@@ -1254,9 -1373,8 +1296,8 @@@ void DoPatchThickenDlg() GtkWidget* radX; GtkWidget* radY; GtkWidget* radZ; - GtkWidget* radNormals; - GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Patch thicken", G_CALLBACK( dialog_delete_callback ), &dialog ); + ui::Window window = create_dialog_window( MainFrame_getWindow(), "Patch thicken", G_CALLBACK( dialog_delete_callback ), &dialog ); GtkAccelGroup* accel = gtk_accel_group_new(); gtk_window_add_accel_group( window, accel );