Commit Graph

120 Commits

Author SHA1 Message Date
Ell 5663daa6e7 app: code layout/typo fixes
The sort of things that only become visible *after* pushing.
2016-08-09 21:55:19 +00:00
Ell 720b73ca86 app: fix a few canvas scroll/scale rounding inconsistencies
Apply rounding more consistently across some of the scroll/scale
functions, to avoid annoying one-pixel-off scrollbar size/position
issues.
2016-08-09 21:31:06 +00:00
Ell bfba49d203 app: make scrollbar limits and scroll-offset clamping rotation aware
Limit the scrollbars by the (screen space) bounding box of the canvas.
Scroll offsets are clamped to 1.5 that.
2016-07-21 21:22:49 +00:00
Michael Natterer 73a9ac967c app: add gimp_display_shell_scrollbars_update_steppers()
for the code from gimp_display_shell_scroll_clamp_and_update() that
sets the scrollbar stepper sensitivity.
2016-01-05 20:53:34 +01:00
Michael Natterer 5521ce0883 app: fix gimp_display_shell_scroll() again to work right with rotation
Call gimp_display_shell_scrolled() before gimp_overlay_box_scroll()
so the rotate transform is updated before the actual scrolling.

The explicit call to gimp_display_shell_rotate_update_transform() got
lost during the last commits, but this solution is cleaner and less
redundant anyway.
2016-01-05 20:29:54 +01:00
Michael Natterer 9391cd390f app: reorder an rename stuff in gimpdisplayshell-scale.[ch]
Rename gimp_display_shell_scale_handle_zoom_revert() to
gimp_display_shell_scale_save_revert_values() because the old name was
completely unclear.
2016-01-05 19:20:23 +01:00
Michael Natterer 2f26016a47 app: move the code to update scrollbars and rulers to their own files
so they are gone from the "scale" and "scroll" namespaces because they
belong to neither and both. And because the files are way too large.
2016-01-05 18:05:38 +01:00
Michael Natterer d228493320 app: remove gimp_display_shell_scroll_clamp_offsets()
and merge it into gimp_display_shell_scroll_clamp_and_update(), the
removed function is not any longer needed separately.
2016-01-05 17:38:56 +01:00
Michael Natterer 18bd9c39c3 app: clean up gimp_display_shell_scroll() a bit
and document the difference to gimp_display_shell_scroll_set_offset()
and why we need both.
2016-01-05 17:34:23 +01:00
Michael Natterer 32104b116d app: some cleanup in gimpdisplayshell-scroll.[ch]
Use more proper transform functions, formatting, make stuff static and
shorten function names.
2016-01-05 15:50:09 +01:00
Michael Natterer 51d41b2d61 app: fix GimpNavigationView and GimpNavigationEditor for rotated canvases
by changing it to always deal with the center of the viewport instead of
its upper-left corner.

Fix gimp_display_shell_scroll_center_image_coordinate() to use the
proper transform functions like in the last commit.
2016-01-05 15:14:08 +01:00
Michael Natterer 34dd127ace app: don't include gimpprojection.h in gimpdisplayshell-scroll.c
It's not needed.
2014-06-29 23:11:12 +02:00
Michael Natterer b3a9a6a3e3 Bug 55367 - Rotated view of the canvas (view is rotated, not image contents)
First version of display rotation, inspired by gimp-painter.
The rotation always happens around the image's center.

The only "UI" for rotating is currently shift+middle-drag and
shift+space-drag. Control constrains the angle to 15 degrees
and is currently the only way to go back to "no rotation".
2013-04-20 15:11:01 +02:00
Michael Natterer 4279023bc6 app: small whitespace fix in gimpdisplayshell-scroll.c 2013-04-18 21:50:29 +02:00
Michael Natterer c3b53b8b66 app: move the "get scaled image size" functions from shell-draw to -scale 2013-04-18 19:06:17 +02:00
Michael Natterer afddcce4e5 app: remove gimp_display_shell_update_scrollbars_and_rulers()
and move its two statements to its two callers.
2013-04-18 18:45:55 +02:00
Michael Natterer 3d4b972f5f app: remove GimpDisplayShell-scroll API that is now unused 2012-06-30 14:22:47 +02:00
Michael Natterer 3441d009f8 app: remove unused tile-manager.h include 2012-05-02 17:46:04 +02:00
Michael Natterer 8124792130 Derive GimpCanvas from GimpOverlayBox
- adapt callbacks to ignore / not block events on offscreen children
- use GimpOverlayBox' scroll API which makes sure overlay children
  don't scroll along
