Index: trunk/src/libcschem/util_endpoint.c =================================================================== --- trunk/src/libcschem/util_endpoint.c (revision 9113) +++ trunk/src/libcschem/util_endpoint.c (revision 9114) @@ -36,6 +36,8 @@ csch_sheet_t *sheet; csch_chdr_t *obj; htepu_t *dst; + int (*incl)(void *udata, csch_chdr_t *obj); + void *udata; } find_wire_t; static csch_rtree_dir_t find_wire_cb(void *ctx_, void *obj_, const csch_rtree_box_t *box) @@ -54,6 +56,9 @@ if (line->hdr.parent != ctx->obj->parent) return csch_RTREE_DIR_NOT_FOUND_CONT; + if ((ctx->incl != NULL) && (!ctx->incl(ctx->udata, &line->hdr))) + return csch_RTREE_DIR_NOT_FOUND_CONT; + if ((line->inst.c.p1.x == line->inst.c.p2.x) && (line->inst.c.p1.y == line->inst.c.p2.y)) zerolen = 1; @@ -84,7 +89,7 @@ } -void csch_endpoint_list_connected(csch_sheet_t *sheet, htepu_t *dst, csch_chdr_t *obj) +void csch_endpoint_list_connected(csch_sheet_t *sheet, htepu_t *dst, csch_chdr_t *obj, int (*incl)(void *udata, csch_chdr_t *obj), void *udata) { find_wire_t ctx = {0}; csch_rtree_box_t query; @@ -95,6 +100,8 @@ ctx.sheet = sheet; ctx.obj = obj; ctx.dst = dst; + ctx.incl = incl; + ctx.udata = udata; query.x1 = obj->bbox.x1-1; query.y1 = obj->bbox.y1-1; query.x2 = obj->bbox.x2+1; query.y2 = obj->bbox.y2+1; Index: trunk/src/libcschem/util_endpoint.h =================================================================== --- trunk/src/libcschem/util_endpoint.h (revision 9113) +++ trunk/src/libcschem/util_endpoint.h (revision 9114) @@ -4,7 +4,10 @@ #include #include -/* List endpoint connected wirenet objects for obj from the same wirenet in dst */ -void csch_endpoint_list_connected(csch_sheet_t *sheet, htepu_t *dst, csch_chdr_t *obj); +/* List endpoint connected wirenet objects for obj from the same wirenet + in dst. If incl is not NULL, it is called on each candidate object before + collecting potential intersection points; if incl returns zero, the object + is not included/considered. */ +void csch_endpoint_list_connected(csch_sheet_t *sheet, htepu_t *dst, csch_chdr_t *obj, int (*incl)(void *udata, csch_chdr_t *obj), void *udata); #endif Index: trunk/src/plugins/std_tools/tool_movecopy.c =================================================================== --- trunk/src/plugins/std_tools/tool_movecopy.c (revision 9113) +++ trunk/src/plugins/std_tools/tool_movecopy.c (revision 9114) @@ -57,11 +57,25 @@ htepu_clear(&mvcp.rubber); } -static void rbm_grab_endpoints(csch_sheet_t *sheet, csch_chdr_t *obj) +static int rbm_include(void *ctx, csch_chdr_t *obj) { + /* ignore selected objects - they are being moved, they shouldn't leave + endpoints behind to connect to */ + if (csch_chdr_is_selected(obj)) + return 0; + + return 1; +} + +static void rbm_grab_endpoints(csch_sheet_t *sheet, csch_chdr_t *obj, int omit_selected) +{ if (obj->type != CSCH_CTYPE_LINE) return; - csch_endpoint_list_connected(sheet, &mvcp.rubber, obj); + + if (omit_selected) + csch_endpoint_list_connected(sheet, &mvcp.rubber, obj, rbm_include, NULL); + else + csch_endpoint_list_connected(sheet, &mvcp.rubber, obj, NULL, NULL); } static void rbm_xor_draw(csch_sheet_t *sheet, csch_coord_t dx, csch_coord_t dy) @@ -156,7 +170,7 @@ } if (!mvcp.copy && (mvcp.endpoint == 0) && conf_core.editor.rubber_band_mode) - rbm_grab_endpoints(sheet, mvcp.click_obj); + rbm_grab_endpoints(sheet, mvcp.click_obj, 0); } else { mvcp.click_obj = NULL; @@ -163,7 +177,7 @@ if (!mvcp.copy && conf_core.editor.rubber_band_mode) { long n; for(n = 0; n < mvcp.click_list.used; n++) - rbm_grab_endpoints(sheet, mvcp.click_list.array[n]); + rbm_grab_endpoints(sheet, mvcp.click_list.array[n], 1); } }