[gimp] app: more actions for display rotation
- From: Simon Budig <simon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: more actions for display rotation
- Date: Mon, 18 May 2015 23:16:07 +0000 (UTC)
commit 6ce2a2b3ad83e826bc5fbad923b035fc03c546bd
Author: Simon Budig <simon budig de>
Date: Sun May 17 00:48:41 2015 +0200
app: more actions for display rotation
app/actions/view-actions.c | 30 ++++++++++++++++++++++--------
app/actions/view-commands.c | 17 ++++++++---------
app/actions/view-commands.h | 2 +-
app/widgets/gimphelp-ids.h | 2 ++
menus/image-menu.xml.in | 2 ++
5 files changed, 35 insertions(+), 18 deletions(-)
---
diff --git a/app/actions/view-actions.c b/app/actions/view-actions.c
index fe52e32..512a344 100644
--- a/app/actions/view-actions.c
+++ b/app/actions/view-actions.c
@@ -394,25 +394,37 @@ static const GimpRadioActionEntry view_zoom_explicit_actions[] =
GIMP_HELP_VIEW_ZOOM_OTHER }
};
-static const GimpEnumActionEntry view_rotate_actions[] =
+static const GimpEnumActionEntry view_rotate_relative_actions[] =
{
+ { "view-rotate-15", GIMP_STOCK_ROTATE_90,
+ NC_("view-action", "Rotate 15° _clockwise"), NULL,
+ NC_("view-action", "Rotate 15 degrees to the right"),
+ GIMP_ACTION_SELECT_NEXT, FALSE,
+ GIMP_HELP_VIEW_ROTATE_15 },
+
{ "view-rotate-90", GIMP_STOCK_ROTATE_90,
NC_("view-action", "Rotate 90° _clockwise"), NULL,
NC_("view-action", "Rotate 90 degrees to the right"),
- GIMP_ROTATE_90, FALSE,
+ GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
GIMP_HELP_VIEW_ROTATE_90 },
{ "view-rotate-180", GIMP_STOCK_ROTATE_180,
NC_("view-action", "Rotate _180°"), NULL,
NC_("view-action", "Turn upside-down"),
- GIMP_ROTATE_180, FALSE,
+ GIMP_ACTION_SELECT_LAST, FALSE,
GIMP_HELP_VIEW_ROTATE_180 },
{ "view-rotate-270", GIMP_STOCK_ROTATE_270,
NC_("view-action", "Rotate 90° counter-clock_wise"), NULL,
NC_("view-action", "Rotate 90 degrees to the left"),
- GIMP_ROTATE_270, FALSE,
- GIMP_HELP_VIEW_ROTATE_270 }
+ GIMP_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
+ GIMP_HELP_VIEW_ROTATE_270 },
+
+ { "view-rotate-345", GIMP_STOCK_ROTATE_270,
+ NC_("view-action", "Rotate 15° counter-clock_wise"), NULL,
+ NC_("view-action", "Rotate 15 degrees to the left"),
+ GIMP_ACTION_SELECT_PREVIOUS, FALSE,
+ GIMP_HELP_VIEW_ROTATE_345 }
};
static const GimpEnumActionEntry view_padding_color_actions[] =
@@ -552,9 +564,9 @@ view_actions_setup (GimpActionGroup *group)
G_CALLBACK (view_zoom_explicit_cmd_callback));
gimp_action_group_add_enum_actions (group, "view-action",
- view_rotate_actions,
- G_N_ELEMENTS (view_rotate_actions),
- G_CALLBACK (view_rotate_cmd_callback));
+ view_rotate_relative_actions,
+ G_N_ELEMENTS (view_rotate_relative_actions),
+ G_CALLBACK (view_rotate_relative_cmd_callback));
gimp_action_group_add_enum_actions (group, "view-padding-color",
view_padding_color_actions,
@@ -686,6 +698,8 @@ view_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("view-zoom-other", image);
SET_SENSITIVE ("view-rotate-reset", image);
+ SET_SENSITIVE ("view-rotate-15", image);
+ SET_SENSITIVE ("view-rotate-345", image);
SET_SENSITIVE ("view-rotate-90", image);
SET_SENSITIVE ("view-rotate-180", image);
SET_SENSITIVE ("view-rotate-270", image);
diff --git a/app/actions/view-commands.c b/app/actions/view-commands.c
index 7c5b8eb..4dc790e 100644
--- a/app/actions/view-commands.c
+++ b/app/actions/view-commands.c
@@ -300,9 +300,9 @@ view_rotate_reset_cmd_callback (GtkAction *action,
}
void
-view_rotate_cmd_callback (GtkAction *action,
- gint value,
- gpointer data)
+view_rotate_relative_cmd_callback (GtkAction *action,
+ gint value,
+ gpointer data)
{
GimpDisplay *display;
GimpDisplayShell *shell;
@@ -311,12 +311,11 @@ view_rotate_cmd_callback (GtkAction *action,
shell = gimp_display_get_shell (display);
- switch ((GimpRotationType) value)
- {
- case GIMP_ROTATE_90: delta = 90; break;
- case GIMP_ROTATE_180: delta = 180; break;
- case GIMP_ROTATE_270: delta = -90; break;
- }
+ delta = 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 (shell, delta);
}
diff --git a/app/actions/view-commands.h b/app/actions/view-commands.h
index a207ed3..c426dc8 100644
--- a/app/actions/view-commands.h
+++ b/app/actions/view-commands.h
@@ -50,7 +50,7 @@ void view_scroll_vertical_cmd_callback (GtkAction *action,
void view_rotate_reset_cmd_callback (GtkAction *action,
gpointer data);
-void view_rotate_cmd_callback (GtkAction *action,
+void view_rotate_relative_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void view_rotate_other_cmd_callback (GtkAction *action,
diff --git a/app/widgets/gimphelp-ids.h b/app/widgets/gimphelp-ids.h
index 228ee46..7628e3c 100644
--- a/app/widgets/gimphelp-ids.h
+++ b/app/widgets/gimphelp-ids.h
@@ -88,9 +88,11 @@
#define GIMP_HELP_VIEW_ZOOM_FILL "gimp-view-zoom-fill"
#define GIMP_HELP_VIEW_ZOOM_OTHER "gimp-view-zoom-other"
#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"
#define GIMP_HELP_VIEW_ROTATE_180 "gimp-view-rotate-180"
#define GIMP_HELP_VIEW_ROTATE_270 "gimp-view-rotate-270"
+#define GIMP_HELP_VIEW_ROTATE_345 "gimp-view-rotate-345"
#define GIMP_HELP_VIEW_ROTATE_OTHER "gimp-view-rotate-other"
#define GIMP_HELP_VIEW_SHOW_SELECTION "gimp-view-show-selection"
#define GIMP_HELP_VIEW_SHOW_LAYER_BOUNDARY "gimp-view-show-layer-boundary"
diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in
index 2b46fcb..86e5c8c 100644
--- a/menus/image-menu.xml.in
+++ b/menus/image-menu.xml.in
@@ -276,6 +276,8 @@
<menu action="view-rotate-menu" name="Rotate">
<menuitem action="view-rotate-reset" />
<separator />
+ <menuitem action="view-rotate-15" />
+ <menuitem action="view-rotate-345" />
<menuitem action="view-rotate-90" />
<menuitem action="view-rotate-270" />
<menuitem action="view-rotate-180" />
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]