2009-10-18 22:19:29 +02:00
Michael Natterer 23955439d6 Don't access GtkAdjustment's members directly
but also don't use its accessors because doing that would emit
"changed" multiple times when setting up an adjustment with multiple
utility functions. Instead, use g_object_set() and freeze/thaw
notification around all calls. g_object_thaw_notify() will make sure
"changed" is emitted if anything has changed since freezing.
2009-10-09 09:59:01 +02:00
Michael Natterer c5b856f16f Use gimp_display_get_image() instead of display->image 2009-10-06 19:20:44 +02:00
Michael Natterer f6fd3aed51 Move GimpDisplayShell's expose functions to separate files 2009-10-02 23:55:26 +02:00
Michael Natterer d9b5207aa2 Change licence to GPLv3 (and to LGPLv3 for libgimp).
2009-01-17  Michael Natterer  <mitch@gimp.org>

	* all files with a GPL header and all COPYING files:

	Change licence to GPLv3 (and to LGPLv3 for libgimp).

	Cleaned up some copyright headers and regenerated the parsers in
	the ImageMap plugin.


svn path=/trunk/; revision=27913
2009-01-17 22:28:01 +00:00
Sven Neumann 47c39d6c97 removed function gimp_display_shell_scroll_get_scaled_viewport_offset() as
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
2008-11-13 23:16:11 +00:00
Michael Natterer 5503e6a055 Add GEGL_CFLAGS and #includes as if gimpdrawable.h and gimpimage.h had a
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-09 20:24:04 +00:00
Sven Neumann 8ec1d65a4a removed trailing whitespace
svn path=/trunk/; revision=26852
2008-09-04 08:37:32 +00:00
Martin Nordholts d9e5942ec6 Fix stupid slip-up in my last commit
svn path=/trunk/; revision=26777
2008-08-26 18:59:23 +00:00
Martin Nordholts dd672dde70 New function.
2008-08-26  Martin Nordholts  <martinn@svn.gnome.org>

	* app/display/gimpdisplayshell-scroll.c
	(gimp_display_shell_scroll_unoverscrollify): New function.

	* app/display/gimpdisplayshell-autoscroll.c
	(gimp_display_shell_autoscroll_timeout): Make sure the autoscroll
	does not result in overscroll. This more or less finalizes the
	implementation of the enhancement request in bug #362915.

svn path=/trunk/; revision=26775
2008-08-26 18:50:54 +00:00
Martin Nordholts ad693bbf9e If no scroll should be applied we can return early.
2008-08-26  Martin Nordholts  <martinn@svn.gnome.org>

	* app/display/gimpdisplayshell-scroll.c
	(gimp_display_shell_scroll): If no scroll should be applied we can
	return early.

svn path=/trunk/; revision=26774
2008-08-26 17:53:54 +00:00
Michael Natterer c1e13e2c5d add gimp_canvas_scroll() which scrolls the canvas and makes the result
2008-08-22  Michael Natterer  <mitch@gimp.org>

	* app/display/gimpcanvas.[ch]: add gimp_canvas_scroll() which
	scrolls the canvas and makes the result visible immediately.

	* app/display/gimpdisplayshell-scroll.c
	(gimp_display_shell_scroll): use the new function.


svn path=/trunk/; revision=26712
2008-08-22 15:57:41 +00:00
Martin Nordholts 120b65469f Fix typo in last commit
svn path=/trunk/; revision=26686
2008-08-20 20:01:45 +00:00
Martin Nordholts ec0849dce8 Use a constant for the minimum step amount for scrollbars.
2008-08-20  Martin Nordholts  <martinn@svn.gnome.org>

	* app/display/gimpdisplayshell-scroll.c: Use a constant for the
	minimum step amount for scrollbars.

svn path=/trunk/; revision=26685
2008-08-20 19:46:58 +00:00
Martin Nordholts 7902305706 Oops, correct parameter order.
2008-08-16  Martin Nordholts  <martinn@svn.gnome.org>

	* app/display/gimpdisplayshell-scroll.c
	(gimp_display_shell_scroll_center_image_on_next_size_allocate):
	Oops, correct parameter order.

