Commit c0ebe2a8 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

app/text/Makefile.am new files that load and save text layers to/from XCF.

2003-10-27  Sven Neumann  <sven@gimp.org>

	* app/text/Makefile.am
	* app/text/gimptextlayer-xcf.[ch]: new files that load and save
	text layers to/from XCF.

	* app/xcf/xcf-load.c
	* app/xcf/xcf-save.c
	* app/text/gimptextlayer.c: removed that code here and use the new
	functions instead.

	* app/text/gimptext-parasite.[ch] (gimp_text_from_parasite): added
	a GError parameter.

	* app/text/gimptextlayer.[ch]: store the name of the parasite that
	the text layer was created from (if read from XCF). Remove the
	parasite when the text layer is edited. If a text layer wasn't
	touched, the original parasite is written back to the XCF file.

	* app/text/gimptextlayout.c (gimp_text_layout_new): handle a NULL
	text string.

	* app/tools/gimptextoptions.c: implement GimpToolOptions::reset
	and save the text across a reset.
parent 7cf23d86
2003-10-27 Sven Neumann <sven@gimp.org>
* app/text/Makefile.am
* app/text/gimptextlayer-xcf.[ch]: new files that load and save
text layers to/from XCF.
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* app/text/gimptextlayer.c: removed that code here and use the new
functions instead.
* app/text/gimptext-parasite.[ch] (gimp_text_from_parasite): added
a GError parameter.
* app/text/gimptextlayer.[ch]: store the name of the parasite that
the text layer was created from (if read from XCF). Remove the
parasite when the text layer is edited. If a text layer wasn't
touched, the original parasite is written back to the XCF file.
* app/text/gimptextlayout.c (gimp_text_layout_new): handle a NULL
text string.
* app/tools/gimptextoptions.c: implement GimpToolOptions::reset
and save the text across a reset.
2003-10-27 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpdock.c (gimp_dock_style_set): call
......@@ -40,6 +40,8 @@ libapptext_a_sources = \
gimptextlayer.h \
gimptextlayer-transform.c \
gimptextlayer-transform.h \
gimptextlayer-xcf.c \
gimptextlayer-xcf.h \
gimptextlayout.c \
gimptextlayout.h \
gimptextlayout-render.c \
......
......@@ -70,30 +70,27 @@ gimp_text_to_parasite (const GimpText *text)
}
GimpText *
gimp_text_from_parasite (const GimpParasite *parasite)
gimp_text_from_parasite (const GimpParasite *parasite,
GError **error)
{
GimpText *text;
const gchar *str;
GError *error = NULL;
g_return_val_if_fail (parasite != NULL, NULL);
g_return_val_if_fail (parasite != NULL, FALSE);
g_return_val_if_fail (strcmp (gimp_parasite_name (parasite),
gimp_text_parasite_name ()) == 0, NULL);
gimp_text_parasite_name ()) == 0, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
str = gimp_parasite_data (parasite);
g_return_val_if_fail (str != NULL, NULL);
g_return_val_if_fail (str != NULL, FALSE);
text = g_object_new (GIMP_TYPE_TEXT, NULL);
if (! gimp_config_deserialize_string (GIMP_CONFIG (text),
str,
gimp_parasite_data_size (parasite),
NULL,
&error))
{
g_warning ("Failed to deserialize text parasite: %s", error->message);
g_error_free (error);
}
gimp_config_deserialize_string (GIMP_CONFIG (text),
str,
gimp_parasite_data_size (parasite),
NULL,
error);
return text;
}
......
......@@ -24,11 +24,12 @@
const gchar * gimp_text_parasite_name (void) G_GNUC_CONST;
GimpParasite * gimp_text_to_parasite (const GimpText *text);
GimpText * gimp_text_from_parasite (const GimpParasite *parasite);
GimpParasite * gimp_text_to_parasite (const GimpText *text);
GimpText * gimp_text_from_parasite (const GimpParasite *parasite,
GError **error);
const gchar * gimp_text_gdyntext_parasite_name (void) G_GNUC_CONST;
GimpText * gimp_text_from_gdyntext_parasite (const GimpParasite *parasite);
GimpText * gimp_text_from_gdyntext_parasite (const GimpParasite *parasite);
#endif /* __GIMP_TEXT_PARASITE_H__ */
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* GimpText
* Copyright (C) 2003 Sven Neumann <sven@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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <glib-object.h>
#include "text/text-types.h"
#include "core/gimp.h"
#include "core/gimpimage.h"
#include "core/gimpparasitelist.h"
#include "gimptext.h"
#include "gimptext-parasite.h"
#include "gimptextlayer.h"
#include "gimptextlayer-xcf.h"
#include "gimp-intl.h"
static GimpLayer * gimp_text_layer_from_layer (GimpLayer *layer,
GimpText *text);
gboolean
gimp_text_layer_xcf_load_hack (GimpLayer **layer)
{
const gchar *name;
GimpText *text = NULL;
GimpParasite *parasite;
g_return_val_if_fail (layer != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_LAYER (*layer), FALSE);
name = gimp_text_parasite_name ();
parasite = gimp_item_parasite_find (GIMP_ITEM (*layer), name);
if (parasite)
{
GError *error = NULL;
text = gimp_text_from_parasite (parasite, &error);
if (error)
{
g_message (_("Problems parsing the text parasite for layer %s:\n"
"%s\n\n"
"Some text properties may be wrong. Unless you want to\n"
"edit the text layer, you don't need to worry about this."),
gimp_object_get_name (GIMP_OBJECT (*layer)),
error->message);
g_error_free (error);
}
}
else
{
name = gimp_text_gdyntext_parasite_name ();
parasite = gimp_item_parasite_find (GIMP_ITEM (*layer), name);
if (parasite)
text = gimp_text_from_gdyntext_parasite (parasite);
}
if (text)
{
*layer = gimp_text_layer_from_layer (*layer, text);
/* let the text layer know what parasite was used to create it */
GIMP_TEXT_LAYER (*layer)->text_parasite = name;
}
return (text != NULL);
}
void
gimp_text_layer_xcf_save_prepare (GimpTextLayer *layer)
{
GimpText *text;
GimpParasite *parasite;
g_return_if_fail (GIMP_IS_TEXT_LAYER (layer));
/* If the layer has a text parasite already, it wasn't changed and we
* can simply save the original parasite back which is still attached.
*/
if (layer->text_parasite)
return;
text = gimp_text_layer_get_text (layer);
parasite = gimp_text_to_parasite (text);
gimp_parasite_list_add (GIMP_ITEM (layer)->parasites, parasite);
}
/**
* gimp_text_layer_from_layer:
* @layer: a #GimpLayer object
* @text: a #GimpText object
*
* Converts a standard #GimpLayer and a #GimpText object into a
* #GimpTextLayer. The new text layer takes ownership of the @text and
* @layer objects. The @layer object is rendered unusable by this
* function. Don't even try to use if afterwards!
*
* This is a gross hack that is needed in order to load text layers
* from XCF files in a backwards-compatible way. Please don't use it
* for anything else!
*
* Return value: a newly allocated #GimpTextLayer object
**/
static GimpLayer *
gimp_text_layer_from_layer (GimpLayer *layer,
GimpText *text)
{
GimpTextLayer *text_layer;
GimpItem *item;
GimpDrawable *drawable;
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
g_return_val_if_fail (GIMP_IS_TEXT (text), NULL);
text_layer = g_object_new (GIMP_TYPE_TEXT_LAYER, NULL);
item = GIMP_ITEM (text_layer);
drawable = GIMP_DRAWABLE (text_layer);
gimp_object_set_name (GIMP_OBJECT (text_layer),
gimp_object_get_name (GIMP_OBJECT (layer)));
item->ID = gimp_item_get_ID (GIMP_ITEM (layer));
item->tattoo = gimp_item_get_tattoo (GIMP_ITEM (layer));
item->gimage = gimp_item_get_image (GIMP_ITEM (layer));
gimp_item_set_image (GIMP_ITEM (layer), NULL);
g_hash_table_replace (item->gimage->gimp->item_table,
GINT_TO_POINTER (item->ID),
item);
item->parasites = GIMP_ITEM (layer)->parasites;
GIMP_ITEM (layer)->parasites = NULL;
item->width = gimp_item_width (GIMP_ITEM (layer));
item->height = gimp_item_height (GIMP_ITEM (layer));
gimp_item_offsets (GIMP_ITEM (layer), &item->offset_x, &item->offset_y);
item->visible = gimp_item_get_visible (GIMP_ITEM (layer));
item->linked = gimp_item_get_linked (GIMP_ITEM (layer));
drawable->tiles = GIMP_DRAWABLE (layer)->tiles;
GIMP_DRAWABLE (layer)->tiles = NULL;
drawable->bytes = gimp_drawable_bytes (GIMP_DRAWABLE (layer));
drawable->type = gimp_drawable_type (GIMP_DRAWABLE (layer));
drawable->has_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
GIMP_LAYER (text_layer)->opacity = gimp_layer_get_opacity (layer);
GIMP_LAYER (text_layer)->mode = gimp_layer_get_mode (layer);
GIMP_LAYER (text_layer)->preserve_trans = gimp_layer_get_preserve_trans (layer);
gimp_text_layer_set_text (text_layer, text);
g_object_unref (text);
g_object_unref (layer);
return GIMP_LAYER (text_layer);
}
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* GimpText
* Copyright (C) 2003 Sven Neumann <sven@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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_TEXT_LAYER_XCF_H__
#define __GIMP_TEXT_LAYER_XCF_H__
gboolean gimp_text_layer_xcf_load_hack (GimpLayer **layer);
void gimp_text_layer_xcf_save_prepare (GimpTextLayer *layer);
#endif /* __GIMP_TEXT_LAYER_XCF_H__ */
......@@ -34,9 +34,12 @@
#include "paint-funcs/paint-funcs.h"
#include "config/gimpconfig.h"
#include "config/gimpconfig-params.h"
#include "config/gimpconfig-utils.h"
#include "core/gimp.h"
#include "core/gimpimage.h"
#include "core/gimpparasitelist.h"
#include "gimptext.h"
#include "gimptext-bitmap.h"
......@@ -52,12 +55,14 @@
static void gimp_text_layer_class_init (GimpTextLayerClass *klass);
static void gimp_text_layer_init (GimpTextLayer *layer);
static void gimp_text_layer_dispose (GObject *object);
static void gimp_text_layer_finalize (GObject *object);
static gsize gimp_text_layer_get_memsize (GimpObject *object,
gsize *gui_size);
static TempBuf * gimp_text_layer_get_preview (GimpViewable *viewable,
gint width,
gint height);
static GimpItem * gimp_text_layer_duplicate (GimpItem *item,
GType new_type,
gboolean add_alpha);
......@@ -65,9 +70,7 @@ static void gimp_text_layer_rename (GimpItem *item,
const gchar *new_name,
const gchar *undo_desc);
static void gimp_text_layer_set_text (GimpTextLayer *layer,
GimpText *text);
static void gimp_text_layer_notify_text (GimpTextLayer *layer);
static void gimp_text_layer_text_notify (GimpTextLayer *layer);
static gboolean gimp_text_layer_idle_render (GimpTextLayer *layer);
static gboolean gimp_text_layer_render_now (GimpTextLayer *layer);
static void gimp_text_layer_render_layout (GimpTextLayer *layer,
......@@ -121,6 +124,7 @@ gimp_text_layer_class_init (GimpTextLayerClass *klass)
parent_class = g_type_class_peek_parent (klass);
object_class->dispose = gimp_text_layer_dispose;
object_class->finalize = gimp_text_layer_finalize;
gimp_object_class->get_memsize = gimp_text_layer_get_memsize;
......@@ -143,6 +147,7 @@ static void
gimp_text_layer_init (GimpTextLayer *layer)
{
layer->text = NULL;
layer->text_parasite = NULL;
layer->idle_render_id = 0;
layer->auto_rename = TRUE;
}
......@@ -150,22 +155,29 @@ gimp_text_layer_init (GimpTextLayer *layer)
static void
gimp_text_layer_dispose (GObject *object)
{
GimpTextLayer *layer;
layer = GIMP_TEXT_LAYER (object);
GimpTextLayer *layer = GIMP_TEXT_LAYER (object);
if (layer->idle_render_id)
{
g_source_remove (layer->idle_render_id);
layer->idle_render_id = 0;
}
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gimp_text_layer_finalize (GObject *object)
{
GimpTextLayer *layer = GIMP_TEXT_LAYER (object);
if (layer->text)
{
g_object_unref (layer->text);
layer->text = NULL;
}
G_OBJECT_CLASS (parent_class)->dispose (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static gsize
......@@ -215,9 +227,10 @@ gimp_text_layer_duplicate (GimpItem *item,
new_text_layer = GIMP_TEXT_LAYER (new_item);
new_text_layer->text = gimp_config_duplicate (GIMP_CONFIG (text_layer->text));
new_text_layer->text_parasite = text_layer->text_parasite;
g_signal_connect_object (new_text_layer->text, "notify",
G_CALLBACK (gimp_text_layer_notify_text),
G_CALLBACK (gimp_text_layer_text_notify),
new_text_layer, G_CONNECT_SWAPPED);
return new_item;
......@@ -251,7 +264,7 @@ gimp_text_layer_new (GimpImage *image,
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (GIMP_IS_TEXT (text), NULL);
if (!text->text)
if (! text->text)
return NULL;
layer = g_object_new (GIMP_TYPE_TEXT_LAYER, NULL);
......@@ -273,81 +286,7 @@ gimp_text_layer_new (GimpImage *image,
return GIMP_LAYER (layer);
}
/**
* gimp_text_layer_from_layer:
* @layer: a #GimpLayer object
* @text: a #GimpText object
*
* Converts a standard #GimpLayer and a #GimpText object into a
* #GimpTextLayer. The new text layer takes ownership of the @text and
* @layer objects. The @layer object is rendered unusable by this
* function. Don't even try to use if afterwards!
*
* This is a gross hack that is needed in order to load text layers
* from XCF files in a backwards-compatible way. Please don't use it
* for anything else!
*
* Return value: a newly allocated #GimpTextLayer object
**/
GimpLayer *
gimp_text_layer_from_layer (GimpLayer *layer,
GimpText *text)
{
GimpTextLayer *text_layer;
GimpItem *item;
GimpDrawable *drawable;
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
g_return_val_if_fail (GIMP_IS_TEXT (text), NULL);
text_layer = g_object_new (GIMP_TYPE_TEXT_LAYER, NULL);
item = GIMP_ITEM (text_layer);
drawable = GIMP_DRAWABLE (text_layer);
gimp_object_set_name (GIMP_OBJECT (text_layer),
gimp_object_get_name (GIMP_OBJECT (layer)));
item->ID = gimp_item_get_ID (GIMP_ITEM (layer));
item->tattoo = gimp_item_get_tattoo (GIMP_ITEM (layer));
item->gimage = gimp_item_get_image (GIMP_ITEM (layer));
gimp_item_set_image (GIMP_ITEM (layer), NULL);
g_hash_table_replace (item->gimage->gimp->item_table,
GINT_TO_POINTER (item->ID),
item);
item->parasites = GIMP_ITEM (layer)->parasites;
GIMP_ITEM (layer)->parasites = NULL;
item->width = gimp_item_width (GIMP_ITEM (layer));
item->height = gimp_item_height (GIMP_ITEM (layer));
gimp_item_offsets (GIMP_ITEM (layer), &item->offset_x, &item->offset_y);
item->visible = gimp_item_get_visible (GIMP_ITEM (layer));
item->linked = gimp_item_get_linked (GIMP_ITEM (layer));
drawable->tiles = GIMP_DRAWABLE (layer)->tiles;
GIMP_DRAWABLE (layer)->tiles = NULL;
drawable->bytes = gimp_drawable_bytes (GIMP_DRAWABLE (layer));
drawable->type = gimp_drawable_type (GIMP_DRAWABLE (layer));
drawable->has_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
GIMP_LAYER (text_layer)->opacity = gimp_layer_get_opacity (layer);
GIMP_LAYER (text_layer)->mode = gimp_layer_get_mode (layer);
GIMP_LAYER (text_layer)->preserve_trans = gimp_layer_get_preserve_trans (layer);
gimp_text_layer_set_text (text_layer, text);
g_object_unref (layer);
g_object_unref (text);
return GIMP_LAYER (text_layer);
}
static void
void
gimp_text_layer_set_text (GimpTextLayer *layer,
GimpText *text)
{
......@@ -357,7 +296,7 @@ gimp_text_layer_set_text (GimpTextLayer *layer,
layer->text = g_object_ref (text);
g_signal_connect_object (text, "notify",
G_CALLBACK (gimp_text_layer_notify_text),
G_CALLBACK (gimp_text_layer_text_notify),
layer, G_CONNECT_SWAPPED);
}
......@@ -374,18 +313,22 @@ gimp_text_layer_render (GimpTextLayer *layer)
{
g_return_if_fail (GIMP_IS_TEXT_LAYER (layer));
if (layer->idle_render_id)
{
g_source_remove (layer->idle_render_id);
layer->idle_render_id = 0;
}
gimp_text_layer_render_now (layer);
}
static void
gimp_text_layer_notify_text (GimpTextLayer *layer)
gimp_text_layer_text_notify (GimpTextLayer *layer)
{
/* If the text layer was created from a parasite, it's time to
* remove that parasite now.
*/
if (layer->text_parasite)
{
gimp_parasite_list_remove (GIMP_ITEM (layer)->parasites,
layer->text_parasite);
layer->text_parasite = NULL;
}
if (layer->idle_render_id)
g_source_remove (layer->idle_render_id);
......@@ -415,6 +358,12 @@ gimp_text_layer_render_now (GimpTextLayer *layer)
gint width;
gint height;
if (layer->idle_render_id)
{
g_source_remove (layer->idle_render_id);
layer->idle_render_id = 0;
}
drawable = GIMP_DRAWABLE (layer);
item = GIMP_ITEM (layer);
image = gimp_item_get_image (item);
......
......@@ -41,6 +41,10 @@ struct _GimpTextLayer
GimpLayer layer;
GimpText *text;
const gchar *text_parasite; /* parasite name that this text was set from,
* and that should be removed when the text
* is changed.
*/
guint idle_render_id;
gboolean auto_rename;
};
......@@ -51,15 +55,13 @@ struct _GimpTextLayerClass
};
/* function declarations */
GType gimp_text_layer_get_type (void) G_GNUC_CONST;
GimpLayer * gimp_text_layer_new (GimpImage *image,
GimpText *text);
GimpLayer * gimp_text_layer_from_layer (GimpLayer *layer,
GimpText *text);
GimpText * gimp_text_layer_get_text (GimpTextLayer *layer);
void gimp_text_layer_set_text (GimpTextLayer *layer,
GimpText *text);
void gimp_text_layer_render (GimpTextLayer *layer);
......
......@@ -165,7 +165,10 @@ gimp_text_layout_new (GimpText *text,
pango_layout_set_font_description (layout->layout, font_desc);
pango_font_description_free (font_desc);
pango_layout_set_text (layout->layout, text->text, -1);
if (text->text)
pango_layout_set_text (layout->layout, text->text, -1);
else
pango_layout_set_text (layout->layout, NULL, 0);
switch (text->justify)
{
......
......@@ -57,25 +57,27 @@ enum
};
static void gimp_text_options_init (GimpTextOptions *options);
static void gimp_text_options_class_init (GimpTextOptionsClass *options_class);
static void gimp_text_options_finalize (GObject *object);
static void gimp_text_options_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_text_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_text_options_notify_font (GimpContext *context,
GParamSpec *pspec,
GimpText *text);
static void gimp_text_options_notify_text_font (GimpText *text,
GParamSpec *pspec,
GimpContext *context);
static void gimp_text_options_init (GimpTextOptions *options);
static void gimp_text_options_class_init (GimpTextOptionsClass *options_class);
static void gimp_text_options_finalize (GObject *object);
static void gimp_text_options_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_text_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_text_options_reset (GimpToolOptions *options);
static void gimp_text_options_notify_font (GimpContext *context,
GParamSpec *pspec,
GimpText *text);
static void gimp_text_options_notify_text_font (GimpText *text,
GParamSpec *pspec,
GimpContext *context);
static GimpToolOptionsClass *parent_class = NULL;
......@@ -112,9 +114,11 @@ gimp_text_options_get_type (void)
static void
gimp_text_options_class_init (GimpTextOptionsClass *klass)
{
GObjectClass *object_class;
GObjectClass *object_class;
GimpToolOptionsClass *options_class;
object_class = G_OBJECT_CLASS (klass);
options_class = GIMP_TOOL_OPTIONS_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
......@@ -122,6 +126,8 @@ gimp_text_options_class_init (GimpTextOptionsClass *klass)
object_class->set_property = gimp_text_options_set_property;
object_class->get_property = gimp_text_options_get_property;
options_class->reset = gimp_text_options_reset;
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_TEXT,
"text", NULL,
GIMP_TYPE_TEXT,
......@@ -203,6 +209,24 @@ gimp_text_options_get_property (GObject *object,
}
}
static void
gimp_text_options_reset (GimpToolOptions *options)
{
GimpTextOptions *text_options = GIMP_TEXT_OPTIONS (options);
gchar *text;
g_object_freeze_notify (G_OBJECT (text_options->text));
text = text_options->text->text;
text_options->text->text = NULL;
GIMP_TOOL_OPTIONS_CLASS (parent_class)->reset (options);
text_options->text->text = text;
g_object_thaw_notify (G_OBJECT (text_options->text));
}
static void
gimp_text_options_notify_font (GimpContext *context,
GParamSpec *pspec,
......
......@@ -49,8 +49,7 @@
#include "core/gimptemplate.h"
#include "core/gimpunit.h"
#include "text/gimptextlayer.h"
#include "text/gimptext-parasite.h"
#include "text/gimptextlayer-xcf.h"
#include "vectors/gimpanchor.h"
#include "vectors/gimpstroke.h"
......@@ -790,18 +789,18 @@ xcf_load_layer (XcfInfo *info,
{
GimpLayer *layer;
GimpLayerMask *layer_mask;
GimpParasite *parasite;
guint32 hierarchy_offset;
guint32 layer_mask_offset;
gboolean apply_mask;
gboolean edit_mask;
gboolean show_mask;
gboolean active;
gboolean floating;
gint width;
gint height;
gint type;
gint add_floating_sel;
gchar *name;
GimpText *text = NULL;
/* check and see if this is the drawable the floating selection
* is attached to. if it is then we'll do the attachment at
......@@ -827,35 +826,12 @@ xcf_load_layer (XcfInfo *info,
&apply_mask, &edit_mask, &show_mask))
goto error;
/* check for a gimp-text parasite */
parasite = gimp_item_parasite_find (GIMP_ITEM (layer),
gimp_text_parasite_name ());
if (parasite)
{
text = gimp_text_from_parasite (parasite);
/* call the evil text layer hack that might change our layer pointer */
active = (info->active_layer == layer);
floating = (info->floating_sel == layer);
if (text)
gimp_parasite_list_remove (GIMP_ITEM (layer)->parasites,
gimp_parasite_name (parasite));
}
else
if (gimp_text_layer_xcf_load_hack (&layer))
{