Index: trunk/src/obj_pstk.h =================================================================== --- trunk/src/obj_pstk.h (revision 16370) +++ trunk/src/obj_pstk.h (revision 16371) @@ -157,6 +157,10 @@ Returns 0 on success. */ int pcb_pstk_proto_change_hole(pcb_pstk_proto_t *proto, const int *hplated, const pcb_coord_t *hdia, const int *htop, const int *hbottom); +/* Change the name of a padstack proto; not yet undoable. + Returns 0 on success. */ +int pcb_pstk_proto_change_name(pcb_pstk_proto_t *proto, const char *new_name); + /* Find or create a new transformed version of an existing proto */ pcb_pstk_tshape_t *pcb_pstk_make_tshape(pcb_data_t *data, pcb_pstk_proto_t *proto, double rot, int xmirror, int smirror, int *out_protoi); Index: trunk/src/obj_pstk_proto.c =================================================================== --- trunk/src/obj_pstk_proto.c (revision 16370) +++ trunk/src/obj_pstk_proto.c (revision 16371) @@ -674,6 +674,17 @@ return 0; } +int pcb_pstk_proto_change_name(pcb_pstk_proto_t *proto, const char *new_name) +{ +#warning undo TODO: make this undoable (check how pcb_pstk_proto_change_hole() does it) + free(proto->name); + if ((new_name == NULL) || (*new_name == '\0')) + proto->name = NULL; + else + proto->name = pcb_strdup(new_name); + return 0; +} + #define TSHAPE_ANGLE_TOL 0.01 #define tshape_angle_eq(a1, a2) (((a1 - a2) >= -TSHAPE_ANGLE_TOL) && ((a1 - a2) <= TSHAPE_ANGLE_TOL))