Bug 560903 – Explicit zooming with e.g. '1' should handle
zoom-focus better * app/display/display-enums.h: Added GIMP_ZOOM_FOCUS_RETAIN_CENTERING_ELSE_BEST_GUESS. * app/display/gimpdisplayshell-scale.c (gimp_display_shell_scale_get_zoom_focus): Take the new enum into account; if the image is centered, keep it centered, else use the best-guess method. * app/actions/view-commands.c (view_zoom_explicit_cmd_callback): Use the new enum for explicit zooming. * app/display/display-enums.c: Regenerated. svn path=/trunk/; revision=27653
This commit is contained in:
18
ChangeLog
18
ChangeLog
@ -1,3 +1,21 @@
|
|||||||
|
2008-11-15 Martin Nordholts <martinn@svn.gnome.org>
|
||||||
|
|
||||||
|
Bug 560903 – Explicit zooming with e.g. '1' should handle
|
||||||
|
zoom-focus better
|
||||||
|
|
||||||
|
* app/display/display-enums.h: Added
|
||||||
|
GIMP_ZOOM_FOCUS_RETAIN_CENTERING_ELSE_BEST_GUESS.
|
||||||
|
|
||||||
|
* app/display/gimpdisplayshell-scale.c
|
||||||
|
(gimp_display_shell_scale_get_zoom_focus): Take the new enum into
|
||||||
|
account; if the image is centered, keep it centered, else use the
|
||||||
|
best-guess method.
|
||||||
|
|
||||||
|
* app/actions/view-commands.c (view_zoom_explicit_cmd_callback):
|
||||||
|
Use the new enum for explicit zooming.
|
||||||
|
|
||||||
|
* app/display/display-enums.c: Regenerated.
|
||||||
|
|
||||||
2008-11-15 Martin Nordholts <martinn@svn.gnome.org>
|
2008-11-15 Martin Nordholts <martinn@svn.gnome.org>
|
||||||
|
|
||||||
Bug 560245 – Zoom selection always centered in the Navigation tab
|
Bug 560245 – Zoom selection always centered in the Navigation tab
|
||||||
|
@ -220,7 +220,7 @@ view_zoom_explicit_cmd_callback (GtkAction *action,
|
|||||||
gimp_display_shell_scale (shell,
|
gimp_display_shell_scale (shell,
|
||||||
GIMP_ZOOM_TO,
|
GIMP_ZOOM_TO,
|
||||||
(gdouble) value / 10000,
|
(gdouble) value / 10000,
|
||||||
GIMP_ZOOM_FOCUS_IMAGE_CENTER);
|
GIMP_ZOOM_FOCUS_RETAIN_CENTERING_ELSE_BEST_GUESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,6 +171,7 @@ gimp_zoom_focus_get_type (void)
|
|||||||
{ GIMP_ZOOM_FOCUS_BEST_GUESS, "GIMP_ZOOM_FOCUS_BEST_GUESS", "best-guess" },
|
{ GIMP_ZOOM_FOCUS_BEST_GUESS, "GIMP_ZOOM_FOCUS_BEST_GUESS", "best-guess" },
|
||||||
{ GIMP_ZOOM_FOCUS_POINTER, "GIMP_ZOOM_FOCUS_POINTER", "pointer" },
|
{ GIMP_ZOOM_FOCUS_POINTER, "GIMP_ZOOM_FOCUS_POINTER", "pointer" },
|
||||||
{ GIMP_ZOOM_FOCUS_IMAGE_CENTER, "GIMP_ZOOM_FOCUS_IMAGE_CENTER", "image-center" },
|
{ GIMP_ZOOM_FOCUS_IMAGE_CENTER, "GIMP_ZOOM_FOCUS_IMAGE_CENTER", "image-center" },
|
||||||
|
{ GIMP_ZOOM_FOCUS_RETAIN_CENTERING_ELSE_BEST_GUESS, "GIMP_ZOOM_FOCUS_RETAIN_CENTERING_ELSE_BEST_GUESS", "retain-centering-else-best-guess" },
|
||||||
{ 0, NULL, NULL }
|
{ 0, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -179,6 +180,7 @@ gimp_zoom_focus_get_type (void)
|
|||||||
{ GIMP_ZOOM_FOCUS_BEST_GUESS, "GIMP_ZOOM_FOCUS_BEST_GUESS", NULL },
|
{ GIMP_ZOOM_FOCUS_BEST_GUESS, "GIMP_ZOOM_FOCUS_BEST_GUESS", NULL },
|
||||||
{ GIMP_ZOOM_FOCUS_POINTER, "GIMP_ZOOM_FOCUS_POINTER", NULL },
|
{ GIMP_ZOOM_FOCUS_POINTER, "GIMP_ZOOM_FOCUS_POINTER", NULL },
|
||||||
{ GIMP_ZOOM_FOCUS_IMAGE_CENTER, "GIMP_ZOOM_FOCUS_IMAGE_CENTER", NULL },
|
{ GIMP_ZOOM_FOCUS_IMAGE_CENTER, "GIMP_ZOOM_FOCUS_IMAGE_CENTER", NULL },
|
||||||
|
{ GIMP_ZOOM_FOCUS_RETAIN_CENTERING_ELSE_BEST_GUESS, "GIMP_ZOOM_FOCUS_RETAIN_CENTERING_ELSE_BEST_GUESS", NULL },
|
||||||
{ 0, NULL, NULL }
|
{ 0, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -87,9 +87,20 @@ GType gimp_zoom_focus_get_type (void) G_GNUC_CONST;
|
|||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
GIMP_ZOOM_FOCUS_BEST_GUESS, /* Make a best guess */
|
/* Make a best guess */
|
||||||
GIMP_ZOOM_FOCUS_POINTER, /* Use the mouse cursor (if within canvas) */
|
GIMP_ZOOM_FOCUS_BEST_GUESS,
|
||||||
GIMP_ZOOM_FOCUS_IMAGE_CENTER /* Use the image center */
|
|
||||||
|
/* Use the mouse cursor (if within canvas) */
|
||||||
|
GIMP_ZOOM_FOCUS_POINTER,
|
||||||
|
|
||||||
|
/* Use the image center */
|
||||||
|
GIMP_ZOOM_FOCUS_IMAGE_CENTER,
|
||||||
|
|
||||||
|
/* If the image is centered, retain the centering. Else use
|
||||||
|
* _BEST_GUESS
|
||||||
|
*/
|
||||||
|
GIMP_ZOOM_FOCUS_RETAIN_CENTERING_ELSE_BEST_GUESS
|
||||||
|
|
||||||
} GimpZoomFocus;
|
} GimpZoomFocus;
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ static gboolean gimp_display_shell_scale_image_starts_to_fit
|
|||||||
gdouble current_scale,
|
gdouble current_scale,
|
||||||
gboolean *vertically,
|
gboolean *vertically,
|
||||||
gboolean *horizontally);
|
gboolean *horizontally);
|
||||||
static void gimp_display_shell_scale_viewport_coord_almost_centered
|
static gboolean gimp_display_shell_scale_viewport_coord_almost_centered
|
||||||
(GimpDisplayShell *shell,
|
(GimpDisplayShell *shell,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
@ -887,21 +887,28 @@ gimp_display_shell_scale_image_stops_to_fit (GimpDisplayShell *shell,
|
|||||||
* @vertically:
|
* @vertically:
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
static void
|
static gboolean
|
||||||
gimp_display_shell_scale_viewport_coord_almost_centered (GimpDisplayShell *shell,
|
gimp_display_shell_scale_viewport_coord_almost_centered (GimpDisplayShell *shell,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
gboolean *horizontally,
|
gboolean *horizontally,
|
||||||
gboolean *vertically)
|
gboolean *vertically)
|
||||||
{
|
{
|
||||||
|
gboolean local_horizontally;
|
||||||
|
gboolean local_vertically;
|
||||||
gint center_x = shell->disp_width / 2;
|
gint center_x = shell->disp_width / 2;
|
||||||
gint center_y = shell->disp_height / 2;
|
gint center_y = shell->disp_height / 2;
|
||||||
|
|
||||||
*horizontally = x > center_x - ALMOST_CENTERED_THRESHOLD &&
|
local_horizontally = (x > center_x - ALMOST_CENTERED_THRESHOLD &&
|
||||||
x < center_x + ALMOST_CENTERED_THRESHOLD;
|
x < center_x + ALMOST_CENTERED_THRESHOLD);
|
||||||
|
|
||||||
*vertically = y > center_y - ALMOST_CENTERED_THRESHOLD &&
|
local_vertically = (y > center_y - ALMOST_CENTERED_THRESHOLD &&
|
||||||
y < center_y + ALMOST_CENTERED_THRESHOLD;
|
y < center_y + ALMOST_CENTERED_THRESHOLD);
|
||||||
|
|
||||||
|
if (horizontally) *horizontally = local_horizontally;
|
||||||
|
if (vertically) *vertically = local_vertically;
|
||||||
|
|
||||||
|
return local_horizontally && local_vertically;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -937,6 +944,7 @@ gimp_display_shell_scale_get_zoom_focus (GimpDisplayShell *shell,
|
|||||||
gint *y,
|
gint *y,
|
||||||
GimpZoomFocus zoom_focus)
|
GimpZoomFocus zoom_focus)
|
||||||
{
|
{
|
||||||
|
GimpZoomFocus real_zoom_focus = zoom_focus;
|
||||||
gint image_center_x, image_center_y;
|
gint image_center_x, image_center_y;
|
||||||
gint other_x, other_y;
|
gint other_x, other_y;
|
||||||
|
|
||||||
@ -995,7 +1003,25 @@ gimp_display_shell_scale_get_zoom_focus (GimpDisplayShell *shell,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Decide which one to use for each axis */
|
/* Decide which one to use for each axis */
|
||||||
switch (zoom_focus)
|
if (zoom_focus == GIMP_ZOOM_FOCUS_RETAIN_CENTERING_ELSE_BEST_GUESS)
|
||||||
|
{
|
||||||
|
gboolean centered;
|
||||||
|
|
||||||
|
centered = gimp_display_shell_scale_viewport_coord_almost_centered (shell,
|
||||||
|
image_center_x,
|
||||||
|
image_center_y,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
real_zoom_focus = (centered ?
|
||||||
|
GIMP_ZOOM_FOCUS_IMAGE_CENTER :
|
||||||
|
GIMP_ZOOM_FOCUS_BEST_GUESS);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
real_zoom_focus = zoom_focus;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (real_zoom_focus)
|
||||||
{
|
{
|
||||||
case GIMP_ZOOM_FOCUS_POINTER:
|
case GIMP_ZOOM_FOCUS_POINTER:
|
||||||
*x = other_x;
|
*x = other_x;
|
||||||
|
Reference in New Issue
Block a user