[gimp] Move GimpDisplayShell's expose functions to separate files



commit f6fd3aed51284d8eccc1143214731c6a862751f0
Author: Michael Natterer <mitch gimp org>
Date:   Fri Oct 2 23:55:26 2009 +0200

    Move GimpDisplayShell's expose functions to separate files

 app/display/Makefile.am                   |    2 +
 app/display/gimpdisplay.c                 |    1 +
 app/display/gimpdisplayshell-appearance.c |    1 +
 app/display/gimpdisplayshell-cursor.c     |    1 +
 app/display/gimpdisplayshell-expose.c     |  116 +++++++++++++++++++++++++++++
 app/display/gimpdisplayshell-expose.h     |   34 +++++++++
 app/display/gimpdisplayshell-filter.c     |    1 +
 app/display/gimpdisplayshell-handlers.c   |    1 +
 app/display/gimpdisplayshell-scale.c      |    1 +
 app/display/gimpdisplayshell-scroll.c     |    1 +
 app/display/gimpdisplayshell-selection.c  |    1 +
 app/display/gimpdisplayshell.c            |   87 +---------------------
 app/display/gimpdisplayshell.h            |   11 ---
 app/tools/gimptransformtool.c             |    1 +
 14 files changed, 162 insertions(+), 97 deletions(-)
---
diff --git a/app/display/Makefile.am b/app/display/Makefile.am
index 240ae3e..031ec42 100644
--- a/app/display/Makefile.am
+++ b/app/display/Makefile.am
@@ -47,6 +47,8 @@ libappdisplay_a_sources = \
 	gimpdisplayshell-dnd.h			\
 	gimpdisplayshell-draw.c			\
 	gimpdisplayshell-draw.h			\
+	gimpdisplayshell-expose.c		\
+	gimpdisplayshell-expose.h		\
 	gimpdisplayshell-handlers.c		\
 	gimpdisplayshell-handlers.h		\
 	gimpdisplayshell-filter.c		\
diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c
index 465b5a6..9c23b34 100644
--- a/app/display/gimpdisplay.c
+++ b/app/display/gimpdisplay.c
@@ -40,6 +40,7 @@
 #include "gimpdisplay.h"
 #include "gimpdisplay-handlers.h"
 #include "gimpdisplayshell.h"
+#include "gimpdisplayshell-expose.h"
 #include "gimpdisplayshell-handlers.h"
 #include "gimpdisplayshell-icon.h"
 #include "gimpdisplayshell-transform.h"
diff --git a/app/display/gimpdisplayshell-appearance.c b/app/display/gimpdisplayshell-appearance.c
index 2960b40..1ac3fde 100644
--- a/app/display/gimpdisplayshell-appearance.c
+++ b/app/display/gimpdisplayshell-appearance.c
@@ -42,6 +42,7 @@
 #include "gimpdisplayoptions.h"
 #include "gimpdisplayshell.h"
 #include "gimpdisplayshell-appearance.h"
+#include "gimpdisplayshell-expose.h"
 #include "gimpdisplayshell-selection.h"
 #include "gimpimagewindow.h"
 #include "gimpstatusbar.h"
diff --git a/app/display/gimpdisplayshell-cursor.c b/app/display/gimpdisplayshell-cursor.c
index ffdb3a6..cb00e79 100644
--- a/app/display/gimpdisplayshell-cursor.c
+++ b/app/display/gimpdisplayshell-cursor.c
@@ -35,6 +35,7 @@
 #include "gimpcursorview.h"
 #include "gimpdisplayshell.h"
 #include "gimpdisplayshell-cursor.h"
+#include "gimpdisplayshell-expose.h"
 #include "gimpdisplayshell-transform.h"
 #include "gimpimagewindow.h"
 #include "gimpstatusbar.h"
