app: add gimp_display_shell_get_canvas_pickable()

... which is similar to gimp_display_shell_get_pickable(), however,
it returns the projection, rather than the image, only when
gimp_display_shell_get_infinite_canvas() is TRUE, i.e., when the
shell is in "show all" mode *and* canvas padding is disabled.

(cherry picked from commit 71f42f6675)
This commit is contained in:
Ell
2019-09-19 19:57:16 +03:00
parent fd631a37c2
commit b67efd4b6c
2 changed files with 22 additions and 0 deletions

View File

@ -1873,6 +1873,26 @@ gimp_display_shell_get_pickable (GimpDisplayShell *shell)
return NULL;
}
GimpPickable *
gimp_display_shell_get_canvas_pickable (GimpDisplayShell *shell)
{
GimpImage *image;
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
image = gimp_display_get_image (shell->display);
if (image)
{
if (! gimp_display_shell_get_infinite_canvas (shell))
return GIMP_PICKABLE (image);
else
return GIMP_PICKABLE (gimp_image_get_projection (image));
}
return NULL;
}
GeglRectangle
gimp_display_shell_get_bounding_box (GimpDisplayShell *shell)
{

View File

@ -310,6 +310,8 @@ void gimp_display_shell_set_show_all (GimpDisplayShell *shell,
gboolean show_all);
GimpPickable * gimp_display_shell_get_pickable (GimpDisplayShell *shell);
GimpPickable * gimp_display_shell_get_canvas_pickable
(GimpDisplayShell *shell);
GeglRectangle gimp_display_shell_get_bounding_box
(GimpDisplayShell *shell);
gboolean gimp_display_shell_get_infinite_canvas