gimp r26608 - in trunk: . app/display
- From: martinn svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26608 - in trunk: . app/display
- Date: Sat, 16 Aug 2008 18:50:38 +0000 (UTC)
Author: martinn
Date: Sat Aug 16 18:50:38 2008
New Revision: 26608
URL: http://svn.gnome.org/viewvc/gimp?rev=26608&view=rev
Log:
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.
Modified:
trunk/ChangeLog
trunk/app/display/gimpdisplayshell-scroll.c
trunk/app/display/gimpdisplayshell-scroll.h
trunk/app/display/gimpdisplayshell.c
Modified: trunk/app/display/gimpdisplayshell-scroll.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-scroll.c (original)
+++ trunk/app/display/gimpdisplayshell-scroll.c Sat Aug 16 18:50:38 2008
@@ -44,6 +44,14 @@
#define OVERPAN_FACTOR 0.5
+typedef struct
+{
+ GimpDisplayShell *shell;
+ gboolean vertically;
+ gboolean horizontally;
+} SizeAllocateCallbackData;
+
+
/**
* gimp_display_shell_scroll_center_image_coordinate:
* @shell:
@@ -292,15 +300,19 @@
}
static void
-gimp_display_shell_scroll_center_image_callback (GimpDisplayShell *shell,
- GtkAllocation *allocation,
- GtkWidget *canvas)
-{
- gimp_display_shell_scroll_center_image (shell, TRUE, TRUE);
+gimp_display_shell_scroll_center_image_callback (GtkWidget *canvas,
+ GtkAllocation *allocation,
+ SizeAllocateCallbackData *data)
+{
+ gimp_display_shell_scroll_center_image (data->shell,
+ data->horizontally,
+ data->vertically);
g_signal_handlers_disconnect_by_func (canvas,
gimp_display_shell_scroll_center_image_callback,
- shell);
+ data);
+
+ g_slice_free (SizeAllocateCallbackData, data);
}
/**
@@ -316,13 +328,27 @@
*
**/
void
-gimp_display_shell_scroll_center_image_on_next_size_allocate (GimpDisplayShell *shell)
+gimp_display_shell_scroll_center_image_on_next_size_allocate (GimpDisplayShell *shell,
+ gboolean vertically,
+ gboolean horizontally)
{
+ SizeAllocateCallbackData *data;
+
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
- g_signal_connect_swapped (shell->canvas, "size-allocate",
- G_CALLBACK (gimp_display_shell_scroll_center_image_callback),
- shell);
+ data = g_slice_new (SizeAllocateCallbackData);
+
+ if (data)
+ {
+ data->shell = shell;
+ data->horizontally = horizontally;
+ data->vertically = vertically;
+
+ g_signal_connect (shell->canvas, "size-allocate",
+ G_CALLBACK (gimp_display_shell_scroll_center_image_callback),
+ data);
+ }
+
}
/**
Modified: trunk/app/display/gimpdisplayshell-scroll.h
==============================================================================
--- trunk/app/display/gimpdisplayshell-scroll.h (original)
+++ trunk/app/display/gimpdisplayshell-scroll.h Sat Aug 16 18:50:38 2008
@@ -35,7 +35,9 @@
gboolean horizontally,
gboolean vertically);
void gimp_display_shell_scroll_center_image_on_next_size_allocate
- (GimpDisplayShell *shell);
+ (GimpDisplayShell *shell,
+ gboolean horizontally,
+ gboolean vertically);
void gimp_display_shell_scroll_get_scaled_viewport (const GimpDisplayShell *shell,
gint *x,
gint *y,
Modified: trunk/app/display/gimpdisplayshell.c
==============================================================================
--- trunk/app/display/gimpdisplayshell.c (original)
+++ trunk/app/display/gimpdisplayshell.c Sat Aug 16 18:50:38 2008
@@ -614,7 +614,9 @@
* axis, center the image on that axis. We know that the canvas
* will get a size-allocate if we get here.
*/
- gimp_display_shell_scroll_center_image_on_next_size_allocate (shell);
+ gimp_display_shell_scroll_center_image_on_next_size_allocate (shell,
+ center_horizontally,
+ center_vertically);
}
return TRUE;
@@ -1270,7 +1272,9 @@
* not even finnished creating the display shell, we can safely
* assume we will get a size-allocate later.
*/
- gimp_display_shell_scroll_center_image_on_next_size_allocate (shell);
+ gimp_display_shell_scroll_center_image_on_next_size_allocate (shell,
+ TRUE,
+ TRUE);
}
else
{
@@ -1423,7 +1427,9 @@
/* A size-allocate will always occur because the scrollbars will
* become visible forcing the canvas to become smaller
*/
- gimp_display_shell_scroll_center_image_on_next_size_allocate (shell);
+ gimp_display_shell_scroll_center_image_on_next_size_allocate (shell,
+ TRUE,
+ TRUE);
shell->fill_idle_id = g_idle_add_full (G_PRIORITY_LOW,
(GSourceFunc) gimp_display_shell_fill_idle,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]