2010-09-25 23:14:57 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* gimpcanvasgroup.c
|
|
|
|
* Copyright (C) 2010 Michael Natterer <mitch@gimp.org>
|
|
|
|
*
|
|
|
|
* 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
|
2018-07-12 05:27:07 +08:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2010-09-25 23:14:57 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <gegl.h>
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include "libgimpbase/gimpbase.h"
|
|
|
|
#include "libgimpmath/gimpmath.h"
|
|
|
|
|
|
|
|
#include "display-types.h"
|
|
|
|
|
|
|
|
#include "gimpcanvasgroup.h"
|
|
|
|
#include "gimpdisplayshell.h"
|
|
|
|
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2010-09-26 20:12:54 +08:00
|
|
|
PROP_0,
|
2010-09-28 04:59:36 +08:00
|
|
|
PROP_GROUP_STROKING,
|
|
|
|
PROP_GROUP_FILLING
|
2010-09-25 23:14:57 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct _GimpCanvasGroupPrivate
|
|
|
|
{
|
2016-01-24 07:54:48 +08:00
|
|
|
GQueue *items;
|
2010-09-26 20:12:54 +08:00
|
|
|
gboolean group_stroking;
|
2010-09-28 04:59:36 +08:00
|
|
|
gboolean group_filling;
|
2010-09-25 23:14:57 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* local function prototypes */
|
|
|
|
|
2017-06-11 04:08:09 +08:00
|
|
|
static void gimp_canvas_group_finalize (GObject *object);
|
2013-04-18 21:45:08 +08:00
|
|
|
static void gimp_canvas_group_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gimp_canvas_group_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gimp_canvas_group_draw (GimpCanvasItem *item,
|
|
|
|
cairo_t *cr);
|
|
|
|
static cairo_region_t * gimp_canvas_group_get_extents (GimpCanvasItem *item);
|
|
|
|
static gboolean gimp_canvas_group_hit (GimpCanvasItem *item,
|
|
|
|
gdouble x,
|
|
|
|
gdouble y);
|
|
|
|
|
|
|
|
static void gimp_canvas_group_child_update (GimpCanvasItem *item,
|
|
|
|
cairo_region_t *region,
|
|
|
|
GimpCanvasGroup *group);
|
2010-09-25 23:14:57 +08:00
|
|
|
|
|
|
|
|
app, libgimp*, modules: don't use g_type_class_add_private() ...
... and G_TYPE_INSTANCE_GET_PRIVATE()
g_type_class_add_private() and G_TYPE_INSTANCE_GET_PRIVATE() were
deprecated in GLib 2.58. Instead, use
G_DEFINE_[ABSTRACT_]TYPE_WITH_PRIVATE(), and
G_ADD_PRIVATE[_DYNAMIC](), and the implictly-defined
foo_get_instance_private() functions, all of which are available in
the GLib versions we depend on.
This commit only covers types registered using one of the
G_DEFINE_FOO() macros (i.e., most types), but not types with a
custom registration function, of which we still have a few -- GLib
currently only provides a (non-deprecated) public API for adding a
private struct using the G_DEFINE_FOO() macros.
Note that this commit was 99% auto-generated (because I'm not
*that* crazy :), so if there are any style mismatches... we'll have
to live with them for now.
2018-09-19 00:09:39 +08:00
|
|
|
G_DEFINE_TYPE_WITH_PRIVATE (GimpCanvasGroup, gimp_canvas_group,
|
|
|
|
GIMP_TYPE_CANVAS_ITEM)
|
2010-09-25 23:14:57 +08:00
|
|
|
|
|
|
|
#define parent_class gimp_canvas_group_parent_class
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_canvas_group_class_init (GimpCanvasGroupClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GimpCanvasItemClass *item_class = GIMP_CANVAS_ITEM_CLASS (klass);
|
|
|
|
|
2017-06-11 04:08:09 +08:00
|
|
|
object_class->finalize = gimp_canvas_group_finalize;
|
2010-09-25 23:14:57 +08:00
|
|
|
object_class->set_property = gimp_canvas_group_set_property;
|
|
|
|
object_class->get_property = gimp_canvas_group_get_property;
|
|
|
|
|
|
|
|
item_class->draw = gimp_canvas_group_draw;
|
|
|
|
item_class->get_extents = gimp_canvas_group_get_extents;
|
2011-03-29 00:54:02 +08:00
|
|
|
item_class->hit = gimp_canvas_group_hit;
|
2010-09-25 23:14:57 +08:00
|
|
|
|
2010-09-26 20:12:54 +08:00
|
|
|
g_object_class_install_property (object_class, PROP_GROUP_STROKING,
|
|
|
|
g_param_spec_boolean ("group-stroking",
|
|
|
|
NULL, NULL,
|
|
|
|
FALSE,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
|
2010-09-28 04:59:36 +08:00
|
|
|
g_object_class_install_property (object_class, PROP_GROUP_FILLING,
|
|
|
|
g_param_spec_boolean ("group-filling",
|
|
|
|
NULL, NULL,
|
|
|
|
FALSE,
|
|
|
|
GIMP_PARAM_READWRITE));
|
2010-09-25 23:14:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_canvas_group_init (GimpCanvasGroup *group)
|
|
|
|
{
|
app, libgimp*, modules: don't use g_type_class_add_private() ...
... and G_TYPE_INSTANCE_GET_PRIVATE()
g_type_class_add_private() and G_TYPE_INSTANCE_GET_PRIVATE() were
deprecated in GLib 2.58. Instead, use
G_DEFINE_[ABSTRACT_]TYPE_WITH_PRIVATE(), and
G_ADD_PRIVATE[_DYNAMIC](), and the implictly-defined
foo_get_instance_private() functions, all of which are available in
the GLib versions we depend on.
This commit only covers types registered using one of the
G_DEFINE_FOO() macros (i.e., most types), but not types with a
custom registration function, of which we still have a few -- GLib
currently only provides a (non-deprecated) public API for adding a
private struct using the G_DEFINE_FOO() macros.
Note that this commit was 99% auto-generated (because I'm not
*that* crazy :), so if there are any style mismatches... we'll have
to live with them for now.
2018-09-19 00:09:39 +08:00
|
|
|
group->priv = gimp_canvas_group_get_instance_private (group);
|
2016-01-24 07:54:48 +08:00
|
|
|
|
|
|
|
group->priv->items = g_queue_new ();
|
2010-09-25 23:14:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-06-11 04:08:09 +08:00
|
|
|
gimp_canvas_group_finalize (GObject *object)
|
2010-09-25 23:14:57 +08:00
|
|
|
{
|
2016-01-24 07:54:48 +08:00
|
|
|
GimpCanvasGroup *group = GIMP_CANVAS_GROUP (object);
|
2017-06-11 04:08:09 +08:00
|
|
|
GimpCanvasItem *item;
|
2010-09-25 23:14:57 +08:00
|
|
|
|
2017-06-11 04:08:09 +08:00
|
|
|
while ((item = g_queue_peek_head (group->priv->items)))
|
|
|
|
gimp_canvas_group_remove_item (group, item);
|
|
|
|
|
|
|
|
g_queue_free (group->priv->items);
|
|
|
|
group->priv->items = NULL;
|
2010-09-25 23:14:57 +08:00
|
|
|
|
2017-06-11 04:08:09 +08:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
2010-09-25 23:14:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_canvas_group_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
2016-01-24 07:54:48 +08:00
|
|
|
GimpCanvasGroup *group = GIMP_CANVAS_GROUP (object);
|
2010-09-25 23:14:57 +08:00
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
2010-09-26 20:12:54 +08:00
|
|
|
case PROP_GROUP_STROKING:
|
2016-01-24 07:54:48 +08:00
|
|
|
group->priv->group_stroking = g_value_get_boolean (value);
|
2010-09-26 20:12:54 +08:00
|
|
|
break;
|
2010-09-28 04:59:36 +08:00
|
|
|
case PROP_GROUP_FILLING:
|
2016-01-24 07:54:48 +08:00
|
|
|
group->priv->group_filling = g_value_get_boolean (value);
|
2010-09-28 04:59:36 +08:00
|
|
|
break;
|
2010-09-26 20:12:54 +08:00
|
|
|
|
2010-09-25 23:14:57 +08:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_canvas_group_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
2016-01-24 07:54:48 +08:00
|
|
|
GimpCanvasGroup *group = GIMP_CANVAS_GROUP (object);
|
2010-09-25 23:14:57 +08:00
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
2010-09-26 20:12:54 +08:00
|
|
|
case PROP_GROUP_STROKING:
|
2016-01-24 07:54:48 +08:00
|
|
|
g_value_set_boolean (value, group->priv->group_stroking);
|
2010-09-26 20:12:54 +08:00
|
|
|
break;
|
2010-09-28 04:59:36 +08:00
|
|
|
case PROP_GROUP_FILLING:
|
2016-01-24 07:54:48 +08:00
|
|
|
g_value_set_boolean (value, group->priv->group_filling);
|
2010-09-28 04:59:36 +08:00
|
|
|
break;
|
2010-09-26 20:12:54 +08:00
|
|
|
|
2010-09-25 23:14:57 +08:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-04-18 21:45:08 +08:00
|
|
|
gimp_canvas_group_draw (GimpCanvasItem *item,
|
|
|
|
cairo_t *cr)
|
2010-09-25 23:14:57 +08:00
|
|
|
{
|
2016-01-24 07:54:48 +08:00
|
|
|
GimpCanvasGroup *group = GIMP_CANVAS_GROUP (item);
|
|
|
|
GList *list;
|
2010-09-25 23:14:57 +08:00
|
|
|
|
2016-01-24 07:54:48 +08:00
|
|
|
for (list = group->priv->items->head; list; list = g_list_next (list))
|
2010-09-25 23:14:57 +08:00
|
|
|
{
|
|
|
|
GimpCanvasItem *sub_item = list->data;
|
|
|
|
|
2010-10-01 20:54:53 +08:00
|
|
|
gimp_canvas_item_draw (sub_item, cr);
|
2010-09-25 23:14:57 +08:00
|
|
|
}
|
2010-09-26 20:12:54 +08:00
|
|
|
|
2016-01-24 07:54:48 +08:00
|
|
|
if (group->priv->group_stroking)
|
2010-10-01 20:54:53 +08:00
|
|
|
_gimp_canvas_item_stroke (item, cr);
|
2010-09-28 04:59:36 +08:00
|
|
|
|
2016-01-24 07:54:48 +08:00
|
|
|
if (group->priv->group_filling)
|
2010-10-01 20:54:53 +08:00
|
|
|
_gimp_canvas_item_fill (item, cr);
|
2010-09-25 23:14:57 +08:00
|
|
|
}
|
|
|
|
|
2010-10-19 01:59:13 +08:00
|
|
|
static cairo_region_t *
|
2013-04-18 21:45:08 +08:00
|
|
|
gimp_canvas_group_get_extents (GimpCanvasItem *item)
|
2010-09-25 23:14:57 +08:00
|
|
|
{
|
2016-01-24 07:54:48 +08:00
|
|
|
GimpCanvasGroup *group = GIMP_CANVAS_GROUP (item);
|
|
|
|
cairo_region_t *region = NULL;
|
|
|
|
GList *list;
|
2010-09-25 23:14:57 +08:00
|
|
|
|
2016-01-24 07:54:48 +08:00
|
|
|
for (list = group->priv->items->head; list; list = g_list_next (list))
|
2010-09-25 23:14:57 +08:00
|
|
|
{
|
|
|
|
GimpCanvasItem *sub_item = list->data;
|
2010-10-19 01:59:13 +08:00
|
|
|
cairo_region_t *sub_region = gimp_canvas_item_get_extents (sub_item);
|
2010-09-25 23:14:57 +08:00
|
|
|
|
2010-09-28 04:59:36 +08:00
|
|
|
if (! region)
|
2010-09-25 23:14:57 +08:00
|
|
|
{
|
2010-09-28 04:59:36 +08:00
|
|
|
region = sub_region;
|
2010-09-25 23:14:57 +08:00
|
|
|
}
|
2010-09-28 04:59:36 +08:00
|
|
|
else if (sub_region)
|
2010-09-25 23:14:57 +08:00
|
|
|
{
|
2010-10-19 01:59:13 +08:00
|
|
|
cairo_region_union (region, sub_region);
|
|
|
|
cairo_region_destroy (sub_region);
|
2010-09-25 23:14:57 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return region;
|
|
|
|
}
|
|
|
|
|
2011-03-29 00:54:02 +08:00
|
|
|
static gboolean
|
2013-04-18 21:45:08 +08:00
|
|
|
gimp_canvas_group_hit (GimpCanvasItem *item,
|
|
|
|
gdouble x,
|
|
|
|
gdouble y)
|
2011-03-29 00:54:02 +08:00
|
|
|
{
|
2016-01-24 07:54:48 +08:00
|
|
|
GimpCanvasGroup *group = GIMP_CANVAS_GROUP (item);
|
|
|
|
GList *list;
|
2011-03-29 00:54:02 +08:00
|
|
|
|
2016-01-24 07:54:48 +08:00
|
|
|
for (list = group->priv->items->head; list; list = g_list_next (list))
|
2011-03-29 00:54:02 +08:00
|
|
|
{
|
|
|
|
if (gimp_canvas_item_hit (list->data, x, y))
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-10-01 23:13:00 +08:00
|
|
|
static void
|
|
|
|
gimp_canvas_group_child_update (GimpCanvasItem *item,
|
2010-10-19 01:59:13 +08:00
|
|
|
cairo_region_t *region,
|
2010-10-01 23:13:00 +08:00
|
|
|
GimpCanvasGroup *group)
|
|
|
|
{
|
2010-10-02 02:41:27 +08:00
|
|
|
if (_gimp_canvas_item_needs_update (GIMP_CANVAS_ITEM (group)))
|
|
|
|
_gimp_canvas_item_update (GIMP_CANVAS_ITEM (group), region);
|
2010-10-01 23:13:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* public functions */
|
|
|
|
|
2010-09-25 23:14:57 +08:00
|
|
|
GimpCanvasItem *
|
2010-10-01 20:13:45 +08:00
|
|
|
gimp_canvas_group_new (GimpDisplayShell *shell)
|
2010-09-25 23:14:57 +08:00
|
|
|
{
|
2010-10-01 20:13:45 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
|
|
|
|
|
|
|
|
return g_object_new (GIMP_TYPE_CANVAS_GROUP,
|
|
|
|
"shell", shell,
|
|
|
|
NULL);
|
2010-09-25 23:14:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_canvas_group_add_item (GimpCanvasGroup *group,
|
|
|
|
GimpCanvasItem *item)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_CANVAS_GROUP (group));
|
|
|
|
g_return_if_fail (GIMP_IS_CANVAS_ITEM (item));
|
|
|
|
g_return_if_fail (GIMP_CANVAS_ITEM (group) != item);
|
|
|
|
|
2016-01-24 07:54:48 +08:00
|
|
|
if (group->priv->group_stroking)
|
2010-09-26 20:12:54 +08:00
|
|
|
gimp_canvas_item_suspend_stroking (item);
|
|
|
|
|
2016-01-24 07:54:48 +08:00
|
|
|
if (group->priv->group_filling)
|
2010-09-28 04:59:36 +08:00
|
|
|
gimp_canvas_item_suspend_filling (item);
|
|
|
|
|
2016-01-24 07:54:48 +08:00
|
|
|
g_queue_push_tail (group->priv->items, g_object_ref (item));
|
2010-10-01 23:13:00 +08:00
|
|
|
|
2010-10-02 02:41:27 +08:00
|
|
|
if (_gimp_canvas_item_needs_update (GIMP_CANVAS_ITEM (group)))
|
2010-10-01 23:13:00 +08:00
|
|
|
{
|
2010-10-19 01:59:13 +08:00
|
|
|
cairo_region_t *region = gimp_canvas_item_get_extents (item);
|
2010-10-02 02:41:27 +08:00
|
|
|
|
|
|
|
if (region)
|
|
|
|
{
|
|
|
|
_gimp_canvas_item_update (GIMP_CANVAS_ITEM (group), region);
|
2010-10-19 01:59:13 +08:00
|
|
|
cairo_region_destroy (region);
|
2010-10-02 02:41:27 +08:00
|
|
|
}
|
2010-10-01 23:13:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
g_signal_connect (item, "update",
|
|
|
|
G_CALLBACK (gimp_canvas_group_child_update),
|
|
|
|
group);
|
2010-09-25 23:14:57 +08:00
|
|
|
}
|
2010-09-26 20:12:54 +08:00
|
|
|
|
|
|
|
void
|
|
|
|
gimp_canvas_group_remove_item (GimpCanvasGroup *group,
|
|
|
|
GimpCanvasItem *item)
|
|
|
|
{
|
2016-01-24 07:54:48 +08:00
|
|
|
GList *list;
|
2010-09-26 20:12:54 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_CANVAS_GROUP (group));
|
|
|
|
g_return_if_fail (GIMP_IS_CANVAS_ITEM (item));
|
|
|
|
|
2016-01-24 07:54:48 +08:00
|
|
|
list = g_queue_find (group->priv->items, item);
|
2010-09-26 20:12:54 +08:00
|
|
|
|
2016-01-24 07:54:48 +08:00
|
|
|
g_return_if_fail (list != NULL);
|
2010-09-26 20:12:54 +08:00
|
|
|
|
2016-01-24 07:54:48 +08:00
|
|
|
g_queue_delete_link (group->priv->items, list);
|
2010-10-01 23:13:00 +08:00
|
|
|
|
2016-01-24 07:54:48 +08:00
|
|
|
if (group->priv->group_stroking)
|
2010-10-03 01:58:35 +08:00
|
|
|
gimp_canvas_item_resume_stroking (item);
|
|
|
|
|
2016-01-24 07:54:48 +08:00
|
|
|
if (group->priv->group_filling)
|
2010-10-03 01:58:35 +08:00
|
|
|
gimp_canvas_item_resume_filling (item);
|
|
|
|
|
2010-10-02 02:41:27 +08:00
|
|
|
if (_gimp_canvas_item_needs_update (GIMP_CANVAS_ITEM (group)))
|
2010-10-01 23:13:00 +08:00
|
|
|
{
|
2010-10-19 01:59:13 +08:00
|
|
|
cairo_region_t *region = gimp_canvas_item_get_extents (item);
|
2010-10-02 02:41:27 +08:00
|
|
|
|
|
|
|
if (region)
|
|
|
|
{
|
|
|
|
_gimp_canvas_item_update (GIMP_CANVAS_ITEM (group), region);
|
2010-10-19 01:59:13 +08:00
|
|
|
cairo_region_destroy (region);
|
2010-10-02 02:41:27 +08:00
|
|
|
}
|
2010-10-01 23:13:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
g_signal_handlers_disconnect_by_func (item,
|
|
|
|
gimp_canvas_group_child_update,
|
|
|
|
group);
|
|
|
|
|
2010-09-26 20:12:54 +08:00
|
|
|
g_object_unref (item);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_canvas_group_set_group_stroking (GimpCanvasGroup *group,
|
|
|
|
gboolean group_stroking)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_CANVAS_GROUP (group));
|
|
|
|
|
2016-01-24 07:54:48 +08:00
|
|
|
if (group->priv->group_stroking != group_stroking)
|
2010-10-03 01:58:35 +08:00
|
|
|
{
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
gimp_canvas_item_begin_change (GIMP_CANVAS_ITEM (group));
|
|
|
|
|
|
|
|
g_object_set (group,
|
|
|
|
"group-stroking", group_stroking ? TRUE : FALSE,
|
|
|
|
NULL);
|
|
|
|
|
2016-01-24 07:54:48 +08:00
|
|
|
for (list = group->priv->items->head; list; list = g_list_next (list))
|
2010-10-03 01:58:35 +08:00
|
|
|
{
|
2016-01-24 07:54:48 +08:00
|
|
|
if (group->priv->group_stroking)
|
2010-10-03 01:58:35 +08:00
|
|
|
gimp_canvas_item_suspend_stroking (list->data);
|
|
|
|
else
|
|
|
|
gimp_canvas_item_resume_stroking (list->data);
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_canvas_item_end_change (GIMP_CANVAS_ITEM (group));
|
|
|
|
}
|
2010-09-26 20:12:54 +08:00
|
|
|
}
|
2010-09-28 04:59:36 +08:00
|
|
|
|
|
|
|
void
|
|
|
|
gimp_canvas_group_set_group_filling (GimpCanvasGroup *group,
|
|
|
|
gboolean group_filling)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_CANVAS_GROUP (group));
|
|
|
|
|
2016-01-24 07:54:48 +08:00
|
|
|
if (group->priv->group_filling != group_filling)
|
2010-10-03 01:58:35 +08:00
|
|
|
{
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
gimp_canvas_item_begin_change (GIMP_CANVAS_ITEM (group));
|
|
|
|
|
|
|
|
g_object_set (group,
|
|
|
|
"group-filling", group_filling ? TRUE : FALSE,
|
|
|
|
NULL);
|
|
|
|
|
2016-01-24 07:54:48 +08:00
|
|
|
for (list = group->priv->items->head; list; list = g_list_next (list))
|
2010-10-03 01:58:35 +08:00
|
|
|
{
|
2016-01-24 07:54:48 +08:00
|
|
|
if (group->priv->group_filling)
|
2010-10-03 01:58:35 +08:00
|
|
|
gimp_canvas_item_suspend_filling (list->data);
|
|
|
|
else
|
|
|
|
gimp_canvas_item_resume_filling (list->data);
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_canvas_item_end_change (GIMP_CANVAS_ITEM (group));
|
|
|
|
}
|
2010-09-28 04:59:36 +08:00
|
|
|
}
|