let gimp_text() and gimp_text_fontname() succeed but return -1 if no layer

2004-12-15  Sven Neumann  <sven@gimp.org>

	* tools/pdbgen/pdb/text_tool.pdb: let gimp_text() and
	gimp_text_fontname() succeed but return -1 if no layer was created.
	Fixes bug #161272.

	* app/pdb/text_tool_cmds.c
	* libgimp/gimptexttool_pdb.c: regenerated.
This commit is contained in:
Sven Neumann 2004-12-15 20:37:54 +00:00 committed by Sven Neumann
parent 37226e50d6
commit 53cfed36a1
4 changed files with 17 additions and 15 deletions

View File

@ -1,3 +1,12 @@
2004-12-15 Sven Neumann <sven@gimp.org>
* tools/pdbgen/pdb/text_tool.pdb: let gimp_text() and
gimp_text_fontname() succeed but return -1 if no layer was created.
Fixes bug #161272.
* app/pdb/text_tool_cmds.c
* libgimp/gimptexttool_pdb.c: regenerated.
2004-12-15 Michael Natterer <mitch@gimp.org> 2004-12-15 Michael Natterer <mitch@gimp.org>
* app/core/gimpdrawable-preview.[ch]: added utility function * app/core/gimpdrawable-preview.[ch]: added utility function

View File

@ -111,8 +111,6 @@ text_fontname_invoker (Gimp *gimp,
text_layer = text_render (gimage, drawable, context, text_layer = text_render (gimage, drawable, context,
x, y, real_fontname, text, x, y, real_fontname, text,
border, antialias); border, antialias);
if (text_layer == NULL)
success = FALSE;
g_free (real_fontname); g_free (real_fontname);
} }
@ -121,7 +119,7 @@ text_fontname_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&text_fontname_proc, success); return_args = procedural_db_return_args (&text_fontname_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = gimp_item_get_ID (GIMP_ITEM (text_layer)); return_args[1].value.pdb_int = text_layer ? gimp_item_get_ID (GIMP_ITEM (text_layer)) : -1;
return return_args; return return_args;
} }
@ -185,7 +183,7 @@ static ProcArg text_fontname_outargs[] =
{ {
GIMP_PDB_LAYER, GIMP_PDB_LAYER,
"text_layer", "text_layer",
"The new text layer" "The new text layer or -1 if no layer was created."
} }
}; };
@ -428,8 +426,6 @@ text_invoker (Gimp *gimp,
text_layer = text_render (gimage, drawable, context, text_layer = text_render (gimage, drawable, context,
x, y, real_fontname, text, x, y, real_fontname, text,
border, antialias); border, antialias);
if (text_layer == NULL)
success = FALSE;
g_free (real_fontname); g_free (real_fontname);
} }
@ -438,7 +434,7 @@ text_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&text_proc, success); return_args = procedural_db_return_args (&text_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = gimp_item_get_ID (GIMP_ITEM (text_layer)); return_args[1].value.pdb_int = text_layer ? gimp_item_get_ID (GIMP_ITEM (text_layer)) : -1;
return return_args; return return_args;
} }
@ -537,7 +533,7 @@ static ProcArg text_outargs[] =
{ {
GIMP_PDB_LAYER, GIMP_PDB_LAYER,
"text_layer", "text_layer",
"The new text layer" "The new text layer or -1 if no layer was created."
} }
}; };

View File

@ -52,7 +52,7 @@
* Finally, a border can be specified around the final rendered text. * Finally, a border can be specified around the final rendered text.
* The border is measured in pixels. * The border is measured in pixels.
* *
* Returns: The new text layer. * Returns: The new text layer or -1 if no layer was created.
*/ */
gint32 gint32
gimp_text_fontname (gint32 image_ID, gimp_text_fontname (gint32 image_ID,
@ -175,7 +175,7 @@ gimp_text_get_extents_fontname (const gchar *text,
* *
* This procedure is deprecated! Use gimp_text_fontname() instead. * This procedure is deprecated! Use gimp_text_fontname() instead.
* *
* Returns: The new text layer. * Returns: The new text layer or -1 if no layer was created.
*/ */
gint32 gint32
gimp_text (gint32 image_ID, gimp_text (gint32 image_ID,

View File

@ -75,7 +75,8 @@ sub font_prop_args {
sub render_outargs { sub render_outargs {
@outargs = ( @outargs = (
{ name => 'text_layer', type => 'layer', { name => 'text_layer', type => 'layer',
desc => 'The new text layer', init => 1 } desc => 'The new text layer or -1 if no layer was created.',
init => 1, return_fail => -1 }
); );
} }
@ -128,8 +129,6 @@ HELP
text_layer = text_render (gimage, drawable, context, text_layer = text_render (gimage, drawable, context,
x, y, real_fontname, text, x, y, real_fontname, text,
border, antialias); border, antialias);
if (text_layer == NULL)
success = FALSE;
g_free (real_fontname); g_free (real_fontname);
} }
@ -199,8 +198,6 @@ sub text {
text_layer = text_render (gimage, drawable, context, text_layer = text_render (gimage, drawable, context,
x, y, real_fontname, text, x, y, real_fontname, text,
border, antialias); border, antialias);
if (text_layer == NULL)
success = FALSE;
g_free (real_fontname); g_free (real_fontname);
} }