[gimp] app: add API to move an existing image-coords overlay around



commit ff01c2d77ecc73e0c75d30a0d22784663333d256
Author: Michael Natterer <mitch gimp org>
Date:   Fri Feb 26 00:09:54 2010 +0100

    app: add API to move an existing image-coords overlay around

 app/display/gimpdisplayshell.c |   28 ++++++++++++++++++++++++++++
 app/display/gimpdisplayshell.h |    4 ++++
 2 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c
index e0aeaf6..e84c4e5 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -1116,6 +1116,34 @@ gimp_display_shell_add_overlay (GimpDisplayShell *shell,
                                        child, x, y);
 }
 
+void
+gimp_display_shell_move_overlay (GimpDisplayShell *shell,
+                                 GtkWidget        *child,
+                                 gdouble           image_x,
+                                 gdouble           image_y)
+{
+  gdouble *x_data;
+  gdouble *y_data;
+  gdouble  x, y;
+
+  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+  g_return_if_fail (GTK_IS_WIDGET (shell));
+
+  x_data = g_object_get_data (G_OBJECT (child), "image-x");
+  y_data = g_object_get_data (G_OBJECT (child), "image-y");
+
+  if (! x_data || ! y_data)
+    return;
+
+  *x_data = image_x;
+  *y_data = image_y;
+
+  gimp_display_shell_transform_xy_f (shell, *x_data, *y_data, &x, &y, FALSE);
+
+  gimp_overlay_box_set_child_position (GIMP_OVERLAY_BOX (shell->canvas),
+                                       child, x, y);
+}
+
 GimpImageWindow *
 gimp_display_shell_get_window (GimpDisplayShell *shell)
 {
diff --git a/app/display/gimpdisplayshell.h b/app/display/gimpdisplayshell.h
index 90db259..017f365 100644
--- a/app/display/gimpdisplayshell.h
+++ b/app/display/gimpdisplayshell.h
@@ -223,6 +223,10 @@ void              gimp_display_shell_add_overlay   (GimpDisplayShell   *shell,
                                                     GtkWidget          *child,
                                                     gdouble             image_x,
                                                     gdouble             image_y);
+void              gimp_display_shell_move_overlay  (GimpDisplayShell   *shell,
+                                                    GtkWidget          *child,
+                                                    gdouble             image_x,
+                                                    gdouble             image_y);
 
 GimpImageWindow * gimp_display_shell_get_window    (GimpDisplayShell   *shell);
 GimpStatusbar   * gimp_display_shell_get_statusbar (GimpDisplayShell   *shell);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]