]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
Clean up and fix actions, menus and dialogs for patch meshes
authorMattia Basaglia <mattia.basaglia@gmail.com>
Sun, 19 Jul 2015 07:05:59 +0000 (09:05 +0200)
committerMattia Basaglia <mattia.basaglia@gmail.com>
Sun, 19 Jul 2015 07:05:59 +0000 (09:05 +0200)
radiant/mainframe.cpp
radiant/patchdialog.cpp
radiant/patchmanip.cpp
radiant/patchmanip.h
radiant/surfacedialog.cpp

index abb12ef658711518d79e1cd444b59dbdc337ac56..95dba53b4d35cb4b44aed6ce5f6ff9e61c2a21c1 100644 (file)
@@ -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");
 }
index daa79f65e5337bb8ec6850345f8777ae44a53867..db3c4ebb9d7192c2011fae73f51c2456e6e4885b 100644 (file)
@@ -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
index d5471e98313b49a89f9735313759c9446043f411..e8d75fe5a0bc1e2d63fd016a27f25f7efe7a6a67 100644 (file)
@@ -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<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( "IncPatchColumn", FreeCaller<Patch_InsertInsertColumn>(), Accelerator( GDK_KP_Add, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
-       GlobalCommands_insert( "IncPatchRow", FreeCaller<Patch_InsertInsertRow>(), Accelerator( GDK_KP_Add, (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "DecPatchColumn", FreeCaller<Patch_DeleteLastColumn>(), Accelerator( GDK_KP_Subtract, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
-       GlobalCommands_insert( "DecPatchRow", FreeCaller<Patch_DeleteLastRow>(), Accelerator( GDK_KP_Subtract, (GdkModifierType)GDK_CONTROL_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>() );
@@ -680,13 +693,13 @@ void Patch_registerCommands(){
        GlobalCommands_insert( "PatchCone", FreeCaller<Patch_Cone>() );
        GlobalCommands_insert( "PatchSphere", FreeCaller<Patch_Sphere>() );
        GlobalCommands_insert( "SimplePatchMesh", FreeCaller<Patch_Plane>(), Accelerator( 'P', (GdkModifierType)GDK_SHIFT_MASK ) );
-       GlobalCommands_insert( "PatchInsertInsertColumn", FreeCaller<Patch_InsertInsertColumn>() );
+       GlobalCommands_insert( "PatchInsertInsertColumn", FreeCaller<Patch_InsertInsertColumn>(), Accelerator( GDK_KP_Add, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
        GlobalCommands_insert( "PatchInsertAddColumn", FreeCaller<Patch_InsertAddColumn>() );
-       GlobalCommands_insert( "PatchInsertInsertRow", FreeCaller<Patch_InsertInsertRow>() );
+       GlobalCommands_insert( "PatchInsertInsertRow", FreeCaller<Patch_InsertInsertRow>(), Accelerator( GDK_KP_Add, (GdkModifierType)GDK_CONTROL_MASK ) );
        GlobalCommands_insert( "PatchInsertAddRow", FreeCaller<Patch_InsertAddRow>() );
        GlobalCommands_insert( "PatchDeleteFirstColumn", FreeCaller<Patch_DeleteFirstColumn>() );
-       GlobalCommands_insert( "PatchDeleteLastColumn", FreeCaller<Patch_DeleteLastColumn>() );
-       GlobalCommands_insert( "PatchDeleteFirstRow", FreeCaller<Patch_DeleteFirstRow>() );
+       GlobalCommands_insert( "PatchDeleteLastColumn", FreeCaller<Patch_DeleteLastColumn>(), Accelerator( GDK_KP_Subtract, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+       GlobalCommands_insert( "PatchDeleteFirstRow", FreeCaller<Patch_DeleteFirstRow>(), Accelerator( GDK_KP_Subtract, (GdkModifierType)GDK_CONTROL_MASK ) );
        GlobalCommands_insert( "PatchDeleteLastRow", FreeCaller<Patch_DeleteLastRow>() );
        GlobalCommands_insert( "InvertCurve", FreeCaller<Patch_Invert>(), Accelerator( 'I', (GdkModifierType)GDK_CONTROL_MASK ) );
        GlobalCommands_insert( "RedisperseRows", FreeCaller<Patch_RedisperseRows>(), Accelerator( 'E', (GdkModifierType)GDK_CONTROL_MASK ) );
@@ -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" );
+       }
 }
 
 
index 4666ae73494a585c802afa8568360fa6e3cffeed..c6646898e3c0b85ac69b5ffc6fab4bfa8589f7ea 100644 (file)
@@ -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;
 
index ac02d7fd89136301e56f7afaccf41319eed11cd6..73312a078fba5435b28649a9680e03ea31efe045 100644 (file)
@@ -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 ){