2009-08-04 05:24:46 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* GimpGroupLayer
|
|
|
|
* Copyright (C) 2009 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
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <gegl.h>
|
|
|
|
|
2009-08-24 05:00:32 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
|
|
|
|
2009-08-04 05:24:46 +08:00
|
|
|
#include "core-types.h"
|
|
|
|
|
2009-08-24 05:00:32 +08:00
|
|
|
#include "base/tile-manager.h"
|
|
|
|
|
2009-08-04 05:24:46 +08:00
|
|
|
#include "gimpgrouplayer.h"
|
|
|
|
#include "gimpimage.h"
|
|
|
|
#include "gimpdrawablestack.h"
|
2009-08-24 22:03:21 +08:00
|
|
|
#include "gimppickable.h"
|
|
|
|
#include "gimpprojectable.h"
|
|
|
|
#include "gimpprojection.h"
|
2009-08-04 05:24:46 +08:00
|
|
|
|
|
|
|
#include "gimp-intl.h"
|
|
|
|
|
|
|
|
|
2009-08-24 02:02:36 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_LOCK_CONTENT
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-08-24 22:03:21 +08:00
|
|
|
static void gimp_projectable_iface_init (GimpProjectableInterface *iface);
|
|
|
|
|
|
|
|
static void gimp_group_layer_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gimp_group_layer_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gimp_group_layer_finalize (GObject *object);
|
|
|
|
|
|
|
|
static gint64 gimp_group_layer_get_memsize (GimpObject *object,
|
|
|
|
gint64 *gui_size);
|
|
|
|
|
|
|
|
static GimpContainer * gimp_group_layer_get_children (GimpViewable *viewable);
|
|
|
|
|
|
|
|
static GimpItem * gimp_group_layer_duplicate (GimpItem *item,
|
|
|
|
GType new_type);
|
|
|
|
|
|
|
|
static GeglNode * gimp_group_layer_get_graph (GimpProjectable *projectable);
|
|
|
|
static GList * gimp_group_layer_get_layers (GimpProjectable *projectable);
|
|
|
|
|
|
|
|
static void gimp_group_layer_child_add (GimpContainer *container,
|
|
|
|
GimpLayer *child,
|
|
|
|
GimpGroupLayer *group);
|
|
|
|
static void gimp_group_layer_child_remove (GimpContainer *container,
|
|
|
|
GimpLayer *child,
|
|
|
|
GimpGroupLayer *group);
|
|
|
|
static void gimp_group_layer_child_move (GimpLayer *child,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
GimpGroupLayer *group);
|
|
|
|
static void gimp_group_layer_child_resize (GimpLayer *child,
|
|
|
|
GimpGroupLayer *group);
|
|
|
|
|
|
|
|
static void gimp_group_layer_update_size (GimpGroupLayer *group);
|
|
|
|
|
|
|
|
static void gimp_group_layer_stack_update (GimpDrawableStack *stack,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GimpGroupLayer *group);
|
|
|
|
static void gimp_group_layer_proj_update (GimpProjection *proj,
|
|
|
|
gboolean now,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GimpGroupLayer *group);
|
|
|
|
|
|
|
|
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GimpGroupLayer, gimp_group_layer, GIMP_TYPE_LAYER,
|
|
|
|
G_IMPLEMENT_INTERFACE (GIMP_TYPE_PROJECTABLE,
|
|
|
|
gimp_projectable_iface_init))
|
2009-08-04 05:24:46 +08:00
|
|
|
|
|
|
|
#define parent_class gimp_group_layer_parent_class
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_group_layer_class_init (GimpGroupLayerClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
|
|
|
GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
|
|
|
GimpItemClass *item_class = GIMP_ITEM_CLASS (klass);
|
|
|
|
|
2009-08-24 02:02:36 +08:00
|
|
|
object_class->set_property = gimp_group_layer_set_property;
|
|
|
|
object_class->get_property = gimp_group_layer_get_property;
|
2009-08-04 05:24:46 +08:00
|
|
|
object_class->finalize = gimp_group_layer_finalize;
|
|
|
|
|
|
|
|
gimp_object_class->get_memsize = gimp_group_layer_get_memsize;
|
|
|
|
|
|
|
|
viewable_class->default_stock_id = "gtk-directory";
|
|
|
|
viewable_class->get_children = gimp_group_layer_get_children;
|
|
|
|
|
|
|
|
item_class->duplicate = gimp_group_layer_duplicate;
|
|
|
|
|
|
|
|
item_class->default_name = _("Group Layer");
|
|
|
|
item_class->rename_desc = _("Rename Group Layer");
|
|
|
|
item_class->translate_desc = _("Move Group Layer");
|
|
|
|
item_class->scale_desc = _("Scale Group Layer");
|
|
|
|
item_class->resize_desc = _("Resize Group Layer");
|
|
|
|
item_class->flip_desc = _("Flip Group Layer");
|
|
|
|
item_class->rotate_desc = _("Rotate Group Layer");
|
|
|
|
item_class->transform_desc = _("Transform Group Layer");
|
2009-08-24 02:02:36 +08:00
|
|
|
|
|
|
|
g_object_class_install_property (object_class, PROP_LOCK_CONTENT,
|
|
|
|
g_param_spec_boolean ("lock-content",
|
|
|
|
NULL, NULL,
|
|
|
|
TRUE,
|
|
|
|
GIMP_PARAM_READABLE));
|
2009-08-04 05:24:46 +08:00
|
|
|
}
|
|
|
|
|
2009-08-24 22:03:21 +08:00
|
|
|
static void
|
|
|
|
gimp_projectable_iface_init (GimpProjectableInterface *iface)
|
|
|
|
{
|
|
|
|
iface->get_image = (GimpImage * (*) (GimpProjectable *)) gimp_item_get_image;
|
|
|
|
iface->get_offset = (void (*) (GimpProjectable*, gint*, gint*)) gimp_item_get_offset;
|
|
|
|
iface->get_size = (void (*) (GimpProjectable*, gint*, gint*)) gimp_viewable_get_size;
|
|
|
|
iface->get_graph = gimp_group_layer_get_graph;
|
|
|
|
iface->invalidate_preview = (void (*) (GimpProjectable*)) gimp_viewable_invalidate_preview;
|
|
|
|
iface->get_layers = gimp_group_layer_get_layers;
|
|
|
|
iface->get_channels = NULL;
|
|
|
|
}
|
|
|
|
|
2009-08-04 05:24:46 +08:00
|
|
|
static void
|
2009-08-24 06:34:12 +08:00
|
|
|
gimp_group_layer_init (GimpGroupLayer *group)
|
2009-08-04 05:24:46 +08:00
|
|
|
{
|
2009-08-24 06:34:12 +08:00
|
|
|
GIMP_ITEM (group)->lock_content = TRUE;
|
2009-08-24 02:02:36 +08:00
|
|
|
|
2009-08-24 06:34:12 +08:00
|
|
|
group->children = gimp_drawable_stack_new (GIMP_TYPE_LAYER);
|
2009-08-24 05:00:32 +08:00
|
|
|
|
2009-08-24 06:34:12 +08:00
|
|
|
g_signal_connect (group->children, "add",
|
2009-08-24 05:00:32 +08:00
|
|
|
G_CALLBACK (gimp_group_layer_child_add),
|
2009-08-24 06:34:12 +08:00
|
|
|
group);
|
|
|
|
g_signal_connect (group->children, "remove",
|
2009-08-24 05:00:32 +08:00
|
|
|
G_CALLBACK (gimp_group_layer_child_remove),
|
2009-08-24 06:34:12 +08:00
|
|
|
group);
|
2009-08-24 05:00:32 +08:00
|
|
|
|
2009-08-24 06:34:12 +08:00
|
|
|
gimp_container_add_handler (group->children, "notify::offset-x",
|
2009-08-24 05:00:32 +08:00
|
|
|
G_CALLBACK (gimp_group_layer_child_move),
|
2009-08-24 06:34:12 +08:00
|
|
|
group);
|
|
|
|
gimp_container_add_handler (group->children, "notify::offset-y",
|
2009-08-24 05:00:32 +08:00
|
|
|
G_CALLBACK (gimp_group_layer_child_move),
|
2009-08-24 06:34:12 +08:00
|
|
|
group);
|
|
|
|
gimp_container_add_handler (group->children, "size-changed",
|
2009-08-24 05:00:32 +08:00
|
|
|
G_CALLBACK (gimp_group_layer_child_resize),
|
2009-08-24 06:34:12 +08:00
|
|
|
group);
|
2009-08-24 22:03:21 +08:00
|
|
|
|
|
|
|
g_signal_connect (group->children, "update",
|
|
|
|
G_CALLBACK (gimp_group_layer_stack_update),
|
|
|
|
group);
|
|
|
|
|
|
|
|
group->projection = gimp_projection_new (GIMP_PROJECTABLE (group));
|
|
|
|
|
|
|
|
g_signal_connect (group->projection, "update",
|
|
|
|
G_CALLBACK (gimp_group_layer_proj_update),
|
|
|
|
group);
|
2009-08-04 05:24:46 +08:00
|
|
|
}
|
|
|
|
|
2009-08-24 02:02:36 +08:00
|
|
|
static void
|
|
|
|
gimp_group_layer_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_group_layer_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GimpItem *item = GIMP_ITEM (object);
|
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_LOCK_CONTENT:
|
|
|
|
g_value_set_boolean (value, gimp_item_get_lock_content (item));
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-04 05:24:46 +08:00
|
|
|
static void
|
|
|
|
gimp_group_layer_finalize (GObject *object)
|
|
|
|
{
|
2009-08-24 06:34:12 +08:00
|
|
|
GimpGroupLayer *group = GIMP_GROUP_LAYER (object);
|
2009-08-04 05:24:46 +08:00
|
|
|
|
2009-08-24 06:34:12 +08:00
|
|
|
if (group->children)
|
2009-08-04 05:24:46 +08:00
|
|
|
{
|
2009-08-24 06:34:12 +08:00
|
|
|
g_signal_handlers_disconnect_by_func (group->children,
|
2009-08-24 05:00:32 +08:00
|
|
|
gimp_group_layer_child_add,
|
2009-08-24 06:34:12 +08:00
|
|
|
group);
|
|
|
|
g_signal_handlers_disconnect_by_func (group->children,
|
2009-08-24 05:00:32 +08:00
|
|
|
gimp_group_layer_child_remove,
|
2009-08-24 06:34:12 +08:00
|
|
|
group);
|
2009-08-24 23:30:41 +08:00
|
|
|
g_signal_handlers_disconnect_by_func (group->children,
|
|
|
|
gimp_group_layer_stack_update,
|
|
|
|
group);
|
2009-08-24 05:00:32 +08:00
|
|
|
|
2009-08-24 06:34:12 +08:00
|
|
|
g_object_unref (group->children);
|
|
|
|
group->children = NULL;
|
2009-08-04 05:24:46 +08:00
|
|
|
}
|
|
|
|
|
2009-08-24 23:30:41 +08:00
|
|
|
if (group->projection)
|
|
|
|
{
|
|
|
|
g_object_unref (group->projection);
|
|
|
|
group->projection = NULL;
|
|
|
|
}
|
|
|
|
|
2009-08-04 05:24:46 +08:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint64
|
|
|
|
gimp_group_layer_get_memsize (GimpObject *object,
|
|
|
|
gint64 *gui_size)
|
|
|
|
{
|
2009-08-24 06:34:12 +08:00
|
|
|
GimpGroupLayer *group = GIMP_GROUP_LAYER (object);
|
2009-08-04 05:24:46 +08:00
|
|
|
gint64 memsize = 0;
|
|
|
|
|
2009-08-24 06:34:12 +08:00
|
|
|
memsize += gimp_object_get_memsize (GIMP_OBJECT (group->children), gui_size);
|
2009-08-04 05:24:46 +08:00
|
|
|
|
|
|
|
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
|
|
|
|
gui_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GimpContainer *
|
|
|
|
gimp_group_layer_get_children (GimpViewable *viewable)
|
|
|
|
{
|
2009-08-24 06:34:12 +08:00
|
|
|
GimpGroupLayer *group = GIMP_GROUP_LAYER (viewable);
|
2009-08-04 05:24:46 +08:00
|
|
|
|
2009-08-24 06:34:12 +08:00
|
|
|
return group->children;
|
2009-08-04 05:24:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static GimpItem *
|
|
|
|
gimp_group_layer_duplicate (GimpItem *item,
|
|
|
|
GType new_type)
|
|
|
|
{
|
|
|
|
GimpItem *new_item;
|
|
|
|
|
|
|
|
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_GROUP_LAYER), NULL);
|
|
|
|
|
|
|
|
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type);
|
|
|
|
|
|
|
|
if (GIMP_IS_GROUP_LAYER (new_item))
|
|
|
|
{
|
2009-08-24 06:34:12 +08:00
|
|
|
GimpGroupLayer *group = GIMP_GROUP_LAYER (item);
|
|
|
|
GimpGroupLayer *new_group = GIMP_GROUP_LAYER (new_item);
|
2009-08-04 05:24:46 +08:00
|
|
|
GList *list;
|
|
|
|
gint position;
|
|
|
|
|
2009-08-24 06:34:12 +08:00
|
|
|
for (list = GIMP_LIST (group->children)->list, position = 0;
|
2009-08-04 05:24:46 +08:00
|
|
|
list;
|
|
|
|
list = g_list_next (list))
|
|
|
|
{
|
|
|
|
GimpItem *child = list->data;
|
|
|
|
GimpItem *new_child;
|
|
|
|
|
|
|
|
new_child = gimp_item_duplicate (child, G_TYPE_FROM_INSTANCE (child));
|
|
|
|
|
2009-08-04 06:14:53 +08:00
|
|
|
gimp_viewable_set_parent (GIMP_VIEWABLE (new_child),
|
2009-08-24 06:34:12 +08:00
|
|
|
GIMP_VIEWABLE (new_group));
|
2009-08-04 06:14:53 +08:00
|
|
|
|
2009-08-24 06:34:12 +08:00
|
|
|
gimp_container_insert (new_group->children,
|
2009-08-04 05:24:46 +08:00
|
|
|
GIMP_OBJECT (new_child),
|
|
|
|
position);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return new_item;
|
|
|
|
}
|
|
|
|
|
2009-08-24 22:03:21 +08:00
|
|
|
static GeglNode *
|
|
|
|
gimp_group_layer_get_graph (GimpProjectable *projectable)
|
|
|
|
{
|
|
|
|
GimpGroupLayer *group = GIMP_GROUP_LAYER (projectable);
|
|
|
|
|
|
|
|
return gimp_drawable_stack_get_graph (GIMP_DRAWABLE_STACK (group->children));
|
|
|
|
}
|
|
|
|
|
|
|
|
static GList *
|
|
|
|
gimp_group_layer_get_layers (GimpProjectable *projectable)
|
|
|
|
{
|
|
|
|
GimpGroupLayer *group = GIMP_GROUP_LAYER (projectable);
|
|
|
|
|
|
|
|
return gimp_item_stack_get_item_iter (GIMP_ITEM_STACK (group->children));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* public functions */
|
|
|
|
|
2009-08-04 05:24:46 +08:00
|
|
|
GimpLayer *
|
|
|
|
gimp_group_layer_new (GimpImage *image)
|
|
|
|
{
|
2009-08-24 06:34:12 +08:00
|
|
|
GimpGroupLayer *group;
|
2009-08-04 05:24:46 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
|
2009-08-24 06:34:12 +08:00
|
|
|
group = g_object_new (GIMP_TYPE_GROUP_LAYER, NULL);
|
2009-08-04 05:24:46 +08:00
|
|
|
|
2009-08-24 06:34:12 +08:00
|
|
|
gimp_drawable_configure (GIMP_DRAWABLE (group),
|
2009-08-04 05:24:46 +08:00
|
|
|
image,
|
|
|
|
0, 0, 1, 1,
|
|
|
|
gimp_image_base_type_with_alpha (image),
|
2009-08-04 06:14:53 +08:00
|
|
|
_("Group Layer"));
|
2009-08-04 05:24:46 +08:00
|
|
|
|
2009-08-24 06:34:12 +08:00
|
|
|
return GIMP_LAYER (group);
|
2009-08-04 05:24:46 +08:00
|
|
|
}
|
2009-08-24 05:00:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_group_layer_child_add (GimpContainer *container,
|
|
|
|
GimpLayer *child,
|
|
|
|
GimpGroupLayer *group)
|
|
|
|
{
|
|
|
|
gimp_group_layer_update_size (group);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_group_layer_child_remove (GimpContainer *container,
|
|
|
|
GimpLayer *child,
|
|
|
|
GimpGroupLayer *group)
|
|
|
|
{
|
|
|
|
gimp_group_layer_update_size (group);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_group_layer_child_move (GimpLayer *child,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
GimpGroupLayer *group)
|
|
|
|
{
|
|
|
|
gimp_group_layer_update_size (group);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_group_layer_child_resize (GimpLayer *child,
|
|
|
|
GimpGroupLayer *group)
|
|
|
|
{
|
|
|
|
gimp_group_layer_update_size (group);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-08-24 06:34:12 +08:00
|
|
|
gimp_group_layer_update_size (GimpGroupLayer *group)
|
2009-08-24 05:00:32 +08:00
|
|
|
{
|
|
|
|
GList *list;
|
|
|
|
gint x = 0;
|
|
|
|
gint y = 0;
|
|
|
|
gint width = 1;
|
|
|
|
gint height = 1;
|
|
|
|
gboolean first = TRUE;
|
|
|
|
|
2009-08-24 22:03:21 +08:00
|
|
|
for (list = gimp_item_stack_get_item_iter (GIMP_ITEM_STACK (group->children));
|
2009-08-24 05:00:32 +08:00
|
|
|
list;
|
|
|
|
list = g_list_next (list))
|
|
|
|
{
|
|
|
|
GimpItem *child = list->data;
|
|
|
|
|
|
|
|
if (first)
|
|
|
|
{
|
|
|
|
x = gimp_item_get_offset_x (child);
|
|
|
|
y = gimp_item_get_offset_y (child);
|
|
|
|
width = gimp_item_get_width (child);
|
|
|
|
height = gimp_item_get_height (child);
|
|
|
|
|
|
|
|
first = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gimp_rectangle_union (x, y, width, height,
|
|
|
|
gimp_item_get_offset_x (child),
|
|
|
|
gimp_item_get_offset_y (child),
|
|
|
|
gimp_item_get_width (child),
|
|
|
|
gimp_item_get_height (child),
|
|
|
|
&x, &y, &width, &height);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-24 06:34:12 +08:00
|
|
|
if (x != gimp_item_get_offset_x (GIMP_ITEM (group)) ||
|
|
|
|
y != gimp_item_get_offset_y (GIMP_ITEM (group)) ||
|
|
|
|
width != gimp_item_get_width (GIMP_ITEM (group)) ||
|
|
|
|
height != gimp_item_get_height (GIMP_ITEM (group)))
|
2009-08-24 05:00:32 +08:00
|
|
|
{
|
2009-08-24 06:34:12 +08:00
|
|
|
if (width != gimp_item_get_width (GIMP_ITEM (group)) ||
|
|
|
|
height != gimp_item_get_height (GIMP_ITEM (group)))
|
2009-08-24 05:00:32 +08:00
|
|
|
{
|
|
|
|
TileManager *tiles;
|
|
|
|
|
2009-08-24 22:03:21 +08:00
|
|
|
GIMP_ITEM (group)->width = width;
|
|
|
|
GIMP_ITEM (group)->height = height;
|
|
|
|
|
|
|
|
gimp_projectable_structure_changed (GIMP_PROJECTABLE (group));
|
|
|
|
|
|
|
|
tiles = gimp_projection_get_tiles_at_level (group->projection,
|
|
|
|
0, NULL);
|
2009-08-24 05:00:32 +08:00
|
|
|
|
2009-08-24 06:34:12 +08:00
|
|
|
gimp_drawable_set_tiles_full (GIMP_DRAWABLE (group),
|
2009-08-24 05:00:32 +08:00
|
|
|
FALSE, NULL,
|
|
|
|
tiles,
|
2009-08-24 06:34:12 +08:00
|
|
|
gimp_drawable_type (GIMP_DRAWABLE (group)),
|
2009-08-24 05:00:32 +08:00
|
|
|
x, y);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-08-24 06:34:12 +08:00
|
|
|
gimp_item_translate (GIMP_ITEM (group),
|
|
|
|
x - gimp_item_get_offset_x (GIMP_ITEM (group)),
|
|
|
|
y - gimp_item_get_offset_y (GIMP_ITEM (group)),
|
2009-08-24 05:00:32 +08:00
|
|
|
FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-08-24 22:03:21 +08:00
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_group_layer_stack_update (GimpDrawableStack *stack,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GimpGroupLayer *group)
|
|
|
|
{
|
|
|
|
/* the layer stack's update signal speaks in image coordinates,
|
|
|
|
* pass to the projection as-is.
|
|
|
|
*/
|
|
|
|
gimp_projectable_update (GIMP_PROJECTABLE (group),
|
|
|
|
x, y, width, height);
|
|
|
|
|
|
|
|
/* flush the pickable not the projectable because flushing the
|
|
|
|
* pickable will finish all invalidation on the projection so it
|
|
|
|
* can be used as source (note that it will still be constructed
|
|
|
|
* when the actual read happens, so this it not a performance
|
|
|
|
* problem)
|
|
|
|
*/
|
|
|
|
gimp_pickable_flush (GIMP_PICKABLE (group->projection));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_group_layer_proj_update (GimpProjection *proj,
|
|
|
|
gboolean now,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GimpGroupLayer *group)
|
|
|
|
{
|
|
|
|
/* the projection speaks in image coordinates, transform to layer
|
|
|
|
* coordinates when emitting our own update signal.
|
|
|
|
*/
|
|
|
|
gimp_drawable_update (GIMP_DRAWABLE (group),
|
|
|
|
x - gimp_item_get_offset_x (GIMP_ITEM (group)),
|
|
|
|
y - gimp_item_get_offset_y (GIMP_ITEM (group)),
|
|
|
|
width, height);
|
|
|
|
}
|