From 93ea9d0eec3d25a4b6eaffc5718405a76dbcf152 Mon Sep 17 00:00:00 2001 From: Manish Singh Date: Wed, 2 Feb 2000 04:14:23 +0000 Subject: [PATCH] commit alt's paths changes -Yosh --- app/internal_procs.c | 60 +++++----- app/paths_cmds.c | 275 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 305 insertions(+), 30 deletions(-) diff --git a/app/internal_procs.c b/app/internal_procs.c index 7bc2f5960b..f2500702e6 100644 --- a/app/internal_procs.c +++ b/app/internal_procs.c @@ -60,7 +60,7 @@ void register_tools_procs (void); void register_undo_procs (void); void register_unit_procs (void); -/* 313 procedures registered total */ +/* 316 procedures registered total */ void internal_procs_init (void) @@ -68,94 +68,94 @@ internal_procs_init (void) app_init_update_status (_("Internal Procedures"), _("Brush UI"), 0.0); register_brush_select_procs (); - app_init_update_status (NULL, _("Brushes"), 0.01); + app_init_update_status (NULL, _("Brushes"), 0.009); register_brushes_procs (); - app_init_update_status (NULL, _("Channel"), 0.045); + app_init_update_status (NULL, _("Channel"), 0.044); register_channel_procs (); app_init_update_status (NULL, _("Channel Ops"), 0.089); register_channel_ops_procs (); - app_init_update_status (NULL, _("Color"), 0.096); + app_init_update_status (NULL, _("Color"), 0.095); register_color_procs (); - app_init_update_status (NULL, _("Convert"), 0.134); + app_init_update_status (NULL, _("Convert"), 0.133); register_convert_procs (); - app_init_update_status (NULL, _("Drawable procedures"), 0.144); + app_init_update_status (NULL, _("Drawable procedures"), 0.142); register_drawable_procs (); - app_init_update_status (NULL, _("Edit procedures"), 0.214); + app_init_update_status (NULL, _("Edit procedures"), 0.212); register_edit_procs (); - app_init_update_status (NULL, _("File Operations"), 0.233); + app_init_update_status (NULL, _("File Operations"), 0.231); register_fileops_procs (); - app_init_update_status (NULL, _("Floating selections"), 0.259); + app_init_update_status (NULL, _("Floating selections"), 0.256); register_floating_sel_procs (); - app_init_update_status (NULL, _("GDisplay procedures"), 0.278); + app_init_update_status (NULL, _("GDisplay procedures"), 0.275); register_gdisplay_procs (); - app_init_update_status (NULL, _("Image"), 0.288); + app_init_update_status (NULL, _("Image"), 0.285); register_gimage_procs (); - app_init_update_status (NULL, _("Image mask"), 0.47); + app_init_update_status (NULL, _("Image mask"), 0.465); register_gimage_mask_procs (); - app_init_update_status (NULL, _("Gimprc procedures"), 0.524); + app_init_update_status (NULL, _("Gimprc procedures"), 0.519); register_gimprc_procs (); - app_init_update_status (NULL, _("Help procedures"), 0.534); + app_init_update_status (NULL, _("Help procedures"), 0.528); register_gimphelp_procs (); - app_init_update_status (NULL, _("Gradients"), 0.537); + app_init_update_status (NULL, _("Gradients"), 0.532); register_gradient_procs (); - app_init_update_status (NULL, _("Gradient UI"), 0.553); + app_init_update_status (NULL, _("Gradient UI"), 0.547); register_gradient_select_procs (); - app_init_update_status (NULL, _("Guide procedures"), 0.565); + app_init_update_status (NULL, _("Guide procedures"), 0.56); register_guides_procs (); - app_init_update_status (NULL, _("Interface"), 0.585); + app_init_update_status (NULL, _("Interface"), 0.579); register_interface_procs (); - app_init_update_status (NULL, _("Layer"), 0.594); + app_init_update_status (NULL, _("Layer"), 0.589); register_layer_procs (); - app_init_update_status (NULL, _("Miscellaneous"), 0.69); + app_init_update_status (NULL, _("Miscellaneous"), 0.684); register_misc_procs (); - app_init_update_status (NULL, _("Palette"), 0.696); + app_init_update_status (NULL, _("Palette"), 0.69); register_palette_procs (); - app_init_update_status (NULL, _("Parasite procedures"), 0.719); + app_init_update_status (NULL, _("Parasite procedures"), 0.712); register_parasite_procs (); - app_init_update_status (NULL, _("Paths"), 0.76); + app_init_update_status (NULL, _("Paths"), 0.753); register_paths_procs (); - app_init_update_status (NULL, _("Pattern UI"), 0.792); + app_init_update_status (NULL, _("Pattern UI"), 0.794); register_pattern_select_procs (); - app_init_update_status (NULL, _("Patterns"), 0.802); + app_init_update_status (NULL, _("Patterns"), 0.804); register_patterns_procs (); - app_init_update_status (NULL, _("Plug-in"), 0.815); + app_init_update_status (NULL, _("Plug-in"), 0.816); register_plug_in_procs (); - app_init_update_status (NULL, _("Procedural database"), 0.827); + app_init_update_status (NULL, _("Procedural database"), 0.829); register_procedural_db_procs (); - app_init_update_status (NULL, _("Text procedures"), 0.853); + app_init_update_status (NULL, _("Text procedures"), 0.854); register_text_tool_procs (); - app_init_update_status (NULL, _("Tool procedures"), 0.866); + app_init_update_status (NULL, _("Tool procedures"), 0.867); register_tools_procs (); - app_init_update_status (NULL, _("Undo"), 0.958); + app_init_update_status (NULL, _("Undo"), 0.959); register_undo_procs (); app_init_update_status (NULL, _("Units"), 0.965); diff --git a/app/paths_cmds.c b/app/paths_cmds.c index df38aab20a..13a2655b67 100644 --- a/app/paths_cmds.c +++ b/app/paths_cmds.c @@ -35,6 +35,9 @@ static ProcRecord path_get_point_at_dist_proc; static ProcRecord path_get_tattoo_proc; static ProcRecord get_path_by_tattoo_proc; static ProcRecord path_delete_proc; +static ProcRecord path_get_locked_proc; +static ProcRecord path_set_locked_proc; +static ProcRecord path_set_tattoo_proc; void register_paths_procs (void) @@ -49,6 +52,9 @@ register_paths_procs (void) procedural_db_register (&path_get_tattoo_proc); procedural_db_register (&get_path_by_tattoo_proc); procedural_db_register (&path_delete_proc); + procedural_db_register (&path_get_locked_proc); + procedural_db_register (&path_set_locked_proc); + procedural_db_register (&path_set_tattoo_proc); } static Argument * @@ -854,3 +860,272 @@ static ProcRecord path_delete_proc = NULL, { { path_delete_invoker } } }; + +static Argument * +path_get_locked_invoker (Argument *args) +{ + gboolean success = TRUE; + Argument *return_args; + GimpImage *gimage; + gchar *pname; + gint32 lockstatus = 0; + PathsList *plist; + PATHP pptr = NULL; + + gimage = pdb_id_to_image (args[0].value.pdb_int); + if (gimage == NULL) + success = FALSE; + + pname = (gchar *) args[1].value.pdb_pointer; + if (pname == NULL) + success = FALSE; + + if (success) + { + /* Get the path with the given name */ + plist = gimage->paths; + + if (plist && plist->bz_paths) + { + GSList *pl = plist->bz_paths; + + while (pl) + { + pptr = pl->data; + + if (!strcmp (pname, pptr->name->str)) + break; /* Found the path */ + + pl = pl->next; + pptr = NULL; + } + + if (pl && pptr) + lockstatus = pptr->locked; + else + success = FALSE; + } + else + success = FALSE; + } + + return_args = procedural_db_return_args (&path_get_locked_proc, success); + + if (success) + return_args[1].value.pdb_int = lockstatus; + + return return_args; +} + +static ProcArg path_get_locked_inargs[] = +{ + { + PDB_IMAGE, + "image", + "The image" + }, + { + PDB_STRING, + "pathname", + "the name of the path whose locked status should be obtained" + } +}; + +static ProcArg path_get_locked_outargs[] = +{ + { + PDB_INT32, + "lockstatus", + "The lock status associated with the name path. 0 returned if the path is not locked. 1 is returned if the path is locked" + } +}; + +static ProcRecord path_get_locked_proc = +{ + "gimp_path_get_locked", + "Returns the locked status associated with the name path.", + "This procedure returns the lock status associated with the specified path. A path can be \"locked\" which means that the transformation tool operations will also apply to the path.", + "Andy Thomas", + "Andy Thomas", + "1999", + PDB_INTERNAL, + 2, + path_get_locked_inargs, + 1, + path_get_locked_outargs, + { { path_get_locked_invoker } } +}; + +static Argument * +path_set_locked_invoker (Argument *args) +{ + gboolean success = TRUE; + GimpImage *gimage; + gchar *pname; + gint32 lockstatus = 0; + PathsList *plist; + PATHP pptr = NULL; + + gimage = pdb_id_to_image (args[0].value.pdb_int); + if (gimage == NULL) + success = FALSE; + + pname = (gchar *) args[1].value.pdb_pointer; + if (pname == NULL) + success = FALSE; + + lockstatus = args[2].value.pdb_int; + + if (success) + { + /* Get the path with the given name */ + plist = gimage->paths; + + if (plist && plist->bz_paths) + { + GSList *pl = plist->bz_paths; + + while (pl) + { + pptr = pl->data; + + if (!strcmp (pname, pptr->name->str)) + break; /* Found the path */ + + pl = pl->next; + pptr = NULL; + } + + if (pl && pptr && lockstatus >=0 && lockstatus <= 1) + pptr->locked = lockstatus; + else + success = FALSE; + } + else + success = FALSE; + } + + return procedural_db_return_args (&path_set_locked_proc, success); +} + +static ProcArg path_set_locked_inargs[] = +{ + { + PDB_IMAGE, + "image", + "The image" + }, + { + PDB_STRING, + "pathname", + "the name of the path whose locked status should be set" + }, + { + PDB_INT32, + "lockstatus", + "The lock status associated with the name path. 0 if the path is not locked. 1 if the path is to be locked" + } +}; + +static ProcRecord path_set_locked_proc = +{ + "gimp_path_set_locked", + "Set the locked status associated with the name path.", + "This procedure sets the lock status associated with the specified path. A path can be \"locked\" which means that the transformation tool operations will also apply to the path.", + "Andy Thomas", + "Andy Thomas", + "1999", + PDB_INTERNAL, + 3, + path_set_locked_inargs, + 0, + NULL, + { { path_set_locked_invoker } } +}; + +static Argument * +path_set_tattoo_invoker (Argument *args) +{ + gboolean success = TRUE; + GimpImage *gimage; + gchar *pname; + gint32 tattovalue = 0; + PathsList *plist; + PATHP pptr = NULL; + + gimage = pdb_id_to_image (args[0].value.pdb_int); + if (gimage == NULL) + success = FALSE; + + pname = (gchar *) args[1].value.pdb_pointer; + if (pname == NULL) + success = FALSE; + + tattovalue = args[2].value.pdb_int; + + if (success) + { + /* Get the path with the given name */ + plist = gimage->paths; + + if (plist && plist->bz_paths) + { + GSList *pl = plist->bz_paths; + + while (pl) + { + pptr = pl->data; + + if (!strcmp (pname, pptr->name->str)) + break; /* Found the path */ + + pl = pl->next; + pptr = NULL; + } + + if (pl && pptr) + pptr->tattoo = tattovalue ; + else + success = FALSE; + } + else + success = FALSE; + } + + return procedural_db_return_args (&path_set_tattoo_proc, success); +} + +static ProcArg path_set_tattoo_inargs[] = +{ + { + PDB_IMAGE, + "image", + "The image" + }, + { + PDB_STRING, + "pathname", + "the name of the path whose tattoo should be set" + }, + { + PDB_INT32, + "tattovalue", + "The tattoo associated with the name path. Only values returned from 'path_get_tattoo' should be used here" + } +}; + +static ProcRecord path_set_tattoo_proc = +{ + "gimp_path_set_tattoo", + "Sets the tattoo associated with the name path.", + "This procedure sets the tattoo associated with the specified path. A tattoo is a unique and permenant identifier attached to a path that can be used to uniquely identify a path within an image even between sessions. Note that the value passed to this function must have been obtained from a previous call to path_get_tattoo.", + "Andy Thomas", + "Andy Thomas", + "1999", + PDB_INTERNAL, + 3, + path_set_tattoo_inargs, + 0, + NULL, + { { path_set_tattoo_invoker } } +};