Index: trunk/src/obj_text.c =================================================================== --- trunk/src/obj_text.c (revision 24471) +++ trunk/src/obj_text.c (revision 24472) @@ -884,16 +884,19 @@ } } -void pcb_text_flagchg_post(pcb_text_t *Text, unsigned long flagbits, void **save) +void pcb_text_flagchg_post(pcb_text_t *Text, unsigned long oldflagbits, void **save) { pcb_data_t *data = Text->parent.layer->parent.data; pcb_layer_t *orig_layer = *save; + unsigned long newflagbits = Text->Flags.f; - if (orig_layer != NULL) { + if ((oldflagbits & PCB_FLAG_DYNTEXT) || (newflagbits & PCB_FLAG_DYNTEXT) || (orig_layer != NULL)) pcb_text_bbox(pcb_font(PCB, Text->fid, 1), Text); + + if (orig_layer != NULL) pcb_r_insert_entry(orig_layer->text_tree, (pcb_box_t *)Text); - } - if ((flagbits & PCB_FLAG_CLEARLINE) || (orig_layer != NULL)) + + if ((newflagbits & PCB_FLAG_CLEARLINE) || (orig_layer != NULL)) pcb_poly_clear_from_poly(data, PCB_OBJ_TEXT, Text->parent.layer, Text); *save = NULL; @@ -903,6 +906,8 @@ { void *save; static pcb_flag_values_t pcb_text_flags = 0; + unsigned long oldflg = Text->Flags.f; + if (pcb_text_flags == 0) pcb_text_flags = pcb_obj_valid_flags(PCB_OBJ_TEXT); @@ -914,7 +919,7 @@ pcb_text_flagchg_pre(/*ctx->chgflag.pcb->Data, */Text, ctx->chgflag.flag, &save); PCB_FLAG_CHANGE(ctx->chgflag.how, ctx->chgflag.flag, Text); - pcb_text_flagchg_post(Text, ctx->chgflag.flag, &save); + pcb_text_flagchg_post(Text, oldflg, &save); return Text; } Index: trunk/src/obj_text.h =================================================================== --- trunk/src/obj_text.h (revision 24471) +++ trunk/src/obj_text.h (revision 24472) @@ -83,7 +83,7 @@ address of a local (void *) cache. The calls make sure bbox and rtree administration are done properly */ void pcb_text_flagchg_pre(pcb_text_t *Text, unsigned long flagbits, void **save); -void pcb_text_flagchg_post(pcb_text_t *Text, unsigned long flagbits, void **save); +void pcb_text_flagchg_post(pcb_text_t *Text, unsigned long oldflagbits, void **save); /* Low level draw call for direct rendering on preview */ void pcb_text_draw_string_simple(pcb_font_t *font, const char *string, pcb_coord_t x0, pcb_coord_t y0, int scale, double rotdeg, int mirror, pcb_coord_t thickness, int xordraw, pcb_coord_t xordx, pcb_coord_t xordy); Index: trunk/src/undo_old.c =================================================================== --- trunk/src/undo_old.c (revision 24471) +++ trunk/src/undo_old.c (revision 24472) @@ -412,6 +412,7 @@ int type; pcb_flag_t swap; int must_redraw; + unsigned long oldflg; /* lookup entry by ID */ type = pcb_search_obj_by_id(PCB->Data, &ptr1, &ptr2, &ptr3, Entry->ID, Entry->Kind); @@ -432,14 +433,16 @@ if (pcb_undo_and_draw && must_redraw && (ptr1e != NULL)) pcb_erase_obj(type, ptr1e, ptr2); - if (obj->type == PCB_OBJ_TEXT) + if (obj->type == PCB_OBJ_TEXT) { + oldflg = obj->Flags.f; pcb_text_flagchg_pre((pcb_text_t *)obj, Entry->Data.Flags.f, &txt_save); + } obj->Flags = Entry->Data.Flags; Entry->Data.Flags = swap; if (obj->type == PCB_OBJ_TEXT) - pcb_text_flagchg_post((pcb_text_t *)obj, Entry->Data.Flags.f, &txt_save); + pcb_text_flagchg_post((pcb_text_t *)obj, oldflg, &txt_save); if (pcb_undo_and_draw && must_redraw) pcb_draw_obj((pcb_any_obj_t *)ptr2);