mirror of https://github.com/GNOME/gimp.git
implement GimpDrawable functions that affect the tiles and mark the text
2004-03-13 Sven Neumann <sven@gimp.org> * app/text/gimptextlayer.[ch]: implement GimpDrawable functions that affect the tiles and mark the text layer as modified. Added new function gimp_drawable_is_text_layer() that checks whether a drawable is an unmodified text layer. * app/display/gimpdisplayshell-dnd.c (gimp_display_shell_bucket_fill): use gimp_drawable_is_text_layer() and only set the text color if the text layer is unmodified. Fixes bug #136623.
This commit is contained in:
parent
c179f9acaf
commit
f81e2f3d68
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
2004-03-13 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* app/text/gimptextlayer.[ch]: implement GimpDrawable functions
|
||||||
|
that affect the tiles and mark the text layer as modified. Added
|
||||||
|
new function gimp_drawable_is_text_layer() that checks whether a
|
||||||
|
drawable is an unmodified text layer.
|
||||||
|
|
||||||
|
* app/display/gimpdisplayshell-dnd.c (gimp_display_shell_bucket_fill):
|
||||||
|
use gimp_drawable_is_text_layer() and only set the text color if the
|
||||||
|
text layer is unmodified. Fixes bug #136623.
|
||||||
|
|
||||||
2004-03-13 Sven Neumann <sven@gimp.org>
|
2004-03-13 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/core/gimpdrawable.[ch]: added new virtual function
|
* app/core/gimpdrawable.[ch]: added new virtual function
|
||||||
|
|
|
@ -177,7 +177,6 @@ gimp_display_shell_bucket_fill (GimpDisplayShell *shell,
|
||||||
{
|
{
|
||||||
GimpImage *gimage = shell->gdisp->gimage;
|
GimpImage *gimage = shell->gdisp->gimage;
|
||||||
GimpDrawable *drawable;
|
GimpDrawable *drawable;
|
||||||
GimpText *text;
|
|
||||||
|
|
||||||
if (gimage->gimp->busy)
|
if (gimage->gimp->busy)
|
||||||
return;
|
return;
|
||||||
|
@ -188,12 +187,12 @@ gimp_display_shell_bucket_fill (GimpDisplayShell *shell,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* FIXME: there should be a virtual method for this that the
|
/* FIXME: there should be a virtual method for this that the
|
||||||
GimpTextLayer can override. */
|
* GimpTextLayer can override.
|
||||||
|
*/
|
||||||
if (color &&
|
if (color && gimp_drawable_is_text_layer (drawable))
|
||||||
GIMP_IS_TEXT_LAYER (drawable) &&
|
|
||||||
(text = gimp_text_layer_get_text (GIMP_TEXT_LAYER (drawable))) != NULL)
|
|
||||||
{
|
{
|
||||||
|
GimpText *text = gimp_text_layer_get_text (GIMP_TEXT_LAYER (drawable));
|
||||||
|
|
||||||
g_object_set (text, "color", color, NULL);
|
g_object_set (text, "color", color, NULL);
|
||||||
gimp_text_layer_flush (GIMP_TEXT_LAYER (drawable));
|
gimp_text_layer_flush (GIMP_TEXT_LAYER (drawable));
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,26 +54,49 @@
|
||||||
#include "gimp-intl.h"
|
#include "gimp-intl.h"
|
||||||
|
|
||||||
|
|
||||||
static void gimp_text_layer_class_init (GimpTextLayerClass *klass);
|
static void gimp_text_layer_class_init (GimpTextLayerClass *klass);
|
||||||
static void gimp_text_layer_init (GimpTextLayer *layer);
|
static void gimp_text_layer_init (GimpTextLayer *layer);
|
||||||
static void gimp_text_layer_dispose (GObject *object);
|
static void gimp_text_layer_dispose (GObject *object);
|
||||||
static void gimp_text_layer_finalize (GObject *object);
|
static void gimp_text_layer_finalize (GObject *object);
|
||||||
|
|
||||||
static gint64 gimp_text_layer_get_memsize (GimpObject *object,
|
static gint64 gimp_text_layer_get_memsize (GimpObject *object,
|
||||||
gint64 *gui_size);
|
gint64 *gui_size);
|
||||||
|
|
||||||
static GimpItem * gimp_text_layer_duplicate (GimpItem *item,
|
static GimpItem * gimp_text_layer_duplicate (GimpItem *item,
|
||||||
GType new_type,
|
GType new_type,
|
||||||
gboolean add_alpha);
|
gboolean add_alpha);
|
||||||
static gboolean gimp_text_layer_rename (GimpItem *item,
|
static gboolean gimp_text_layer_rename (GimpItem *item,
|
||||||
const gchar *new_name,
|
const gchar *new_name,
|
||||||
const gchar *undo_desc);
|
const gchar *undo_desc);
|
||||||
|
|
||||||
static void gimp_text_layer_text_notify (GimpTextLayer *layer);
|
static void gimp_text_layer_apply_region (GimpDrawable *drawable,
|
||||||
static gboolean gimp_text_layer_idle_render (GimpTextLayer *layer);
|
PixelRegion *src2PR,
|
||||||
static gboolean gimp_text_layer_render_now (GimpTextLayer *layer);
|
gboolean push_undo,
|
||||||
static void gimp_text_layer_render_layout (GimpTextLayer *layer,
|
const gchar *undo_desc,
|
||||||
GimpTextLayout *layout);
|
gdouble opacity,
|
||||||
|
GimpLayerModeEffects mode,
|
||||||
|
TileManager *src1_tiles,
|
||||||
|
gint x,
|
||||||
|
gint y);
|
||||||
|
static void gimp_text_layer_replace_region (GimpDrawable *drawable,
|
||||||
|
PixelRegion *src2PR,
|
||||||
|
gboolean push_undo,
|
||||||
|
const gchar *undo_desc,
|
||||||
|
gdouble opacity,
|
||||||
|
PixelRegion *maskPR,
|
||||||
|
gint x,
|
||||||
|
gint y);
|
||||||
|
static void gimp_text_layer_set_tiles (GimpDrawable *drawable,
|
||||||
|
gboolean push_undo,
|
||||||
|
const gchar *undo_desc,
|
||||||
|
TileManager *tiles,
|
||||||
|
GimpImageType type);
|
||||||
|
|
||||||
|
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,
|
||||||
|
GimpTextLayout *layout);
|
||||||
|
|
||||||
|
|
||||||
static GimpLayerClass *parent_class = NULL;
|
static GimpLayerClass *parent_class = NULL;
|
||||||
|
@ -110,15 +133,11 @@ gimp_text_layer_get_type (void)
|
||||||
static void
|
static void
|
||||||
gimp_text_layer_class_init (GimpTextLayerClass *klass)
|
gimp_text_layer_class_init (GimpTextLayerClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class;
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
GimpObjectClass *gimp_object_class;
|
GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||||
GimpViewableClass *viewable_class;
|
GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||||
GimpItemClass *item_class;
|
GimpItemClass *item_class = GIMP_ITEM_CLASS (klass);
|
||||||
|
GimpDrawableClass *drawable_class = GIMP_DRAWABLE_CLASS (klass);
|
||||||
object_class = G_OBJECT_CLASS (klass);
|
|
||||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
|
||||||
viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
|
||||||
item_class = GIMP_ITEM_CLASS (klass);
|
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (klass);
|
parent_class = g_type_class_peek_parent (klass);
|
||||||
|
|
||||||
|
@ -139,6 +158,10 @@ gimp_text_layer_class_init (GimpTextLayerClass *klass)
|
||||||
item_class->rotate = gimp_text_layer_rotate;
|
item_class->rotate = gimp_text_layer_rotate;
|
||||||
item_class->transform = gimp_text_layer_transform;
|
item_class->transform = gimp_text_layer_transform;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
drawable_class->apply_region = gimp_text_layer_apply_region;
|
||||||
|
drawable_class->replace_region = gimp_text_layer_replace_region;
|
||||||
|
drawable_class->set_tiles = gimp_text_layer_set_tiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -148,6 +171,7 @@ gimp_text_layer_init (GimpTextLayer *layer)
|
||||||
layer->text_parasite = NULL;
|
layer->text_parasite = NULL;
|
||||||
layer->idle_render_id = 0;
|
layer->idle_render_id = 0;
|
||||||
layer->auto_rename = TRUE;
|
layer->auto_rename = TRUE;
|
||||||
|
layer->modified = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -245,6 +269,55 @@ gimp_text_layer_rename (GimpItem *item,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_text_layer_apply_region (GimpDrawable *drawable,
|
||||||
|
PixelRegion *src2PR,
|
||||||
|
gboolean push_undo,
|
||||||
|
const gchar *undo_desc,
|
||||||
|
gdouble opacity,
|
||||||
|
GimpLayerModeEffects mode,
|
||||||
|
TileManager *src1_tiles,
|
||||||
|
gint x,
|
||||||
|
gint y)
|
||||||
|
{
|
||||||
|
GIMP_DRAWABLE_CLASS (parent_class)->apply_region (drawable, src2PR,
|
||||||
|
push_undo, undo_desc,
|
||||||
|
opacity, mode,
|
||||||
|
src1_tiles, x, y);
|
||||||
|
GIMP_TEXT_LAYER (drawable)->modified = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_text_layer_replace_region (GimpDrawable *drawable,
|
||||||
|
PixelRegion *src2PR,
|
||||||
|
gboolean push_undo,
|
||||||
|
const gchar *undo_desc,
|
||||||
|
gdouble opacity,
|
||||||
|
PixelRegion *maskPR,
|
||||||
|
gint x,
|
||||||
|
gint y)
|
||||||
|
{
|
||||||
|
GIMP_DRAWABLE_CLASS (parent_class)->replace_region (drawable, src2PR,
|
||||||
|
push_undo, undo_desc,
|
||||||
|
opacity,
|
||||||
|
maskPR, x, y);
|
||||||
|
GIMP_TEXT_LAYER (drawable)->modified = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_text_layer_set_tiles (GimpDrawable *drawable,
|
||||||
|
gboolean push_undo,
|
||||||
|
const gchar *undo_desc,
|
||||||
|
TileManager *tiles,
|
||||||
|
GimpImageType type)
|
||||||
|
{
|
||||||
|
GIMP_DRAWABLE_CLASS (parent_class)->set_tiles (drawable,
|
||||||
|
push_undo, undo_desc,
|
||||||
|
tiles, type);
|
||||||
|
GIMP_TEXT_LAYER (drawable)->modified = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gimp_text_layer_new:
|
* gimp_text_layer_new:
|
||||||
* @image: the #GimpImage the layer should belong to
|
* @image: the #GimpImage the layer should belong to
|
||||||
|
@ -327,6 +400,16 @@ gimp_text_layer_get_text (GimpTextLayer *layer)
|
||||||
return layer->text;
|
return layer->text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gimp_drawable_is_text_layer (GimpDrawable *drawable)
|
||||||
|
{
|
||||||
|
return (GIMP_IS_TEXT_LAYER (drawable) &&
|
||||||
|
GIMP_TEXT_LAYER (drawable)->text &&
|
||||||
|
GIMP_TEXT_LAYER (drawable)->modified == FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gimp_text_layer_discard:
|
* gimp_text_layer_discard:
|
||||||
* @layer: a #GimpTextLayer
|
* @layer: a #GimpTextLayer
|
||||||
|
|
|
@ -47,6 +47,7 @@ struct _GimpTextLayer
|
||||||
*/
|
*/
|
||||||
guint idle_render_id;
|
guint idle_render_id;
|
||||||
gboolean auto_rename;
|
gboolean auto_rename;
|
||||||
|
gboolean modified;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GimpTextLayerClass
|
struct _GimpTextLayerClass
|
||||||
|
@ -55,15 +56,17 @@ struct _GimpTextLayerClass
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
GType gimp_text_layer_get_type (void) G_GNUC_CONST;
|
GType gimp_text_layer_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
GimpLayer * gimp_text_layer_new (GimpImage *image,
|
GimpLayer * gimp_text_layer_new (GimpImage *image,
|
||||||
GimpText *text);
|
GimpText *text);
|
||||||
GimpText * gimp_text_layer_get_text (GimpTextLayer *layer);
|
GimpText * gimp_text_layer_get_text (GimpTextLayer *layer);
|
||||||
void gimp_text_layer_set_text (GimpTextLayer *layer,
|
void gimp_text_layer_set_text (GimpTextLayer *layer,
|
||||||
GimpText *text);
|
GimpText *text);
|
||||||
void gimp_text_layer_discard (GimpTextLayer *layer);
|
void gimp_text_layer_discard (GimpTextLayer *layer);
|
||||||
void gimp_text_layer_flush (GimpTextLayer *layer);
|
void gimp_text_layer_flush (GimpTextLayer *layer);
|
||||||
|
|
||||||
|
gboolean gimp_drawable_is_text_layer (GimpDrawable *drawable);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_TEXT_LAYER_H__ */
|
#endif /* __GIMP_TEXT_LAYER_H__ */
|
||||||
|
|
Loading…
Reference in New Issue