Index: trunk/src/obj_arc.c =================================================================== --- trunk/src/obj_arc.c (revision 13852) +++ trunk/src/obj_arc.c (revision 13853) @@ -535,7 +535,6 @@ pcb_arc_invalidate_erase(Arc); pcb_arc_move(Arc, ctx->move.dx, ctx->move.dy); pcb_arc_invalidate_draw(Layer, Arc); - pcb_draw(); } else { pcb_arc_move(Arc, ctx->move.dx, ctx->move.dy); @@ -593,10 +592,8 @@ pcb_message(PCB_MSG_WARNING, _("Sorry, the object is locked\n")); return NULL; } - if (ctx->move.dst_layer == Layer && Layer->meta.real.vis) { + if (ctx->move.dst_layer == Layer && Layer->meta.real.vis) pcb_arc_invalidate_draw(Layer, Arc); - pcb_draw(); - } if (ctx->move.dst_layer == Layer) return Arc; pcb_undo_add_obj_to_move_to_layer(PCB_TYPE_ARC, Layer, Arc, Arc); @@ -607,7 +604,6 @@ pcb_poly_clear_from_poly(PCB->Data, PCB_TYPE_ARC, ctx->move.dst_layer, Arc); if (ctx->move.dst_layer->meta.real.vis) pcb_arc_invalidate_draw(ctx->move.dst_layer, newone); - pcb_draw(); return newone; } @@ -626,11 +622,8 @@ void *pcb_arcop_remve(pcb_opctx_t *ctx, pcb_layer_t *Layer, pcb_arc_t *Arc) { /* erase from screen */ - if (Layer->meta.real.vis) { + if (Layer->meta.real.vis) pcb_arc_invalidate_erase(Arc); - if (!ctx->remove.bulk) - pcb_draw(); - } pcb_undo_move_obj_to_remove(PCB_TYPE_ARC, Layer, Arc, Arc); return NULL; } @@ -642,13 +635,15 @@ void *pcb_arc_destroy(pcb_layer_t *Layer, pcb_arc_t *Arc) { + void *res; pcb_opctx_t ctx; ctx.remove.pcb = PCB; - ctx.remove.bulk = pcb_false; ctx.remove.destroy_target = NULL; - return pcb_arcop_remve(&ctx, Layer, Arc); + res = pcb_arcop_remve(&ctx, Layer, Arc); + pcb_draw(); + return res; } /* rotates an arc */ @@ -713,7 +708,6 @@ pcb_r_insert_entry(Layer->arc_tree, (pcb_box_t *) Arc, 0); pcb_poly_clear_from_poly(PCB->Data, PCB_TYPE_ARC, Layer, Arc); pcb_arc_invalidate_draw(Layer, Arc); - pcb_draw(); return Arc; } Index: trunk/src/obj_elem.c =================================================================== --- trunk/src/obj_elem.c (revision 13852) +++ trunk/src/obj_elem.c (revision 13853) @@ -1128,14 +1128,16 @@ void *pcb_element_remove(pcb_element_t *Element) { + void *res; pcb_opctx_t ctx; ctx.remove.pcb = PCB; - ctx.remove.bulk = pcb_false; ctx.remove.destroy_target = NULL; PCB_CLEAR_PARENT(Element); - return pcb_elemop_remove(&ctx, Element); + res = pcb_elemop_remove(&ctx, Element); + pcb_draw(); + return res; } /* rotate an element in 90 degree steps */ @@ -1724,7 +1726,6 @@ } PCB_END_LOOP; pcb_elem_name_invalidate_draw(Element); - pcb_draw(); } else { PCB_ELEMENT_PCB_TEXT_LOOP(Element); @@ -1743,14 +1744,11 @@ /* moves an element */ void *pcb_elemop_move(pcb_opctx_t *ctx, pcb_element_t *Element) { - pcb_bool didDraw = pcb_false; - if (pcb_silk_on(PCB) && (PCB_FRONT(Element) || PCB->InvisibleObjectsOn)) { pcb_elem_invalidate_erase(Element); pcb_element_move(PCB->Data, Element, ctx->move.dx, ctx->move.dy); pcb_elem_name_invalidate_draw(Element); pcb_elem_package_invalidate_draw(Element); - didDraw = pcb_true; } else { if (PCB->PinOn) @@ -1759,10 +1757,7 @@ } if (PCB->PinOn) { pcb_elem_pp_invalidate_draw(Element); - didDraw = pcb_true; } - if (didDraw) - pcb_draw(); return Element; } @@ -1802,11 +1797,8 @@ void *pcb_elemop_remove(pcb_opctx_t *ctx, pcb_element_t *Element) { /* erase from screen */ - if ((pcb_silk_on(PCB) || PCB->PinOn) && (PCB_FRONT(Element) || PCB->InvisibleObjectsOn)) { + if ((pcb_silk_on(PCB) || PCB->PinOn) && (PCB_FRONT(Element) || PCB->InvisibleObjectsOn)) pcb_elem_invalidate_erase(Element); - if (!ctx->remove.bulk) - pcb_draw(); - } pcb_undo_move_obj_to_remove(PCB_TYPE_ELEMENT, Element, Element, Element); return NULL; } @@ -1817,7 +1809,6 @@ pcb_elem_invalidate_erase(Element); pcb_element_rotate90(PCB->Data, Element, ctx->rotate.center_x, ctx->rotate.center_y, ctx->rotate.number); pcb_elem_invalidate_draw(Element); - pcb_draw(); return Element; } @@ -1835,7 +1826,6 @@ } PCB_END_LOOP; pcb_elem_name_invalidate_draw(Element); - pcb_draw(); return Element; } Index: trunk/src/obj_line.c =================================================================== --- trunk/src/obj_line.c (revision 13852) +++ trunk/src/obj_line.c (revision 13853) @@ -493,10 +493,8 @@ if (Layer->meta.real.vis) pcb_line_invalidate_erase(Line); pcb_line_move(Line, ctx->move.dx, ctx->move.dy); - if (Layer->meta.real.vis) { + if (Layer->meta.real.vis) pcb_line_invalidate_draw(Layer, Line); - pcb_draw(); - } return Line; } @@ -537,10 +535,8 @@ pcb_line_bbox(Line); pcb_r_insert_entry(Layer->line_tree, &Line->BoundingBox, 0); pcb_poly_clear_from_poly(ctx->move.pcb->Data, PCB_TYPE_LINE, Layer, Line); - if (Layer->meta.real.vis) { + if (Layer->meta.real.vis) pcb_line_invalidate_draw(Layer, Line); - pcb_draw(); - } return Line; } else { /* must be a rat */ @@ -551,10 +547,8 @@ PCB_MOVE(Point->X, Point->Y, ctx->move.dx, ctx->move.dy); pcb_line_bbox(Line); pcb_r_insert_entry(ctx->move.pcb->Data->rat_tree, &Line->BoundingBox, 0); - if (ctx->move.pcb->RatOn) { + if (ctx->move.pcb->RatOn) pcb_rat_invalidate_draw((pcb_rat_t *) Line); - pcb_draw(); - } return Line; } } @@ -589,8 +583,6 @@ pcb_gui->control_is_pressed() ); pcb_route_apply_to_line(&route,Layer,Line); pcb_route_destroy(&route); - - pcb_draw(); } return NULL; } @@ -645,10 +637,8 @@ pcb_message(PCB_MSG_WARNING, _("Sorry, the object is locked\n")); return NULL; } - if (ctx->move.dst_layer == Layer && Layer->meta.real.vis) { + if (ctx->move.dst_layer == Layer && Layer->meta.real.vis) pcb_line_invalidate_draw(Layer, Line); - pcb_draw(); - } if (ctx->move.dst_layer == Layer) return Line; @@ -661,7 +651,6 @@ pcb_poly_clear_from_poly(PCB->Data, PCB_TYPE_LINE, ctx->move.dst_layer, newone); if (ctx->move.dst_layer->meta.real.vis) pcb_line_invalidate_draw(ctx->move.dst_layer, newone); - pcb_draw(); if (!PCB->ViaOn || ctx->move.more_to_come || pcb_layer_get_group_(Layer) == pcb_layer_get_group_(ctx->move.dst_layer) || !(pcb_layer_flags(PCB, pcb_layer_id(PCB->Data, Layer)) & PCB_LYT_COPPER) || !(pcb_layer_flags_(ctx->move.dst_layer) & PCB_LYT_COPPER)) @@ -690,7 +679,6 @@ if (setjmp(info.env) == 0) pcb_r_search(Layer->line_tree, &sb, NULL, moveline_callback, &info, NULL); } - pcb_draw(); return newone; } @@ -754,11 +742,8 @@ void *pcb_lineop_remove(pcb_opctx_t *ctx, pcb_layer_t *Layer, pcb_line_t *Line) { /* erase from screen */ - if (Layer->meta.real.vis) { + if (Layer->meta.real.vis) pcb_line_invalidate_erase(Line); - if (!ctx->remove.bulk) - pcb_draw(); - } pcb_undo_move_obj_to_remove(PCB_TYPE_LINE, Layer, Line, Line); return NULL; } @@ -765,13 +750,15 @@ void *pcb_line_destroy(pcb_layer_t *Layer, pcb_line_t *Line) { + void *res; pcb_opctx_t ctx; ctx.remove.pcb = PCB; - ctx.remove.bulk = pcb_false; ctx.remove.destroy_target = NULL; - return pcb_lineop_remove(&ctx, Layer, Line); + res = pcb_lineop_remove(&ctx, Layer, Line); + pcb_draw(); + return res; } /* rotates a line in 90 degree steps */ @@ -860,7 +847,6 @@ pcb_r_insert_entry(PCB->Data->rat_tree, (pcb_box_t *) Line, 0); pcb_rat_invalidate_draw((pcb_rat_t *) Line); } - pcb_draw(); } /* rotates a line's point */ @@ -921,7 +907,6 @@ pcb_poly_clear_from_poly(PCB->Data, PCB_TYPE_LINE, Layer, line); /* creation call adds it to the rtree */ } - pcb_draw(); return line; } Index: trunk/src/obj_pad.c =================================================================== --- trunk/src/obj_pad.c (revision 13852) +++ trunk/src/obj_pad.c (revision 13853) @@ -216,7 +216,6 @@ pcb_undo_add_obj_to_flag(Pad); PCB_FLAG_TOGGLE(PCB_FLAG_NOPASTE, Pad); pcb_pad_invalidate_draw(Pad); - pcb_draw(); return pcb_true; } Index: trunk/src/obj_pinvia.c =================================================================== --- trunk/src/obj_pinvia.c (revision 13852) +++ trunk/src/obj_pinvia.c (revision 13853) @@ -841,10 +841,8 @@ if (PCB->ViaOn) pcb_via_invalidate_erase(Via); pcb_via_move(Via, ctx->move.dx, ctx->move.dy); - if (PCB->ViaOn) { + if (PCB->ViaOn) pcb_via_invalidate_draw(Via); - pcb_draw(); - } return Via; } @@ -886,11 +884,8 @@ void *pcb_viaop_remove(pcb_opctx_t *ctx, pcb_pin_t *Via) { /* erase from screen and memory */ - if (PCB->ViaOn) { + if (PCB->ViaOn) pcb_via_invalidate_erase(Via); - if (!ctx->remove.bulk) - pcb_draw(); - } pcb_undo_move_obj_to_remove(PCB_TYPE_VIA, Via, Via, Via); return NULL; } Index: trunk/src/obj_poly.c =================================================================== --- trunk/src/obj_poly.c (revision 13852) +++ trunk/src/obj_poly.c (revision 13853) @@ -491,10 +491,8 @@ pcb_poly_bbox(Polygon); pcb_r_insert_entry(Layer->polygon_tree, (pcb_box_t *) Polygon, 0); pcb_poly_init_clip(PCB->Data, Layer, Polygon); - if (ctx->insert.forcible || !pcb_poly_remove_excess_points(Layer, Polygon)) { + if (ctx->insert.forcible || !pcb_poly_remove_excess_points(Layer, Polygon)) pcb_poly_invalidate_draw(Layer, Polygon); - pcb_draw(); - } pcb_poly_ppclear(Polygon); @@ -540,10 +538,8 @@ } pcb_poly_move(Polygon, ctx->move.dx, ctx->move.dy); pcb_poly_init_clip(PCB->Data, Layer, Polygon); - if (Layer->meta.real.vis) { + if (Layer->meta.real.vis) pcb_poly_invalidate_draw(Layer, Polygon); - pcb_draw(); - } return Polygon; } @@ -582,10 +578,8 @@ pcb_r_insert_entry(Layer->polygon_tree, (pcb_box_t *) Polygon, 0); pcb_poly_remove_excess_points(Layer, Polygon); pcb_poly_init_clip(PCB->Data, Layer, Polygon); - if (Layer->meta.real.vis) { + if (Layer->meta.real.vis) pcb_poly_invalidate_draw(Layer, Polygon); - pcb_draw(); - } pcb_poly_ppclear(Polygon); return Point; } @@ -654,10 +648,8 @@ pcb_r_search(PCB->Data->via_tree, &Polygon->BoundingBox, NULL, mptl_pin_callback, &d, NULL); newone = (struct pcb_poly_s *) pcb_polyop_move_to_layer_low(ctx, Layer, Polygon, ctx->move.dst_layer); pcb_poly_init_clip(PCB->Data, ctx->move.dst_layer, newone); - if (ctx->move.dst_layer->meta.real.vis) { + if (ctx->move.dst_layer->meta.real.vis) pcb_poly_invalidate_draw(ctx->move.dst_layer, newone); - pcb_draw(); - } return newone; } @@ -715,11 +707,8 @@ { /* erase from screen */ pcb_poly_pprestore(Polygon); - if (Layer->meta.real.vis) { + if (Layer->meta.real.vis) pcb_poly_invalidate_erase(Polygon); - if (!ctx->remove.bulk) - pcb_draw(); - } pcb_undo_move_obj_to_remove(PCB_TYPE_POLY, Layer, Polygon, Polygon); return NULL; } @@ -726,13 +715,15 @@ void *pcb_poly_remove(pcb_layer_t *Layer, pcb_poly_t *Polygon) { + void *res; pcb_opctx_t ctx; ctx.remove.pcb = PCB; - ctx.remove.bulk = pcb_false; ctx.remove.destroy_target = NULL; - return pcb_polyop_remove(&ctx, Layer, Polygon); + res = pcb_polyop_remove(&ctx, Layer, Polygon); + pcb_draw(); + return res; } /* Removes a contour from a polygon. @@ -747,11 +738,8 @@ pcb_poly_pprestore(Polygon); - if (Layer->meta.real.vis) { + if (Layer->meta.real.vis) pcb_poly_invalidate_erase(Polygon); - if (!ctx->remove.bulk) - pcb_draw(); - } /* Copy the polygon to the undo list */ pcb_undo_add_obj_to_remove_contour(PCB_TYPE_POLY, Layer, Polygon); @@ -775,11 +763,8 @@ pcb_poly_ppclear(Polygon); /* redraw polygon if necessary */ - if (Layer->meta.real.vis) { + if (Layer->meta.real.vis) pcb_poly_invalidate_draw(Layer, Polygon); - if (!ctx->remove.bulk) - pcb_draw(); - } return NULL; } @@ -825,11 +810,8 @@ pcb_poly_init_clip(PCB->Data, Layer, Polygon); /* redraw polygon if necessary */ - if (Layer->meta.real.vis) { + if (Layer->meta.real.vis) pcb_poly_invalidate_draw(Layer, Polygon); - if (!ctx->remove.bulk) - pcb_draw(); - } pcb_poly_ppclear(Polygon); return NULL; @@ -862,10 +844,8 @@ pcb_poly_rotate90(Polygon, ctx->rotate.center_x, ctx->rotate.center_y, ctx->rotate.number); pcb_r_insert_entry(Layer->polygon_tree, (pcb_box_t *) Polygon, 0); pcb_poly_init_clip(PCB->Data, Layer, Polygon); - if (Layer->meta.real.vis) { + if (Layer->meta.real.vis) pcb_poly_invalidate_draw(Layer, Polygon); - pcb_draw(); - } pcb_poly_ppclear(Polygon); return Polygon; } @@ -877,10 +857,8 @@ pcb_poly_invalidate_erase(Polygon); pcb_poly_rotate(Layer, Polygon, ctx->rotate.center_x, ctx->rotate.center_y, ctx->rotate.cosa, ctx->rotate.sina); pcb_poly_init_clip(PCB->Data, Layer, Polygon); - if (Layer->meta.real.vis) { + if (Layer->meta.real.vis) pcb_poly_invalidate_draw(Layer, Polygon); - pcb_draw(); - } pcb_poly_ppclear(Polygon); return Polygon; } Index: trunk/src/obj_pstk_op.c =================================================================== --- trunk/src/obj_pstk_op.c (revision 13852) +++ trunk/src/obj_pstk_op.c (revision 13853) @@ -91,7 +91,6 @@ pcb_pstk_invalidate_erase(ps); pcb_pstk_move_(ps, ctx->move.dx, ctx->move.dy); pcb_pstk_invalidate_draw(ps); - pcb_draw(); return ps; } Index: trunk/src/obj_rat.c =================================================================== --- trunk/src/obj_rat.c (revision 13852) +++ trunk/src/obj_rat.c (revision 13853) @@ -106,7 +106,6 @@ pcb_bool changed = pcb_false; ctx.remove.pcb = PCB; - ctx.remove.bulk = pcb_true; ctx.remove.destroy_target = NULL; PCB_RAT_LOOP(PCB->Data); @@ -117,10 +116,8 @@ } } PCB_END_LOOP; - if (changed) { - pcb_draw(); + if (changed) pcb_undo_inc_serial(); - } return changed; } @@ -172,7 +169,6 @@ pcb_line_invalidate_draw(CURRENT, newone); } pcb_undo_move_obj_to_remove(PCB_TYPE_RATLINE, Rat, Rat, Rat); - pcb_draw(); return newone; } @@ -191,7 +187,6 @@ pcb_rat_invalidate_erase(Rat); pcb_undo_move_obj_to_remove(PCB_TYPE_RATLINE, Rat, Rat, Rat); pcb_line_invalidate_draw(ctx->move.dst_layer, newone); - pcb_draw(); return newone; } @@ -209,11 +204,8 @@ void *pcb_ratop_remove(pcb_opctx_t *ctx, pcb_rat_t *Rat) { /* erase from screen and memory */ - if (PCB->RatOn) { + if (PCB->RatOn) pcb_rat_invalidate_erase(Rat); - if (!ctx->remove.bulk) - pcb_draw(); - } pcb_undo_move_obj_to_remove(PCB_TYPE_RATLINE, Rat, Rat, Rat); return NULL; } Index: trunk/src/obj_subc.c =================================================================== --- trunk/src/obj_subc.c (revision 13852) +++ trunk/src/obj_subc.c (revision 13853) @@ -1324,8 +1324,6 @@ void *pcb_subcop_remove(pcb_opctx_t *ctx, pcb_subc_t *sc) { EraseSubc(sc); - if (!ctx->remove.bulk) - pcb_draw(); pcb_undo_move_obj_to_remove(PCB_TYPE_SUBC, sc, sc, sc); return NULL; } @@ -1332,14 +1330,16 @@ void *pcb_subc_remove(pcb_subc_t *sc) { + void *res; pcb_opctx_t ctx; ctx.remove.pcb = PCB; - ctx.remove.bulk = pcb_false; ctx.remove.destroy_target = NULL; /* PCB_CLEAR_PARENT(subc);*/ - return pcb_subcop_remove(&ctx, sc); + res = pcb_subcop_remove(&ctx, sc); + pcb_draw(); + return res; } Index: trunk/src/obj_text.c =================================================================== --- trunk/src/obj_text.c (revision 13852) +++ trunk/src/obj_text.c (revision 13853) @@ -459,7 +459,6 @@ pcb_text_invalidate_erase(Layer, Text); pcb_text_move(Text, ctx->move.dx, ctx->move.dy); pcb_text_invalidate_draw(Layer, Text); - pcb_draw(); } else pcb_text_move(Text, ctx->move.dx, ctx->move.dy); @@ -530,8 +529,6 @@ text = pcb_textop_move_to_layer_low(ctx, layer, text, ctx->move.dst_layer); if (ctx->move.dst_layer->meta.real.vis) pcb_text_invalidate_draw(ctx->move.dst_layer, text); - if (layer->meta.real.vis || ctx->move.dst_layer->meta.real.vis) - pcb_draw(); } return text; } @@ -554,8 +551,6 @@ if (Layer->meta.real.vis) { pcb_text_invalidate_erase(Layer, Text); pcb_r_delete_entry(Layer->text_tree, (pcb_box_t *)Text); - if (!ctx->remove.bulk) - pcb_draw(); } pcb_undo_move_obj_to_remove(PCB_TYPE_TEXT, Layer, Text, Text); return NULL; @@ -563,13 +558,15 @@ void *pcb_text_destroy(pcb_layer_t *Layer, pcb_text_t *Text) { + void *res; pcb_opctx_t ctx; ctx.remove.pcb = PCB; - ctx.remove.bulk = pcb_false; ctx.remove.destroy_target = NULL; - return pcb_textop_remove(&ctx, Layer, Text); + res = pcb_textop_remove(&ctx, Layer, Text); + pcb_draw(); + return res; } /* rotates a text in 90 degree steps; only the bounding box is rotated, @@ -601,7 +598,6 @@ pcb_r_insert_entry(Layer->text_tree, (pcb_box_t *) Text, 0); pcb_poly_clear_from_poly(PCB->Data, PCB_TYPE_TEXT, Layer, Text); pcb_text_invalidate_draw(Layer, Text); - pcb_draw(); return Text; } Index: trunk/src/operation.h =================================================================== --- trunk/src/operation.h (revision 13852) +++ trunk/src/operation.h (revision 13853) @@ -89,7 +89,6 @@ typedef struct { pcb_board_t *pcb; pcb_data_t *destroy_target; - pcb_bool bulk; /* don't draw if part of a bulk operation */ } pcb_opctx_remove_t; typedef struct { Index: trunk/src/pcb-menu-gtk.lht =================================================================== --- trunk/src/pcb-menu-gtk.lht (revision 13852) +++ trunk/src/pcb-menu-gtk.lht (revision 13853) @@ -44,6 +44,7 @@ ha:File { m=F li:submenu { + ha:custom = { a={;}; action=autoplaceselected() } ha:Start New Layout = { a=Ctrln; action=New() } ha:Revert = { action=Load(Revert,none); tip=Revert to the layout stored on disk } - Index: trunk/src/remove.c =================================================================== --- trunk/src/remove.c (revision 13852) +++ trunk/src/remove.c (revision 13853) @@ -82,7 +82,6 @@ pcb_opctx_t ctx; ctx.remove.pcb = PCB; - ctx.remove.bulk = pcb_true; ctx.remove.destroy_target = NULL; if (pcb_selected_operation(PCB, PCB->Data, &RemoveFunctions, &ctx, pcb_false, PCB_TYPEMASK_ALL)) { @@ -103,20 +102,22 @@ void *ptr; ctx.remove.pcb = PCB; - ctx.remove.bulk = pcb_false; ctx.remove.destroy_target = NULL; ptr = pcb_object_operation(&RemoveFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3); + pcb_draw(); return ptr; } void *pcb_destroy_object(pcb_data_t *Target, int Type, void *Ptr1, void *Ptr2, void *Ptr3) { + void *res; pcb_opctx_t ctx; ctx.remove.pcb = PCB; - ctx.remove.bulk = pcb_false; ctx.remove.destroy_target = Target; - return (pcb_object_operation(&DestroyFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3)); + res = pcb_object_operation(&DestroyFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3); + pcb_draw(); + return res; }