#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"
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();
}
// =============================================================================
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;
}
}
{
- 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
}
}
}
}
- 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"
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();
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 );
}
}
#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();
}
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 );
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 );