diff --git a/app/display/gimpdisplayshell-expose.c b/app/display/gimpdisplayshell-expose.c
new file mode 100644
index 0000000..560079b
--- /dev/null
+++ b/app/display/gimpdisplayshell-expose.c
@@ -0,0 +1,116 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <gegl.h>
+#include <gtk/gtk.h>
+
+#include "libgimpmath/gimpmath.h"
+
+#include "display-types.h"
+
+#include "core/gimpguide.h"
+#include "core/gimpsamplepoint.h"
+
+#include "gimpdisplayshell.h"
+#include "gimpdisplayshell-expose.h"
+#include "gimpdisplayshell-transform.h"
+
+
+void
+gimp_display_shell_expose_area (GimpDisplayShell *shell,
+                                gint              x,
+                                gint              y,
+                                gint              w,
+                                gint              h)
+{
+  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+
+  gtk_widget_queue_draw_area (shell->canvas, x, y, w, h);
+}
+
+void
+gimp_display_shell_expose_guide (GimpDisplayShell *shell,
+                                 GimpGuide        *guide)
+{
+  gint position;
+  gint x, y;
+
+  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+  g_return_if_fail (GIMP_IS_GUIDE (guide));
+
+  position = gimp_guide_get_position (guide);
+
+  if (position < 0)
+    return;
+
+  gimp_display_shell_transform_xy (shell,
+                                   position, position,
+                                   &x, &y,
+                                   FALSE);
+
+  switch (gimp_guide_get_orientation (guide))
+    {
+    case GIMP_ORIENTATION_HORIZONTAL:
+      gimp_display_shell_expose_area (shell, 0, y, shell->disp_width, 1);
+      break;
+
+    case GIMP_ORIENTATION_VERTICAL:
+      gimp_display_shell_expose_area (shell, x, 0, 1, shell->disp_height);
+      break;
+
+    default:
+      break;
+    }
+}
+
+void
+gimp_display_shell_expose_sample_point (GimpDisplayShell *shell,
+                                        GimpSamplePoint  *sample_point)
+{
+  gdouble x, y;
+  gint    x1, y1, x2, y2;
+
+  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+  g_return_if_fail (sample_point != NULL);
+
+  if (sample_point->x < 0)
+    return;
+
+  gimp_display_shell_transform_xy_f (shell,
+                                     sample_point->x + 0.5,
+                                     sample_point->y + 0.5,
+                                     &x, &y,
+                                     FALSE);
+
+  x1 = MAX (0, floor (x - GIMP_SAMPLE_POINT_DRAW_SIZE));
+  y1 = MAX (0, floor (y - GIMP_SAMPLE_POINT_DRAW_SIZE));
+  x2 = MIN (shell->disp_width,  ceil (x + GIMP_SAMPLE_POINT_DRAW_SIZE));
+  y2 = MIN (shell->disp_height, ceil (y + GIMP_SAMPLE_POINT_DRAW_SIZE));
+
+  /* HACK: add 3 instead of 1 so the number gets cleared too */
+  gimp_display_shell_expose_area (shell, x1, y1, x2 - x1 + 3, y2 - y1 + 3);
+}
+
+void
+gimp_display_shell_expose_full (GimpDisplayShell *shell)
+{
+  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+
+  gtk_widget_queue_draw (shell->canvas);
+}
diff --git a/app/display/gimpdisplayshell-expose.h b/app/display/gimpdisplayshell-expose.h
new file mode 100644
index 0000000..110a865
--- /dev/null
+++ b/app/display/gimpdisplayshell-expose.h
@@ -0,0 +1,34 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_DISPLAY_SHELL_EXPOSE_H__
+#define __GIMP_DISPLAY_SHELL_EXPOSE_H__
+
+
+void        gimp_display_shell_expose_area         (GimpDisplayShell   *shell,
+                                                    gint                x,
+                                                    gint                y,
+                                                    gint                w,
+                                                    gint                h);
+void        gimp_display_shell_expose_guide        (GimpDisplayShell   *shell,
+                                                    GimpGuide          *guide);
+void        gimp_display_shell_expose_sample_point (GimpDisplayShell   *shell,
+                                                    GimpSamplePoint    *sample_point);
+void        gimp_display_shell_expose_full         (GimpDisplayShell   *shell);
+
+
+#endif /* __GIMP_DISPLAY_SHELL_EXPOSE_H__ */
diff --git a/app/display/gimpdisplayshell-filter.c b/app/display/gimpdisplayshell-filter.c
index 6ba9a4a..a491ba6 100644
--- a/app/display/gimpdisplayshell-filter.c
+++ b/app/display/gimpdisplayshell-filter.c
@@ -27,6 +27,7 @@
 #include "config/gimpcoreconfig.h"
 
 #include "gimpdisplayshell.h"
