Index: trunk/src/crosshair.c =================================================================== --- trunk/src/crosshair.c (revision 18683) +++ trunk/src/crosshair.c (revision 18684) @@ -171,8 +171,8 @@ pcb_coord_t x, y; /* set offset */ - x = pcb_crosshair.X - Buffer->X; - y = pcb_crosshair.Y - Buffer->Y; + x = pcb_crosshair.AttachedObject.tx - Buffer->X; + y = pcb_crosshair.AttachedObject.ty - Buffer->Y; /* draw all visible layers */ for (i = 0; i < pcb_max_layer; i++) @@ -245,8 +245,8 @@ */ void pcb_xordraw_movecopy(void) { - pcb_coord_t dx = pcb_crosshair.X - pcb_crosshair.AttachedObject.X; - pcb_coord_t dy = pcb_crosshair.Y - pcb_crosshair.AttachedObject.Y; + pcb_coord_t dx = pcb_crosshair.AttachedObject.tx - pcb_crosshair.AttachedObject.X; + pcb_coord_t dy = pcb_crosshair.AttachedObject.ty - pcb_crosshair.AttachedObject.Y; int event_sent = 0; switch (pcb_crosshair.AttachedObject.Type) { Index: trunk/src/crosshair.h =================================================================== --- trunk/src/crosshair.h (revision 18683) +++ trunk/src/crosshair.h (revision 18684) @@ -44,6 +44,7 @@ typedef struct { /* currently attached object */ pcb_coord_t X, Y; /* saved position when PCB_MODE_MOVE */ + pcb_coord_t tx, ty; /* target position when PCB_MODE_MOVE */ pcb_box_t BoundingBox; long int Type; /* object type */ long int State; Index: trunk/src/tool_buffer.c =================================================================== --- trunk/src/tool_buffer.c (revision 18683) +++ trunk/src/tool_buffer.c (revision 18684) @@ -67,7 +67,7 @@ pcb_subc_remove(orig_subc); } } - if (pcb_buffer_copy_to_layout(PCB, pcb_tool_note.X, pcb_tool_note.Y)) + if (pcb_buffer_copy_to_layout(PCB, pcb_crosshair.AttachedObject.tx, pcb_crosshair.AttachedObject.ty)) pcb_board_set_changed_flag(pcb_true); if (orig_subc != NULL) { @@ -94,6 +94,12 @@ } } +void pcb_tool_buffer_adjust_attached_objects(void) +{ + pcb_crosshair.AttachedObject.tx = pcb_crosshair.X; + pcb_crosshair.AttachedObject.ty = pcb_crosshair.Y; +} + void pcb_tool_buffer_draw_attached(void) { pcb_xordraw_buffer(PCB_PASTEBUFFER); @@ -105,7 +111,7 @@ pcb_tool_buffer_uninit, pcb_tool_buffer_notify_mode, pcb_tool_buffer_release_mode, - NULL, + pcb_tool_buffer_adjust_attached_objects, pcb_tool_buffer_draw_attached, NULL, NULL, Index: trunk/src/tool_copy.c =================================================================== --- trunk/src/tool_copy.c (revision 18683) +++ trunk/src/tool_copy.c (revision 18684) @@ -75,7 +75,7 @@ pcb_copy_obj(pcb_crosshair.AttachedObject.Type, pcb_crosshair.AttachedObject.Ptr1, pcb_crosshair.AttachedObject.Ptr2, - pcb_crosshair.AttachedObject.Ptr3, pcb_tool_note.X - pcb_crosshair.AttachedObject.X, pcb_tool_note.Y - pcb_crosshair.AttachedObject.Y); + pcb_crosshair.AttachedObject.Ptr3, pcb_crosshair.AttachedObject.tx - pcb_crosshair.AttachedObject.X, pcb_crosshair.AttachedObject.ty - pcb_crosshair.AttachedObject.Y); pcb_board_set_changed_flag(pcb_true); } @@ -94,6 +94,12 @@ } } +void pcb_tool_copy_adjust_attached_objects(void) +{ + pcb_crosshair.AttachedObject.tx = pcb_crosshair.X; + pcb_crosshair.AttachedObject.ty = pcb_crosshair.Y; +} + void pcb_tool_copy_draw_attached(void) { pcb_xordraw_movecopy(); @@ -113,7 +119,7 @@ pcb_tool_copy_uninit, pcb_tool_copy_notify_mode, pcb_tool_copy_release_mode, - NULL, + pcb_tool_copy_adjust_attached_objects, pcb_tool_copy_draw_attached, pcb_tool_copy_undo_act, NULL, Index: trunk/src/tool_move.c =================================================================== --- trunk/src/tool_move.c (revision 18683) +++ trunk/src/tool_move.c (revision 18684) @@ -76,8 +76,8 @@ /* second notify, move object */ case PCB_CH_STATE_SECOND: - dx = pcb_tool_note.X - pcb_crosshair.AttachedObject.X; - dy = pcb_tool_note.Y - pcb_crosshair.AttachedObject.Y; + dx = pcb_crosshair.AttachedObject.tx - pcb_crosshair.AttachedObject.X; + dy = pcb_crosshair.AttachedObject.ty - pcb_crosshair.AttachedObject.Y; if ((dx != 0) || (dy != 0)) { pcb_move_obj_and_rubberband(pcb_crosshair.AttachedObject.Type, pcb_crosshair.AttachedObject.Ptr1, pcb_crosshair.AttachedObject.Ptr2, pcb_crosshair.AttachedObject.Ptr3, dx, dy); pcb_crosshair_set_local_ref(0, 0, pcb_false); @@ -100,6 +100,12 @@ } } +void pcb_tool_move_adjust_attached_objects(void) +{ + pcb_crosshair.AttachedObject.tx = pcb_crosshair.X; + pcb_crosshair.AttachedObject.ty = pcb_crosshair.Y; +} + void pcb_tool_move_draw_attached(void) { pcb_xordraw_movecopy(); @@ -119,7 +125,7 @@ pcb_tool_move_uninit, pcb_tool_move_notify_mode, pcb_tool_move_release_mode, - NULL, + pcb_tool_move_adjust_attached_objects, pcb_tool_move_draw_attached, pcb_tool_move_undo_act, NULL,