Index: trunk/src/change.c =================================================================== --- trunk/src/change.c (revision 12398) +++ trunk/src/change.c (revision 12399) @@ -40,6 +40,7 @@ #include "hid_actions.h" #include "compat_nls.h" #include "obj_all_op.h" +#include "obj_padstack_op.h" #include "obj_subc_parent.h" #include "obj_term.h" @@ -115,7 +116,7 @@ NULL, NULL, NULL, /* subc */ - NULL /* padstack */ + pcb_padstackop_change_thermal }; pcb_opfunc_t ChangeClearSizeFunctions = { Index: trunk/src/obj_padstack.c =================================================================== --- trunk/src/obj_padstack.c (revision 12398) +++ trunk/src/obj_padstack.c (revision 12399) @@ -350,4 +350,15 @@ return 0; } +void pcb_padstack_set_thermal(pcb_padstack_t *ps, unsigned long lid, unsigned char shape) +{ + if (ps->thermal.used <= lid) { + unsigned long oldu = ps->thermal.used; + ps->thermal.used = lid+1; + ps->thermal.shape = realloc(ps->thermal.shape, ps->thermal.used); + memset(ps->thermal.shape + oldu, 0, ps->thermal.used - oldu - 1); + } + ps->thermal.shape[lid] = shape; +} + #include "obj_padstack_op.c" Index: trunk/src/obj_padstack.h =================================================================== --- trunk/src/obj_padstack.h (revision 12398) +++ trunk/src/obj_padstack.h (revision 12399) @@ -32,7 +32,7 @@ pcb_coord_t x, y; struct { unsigned long used; - char *shape; /* indexed by layer ID */ + unsigned char *shape; /* indexed by layer ID */ } thermal; gdl_elem_t link; /* a padstack is in a list in pcb_data_t as a global object */ }; @@ -112,6 +112,7 @@ void pcb_padstack_add(pcb_data_t *data, pcb_padstack_t *ps); void pcb_padstack_bbox(pcb_padstack_t *ps); +void pcb_padstack_set_thermal(pcb_padstack_t *ps, unsigned long lid, unsigned char shape); /*** proto ***/ Index: trunk/src/obj_padstack_op.c =================================================================== --- trunk/src/obj_padstack_op.c (revision 12398) +++ trunk/src/obj_padstack_op.c (revision 12399) @@ -138,3 +138,17 @@ return NULL; } +void *pcb_padstackop_change_thermal(pcb_opctx_t *ctx, pcb_padstack_t *ps) +{ + pcb_undo_add_obj_to_clear_poly(PCB_TYPE_PADSTACK, ps, ps, ps, pcb_false); + pcb_poly_restore_to_poly(PCB->Data, PCB_TYPE_PADSTACK, CURRENT, ps); + +#warning TODO: undo + get PCB in ctx + get INDEXOFCURRENT/CURRENT in ctx + pcb_padstack_set_thermal(ps, INDEXOFCURRENT, ctx->chgtherm.style); + + pcb_undo_add_obj_to_clear_poly(PCB_TYPE_PADSTACK, ps, ps, ps, pcb_true); + pcb_poly_clear_from_poly(PCB->Data, PCB_TYPE_PADSTACK, CURRENT, ps); + pcb_via_invalidate_draw(ps); + return ps; +} + Index: trunk/src/obj_padstack_op.h =================================================================== --- trunk/src/obj_padstack_op.h (revision 12398) +++ trunk/src/obj_padstack_op.h (revision 12399) @@ -34,7 +34,9 @@ void *pcb_padstackop_remove(pcb_opctx_t *ctx, pcb_padstack_t *ps); void *pcb_padstackop_destroy(pcb_opctx_t *ctx, pcb_padstack_t *ps); +void *pcb_padstackop_change_thermal(pcb_opctx_t *ctx, pcb_padstack_t *ps); + /*** TODO: unimplemented ones ***/ void *pcb_padstackop_change_size(pcb_opctx_t *ctx, pcb_padstack_t *ps); @@ -41,7 +43,6 @@ void *pcb_padstackop_change_2nd_size(pcb_opctx_t *ctx, pcb_padstack_t *ps); void *pcb_padstackop_change_clear_size(pcb_opctx_t *ctx, pcb_padstack_t *ps); -void *pcb_padstackop_change_thermal(pcb_opctx_t *ctx, pcb_padstack_t *ps); void *pcb_padstackop_change_name(pcb_opctx_t *ctx, pcb_padstack_t *ps); void *pcb_padstackop_change_flag(pcb_opctx_t *ctx, pcb_padstack_t *ps);