svn path=/trunk/; revision=26609
2008-08-16 19:18:31 +00:00
Martin Nordholts f45897f6c7 Support axis independence.
2008-08-16  Martin Nordholts  <martinn@svn.gnome.org>

	* app/display/gimpdisplayshell-scroll.[ch]
	(gimp_display_shell_scroll_center_image_on_next_size_allocate):
	Support axis independence.

	* app/display/gimpdisplayshell.c: Adapt.

svn path=/trunk/; revision=26608
2008-08-16 18:50:38 +00:00
Martin Nordholts 80ff2e82c3 Explain that this function needs to be used with care since it is risky.
2008-08-16  Martin Nordholts  <martinn@svn.gnome.org>

	* app/display/gimpdisplayshell-scroll.c
	(gimp_display_shell_scroll_center_image_on_next_size_allocate):
	Explain that this function needs to be used with care since it is
	risky.

	* app/display/gimpdisplayshell.c
	(gimp_display_shell_new)
	(gimp_display_shell_fill): Clarify that it is safe to use the
	risky function.

	(gimp_display_shell_configure_event): Make proper comparisions (<=
	not =) and explain that usage of the risky function is safe.

	(gimp_display_shell_shrink_wrap): Always call
	gimp_display_shell_scroll_center_image() and let size-requests be
	handled by GimpDisplayShell::configure_event().

	* app/actions/view-commands.c (view_shrink_wrap_cmd_callback): No
	need to center anything explicitly any longer.

svn path=/trunk/; revision=26607
2008-08-16 18:25:32 +00:00
Martin Nordholts c8ae8f67b4 New function.
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 19:23:28 +00:00
Martin Nordholts 2f52791b2b New helper function.
2008-08-14  Martin Nordholts  <martinn@svn.gnome.org>

	* app/display/gimpdisplayshell-scroll.c
	(gimp_display_shell_scroll_clamp_and_update): New helper function.

	* app/display/gimpdisplayshell-scale.c
	* app/display/gimpdisplayshell-scroll.c
	* app/display/gimpdisplayshell-callbacks.c: Use it.

svn path=/trunk/; revision=26554
2008-08-14 14:41:29 +00:00
Martin Nordholts 21a6d735e5 Always center the image after a wrap. I can't think of a case when that
2008-08-10  Martin Nordholts  <martinn@svn.gnome.org>

	* app/display/gimpdisplayshell.c (gimp_display_shell_shrink_wrap):
	Always center the image after a wrap. I can't think of a case when
	that shouldn't happen.

	* app/display/gimpdisplayshell-handlers.c
	(gimp_display_shell_size_changed_detailed_handler): Centering
	occurs implicitly after wrapping now, no need to do it explicitly.

	* app/display/gimpdisplayshell-scroll.c
	(gimp_display_shell_scroll_center_image): Handle the no-image
	case.

svn path=/trunk/; revision=26487
2008-08-10 14:26:29 +00:00
Martin Nordholts b41206c334 New low level function for setting display shell offset.
2008-08-10  Martin Nordholts  <martinn@svn.gnome.org>

	* app/display/gimpdisplayshell-scroll.[ch]
	(gimp_display_shell_scroll_set_offset): New low level function for
	setting display shell offset.

	(gimp_display_shell_scroll_center_image)

	* app/display/gimpdisplayshell-handlers.c
	(gimp_display_shell_size_changed_detailed_handler): Use it instead
	of gimp_display_shell_scale_by_values().

svn path=/trunk/; revision=26486
2008-08-10 13:09:24 +00:00
Martin Nordholts 2eacb5cf58 Rename gimp_display_shell_scale_setup() to
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 11:56:29 +00:00
Martin Nordholts 4bbe4c81b8 Renamed gimp_display_shell_scroll_private() to gimp_display_shell_scroll()
2008-08-10  Martin Nordholts  <martinn@svn.gnome.org>

	* app/display/gimpdisplayshell-scroll.[ch]: Renamed
	gimp_display_shell_scroll_private() to gimp_display_shell_scroll()
	and keep it here.

	* app/display/gimpdisplayshell-private.h: Removed.

	* app/display/Makefile.am
	* app/display/gimpdisplayshell-scale.c
	* app/display/gimpdisplayshell-scroll.c
	* app/display/gimpdisplayshell-handlers.c
	* app/display/gimpdisplayshell-callbacks.c
	* app/display/gimpdisplayshell-autoscroll.c: Adapt.

