[gimp] app: add absolute actions to the display rotation



commit c344a0950e58b04a198236ca1051b7862e695740
Author: Simon Budig <simon budig de>
Date:   Sun May 17 03:18:13 2015 +0200

    app: add absolute actions to the display rotation

 app/actions/view-actions.c  |   27 ++++++++++++++++++++-------
 app/actions/view-commands.c |   14 +++++++++++---
 app/actions/view-commands.h |    3 ++-
 3 files changed, 33 insertions(+), 11 deletions(-)
---
diff --git a/app/actions/view-actions.c b/app/actions/view-actions.c
index 512a344..06bfcd5 100644
--- a/app/actions/view-actions.c
+++ b/app/actions/view-actions.c
@@ -104,16 +104,10 @@ static const GimpActionEntry view_actions[] =
     G_CALLBACK (view_zoom_revert_cmd_callback),
     GIMP_HELP_VIEW_ZOOM_REVERT },
 
-  { "view-rotate-reset", GIMP_STOCK_RESET,
-    NC_("view-action", "_Reset to 0°"), "exclam",
-    NC_("view-action", "Reset the angle of rotation to 0°"),
-    G_CALLBACK (view_rotate_reset_cmd_callback),
-    GIMP_HELP_VIEW_ROTATE_RESET },
-
   { "view-rotate-other", NULL,
     NC_("view-action", "Othe_r..."), NULL,
     NC_("view-action", "Set a custom rotation angle"),
-     G_CALLBACK (view_rotate_other_cmd_callback),
+    G_CALLBACK (view_rotate_other_cmd_callback),
     GIMP_HELP_VIEW_ROTATE_OTHER },
 
   { "view-navigation-window", GIMP_STOCK_NAVIGATION,
@@ -394,6 +388,20 @@ static const GimpRadioActionEntry view_zoom_explicit_actions[] =
     GIMP_HELP_VIEW_ZOOM_OTHER }
 };
 
+static const GimpEnumActionEntry view_rotate_absolute_actions[] =
+{
+  { "view-rotate-set-absolute", NULL,
+    "Display Rotation Absolute Angle Set", NULL, NULL,
+    GIMP_ACTION_SELECT_SET, TRUE,
+    NULL },
+
+  { "view-rotate-reset", GIMP_STOCK_RESET,
+    NC_("view-action", "_Reset to 0°"), "exclam",
+    NC_("view-action", "Reset the angle of rotation to 0°"),
+    GIMP_ACTION_SELECT_SET_TO_DEFAULT, FALSE,
+    GIMP_HELP_VIEW_ROTATE_RESET },
+};
+
 static const GimpEnumActionEntry view_rotate_relative_actions[] =
 {
   { "view-rotate-15", GIMP_STOCK_ROTATE_90,
@@ -564,6 +572,11 @@ view_actions_setup (GimpActionGroup *group)
                                        G_CALLBACK (view_zoom_explicit_cmd_callback));
 
   gimp_action_group_add_enum_actions (group, "view-action",
+                                      view_rotate_absolute_actions,
+                                      G_N_ELEMENTS (view_rotate_absolute_actions),
+                                      G_CALLBACK (view_rotate_absolute_cmd_callback));
+
+  gimp_action_group_add_enum_actions (group, "view-action",
                                       view_rotate_relative_actions,
                                       G_N_ELEMENTS (view_rotate_relative_actions),
                                       G_CALLBACK (view_rotate_relative_cmd_callback));
diff --git a/app/actions/view-commands.c b/app/actions/view-commands.c
index 4dc790e..921cdfd 100644
--- a/app/actions/view-commands.c
+++ b/app/actions/view-commands.c
@@ -287,16 +287,24 @@ view_dot_for_dot_cmd_callback (GtkAction *action,
 }
 
 void
-view_rotate_reset_cmd_callback (GtkAction *action,
-                                gpointer   data)
+view_rotate_absolute_cmd_callback (GtkAction *action,
+                                   gint       value,
+                                   gpointer   data)
 {
   GimpDisplay      *display;
   GimpDisplayShell *shell;
+  gdouble           angle = 0.0;
   return_if_no_display (display, data);
 
   shell = gimp_display_get_shell (display);
 
-  gimp_display_shell_rotate_to (shell, 0.0);
+  angle = action_select_value ((GimpActionSelectType) value,
+                               0.0,
+                               -180.0, 180.0, 0.0,
+                               1.0, 15.0, 90.0, 0.0,
+                               TRUE);
+
+  gimp_display_shell_rotate_to (shell, angle);
 }
 
 void
diff --git a/app/actions/view-commands.h b/app/actions/view-commands.h
index c426dc8..b58b28e 100644
--- a/app/actions/view-commands.h
+++ b/app/actions/view-commands.h
@@ -48,7 +48,8 @@ void   view_scroll_vertical_cmd_callback       (GtkAction *action,
                                                 gint       value,
                                                 gpointer   data);
 
-void   view_rotate_reset_cmd_callback          (GtkAction *action,
+void   view_rotate_absolute_cmd_callback       (GtkAction *action,
+                                                gint       value,
                                                 gpointer   data);
 void   view_rotate_relative_cmd_callback       (GtkAction *action,
                                                 gint       value,


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