Index: trunk/src/insert.c =================================================================== --- trunk/src/insert.c (revision 5296) +++ trunk/src/insert.c (revision 5297) @@ -37,6 +37,7 @@ #include "undo.h" #include "obj_line_op.h" +#include "obj_arc_op.h" #include "obj_rat_op.h" #include "obj_poly_op.h" @@ -54,7 +55,7 @@ NULL, NULL, NULL, - NULL, + pcb_arc_insert_point, InsertPointIntoRat, NULL }; Index: trunk/src/insert.h =================================================================== --- trunk/src/insert.h (revision 5296) +++ trunk/src/insert.h (revision 5297) @@ -31,7 +31,7 @@ #include "config.h" -#define PCB_INSERT_TYPES (PCB_TYPE_POLYGON | PCB_TYPE_LINE | PCB_TYPE_RATLINE) +#define PCB_INSERT_TYPES (PCB_TYPE_POLYGON | PCB_TYPE_LINE | PCB_TYPE_ARC | PCB_TYPE_RATLINE) /* --------------------------------------------------------------------------- * prototypes Index: trunk/src/obj_arc.c =================================================================== --- trunk/src/obj_arc.c (revision 5296) +++ trunk/src/obj_arc.c (revision 5297) @@ -608,6 +608,33 @@ return (Arc); } +void *pcb_arc_insert_point(pcb_opctx_t *ctx, pcb_layer_t *Layer, pcb_arc_t *arc) +{ + pcb_angle_t end_ang = arc->StartAngle + arc->Delta; + pcb_coord_t x = pcb_crosshair.X, y = pcb_crosshair.Y; + pcb_angle_t angle = atan2(-(y - arc->Y), (x - arc->X)) * 180.0 / M_PI + 180.0; + pcb_arc_t *new_arc; + + if (end_ang > 360.0) + end_ang -= 360.0; + if (end_ang < -360.0) + end_ang += 360.0; + + if ((arc->Delta < 0) || (arc->Delta > 180)) + new_arc = pcb_arc_new(Layer, arc->X, arc->Y, arc->Width, arc->Height, angle, end_ang - angle + 360.0, arc->Thickness, arc->Clearance, arc->Flags); + else + new_arc = pcb_arc_new(Layer, arc->X, arc->Y, arc->Width, arc->Height, angle, end_ang - angle, arc->Thickness, arc->Clearance, arc->Flags); + + if (new_arc != NULL) { + PCB_FLAG_CHANGE(PCB_CHGFLG_SET, PCB_FLAG_FOUND, new_arc); + if (arc->Delta < 0) + pcb_arc_set_angles(Layer, arc, arc->StartAngle, angle - arc->StartAngle - 360.0); + else + pcb_arc_set_angles(Layer, arc, arc->StartAngle, angle - arc->StartAngle); + } + return new_arc; +} + /*** draw ***/ void _draw_arc(pcb_arc_t * arc) { Index: trunk/src/obj_arc_op.h =================================================================== --- trunk/src/obj_arc_op.h (revision 5296) +++ trunk/src/obj_arc_op.h (revision 5297) @@ -44,3 +44,7 @@ void *DestroyArc(pcb_opctx_t *ctx, pcb_layer_t *Layer, pcb_arc_t *Arc); void *RemoveArc_op(pcb_opctx_t *ctx, pcb_layer_t *Layer, pcb_arc_t *Arc); void *RotateArc(pcb_opctx_t *ctx, pcb_layer_t *Layer, pcb_arc_t *Arc); + +void *pcb_arc_insert_point(pcb_opctx_t *ctx, pcb_layer_t *Layer, pcb_arc_t *arc); + +