Index: trunk/src/obj_pstk.h =================================================================== --- trunk/src/obj_pstk.h (revision 12942) +++ trunk/src/obj_pstk.h (revision 12943) @@ -141,7 +141,12 @@ /* grow (or shrink) a prototype to or by val - change the proto in place */ void pcb_pstk_proto_grow(pcb_pstk_proto_t *proto, pcb_bool is_absolute, pcb_coord_t val); +void pcb_pstk_shape_grow(pcb_pstk_shape_t *shp, pcb_bool is_absolute, pcb_coord_t val); +/* Derive (copy and bloat) the shape at dst_idx from src_idx; set the mask and comb + for the new shape. If dst_idx is -1, allocate the new shape */ +void pcb_pstk_shape_derive(pcb_pstk_proto_t *proto, int dst_idx, int src_idx, pcb_coord_t bloat, pcb_layer_type_t mask, pcb_layer_combining_t comb); + /* Look up the shape index corresponding to a lty/comb; returns -1 if not found/empty */ int pcb_pstk_get_shape_idx(pcb_pstk_tshape_t *ts, pcb_layer_type_t lyt, pcb_layer_combining_t comb); Index: trunk/src/obj_pstk_proto.c =================================================================== --- trunk/src/obj_pstk_proto.c (revision 12942) +++ trunk/src/obj_pstk_proto.c (revision 12943) @@ -663,7 +663,7 @@ *cy = pcb_round(y); } -static void pcb_pstk_shape_grow(pcb_pstk_shape_t *shp, pcb_bool is_absolute, pcb_coord_t val) +void pcb_pstk_shape_grow(pcb_pstk_shape_t *shp, pcb_bool is_absolute, pcb_coord_t val) { pcb_coord_t cx, cy; int n; @@ -719,6 +719,30 @@ pcb_pstk_shape_grow(&proto->tr.array[n].shape[i], is_absolute, val); } +void pcb_pstk_shape_derive(pcb_pstk_proto_t *proto, int dst_idx, int src_idx, pcb_coord_t bloat, pcb_layer_type_t mask, pcb_layer_combining_t comb) +{ + int n; + + /* do the same copy on all shapes of all transformed variants */ + for(n = 0; n < proto->tr.used; n++) { + int d = dst_idx; + if (d < 0) { + d = proto->tr.array[n].len; + proto->tr.array[n].len++; + proto->tr.array[n].shape = realloc(proto->tr.array[n].shape, proto->tr.array[n].len * sizeof(proto->tr.array[n].shape[0])); + + } + else + pcb_pstk_shape_free(&proto->tr.array[n].shape[d]); + pcb_pstk_shape_copy(&proto->tr.array[n].shape[d], &proto->tr.array[n].shape[src_idx]); + proto->tr.array[n].shape[d].layer_mask = mask; + proto->tr.array[n].shape[d].comb = comb; + if (bloat != 0) + pcb_pstk_shape_grow(&proto->tr.array[n].shape[d], pcb_false, bloat); + } +} + + static void pcb_pstk_tshape_del_idx(pcb_pstk_tshape_t *shp, int idx) { int n; Index: trunk/src_plugins/dialogs/dlg_padstack.c =================================================================== --- trunk/src_plugins/dialogs/dlg_padstack.c (revision 12942) +++ trunk/src_plugins/dialogs/dlg_padstack.c (revision 12943) @@ -259,29 +259,6 @@ pcb_gui->invalidate_all(); } -static void pse_change_shape(pcb_pstk_proto_t *proto, int dst_idx, int src_idx, pcb_coord_t bloat, pcb_layer_type_t mask, pcb_layer_combining_t comb) -{ - int n; - - /* do the same copy on all shapes of all transformed variants */ - for(n = 0; n < proto->tr.used; n++) { - int d = dst_idx; - if (d < 0) { - d = proto->tr.array[n].len; - proto->tr.array[n].len++; - proto->tr.array[n].shape = realloc(proto->tr.array[n].shape, proto->tr.array[n].len * sizeof(proto->tr.array[n].shape[0])); - - } - else - pcb_pstk_shape_free(&proto->tr.array[n].shape[d]); - pcb_pstk_shape_copy(&proto->tr.array[n].shape[d], &proto->tr.array[n].shape[src_idx]); - proto->tr.array[n].shape[d].layer_mask = mask; - proto->tr.array[n].shape[d].comb = comb; - if (bloat != 0) - pcb_pstk_shape_grow(&proto->tr.array[n].shape[d], pcb_false, bloat); - } -} - static void pse_shape_auto(void *hid_ctx, void *caller_data, pcb_hid_attribute_t *attr) { int n, src_idx = -1; @@ -313,7 +290,7 @@ return; } - pse_change_shape(proto, dst_idx, src_idx, pse_layer[pse->editing_shape].auto_bloat, pse_layer[pse->editing_shape].mask, pse_layer[pse->editing_shape].comb); + pcb_pstk_shape_derive(proto, dst_idx, src_idx, pse_layer[pse->editing_shape].auto_bloat, pse_layer[pse->editing_shape].mask, pse_layer[pse->editing_shape].comb); pse_ps2dlg(pse->parent_hid_ctx, pse); pcb_gui->invalidate_all();