Index: trunk/src/action_helper.c =================================================================== --- trunk/src/action_helper.c (revision 5278) +++ trunk/src/action_helper.c (revision 5279) @@ -101,6 +101,22 @@ *y = box->Y1; break; } + + case PCB_TYPE_ARC_POINT: + { + pcb_box_t *box; + + box = pcb_arc_get_ends((pcb_arc_t *) ptr2); + if ((*(int *)ptr3) == 0) { + *x = box->X1; + *y = box->Y1; + } + else { + *x = box->X2; + *y = box->Y2; + } + break; + } } } Index: trunk/src/buffer.c =================================================================== --- trunk/src/buffer.c (revision 5278) +++ trunk/src/buffer.c (revision 5279) @@ -61,7 +61,8 @@ NULL, NULL, AddArcToBuffer, - AddRatToBuffer + AddRatToBuffer, + NULL }; static pcb_opfunc_t MoveBufferFunctions = { @@ -76,7 +77,8 @@ NULL, NULL, MoveArcToBuffer, - MoveRatToBuffer + MoveRatToBuffer, + NULL }; /* --------------------------------------------------------------------------- Index: trunk/src/change.c =================================================================== --- trunk/src/change.c (revision 5278) +++ trunk/src/change.c (revision 5279) @@ -56,6 +56,7 @@ NULL, NULL, ChangeArcSize, + NULL, NULL }; @@ -71,6 +72,7 @@ NULL, NULL, ChangeArcSize, + NULL, NULL }; @@ -86,6 +88,7 @@ NULL, NULL, NULL, + NULL, NULL }; @@ -101,6 +104,7 @@ NULL, NULL, NULL, + NULL, NULL }; @@ -116,6 +120,7 @@ NULL, NULL, ChangeArcClearSize, + NULL, NULL }; @@ -131,6 +136,7 @@ NULL, NULL, NULL, + NULL, NULL }; @@ -146,6 +152,7 @@ NULL, NULL, NULL, + NULL, NULL }; @@ -161,6 +168,7 @@ NULL, NULL, NULL, + NULL, NULL }; @@ -176,6 +184,7 @@ NULL, NULL, NULL, + NULL, NULL }; @@ -191,6 +200,7 @@ NULL, NULL, ChangeArcJoin, + NULL, NULL }; @@ -206,6 +216,7 @@ NULL, NULL, NULL, + NULL, NULL }; @@ -225,6 +236,7 @@ NULL, NULL, NULL, + NULL, NULL }; @@ -240,6 +252,7 @@ NULL, NULL, NULL, + NULL, NULL }; @@ -255,6 +268,7 @@ NULL, NULL, SetArcJoin, + NULL, NULL }; @@ -270,6 +284,7 @@ NULL, NULL, NULL, + NULL, NULL }; @@ -285,6 +300,7 @@ NULL, NULL, NULL, + NULL, NULL }; @@ -300,6 +316,7 @@ NULL, NULL, ClrArcJoin, + NULL, NULL }; @@ -315,6 +332,7 @@ NULL, NULL, NULL, + NULL, NULL }; @@ -330,6 +348,7 @@ NULL, NULL, ChangeArcRadius, + NULL, NULL }; @@ -345,6 +364,7 @@ NULL, NULL, ChangeArcAngle, + NULL, NULL }; Index: trunk/src/copy.c =================================================================== --- trunk/src/copy.c (revision 5278) +++ trunk/src/copy.c (revision 5279) @@ -54,6 +54,7 @@ NULL, NULL, CopyArc, + NULL, NULL }; Index: trunk/src/crosshair.c =================================================================== --- trunk/src/crosshair.c (revision 5278) +++ trunk/src/crosshair.c (revision 5279) @@ -47,6 +47,7 @@ #include "obj_line_draw.h" #include "obj_arc_draw.h" +#include "obj_arc_ui.h" typedef struct { int x, y; @@ -401,6 +402,10 @@ break; } + case PCB_TYPE_ARC_POINT: + pcb_arc_ui_move_or_copy(&pcb_crosshair); + break; + case PCB_TYPE_POLYGON_POINT: { pcb_polygon_t *polygon; @@ -741,12 +746,10 @@ */ DrawLine(NULL, (pcb_line_t *) obj); break; -#if 0 - case ARCPOINT_TYPE: + case PCB_TYPE_ARC_POINT: /* See comment above */ DrawArc(NULL, (pcb_arc_t *) obj); break; -#endif } } @@ -900,7 +903,8 @@ if ((conf_core.editor.mode != PCB_MODE_LINE || CURRENT != ptr1) && (conf_core.editor.mode != PCB_MODE_MOVE || pcb_crosshair.AttachedObject.Ptr1 != ptr1 || - pcb_crosshair.AttachedObject.Type != PCB_TYPE_LINE_POINT || pcb_crosshair.AttachedObject.Ptr2 == line)) + pcb_crosshair.AttachedObject.Type != PCB_TYPE_LINE_POINT + || pcb_crosshair.AttachedObject.Ptr2 == line)) return; dx = line->Point2.X - line->Point1.X; Index: trunk/src/globalconst.h =================================================================== --- trunk/src/globalconst.h (revision 5278) +++ trunk/src/globalconst.h (revision 5279) @@ -91,7 +91,7 @@ #endif #endif -#define PCB_MAX_LINE_POINT_DISTANCE 0 /* maximum distance when searching line points */ +#define PCB_MAX_LINE_POINT_DISTANCE 0 /* maximum distance when searching line points; same for arc point */ #define PCB_MAX_POLYGON_POINT_DISTANCE 0 /* maximum distance when searching polygon points */ #define PCB_MAX_ELEMENTNAMES 3 /* number of supported names of an element */ #define PCB_MAX_NETLIST_LINE_LENGTH 255 /* maximum line length for netlist files */ Index: trunk/src/insert.c =================================================================== --- trunk/src/insert.c (revision 5278) +++ trunk/src/insert.c (revision 5279) @@ -55,7 +55,8 @@ NULL, NULL, NULL, - InsertPointIntoRat + InsertPointIntoRat, + NULL }; /* --------------------------------------------------------------------------- Index: trunk/src/move.c =================================================================== --- trunk/src/move.c (revision 5278) +++ trunk/src/move.c (revision 5279) @@ -60,10 +60,14 @@ MoveLinePoint, MovePolygonPoint, MoveArc, - NULL -}, MoveToLayerFunctions = { -MoveLineToLayer, MoveTextToLayer, MovePolygonToLayer, NULL, NULL, NULL, NULL, NULL, NULL, NULL, MoveArcToLayer, MoveRatToLayer}; + NULL, + MoveArcPoint +}; +static pcb_opfunc_t MoveToLayerFunctions = { +MoveLineToLayer, MoveTextToLayer, MovePolygonToLayer, NULL, NULL, NULL, NULL, NULL, NULL, NULL, MoveArcToLayer, MoveRatToLayer, NULL +}; + /* --------------------------------------------------------------------------- * moves the object identified by its data pointers and the type * not we don't bump the undo serial number @@ -101,9 +105,15 @@ if (DX == 0 && DY == 0) return NULL; - pcb_undo_add_obj_to_move(Type, Ptr1, Ptr2, Ptr3, DX, DY); - ptr2 = pcb_object_operation(&MoveFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3); - pcb_undo_inc_serial(); + if (Type == PCB_TYPE_ARC_POINT) { + /* moving the endpoint of an arc is not really a move, but a change of arc properties */ + pcb_message(PCB_MSG_ERROR, "Unsupported: moving arc endpoint\n"); + } + else { + pcb_undo_add_obj_to_move(Type, Ptr1, Ptr2, Ptr3, DX, DY); + ptr2 = pcb_object_operation(&MoveFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3); + pcb_undo_inc_serial(); + } pcb_draw_inhibit_dec(); pcb_draw(); Index: trunk/src/move.h =================================================================== --- trunk/src/move.h (revision 5278) +++ trunk/src/move.h (revision 5279) @@ -42,7 +42,7 @@ #define PCB_MOVE_TYPES \ (PCB_TYPE_VIA | PCB_TYPE_LINE | PCB_TYPE_TEXT | PCB_TYPE_ELEMENT | PCB_TYPE_ELEMENT_NAME | \ - PCB_TYPE_POLYGON | PCB_TYPE_POLYGON_POINT | PCB_TYPE_LINE_POINT | PCB_TYPE_ARC) + PCB_TYPE_POLYGON | PCB_TYPE_POLYGON_POINT | PCB_TYPE_LINE_POINT | PCB_TYPE_ARC | PCB_TYPE_ARC_POINT) #define PCB_MOVETOLAYER_TYPES \ (PCB_TYPE_LINE | PCB_TYPE_TEXT | PCB_TYPE_POLYGON | PCB_TYPE_RATLINE | PCB_TYPE_ARC) Index: trunk/src/obj_arc.c =================================================================== --- trunk/src/obj_arc.c (revision 5278) +++ trunk/src/obj_arc.c (revision 5279) @@ -595,6 +595,43 @@ return (Arc); } +void *MoveArcPoint(pcb_opctx_t *ctx, pcb_layer_t *Layer, pcb_arc_t *Arc, int *end_id) +{ +#if 0 + if (Layer) { + if (Layer->On) + EraseLine(Line); + pcb_poly_restore_to_poly(PCB->Data, PCB_TYPE_LINE, Layer, Line); + pcb_r_delete_entry(Layer->line_tree, &Line->BoundingBox); + PCB_MOVE(Point->X, Point->Y, ctx->move.dx, ctx->move.dy); + pcb_line_bbox(Line); + pcb_r_insert_entry(Layer->line_tree, &Line->BoundingBox, 0); + pcb_poly_clear_from_poly(PCB->Data, PCB_TYPE_LINE, Layer, Line); + if (Layer->On) { + DrawLine(Layer, Line); + pcb_draw(); + } + return (Line); + } + else { /* must be a rat */ + + if (PCB->RatOn) + EraseRat((pcb_rat_t *) Line); + pcb_r_delete_entry(PCB->Data->rat_tree, &Line->BoundingBox); + PCB_MOVE(Point->X, Point->Y, ctx->move.dx, ctx->move.dy); + pcb_line_bbox(Line); + pcb_r_insert_entry(PCB->Data->rat_tree, &Line->BoundingBox, 0); + if (PCB->RatOn) { + DrawRat((pcb_rat_t *) Line); + pcb_draw(); + } + return (Line); + } +#endif + return NULL; +} + + /*** draw ***/ void _draw_arc(pcb_arc_t * arc) { Index: trunk/src/obj_arc_op.h =================================================================== --- trunk/src/obj_arc_op.h (revision 5278) +++ trunk/src/obj_arc_op.h (revision 5279) @@ -44,3 +44,5 @@ 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 *MoveArcPoint(pcb_opctx_t *ctx, pcb_layer_t *Layer, pcb_arc_t *Arc, int *end_id); + Index: trunk/src/obj_arc_ui.c =================================================================== --- trunk/src/obj_arc_ui.c (revision 5278) +++ trunk/src/obj_arc_ui.c (revision 5279) @@ -25,3 +25,13 @@ /* Arc UI logics */ +#include "config.h" +#include "obj_arc_ui.h" + +#include + +void pcb_arc_ui_move_or_copy(pcb_crosshair_t *ch) +{ + fprintf(stderr, "Moving arc endpoint: not yet implemented\n"); +} + Index: trunk/src/obj_arc_ui.h =================================================================== --- trunk/src/obj_arc_ui.h (revision 5278) +++ trunk/src/obj_arc_ui.h (revision 5279) @@ -22,5 +22,9 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ +/* Arc UI logics */ -/* Arc UI logics */ +#include "crosshair.h" + +void pcb_arc_ui_move_or_copy(pcb_crosshair_t *ch); + Index: trunk/src/obj_common.c =================================================================== --- trunk/src/obj_common.c (revision 5278) +++ trunk/src/obj_common.c (revision 5279) @@ -55,6 +55,9 @@ case PCB_TYPE_POLYGON_POINT: case PCB_TYPE_LINE_POINT: return (pcb_box_t *) Ptr3; + case PCB_TYPE_ARC_POINT: +/* abort();*/ + default: pcb_message(PCB_MSG_DEFAULT, "Request for bounding box of unsupported type %d\n", Type); return (pcb_box_t *) Ptr2; Index: trunk/src/operation.h =================================================================== --- trunk/src/operation.h (revision 5278) +++ trunk/src/operation.h (revision 5279) @@ -122,6 +122,7 @@ void *(*Point)(pcb_opctx_t *ctx, pcb_layer_t *, pcb_polygon_t *, pcb_point_t *); void *(*Arc)(pcb_opctx_t *ctx, pcb_layer_t *, pcb_arc_t *); void *(*Rat)(pcb_opctx_t *ctx, pcb_rat_t *); + void *(*ArcPoint)(pcb_opctx_t *ctx, pcb_layer_t *, pcb_arc_t *, int *end_id); } pcb_opfunc_t; #endif Index: trunk/src/remove.c =================================================================== --- trunk/src/remove.c (revision 5278) +++ trunk/src/remove.c (revision 5279) @@ -51,7 +51,8 @@ RemoveLinePoint, RemovePolygonPoint, RemoveArc_op, - RemoveRat + RemoveRat, + NULL }; static pcb_opfunc_t DestroyFunctions = { @@ -66,7 +67,8 @@ NULL, DestroyPolygonPoint, DestroyArc, - DestroyRat + DestroyRat, + NULL }; /* ---------------------------------------------------------------------- Index: trunk/src/remove.h =================================================================== --- trunk/src/remove.h (revision 5278) +++ trunk/src/remove.h (revision 5279) @@ -34,9 +34,9 @@ /* --------------------------------------------------------------------------- * some constants */ -#define PCB_REMOVE_TYPES \ - (PCB_TYPE_VIA | PCB_TYPE_LINE_POINT | PCB_TYPE_LINE | PCB_TYPE_TEXT | PCB_TYPE_ELEMENT | \ - PCB_TYPE_POLYGON_POINT | PCB_TYPE_POLYGON | PCB_TYPE_RATLINE | PCB_TYPE_ARC) +#define PCB_REMOVE_TYPES \ + (PCB_TYPE_VIA | PCB_TYPE_LINE_POINT | PCB_TYPE_LINE | PCB_TYPE_TEXT | PCB_TYPE_ELEMENT | \ + PCB_TYPE_POLYGON_POINT | PCB_TYPE_POLYGON | PCB_TYPE_RATLINE | PCB_TYPE_ARC | PCB_TYPE_ARC_POINT) pcb_bool pcb_remove_selected(void); void *pcb_remove_object(int, void *, void *, void *); Index: trunk/src/rotate.c =================================================================== --- trunk/src/rotate.c (revision 5278) +++ trunk/src/rotate.c (revision 5279) @@ -64,6 +64,7 @@ RotateLinePoint, NULL, RotateArc, + NULL, NULL }; Index: trunk/src/select.c =================================================================== --- trunk/src/select.c (revision 5278) +++ trunk/src/select.c (revision 5279) @@ -502,6 +502,11 @@ return (F->LinePoint(ctx, (pcb_layer_t *) Ptr1, (pcb_line_t *) Ptr2, (pcb_point_t *) Ptr3)); break; + case PCB_TYPE_ARC_POINT: + if (F->ArcPoint) + return (F->ArcPoint(ctx, (pcb_layer_t *) Ptr1, (pcb_line_t *) Ptr2, (int *) Ptr3)); + break; + case PCB_TYPE_TEXT: if (F->Text) return (F->Text(ctx, (pcb_layer_t *) Ptr1, (pcb_text_t *) Ptr2));