[gimp] Issue #1168 - Allow resetting rotation view and flip view separately.



commit 15fb4a7be098366b14fce9b113c7fc4f1b557722
Author: Jehan <jehan girinstud io>
Date:   Fri Aug 11 22:37:36 2017 +0200

    Issue #1168 - Allow resetting rotation view and flip view separately.
    
    Action "view-rotate-reset" renamed to "view-reset" (resets both flipping
    and rotate). New "view-rotate-reset" and "view-flip-rotate" for
    resetting rotation and flipping respectively.

 app/actions/view-actions.c  | 21 +++++++++++++++++++--
 app/actions/view-commands.c | 32 +++++++++++++++++++++++++++++---
 app/actions/view-commands.h |  7 +++++++
 app/widgets/gimphelp-ids.h  |  2 ++
 menus/image-menu.xml.in     |  2 +-
 5 files changed, 58 insertions(+), 6 deletions(-)
---
diff --git a/app/actions/view-actions.c b/app/actions/view-actions.c
index cca55e64b5..363707b4ad 100644
--- a/app/actions/view-actions.c
+++ b/app/actions/view-actions.c
@@ -132,6 +132,20 @@ static const GimpActionEntry view_actions[] =
     view_rotate_other_cmd_callback,
     GIMP_HELP_VIEW_ROTATE_OTHER },
 
+  { "view-flip-reset", GIMP_ICON_RESET,
+    NC_("view-action", "_Reset Flipping"), NULL,
+    NC_("view-action",
+        "Reset flipping to unflipped"),
+    view_flip_reset_cmd_callback,
+    GIMP_HELP_VIEW_FLIP_RESET },
+
+  { "view-reset", GIMP_ICON_RESET,
+    NC_("view-action", "_Reset Flip & Rotate"), "exclam",
+    NC_("view-action",
+        "Reset flipping to unflipped and the angle of rotation to 0°"),
+    view_reset_cmd_callback,
+    GIMP_HELP_VIEW_RESET },
+
   { "view-navigation-window", GIMP_ICON_DIALOG_NAVIGATION,
     NC_("view-action", "Na_vigation Window"), NULL,
     NC_("view-action", "Show an overview window for this image"),
@@ -499,9 +513,9 @@ static const GimpEnumActionEntry view_rotate_absolute_actions[] =
     NULL },
 
   { "view-rotate-reset", GIMP_ICON_RESET,
-    NC_("view-action", "_Reset Flip & Rotate"), "exclam",
+    NC_("view-action", "_Reset Rotate"), NULL,
     NC_("view-action",
-        "Reset flipping to unflipped and the angle of rotation to 0°"),
+        "Reset the angle of rotation to 0°"),
     GIMP_ACTION_SELECT_SET_TO_DEFAULT, FALSE,
     GIMP_HELP_VIEW_ROTATE_RESET },
 };
