Index: trunk/src/crosshair.h =================================================================== --- trunk/src/crosshair.h (revision 13441) +++ trunk/src/crosshair.h (revision 13442) @@ -74,6 +74,7 @@ pcb_attached_line_t AttachedLine; /* data of new lines... */ pcb_attached_box_t AttachedBox; pcb_poly_t AttachedPolygon; + int AttachedPolygon_pts; /* number of valid points ever seen for this poly */ pcb_attached_object_t AttachedObject; /* data of attached objects */ pcb_route_t Route; /* Calculated line route in LINE or MOVE(LINE) mode */ enum pcb_crosshair_shape_e shape; /* shape of crosshair */ @@ -83,6 +84,7 @@ pcb_pin_t *snapped_pin; pcb_pstk_t *snapped_pstk; + /* list of object IDs that could have been dragged so that they can be cycled */ long int *drags; int drags_len, drags_current; Index: trunk/src/polygon.c =================================================================== --- trunk/src/polygon.c (revision 13441) +++ trunk/src/polygon.c (revision 13442) @@ -1559,7 +1559,7 @@ } /* --------------------------------------------------------------------------- - * go back to the previous point of the polygon + * go back to the previous point of the polygon (undo) */ void pcb_polygon_go_to_prev_point(void) { @@ -1590,6 +1590,21 @@ } /* --------------------------------------------------------------------------- + * go forward to the next point of the polygon (redo) + */ +void pcb_polygon_go_to_next_point(void) +{ + if ((pcb_crosshair.AttachedPolygon.PointN > 0) && (pcb_crosshair.AttachedPolygon.PointN < pcb_crosshair.AttachedPolygon_pts)) { + pcb_point_t *points = pcb_crosshair.AttachedPolygon.Points; + pcb_cardinal_t n = pcb_crosshair.AttachedPolygon.PointN; + + pcb_crosshair.AttachedPolygon.PointN++; + pcb_crosshair.AttachedLine.Point1.X = points[n].X; + pcb_crosshair.AttachedLine.Point1.Y = points[n].Y; + } +} + +/* --------------------------------------------------------------------------- * close polygon if possible */ void pcb_polygon_close_poly(void) Index: trunk/src/polygon.h =================================================================== --- trunk/src/polygon.h (revision 13441) +++ trunk/src/polygon.h (revision 13442) @@ -59,7 +59,8 @@ pcb_cardinal_t pcb_poly_contour_next_point(pcb_poly_t *polygon, pcb_cardinal_t point); pcb_cardinal_t pcb_poly_get_lowest_distance_point(pcb_poly_t *, pcb_coord_t, pcb_coord_t); pcb_bool pcb_poly_remove_excess_points(pcb_layer_t *, pcb_poly_t *); -void pcb_polygon_go_to_prev_point(void); +void pcb_polygon_go_to_prev_point(void); /* undo */ +void pcb_polygon_go_to_next_point(void); /* redo */ void pcb_polygon_close_poly(void); void pcb_polygon_copy_attached_to_layer(void); void pcb_polygon_close_hole(void); Index: trunk/src/tool_poly.c =================================================================== --- trunk/src/tool_poly.c (revision 13441) +++ trunk/src/tool_poly.c (revision 13442) @@ -46,6 +46,7 @@ pcb_crosshair.AttachedLine.Point1.X = pcb_crosshair.AttachedLine.Point2.X = pcb_crosshair.X; pcb_crosshair.AttachedLine.Point1.Y = pcb_crosshair.AttachedLine.Point2.Y = pcb_crosshair.Y; pcb_crosshair.AttachedLine.State = PCB_CH_STATE_THIRD; + pcb_crosshair.AttachedPolygon_pts = 0; } /* check if this is the last point of a polygon */ @@ -65,6 +66,7 @@ */ if (!n || points[n - 1].X != pcb_crosshair.AttachedLine.Point2.X || points[n - 1].Y != pcb_crosshair.AttachedLine.Point2.Y) { pcb_poly_point_new(&pcb_crosshair.AttachedPolygon, pcb_crosshair.AttachedLine.Point2.X, pcb_crosshair.AttachedLine.Point2.Y); + pcb_crosshair.AttachedPolygon_pts = pcb_crosshair.AttachedPolygon.PointN; /* copy the coordinates */ pcb_crosshair.AttachedLine.Point1.X = pcb_crosshair.AttachedLine.Point2.X; @@ -108,8 +110,10 @@ pcb_bool pcb_tool_poly_redo_act(void) { - if (pcb_crosshair.AttachedPolygon.PointN) + if (pcb_crosshair.AttachedPolygon.PointN) { + pcb_polygon_go_to_next_point(); return pcb_false; + } else return pcb_true; }