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

added getter and setter for path visibility (bug #319617).

2005-10-25  Sven Neumann  <sven@gimp.org>

	* tools/pdbgen/pdb/paths.pdb: added getter and setter for path
	visibility (bug #319617).

	* app/pdb/internal_procs.c
	* app/pdb/paths_cmds.c
	* libgimp/gimppaths_pdb.[ch]: regenerated.

	* libgimp/gimp.def: updated.
parent be5ec577
2005-10-25 Sven Neumann <sven@gimp.org>
* tools/pdbgen/pdb/paths.pdb: added getter and setter for path
visibility (bug #319617).
* app/pdb/internal_procs.c
* app/pdb/paths_cmds.c
* libgimp/gimppaths_pdb.[ch]: regenerated.
* libgimp/gimp.def: updated.
2005-10-24 Sven Neumann <sven@gimp.org>
* plug-ins/common/png.c: load and save embedded ICC profiles, based
......
......@@ -77,7 +77,7 @@ void register_undo_procs (Gimp *gimp);
void register_unit_procs (Gimp *gimp);
void register_vectors_procs (Gimp *gimp);
/* 491 procedures registered total */
/* 493 procedures registered total */
void
internal_procs_init (Gimp *gimp,
......@@ -101,13 +101,13 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Channel"), 0.077);
register_channel_procs (gimp);
(* status_callback) (NULL, _("Color"), 0.098);
(* status_callback) (NULL, _("Color"), 0.097);
register_color_procs (gimp);
(* status_callback) (NULL, _("Context"), 0.13);
register_context_procs (gimp);
(* status_callback) (NULL, _("Convert"), 0.175);
(* status_callback) (NULL, _("Convert"), 0.174);
register_convert_procs (gimp);
(* status_callback) (NULL, _("Display procedures"), 0.181);
......@@ -116,88 +116,88 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Drawable procedures"), 0.191);
register_drawable_procs (gimp);
(* status_callback) (NULL, _("Transformation procedures"), 0.263);
(* status_callback) (NULL, _("Transformation procedures"), 0.262);
register_drawable_transform_procs (gimp);
(* status_callback) (NULL, _("Edit procedures"), 0.295);
(* status_callback) (NULL, _("Edit procedures"), 0.294);
register_edit_procs (gimp);
(* status_callback) (NULL, _("File Operations"), 0.326);
(* status_callback) (NULL, _("File Operations"), 0.325);
register_fileops_procs (gimp);
(* status_callback) (NULL, _("Floating selections"), 0.348);
(* status_callback) (NULL, _("Floating selections"), 0.347);
register_floating_sel_procs (gimp);
(* status_callback) (NULL, _("Font UI"), 0.36);
(* status_callback) (NULL, _("Font UI"), 0.359);
register_font_select_procs (gimp);
(* status_callback) (NULL, _("Fonts"), 0.367);
(* status_callback) (NULL, _("Fonts"), 0.365);
register_fonts_procs (gimp);
(* status_callback) (NULL, _("Gimprc procedures"), 0.371);
(* status_callback) (NULL, _("Gimprc procedures"), 0.369);
register_gimprc_procs (gimp);
(* status_callback) (NULL, _("Gradient"), 0.385);
(* status_callback) (NULL, _("Gradient"), 0.383);
register_gradient_procs (gimp);
(* status_callback) (NULL, _("Gradient UI"), 0.446);
(* status_callback) (NULL, _("Gradient UI"), 0.444);
register_gradient_select_procs (gimp);
(* status_callback) (NULL, _("Gradients"), 0.452);
(* status_callback) (NULL, _("Gradients"), 0.45);
register_gradients_procs (gimp);
(* status_callback) (NULL, _("Image grid procedures"), 0.462);
(* status_callback) (NULL, _("Image grid procedures"), 0.46);
register_grid_procs (gimp);
(* status_callback) (NULL, _("Guide procedures"), 0.483);
(* status_callback) (NULL, _("Guide procedures"), 0.481);
register_guides_procs (gimp);
(* status_callback) (NULL, _("Help procedures"), 0.495);
(* status_callback) (NULL, _("Help procedures"), 0.493);
register_help_procs (gimp);
(* status_callback) (NULL, _("Image"), 0.497);
(* status_callback) (NULL, _("Image"), 0.495);
register_image_procs (gimp);
(* status_callback) (NULL, _("Layer"), 0.625);
(* status_callback) (NULL, _("Layer"), 0.623);
register_layer_procs (gimp);
(* status_callback) (NULL, _("Message procedures"), 0.68);
(* status_callback) (NULL, _("Message procedures"), 0.677);
register_message_procs (gimp);
(* status_callback) (NULL, _("Miscellaneous"), 0.686);
(* status_callback) (NULL, _("Miscellaneous"), 0.684);
register_misc_procs (gimp);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.692);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.69);
register_paint_tools_procs (gimp);
(* status_callback) (NULL, _("Palette"), 0.723);
(* status_callback) (NULL, _("Palette"), 0.72);
register_palette_procs (gimp);
(* status_callback) (NULL, _("Palette UI"), 0.752);
(* status_callback) (NULL, _("Palette UI"), 0.748);
register_palette_select_procs (gimp);
(* status_callback) (NULL, _("Palettes"), 0.758);
(* status_callback) (NULL, _("Palettes"), 0.755);
register_palettes_procs (gimp);
(* status_callback) (NULL, _("Parasite procedures"), 0.766);
(* status_callback) (NULL, _("Parasite procedures"), 0.763);
register_parasite_procs (gimp);
(* status_callback) (NULL, _("Paths"), 0.79);
(* status_callback) (NULL, _("Paths"), 0.787);
register_paths_procs (gimp);
(* status_callback) (NULL, _("Pattern"), 0.823);
(* status_callback) (NULL, _("Pattern"), 0.824);
register_pattern_procs (gimp);
(* status_callback) (NULL, _("Pattern UI"), 0.827);
(* status_callback) (NULL, _("Pattern UI"), 0.828);
register_pattern_select_procs (gimp);
(* status_callback) (NULL, _("Patterns"), 0.833);
(* status_callback) (NULL, _("Patterns"), 0.834);
register_patterns_procs (gimp);
(* status_callback) (NULL, _("Plug-in"), 0.841);
(* status_callback) (NULL, _("Plug-in"), 0.842);
register_plug_in_procs (gimp);
(* status_callback) (NULL, _("Procedural database"), 0.853);
(* status_callback) (NULL, _("Procedural database"), 0.854);
register_procedural_db_procs (gimp);
(* status_callback) (NULL, _("Progress"), 0.872);
......@@ -218,7 +218,7 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Undo"), 0.953);
register_undo_procs (gimp);
(* status_callback) (NULL, _("Units"), 0.967);
(* status_callback) (NULL, _("Units"), 0.968);
register_unit_procs (gimp);
(* status_callback) (NULL, _("Paths"), 0.992);
......
......@@ -52,6 +52,8 @@ static ProcRecord path_set_tattoo_proc;
static ProcRecord get_path_by_tattoo_proc;
static ProcRecord path_get_locked_proc;
static ProcRecord path_set_locked_proc;
static ProcRecord path_get_visible_proc;
static ProcRecord path_set_visible_proc;
static ProcRecord path_to_selection_proc;
static ProcRecord path_import_proc;
static ProcRecord path_import_string_proc;
......@@ -72,6 +74,8 @@ register_paths_procs (Gimp *gimp)
procedural_db_register (gimp, &get_path_by_tattoo_proc);
procedural_db_register (gimp, &path_get_locked_proc);
procedural_db_register (gimp, &path_set_locked_proc);
procedural_db_register (gimp, &path_get_visible_proc);
procedural_db_register (gimp, &path_set_visible_proc);
procedural_db_register (gimp, &path_to_selection_proc);
procedural_db_register (gimp, &path_import_proc);
procedural_db_register (gimp, &path_import_string_proc);
......@@ -1180,6 +1184,158 @@ static ProcRecord path_set_locked_proc =
{ { path_set_locked_invoker } }
};
static Argument *
path_get_visible_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
GimpImage *gimage;
gchar *name;
gboolean visible = FALSE;
GimpVectors *vectors;
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_IMAGE (gimage))
success = FALSE;
name = (gchar *) args[1].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
if (success)
{
vectors = gimp_image_get_vectors_by_name (gimage, name);
if (vectors)
visible = gimp_item_get_visible (GIMP_ITEM (vectors));
else
success = FALSE;
}
return_args = procedural_db_return_args (&path_get_visible_proc, success);
if (success)
return_args[1].value.pdb_int = visible;
return return_args;
}
static ProcArg path_get_visible_inargs[] =
{
{
GIMP_PDB_IMAGE,
"image",
"The image"
},
{
GIMP_PDB_STRING,
"name",
"The name of the path whose visibility should be obtained."
}
};
static ProcArg path_get_visible_outargs[] =
{
{
GIMP_PDB_INT32,
"visible",
"TRUE if the path is visible, FALSE otherwise"
}
};
static ProcRecord path_get_visible_proc =
{
"gimp-path-get-visible",
"gimp-path-get-visible",
"Get the visibility of the named path.",
"This procedure returns the visibility of the specified path.",
"Andy Thomas",
"Andy Thomas",
"1999",
NULL,
GIMP_INTERNAL,
2,
path_get_visible_inargs,
1,
path_get_visible_outargs,
{ { path_get_visible_invoker } }
};
static Argument *
path_set_visible_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpImage *gimage;
gchar *name;
gboolean visible = FALSE;
GimpVectors *vectors;
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_IMAGE (gimage))
success = FALSE;
name = (gchar *) args[1].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
visible = args[2].value.pdb_int ? TRUE : FALSE;
if (success)
{
vectors = gimp_image_get_vectors_by_name (gimage, name);
if (vectors)
gimp_item_set_visible (GIMP_ITEM (vectors), visible, TRUE);
else
success = FALSE;
}
return procedural_db_return_args (&path_set_visible_proc, success);
}
static ProcArg path_set_visible_inargs[] =
{
{
GIMP_PDB_IMAGE,
"image",
"The image"
},
{
GIMP_PDB_STRING,
"name",
"The name of the path whose visibility should be set"
},
{
GIMP_PDB_INT32,
"visible",
"The new path visibility"
}
};
static ProcRecord path_set_visible_proc =
{
"gimp-path-set-visible",
"gimp-path-set-visible",
"Sets the visibility of the named path.",
"This procedure sets the specified path's visibility.",
"Sven Neumann",
"Sven Neumann",
"2005",
NULL,
GIMP_INTERNAL,
3,
path_set_visible_inargs,
0,
NULL,
{ { path_set_visible_invoker } }
};
static Argument *
path_to_selection_invoker (Gimp *gimp,
GimpContext *context,
......
......@@ -454,6 +454,7 @@ EXPORTS
gimp_path_get_point_at_dist
gimp_path_get_points
gimp_path_get_tattoo
gimp_path_get_visible
gimp_path_import
gimp_path_import_string
gimp_path_list
......@@ -461,6 +462,7 @@ EXPORTS
gimp_path_set_locked
gimp_path_set_points
gimp_path_set_tattoo
gimp_path_set_visible
gimp_path_stroke_current
gimp_path_to_selection
gimp_pattern_get_info
......
......@@ -509,6 +509,76 @@ gimp_path_set_locked (gint32 image_ID,
return success;
}
/**
* gimp_path_get_visible:
* @image_ID: The image.
* @name: The name of the path whose visibility should be obtained.
*
* Get the visibility of the named path.
*
* This procedure returns the visibility of the specified path.
*
* Returns: TRUE if the path is visible, FALSE otherwise.
*/
gboolean
gimp_path_get_visible (gint32 image_ID,
const gchar *name)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean visible = FALSE;
return_vals = gimp_run_procedure ("gimp-path-get-visible",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
visible = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return visible;
}
/**
* gimp_path_set_visible:
* @image_ID: The image.
* @name: The name of the path whose visibility should be set.
* @visible: The new path visibility.
*
* Sets the visibility of the named path.
*
* This procedure sets the specified path's visibility.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.4
*/
gboolean
gimp_path_set_visible (gint32 image_ID,
const gchar *name,
gboolean visible)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-path-set-visible",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_STRING, name,
GIMP_PDB_INT32, visible,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_path_to_selection:
* @image_ID: The image.
......
......@@ -63,6 +63,11 @@ gboolean gimp_path_get_locked (gint32 image_ID,
gboolean gimp_path_set_locked (gint32 image_ID,
const gchar *name,
gboolean locked);
gboolean gimp_path_get_visible (gint32 image_ID,
const gchar *name);
gboolean gimp_path_set_visible (gint32 image_ID,
const gchar *name,
gboolean visible);
gboolean gimp_path_to_selection (gint32 image_ID,
const gchar *name,
GimpChannelOps op,
......
......@@ -625,6 +625,75 @@ CODE
);
}
sub path_get_visible {
$blurb = 'Get the visibility of the named path.';
$help = <<'HELP';
This procedure returns the visibility of the specified path.
HELP
&pdb_misc;
@inargs = (
&std_image_arg,
{ name => 'name', type => 'string',
desc => 'The name of the path whose visibility should be obtained.' }
);
@outargs = (
{ name => 'visible', type => 'boolean',
desc => 'TRUE if the path is visible, FALSE otherwise', init => 1 }
);
%invoke = (
vars => [ 'GimpVectors *vectors' ],
code => <<'CODE'
{
vectors = gimp_image_get_vectors_by_name (gimage, name);
if (vectors)
visible = gimp_item_get_visible (GIMP_ITEM (vectors));
else
success = FALSE;
}
CODE
);
}
sub path_set_visible {
$blurb = 'Sets the visibility of the named path.';
$help = <<'HELP';
This procedure sets the specified path's visibility.
HELP
$author = $copyright = 'Sven Neumann';
$date = '2005';
$since = '2.4';
@inargs = (
&std_image_arg,
{ name => 'name', type => 'string',
desc => 'The name of the path whose visibility should be set' },
{ name => 'visible', type => 'boolean',
desc => 'The new path visibility', init => 1 }
);
%invoke = (
vars => [ 'GimpVectors *vectors' ],
code => <<'CODE'
{
vectors = gimp_image_get_vectors_by_name (gimage, name);
if (vectors)
gimp_item_set_visible (GIMP_ITEM (vectors), visible, TRUE);
else
success = FALSE;
}
CODE
);
}
sub path_to_selection {
$blurb = 'Transforms the active path into a selection';
......@@ -742,8 +811,9 @@ HELP
path_get_points path_set_points
path_stroke_current path_get_point_at_dist
path_get_tattoo path_set_tattoo get_path_by_tattoo
path_get_locked path_set_locked path_to_selection
path_import path_import_string);
path_get_locked path_set_locked
path_get_visible path_set_visible
path_to_selection path_import path_import_string);
%exports = (app => [@procs], lib => [@procs]);
$desc = 'Paths';
......
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