Index: trunk/src/crosshair.c =================================================================== --- trunk/src/crosshair.c (revision 32904) +++ trunk/src/crosshair.c (revision 32905) @@ -592,6 +592,11 @@ rnd_event(&PCB->hidlib, PCB_EVENT_RUBBER_MOVE_DRAW, "icc", 0, dx, dy ); } +void pcb_crosshair_attached_clean(rnd_hidlib_t *hidlib) +{ + +} + void rnd_draw_attached(rnd_hidlib_t *hidlib, rnd_bool inhibit_drawing_mode) { if (!inhibit_drawing_mode) { @@ -617,7 +622,6 @@ rnd_render->set_drawing_mode(rnd_gui, RND_HID_COMP_FLUSH, 1, NULL); } - void rnd_draw_marks(rnd_hidlib_t *hidlib, rnd_bool inhibit_drawing_mode) { rnd_coord_t ms = conf_core.appearance.mark_size, ms2 = ms / 2; Index: trunk/src/crosshair.h =================================================================== --- trunk/src/crosshair.h (revision 32904) +++ trunk/src/crosshair.h (revision 32905) @@ -123,4 +123,7 @@ void pcb_xordraw_movecopy(rnd_bool modifier); void pcb_xordraw_insert_pt_obj(void); +/* Always call this before changing the attached object of the crosshair */ +void pcb_crosshair_attached_clean(rnd_hidlib_t *hidlib); + #endif Index: trunk/src/gui_act.c =================================================================== --- trunk/src/gui_act.c (revision 32904) +++ trunk/src/gui_act.c (revision 32905) @@ -392,6 +392,7 @@ /* line has two endpoints, check which one is close to the original x;y */ pcb_line_t *l = ptr2; if (close_enough(hidlib->tool_x, l->Point1.X) && close_enough(hidlib->tool_y, l->Point1.Y)) { + pcb_crosshair_attached_clean(hidlib); pcb_crosshair.AttachedObject.Type = PCB_OBJ_LINE_POINT; pcb_crosshair.AttachedObject.Ptr1 = ptr1; pcb_crosshair.AttachedObject.Ptr2 = ptr2; @@ -399,6 +400,7 @@ goto switched; } if (close_enough(hidlib->tool_x, l->Point2.X) && close_enough(hidlib->tool_y, l->Point2.Y)) { + pcb_crosshair_attached_clean(hidlib); pcb_crosshair.AttachedObject.Type = PCB_OBJ_LINE_POINT; pcb_crosshair.AttachedObject.Ptr1 = ptr1; pcb_crosshair.AttachedObject.Ptr2 = ptr2; @@ -410,6 +412,7 @@ rnd_coord_t ex, ey; pcb_arc_get_end((pcb_arc_t *)ptr2, 0, &ex, &ey); if (close_enough(hidlib->tool_x, ex) && close_enough(hidlib->tool_y, ey)) { + pcb_crosshair_attached_clean(hidlib); pcb_crosshair.AttachedObject.Type = PCB_OBJ_ARC_POINT; pcb_crosshair.AttachedObject.Ptr1 = ptr1; pcb_crosshair.AttachedObject.Ptr2 = ptr2; @@ -418,6 +421,7 @@ } pcb_arc_get_end((pcb_arc_t *)ptr2, 1, &ex, &ey); if (close_enough(hidlib->tool_x, ex) && close_enough(hidlib->tool_y, ey)) { + pcb_crosshair_attached_clean(hidlib); pcb_crosshair.AttachedObject.Type = PCB_OBJ_ARC_POINT; pcb_crosshair.AttachedObject.Ptr1 = ptr1; pcb_crosshair.AttachedObject.Ptr2 = ptr2; @@ -426,6 +430,7 @@ } } else if (pcb_search_obj_by_id(PCB->Data, &ptr1, &ptr2, &ptr3, pcb_crosshair.drags[pcb_crosshair.drags_current], PCB_OBJ_ARC) != PCB_OBJ_VOID) { + pcb_crosshair_attached_clean(hidlib); pcb_crosshair.AttachedObject.Type = PCB_OBJ_ARC; pcb_crosshair.AttachedObject.Ptr1 = ptr1; pcb_crosshair.AttachedObject.Ptr2 = ptr2; Index: trunk/src_plugins/serpentine/serpentine.c =================================================================== --- trunk/src_plugins/serpentine/serpentine.c (revision 32904) +++ trunk/src_plugins/serpentine/serpentine.c (revision 32905) @@ -292,6 +292,7 @@ static void tool_serpentine_uninit(void) { rnd_hid_notify_crosshair_change(&PCB->hidlib, rnd_false); + pcb_crosshair_attached_clean(&PCB->hidlib); pcb_crosshair.AttachedObject.Type = PCB_OBJ_VOID; pcb_crosshair.AttachedObject.State = PCB_CH_STATE_FIRST; rnd_hid_notify_crosshair_change(&PCB->hidlib, rnd_true); @@ -304,6 +305,7 @@ switch (pcb_crosshair.AttachedObject.State) { case PCB_CH_STATE_FIRST: + pcb_crosshair_attached_clean(hl); pcb_crosshair.AttachedObject.Type = pcb_search_screen(hl->tool_x, hl->tool_y, PCB_OBJ_LINE, &pcb_crosshair.AttachedObject.Ptr1, &pcb_crosshair.AttachedObject.Ptr2, &pcb_crosshair.AttachedObject.Ptr3); /* TODO: check if an object is on the current layer */ Index: trunk/src_plugins/sketch_route/sketch_route.c =================================================================== --- trunk/src_plugins/sketch_route/sketch_route.c (revision 32904) +++ trunk/src_plugins/sketch_route/sketch_route.c (revision 32905) @@ -1012,6 +1012,7 @@ { rnd_hid_notify_crosshair_change(&PCB->hidlib, rnd_false); attached_path_uninit(); + pcb_crosshair_attached_clean(&PCB->hidlib); pcb_crosshair.AttachedObject.Type = PCB_OBJ_VOID; pcb_crosshair.AttachedObject.State = PCB_CH_STATE_FIRST; rnd_hid_notify_crosshair_change(&PCB->hidlib, rnd_true); @@ -1033,6 +1034,7 @@ && ((type == PCB_OBJ_PSTK && pcb_pstk_shape_at(PCB, (pcb_pstk_t *) term_obj, PCB_CURRLAYER(PCB)) != NULL) || type != PCB_OBJ_PSTK) && attached_path_init(PCB_CURRLAYER(PCB), term_obj)) { + pcb_crosshair_attached_clean(hl); pcb_crosshair.AttachedObject.Type = PCB_OBJ_LINE; pcb_crosshair.AttachedObject.State = PCB_CH_STATE_SECOND; } @@ -1051,6 +1053,7 @@ || type != PCB_OBJ_PSTK)) { if (attached_path_finish(term_obj) == rnd_true) { attached_path_uninit(); + pcb_crosshair_attached_clean(hl); pcb_crosshair.AttachedObject.Type = PCB_OBJ_VOID; pcb_crosshair.AttachedObject.State = PCB_CH_STATE_FIRST; } else { Index: trunk/src_plugins/tool_std/tool_arrow.c =================================================================== --- trunk/src_plugins/tool_std/tool_arrow.c (revision 32904) +++ trunk/src_plugins/tool_std/tool_arrow.c (revision 32905) @@ -53,6 +53,7 @@ void pcb_tool_arrow_uninit(void) { rnd_hid_notify_crosshair_change(&PCB->hidlib, rnd_false); + pcb_crosshair_attached_clean(&PCB->hidlib); pcb_crosshair.AttachedObject.Type = PCB_OBJ_VOID; pcb_crosshair.AttachedObject.State = PCB_CH_STATE_FIRST; pcb_crosshair.AttachedBox.State = PCB_CH_STATE_FIRST; @@ -89,6 +90,7 @@ rnd_tool_save(hl); rnd_tool_is_saved = rnd_true; rnd_tool_select_by_name(hl, rnd_gui->control_is_pressed(rnd_gui)? "copy" : "move"); + pcb_crosshair_attached_clean(hl); pcb_crosshair.AttachedObject.Ptr1 = pcb_crosshair_note.ptr1; pcb_crosshair.AttachedObject.Ptr2 = pcb_crosshair_note.ptr2; pcb_crosshair.AttachedObject.Ptr3 = pcb_crosshair_note.ptr3; Index: trunk/src_plugins/tool_std/tool_copy.c =================================================================== --- trunk/src_plugins/tool_std/tool_copy.c (revision 32904) +++ trunk/src_plugins/tool_std/tool_copy.c (revision 32905) @@ -44,6 +44,7 @@ void pcb_tool_copy_uninit(void) { rnd_hid_notify_crosshair_change(&PCB->hidlib, rnd_false); + pcb_crosshair_attached_clean(&PCB->hidlib); pcb_crosshair.AttachedObject.Type = PCB_OBJ_VOID; pcb_crosshair.AttachedObject.State = PCB_CH_STATE_FIRST; rnd_hid_notify_crosshair_change(&PCB->hidlib, rnd_true); @@ -60,6 +61,7 @@ { int types = PCB_COPY_TYPES; + pcb_crosshair_attached_clean(hl); pcb_crosshair.AttachedObject.Type = pcb_search_screen(hl->tool_x, hl->tool_y, types, &pcb_crosshair.AttachedObject.Ptr1, &pcb_crosshair.AttachedObject.Ptr2, &pcb_crosshair.AttachedObject.Ptr3); @@ -85,6 +87,7 @@ } /* reset identifiers */ + pcb_crosshair_attached_clean(hl); pcb_crosshair.AttachedObject.Type = PCB_OBJ_VOID; pcb_crosshair.AttachedObject.State = PCB_CH_STATE_FIRST; pcb_crosshair.extobj_edit = NULL; Index: trunk/src_plugins/tool_std/tool_insert.c =================================================================== --- trunk/src_plugins/tool_std/tool_insert.c (revision 32904) +++ trunk/src_plugins/tool_std/tool_insert.c (revision 32905) @@ -54,6 +54,7 @@ void pcb_tool_insert_uninit(void) { rnd_hid_notify_crosshair_change(&PCB->hidlib, rnd_false); + pcb_crosshair_attached_clean(&PCB->hidlib); pcb_crosshair.AttachedObject.Type = PCB_OBJ_VOID; pcb_crosshair.AttachedObject.State = PCB_CH_STATE_FIRST; pcb_crosshair.extobj_edit = NULL; @@ -66,6 +67,7 @@ switch (pcb_crosshair.AttachedObject.State) { /* first notify, lookup object */ case PCB_CH_STATE_FIRST: + pcb_crosshair_attached_clean(hl); pcb_crosshair.AttachedObject.Type = pcb_search_screen_maybe_selector(hl->tool_x, hl->tool_y, PCB_INSERT_TYPES, &pcb_crosshair.AttachedObject.Ptr1, &pcb_crosshair.AttachedObject.Ptr2, &pcb_crosshair.AttachedObject.Ptr3); @@ -74,6 +76,7 @@ pcb_any_obj_t *obj = (pcb_any_obj_t *)pcb_crosshair.AttachedObject.Ptr2; if (PCB_FLAG_TEST(PCB_FLAG_LOCK, obj)) { rnd_message(RND_MSG_WARNING, "Sorry, %s object is locked\n", pcb_obj_type_name(obj->type)); + pcb_crosshair_attached_clean(hl); pcb_crosshair.AttachedObject.Type = PCB_OBJ_VOID; pcb_crosshair.extobj_edit = NULL; break; @@ -101,6 +104,7 @@ pcb_crosshair.AttachedObject.Ptr2, &polyIndex, InsertedPoint.X, InsertedPoint.Y, rnd_false, rnd_false); pcb_board_set_changed_flag(pcb, rnd_true); + pcb_crosshair_attached_clean(hl); pcb_crosshair.AttachedObject.Type = PCB_OBJ_VOID; pcb_crosshair.AttachedObject.State = PCB_CH_STATE_FIRST; pcb_crosshair.extobj_edit = NULL; @@ -111,6 +115,7 @@ /* second notify, insert new point into object */ case PCB_CH_STATE_SECOND: + pcb_crosshair_attached_clean(hl); if (pcb_crosshair.AttachedObject.Type == PCB_OBJ_POLY) pcb_insert_point_in_object(PCB_OBJ_POLY, pcb_crosshair.AttachedObject.Ptr1, fake.poly, @@ -122,6 +127,7 @@ pcb_board_set_changed_flag(pcb, rnd_true); /* reset identifiers */ + pcb_crosshair_attached_clean(hl); pcb_crosshair.AttachedObject.Type = PCB_OBJ_VOID; pcb_crosshair.AttachedObject.State = PCB_CH_STATE_FIRST; pcb_crosshair.extobj_edit = NULL; Index: trunk/src_plugins/tool_std/tool_move.c =================================================================== --- trunk/src_plugins/tool_std/tool_move.c (revision 32904) +++ trunk/src_plugins/tool_std/tool_move.c (revision 32905) @@ -47,6 +47,7 @@ void pcb_tool_move_uninit(void) { rnd_hid_notify_crosshair_change(&PCB->hidlib, rnd_false); + pcb_crosshair_attached_clean(&PCB->hidlib); pcb_crosshair.AttachedObject.Type = PCB_OBJ_VOID; pcb_crosshair.AttachedObject.State = PCB_CH_STATE_FIRST; rnd_hid_notify_crosshair_change(&PCB->hidlib, rnd_true); @@ -64,6 +65,7 @@ { int types = PCB_MOVE_TYPES; + pcb_crosshair_attached_clean(hl); pcb_crosshair.AttachedObject.Type = pcb_search_screen(hl->tool_x, hl->tool_y, types, &pcb_crosshair.AttachedObject.Ptr1, &pcb_crosshair.AttachedObject.Ptr2, &pcb_crosshair.AttachedObject.Ptr3); @@ -71,6 +73,7 @@ pcb_any_obj_t *obj = (pcb_any_obj_t *)pcb_crosshair.AttachedObject.Ptr2; if (PCB_FLAG_TEST(PCB_FLAG_LOCK, obj)) { rnd_message(RND_MSG_WARNING, "Sorry, %s object is locked\n", pcb_obj_type_name(obj->type)); + pcb_crosshair_attached_clean(hl); pcb_crosshair.AttachedObject.Type = PCB_OBJ_VOID; pcb_crosshair.extobj_edit = NULL; } @@ -121,6 +124,7 @@ pcb_extobj_float_geo(pcb_crosshair.extobj_edit); /* reset identifiers */ + pcb_crosshair_attached_clean(hl); pcb_crosshair.AttachedObject.Type = PCB_OBJ_VOID; pcb_crosshair.AttachedObject.State = PCB_CH_STATE_FIRST; pcb_crosshair.extobj_edit = NULL; Index: trunk/src_plugins/tool_std/tool_polyhole.c =================================================================== --- trunk/src_plugins/tool_std/tool_polyhole.c (revision 32904) +++ trunk/src_plugins/tool_std/tool_polyhole.c (revision 32905) @@ -56,6 +56,7 @@ switch (pcb_crosshair.AttachedObject.State) { /* first notify, lookup object */ case PCB_CH_STATE_FIRST: + pcb_crosshair_attached_clean(hl); pcb_crosshair.AttachedPolygon_pts = 0; pcb_crosshair.AttachedObject.Type = pcb_search_screen_maybe_selector(hl->tool_x, hl->tool_y, PCB_OBJ_POLY, @@ -68,6 +69,7 @@ if (PCB_FLAG_TEST(PCB_FLAG_LOCK, (pcb_poly_t *)pcb_crosshair.AttachedObject.Ptr2)) { rnd_message(RND_MSG_WARNING, "Sorry, poly object is locked\n"); + pcb_crosshair_attached_clean(hl); pcb_crosshair.AttachedObject.Type = PCB_OBJ_VOID; pcb_crosshair.extobj_edit = NULL; break;