[gimp] Move the undo disable/freeze APIs to gimpimage-undo.[ch]



commit 9a561646c2af795df1ce55b738879d834d0492ce
Author: Michael Natterer <mitch gimp org>
Date:   Mon Feb 8 11:11:33 2010 +0100

    Move the undo disable/freeze APIs to gimpimage-undo.[ch]

 app/core/gimpimage-duplicate.c |    1 +
 app/core/gimpimage-undo.c      |   63 ++++++++++++++++++++++++++++++++++++
 app/core/gimpimage-undo.h      |    6 +++
 app/core/gimpimage.c           |   70 ++--------------------------------------
 app/core/gimpimage.h           |   13 ++-----
 app/core/gimptemplate.c        |    1 +
 app/widgets/gimptoolbox-dnd.c  |    1 +
 app/xcf/xcf-load.c             |    1 +
 8 files changed, 80 insertions(+), 76 deletions(-)
---
diff --git a/app/core/gimpimage-duplicate.c b/app/core/gimpimage-duplicate.c
index 3e8188b..4570e3c 100644
--- a/app/core/gimpimage-duplicate.c
+++ b/app/core/gimpimage-duplicate.c
@@ -34,6 +34,7 @@
 #include "gimpimage-grid.h"
 #include "gimpimage-guides.h"
 #include "gimpimage-private.h"
+#include "gimpimage-undo.h"
 #include "gimpimage-sample-points.h"
 #include "gimplayer.h"
 #include "gimplayer-floating-sel.h"
diff --git a/app/core/gimpimage-undo.c b/app/core/gimpimage-undo.c
index 004b516..dcf365f 100644
--- a/app/core/gimpimage-undo.c
+++ b/app/core/gimpimage-undo.c
@@ -49,6 +49,69 @@ static GimpDirtyMask gimp_image_undo_dirty_from_type (GimpUndoType   undo_type);
 /*  public functions  */
 
 gboolean
+gimp_image_undo_is_enabled (const GimpImage *image)
+{
+  g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
+
+  return (GIMP_IMAGE_GET_PRIVATE (image)->undo_freeze_count == 0);
+}
+
+gboolean
+gimp_image_undo_enable (GimpImage *image)
+{
+  g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
+
+  /*  Free all undo steps as they are now invalidated  */
+  gimp_image_undo_free (image);
+
+  return gimp_image_undo_thaw (image);
+}
+
+gboolean
+gimp_image_undo_disable (GimpImage *image)
+{
+  g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
+
+  return gimp_image_undo_freeze (image);
+}
+
+gboolean
+gimp_image_undo_freeze (GimpImage *image)
+{
+  GimpImagePrivate *private;
+
+  g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
+
+  private = GIMP_IMAGE_GET_PRIVATE (image);
+
+  private->undo_freeze_count++;
+
+  if (private->undo_freeze_count == 1)
+    gimp_image_undo_event (image, GIMP_UNDO_EVENT_UNDO_FREEZE, NULL);
+
+  return TRUE;
+}
+
+gboolean
+gimp_image_undo_thaw (GimpImage *image)
+{
+  GimpImagePrivate *private;
+
+  g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
+
+  private = GIMP_IMAGE_GET_PRIVATE (image);
+
+  g_return_val_if_fail (private->undo_freeze_count > 0, FALSE);
+
+  private->undo_freeze_count--;
+
+  if (private->undo_freeze_count == 0)
+    gimp_image_undo_event (image, GIMP_UNDO_EVENT_UNDO_THAW, NULL);
+
+  return TRUE;
+}
+
+gboolean
 gimp_image_undo (GimpImage *image)
 {
   GimpImagePrivate *private;
diff --git a/app/core/gimpimage-undo.h b/app/core/gimpimage-undo.h
index d212da7..a7527cd 100644
--- a/app/core/gimpimage-undo.h
+++ b/app/core/gimpimage-undo.h
@@ -19,6 +19,12 @@
 #define __GIMP_IMAGE__UNDO_H__
 
 
+gboolean        gimp_image_undo_is_enabled      (const GimpImage  *image);
+gboolean        gimp_image_undo_enable          (GimpImage        *image);
+gboolean        gimp_image_undo_disable         (GimpImage        *image);
+gboolean        gimp_image_undo_freeze          (GimpImage        *image);
+gboolean        gimp_image_undo_thaw            (GimpImage        *image);
+
 gboolean        gimp_image_undo                 (GimpImage        *image);
 gboolean        gimp_image_redo                 (GimpImage        *image);
 
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 237b656..9696035 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -2087,72 +2087,6 @@ gimp_image_quick_mask_changed (GimpImage *image)
   g_signal_emit (image, gimp_image_signals[QUICK_MASK_CHANGED], 0);
 }
 
