Commit 520ee8b3 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

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.
parent 91b2f1e9
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.
......@@ -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
{
......
......@@ -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)
{
......
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment