added gimp_text_layer_set(), a function that calls g_object_set() on the

2004-03-19  Sven Neumann  <sven@gimp.org>

	* app/text/gimptextlayer.[ch]: added gimp_text_layer_set(), a
	function that calls g_object_set() on the text-layer's text object
	and pushes an undo step.

	* app/display/gimpdisplayshell-dnd.c (gimp_display_shell_bucket_fill):
	use the new function.
This commit is contained in:
Sven Neumann 2004-03-19 22:12:18 +00:00 committed by Sven Neumann
parent 91b2f1e960
commit 520ee8b3ac
4 changed files with 47 additions and 9 deletions

View File

@ -1,3 +1,12 @@
2004-03-19 Sven Neumann <sven@gimp.org>
* app/text/gimptextlayer.[ch]: added gimp_text_layer_set(), a
function that calls g_object_set() on the text-layer's text object
and pushes an undo step.
* app/display/gimpdisplayshell-dnd.c (gimp_display_shell_bucket_fill):
use the new function.
2004-03-19 Sven Neumann <sven@gimp.org>
* HACKING: some minor updates.

View File

@ -191,9 +191,9 @@ gimp_display_shell_bucket_fill (GimpDisplayShell *shell,
*/
if (color && gimp_drawable_is_text_layer (drawable))
{
g_object_set (gimp_text_layer_get_text (GIMP_TEXT_LAYER (drawable)),
"color", color,
NULL);
gimp_text_layer_set (GIMP_TEXT_LAYER (drawable), NULL,
"color", color,
NULL);
}
else
{

View File

@ -473,14 +473,30 @@ gimp_text_layer_get_text (GimpTextLayer *layer)
return layer->text;
}
gboolean
gimp_drawable_is_text_layer (GimpDrawable *drawable)
void
gimp_text_layer_set (GimpTextLayer *layer,
const gchar *undo_desc,
const gchar *first_property_name,
...)
{
return (GIMP_IS_TEXT_LAYER (drawable) &&
GIMP_TEXT_LAYER (drawable)->text &&
GIMP_TEXT_LAYER (drawable)->modified == FALSE);
}
GimpText *text;
va_list var_args;
g_return_if_fail (gimp_drawable_is_text_layer ((GimpDrawable *) layer));
text = gimp_text_layer_get_text (layer);
if (! text)
return;
gimp_image_undo_push_text_layer (gimp_item_get_image (GIMP_ITEM (layer)),
undo_desc, layer);
va_start (var_args, first_property_name);
g_object_set_valist (G_OBJECT (text), first_property_name, var_args);
va_end (var_args);
}
/**
* gimp_text_layer_discard:
@ -504,6 +520,15 @@ gimp_text_layer_discard (GimpTextLayer *layer)
gimp_text_layer_set_text (layer, NULL);
}
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);
}
static void
gimp_text_layer_text_notify (GimpTextLayer *layer)
{

View File

@ -63,6 +63,10 @@ GimpText * gimp_text_layer_get_text (GimpTextLayer *layer);
void gimp_text_layer_set_text (GimpTextLayer *layer,
GimpText *text);
void gimp_text_layer_discard (GimpTextLayer *layer);
void gimp_text_layer_set (GimpTextLayer *layer,
const gchar *undo_desc,
const gchar *first_property_name,
...);
gboolean gimp_drawable_is_text_layer (GimpDrawable *drawable);