-
-/*  undo  */
-
-gboolean
-gimp_image_undo_is_enabled (const GimpImage *image)
-{
-  g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
-
-  return (GIMP_IMAGE_GET_PRIVATE (image)->undo_freeze_count == 0);
-}
-
-gboolean
-gimp_image_undo_enable (GimpImage *image)
-{
-  g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
-
-  /*  Free all undo steps as they are now invalidated  */
-  gimp_image_undo_free (image);
-
-  return gimp_image_undo_thaw (image);
-}
-
-gboolean
-gimp_image_undo_disable (GimpImage *image)
-{
-  g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
-
-  return gimp_image_undo_freeze (image);
-}
-
-gboolean
-gimp_image_undo_freeze (GimpImage *image)
-{
-  GimpImagePrivate *private;
-
-  g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
-
-  private = GIMP_IMAGE_GET_PRIVATE (image);
-
-  private->undo_freeze_count++;
-
-  if (private->undo_freeze_count == 1)
-    gimp_image_undo_event (image, GIMP_UNDO_EVENT_UNDO_FREEZE, NULL);
-
-  return TRUE;
-}
-
-gboolean
-gimp_image_undo_thaw (GimpImage *image)
-{
-  GimpImagePrivate *private;
-
-  g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
-
-  private = GIMP_IMAGE_GET_PRIVATE (image);
-
-  g_return_val_if_fail (private->undo_freeze_count > 0, FALSE);
-
-  private->undo_freeze_count--;
-
-  if (private->undo_freeze_count == 0)
-    gimp_image_undo_event (image, GIMP_UNDO_EVENT_UNDO_THAW, NULL);
-
-  return TRUE;
-}
-
 void
 gimp_image_undo_event (GimpImage     *image,
                        GimpUndoEvent  event,
@@ -2168,6 +2102,8 @@ gimp_image_undo_event (GimpImage     *image,
 }
 
 
+/*  dirty counters  */
+
 /* NOTE about the image->dirty counter:
  *   If 0, then the image is clean (ie, copy on disk is the same as the one
  *      in memory).
@@ -2305,7 +2241,6 @@ gimp_image_get_dirty_time (const GimpImage *image)
   return GIMP_IMAGE_GET_PRIVATE (image)->dirty_time;
 }
 
-
 /**
  * gimp_image_saved:
  * @image:
@@ -2342,6 +2277,7 @@ gimp_image_exported (GimpImage   *image,
   g_signal_emit (image, gimp_image_signals[EXPORTED], 0, uri);
 }
 
+
 /*  flush this image's displays  */
 
 void
diff --git a/app/core/gimpimage.h b/app/core/gimpimage.h
index a72b4f5..b4ef022 100644
--- a/app/core/gimpimage.h
+++ b/app/core/gimpimage.h
@@ -265,18 +265,13 @@ void            gimp_image_size_changed_detailed (GimpImage          *image,
                                                   gint                previous_origin_y,
                                                   gint                previous_width,
                                                   gint                previous_height);
-
-
-/*  undo  */
-
-gboolean        gimp_image_undo_is_enabled       (const GimpImage    *image);
-gboolean        gimp_image_undo_enable           (GimpImage          *image);
-gboolean        gimp_image_undo_disable          (GimpImage          *image);
-gboolean        gimp_image_undo_freeze           (GimpImage          *image);
-gboolean        gimp_image_undo_thaw             (GimpImage          *image);
 void            gimp_image_undo_event            (GimpImage          *image,
                                                   GimpUndoEvent       event,
                                                   GimpUndo           *undo);
+
+
+/*  dirty counters  */
+
 gint            gimp_image_dirty                 (GimpImage          *image,
                                                   GimpDirtyMask       dirty_mask);
 gint            gimp_image_clean                 (GimpImage          *image,
diff --git a/app/core/gimptemplate.c b/app/core/gimptemplate.c
index e887a9a..fe45ede 100644
--- a/app/core/gimptemplate.c
+++ b/app/core/gimptemplate.c
@@ -32,6 +32,7 @@
 #include "gimp.h"
 #include "gimpcontext.h"
 #include "gimpimage.h"
+#include "gimpimage-undo.h"
 #include "gimplayer.h"
 #include "gimpprojection.h"
 #include "gimptemplate.h"
diff --git a/app/widgets/gimptoolbox-dnd.c b/app/widgets/gimptoolbox-dnd.c
index 1846ada..8ddc650 100644
--- a/app/widgets/gimptoolbox-dnd.c
+++ b/app/widgets/gimptoolbox-dnd.c
@@ -33,6 +33,7 @@
 #include "core/gimpcontext.h"
 #include "core/gimpimage.h"
 #include "core/gimpimage-colormap.h"
+#include "core/gimpimage-undo.h"
 #include "core/gimplayer.h"
 #include "core/gimplayermask.h"
 #include "core/gimptoolinfo.h"
diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c
index 150722c..0da079c 100644
--- a/app/xcf/xcf-load.c
+++ b/app/xcf/xcf-load.c
@@ -44,6 +44,7 @@
 #include "core/gimpimage-guides.h"
 #include "core/gimpimage-private.h"
 #include "core/gimpimage-sample-points.h"
+#include "core/gimpimage-undo.h"
 #include "core/gimpitemstack.h"
 #include "core/gimplayer-floating-sel.h"
 #include "core/gimplayermask.h"



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