svn path=/trunk/; revision=26480
2008-08-10 11:11:19 +00:00
Martin Nordholts 65ff34a540 It makes more sense for gimp_display_shell_get_scaled_image_size() to be
2008-08-10  Martin Nordholts  <martinn@svn.gnome.org>

	* app/display/gimpdisplayshell-scroll.[ch]: It makes more sense
	for gimp_display_shell_get_scaled_image_size() to be moved from
	here to

	* app/display/gimpdisplayshell-draw.[ch]: here, and rename it to
	gimp_display_shell_draw_get_scaled_image_size().

	* app/display/gimpdisplayshell.c: Adapt to name change.

svn path=/trunk/; revision=26479
2008-08-10 10:54:00 +00:00
Martin Nordholts b9f66d0489 gimp_display_shell_ -> gimp_display_shell_scroll_ for functions that are
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 09:08:11 +00:00
Martin Nordholts 34b4b890cf There is no need for special casing depending on image size relative to
2008-08-10  Martin Nordholts  <martinn@svn.gnome.org>

	* app/display/gimpdisplayshell-scroll.c
	(gimp_display_shell_scroll_center_image): There is no need for
	special casing depending on image size relative to viewport size.

svn path=/trunk/; revision=26471
2008-08-10 07:26:35 +00:00
Martin Nordholts a736df49e2 Put functions to center the image in the display shell where they belong,
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-10 07:23:14 +00:00
Sven Neumann 3b067cba23 added gimp_image_get_projection().
2008-08-07  Sven Neumann  <sven@gimp.org>

	* app/core/gimpimage.[ch]: added gimp_image_get_projection().

	* app/display/gimpdisplay-handlers.c
	* app/display/gimpdisplayshell-render.c
	* app/display/gimpdisplayshell-scroll.c
	* app/paint/gimppaintcore.c
	* app/paint/gimpsourcecore.c
	* app/tools/gimpbycolorselecttool.c
	* app/tools/gimpeditselectiontool.c
	* app/tools/gimpimagemaptool.c
	* app/tools/gimpiscissorstool.c
	* app/tools/gimppainttool.c
	* app/widgets/gimpsamplepointeditor.c
	* tools/pdbgen/pdb/image.pdb: use the new accessor function.

	* app/pdb/image-cmds.c: regenerated.


svn path=/trunk/; revision=26413
2008-08-07 09:17:46 +00:00
Michael Natterer 612778c885 app/display/gimpdisplayshell-scroll.[ch]
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 17:50:32 +00:00
Martin Nordholts 5a856e9d45 Don't setup scrollbar step increment here.
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-05 17:17:27 +00:00
Michael Natterer 26c2c6afda :size-changed-detailed): change double to int in signal parameters.
2008-08-04  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpimage.[ch] (GimpImage::size-changed-detailed):
	change double to int in signal parameters.

	Remove gimp_image_emit_size_changed_signals() and call
	gimp_viewable_size_changed() in size-changed-detailed's default
	handler.

	* app/core/gimpimageundo.[ch]
	* app/core/gimpimage-undo-push.[ch]: change double to int in
	previous-origin related code.

	* app/core/gimpimage-undo.c
	* app/core/gimpimage-scale.c
	* app/core/gimpimage-crop.c
	* app/core/gimpimage-rotate.c
	* app/core/gimpimage-resize.c: call gimp_image_size_changed_detailed()
	instead of the removed gimp_image_emit_size_changed_signals()

	* app/display/gimpdisplayshell-scroll.[ch]: remove
	gimp_display_shell_handle_size_changed_detailed() because it
	handles both scrolling and scaling and doesn't belong here.

	* app/display/gimpdisplayshell-handlers.c: moved its code back to
	gimp_display_shell_size_changed_detailed_handler() and follow the
	double -> int change above.


svn path=/trunk/; revision=26367
2008-08-04 20:11:35 +00:00
Martin Nordholts 6c48f2b601 Further work for completing bug #362915 that makes changes to the image
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-08-03 11:35:53 +00:00