Commit 2439ae3a authored by Michael Natterer's avatar Michael Natterer 😴

app: add new action "view-scroll-center" with shortcut Shift+J

The zoom focus discussion on IRC suggests that everybody is annoyed
about centering behavior (or lack thereof), so here is a way to
explicitly center the image witout zooming.
parent c6f07f5d
......@@ -46,6 +46,8 @@ Usability:
- Improve mouse wheel zooming behavior to keep the same point
centered under the pointer even if the image is completely visible
in the canvas.
- Add "View -> Center Image in Window" (Shift+J) as a quick way to
center the image at any zoom level.
Translations:
......
......@@ -97,6 +97,12 @@ static const GimpActionEntry view_actions[] =
G_CALLBACK (view_close_cmd_callback),
GIMP_HELP_FILE_CLOSE },
{ "view-scroll-center", GIMP_ICON_CENTER,
NC_("view-action", "Center Image in Window"), "<shift>J",
NC_("view-action", "Scroll the image so that it is centered in the window"),
G_CALLBACK (view_scroll_center_cmd_callback),
GIMP_HELP_VIEW_SCROLL_CENTER },
{ "view-zoom-fit-in", GIMP_ICON_ZOOM_FIT_BEST,
NC_("view-action", "_Fit Image in Window"), "<primary><shift>J",
NC_("view-action", "Adjust the zoom ratio so that the image becomes fully visible"),
......@@ -897,6 +903,8 @@ view_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("view-dot-for-dot", image);
SET_ACTIVE ("view-dot-for-dot", display && shell->dot_for_dot);
SET_SENSITIVE ("view-scroll-center", image);
SET_SENSITIVE ("view-zoom-revert", revert_enabled);
if (revert_enabled)
{
......
......@@ -125,6 +125,17 @@ view_close_cmd_callback (GtkAction *action,
gimp_display_shell_close (shell, FALSE);
}
void
view_scroll_center_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *display;
return_if_no_display (display, data);
gimp_display_shell_scroll_center_image (gimp_display_get_shell (display),
TRUE, TRUE);
}
void
view_zoom_fit_in_cmd_callback (GtkAction *action,
gpointer data)
......
......@@ -24,6 +24,9 @@ void view_new_cmd_callback (GtkAction *action,
void view_close_cmd_callback (GtkAction *action,
gpointer data);
void view_scroll_center_cmd_callback (GtkAction *action,
gpointer data);
void view_zoom_fit_in_cmd_callback (GtkAction *action,
gpointer data);
void view_zoom_fill_cmd_callback (GtkAction *action,
......
......@@ -85,6 +85,7 @@
#define GIMP_HELP_VIEW_NEW "gimp-view-new"
#define GIMP_HELP_VIEW_DOT_FOR_DOT "gimp-view-dot-for-dot"
#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"
#define GIMP_HELP_VIEW_ZOOM_IN "gimp-view-zoom-in"
......
......@@ -294,6 +294,7 @@
<separator />
<menuitem action="view-rotate-other" />
</menu>
<menuitem action="view-scroll-center" />
<separator />
<menuitem action="view-shrink-wrap" />
<menuitem action="view-fullscreen" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment