Commit 82ca2233 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

change member "gboolean stroking" into "gint stroking_count". Add push/pop

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.


svn path=/trunk/; revision=27464
parent 064f2afd
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.
2008-10-29 Sven Neumann <sven@gimp.org>
Bug 558420 – projection incorrect with alpha-less layers
......
......@@ -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)
......
......@@ -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__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment