app: more actions for display rotation
This commit is contained in:
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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"
|
||||
|
@ -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" />
|
||||
|
Reference in New Issue
Block a user