Index: trunk/src/event.h =================================================================== --- trunk/src/event.h (revision 5240) +++ trunk/src/event.h (revision 5241) @@ -35,6 +35,7 @@ PCB_EVENT_RUBBER_RESET, /* rubber band: reset attached */ PCB_EVENT_RUBBER_REMOVE_ELEMENT, /* rubber band: removed an element with rubber bands attached */ + PCB_EVENT_RUBBER_MOVE, /* rubber band: object moved */ PCB_EVENT_last /* not a real event */ } pcb_event_id_t; Index: trunk/src/move.c =================================================================== --- trunk/src/move.c (revision 5240) +++ trunk/src/move.c (revision 5241) @@ -40,6 +40,7 @@ #include "move.h" #include "select.h" #include "undo.h" +#include "event.h" #include "hid_actions.h" #include "compat_misc.h" #include "obj_all_op.h" @@ -86,7 +87,6 @@ */ void *pcb_move_obj_and_rubberband(int Type, void *Ptr1, void *Ptr2, void *Ptr3, pcb_coord_t DX, pcb_coord_t DY) { - pcb_rubberband_t *ptr; pcb_opctx_t ctx; void *ptr2; @@ -96,27 +96,11 @@ ctx.move.dx = DX; ctx.move.dy = DY; - if (DX == 0 && DY == 0) { - int n; + pcb_event(PCB_EVENT_RUBBER_MOVE, "ccp", DX, DY, &ctx); - /* first clear any marks that we made in the line flags */ - for(n = 0, ptr = pcb_crosshair.AttachedObject.Rubberband; n < pcb_crosshair.AttachedObject.RubberbandN; n++, ptr++) - PCB_FLAG_CLEAR(PCB_FLAG_RUBBEREND, ptr->Line); + if (DX == 0 && DY == 0) + return NULL; - return (NULL); - } - - /* move all the lines... and reset the counter */ - ptr = pcb_crosshair.AttachedObject.Rubberband; - while (pcb_crosshair.AttachedObject.RubberbandN) { - /* first clear any marks that we made in the line flags */ - PCB_FLAG_CLEAR(PCB_FLAG_RUBBEREND, ptr->Line); - pcb_undo_add_obj_to_move(PCB_TYPE_LINE_POINT, ptr->Layer, ptr->Line, ptr->MovedPoint, DX, DY); - MoveLinePoint(&ctx, ptr->Layer, ptr->Line, ptr->MovedPoint); - pcb_crosshair.AttachedObject.RubberbandN--; - ptr++; - } - pcb_undo_add_obj_to_move(Type, Ptr1, Ptr2, Ptr3, DX, DY); ptr2 = pcb_object_operation(&MoveFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3); pcb_undo_inc_serial(); Index: trunk/src/rubberband.c =================================================================== --- trunk/src/rubberband.c (revision 5240) +++ trunk/src/rubberband.c (revision 5241) @@ -40,6 +40,8 @@ #include "event.h" #include "undo.h" #include "obj_rat_draw.h" +#include "operation.h" +#include "obj_line_op.h" #include "polygon.h" @@ -554,6 +556,34 @@ } } +static void rbe_move(void *user_data, int argc, pcb_event_arg_t argv[]) +{ + pcb_rubberband_t *ptr; + pcb_coord_t DX = argv[1].d.c, DY = argv[2].d.c; + pcb_opctx_t *ctx = argv[3].d.p; + + if (DX == 0 && DY == 0) { + int n; + + /* first clear any marks that we made in the line flags */ + for(n = 0, ptr = pcb_crosshair.AttachedObject.Rubberband; n < pcb_crosshair.AttachedObject.RubberbandN; n++, ptr++) + PCB_FLAG_CLEAR(PCB_FLAG_RUBBEREND, ptr->Line); + + return; + } + + /* move all the lines... and reset the counter */ + ptr = pcb_crosshair.AttachedObject.Rubberband; + while (pcb_crosshair.AttachedObject.RubberbandN) { + /* first clear any marks that we made in the line flags */ + PCB_FLAG_CLEAR(PCB_FLAG_RUBBEREND, ptr->Line); + pcb_undo_add_obj_to_move(PCB_TYPE_LINE_POINT, ptr->Layer, ptr->Line, ptr->MovedPoint, DX, DY); + MoveLinePoint(ctx, ptr->Layer, ptr->Line, ptr->MovedPoint); + pcb_crosshair.AttachedObject.RubberbandN--; + ptr++; + } +} + static const char *rubber_cookie = "old rubberband"; void pcb_rubberband_init(void) @@ -561,4 +591,5 @@ void *ctx = NULL; pcb_event_bind(PCB_EVENT_RUBBER_RESET, rbe_reset, ctx, rubber_cookie); pcb_event_bind(PCB_EVENT_RUBBER_REMOVE_ELEMENT, rbe_remove_element, ctx, rubber_cookie); + pcb_event_bind(PCB_EVENT_RUBBER_MOVE, rbe_move, ctx, rubber_cookie); }