Index: trunk/src/change.c =================================================================== --- trunk/src/change.c (revision 28778) +++ trunk/src/change.c (revision 28779) @@ -48,6 +48,7 @@ #include "obj_poly_op.h" #include "obj_text_op.h" #include "obj_subc_op.h" +#include "extobj.h" static const char core_chg_cookie[] = "core: change.c"; @@ -838,6 +839,7 @@ chg_attr_t *ca = udata; int curr_delete = 0; char *curr_value = NULL, **slot; + const char *new_val; slot = pcb_attribute_get_ptr(&ca->obj->Attributes, ca->key); @@ -854,9 +856,11 @@ slot = pcb_attribute_get_ptr(&ca->obj->Attributes, ca->key); } *slot = ca->value; + new_val = ca->value; } else { *slot = NULL; + new_val = NULL; pcb_attribute_remove(&ca->obj->Attributes, ca->key); } @@ -864,6 +868,10 @@ /* save current state in ca */ ca->delete = curr_delete; ca->value = curr_value; + + + /* side effects */ + pcb_extobj_chg_attr(ca->obj, ca->key, new_val); return 0; } Index: trunk/src/extobj.h =================================================================== --- trunk/src/extobj.h (revision 28778) +++ trunk/src/extobj.h (revision 28779) @@ -48,6 +48,7 @@ void (*edit_geo)(pcb_subc_t *subc, pcb_any_obj_t *edit_obj); /* called after the geometry of the edit-object changed */ void (*float_pre)(pcb_subc_t *subc, pcb_any_obj_t *floater); /* called before an extobj floater is edited in any way - must not free() the floater */ void (*float_geo)(pcb_subc_t *subc, pcb_any_obj_t *floater); /* called after the geometry of an extobj floater is changed - must not free() the floater */ + void (*chg_attr)(pcb_subc_t *subc, const char *key, const char *value); /* called after an attribute changed; value == NULL means attribute is deleted */ /* dynamic data - filled in by core */ int idx; @@ -177,4 +178,23 @@ } } +PCB_INLINE void pcb_extobj_chg_attr(pcb_any_obj_t *obj, const char *key, const char *value) +{ + pcb_subc_t *subc; + pcb_extobj_t *eo; + + if (obj->type == PCB_OBJ_SUBC) + subc = (pcb_subc_t *)obj; + else + subc = pcb_extobj_get_subcobj_by_attr(obj); + + if (subc == NULL) + return; + + eo = pcb_extobj_get(subc); + + if ((eo != NULL) && (eo->chg_attr != NULL)) + eo->chg_attr(subc, key, value); +} + #endif