Index: trunk/src/draw.c =================================================================== --- trunk/src/draw.c (revision 3683) +++ trunk/src/draw.c (revision 3684) @@ -159,8 +159,11 @@ /* * initiate the actual redrawing of the updated area */ +pcb_cardinal_t pcb_draw_inhibit = 0; void Draw(void) { + if (pcb_draw_inhibit) + return; if (Block.X1 <= Block.X2 && Block.Y1 <= Block.Y2) gui->invalidate_lr(Block.X1, Block.X2, Block.Y1, Block.Y2); Index: trunk/src/draw.h =================================================================== --- trunk/src/draw.h (revision 3683) +++ trunk/src/draw.h (revision 3684) @@ -31,6 +31,19 @@ #include "global.h" +/* Temporarily inhibid drawing if this is non-zero. A function that calls a + lot of other functions that would call Draw() a lot in turn may increase + this value before the calls, then decrease it at the end and call Draw(). + This makes sure the whole block is redrawn only once at the end. */ +extern pcb_cardinal_t pcb_draw_inhibit; + +#define pcb_draw_inhibit_inc() pcb_draw_inhibit++ +#define pcb_draw_inhibit_dec() \ +do { \ + if (pcb_draw_inhibit > 0) \ + pcb_draw_inhibit--; \ +} while(0) \ + void Draw(void); void Redraw(void); void DrawVia(PinTypePtr); Index: trunk/src/move.c =================================================================== --- trunk/src/move.c (revision 3683) +++ trunk/src/move.c (revision 3684) @@ -694,6 +694,8 @@ RubberbandTypePtr ptr; void *ptr2; + pcb_draw_inhibit_inc(); + /* setup offset */ DeltaX = DX; DeltaY = DY; @@ -714,6 +716,10 @@ AddObjectToMoveUndoList(Type, Ptr1, Ptr2, Ptr3, DX, DY); ptr2 = ObjectOperation(&MoveFunctions, Type, Ptr1, Ptr2, Ptr3); IncrementUndoSerialNumber(); + + pcb_draw_inhibit_dec(); + Draw(); + return (ptr2); }