@@ -985,6 +999,7 @@ view_actions_update (GimpActionGroup *group,
   SET_SENSITIVE ("view-flip-horizontally", image);
   SET_ACTIVE    ("view-flip-horizontally", flip_horizontally);
 
+  SET_SENSITIVE ("view-flip-reset",        image);
   SET_SENSITIVE ("view-flip-vertically",   image);
   SET_ACTIVE    ("view-flip-vertically",   flip_vertically);
 
@@ -996,6 +1011,8 @@ view_actions_update (GimpActionGroup *group,
   SET_SENSITIVE ("view-rotate-270",        image);
   SET_SENSITIVE ("view-rotate-other",      image);
 
+  SET_SENSITIVE ("view-reset",             image);
+
   if (image)
     {
       view_actions_set_zoom (group, shell);
diff --git a/app/actions/view-commands.c b/app/actions/view-commands.c
index 7b606048dc..0f6fdc0b7e 100644
--- a/app/actions/view-commands.c
+++ b/app/actions/view-commands.c
@@ -409,6 +409,20 @@ view_flip_vertically_cmd_callback (GimpAction *action,
     }
 }
 
+void
+view_flip_reset_cmd_callback (GimpAction *action,
+                              GVariant   *value,
+                              gpointer    data)
+{
+  GimpDisplay      *display;
+  GimpDisplayShell *shell;
+
+  return_if_no_display (display, data);
+
+  shell = gimp_display_get_shell (display);
+  gimp_display_shell_flip (shell, FALSE, FALSE);
+}
+
 void
 view_rotate_absolute_cmd_callback (GimpAction *action,
                                    GVariant   *value,
@@ -431,9 +445,6 @@ view_rotate_absolute_cmd_callback (GimpAction *action,
                                TRUE);
 
   gimp_display_shell_rotate_to (shell, angle);
-
-  if (select_type == GIMP_ACTION_SELECT_SET_TO_DEFAULT)
-    gimp_display_shell_flip (shell, FALSE, FALSE);
 }
 
 void
@@ -474,6 +485,21 @@ view_rotate_other_cmd_callback (GimpAction *action,
   gimp_display_shell_rotate_dialog (shell);
 }
 
+void
+view_reset_cmd_callback (GimpAction *action,
+                         GVariant   *value,
+                         gpointer    data)
+{
+  GimpDisplay      *display;
+  GimpDisplayShell *shell;
+
+  return_if_no_display (display, data);
+
+  shell = gimp_display_get_shell (display);
+  gimp_display_shell_rotate_to (shell, 0.0);
+  gimp_display_shell_flip (shell, FALSE, FALSE);
+}
+
 void
 view_scroll_horizontal_cmd_callback (GimpAction *action,
                                      GVariant   *value,
diff --git a/app/actions/view-commands.h b/app/actions/view-commands.h
index 17b15b2ece..b1c8d36679 100644
--- a/app/actions/view-commands.h
+++ b/app/actions/view-commands.h
@@ -74,6 +74,9 @@ void   view_flip_horizontally_cmd_callback          (GimpAction *action,
 void   view_flip_vertically_cmd_callback            (GimpAction *action,
                                                      GVariant   *value,
                                                      gpointer    data);
+void   view_flip_reset_cmd_callback                 (GimpAction *action,
+                                                     GVariant   *value,
+                                                     gpointer    data);
 
 void   view_rotate_absolute_cmd_callback            (GimpAction *action,
                                                      GVariant   *value,
@@ -85,6 +88,10 @@ void   view_rotate_other_cmd_callback               (GimpAction *action,
                                                      GVariant   *value,
                                                      gpointer    data);
 
+void   view_reset_cmd_callback                      (GimpAction *action,
+                                                     GVariant   *value,
+                                                     gpointer    data);
+
 void   view_navigation_window_cmd_callback          (GimpAction *action,
                                                      GVariant   *value,
                                                      gpointer    data);
diff --git a/app/widgets/gimphelp-ids.h b/app/widgets/gimphelp-ids.h
index 42fb8c73e6..96b8c1fe0c 100644
--- a/app/widgets/gimphelp-ids.h
+++ b/app/widgets/gimphelp-ids.h
@@ -85,6 +85,7 @@
 #define GIMP_HELP_VIEW_NEW                        "gimp-view-new"
 #define GIMP_HELP_VIEW_SHOW_ALL                   "gimp-view-show-all"
 #define GIMP_HELP_VIEW_DOT_FOR_DOT                "gimp-view-dot-for-dot"
+#define GIMP_HELP_VIEW_RESET                      "gimp-view-reset"
 #define GIMP_HELP_VIEW_SCROLL_CENTER              "gimp-view-scroll-center"
 #define GIMP_HELP_VIEW_ZOOM_REVERT                "gimp-view-zoom-revert"
 #define GIMP_HELP_VIEW_ZOOM_OUT                   "gimp-view-zoom-out"
@@ -95,6 +96,7 @@
 #define GIMP_HELP_VIEW_ZOOM_SELECTION             "gimp-view-zoom-selection"
 #define GIMP_HELP_VIEW_ZOOM_OTHER                 "gimp-view-zoom-other"
 #define GIMP_HELP_VIEW_FLIP                       "gimp-view-flip"
+#define GIMP_HELP_VIEW_FLIP_RESET                 "gimp-view-flip-reset"
 #define GIMP_HELP_VIEW_ROTATE_RESET               "gimp-view-rotate-reset"
 #define GIMP_HELP_VIEW_ROTATE_15                  "gimp-view-rotate-15"
 #define GIMP_HELP_VIEW_ROTATE_90                  "gimp-view-rotate-90"
diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in
index 4bc5a5d516..785ef2d305 100644
--- a/menus/image-menu.xml.in
+++ b/menus/image-menu.xml.in
@@ -284,7 +284,7 @@
         <menuitem action="view-zoom-other" />
       </menu>
       <menu action="view-rotate-menu" name="Rotate">
-        <menuitem action="view-rotate-reset" />
+        <menuitem action="view-reset" />
         <separator />
        <menuitem action="view-flip-horizontally" />
        <menuitem action="view-flip-vertically" />


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]