Index: autoplace.c =================================================================== --- autoplace.c (revision 13855) +++ autoplace.c (revision 13856) @@ -904,7 +904,7 @@ pcb_netlist_t *Nets; vtp0_t Selected; PerturbationType pt; - double C0, T0; + double C00, C0, T0; pcb_bool changed = pcb_false; vtp0_init(&Selected); @@ -933,7 +933,7 @@ const double Tx = PCB_MIL_TO_COORD(300), P = 0.95; double Cs = 0.0; int i; - C0 = ComputeCost(Nets, Tx, Tx); + C00 = C0 = ComputeCost(Nets, Tx, Tx); for (i = 0; i < TRIALS; i++) { pt = createPerturbation(&Selected, PCB_INCH_TO_COORD(1)); doPerturb(&pt, pcb_false); @@ -974,6 +974,10 @@ if (good_moves >= good_move_cutoff || moves >= move_cutoff) { printf("END OF STAGE: COST %.0f\t" "GOOD_MOVES %d\tMOVES %d\t" "T: %.1f\n", C0, good_moves, moves, T); pcb_draw(); + if ((pcb_gui != NULL) && (pcb_gui->progress != NULL)) { + if (pcb_gui->progress(C00-T, C00, "Optimizing the placement...")) + break; + } /* is this the end? */ if (T < 5 || good_moves < moves / CostParameter.good_ratio) break; @@ -987,6 +991,8 @@ changed = (steps > 0); } done: + if ((pcb_gui != NULL) && (pcb_gui->progress != NULL)) + pcb_gui->progress(0, 0, NULL); if (changed) { pcb_rats_destroy(pcb_false); pcb_rat_add_all(pcb_false, NULL);