Index: trunk/src/buffer.c =================================================================== --- trunk/src/buffer.c (revision 28889) +++ trunk/src/buffer.c (revision 28890) @@ -61,6 +61,7 @@ #include "extobj.h" static int move_buffer_pre(pcb_opctx_t *ctx, pcb_any_obj_t *ptr2, void *ptr3); +static void move_buffer_post(pcb_opctx_t *ctx, pcb_any_obj_t *ptr2, void *ptr3); static int add_buffer_pre(pcb_opctx_t *ctx, pcb_any_obj_t *ptr2, void *ptr3); static pcb_opfunc_t AddBufferFunctions = { @@ -80,7 +81,7 @@ static pcb_opfunc_t MoveBufferFunctions = { move_buffer_pre, - NULL, /* common_post */ + move_buffer_post, pcb_lineop_move_buffer, pcb_textop_move_buffer, pcb_polyop_move_buffer, @@ -95,23 +96,33 @@ static int move_buffer_pre(pcb_opctx_t *ctx, pcb_any_obj_t *obj, void *ptr3) { - pcb_subc_t *subc; + ctx->buffer.post_subc = pcb_extobj_get_floater_subc(obj); - if (ctx->buffer.removing) return 0; /* don't do anything extobj-special for removing, it's already been done */ - subc = pcb_extobj_get_floater_subc(obj); - -pcb_trace("move buff %p\n", subc); +pcb_trace("move buff %p\n", ctx->buffer.post_subc); /* when an edit-object is moved to buffer, the corresponding subc obj needs to be moved too */ - if (subc != NULL) { - pcb_subcop_move_buffer(ctx, subc); + if (ctx->buffer.post_subc != NULL) { + pcb_subcop_move_buffer(ctx, ctx->buffer.post_subc); return 1; } return 0; } +static void move_buffer_post(pcb_opctx_t *ctx, pcb_any_obj_t *obj, void *ptr3) +{ + if ((!ctx->buffer.removing) || (ctx->buffer.post_subc == NULL)) + return; + +pcb_trace("move buff post: %p\n", ctx->buffer.post_subc); + /* when an edit-object is moved to buffer, the corresponding subc obj needs to be moved too */ + if (ctx->buffer.post_subc != NULL) { + pcb_extobj_subc_geo(ctx->buffer.post_subc); + ctx->buffer.post_subc = NULL; + } +} + static int add_buffer_pre(pcb_opctx_t *ctx, pcb_any_obj_t *obj, void *ptr3) { pcb_subc_t *subc = pcb_extobj_get_floater_subc(obj); Index: trunk/src/extobj.h =================================================================== --- trunk/src/extobj.h (revision 28889) +++ trunk/src/extobj.h (revision 28890) @@ -50,7 +50,7 @@ const char *name; void (*draw_mark)(pcb_draw_info_t *info, pcb_subc_t *obj); /* called when drawing the subc marks (instead of drawing the dashed outline and diamond origin) */ 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 (*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; floater may be NULL (post-floater-deletion update on the parent subc) */ void (*float_new)(pcb_subc_t *subc, pcb_any_obj_t *floater); /* called when a floater object is split so a new floater is created */ pcb_extobj_del_t (*float_del)(pcb_subc_t *subc, pcb_any_obj_t *floater); /* called when a floater object is to be removed; returns what the core should do; if not specified: remove the subc */ void (*chg_attr)(pcb_subc_t *subc, const char *key, const char *value); /* called after an attribute changed; value == NULL means attribute is deleted */ @@ -234,4 +234,14 @@ eo->float_geo(subc, flt); } +PCB_INLINE void pcb_extobj_subc_geo(pcb_subc_t *subc) +{ + pcb_extobj_t *eo; + + eo = pcb_extobj_get(subc); + + if ((eo != NULL) && (eo->float_geo != NULL)) + eo->float_geo(subc, NULL); +} + #endif Index: trunk/src/operation.h =================================================================== --- trunk/src/operation.h (revision 28889) +++ trunk/src/operation.h (revision 28890) @@ -42,6 +42,9 @@ unsigned keep_id:1; unsigned removing:1; pcb_data_t *dst, *src; + + /* internal */ + pcb_subc_t *post_subc; /* remember the extobj parent subc while removing a floater */ } pcb_opctx_buffer_t; typedef struct {