]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
Merge commit 'cac514541c3ae6f72c4c00c19c215ff62a023df4' into garux-merge
authorThomas Debesse <dev@illwieckz.net>
Mon, 25 May 2020 20:32:22 +0000 (22:32 +0200)
committerThomas Debesse <dev@illwieckz.net>
Mon, 25 May 2020 20:32:22 +0000 (22:32 +0200)
1  2 
libs/gtkutil/paned.cpp
libs/gtkutil/paned.h
radiant/brushmanip.cpp
radiant/entity.cpp
radiant/gtkdlgs.cpp
radiant/mainframe.cpp
radiant/mainframe.h
radiant/patch.cpp
radiant/patchmanip.cpp

index 4f724eef96bd6c247bd11044f0911278a5de39d4,a78966e7efe8a872175cf61e17650c28e12e3738..89025f62a5d0a9aa6b7f961fa88c918b7b47ebcc
@@@ -21,8 -21,8 +21,7 @@@
  
  #include "paned.h"
  
 -#include <gtk/gtkhpaned.h>
 -#include <gtk/gtkvpaned.h>
 +#include <gtk/gtk.h>
- #include <uilib/uilib.h>
  
  #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;
  }
index 842996efb5e3db6097b3cfa1899766e50c99cecd,2c95be41106e9aec9e88b302fdd09988b847b973..7bb5dc1bee62ed4d1b211730684dab9f4611ae4d
@@@ -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 <uilib/uilib.h>
++
++ui::Widget create_split_views( ui::Widget topleft, ui::Widget botleft, ui::Widget topright, ui::Widget botright, ui::Widget& vsplit1, ui::Widget& vsplit2 );
  
  #endif
Simple merge
Simple merge
index 1deceec8b1f756d6c478f58967293b214be8500c,e7e608911bbcf4e5a590002d7da4f418db65c27d..53d697f46aec0f24a75f6d10ab5716df9a0187bf
  #include "iselection.h"
  
  #include <gdk/gdkkeysyms.h>
 -#include <gtk/gtkmain.h>
 -#include <gtk/gtkentry.h>
 -#include <gtk/gtkhbox.h>
 -#include <gtk/gtkvbox.h>
 -#include <gtk/gtkframe.h>
 -#include <gtk/gtklabel.h>
 -#include <gtk/gtktable.h>
 -#include <gtk/gtkbutton.h>
 -#include <gtk/gtkcombobox.h>
 -#include <gtk/gtkscrolledwindow.h>
 -#include <gtk/gtktextview.h>
 -#include <gtk/gtktextbuffer.h>
 -#include <gtk/gtktreeview.h>
 -#include <gtk/gtkcellrenderertext.h>
 -#include <gtk/gtktreeselection.h>
 -#include <gtk/gtkliststore.h>
 +#include <uilib/uilib.h>
+ #include <gtk/gtkspinbutton.h>
  
  #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<int>( 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();
  }
  
  // =============================================================================
index 4bd30a9561f140282d9028b0245b36ac3cb46c3f,8e0c10b7a08bdbcf1d3c6965eefe8fc946a65e3c..86bddbe7db554d77dd6507d466c29e762f6d06bb
@@@ -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<void(), WXY_Print>());
-       create_menu_item_with_mnemonic( menu, "_Background select", makeCallbackF(WXY_BackgroundSelect) );
 -//  create_menu_item_with_mnemonic(menu, "_Print XY View", FreeCaller<WXY_Print>());
 -      create_menu_item_with_mnemonic( menu, "_Background image...", FreeCaller<WXY_BackgroundSelect>() );
++//  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
                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()
        }
  }
  
 -              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 );
+ 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( 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<MainFrame_toggleFullscreen>(), Accelerator( GDK_F11 ) );
 -      GlobalCommands_insert( "MaximizeView", FreeCaller<Maximize_View>(), 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<CSG_Subtract>(), Accelerator( 'U', (GdkModifierType)GDK_SHIFT_MASK ) );
 -      GlobalCommands_insert( "CSGMerge", FreeCaller<CSG_Merge>(), Accelerator( 'U', (GdkModifierType)GDK_CONTROL_MASK ) );
 -      GlobalCommands_insert( "CSGroom", FreeCaller<CSG_MakeRoom>() );
 -      GlobalCommands_insert( "CSGTool", FreeCaller<CSG_Tool>() );
 +      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();
  
index ca8c79c64e6fc641afc03e387e6188c4d40fd8ea,34d925b3c9256414dc9952f746de94c8c691ee68..ba9d94b10c0b85c44720fd4bdb69d9a7a2d91040
@@@ -72,10 -73,13 +72,13 @@@ void Create()
  void SaveWindowInfo();
  void Shutdown();
  
 -GtkWidget* m_vSplit;
 -GtkWidget* m_hSplit;
 -GtkWidget* m_vSplit2;
+ public:
 +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;
Simple merge
index dae11c60d5a70b03564a1ddbd0ff0ac9dd1aea5e,be74d66a40b4f1975cc919544a2c74fd8f0207ca..7e21b4fcdedb9ea4a32a29d5777ecff1780f2d96
@@@ -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<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( "PatchInsertFirstColumn", FreeCaller<Patch_InsertFirstColumn>(), Accelerator( GDK_KP_Add, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
 -      GlobalCommands_insert( "PatchInsertLastColumn", FreeCaller<Patch_InsertLastColumn>() );
 -      GlobalCommands_insert( "PatchInsertFirstRow", FreeCaller<Patch_InsertFirstRow>(), Accelerator( GDK_KP_Add, (GdkModifierType)GDK_CONTROL_MASK ) );
 -      GlobalCommands_insert( "PatchInsertLastRow", FreeCaller<Patch_InsertLastRow>() );
 -      GlobalCommands_insert( "PatchDeleteFirstColumn", FreeCaller<Patch_DeleteFirstColumn>() );
 -      GlobalCommands_insert( "PatchDeleteLastColumn", FreeCaller<Patch_DeleteLastColumn>(), Accelerator( GDK_KP_Subtract, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
 -      GlobalCommands_insert( "PatchDeleteFirstRow", FreeCaller<Patch_DeleteFirstRow>() );
 -      GlobalCommands_insert( "PatchDeleteLastRow", FreeCaller<Patch_DeleteLastRow>(), Accelerator( GDK_KP_Subtract, (GdkModifierType)GDK_CONTROL_MASK ) );
 -      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 ) );
 -//    GlobalCommands_insert( "MakeOverlayPatch", FreeCaller<Patch_OverlayOn>(), Accelerator( 'Y' ) );
 -//    GlobalCommands_insert( "ClearPatchOverlays", FreeCaller<Patch_OverlayOff>(), Accelerator( 'L', (GdkModifierType)GDK_CONTROL_MASK ) );
 -      GlobalCommands_insert( "PatchDeform", FreeCaller<Patch_Deform>() );
 -      GlobalCommands_insert( "PatchThicken", FreeCaller<Patch_Thicken>(), 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 );
                }
                        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 );
                }
                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" );
  
  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 );
                        }
                        {
                                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;
+                       }
                }
  
                {
        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;
  
 -      GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Patch deform", G_CALLBACK( dialog_delete_callback ), &dialog );
+     GtkWidget* rndY;
+       GtkWidget* rndX;
 +      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 );