+#include "gimpdisplayshell-expose.h"
 #include "gimpdisplayshell-filter.h"
 
 
diff --git a/app/display/gimpdisplayshell-handlers.c b/app/display/gimpdisplayshell-handlers.c
index 16be205..6882c06 100644
--- a/app/display/gimpdisplayshell-handlers.c
+++ b/app/display/gimpdisplayshell-handlers.c
@@ -44,6 +44,7 @@
 #include "gimpdisplayshell-appearance.h"
 #include "gimpdisplayshell-callbacks.h"
 #include "gimpdisplayshell-draw.h"
+#include "gimpdisplayshell-expose.h"
 #include "gimpdisplayshell-handlers.h"
 #include "gimpdisplayshell-icon.h"
 #include "gimpdisplayshell-scale.h"
diff --git a/app/display/gimpdisplayshell-scale.c b/app/display/gimpdisplayshell-scale.c
index e53158f..dce3583 100644
--- a/app/display/gimpdisplayshell-scale.c
+++ b/app/display/gimpdisplayshell-scale.c
@@ -34,6 +34,7 @@
 #include "gimpdisplay.h"
 #include "gimpdisplayshell.h"
 #include "gimpdisplayshell-draw.h"
+#include "gimpdisplayshell-expose.h"
 #include "gimpdisplayshell-scale.h"
 #include "gimpdisplayshell-scroll.h"
 #include "gimpdisplayshell-title.h"
diff --git a/app/display/gimpdisplayshell-scroll.c b/app/display/gimpdisplayshell-scroll.c
index c937c40..0bbba21 100644
--- a/app/display/gimpdisplayshell-scroll.c
+++ b/app/display/gimpdisplayshell-scroll.c
@@ -38,6 +38,7 @@
 #include "gimpdisplay-foreach.h"
 #include "gimpdisplayshell.h"
 #include "gimpdisplayshell-draw.h"
+#include "gimpdisplayshell-expose.h"
 #include "gimpdisplayshell-scale.h"
 #include "gimpdisplayshell-scroll.h"
 
diff --git a/app/display/gimpdisplayshell-selection.c b/app/display/gimpdisplayshell-selection.c
index 73d8526..51a8bed 100644
--- a/app/display/gimpdisplayshell-selection.c
+++ b/app/display/gimpdisplayshell-selection.c
@@ -35,6 +35,7 @@
 #include "gimpdisplay.h"
 #include "gimpdisplayshell.h"
 #include "gimpdisplayshell-appearance.h"
+#include "gimpdisplayshell-expose.h"
 #include "gimpdisplayshell-selection.h"
 #include "gimpdisplayshell-transform.h"
 
diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c
index 6b7c782..b8704f4 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -37,14 +37,12 @@
 #include "core/gimp.h"
 #include "core/gimpchannel.h"
 #include "core/gimpcontext.h"
-#include "core/gimpguide.h"
 #include "core/gimpimage.h"
 #include "core/gimpimage-grid.h"
 #include "core/gimpimage-guides.h"
 #include "core/gimpimage-snap.h"
 #include "core/gimpprojection.h"
 #include "core/gimpmarshal.h"
-#include "core/gimpsamplepoint.h"
 #include "core/gimptemplate.h"
 
 #include "widgets/gimpactiongroup.h"
@@ -65,7 +63,7 @@
 #include "gimpdisplayshell-cursor.h"
 #include "gimpdisplayshell-dnd.h"
 #include "gimpdisplayshell-draw.h"
-#include "gimpdisplayshell-draw.h"
+#include "gimpdisplayshell-expose.h"
 #include "gimpdisplayshell-filter.h"
 #include "gimpdisplayshell-handlers.h"
 #include "gimpdisplayshell-progress.h"
@@ -1498,89 +1496,6 @@ gimp_display_shell_mask_bounds (GimpDisplayShell *shell,
 }
 
 void
