gimp r27464 - in trunk: . app/core



Author: mitch
Date: Wed Oct 29 19:55:58 2008
New Revision: 27464
URL: http://svn.gnome.org/viewvc/gimp?rev=27464&view=rev

Log:
2008-10-29  Michael Natterer  <mitch gimp org>

	* app/core/gimpselection.[ch]: change member "gboolean stroking"
	into "gint stroking_count". Add push/pop API to increase/decrease
	the counter. Pretend the selection is empty if the counter is > 0.
	Enables correctly rendering vector layers even if there is a
	selection.



Modified:
   trunk/ChangeLog
   trunk/app/core/gimpselection.c
   trunk/app/core/gimpselection.h

Modified: trunk/app/core/gimpselection.c
==============================================================================
--- trunk/app/core/gimpselection.c	(original)
+++ trunk/app/core/gimpselection.c	Wed Oct 29 19:55:58 2008
@@ -178,7 +178,7 @@
 static void
 gimp_selection_init (GimpSelection *selection)
 {
-  selection->stroking = FALSE;
+  selection->stroking_count = 0;
 }
 
 static gboolean
@@ -278,13 +278,13 @@
       return FALSE;
     }
 
-  selection->stroking = TRUE;
+  gimp_selection_push_stroking (selection);
 
   retval = GIMP_ITEM_CLASS (parent_class)->stroke (item, drawable,
                                                    stroke_options,
                                                    push_undo, progress, error);
 
-  selection->stroking = FALSE;
+  gimp_selection_pop_stroking (selection);
 
   return retval;
 }
@@ -419,7 +419,7 @@
    *  that the selection mask is empty so that it doesn't mask the paint
    *  during the stroke operation.
    */
-  if (selection->stroking)
+  if (selection->stroking_count > 0)
     return TRUE;
 
   return GIMP_CHANNEL_CLASS (parent_class)->is_empty (channel);
@@ -531,6 +531,27 @@
   return channel;
 }
 
+gint
+gimp_selection_push_stroking (GimpSelection *selection)
+{
+  g_return_val_if_fail (GIMP_IS_SELECTION (selection), 0);
+
+  selection->stroking_count++;
+
+  return selection->stroking_count;
+}
+
+gint
+gimp_selection_pop_stroking (GimpSelection *selection)
+{
+  g_return_val_if_fail (GIMP_IS_SELECTION (selection), 0);
+  g_return_val_if_fail (selection->stroking_count > 0, 0);
+
+  selection->stroking_count--;
+
+  return selection->stroking_count;
+}
+
 void
 gimp_selection_load (GimpChannel *selection,
                      GimpChannel *channel)

Modified: trunk/app/core/gimpselection.h
==============================================================================
--- trunk/app/core/gimpselection.h	(original)
+++ trunk/app/core/gimpselection.h	Wed Oct 29 19:55:58 2008
@@ -37,7 +37,7 @@
 {
   GimpChannel parent_instance;
 
-  gboolean    stroking;
+  gint        stroking_count;
 };
 
 struct _GimpSelectionClass
@@ -46,31 +46,34 @@
 };
 
 
-GType         gimp_selection_get_type   (void) G_GNUC_CONST;
+GType         gimp_selection_get_type      (void) G_GNUC_CONST;
 
-GimpChannel * gimp_selection_new        (GimpImage     *image,
-                                         gint           width,
-                                         gint           height);
-
-void          gimp_selection_load       (GimpChannel   *selection,
-                                         GimpChannel   *channel);
-GimpChannel * gimp_selection_save       (GimpChannel   *selection);
-
-TileManager * gimp_selection_extract    (GimpChannel   *selection,
-                                         GimpPickable  *pickable,
-                                         GimpContext   *context,
-                                         gboolean       cut_image,
-                                         gboolean       keep_indexed,
-                                         gboolean       add_alpha,
-                                         GError       **error);
-
-GimpLayer   * gimp_selection_float      (GimpChannel   *selection,
-                                         GimpDrawable  *drawable,
-                                         GimpContext   *context,
-                                         gboolean       cut_image,
-                                         gint           off_x,
-                                         gint           off_y,
-                                         GError       **error);
+GimpChannel * gimp_selection_new           (GimpImage     *image,
+                                            gint           width,
+                                            gint           height);
+
+gint          gimp_selection_push_stroking (GimpSelection *selection);
+gint          gimp_selection_pop_stroking  (GimpSelection *selection);
+
+void          gimp_selection_load          (GimpChannel   *selection,
+                                            GimpChannel   *channel);
+GimpChannel * gimp_selection_save          (GimpChannel   *selection);
+
+TileManager * gimp_selection_extract       (GimpChannel   *selection,
+                                            GimpPickable  *pickable,
+                                            GimpContext   *context,
+                                            gboolean       cut_image,
+                                            gboolean       keep_indexed,
+                                            gboolean       add_alpha,
+                                            GError       **error);
+
+GimpLayer   * gimp_selection_float         (GimpChannel   *selection,
+                                            GimpDrawable  *drawable,
+                                            GimpContext   *context,
+                                            gboolean       cut_image,
+                                            gint           off_x,
+                                            gint           off_y,
+                                            GError       **error);
 
 
 #endif /* __GIMP_SELECTION_H__ */



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