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
* app/display/gimpdisplayshell-scale.c (gimp_display_shell_scale):
Also take the image center and not only the zoom focus point into
account when deciding whether or not to center the image after
zoom.
svn path=/trunk/; revision=27651
2008-11-14 Sven Neumann <sven@gimp.org>
* app/display/gimpdisplayshell-scroll.[ch]: removed function
gimp_display_shell_scroll_get_scaled_viewport_offset() as it was
only returning -shell->offset_x and -shell->offset_y and it
started to show up in profiles.
* app/display/gimpdisplayshell-draw.c
* app/display/gimpdisplayshell-transform.c
* app/display/gimpdisplayshell-scale.c: use the shell offsets
directly.
svn path=/trunk/; revision=27644
* app/display/gimpdisplayshell-scale.c
(gimp_display_shell_scale_update_rulers): Avoid critical warnings
when converting an image window with a unit other than pixels into
a the empty image window. Probably fixes some of the crashes
reported by Windows users.
svn path=/trunk/; revision=27586
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-callbacks.c: Fix calls to
gimp_display_shell_scaled() when Resize window on zoom is enabled.
svn path=/trunk/; revision=27366
2008-10-09 Michael Natterer <mitch@gimp.org>
Add GEGL_CFLAGS and #includes as if gimpdrawable.h and gimpimage.h
had a GEGL dependency (they will have in the next commit, but I
wanted to keep the commit separate).
* app/dialogs/Makefile.am
* app/file/Makefile.am
* app/gui/Makefile.am
* app/menus/Makefile.am
* app/paint/Makefile.am
* app/plug-in/Makefile.am
* app/text/Makefile.am
* app/vectors/Makefile.am
* app/widgets/Makefile.am
* app/xcf/Makefile.am: add GEGL_CFLAGS.
* app/actions/*.c
* app/core/*.c
* app/dialogs/*.c
* app/display/*.c
* app/file/*.c
* app/gui/*.c
* app/menus/*.c
* app/paint/*.c
* app/pdb/gimppdb-utils.c
* app/pdb/gimpprocedure.c
* app/plug-in/*.c
* app/text/*.c
* app/tools/*.c
* app/vectors/*.c
* app/widgets/*.c
* app/xcf/*.c: add <gegl.h> or replace <glib-object.h> by <gegl.h>
to all files which include a drawable subclass or gimpimage.h
* tools/pdbgen/app.pl: include <gegl.h> instead of <glib-object.h>
in all generated files.
* app/pdb/*-cmds.c: regenerated.
* data/images/gimp-splash.png: the goat is still sleeping.
By Aurore Derriennic.
svn path=/trunk/; revision=27202
2008-10-03 Sven Neumann <sven@gimp.org>
* app/display/gimpdisplayshell-scale.c
(gimp_display_shell_scale_update_scrollbars)
(gimp_display_shell_scale_update_rulers): bail out early if
shell->display is NULL. Fixes crash reported on the
mailing-list.
svn path=/trunk/; revision=27117
to 100%
* app/display/display-enums.h: Added a GimpZoomFocus enum with
'best guess', 'pointer' or 'image center' values.
* app/display/gimpdisplayshell-scale.[ch]
(gimp_display_shell_scale): Take a GimpZoomFocus parameter and
pass it on to
(gimp_display_shell_scale_get_zoom_focus): which returns the
requested zoom focus point if one was given, else makes a best
guess.
* app/actions/view-commands.c
* app/display/gimpstatusbar.c
* app/display/gimpnavigationeditor.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-scale-dialog.c: For explicit-zoom
commands like "zoom to 100%", always use the image center as the
zoom focus point. For all other zooming, continue to use the
best-guess method.
* app/display/display-enums.c: Regenerated.
svn path=/trunk/; revision=27104
2008-08-31 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scale.c
(gimp_display_shell_set_initial_scale): We need to set the scale
before using it. Fixes at least gimp_display_shell_fill() and
Image -> Duplicate giving weird initial scales.
svn path=/trunk/; revision=26823
2008-08-28 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scale.c
(gimp_display_shell_scale_to): Canonically calculate scale to use
for zoom-focus calculations so that it also works when not in Dot
by dot-mode.
svn path=/trunk/; revision=26805
2008-08-16 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scale.c
(gimp_display_shell_scale_viewport_coord_almost_centered): New
function.
(gimp_display_shell_scale): Center the image on zoom also if it is
almost centered. This makes the image centered all the way when
zooming out far away.
svn path=/trunk/; revision=26589
2008-08-15 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scale.c (gimp_display_shell_scale):
More elegantly deal with the 'Resize window on zoom'-case.
svn path=/trunk/; revision=26581
2008-08-14 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scale.c
(gimp_display_shell_scale_image_stops_to_fit): New function.
(gimp_display_shell_scale_get_zoom_focus): If the image stops
to fit the viewport, we can already now use the mouse cursor
as the zoom focus point.
svn path=/trunk/; revision=26563
2008-08-14 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-draw.[ch]
(gimp_display_shell_draw_get_scaled_image_size_for_scale): New
function.
* app/display/gimpdisplayshell-scale.[ch]
(gimp_display_shell_scale): When zooming out and the image
starts to fit the viewport on a given axis, center on that
axis.
(gimp_display_shell_scale_image_starts_to_fit): New function.
(gimp_display_shell_calculate_scale_x_and_y): New function.
* app/display/gimpdisplayshell.c
(gimp_display_shell_scale_changed): Use
gimp_display_shell_calculate_scale_x_and_y().
* app/display/gimpdisplayshell-scroll.c
(gimp_display_shell_scroll_center_image): Bail out if neither
vertical nor horizontal centering is requested.
svn path=/trunk/; revision=26562
2008-08-14 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scale.c
(gimp_display_shell_scale_get_zoom_focus): When the image is
within the viewport, also use the center of the image as the zoom
focus point when zooming it. It feels way too weird not to do it
this way.
svn path=/trunk/; revision=26561
2008-08-14 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scale.c
(gimp_display_shell_scale_get_zoom_focus): If the image is within
the viewport and we are zooming out, make the focus point be the
center of the image.
svn path=/trunk/; revision=26560
2008-08-14 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scale.c
(gimp_display_shell_scale_to): Move calculation of the actual new
scale to use from here
(gimp_display_shell_scale): to here, because we need this
information in order to determine what point to focus on while
zooming.
svn path=/trunk/; revision=26559
2008-08-14 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scale.c
(gimp_display_shell_update_scrollbars_and_rulers): Split this up
in gimp_display_shell_scale_update_scrollbars() and
gimp_display_shell_scale_update_rulers().
svn path=/trunk/; revision=26555
2008-08-13 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scale.c
(gimp_display_shell_scale_get_zoom_focus): New function
responsible for deciding what viewport coordinate to focus on when
zooming in and out.
svn path=/trunk/; revision=26532
2008-08-13 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scale.[ch]
(gimp_display_shell_scale_to): Make this a private function
because we want to be in full control over what pixel to focus on
when zooming in and out.
* app/display/gimpdisplayshell-callbacks.c
(gimp_display_shell_canvas_tool_events): Use
gimp_display_shell_scale() here instead of
gimp_display_shell_scale_to(). We figure out (and can override if
we wish) the coordinates that were previously passed explicitly.
svn path=/trunk/; revision=26531
2008-08-13 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scale.c
(gimp_display_shell_scale_image_is_within_viewport): New function.
* app/display/gimpdisplayshell.c (gimp_display_shell_new): When
the zoom button is toggled, implicitly do a View -> Fit Image in
Window if the (scaled) image is within the viewport.
svn path=/trunk/; revision=26529
2008-08-10 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scale.c
(gimp_display_shell_scale_handle_zoom_revert): Move the
zoom-revert updating logic into this new helper function so that
we can update zoom-revert from other places.
svn path=/trunk/; revision=26485
2008-08-10 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scale.[ch]:
Rename gimp_display_shell_scale_setup() to
gimp_display_shell_update_scrollbars_and_rulers(), because that's
exactly what that function does.
* app/display/gimpdisplayshell.c
* app/display/gimpdisplayshell-scroll.c
* app/display/gimpdisplayshell-handlers.c
* app/display/gimpdisplayshell-callbacks.c: Adapt to new name.
svn path=/trunk/; revision=26484
2008-08-10 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scroll.[ch]: gimp_display_shell_ ->
gimp_display_shell_scroll_ for functions that are scroll
related. Also did some other minor renamings.
* app/display/gimpnavigationeditor.c
* app/display/gimpdisplayshell-draw.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-transform.c
* app/display/gimpdisplayshell-callbacks.c: Adapt to the name
changes.
svn path=/trunk/; revision=26476
2008-08-10 Martin Nordholts <martinn@svn.gnome.org>
Put functions to center the image in the display shell where they
belong, and give them proper names.
* app/display/gimpdisplayshell-scale.[ch]: Get rid of functions
and use the new names.
* app/display/gimpdisplayshell-scroll.[ch]: Put the functions here
and call them gimp_display_shell_scroll_center_image() and
gimp_display_shell_scroll_center_image_on_next_size_allocate().
* app/display/gimpdisplayshell.c:
* app/display/gimpdisplayshell-handlers.c: Use the new names.
svn path=/trunk/; revision=26470
2008-08-06 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scale.c
(gimp_display_shell_center_image): The operation of centering the
image in the display shell has by itself nothing to do with
resizing the display shell window.
svn path=/trunk/; revision=26404
2008-08-05 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scale.c (gimp_display_shell_scale):
Only center on the mouse pointer when zooming if it is within the
canvas.
svn path=/trunk/; revision=26396
2008-08-05 Michael Natterer <mitch@gimp.org>
* app/display/gimpdisplayshell-scroll.[ch]
* app/display/gimpdisplayshell-draw.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-transform.c: get rid of the "image"
part in all instances of "scaled_image_viewport_offset", we call
it simply "viewport" in all other places and it makes the code
more readable.
svn path=/trunk/; revision=26395
2008-08-05 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scale.c
(gimp_display_shell_scale_setup): Don't setup scrollbar step
increment here.
* app/display/gimpdisplayshell-scroll.c
(gimp_display_shell_setup_hscrollbar_with_value)
(gimp_display_shell_setup_vscrollbar_with_value): Setup scrollbar
step increment here and make sure that a step always scrolls at
least a display shell pixel.
svn path=/trunk/; revision=26390
2008-08-03 Martin Nordholts <martinn@svn.gnome.org>
Further work for completing bug #362915 that makes changes to the
image size (e.g when cropping) be much more nicely handled by
display shell.
* app/core/gimpimage.[ch]: Add new signal
GimpImage::size-changed-detailed that is emited whenever
GimpViewable::size-changed is. The new signal provides additional
information, namely the previous origin relative to the current
origin. Cliens choose what specific signal to listen to depending
on how much info they need.
* app/display/gimpdisplayshell-handlers.c: Connect to
GimpImage::size-changed-detailed instead of
GimpViewable::size-changed since the shell wants information about
the previous image origin.
(gimp_display_shell_resolution_changed_handler): Use
gimp_display_shell_scale_resize() instead to avoid display
garbage.
* app/display/gimpdisplayshell-scale.[ch]: Add new utility
function gimp_display_shell_center_image_on_next_size_allocate().
* app/display/gimpdisplayshell-scroll.[ch]
(gimp_display_shell_handle_size_changed_detailed): New function
that replaces logic in gimp_display_shell_handle_size_changed and
that takes previous-origin of the image into account and adjusts
the offset so that the image content that remains doesn't move. If
the window is resized on image resize, just center the image
afterwards.
* app/core/gimpimage-undo-push.[ch]
(gimp_image_undo_push_image_size): Add previous-origin paremeters.
* app/core/gimpimageundo.[ch]: Add and manage previous-origin
properties so that the display shell offset can be appropriately
adjusted also when undoing.
* app/core/gimpundo.h
* app/core/gimpimage-undo.c: Add previous_origin members to the
undo accumulator and emit that information when the size of the
image changes due to the undo.
* app/core/gimpimage-crop.c (gimp_image_crop)
* app/core/gimpimage-scale.c (gimp_image_scale)
* app/core/gimpimage-rotate.c (gimp_image_rotate)
* app/core/gimpimage-resize.c (gimp_image_resize_with_layers):
Supply information about the previous-origin of the image to the
size-changed signals and the undo system.
svn path=/trunk/; revision=26354
2008-07-14 Sven Neumann <sven@gimp.org>
* app/display/gimpdisplayshell-scale.c
(gimp_display_shell_scale_setup): added some line breaks to
improve readability.
svn path=/trunk/; revision=26187
2008-07-13 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scale.[ch]
(gimp_display_shell_center_image): Allow to choose what axes to
center on.
(gimp_display_shell_scale_fill)
(gimp_display_shell_scale_fit_in): Explicitly center on both axes.
* app/display/gimpdisplayshell.c (gimp_display_shell_fill): Center
the image in the filled display shell. Rather hackish, but seems
to work fine.
svn path=/trunk/; revision=26185
2008-07-13 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scale.c
(gimp_display_shell_center_image): New function.
(gimp_display_shell_scale_fill)
(gimp_display_shell_scale_fit_in): Center the image at the end.
svn path=/trunk/; revision=26176
2008-07-12 Martin Nordholts <martinn@svn.gnome.org>
The following change is conceptually based on a patch by
Alexia Death and implements the core functionality for
bug #362915.
* app/display/gimpdisplayshell-scroll.[ch]
(gimp_display_shell_scroll_clamp_offsets): Clamp the offsets in
such a way that allows to scroll beyond the image border.
(gimp_display_shell_setup_hscrollbar_with_value)
(gimp_display_shell_setup_vscrollbar_with_value): Put common
scrollbar range setup code here.
* app/display/gimpdisplayshell-scale.c
(gimp_display_shell_scale_setup): Use above helper functions for
setting up scrollbar range.
* app/display/gimpdisplayshell-callbacks.c: Handle adjustment of
the scrollbar range when they are about to change value.
* app/display/gimpdisplayshell.c: Always keep the scrollbar
steppers sensitive to user input.
svn path=/trunk/; revision=26166
2008-07-12 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scale.c
(gimp_display_shell_scale_setup): The scrollbars should be setup
using the new offset, not the old counterpart.
svn path=/trunk/; revision=26154
2008-07-12 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scale.c
(gimp_display_shell_scale_setup): Renamed the variables sx and sy
to sw and sh.
svn path=/trunk/; revision=26148
2008-07-12 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell.c: Kill disp_[xy]offset! We now
keep store that information by using negative values in
offset_[xy].
* app/display/gimpdisplayshell-scroll.[ch]
(gimp_display_shell_scroll_clamp_offsets)
(gimp_display_shell_get_scaled_image_viewport_offset): Adjust
accordingly to preserve current behaviour.
(gimp_display_shell_get_disp_offset): New function to get the old
disp_[xy]offset based on the new offset_[xy].
(gimp_display_shell_get_render_start_offset): New function to get
th old offset_[xy] based on the new offset_[xy].
* app/display/gimpdisplayshell-draw.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-render.c: Get rid of
disp_[xy]offset and use
gimp_display_shell_get_render_start_offset() and
gimp_display_shell_get_disp_offset() instead.
svn path=/trunk/; revision=26146
2008-07-11 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scale.c
(gimp_display_shell_scale_setup): Restructure the way the rulers
are setup, partly by making use of the new nifty
gimp_display_shell_get_scaled_image_viewport_offset().
svn path=/trunk/; revision=26143