From: Mattia Basaglia Date: Sun, 19 Jul 2015 07:05:59 +0000 (+0200) Subject: Clean up and fix actions, menus and dialogs for patch meshes X-Git-Tag: xonotic-v0.8.1~1^2~5^2~5 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d5b7f8515270f05aed3996418086f38c89e14ec1;p=xonotic%2Fnetradiant.git Clean up and fix actions, menus and dialogs for patch meshes --- diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index abb12ef6..95dba53b 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -2205,10 +2205,10 @@ void PatchInspector_registerShortcuts(){ void Patch_registerShortcuts(){ command_connect_accelerator( "InvertCurveTextureX" ); command_connect_accelerator( "InvertCurveTextureY" ); - command_connect_accelerator( "IncPatchColumn" ); - command_connect_accelerator( "IncPatchRow" ); - command_connect_accelerator( "DecPatchColumn" ); - command_connect_accelerator( "DecPatchRow" ); + command_connect_accelerator( "PatchInsertInsertColumn" ); + command_connect_accelerator( "PatchInsertInsertRow" ); + command_connect_accelerator( "PatchDeleteLastColumn" ); + command_connect_accelerator( "PatchDeleteLastRow" ); command_connect_accelerator( "NaturalizePatch" ); //command_connect_accelerator("CapCurrentCurve"); } diff --git a/radiant/patchdialog.cpp b/radiant/patchdialog.cpp index daa79f65..db3c4ebb 100644 --- a/radiant/patchdialog.cpp +++ b/radiant/patchdialog.cpp @@ -376,29 +376,19 @@ void Scene_PatchTileTexture_Selected( scene::Graph& graph, float s, float t ){ } static void OnBtnPatchdetails( GtkWidget *widget, gpointer data ){ - UndoableCommand command( "patchCapTexture" ); - - Scene_PatchCapTexture_Selected( GlobalSceneGraph() ); + Patch_CapTexture(); } static void OnBtnPatchfit( GtkWidget *widget, gpointer data ){ - UndoableCommand command( "patchFitTexture" ); - - Scene_PatchTileTexture_Selected( GlobalSceneGraph(), 1, 1 ); + Patch_FitTexture(); } static void OnBtnPatchnatural( GtkWidget *widget, gpointer data ){ - UndoableCommand command( "patchNaturalTexture" ); - - Scene_PatchNaturalTexture_Selected( GlobalSceneGraph() ); + Patch_NaturalTexture(); } static void OnBtnPatchreset( GtkWidget *widget, gpointer data ){ - float fx, fy; - if ( DoTextureLayout( &fx, &fy ) == eIDOK ) { - UndoableCommand command( "patchTileTexture" ); - Scene_PatchTileTexture_Selected( GlobalSceneGraph(), fx, fy ); - } + Patch_ResetTexture(); } struct PatchRotateTexture diff --git a/radiant/patchmanip.cpp b/radiant/patchmanip.cpp index d5471e98..e8d75fe5 100644 --- a/radiant/patchmanip.cpp +++ b/radiant/patchmanip.cpp @@ -585,8 +585,25 @@ void Patch_NaturalTexture(){ Scene_PatchNaturalTexture_Selected( GlobalSceneGraph() ); } +void Patch_CapTexture(){ + UndoableCommand command( "patchCapTexture" ); + Scene_PatchCapTexture_Selected( GlobalSceneGraph() ); +} + +void Patch_ResetTexture(){ + float fx, fy; + if ( DoTextureLayout( &fx, &fy ) == eIDOK ) { + UndoableCommand command( "patchTileTexture" ); + Scene_PatchTileTexture_Selected( GlobalSceneGraph(), fx, fy ); + } +} +void Patch_FitTexture(){ + UndoableCommand command( "patchFitTexture" ); + + Scene_PatchTileTexture_Selected( GlobalSceneGraph(), 1, 1 ); +} #include "ifilter.h" @@ -661,10 +678,6 @@ void PatchPreferences_construct(){ 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( "IncPatchColumn", FreeCaller(), Accelerator( GDK_KP_Add, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); - GlobalCommands_insert( "IncPatchRow", FreeCaller(), Accelerator( GDK_KP_Add, (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "DecPatchColumn", FreeCaller(), Accelerator( GDK_KP_Subtract, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); - GlobalCommands_insert( "DecPatchRow", FreeCaller(), Accelerator( GDK_KP_Subtract, (GdkModifierType)GDK_CONTROL_MASK ) ); GlobalCommands_insert( "NaturalizePatch", FreeCaller(), Accelerator( 'N', (GdkModifierType)GDK_CONTROL_MASK ) ); GlobalCommands_insert( "PatchCylinder", FreeCaller() ); GlobalCommands_insert( "PatchDenseCylinder", FreeCaller() ); @@ -680,13 +693,13 @@ void Patch_registerCommands(){ GlobalCommands_insert( "PatchCone", FreeCaller() ); GlobalCommands_insert( "PatchSphere", FreeCaller() ); GlobalCommands_insert( "SimplePatchMesh", FreeCaller(), Accelerator( 'P', (GdkModifierType)GDK_SHIFT_MASK ) ); - GlobalCommands_insert( "PatchInsertInsertColumn", FreeCaller() ); + GlobalCommands_insert( "PatchInsertInsertColumn", FreeCaller(), Accelerator( GDK_KP_Add, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); GlobalCommands_insert( "PatchInsertAddColumn", FreeCaller() ); - GlobalCommands_insert( "PatchInsertInsertRow", FreeCaller() ); + GlobalCommands_insert( "PatchInsertInsertRow", FreeCaller(), Accelerator( GDK_KP_Add, (GdkModifierType)GDK_CONTROL_MASK ) ); GlobalCommands_insert( "PatchInsertAddRow", FreeCaller() ); GlobalCommands_insert( "PatchDeleteFirstColumn", FreeCaller() ); - GlobalCommands_insert( "PatchDeleteLastColumn", FreeCaller() ); - GlobalCommands_insert( "PatchDeleteFirstRow", FreeCaller() ); + GlobalCommands_insert( "PatchDeleteLastColumn", FreeCaller(), Accelerator( GDK_KP_Subtract, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); + GlobalCommands_insert( "PatchDeleteFirstRow", FreeCaller(), Accelerator( GDK_KP_Subtract, (GdkModifierType)GDK_CONTROL_MASK ) ); GlobalCommands_insert( "PatchDeleteLastRow", FreeCaller() ); GlobalCommands_insert( "InvertCurve", FreeCaller(), Accelerator( 'I', (GdkModifierType)GDK_CONTROL_MASK ) ); GlobalCommands_insert( "RedisperseRows", FreeCaller(), Accelerator( 'E', (GdkModifierType)GDK_CONTROL_MASK ) ); @@ -791,6 +804,16 @@ void Patch_constructMenu( GtkMenu* menu ){ create_menu_item_with_mnemonic( menu_in_menu, "Set", "MakeOverlayPatch" ); create_menu_item_with_mnemonic( menu_in_menu, "Clear", "ClearPatchOverlays" ); } + menu_separator( menu ); + { + GtkMenu* 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, "Flip Horizontally", "InvertCurveTextureX" ); + create_menu_item_with_mnemonic( menu_in_menu, "Flip Vertically", "InvertCurveTextureY" ); + create_menu_item_with_mnemonic( menu_in_menu, "Naturalize", "NaturalizePatch" ); + } } diff --git a/radiant/patchmanip.h b/radiant/patchmanip.h index 4666ae73..c6646898 100644 --- a/radiant/patchmanip.h +++ b/radiant/patchmanip.h @@ -51,6 +51,11 @@ void PatchPreferences_construct(); void Patch_registerPreferencesPage(); +void Patch_NaturalTexture(); +void Patch_CapTexture(); +void Patch_ResetTexture(); +void Patch_FitTexture(); + class PatchCreator; extern PatchCreator* g_patchCreator; diff --git a/radiant/surfacedialog.cpp b/radiant/surfacedialog.cpp index ac02d7fd..73312a07 100644 --- a/radiant/surfacedialog.cpp +++ b/radiant/surfacedialog.cpp @@ -442,23 +442,19 @@ void SurfaceInspector_FitTexture(){ } static void OnBtnPatchdetails( GtkWidget *widget, gpointer data ){ - Scene_PatchCapTexture_Selected( GlobalSceneGraph() ); + Patch_CapTexture(); } static void OnBtnPatchnatural( GtkWidget *widget, gpointer data ){ - Scene_PatchNaturalTexture_Selected( GlobalSceneGraph() ); + Patch_NaturalTexture(); } static void OnBtnPatchreset( GtkWidget *widget, gpointer data ){ - float fx, fy; - - if ( DoTextureLayout( &fx, &fy ) == eIDOK ) { - Scene_PatchTileTexture_Selected( GlobalSceneGraph(), fx, fy ); - } + Patch_ResetTexture(); } static void OnBtnPatchFit( GtkWidget *widget, gpointer data ){ - Scene_PatchTileTexture_Selected( GlobalSceneGraph(), 1, 1 ); + Patch_FitTexture(); } static void OnBtnAxial( GtkWidget *widget, gpointer data ){