From 82ca2233769901c29bd7b31199160e6ce4fa75d4 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Wed, 29 Oct 2008 19:55:58 +0000 Subject: [PATCH] change member "gboolean stroking" into "gint stroking_count". Add push/pop 2008-10-29 Michael Natterer * 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. svn path=/trunk/; revision=27464 --- ChangeLog | 8 +++++++ app/core/gimpselection.c | 29 +++++++++++++++++++++---- app/core/gimpselection.h | 47 +++++++++++++++++++++------------------- 3 files changed, 58 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index f0aa2825f1..3e895a8adb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-10-29 Michael Natterer + + * 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. + 2008-10-29 Sven Neumann Bug 558420 – projection incorrect with alpha-less layers diff --git a/app/core/gimpselection.c b/app/core/gimpselection.c index 78e0911781..5cd03fc833 100644 --- a/app/core/gimpselection.c +++ b/app/core/gimpselection.c @@ -178,7 +178,7 @@ gimp_selection_class_init (GimpSelectionClass *klass) static void gimp_selection_init (GimpSelection *selection) { - selection->stroking = FALSE; + selection->stroking_count = 0; } static gboolean @@ -278,13 +278,13 @@ gimp_selection_stroke (GimpItem *item, 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 @@ gimp_selection_is_empty (GimpChannel *channel) * 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 @@ gimp_selection_new (GimpImage *image, 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) diff --git a/app/core/gimpselection.h b/app/core/gimpselection.h index 8cadb39c11..8060763c7c 100644 --- a/app/core/gimpselection.h +++ b/app/core/gimpselection.h @@ -37,7 +37,7 @@ struct _GimpSelection { GimpChannel parent_instance; - gboolean stroking; + gint stroking_count; }; struct _GimpSelectionClass @@ -46,31 +46,34 @@ struct _GimpSelectionClass }; -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); +GimpChannel * gimp_selection_new (GimpImage *image, + gint width, + gint height); -void gimp_selection_load (GimpChannel *selection, - GimpChannel *channel); -GimpChannel * gimp_selection_save (GimpChannel *selection); +gint gimp_selection_push_stroking (GimpSelection *selection); +gint gimp_selection_pop_stroking (GimpSelection *selection); -TileManager * gimp_selection_extract (GimpChannel *selection, - GimpPickable *pickable, - GimpContext *context, - gboolean cut_image, - gboolean keep_indexed, - gboolean add_alpha, - GError **error); +void gimp_selection_load (GimpChannel *selection, + GimpChannel *channel); +GimpChannel * gimp_selection_save (GimpChannel *selection); -GimpLayer * gimp_selection_float (GimpChannel *selection, - GimpDrawable *drawable, - GimpContext *context, - gboolean cut_image, - gint off_x, - gint off_y, - GError **error); +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__ */