-gimp_display_shell_expose_area (GimpDisplayShell *shell,
-                                gint              x,
-                                gint              y,
-                                gint              w,
-                                gint              h)
-{
-  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
-
-  gtk_widget_queue_draw_area (shell->canvas, x, y, w, h);
-}
-
-void
-gimp_display_shell_expose_guide (GimpDisplayShell *shell,
-                                 GimpGuide        *guide)
-{
-  gint position;
-  gint x, y;
-
-  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
-  g_return_if_fail (GIMP_IS_GUIDE (guide));
-
-  position = gimp_guide_get_position (guide);
-
-  if (position < 0)
-    return;
-
-  gimp_display_shell_transform_xy (shell,
-                                   position, position,
-                                   &x, &y,
-                                   FALSE);
-
-  switch (gimp_guide_get_orientation (guide))
-    {
-    case GIMP_ORIENTATION_HORIZONTAL:
-      gimp_display_shell_expose_area (shell, 0, y, shell->disp_width, 1);
-      break;
-
-    case GIMP_ORIENTATION_VERTICAL:
-      gimp_display_shell_expose_area (shell, x, 0, 1, shell->disp_height);
-      break;
-
-    default:
-      break;
-    }
-}
-
-void
-gimp_display_shell_expose_sample_point (GimpDisplayShell *shell,
-                                        GimpSamplePoint  *sample_point)
-{
-  gdouble x, y;
-  gint    x1, y1, x2, y2;
-
-  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
-  g_return_if_fail (sample_point != NULL);
-
-  if (sample_point->x < 0)
-    return;
-
-  gimp_display_shell_transform_xy_f (shell,
-                                     sample_point->x + 0.5,
-                                     sample_point->y + 0.5,
-                                     &x, &y,
-                                     FALSE);
-
-  x1 = MAX (0, floor (x - GIMP_SAMPLE_POINT_DRAW_SIZE));
-  y1 = MAX (0, floor (y - GIMP_SAMPLE_POINT_DRAW_SIZE));
-  x2 = MIN (shell->disp_width,  ceil (x + GIMP_SAMPLE_POINT_DRAW_SIZE));
-  y2 = MIN (shell->disp_height, ceil (y + GIMP_SAMPLE_POINT_DRAW_SIZE));
-
-  /* HACK: add 3 instead of 1 so the number gets cleared too */
-  gimp_display_shell_expose_area (shell, x1, y1, x2 - x1 + 3, y2 - y1 + 3);
-}
-
-void
-gimp_display_shell_expose_full (GimpDisplayShell *shell)
-{
-  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
-
-  gtk_widget_queue_draw (shell->canvas);
-}
-
-void
 gimp_display_shell_flush (GimpDisplayShell *shell,
                           gboolean          now)
 {
diff --git a/app/display/gimpdisplayshell.h b/app/display/gimpdisplayshell.h
index 33d008c..af10e9c 100644
--- a/app/display/gimpdisplayshell.h
+++ b/app/display/gimpdisplayshell.h
@@ -257,17 +257,6 @@ gboolean    gimp_display_shell_mask_bounds         (GimpDisplayShell   *shell,
                                                     gint               *x2,
                                                     gint               *y2);
 
-void        gimp_display_shell_expose_area         (GimpDisplayShell   *shell,
-                                                    gint                x,
-                                                    gint                y,
-                                                    gint                w,
-                                                    gint                h);
-void        gimp_display_shell_expose_guide        (GimpDisplayShell   *shell,
-                                                    GimpGuide          *guide);
-void        gimp_display_shell_expose_sample_point (GimpDisplayShell   *shell,
-                                                    GimpSamplePoint    *sample_point);
-void        gimp_display_shell_expose_full         (GimpDisplayShell   *shell);
-
 void        gimp_display_shell_flush               (GimpDisplayShell   *shell,
                                                     gboolean            now);
 
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index fe980d8..6418142 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -55,6 +55,7 @@
 #include "display/gimpdisplay.h"
 #include "display/gimpdisplayshell.h"
 #include "display/gimpdisplayshell-appearance.h"
+#include "display/gimpdisplayshell-expose.h"
 #include "display/gimpdisplayshell-transform.h"
 
 #include "gimptoolcontrol.h"



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