Index: trunk/src/buffer.c =================================================================== --- trunk/src/buffer.c (revision 4550) +++ trunk/src/buffer.c (revision 4551) @@ -53,18 +53,18 @@ /* --------------------------------------------------------------------------- * some local prototypes */ -static void *AddViaToBuffer(PinTypePtr); -static void *AddLineToBuffer(LayerTypePtr, LineTypePtr); -static void *AddRatToBuffer(RatTypePtr); -static void *AddTextToBuffer(LayerTypePtr, TextTypePtr); -static void *AddPolygonToBuffer(LayerTypePtr, PolygonTypePtr); -static void *AddElementToBuffer(ElementTypePtr); -static void *MoveViaToBuffer(PinTypePtr); -static void *MoveLineToBuffer(LayerTypePtr, LineTypePtr); -static void *MoveRatToBuffer(RatTypePtr); -static void *MoveTextToBuffer(LayerTypePtr, TextTypePtr); -static void *MovePolygonToBuffer(LayerTypePtr, PolygonTypePtr); -static void *MoveElementToBuffer(ElementTypePtr); +static void *AddViaToBuffer(pcb_opctx_t *ctx, PinTypePtr); +static void *AddLineToBuffer(pcb_opctx_t *ctx, LayerTypePtr, LineTypePtr); +static void *AddRatToBuffer(pcb_opctx_t *ctx, RatTypePtr); +static void *AddTextToBuffer(pcb_opctx_t *ctx, LayerTypePtr, TextTypePtr); +static void *AddPolygonToBuffer(pcb_opctx_t *ctx, LayerTypePtr, PolygonTypePtr); +static void *AddElementToBuffer(pcb_opctx_t *ctx, ElementTypePtr); +static void *MoveViaToBuffer(pcb_opctx_t *ctx, PinTypePtr); +static void *MoveLineToBuffer(pcb_opctx_t *ctx, LayerTypePtr, LineTypePtr); +static void *MoveRatToBuffer(pcb_opctx_t *ctx, RatTypePtr); +static void *MoveTextToBuffer(pcb_opctx_t *ctx, LayerTypePtr, TextTypePtr); +static void *MovePolygonToBuffer(pcb_opctx_t *ctx, LayerTypePtr, PolygonTypePtr); +static void *MoveElementToBuffer(pcb_opctx_t *ctx, ElementTypePtr); static void SwapBuffer(BufferTypePtr); /* --------------------------------------------------------------------------- @@ -74,7 +74,7 @@ int pcb_buffer_extraflg = 0; DataTypePtr pcb_buffer_dest, pcb_buffer_src; -static ObjectFunctionType AddBufferFunctions = { +static pcb_opfunc_t AddBufferFunctions = { AddLineToBuffer, AddTextToBuffer, AddPolygonToBuffer, @@ -96,7 +96,7 @@ /* --------------------------------------------------------------------------- * copies a via to paste buffer */ -static void *AddViaToBuffer(PinTypePtr Via) +static void *AddViaToBuffer(pcb_opctx_t *ctx, PinTypePtr Via) { return (CreateNewVia(pcb_buffer_dest, Via->X, Via->Y, Via->Thickness, Via->Clearance, Via->Mask, Via->DrillingHole, Via->Name, MaskFlags(Via->Flags, PCB_FLAG_FOUND | pcb_buffer_extraflg))); @@ -105,7 +105,7 @@ /* --------------------------------------------------------------------------- * copies a rat-line to paste buffer */ -static void *AddRatToBuffer(RatTypePtr Rat) +static void *AddRatToBuffer(pcb_opctx_t *ctx, RatTypePtr Rat) { return (CreateNewRat(pcb_buffer_dest, Rat->Point1.X, Rat->Point1.Y, Rat->Point2.X, Rat->Point2.Y, Rat->group1, @@ -115,7 +115,7 @@ /* --------------------------------------------------------------------------- * copies a line to buffer */ -static void *AddLineToBuffer(LayerTypePtr Layer, LineTypePtr Line) +static void *AddLineToBuffer(pcb_opctx_t *ctx, LayerTypePtr Layer, LineTypePtr Line) { LineTypePtr line; LayerTypePtr layer = &pcb_buffer_dest->Layer[GetLayerNumber(pcb_buffer_src, Layer)]; @@ -131,7 +131,7 @@ /* --------------------------------------------------------------------------- * copies a text to buffer */ -static void *AddTextToBuffer(LayerTypePtr Layer, TextTypePtr Text) +static void *AddTextToBuffer(pcb_opctx_t *ctx, LayerTypePtr Layer, TextTypePtr Text) { LayerTypePtr layer = &pcb_buffer_dest->Layer[GetLayerNumber(pcb_buffer_src, Layer)]; @@ -142,7 +142,7 @@ /* --------------------------------------------------------------------------- * copies a polygon to buffer */ -static void *AddPolygonToBuffer(LayerTypePtr Layer, PolygonTypePtr Polygon) +static void *AddPolygonToBuffer(pcb_opctx_t *ctx, LayerTypePtr Layer, PolygonTypePtr Polygon) { LayerTypePtr layer = &pcb_buffer_dest->Layer[GetLayerNumber(pcb_buffer_src, Layer)]; PolygonTypePtr polygon; @@ -165,7 +165,7 @@ /* --------------------------------------------------------------------------- * copies a element to buffer */ -static void *AddElementToBuffer(ElementTypePtr Element) +static void *AddElementToBuffer(pcb_opctx_t *ctx, ElementTypePtr Element) { ElementTypePtr element; @@ -195,7 +195,7 @@ /* --------------------------------------------------------------------------- * moves a via to paste buffer without allocating memory for the name */ -static void *MoveViaToBuffer(PinType * via) +static void *MoveViaToBuffer(pcb_opctx_t *ctx, PinType * via) { RestoreToPolygon(pcb_buffer_src, PCB_TYPE_VIA, via, via); @@ -215,7 +215,7 @@ /* --------------------------------------------------------------------------- * moves a rat-line to paste buffer */ -static void *MoveRatToBuffer(RatType * rat) +static void *MoveRatToBuffer(pcb_opctx_t *ctx, RatType * rat) { r_delete_entry(pcb_buffer_src->rat_tree, (BoxType *) rat); @@ -233,7 +233,7 @@ /* --------------------------------------------------------------------------- * moves a line to buffer */ -static void *MoveLineToBuffer(LayerType * layer, LineType * line) +static void *MoveLineToBuffer(pcb_opctx_t *ctx, LayerType * layer, LineType * line) { LayerTypePtr lay = &pcb_buffer_dest->Layer[GetLayerNumber(pcb_buffer_src, layer)]; @@ -255,7 +255,7 @@ /* --------------------------------------------------------------------------- * moves a text to buffer without allocating memory for the name */ -static void *MoveTextToBuffer(LayerType * layer, TextType * text) +static void *MoveTextToBuffer(pcb_opctx_t *ctx, LayerType * layer, TextType * text) { LayerType *lay = &pcb_buffer_dest->Layer[GetLayerNumber(pcb_buffer_src, layer)]; @@ -275,7 +275,7 @@ /* --------------------------------------------------------------------------- * moves a polygon to buffer. Doesn't allocate memory for the points */ -static void *MovePolygonToBuffer(LayerType * layer, PolygonType * polygon) +static void *MovePolygonToBuffer(pcb_opctx_t *ctx, LayerType * layer, PolygonType * polygon) { LayerType *lay = &pcb_buffer_dest->Layer[GetLayerNumber(pcb_buffer_src, layer)]; @@ -295,7 +295,7 @@ /* --------------------------------------------------------------------------- * moves a element to buffer without allocating memory for pins/names */ -static void *MoveElementToBuffer(ElementType * element) +static void *MoveElementToBuffer(pcb_opctx_t *ctx, ElementType * element) { /* * Delete the element from the source (remove it from trees, @@ -364,6 +364,8 @@ */ void AddSelectedToBuffer(BufferTypePtr Buffer, Coord X, Coord Y, pcb_bool LeaveSelected) { + pcb_opctx_t ctx; + /* switch crosshair off because adding objects to the pastebuffer * may change the 'valid' area for the cursor */ @@ -372,7 +374,7 @@ notify_crosshair_change(pcb_false); pcb_buffer_src = PCB->Data; pcb_buffer_dest = Buffer->Data; - SelectedOperation(&AddBufferFunctions, pcb_false, PCB_TYPEMASK_ALL); + SelectedOperation(&AddBufferFunctions, &ctx, pcb_false, PCB_TYPEMASK_ALL); /* set origin to passed or current position */ if (X || Y) { @@ -1185,10 +1187,12 @@ */ void *MoveObjectToBuffer(DataTypePtr Destination, DataTypePtr Src, int Type, void *Ptr1, void *Ptr2, void *Ptr3) { + pcb_opctx_t ctx; + /* setup local identifiers used by move operations */ pcb_buffer_dest = Destination; pcb_buffer_src = Src; - return (ObjectOperation(&MoveBufferFunctions, Type, Ptr1, Ptr2, Ptr3)); + return (ObjectOperation(&MoveBufferFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3)); } /* ---------------------------------------------------------------------- @@ -1196,10 +1200,12 @@ */ void *CopyObjectToBuffer(DataTypePtr Destination, DataTypePtr Src, int Type, void *Ptr1, void *Ptr2, void *Ptr3) { + pcb_opctx_t ctx; + /* setup local identifiers used by Add operations */ pcb_buffer_dest = Destination; pcb_buffer_src = Src; - return (ObjectOperation(&AddBufferFunctions, Type, Ptr1, Ptr2, Ptr3)); + return (ObjectOperation(&AddBufferFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3)); } /* ---------------------------------------------------------------------- */ Index: trunk/src/change.c =================================================================== --- trunk/src/change.c (revision 4550) +++ trunk/src/change.c (revision 4551) @@ -48,70 +48,70 @@ /* --------------------------------------------------------------------------- * some local prototypes */ -static void *ChangePinSize(ElementTypePtr, PinTypePtr); -static void *ChangePinClearSize(ElementTypePtr, PinTypePtr); -static void *ChangePinMaskSize(ElementTypePtr, PinTypePtr); -static void *ChangePadSize(ElementTypePtr, PadTypePtr); -static void *ChangePadClearSize(ElementTypePtr, PadTypePtr); -static void *ChangePadMaskSize(ElementTypePtr, PadTypePtr); -static void *ChangePin2ndSize(ElementTypePtr, PinTypePtr); -static void *ChangeElement1stSize(ElementTypePtr); -static void *ChangeElement2ndSize(ElementTypePtr); -static void *ChangeViaSize(PinTypePtr); -static void *ChangeVia2ndSize(PinTypePtr); -static void *ChangeViaClearSize(PinTypePtr); -static void *ChangeViaMaskSize(PinTypePtr); -static void *ChangeLineSize(LayerTypePtr, LineTypePtr); -static void *ChangeLineClearSize(LayerTypePtr, LineTypePtr); -static void *ChangePolygonClearSize(LayerTypePtr, PolygonTypePtr); -static void *ChangeArcSize(LayerTypePtr, ArcTypePtr); -static void *ChangeArcClearSize(LayerTypePtr, ArcTypePtr); -static void *ChangeTextSize(LayerTypePtr, TextTypePtr); -static void *ChangeElementSize(ElementTypePtr); -static void *ChangeElementNameSize(ElementTypePtr); -static void *ChangeElementClearSize(ElementTypePtr); -static void *ChangePinName(ElementTypePtr, PinTypePtr); -static void *ChangePadName(ElementTypePtr, PadTypePtr); -static void *ChangePinNum(ElementTypePtr, PinTypePtr); -static void *ChangePadNum(ElementTypePtr, PadTypePtr); -static void *ChangeViaName(PinTypePtr); -static void *ChangeLineName(LayerTypePtr, LineTypePtr); -static void *ChangeElementName(ElementTypePtr); -static void *ChangeElementNonetlist(ElementTypePtr); -static void *ChangeTextName(LayerTypePtr, TextTypePtr); -static void *ChangeElementSquare(ElementTypePtr); -static void *SetElementSquare(ElementTypePtr); -static void *ClrElementSquare(ElementTypePtr); -static void *ChangeElementOctagon(ElementTypePtr); -static void *SetElementOctagon(ElementTypePtr); -static void *ClrElementOctagon(ElementTypePtr); -static void *ChangeViaSquare(PinTypePtr); -static void *ChangePinSquare(ElementTypePtr, PinTypePtr); -static void *SetPinSquare(ElementTypePtr, PinTypePtr); -static void *ClrPinSquare(ElementTypePtr, PinTypePtr); -static void *ChangePinOctagon(ElementTypePtr, PinTypePtr); -static void *SetPinOctagon(ElementTypePtr, PinTypePtr); -static void *ClrPinOctagon(ElementTypePtr, PinTypePtr); -static void *ChangeViaOctagon(PinTypePtr); -static void *SetViaOctagon(PinTypePtr); -static void *ClrViaOctagon(PinTypePtr); -static void *ChangePadSquare(ElementTypePtr, PadTypePtr); -static void *SetPadSquare(ElementTypePtr, PadTypePtr); -static void *ClrPadSquare(ElementTypePtr, PadTypePtr); -static void *ChangeViaThermal(PinTypePtr); -static void *ChangePinThermal(ElementTypePtr, PinTypePtr); -static void *ChangeLineJoin(LayerTypePtr, LineTypePtr); -static void *SetLineJoin(LayerTypePtr, LineTypePtr); -static void *ClrLineJoin(LayerTypePtr, LineTypePtr); -static void *ChangeArcJoin(LayerTypePtr, ArcTypePtr); -static void *SetArcJoin(LayerTypePtr, ArcTypePtr); -static void *ClrArcJoin(LayerTypePtr, ArcTypePtr); -static void *ChangeTextJoin(LayerTypePtr, TextTypePtr); -static void *SetTextJoin(LayerTypePtr, TextTypePtr); -static void *ClrTextJoin(LayerTypePtr, TextTypePtr); -static void *ChangePolyClear(LayerTypePtr, PolygonTypePtr); -static void *ChangeArcRadius(LayerTypePtr, ArcTypePtr); -static void *ChangeArcAngle(LayerTypePtr, ArcTypePtr); +static void *ChangePinSize(pcb_opctx_t *ctx, ElementTypePtr, PinTypePtr); +static void *ChangePinClearSize(pcb_opctx_t *ctx, ElementTypePtr, PinTypePtr); +static void *ChangePinMaskSize(pcb_opctx_t *ctx, ElementTypePtr, PinTypePtr); +static void *ChangePadSize(pcb_opctx_t *ctx, ElementTypePtr, PadTypePtr); +static void *ChangePadClearSize(pcb_opctx_t *ctx, ElementTypePtr, PadTypePtr); +static void *ChangePadMaskSize(pcb_opctx_t *ctx, ElementTypePtr, PadTypePtr); +static void *ChangePin2ndSize(pcb_opctx_t *ctx, ElementTypePtr, PinTypePtr); +static void *ChangeElement1stSize(pcb_opctx_t *ctx, ElementTypePtr); +static void *ChangeElement2ndSize(pcb_opctx_t *ctx, ElementTypePtr); +static void *ChangeViaSize(pcb_opctx_t *ctx, PinTypePtr); +static void *ChangeVia2ndSize(pcb_opctx_t *ctx, PinTypePtr); +static void *ChangeViaClearSize(pcb_opctx_t *ctx, PinTypePtr); +static void *ChangeViaMaskSize(pcb_opctx_t *ctx, PinTypePtr); +static void *ChangeLineSize(pcb_opctx_t *ctx, LayerTypePtr, LineTypePtr); +static void *ChangeLineClearSize(pcb_opctx_t *ctx, LayerTypePtr, LineTypePtr); +static void *ChangePolygonClearSize(pcb_opctx_t *ctx, LayerTypePtr, PolygonTypePtr); +static void *ChangeArcSize(pcb_opctx_t *ctx, LayerTypePtr, ArcTypePtr); +static void *ChangeArcClearSize(pcb_opctx_t *ctx, LayerTypePtr, ArcTypePtr); +static void *ChangeTextSize(pcb_opctx_t *ctx, LayerTypePtr, TextTypePtr); +static void *ChangeElementSize(pcb_opctx_t *ctx, ElementTypePtr); +static void *ChangeElementNameSize(pcb_opctx_t *ctx, ElementTypePtr); +static void *ChangeElementClearSize(pcb_opctx_t *ctx, ElementTypePtr); +static void *ChangePinName(pcb_opctx_t *ctx, ElementTypePtr, PinTypePtr); +static void *ChangePadName(pcb_opctx_t *ctx, ElementTypePtr, PadTypePtr); +static void *ChangePinNum(pcb_opctx_t *ctx, ElementTypePtr, PinTypePtr); +static void *ChangePadNum(pcb_opctx_t *ctx, ElementTypePtr, PadTypePtr); +static void *ChangeViaName(pcb_opctx_t *ctx, PinTypePtr); +static void *ChangeLineName(pcb_opctx_t *ctx, LayerTypePtr, LineTypePtr); +static void *ChangeElementName(pcb_opctx_t *ctx, ElementTypePtr); +static void *ChangeElementNonetlist(pcb_opctx_t *ctx, ElementTypePtr); +static void *ChangeTextName(pcb_opctx_t *ctx, LayerTypePtr, TextTypePtr); +static void *ChangeElementSquare(pcb_opctx_t *ctx, ElementTypePtr); +static void *SetElementSquare(pcb_opctx_t *ctx, ElementTypePtr); +static void *ClrElementSquare(pcb_opctx_t *ctx, ElementTypePtr); +static void *ChangeElementOctagon(pcb_opctx_t *ctx, ElementTypePtr); +static void *SetElementOctagon(pcb_opctx_t *ctx, ElementTypePtr); +static void *ClrElementOctagon(pcb_opctx_t *ctx, ElementTypePtr); +static void *ChangeViaSquare(pcb_opctx_t *ctx, PinTypePtr); +static void *ChangePinSquare(pcb_opctx_t *ctx, ElementTypePtr, PinTypePtr); +static void *SetPinSquare(pcb_opctx_t *ctx, ElementTypePtr, PinTypePtr); +static void *ClrPinSquare(pcb_opctx_t *ctx, ElementTypePtr, PinTypePtr); +static void *ChangePinOctagon(pcb_opctx_t *ctx, ElementTypePtr, PinTypePtr); +static void *SetPinOctagon(pcb_opctx_t *ctx, ElementTypePtr, PinTypePtr); +static void *ClrPinOctagon(pcb_opctx_t *ctx, ElementTypePtr, PinTypePtr); +static void *ChangeViaOctagon(pcb_opctx_t *ctx, PinTypePtr); +static void *SetViaOctagon(pcb_opctx_t *ctx, PinTypePtr); +static void *ClrViaOctagon(pcb_opctx_t *ctx, PinTypePtr); +static void *ChangePadSquare(pcb_opctx_t *ctx, ElementTypePtr, PadTypePtr); +static void *SetPadSquare(pcb_opctx_t *ctx, ElementTypePtr, PadTypePtr); +static void *ClrPadSquare(pcb_opctx_t *ctx, ElementTypePtr, PadTypePtr); +static void *ChangeViaThermal(pcb_opctx_t *ctx, PinTypePtr); +static void *ChangePinThermal(pcb_opctx_t *ctx, ElementTypePtr, PinTypePtr); +static void *ChangeLineJoin(pcb_opctx_t *ctx, LayerTypePtr, LineTypePtr); +static void *SetLineJoin(pcb_opctx_t *ctx, LayerTypePtr, LineTypePtr); +static void *ClrLineJoin(pcb_opctx_t *ctx, LayerTypePtr, LineTypePtr); +static void *ChangeArcJoin(pcb_opctx_t *ctx, LayerTypePtr, ArcTypePtr); +static void *SetArcJoin(pcb_opctx_t *ctx, LayerTypePtr, ArcTypePtr); +static void *ClrArcJoin(pcb_opctx_t *ctx, LayerTypePtr, ArcTypePtr); +static void *ChangeTextJoin(pcb_opctx_t *ctx, LayerTypePtr, TextTypePtr); +static void *SetTextJoin(pcb_opctx_t *ctx, LayerTypePtr, TextTypePtr); +static void *ClrTextJoin(pcb_opctx_t *ctx, LayerTypePtr, TextTypePtr); +static void *ChangePolyClear(pcb_opctx_t *ctx, LayerTypePtr, PolygonTypePtr); +static void *ChangeArcRadius(pcb_opctx_t *ctx, LayerTypePtr, ArcTypePtr); +static void *ChangeArcAngle(pcb_opctx_t *ctx, LayerTypePtr, ArcTypePtr); /* --------------------------------------------------------------------------- * some local identifiers @@ -123,7 +123,7 @@ static Angle ADelta, AAbsolute; /* same as above, but for angles */ -static ObjectFunctionType ChangeSizeFunctions = { +static pcb_opfunc_t ChangeSizeFunctions = { ChangeLineSize, ChangeTextSize, ChangePolyClear, @@ -138,7 +138,7 @@ NULL }; -static ObjectFunctionType Change1stSizeFunctions = { +static pcb_opfunc_t Change1stSizeFunctions = { ChangeLineSize, ChangeTextSize, ChangePolyClear, @@ -153,7 +153,7 @@ NULL }; -static ObjectFunctionType Change2ndSizeFunctions = { +static pcb_opfunc_t Change2ndSizeFunctions = { NULL, NULL, NULL, @@ -168,7 +168,7 @@ NULL }; -static ObjectFunctionType ChangeThermalFunctions = { +static pcb_opfunc_t ChangeThermalFunctions = { NULL, NULL, NULL, @@ -183,7 +183,7 @@ NULL }; -static ObjectFunctionType ChangeClearSizeFunctions = { +static pcb_opfunc_t ChangeClearSizeFunctions = { ChangeLineClearSize, NULL, ChangePolygonClearSize, /* just to tell the user not to :-) */ @@ -198,7 +198,7 @@ NULL }; -static ObjectFunctionType ChangeNameFunctions = { +static pcb_opfunc_t ChangeNameFunctions = { ChangeLineName, ChangeTextName, NULL, @@ -213,7 +213,7 @@ NULL }; -static ObjectFunctionType ChangePinnumFunctions = { +static pcb_opfunc_t ChangePinnumFunctions = { NULL, NULL, NULL, @@ -228,7 +228,7 @@ NULL }; -static ObjectFunctionType ChangeSquareFunctions = { +static pcb_opfunc_t ChangeSquareFunctions = { NULL, NULL, NULL, @@ -243,7 +243,7 @@ NULL }; -static ObjectFunctionType ChangeNonetlistFunctions = { +static pcb_opfunc_t ChangeNonetlistFunctions = { NULL, NULL, NULL, @@ -258,7 +258,7 @@ NULL }; -static ObjectFunctionType ChangeJoinFunctions = { +static pcb_opfunc_t ChangeJoinFunctions = { ChangeLineJoin, ChangeTextJoin, NULL, @@ -273,7 +273,7 @@ NULL }; -static ObjectFunctionType ChangeOctagonFunctions = { +static pcb_opfunc_t ChangeOctagonFunctions = { NULL, NULL, NULL, @@ -288,7 +288,7 @@ NULL }; -static ObjectFunctionType ChangeMaskSizeFunctions = { +static pcb_opfunc_t ChangeMaskSizeFunctions = { NULL, NULL, NULL, @@ -307,7 +307,7 @@ NULL }; -static ObjectFunctionType SetSquareFunctions = { +static pcb_opfunc_t SetSquareFunctions = { NULL, NULL, NULL, @@ -322,7 +322,7 @@ NULL }; -static ObjectFunctionType SetJoinFunctions = { +static pcb_opfunc_t SetJoinFunctions = { SetLineJoin, SetTextJoin, NULL, @@ -337,7 +337,7 @@ NULL }; -static ObjectFunctionType SetOctagonFunctions = { +static pcb_opfunc_t SetOctagonFunctions = { NULL, NULL, NULL, @@ -352,7 +352,7 @@ NULL }; -static ObjectFunctionType ClrSquareFunctions = { +static pcb_opfunc_t ClrSquareFunctions = { NULL, NULL, NULL, @@ -367,7 +367,7 @@ NULL }; -static ObjectFunctionType ClrJoinFunctions = { +static pcb_opfunc_t ClrJoinFunctions = { ClrLineJoin, ClrTextJoin, NULL, @@ -382,7 +382,7 @@ NULL }; -static ObjectFunctionType ClrOctagonFunctions = { +static pcb_opfunc_t ClrOctagonFunctions = { NULL, NULL, NULL, @@ -397,7 +397,7 @@ NULL }; -static ObjectFunctionType ChangeRadiusFunctions = { +static pcb_opfunc_t ChangeRadiusFunctions = { NULL, NULL, NULL, @@ -412,7 +412,7 @@ NULL }; -static ObjectFunctionType ChangeAngleFunctions = { +static pcb_opfunc_t ChangeAngleFunctions = { NULL, NULL, NULL, @@ -432,7 +432,7 @@ * changes the thermal on a via * returns pcb_true if changed */ -static void *ChangeViaThermal(PinTypePtr Via) +static void *ChangeViaThermal(pcb_opctx_t *ctx, PinTypePtr Via) { AddObjectToClearPolyUndoList(PCB_TYPE_VIA, Via, Via, Via, pcb_false); RestoreToPolygon(PCB->Data, PCB_TYPE_VIA, CURRENT, Via); @@ -451,7 +451,7 @@ * changes the thermal on a pin * returns pcb_true if changed */ -static void *ChangePinThermal(ElementTypePtr element, PinTypePtr Pin) +static void *ChangePinThermal(pcb_opctx_t *ctx, ElementTypePtr element, PinTypePtr Pin) { AddObjectToClearPolyUndoList(PCB_TYPE_PIN, element, Pin, Pin, pcb_false); RestoreToPolygon(PCB->Data, PCB_TYPE_VIA, CURRENT, Pin); @@ -470,7 +470,7 @@ * changes the size of a via * returns pcb_true if changed */ -static void *ChangeViaSize(PinTypePtr Via) +static void *ChangeViaSize(pcb_opctx_t *ctx, PinTypePtr Via) { Coord value = Absolute ? Absolute : Via->Thickness + Delta; @@ -500,7 +500,7 @@ * changes the drilling hole of a via * returns pcb_true if changed */ -static void *ChangeVia2ndSize(PinTypePtr Via) +static void *ChangeVia2ndSize(pcb_opctx_t *ctx, PinTypePtr Via) { Coord value = (Absolute) ? Absolute : Via->DrillingHole + Delta; @@ -528,7 +528,7 @@ * changes the clearance size of a via * returns pcb_true if changed */ -static void *ChangeViaClearSize(PinTypePtr Via) +static void *ChangeViaClearSize(pcb_opctx_t *ctx, PinTypePtr Via) { Coord value = (Absolute) ? Absolute : Via->Clearance + Delta; @@ -561,7 +561,7 @@ * changes the size of a pin * returns pcb_true if changed */ -static void *ChangePinSize(ElementTypePtr Element, PinTypePtr Pin) +static void *ChangePinSize(pcb_opctx_t *ctx, ElementTypePtr Element, PinTypePtr Pin) { Coord value = (Absolute) ? Absolute : Pin->Thickness + Delta; @@ -589,7 +589,7 @@ * changes the clearance size of a pin * returns pcb_true if changed */ -static void *ChangePinClearSize(ElementTypePtr Element, PinTypePtr Pin) +static void *ChangePinClearSize(pcb_opctx_t *ctx, ElementTypePtr Element, PinTypePtr Pin) { Coord value = (Absolute) ? Absolute : Pin->Clearance + Delta; @@ -620,7 +620,7 @@ * changes the size of a pad * returns pcb_true if changed */ -static void *ChangePadSize(ElementTypePtr Element, PadTypePtr Pad) +static void *ChangePadSize(pcb_opctx_t *ctx, ElementTypePtr Element, PadTypePtr Pad) { Coord value = (Absolute) ? Absolute : Pad->Thickness + Delta; @@ -647,7 +647,7 @@ * changes the clearance size of a pad * returns pcb_true if changed */ -static void *ChangePadClearSize(ElementTypePtr Element, PadTypePtr Pad) +static void *ChangePadClearSize(pcb_opctx_t *ctx, ElementTypePtr Element, PadTypePtr Pad) { Coord value = (Absolute) ? Absolute : Pad->Clearance + Delta; @@ -678,7 +678,7 @@ * changes the drilling hole of all pins of an element * returns pcb_true if changed */ -static void *ChangeElement2ndSize(ElementTypePtr Element) +static void *ChangeElement2ndSize(pcb_opctx_t *ctx, ElementTypePtr Element) { pcb_bool changed = pcb_false; Coord value; @@ -715,7 +715,7 @@ * changes ring dia of all pins of an element * returns pcb_true if changed */ -static void *ChangeElement1stSize(ElementTypePtr Element) +static void *ChangeElement1stSize(pcb_opctx_t *ctx, ElementTypePtr Element) { pcb_bool changed = pcb_false; Coord value; @@ -750,7 +750,7 @@ * changes the clearance of all pins of an element * returns pcb_true if changed */ -static void *ChangeElementClearSize(ElementTypePtr Element) +static void *ChangeElementClearSize(pcb_opctx_t *ctx, ElementTypePtr Element) { pcb_bool changed = pcb_false; Coord value; @@ -811,7 +811,7 @@ * changes the drilling hole of a pin * returns pcb_true if changed */ -static void *ChangePin2ndSize(ElementTypePtr Element, PinTypePtr Pin) +static void *ChangePin2ndSize(pcb_opctx_t *ctx, ElementTypePtr Element, PinTypePtr Pin) { Coord value = (Absolute) ? Absolute : Pin->DrillingHole + Delta; @@ -839,7 +839,7 @@ * changes the size of a line * returns pcb_true if changed */ -static void *ChangeLineSize(LayerTypePtr Layer, LineTypePtr Line) +static void *ChangeLineSize(pcb_opctx_t *ctx, LayerTypePtr Layer, LineTypePtr Line) { Coord value = (Absolute) ? Absolute : Line->Thickness + Delta; @@ -864,7 +864,7 @@ * changes the clearance size of a line * returns pcb_true if changed */ -static void *ChangeLineClearSize(LayerTypePtr Layer, LineTypePtr Line) +static void *ChangeLineClearSize(pcb_opctx_t *ctx, LayerTypePtr Layer, LineTypePtr Line) { Coord value = (Absolute) ? Absolute : Line->Clearance + Delta; @@ -893,7 +893,7 @@ /* --------------------------------------------------------------------------- * Handle attempts to change the clearance of a polygon. */ -static void *ChangePolygonClearSize(LayerTypePtr Layer, PolygonTypePtr poly) +static void *ChangePolygonClearSize(pcb_opctx_t *ctx, LayerTypePtr Layer, PolygonTypePtr poly) { static int shown_this_message = 0; if (!shown_this_message) { @@ -911,7 +911,7 @@ * changes the size of an arc * returns pcb_true if changed */ -static void *ChangeArcSize(LayerTypePtr Layer, ArcTypePtr Arc) +static void *ChangeArcSize(pcb_opctx_t *ctx, LayerTypePtr Layer, ArcTypePtr Arc) { Coord value = (Absolute) ? Absolute : Arc->Thickness + Delta; @@ -936,7 +936,7 @@ * changes the clearance size of an arc * returns pcb_true if changed */ -static void *ChangeArcClearSize(LayerTypePtr Layer, ArcTypePtr Arc) +static void *ChangeArcClearSize(pcb_opctx_t *ctx, LayerTypePtr Layer, ArcTypePtr Arc) { Coord value = (Absolute) ? Absolute : Arc->Clearance + Delta; @@ -966,7 +966,7 @@ * changes the radius of an arc (is_primary 0=width or 1=height or 2=both) * returns pcb_true if changed */ -static void *ChangeArcRadius(LayerTypePtr Layer, ArcTypePtr Arc) +static void *ChangeArcRadius(pcb_opctx_t *ctx, LayerTypePtr Layer, ArcTypePtr Arc) { Coord value, *dst; void *a0, *a1; @@ -978,8 +978,8 @@ case 0: dst = &Arc->Width; break; case 1: dst = &Arc->Height; break; case 2: - is_primary = 0; a0 = ChangeArcRadius(Layer, Arc); - is_primary = 1; a1 = ChangeArcRadius(Layer, Arc); + is_primary = 0; a0 = ChangeArcRadius(ctx, Layer, Arc); + is_primary = 1; a1 = ChangeArcRadius(ctx, Layer, Arc); if ((a0 != NULL) || (a1 != NULL)) return Arc; return NULL; @@ -1006,7 +1006,7 @@ * changes the angle of an arc (is_primary 0=start or 1=end) * returns pcb_true if changed */ -static void *ChangeArcAngle(LayerTypePtr Layer, ArcTypePtr Arc) +static void *ChangeArcAngle(pcb_opctx_t *ctx, LayerTypePtr Layer, ArcTypePtr Arc) { Angle value, *dst; void *a0, *a1; @@ -1018,8 +1018,8 @@ case 0: dst = &Arc->StartAngle; break; case 1: dst = &Arc->Delta; break; case 2: - is_primary = 0; a0 = ChangeArcAngle(Layer, Arc); - is_primary = 1; a1 = ChangeArcAngle(Layer, Arc); + is_primary = 0; a0 = ChangeArcAngle(ctx, Layer, Arc); + is_primary = 1; a1 = ChangeArcAngle(ctx, Layer, Arc); if ((a0 != NULL) || (a1 != NULL)) return Arc; return NULL; @@ -1050,7 +1050,7 @@ * changes the scaling factor of a text object * returns pcb_true if changed */ -static void *ChangeTextSize(LayerTypePtr Layer, TextTypePtr Text) +static void *ChangeTextSize(pcb_opctx_t *ctx, LayerTypePtr Layer, TextTypePtr Text) { int value = Absolute ? PCB_COORD_TO_MIL(Absolute) : Text->Scale + PCB_COORD_TO_MIL(Delta); @@ -1076,7 +1076,7 @@ * changes the scaling factor of an element's outline * returns pcb_true if changed */ -static void *ChangeElementSize(ElementTypePtr Element) +static void *ChangeElementSize(pcb_opctx_t *ctx, ElementTypePtr Element) { Coord value; pcb_bool changed = pcb_false; @@ -1117,7 +1117,7 @@ * changes the scaling factor of a elementname object * returns pcb_true if changed */ -static void *ChangeElementNameSize(ElementTypePtr Element) +static void *ChangeElementNameSize(pcb_opctx_t *ctx, ElementTypePtr Element) { int value = Absolute ? PCB_COORD_TO_MIL(Absolute) : DESCRIPTION_TEXT(Element).Scale + PCB_COORD_TO_MIL(Delta); @@ -1144,7 +1144,7 @@ /* --------------------------------------------------------------------------- * changes the name of a via */ -static void *ChangeViaName(PinTypePtr Via) +static void *ChangeViaName(pcb_opctx_t *ctx, PinTypePtr Via) { char *old = Via->Name; @@ -1161,7 +1161,7 @@ /* --------------------------------------------------------------------------- * changes the name of a pin */ -static void *ChangePinName(ElementTypePtr Element, PinTypePtr Pin) +static void *ChangePinName(pcb_opctx_t *ctx, ElementTypePtr Element, PinTypePtr Pin) { char *old = Pin->Name; @@ -1179,7 +1179,7 @@ /* --------------------------------------------------------------------------- * changes the name of a pad */ -static void *ChangePadName(ElementTypePtr Element, PadTypePtr Pad) +static void *ChangePadName(pcb_opctx_t *ctx, ElementTypePtr Element, PadTypePtr Pad) { char *old = Pad->Name; @@ -1197,7 +1197,7 @@ /* --------------------------------------------------------------------------- * changes the number of a pin */ -static void *ChangePinNum(ElementTypePtr Element, PinTypePtr Pin) +static void *ChangePinNum(pcb_opctx_t *ctx, ElementTypePtr Element, PinTypePtr Pin) { char *old = Pin->Number; @@ -1215,7 +1215,7 @@ /* --------------------------------------------------------------------------- * changes the number of a pad */ -static void *ChangePadNum(ElementTypePtr Element, PadTypePtr Pad) +static void *ChangePadNum(pcb_opctx_t *ctx, ElementTypePtr Element, PadTypePtr Pad) { char *old = Pad->Number; @@ -1233,7 +1233,7 @@ /* --------------------------------------------------------------------------- * changes the name of a line */ -static void *ChangeLineName(LayerTypePtr Layer, LineTypePtr Line) +static void *ChangeLineName(pcb_opctx_t *ctx, LayerTypePtr Layer, LineTypePtr Line) { char *old = Line->Number; @@ -1270,7 +1270,7 @@ return old; } -static void *ChangeElementName(ElementTypePtr Element) +static void *ChangeElementName(pcb_opctx_t *ctx, ElementTypePtr Element) { if (TEST_FLAG(PCB_FLAG_LOCK, &Element->Name[0])) return (NULL); @@ -1284,7 +1284,7 @@ return ChangeElementText(PCB, PCB->Data, Element, NAME_INDEX(), NewName); } -static void *ChangeElementNonetlist(ElementTypePtr Element) +static void *ChangeElementNonetlist(pcb_opctx_t *ctx, ElementTypePtr Element) { if (TEST_FLAG(PCB_FLAG_LOCK, Element)) return (NULL); @@ -1298,7 +1298,7 @@ * the one for the new string is allocated * returns pcb_true if the string has been changed */ -static void *ChangeTextName(LayerTypePtr Layer, TextTypePtr Text) +static void *ChangeTextName(pcb_opctx_t *ctx, LayerTypePtr Layer, TextTypePtr Text) { char *old = Text->TextString; @@ -1357,7 +1357,7 @@ /* --------------------------------------------------------------------------- * changes the clearance flag of a line */ -static void *ChangeLineJoin(LayerTypePtr Layer, LineTypePtr Line) +static void *ChangeLineJoin(pcb_opctx_t *ctx, LayerTypePtr Layer, LineTypePtr Line) { if (TEST_FLAG(PCB_FLAG_LOCK, Line)) return (NULL); @@ -1379,27 +1379,27 @@ /* --------------------------------------------------------------------------- * sets the clearance flag of a line */ -static void *SetLineJoin(LayerTypePtr Layer, LineTypePtr Line) +static void *SetLineJoin(pcb_opctx_t *ctx, LayerTypePtr Layer, LineTypePtr Line) { if (TEST_FLAG(PCB_FLAG_LOCK, Line) || TEST_FLAG(PCB_FLAG_CLEARLINE, Line)) return (NULL); - return ChangeLineJoin(Layer, Line); + return ChangeLineJoin(ctx, Layer, Line); } /* --------------------------------------------------------------------------- * clears the clearance flag of a line */ -static void *ClrLineJoin(LayerTypePtr Layer, LineTypePtr Line) +static void *ClrLineJoin(pcb_opctx_t *ctx, LayerTypePtr Layer, LineTypePtr Line) { if (TEST_FLAG(PCB_FLAG_LOCK, Line) || !TEST_FLAG(PCB_FLAG_CLEARLINE, Line)) return (NULL); - return ChangeLineJoin(Layer, Line); + return ChangeLineJoin(ctx, Layer, Line); } /* --------------------------------------------------------------------------- * changes the clearance flag of an arc */ -static void *ChangeArcJoin(LayerTypePtr Layer, ArcTypePtr Arc) +static void *ChangeArcJoin(pcb_opctx_t *ctx, LayerTypePtr Layer, ArcTypePtr Arc) { if (TEST_FLAG(PCB_FLAG_LOCK, Arc)) return (NULL); @@ -1421,27 +1421,27 @@ /* --------------------------------------------------------------------------- * sets the clearance flag of an arc */ -static void *SetArcJoin(LayerTypePtr Layer, ArcTypePtr Arc) +static void *SetArcJoin(pcb_opctx_t *ctx, LayerTypePtr Layer, ArcTypePtr Arc) { if (TEST_FLAG(PCB_FLAG_LOCK, Arc) || TEST_FLAG(PCB_FLAG_CLEARLINE, Arc)) return (NULL); - return ChangeArcJoin(Layer, Arc); + return ChangeArcJoin(ctx, Layer, Arc); } /* --------------------------------------------------------------------------- * clears the clearance flag of an arc */ -static void *ClrArcJoin(LayerTypePtr Layer, ArcTypePtr Arc) +static void *ClrArcJoin(pcb_opctx_t *ctx, LayerTypePtr Layer, ArcTypePtr Arc) { if (TEST_FLAG(PCB_FLAG_LOCK, Arc) || !TEST_FLAG(PCB_FLAG_CLEARLINE, Arc)) return (NULL); - return ChangeArcJoin(Layer, Arc); + return ChangeArcJoin(ctx, Layer, Arc); } /* --------------------------------------------------------------------------- * changes the clearance flag of a text */ -static void *ChangeTextJoin(LayerTypePtr Layer, TextTypePtr Text) +static void *ChangeTextJoin(pcb_opctx_t *ctx, LayerTypePtr Layer, TextTypePtr Text) { if (TEST_FLAG(PCB_FLAG_LOCK, Text)) return (NULL); @@ -1463,27 +1463,27 @@ /* --------------------------------------------------------------------------- * sets the clearance flag of a text */ -static void *SetTextJoin(LayerTypePtr Layer, TextTypePtr Text) +static void *SetTextJoin(pcb_opctx_t *ctx, LayerTypePtr Layer, TextTypePtr Text) { if (TEST_FLAG(PCB_FLAG_LOCK, Text) || TEST_FLAG(PCB_FLAG_CLEARLINE, Text)) return (NULL); - return ChangeTextJoin(Layer, Text); + return ChangeTextJoin(ctx, Layer, Text); } /* --------------------------------------------------------------------------- * clears the clearance flag of a text */ -static void *ClrTextJoin(LayerTypePtr Layer, TextTypePtr Text) +static void *ClrTextJoin(pcb_opctx_t *ctx, LayerTypePtr Layer, TextTypePtr Text) { if (TEST_FLAG(PCB_FLAG_LOCK, Text) || !TEST_FLAG(PCB_FLAG_CLEARLINE, Text)) return (NULL); - return ChangeTextJoin(Layer, Text); + return ChangeTextJoin(ctx, Layer, Text); } /* --------------------------------------------------------------------------- * changes the square flag of all pins on an element */ -static void *ChangeElementSquare(ElementTypePtr Element) +static void *ChangeElementSquare(pcb_opctx_t *ctx, ElementTypePtr Element) { void *ans = NULL; @@ -1491,12 +1491,12 @@ return (NULL); PIN_LOOP(Element); { - ans = ChangePinSquare(Element, pin); + ans = ChangePinSquare(ctx, Element, pin); } END_LOOP; PAD_LOOP(Element); { - ans = ChangePadSquare(Element, pad); + ans = ChangePadSquare(ctx, Element, pad); } END_LOOP; return (ans); @@ -1505,7 +1505,7 @@ /* --------------------------------------------------------------------------- * sets the square flag of all pins on an element */ -static void *SetElementSquare(ElementTypePtr Element) +static void *SetElementSquare(pcb_opctx_t *ctx, ElementTypePtr Element) { void *ans = NULL; @@ -1513,12 +1513,12 @@ return (NULL); PIN_LOOP(Element); { - ans = SetPinSquare(Element, pin); + ans = SetPinSquare(ctx, Element, pin); } END_LOOP; PAD_LOOP(Element); { - ans = SetPadSquare(Element, pad); + ans = SetPadSquare(ctx, Element, pad); } END_LOOP; return (ans); @@ -1527,7 +1527,7 @@ /* --------------------------------------------------------------------------- * clears the square flag of all pins on an element */ -static void *ClrElementSquare(ElementTypePtr Element) +static void *ClrElementSquare(pcb_opctx_t *ctx, ElementTypePtr Element) { void *ans = NULL; @@ -1535,12 +1535,12 @@ return (NULL); PIN_LOOP(Element); { - ans = ClrPinSquare(Element, pin); + ans = ClrPinSquare(ctx, Element, pin); } END_LOOP; PAD_LOOP(Element); { - ans = ClrPadSquare(Element, pad); + ans = ClrPadSquare(ctx, Element, pad); } END_LOOP; return (ans); @@ -1549,7 +1549,7 @@ /* --------------------------------------------------------------------------- * changes the octagon flags of all pins of an element */ -static void *ChangeElementOctagon(ElementTypePtr Element) +static void *ChangeElementOctagon(pcb_opctx_t *ctx, ElementTypePtr Element) { void *result = NULL; @@ -1557,7 +1557,7 @@ return (NULL); PIN_LOOP(Element); { - ChangePinOctagon(Element, pin); + ChangePinOctagon(ctx, Element, pin); result = Element; } END_LOOP; @@ -1567,7 +1567,7 @@ /* --------------------------------------------------------------------------- * sets the octagon flags of all pins of an element */ -static void *SetElementOctagon(ElementTypePtr Element) +static void *SetElementOctagon(pcb_opctx_t *ctx, ElementTypePtr Element) { void *result = NULL; @@ -1575,7 +1575,7 @@ return (NULL); PIN_LOOP(Element); { - SetPinOctagon(Element, pin); + SetPinOctagon(ctx, Element, pin); result = Element; } END_LOOP; @@ -1585,7 +1585,7 @@ /* --------------------------------------------------------------------------- * clears the octagon flags of all pins of an element */ -static void *ClrElementOctagon(ElementTypePtr Element) +static void *ClrElementOctagon(pcb_opctx_t *ctx, ElementTypePtr Element) { void *result = NULL; @@ -1593,7 +1593,7 @@ return (NULL); PIN_LOOP(Element); { - ClrPinOctagon(Element, pin); + ClrPinOctagon(ctx, Element, pin); result = Element; } END_LOOP; @@ -1603,7 +1603,7 @@ /* --------------------------------------------------------------------------- * changes the square flag of a pad */ -static void *ChangePadSquare(ElementTypePtr Element, PadTypePtr Pad) +static void *ChangePadSquare(pcb_opctx_t *ctx, ElementTypePtr Element, PadTypePtr Pad) { if (TEST_FLAG(PCB_FLAG_LOCK, Pad)) return (NULL); @@ -1621,13 +1621,13 @@ /* --------------------------------------------------------------------------- * sets the square flag of a pad */ -static void *SetPadSquare(ElementTypePtr Element, PadTypePtr Pad) +static void *SetPadSquare(pcb_opctx_t *ctx, ElementTypePtr Element, PadTypePtr Pad) { if (TEST_FLAG(PCB_FLAG_LOCK, Pad) || TEST_FLAG(PCB_FLAG_SQUARE, Pad)) return (NULL); - return (ChangePadSquare(Element, Pad)); + return (ChangePadSquare(ctx, Element, Pad)); } @@ -1634,13 +1634,13 @@ /* --------------------------------------------------------------------------- * clears the square flag of a pad */ -static void *ClrPadSquare(ElementTypePtr Element, PadTypePtr Pad) +static void *ClrPadSquare(pcb_opctx_t *ctx, ElementTypePtr Element, PadTypePtr Pad) { if (TEST_FLAG(PCB_FLAG_LOCK, Pad) || !TEST_FLAG(PCB_FLAG_SQUARE, Pad)) return (NULL); - return (ChangePadSquare(Element, Pad)); + return (ChangePadSquare(ctx, Element, Pad)); } @@ -1647,7 +1647,7 @@ /* --------------------------------------------------------------------------- * changes the square flag of a via */ -static void *ChangeViaSquare(PinTypePtr Via) +static void *ChangeViaSquare(pcb_opctx_t *ctx, PinTypePtr Via) { if (TEST_FLAG(PCB_FLAG_LOCK, Via)) return (NULL); @@ -1670,7 +1670,7 @@ /* --------------------------------------------------------------------------- * changes the square flag of a pin */ -static void *ChangePinSquare(ElementTypePtr Element, PinTypePtr Pin) +static void *ChangePinSquare(pcb_opctx_t *ctx, ElementTypePtr Element, PinTypePtr Pin) { if (TEST_FLAG(PCB_FLAG_LOCK, Pin)) return (NULL); @@ -1693,29 +1693,29 @@ /* --------------------------------------------------------------------------- * sets the square flag of a pin */ -static void *SetPinSquare(ElementTypePtr Element, PinTypePtr Pin) +static void *SetPinSquare(pcb_opctx_t *ctx, ElementTypePtr Element, PinTypePtr Pin) { if (TEST_FLAG(PCB_FLAG_LOCK, Pin) || TEST_FLAG(PCB_FLAG_SQUARE, Pin)) return (NULL); - return (ChangePinSquare(Element, Pin)); + return (ChangePinSquare(ctx, Element, Pin)); } /* --------------------------------------------------------------------------- * clears the square flag of a pin */ -static void *ClrPinSquare(ElementTypePtr Element, PinTypePtr Pin) +static void *ClrPinSquare(pcb_opctx_t *ctx, ElementTypePtr Element, PinTypePtr Pin) { if (TEST_FLAG(PCB_FLAG_LOCK, Pin) || !TEST_FLAG(PCB_FLAG_SQUARE, Pin)) return (NULL); - return (ChangePinSquare(Element, Pin)); + return (ChangePinSquare(ctx, Element, Pin)); } /* --------------------------------------------------------------------------- * changes the octagon flag of a via */ -static void *ChangeViaOctagon(PinTypePtr Via) +static void *ChangeViaOctagon(pcb_opctx_t *ctx, PinTypePtr Via) { if (TEST_FLAG(PCB_FLAG_LOCK, Via)) return (NULL); @@ -1733,29 +1733,29 @@ /* --------------------------------------------------------------------------- * sets the octagon flag of a via */ -static void *SetViaOctagon(PinTypePtr Via) +static void *SetViaOctagon(pcb_opctx_t *ctx, PinTypePtr Via) { if (TEST_FLAG(PCB_FLAG_LOCK, Via) || TEST_FLAG(PCB_FLAG_OCTAGON, Via)) return (NULL); - return (ChangeViaOctagon(Via)); + return (ChangeViaOctagon(ctx, Via)); } /* --------------------------------------------------------------------------- * clears the octagon flag of a via */ -static void *ClrViaOctagon(PinTypePtr Via) +static void *ClrViaOctagon(pcb_opctx_t *ctx, PinTypePtr Via) { if (TEST_FLAG(PCB_FLAG_LOCK, Via) || !TEST_FLAG(PCB_FLAG_OCTAGON, Via)) return (NULL); - return (ChangeViaOctagon(Via)); + return (ChangeViaOctagon(ctx, Via)); } /* --------------------------------------------------------------------------- * changes the octagon flag of a pin */ -static void *ChangePinOctagon(ElementTypePtr Element, PinTypePtr Pin) +static void *ChangePinOctagon(pcb_opctx_t *ctx, ElementTypePtr Element, PinTypePtr Pin) { if (TEST_FLAG(PCB_FLAG_LOCK, Pin)) return (NULL); @@ -1773,23 +1773,23 @@ /* --------------------------------------------------------------------------- * sets the octagon flag of a pin */ -static void *SetPinOctagon(ElementTypePtr Element, PinTypePtr Pin) +static void *SetPinOctagon(pcb_opctx_t *ctx, ElementTypePtr Element, PinTypePtr Pin) { if (TEST_FLAG(PCB_FLAG_LOCK, Pin) || TEST_FLAG(PCB_FLAG_OCTAGON, Pin)) return (NULL); - return (ChangePinOctagon(Element, Pin)); + return (ChangePinOctagon(ctx, Element, Pin)); } /* --------------------------------------------------------------------------- * clears the octagon flag of a pin */ -static void *ClrPinOctagon(ElementTypePtr Element, PinTypePtr Pin) +static void *ClrPinOctagon(pcb_opctx_t *ctx, ElementTypePtr Element, PinTypePtr Pin) { if (TEST_FLAG(PCB_FLAG_LOCK, Pin) || !TEST_FLAG(PCB_FLAG_OCTAGON, Pin)) return (NULL); - return (ChangePinOctagon(Element, Pin)); + return (ChangePinOctagon(ctx, Element, Pin)); } /* --------------------------------------------------------------------------- @@ -1846,7 +1846,7 @@ /* --------------------------------------------------------------------------- * changes the CLEARPOLY flag of a polygon */ -static void *ChangePolyClear(LayerTypePtr Layer, PolygonTypePtr Polygon) +static void *ChangePolyClear(pcb_opctx_t *ctx, LayerTypePtr Layer, PolygonTypePtr Polygon) { if (TEST_FLAG(PCB_FLAG_LOCK, Polygon)) return (NULL); @@ -1889,9 +1889,10 @@ pcb_bool ChangeSelectedThermals(int types, int therm_style) { pcb_bool change = pcb_false; + pcb_opctx_t ctx; Delta = therm_style; - change = SelectedOperation(&ChangeThermalFunctions, pcb_false, types); + change = SelectedOperation(&ChangeThermalFunctions, &ctx, pcb_false, types); if (change) { Draw(); IncrementUndoSerialNumber(); @@ -1906,12 +1907,13 @@ pcb_bool ChangeSelectedSize(int types, Coord Difference, pcb_bool fixIt) { pcb_bool change = pcb_false; - + pcb_opctx_t ctx; + /* setup identifiers */ Absolute = (fixIt) ? Difference : 0; Delta = Difference; - change = SelectedOperation(&ChangeSizeFunctions, pcb_false, types); + change = SelectedOperation(&ChangeSizeFunctions, &ctx, pcb_false, types); if (change) { Draw(); IncrementUndoSerialNumber(); @@ -1926,14 +1928,15 @@ pcb_bool ChangeSelectedClearSize(int types, Coord Difference, pcb_bool fixIt) { pcb_bool change = pcb_false; + pcb_opctx_t ctx; /* setup identifiers */ Absolute = (fixIt) ? Difference : 0; Delta = Difference; if (conf_core.editor.show_mask) - change = SelectedOperation(&ChangeMaskSizeFunctions, pcb_false, types); + change = SelectedOperation(&ChangeMaskSizeFunctions, &ctx, pcb_false, types); else - change = SelectedOperation(&ChangeClearSizeFunctions, pcb_false, types); + change = SelectedOperation(&ChangeClearSizeFunctions, &ctx, pcb_false, types); if (change) { Draw(); IncrementUndoSerialNumber(); @@ -1948,11 +1951,12 @@ pcb_bool ChangeSelected2ndSize(int types, Coord Difference, pcb_bool fixIt) { pcb_bool change = pcb_false; + pcb_opctx_t ctx; /* setup identifiers */ Absolute = (fixIt) ? Difference : 0; Delta = Difference; - change = SelectedOperation(&Change2ndSizeFunctions, pcb_false, types); + change = SelectedOperation(&Change2ndSizeFunctions, &ctx, pcb_false, types); if (change) { Draw(); IncrementUndoSerialNumber(); @@ -1967,8 +1971,9 @@ pcb_bool ChangeSelectedJoin(int types) { pcb_bool change = pcb_false; + pcb_opctx_t ctx; - change = SelectedOperation(&ChangeJoinFunctions, pcb_false, types); + change = SelectedOperation(&ChangeJoinFunctions, &ctx, pcb_false, types); if (change) { Draw(); IncrementUndoSerialNumber(); @@ -1983,8 +1988,9 @@ pcb_bool SetSelectedJoin(int types) { pcb_bool change = pcb_false; + pcb_opctx_t ctx; - change = SelectedOperation(&SetJoinFunctions, pcb_false, types); + change = SelectedOperation(&SetJoinFunctions, &ctx, pcb_false, types); if (change) { Draw(); IncrementUndoSerialNumber(); @@ -1999,8 +2005,9 @@ pcb_bool ClrSelectedJoin(int types) { pcb_bool change = pcb_false; + pcb_opctx_t ctx; - change = SelectedOperation(&ClrJoinFunctions, pcb_false, types); + change = SelectedOperation(&ClrJoinFunctions, &ctx, pcb_false, types); if (change) { Draw(); IncrementUndoSerialNumber(); @@ -2015,8 +2022,9 @@ pcb_bool ChangeSelectedNonetlist(int types) { pcb_bool change = pcb_false; + pcb_opctx_t ctx; - change = SelectedOperation(&ChangeNonetlistFunctions, pcb_false, types); + change = SelectedOperation(&ChangeNonetlistFunctions, &ctx, pcb_false, types); if (change) { Draw(); IncrementUndoSerialNumber(); @@ -2032,8 +2040,9 @@ pcb_bool SetSelectedNonetlist(int types) { pcb_bool change = pcb_false; + pcb_opctx_t ctx; - change = SelectedOperation(&SetNonetlistFunctions, pcb_false, types); + change = SelectedOperation(&SetNonetlistFunctions, &ctx, pcb_false, types); if (change) { Draw(); IncrementUndoSerialNumber(); @@ -2048,8 +2057,9 @@ pcb_bool ClrSelectedNonetlist(int types) { pcb_bool change = pcb_false; + pcb_opctx_t ctx; - change = SelectedOperation(&ClrNonetlistFunctions, pcb_false, types); + change = SelectedOperation(&ClrNonetlistFunctions, &ctx, pcb_false, types); if (change) { Draw(); IncrementUndoSerialNumber(); @@ -2065,8 +2075,9 @@ pcb_bool ChangeSelectedSquare(int types) { pcb_bool change = pcb_false; + pcb_opctx_t ctx; - change = SelectedOperation(&ChangeSquareFunctions, pcb_false, types); + change = SelectedOperation(&ChangeSquareFunctions, &ctx, pcb_false, types); if (change) { Draw(); IncrementUndoSerialNumber(); @@ -2081,6 +2092,7 @@ pcb_bool ChangeSelectedAngle(int types, int is_start, Angle Difference, pcb_bool fixIt) { pcb_bool change = pcb_false; + pcb_opctx_t ctx; /* setup identifiers */ AAbsolute = (fixIt) ? Difference : 0; @@ -2087,7 +2099,7 @@ ADelta = Difference; is_primary = is_start; - change = SelectedOperation(&ChangeAngleFunctions, pcb_false, types); + change = SelectedOperation(&ChangeAngleFunctions, &ctx, pcb_false, types); if (change) { Draw(); IncrementUndoSerialNumber(); @@ -2102,6 +2114,7 @@ pcb_bool ChangeSelectedRadius(int types, int is_start, Angle Difference, pcb_bool fixIt) { pcb_bool change = pcb_false; + pcb_opctx_t ctx; /* setup identifiers */ Absolute = (fixIt) ? Difference : 0; @@ -2108,7 +2121,7 @@ Delta = Difference; is_primary = is_start; - change = SelectedOperation(&ChangeRadiusFunctions, pcb_false, types); + change = SelectedOperation(&ChangeRadiusFunctions, &ctx, pcb_false, types); if (change) { Draw(); IncrementUndoSerialNumber(); @@ -2124,8 +2137,9 @@ pcb_bool SetSelectedSquare(int types) { pcb_bool change = pcb_false; + pcb_opctx_t ctx; - change = SelectedOperation(&SetSquareFunctions, pcb_false, types); + change = SelectedOperation(&SetSquareFunctions, &ctx, pcb_false, types); if (change) { Draw(); IncrementUndoSerialNumber(); @@ -2140,8 +2154,9 @@ pcb_bool ClrSelectedSquare(int types) { pcb_bool change = pcb_false; + pcb_opctx_t ctx; - change = SelectedOperation(&ClrSquareFunctions, pcb_false, types); + change = SelectedOperation(&ClrSquareFunctions, &ctx, pcb_false, types); if (change) { Draw(); IncrementUndoSerialNumber(); @@ -2156,8 +2171,9 @@ pcb_bool ChangeSelectedOctagon(int types) { pcb_bool change = pcb_false; + pcb_opctx_t ctx; - change = SelectedOperation(&ChangeOctagonFunctions, pcb_false, types); + change = SelectedOperation(&ChangeOctagonFunctions, &ctx, pcb_false, types); if (change) { Draw(); IncrementUndoSerialNumber(); @@ -2172,8 +2188,9 @@ pcb_bool SetSelectedOctagon(int types) { pcb_bool change = pcb_false; + pcb_opctx_t ctx; - change = SelectedOperation(&SetOctagonFunctions, pcb_false, types); + change = SelectedOperation(&SetOctagonFunctions, &ctx, pcb_false, types); if (change) { Draw(); IncrementUndoSerialNumber(); @@ -2188,8 +2205,9 @@ pcb_bool ClrSelectedOctagon(int types) { pcb_bool change = pcb_false; + pcb_opctx_t ctx; - change = SelectedOperation(&ClrOctagonFunctions, pcb_false, types); + change = SelectedOperation(&ClrOctagonFunctions, &ctx, pcb_false, types); if (change) { Draw(); IncrementUndoSerialNumber(); @@ -2248,11 +2266,12 @@ pcb_bool ChangeObjectSize(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord Difference, pcb_bool fixIt) { pcb_bool change; + pcb_opctx_t ctx; /* setup identifier */ Absolute = (fixIt) ? Difference : 0; Delta = Difference; - change = (ObjectOperation(&ChangeSizeFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL); + change = (ObjectOperation(&ChangeSizeFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3) != NULL); if (change) { Draw(); IncrementUndoSerialNumber(); @@ -2267,11 +2286,12 @@ pcb_bool ChangeObject1stSize(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord Difference, pcb_bool fixIt) { pcb_bool change; + pcb_opctx_t ctx; /* setup identifier */ Absolute = (fixIt) ? Difference : 0; Delta = Difference; - change = (ObjectOperation(&Change1stSizeFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL); + change = (ObjectOperation(&Change1stSizeFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3) != NULL); if (change) { Draw(); IncrementUndoSerialNumber(); @@ -2286,12 +2306,13 @@ pcb_bool ChangeObjectRadius(int Type, void *Ptr1, void *Ptr2, void *Ptr3, int is_x, Coord r, pcb_bool fixIt) { pcb_bool change; + pcb_opctx_t ctx; /* setup identifier */ Absolute = (fixIt) ? r : 0; Delta = r; is_primary = is_x; - change = (ObjectOperation(&ChangeRadiusFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL); + change = (ObjectOperation(&ChangeRadiusFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3) != NULL); if (change) { Draw(); IncrementUndoSerialNumber(); @@ -2306,12 +2327,13 @@ pcb_bool ChangeObjectAngle(int Type, void *Ptr1, void *Ptr2, void *Ptr3, int is_start, Angle a, pcb_bool fixIt) { pcb_bool change; + pcb_opctx_t ctx; /* setup identifier */ AAbsolute = (fixIt) ? a : 0; ADelta = a; is_primary = is_start; - change = (ObjectOperation(&ChangeAngleFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL); + change = (ObjectOperation(&ChangeAngleFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3) != NULL); if (change) { Draw(); IncrementUndoSerialNumber(); @@ -2327,14 +2349,15 @@ pcb_bool ChangeObjectClearSize(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord Difference, pcb_bool fixIt) { pcb_bool change; + pcb_opctx_t ctx; /* setup identifier */ Absolute = (fixIt) ? Difference : 0; Delta = Difference; if (conf_core.editor.show_mask) - change = (ObjectOperation(&ChangeMaskSizeFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL); + change = (ObjectOperation(&ChangeMaskSizeFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3) != NULL); else - change = (ObjectOperation(&ChangeClearSizeFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL); + change = (ObjectOperation(&ChangeClearSizeFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3) != NULL); if (change) { Draw(); IncrementUndoSerialNumber(); @@ -2350,9 +2373,10 @@ pcb_bool ChangeObjectThermal(int Type, void *Ptr1, void *Ptr2, void *Ptr3, int therm_type) { pcb_bool change; + pcb_opctx_t ctx; Delta = Absolute = therm_type; - change = (ObjectOperation(&ChangeThermalFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL); + change = (ObjectOperation(&ChangeThermalFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3) != NULL); if (change) { Draw(); IncrementUndoSerialNumber(); @@ -2367,11 +2391,12 @@ pcb_bool ChangeObject2ndSize(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord Difference, pcb_bool fixIt, pcb_bool incundo) { pcb_bool change; + pcb_opctx_t ctx; /* setup identifier */ Absolute = (fixIt) ? Difference : 0; Delta = Difference; - change = (ObjectOperation(&Change2ndSizeFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL); + change = (ObjectOperation(&Change2ndSizeFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3) != NULL); if (change) { Draw(); if (incundo) @@ -2387,11 +2412,12 @@ pcb_bool ChangeObjectMaskSize(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord Difference, pcb_bool fixIt) { pcb_bool change; + pcb_opctx_t ctx; /* setup identifier */ Absolute = (fixIt) ? Difference : 0; Delta = Difference; - change = (ObjectOperation(&ChangeMaskSizeFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL); + change = (ObjectOperation(&ChangeMaskSizeFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3) != NULL); if (change) { Draw(); IncrementUndoSerialNumber(); @@ -2409,9 +2435,11 @@ void *ChangeObjectName(int Type, void *Ptr1, void *Ptr2, void *Ptr3, char *Name) { void *result; + pcb_opctx_t ctx; + /* setup identifier */ NewName = Name; - result = ObjectOperation(&ChangeNameFunctions, Type, Ptr1, Ptr2, Ptr3); + result = ObjectOperation(&ChangeNameFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3); Draw(); return (result); } @@ -2426,9 +2454,11 @@ void *ChangeObjectPinnum(int Type, void *Ptr1, void *Ptr2, void *Ptr3, char *Name) { void *result; + pcb_opctx_t ctx; + /* setup identifier */ NewName = Name; - result = ObjectOperation(&ChangePinnumFunctions, Type, Ptr1, Ptr2, Ptr3); + result = ObjectOperation(&ChangePinnumFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3); Draw(); return (result); } @@ -2439,7 +2469,9 @@ */ pcb_bool ChangeObjectJoin(int Type, void *Ptr1, void *Ptr2, void *Ptr3) { - if (ObjectOperation(&ChangeJoinFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { + pcb_opctx_t ctx; + + if (ObjectOperation(&ChangeJoinFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3) != NULL) { Draw(); IncrementUndoSerialNumber(); return (pcb_true); @@ -2453,7 +2485,9 @@ */ pcb_bool SetObjectJoin(int Type, void *Ptr1, void *Ptr2, void *Ptr3) { - if (ObjectOperation(&SetJoinFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { + pcb_opctx_t ctx; + + if (ObjectOperation(&SetJoinFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3) != NULL) { Draw(); IncrementUndoSerialNumber(); return (pcb_true); @@ -2467,7 +2501,9 @@ */ pcb_bool ClrObjectJoin(int Type, void *Ptr1, void *Ptr2, void *Ptr3) { - if (ObjectOperation(&ClrJoinFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { + pcb_opctx_t ctx; + + if (ObjectOperation(&ClrJoinFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3) != NULL) { Draw(); IncrementUndoSerialNumber(); return (pcb_true); @@ -2481,7 +2517,9 @@ */ pcb_bool ChangeObjectNonetlist(int Type, void *Ptr1, void *Ptr2, void *Ptr3) { - if (ObjectOperation(&ChangeNonetlistFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { + pcb_opctx_t ctx; + + if (ObjectOperation(&ChangeNonetlistFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3) != NULL) { Draw(); IncrementUndoSerialNumber(); return (pcb_true); @@ -2495,8 +2533,10 @@ */ pcb_bool ChangeObjectSquare(int Type, void *Ptr1, void *Ptr2, void *Ptr3, int style) { + pcb_opctx_t ctx; + Absolute = style; - if (ObjectOperation(&ChangeSquareFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { + if (ObjectOperation(&ChangeSquareFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3) != NULL) { Draw(); IncrementUndoSerialNumber(); return (pcb_true); @@ -2510,7 +2550,9 @@ */ pcb_bool SetObjectSquare(int Type, void *Ptr1, void *Ptr2, void *Ptr3) { - if (ObjectOperation(&SetSquareFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { + pcb_opctx_t ctx; + + if (ObjectOperation(&SetSquareFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3) != NULL) { Draw(); IncrementUndoSerialNumber(); return (pcb_true); @@ -2524,7 +2566,9 @@ */ pcb_bool ClrObjectSquare(int Type, void *Ptr1, void *Ptr2, void *Ptr3) { - if (ObjectOperation(&ClrSquareFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { + pcb_opctx_t ctx; + + if (ObjectOperation(&ClrSquareFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3) != NULL) { Draw(); IncrementUndoSerialNumber(); return (pcb_true); @@ -2538,7 +2582,9 @@ */ pcb_bool ChangeObjectOctagon(int Type, void *Ptr1, void *Ptr2, void *Ptr3) { - if (ObjectOperation(&ChangeOctagonFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { + pcb_opctx_t ctx; + + if (ObjectOperation(&ChangeOctagonFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3) != NULL) { Draw(); IncrementUndoSerialNumber(); return (pcb_true); @@ -2552,7 +2598,9 @@ */ pcb_bool SetObjectOctagon(int Type, void *Ptr1, void *Ptr2, void *Ptr3) { - if (ObjectOperation(&SetOctagonFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { + pcb_opctx_t ctx; + + if (ObjectOperation(&SetOctagonFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3) != NULL) { Draw(); IncrementUndoSerialNumber(); return (pcb_true); @@ -2566,7 +2614,9 @@ */ pcb_bool ClrObjectOctagon(int Type, void *Ptr1, void *Ptr2, void *Ptr3) { - if (ObjectOperation(&ClrOctagonFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { + pcb_opctx_t ctx; + + if (ObjectOperation(&ClrOctagonFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3) != NULL) { Draw(); IncrementUndoSerialNumber(); return (pcb_true); @@ -2676,7 +2726,7 @@ * changes the mask size of a pad * returns pcb_true if changed */ -static void *ChangePadMaskSize(ElementTypePtr Element, PadTypePtr Pad) +static void *ChangePadMaskSize(pcb_opctx_t *ctx, ElementTypePtr Element, PadTypePtr Pad) { Coord value = (Absolute) ? Absolute : Pad->Mask + Delta; @@ -2699,7 +2749,7 @@ * changes the mask size of a pin * returns pcb_true if changed */ -static void *ChangePinMaskSize(ElementTypePtr Element, PinTypePtr Pin) +static void *ChangePinMaskSize(pcb_opctx_t *ctx, ElementTypePtr Element, PinTypePtr Pin) { Coord value = (Absolute) ? Absolute : Pin->Mask + Delta; @@ -2722,7 +2772,7 @@ * changes the mask size of a via * returns pcb_true if changed */ -static void *ChangeViaMaskSize(PinTypePtr Via) +static void *ChangeViaMaskSize(pcb_opctx_t *ctx, PinTypePtr Via) { Coord value; Index: trunk/src/copy.c =================================================================== --- trunk/src/copy.c (revision 4550) +++ trunk/src/copy.c (revision 4551) @@ -47,18 +47,18 @@ /* --------------------------------------------------------------------------- * some local prototypes */ -static void *CopyVia(PinTypePtr); -static void *CopyLine(LayerTypePtr, LineTypePtr); -static void *CopyArc(LayerTypePtr, ArcTypePtr); -static void *CopyText(LayerTypePtr, TextTypePtr); -static void *CopyPolygon(LayerTypePtr, PolygonTypePtr); -static void *CopyElement(ElementTypePtr); +static void *CopyVia(pcb_opctx_t *ctx, PinTypePtr); +static void *CopyLine(pcb_opctx_t *ctx, LayerTypePtr, LineTypePtr); +static void *CopyArc(pcb_opctx_t *ctx, LayerTypePtr, ArcTypePtr); +static void *CopyText(pcb_opctx_t *ctx, LayerTypePtr, TextTypePtr); +static void *CopyPolygon(pcb_opctx_t *ctx, LayerTypePtr, PolygonTypePtr); +static void *CopyElement(pcb_opctx_t *ctx, ElementTypePtr); /* --------------------------------------------------------------------------- * some local identifiers */ static Coord DeltaX, DeltaY; /* movement vector */ -static ObjectFunctionType CopyFunctions = { +static pcb_opfunc_t CopyFunctions = { CopyLine, CopyText, CopyPolygon, @@ -158,7 +158,7 @@ /* --------------------------------------------------------------------------- * copies a via */ -static void *CopyVia(PinTypePtr Via) +static void *CopyVia(pcb_opctx_t *ctx, PinTypePtr Via) { PinTypePtr via; @@ -174,7 +174,7 @@ /* --------------------------------------------------------------------------- * copies a line */ -static void *CopyLine(LayerTypePtr Layer, LineTypePtr Line) +static void *CopyLine(pcb_opctx_t *ctx, LayerTypePtr Layer, LineTypePtr Line) { LineTypePtr line; @@ -194,7 +194,7 @@ /* --------------------------------------------------------------------------- * copies an arc */ -static void *CopyArc(LayerTypePtr Layer, ArcTypePtr Arc) +static void *CopyArc(pcb_opctx_t *ctx, LayerTypePtr Layer, ArcTypePtr Arc) { ArcTypePtr arc; @@ -211,7 +211,7 @@ /* --------------------------------------------------------------------------- * copies a text */ -static void *CopyText(LayerTypePtr Layer, TextTypePtr Text) +static void *CopyText(pcb_opctx_t *ctx, LayerTypePtr Layer, TextTypePtr Text) { TextTypePtr text; @@ -225,7 +225,7 @@ /* --------------------------------------------------------------------------- * copies a polygon */ -static void *CopyPolygon(LayerTypePtr Layer, PolygonTypePtr Polygon) +static void *CopyPolygon(pcb_opctx_t *ctx, LayerTypePtr Layer, PolygonTypePtr Polygon) { PolygonTypePtr polygon; @@ -244,7 +244,7 @@ /* --------------------------------------------------------------------------- * copies an element onto the PCB. Then does a draw. */ -static void *CopyElement(ElementTypePtr Element) +static void *CopyElement(pcb_opctx_t *ctx, ElementTypePtr Element) { #ifdef DEBUG @@ -279,6 +279,7 @@ { pcb_cardinal_t i; pcb_bool changed = pcb_false; + pcb_opctx_t ctx; #ifdef DEBUG printf("Entering CopyPastebufferToLayout.....\n"); @@ -295,22 +296,22 @@ changed = changed || (!LAYER_IS_EMPTY(sourcelayer)); LINE_LOOP(sourcelayer); { - CopyLine(destlayer, line); + CopyLine(&ctx, destlayer, line); } END_LOOP; ARC_LOOP(sourcelayer); { - CopyArc(destlayer, arc); + CopyArc(&ctx, destlayer, arc); } END_LOOP; TEXT_LOOP(sourcelayer); { - CopyText(destlayer, text); + CopyText(&ctx, destlayer, text); } END_LOOP; POLYGON_LOOP(sourcelayer); { - CopyPolygon(destlayer, polygon); + CopyPolygon(&ctx, destlayer, polygon); } END_LOOP; } @@ -324,7 +325,7 @@ printf("In CopyPastebufferToLayout, pasting element %s\n", element->Name[1].TextString); #endif if (FRONT(element) || PCB->InvisibleObjectsOn) { - CopyElement(element); + CopyElement(&ctx, element); changed = pcb_true; } } @@ -336,7 +337,7 @@ changed |= (pinlist_length(&(PASTEBUFFER->Data->Via)) != 0); VIA_LOOP(PASTEBUFFER->Data); { - CopyVia(via); + CopyVia(&ctx, via); } END_LOOP; } @@ -361,6 +362,7 @@ void *CopyObject(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord DX, Coord DY) { void *ptr; + pcb_opctx_t ctx; /* setup movement vector */ DeltaX = DX; @@ -367,7 +369,7 @@ DeltaY = DY; /* the subroutines add the objects to the undo-list */ - ptr = ObjectOperation(&CopyFunctions, Type, Ptr1, Ptr2, Ptr3); + ptr = ObjectOperation(&CopyFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3); IncrementUndoSerialNumber(); return (ptr); } Index: trunk/src/insert.c =================================================================== --- trunk/src/insert.c (revision 4550) +++ trunk/src/insert.c (revision 4551) @@ -46,9 +46,9 @@ /* --------------------------------------------------------------------------- * some local prototypes */ -static void *InsertPointIntoLine(LayerTypePtr, LineTypePtr); -static void *InsertPointIntoPolygon(LayerTypePtr, PolygonTypePtr); -static void *InsertPointIntoRat(RatTypePtr); +static void *InsertPointIntoLine(pcb_opctx_t *ctx, LayerTypePtr, LineTypePtr); +static void *InsertPointIntoPolygon(pcb_opctx_t *ctx, LayerTypePtr, PolygonTypePtr); +static void *InsertPointIntoRat(pcb_opctx_t *ctx, RatTypePtr); /* --------------------------------------------------------------------------- * some local identifiers @@ -57,7 +57,7 @@ static pcb_cardinal_t InsertAt; static pcb_bool InsertLast; static pcb_bool Forcible; -static ObjectFunctionType InsertFunctions = { +static pcb_opfunc_t InsertFunctions = { InsertPointIntoLine, NULL, InsertPointIntoPolygon, @@ -75,7 +75,7 @@ /* --------------------------------------------------------------------------- * inserts a point into a rat-line */ -static void *InsertPointIntoRat(RatTypePtr Rat) +static void *InsertPointIntoRat(pcb_opctx_t *ctx, RatTypePtr Rat) { LineTypePtr newone; @@ -100,7 +100,7 @@ /* --------------------------------------------------------------------------- * inserts a point into a line */ -static void *InsertPointIntoLine(LayerTypePtr Layer, LineTypePtr Line) +static void *InsertPointIntoLine(pcb_opctx_t *ctx, LayerTypePtr Layer, LineTypePtr Line) { LineTypePtr line; Coord X, Y; @@ -136,7 +136,7 @@ /* --------------------------------------------------------------------------- * inserts a point into a polygon */ -static void *InsertPointIntoPolygon(LayerTypePtr Layer, PolygonTypePtr Polygon) +static void *InsertPointIntoPolygon(pcb_opctx_t *ctx, LayerTypePtr Layer, PolygonTypePtr Polygon) { PointType save; pcb_cardinal_t n; @@ -186,6 +186,7 @@ void *InsertPointIntoObject(int Type, void *Ptr1, void *Ptr2, pcb_cardinal_t * Ptr3, Coord DX, Coord DY, pcb_bool Force, pcb_bool insert_last) { void *ptr; + pcb_opctx_t ctx; /* setup offset */ InsertX = DX; @@ -195,7 +196,7 @@ Forcible = Force; /* the operation insert the points to the undo-list */ - ptr = ObjectOperation(&InsertFunctions, Type, Ptr1, Ptr2, Ptr3); + ptr = ObjectOperation(&InsertFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3); if (ptr != NULL) IncrementUndoSerialNumber(); return (ptr); Index: trunk/src/move.c =================================================================== --- trunk/src/move.c (revision 4550) +++ trunk/src/move.c (revision 4551) @@ -55,20 +55,20 @@ /* --------------------------------------------------------------------------- * some local prototypes */ -static void *MoveElementName(ElementTypePtr); -static void *MoveElement(ElementTypePtr); -static void *MoveVia(PinTypePtr); -static void *MoveLine(LayerTypePtr, LineTypePtr); -static void *MoveArc(LayerTypePtr, ArcTypePtr); -static void *MoveText(LayerTypePtr, TextTypePtr); -static void *MovePolygon(LayerTypePtr, PolygonTypePtr); -static void *MoveLinePoint(LayerTypePtr, LineTypePtr, PointTypePtr); -static void *MovePolygonPoint(LayerTypePtr, PolygonTypePtr, PointTypePtr); -static void *MoveLineToLayer(LayerTypePtr, LineTypePtr); -static void *MoveArcToLayer(LayerTypePtr, ArcTypePtr); -static void *MoveRatToLayer(RatTypePtr); -static void *MoveTextToLayer(LayerTypePtr, TextTypePtr); -static void *MovePolygonToLayer(LayerTypePtr, PolygonTypePtr); +static void *MoveElementName(pcb_opctx_t *ctx, ElementTypePtr); +static void *MoveElement(pcb_opctx_t *ctx, ElementTypePtr); +static void *MoveVia(pcb_opctx_t *ctx, PinTypePtr); +static void *MoveLine(pcb_opctx_t *ctx, LayerTypePtr, LineTypePtr); +static void *MoveArc(pcb_opctx_t *ctx, LayerTypePtr, ArcTypePtr); +static void *MoveText(pcb_opctx_t *ctx, LayerTypePtr, TextTypePtr); +static void *MovePolygon(pcb_opctx_t *ctx, LayerTypePtr, PolygonTypePtr); +static void *MoveLinePoint(pcb_opctx_t *ctx, LayerTypePtr, LineTypePtr, PointTypePtr); +static void *MovePolygonPoint(pcb_opctx_t *ctx, LayerTypePtr, PolygonTypePtr, PointTypePtr); +static void *MoveLineToLayer(pcb_opctx_t *ctx, LayerTypePtr, LineTypePtr); +static void *MoveArcToLayer(pcb_opctx_t *ctx, LayerTypePtr, ArcTypePtr); +static void *MoveRatToLayer(pcb_opctx_t *ctx, RatTypePtr); +static void *MoveTextToLayer(pcb_opctx_t *ctx, LayerTypePtr, TextTypePtr); +static void *MovePolygonToLayer(pcb_opctx_t *ctx, LayerTypePtr, PolygonTypePtr); /* --------------------------------------------------------------------------- * some local identifiers @@ -76,7 +76,7 @@ static Coord DeltaX, DeltaY; /* used by local routines as offset */ static LayerTypePtr Dest; static pcb_bool MoreToCome; -static ObjectFunctionType MoveFunctions = { +static pcb_opfunc_t MoveFunctions = { MoveLine, MoveText, MovePolygon, @@ -154,7 +154,7 @@ /* ---------------------------------------------------------------------- * moves all names of an element to a new position */ -static void *MoveElementName(ElementTypePtr Element) +static void *MoveElementName(pcb_opctx_t *ctx, ElementTypePtr Element) { if (PCB->ElementOn && (FRONT(Element) || PCB->InvisibleObjectsOn)) { EraseElementName(Element); @@ -187,7 +187,7 @@ /* --------------------------------------------------------------------------- * moves an element */ -static void *MoveElement(ElementTypePtr Element) +static void *MoveElement(pcb_opctx_t *ctx, ElementTypePtr Element) { pcb_bool didDraw = pcb_false; @@ -215,7 +215,7 @@ /* --------------------------------------------------------------------------- * moves a via */ -static void *MoveVia(PinTypePtr Via) +static void *MoveVia(pcb_opctx_t *ctx, PinTypePtr Via) { r_delete_entry(PCB->Data->via_tree, (BoxType *) Via); RestoreToPolygon(PCB->Data, PCB_TYPE_VIA, Via, Via); @@ -234,7 +234,7 @@ /* --------------------------------------------------------------------------- * moves a line */ -static void *MoveLine(LayerTypePtr Layer, LineTypePtr Line) +static void *MoveLine(pcb_opctx_t *ctx, LayerTypePtr Layer, LineTypePtr Line) { if (Layer->On) EraseLine(Line); @@ -253,7 +253,7 @@ /* --------------------------------------------------------------------------- * moves an arc */ -static void *MoveArc(LayerTypePtr Layer, ArcTypePtr Arc) +static void *MoveArc(pcb_opctx_t *ctx, LayerTypePtr Layer, ArcTypePtr Arc) { RestoreToPolygon(PCB->Data, PCB_TYPE_ARC, Layer, Arc); r_delete_entry(Layer->arc_tree, (BoxType *) Arc); @@ -274,7 +274,7 @@ /* --------------------------------------------------------------------------- * moves a text object */ -static void *MoveText(LayerTypePtr Layer, TextTypePtr Text) +static void *MoveText(pcb_opctx_t *ctx, LayerTypePtr Layer, TextTypePtr Text) { RestoreToPolygon(PCB->Data, PCB_TYPE_TEXT, Layer, Text); r_delete_entry(Layer->text_tree, (BoxType *) Text); @@ -307,7 +307,7 @@ /* --------------------------------------------------------------------------- * moves a polygon */ -static void *MovePolygon(LayerTypePtr Layer, PolygonTypePtr Polygon) +static void *MovePolygon(pcb_opctx_t *ctx, LayerTypePtr Layer, PolygonTypePtr Polygon) { if (Layer->On) { ErasePolygon(Polygon); @@ -326,7 +326,7 @@ /* --------------------------------------------------------------------------- * moves one end of a line */ -static void *MoveLinePoint(LayerTypePtr Layer, LineTypePtr Line, PointTypePtr Point) +static void *MoveLinePoint(pcb_opctx_t *ctx, LayerTypePtr Layer, LineTypePtr Line, PointTypePtr Point) { if (Layer) { if (Layer->On) @@ -362,7 +362,7 @@ /* --------------------------------------------------------------------------- * moves a polygon-point */ -static void *MovePolygonPoint(LayerTypePtr Layer, PolygonTypePtr Polygon, PointTypePtr Point) +static void *MovePolygonPoint(pcb_opctx_t *ctx, LayerTypePtr Layer, PolygonTypePtr Polygon, PointTypePtr Point) { if (Layer->On) { ErasePolygon(Polygon); @@ -383,7 +383,7 @@ /* --------------------------------------------------------------------------- * moves a line between layers; lowlevel routines */ -static void *MoveLineToLayerLowLevel(LayerType * Source, LineType * line, LayerType * Destination) +static void *MoveLineToLayerLowLevel(pcb_opctx_t *ctx, LayerType * Source, LineType * line, LayerType * Destination) { r_delete_entry(Source->line_tree, (BoxType *) line); @@ -399,7 +399,7 @@ /* --------------------------------------------------------------------------- * moves an arc between layers; lowlevel routines */ -static void *MoveArcToLayerLowLevel(LayerType * Source, ArcType * arc, LayerType * Destination) +static void *MoveArcToLayerLowLevel(pcb_opctx_t *ctx, LayerType * Source, ArcType * arc, LayerType * Destination) { r_delete_entry(Source->arc_tree, (BoxType *) arc); @@ -416,7 +416,7 @@ /* --------------------------------------------------------------------------- * moves an arc between layers */ -static void *MoveArcToLayer(LayerType * Layer, ArcType * Arc) +static void *MoveArcToLayer(pcb_opctx_t *ctx, LayerType * Layer, ArcType * Arc) { ArcTypePtr newone; @@ -434,7 +434,7 @@ RestoreToPolygon(PCB->Data, PCB_TYPE_ARC, Layer, Arc); if (Layer->On) EraseArc(Arc); - newone = (ArcTypePtr) MoveArcToLayerLowLevel(Layer, Arc, Dest); + newone = (ArcTypePtr) MoveArcToLayerLowLevel(ctx, Layer, Arc, Dest); ClearFromPolygon(PCB->Data, PCB_TYPE_ARC, Dest, Arc); if (Dest->On) DrawArc(Dest, newone); @@ -445,7 +445,7 @@ /* --------------------------------------------------------------------------- * moves a line between layers */ -static void *MoveRatToLayer(RatType * Rat) +static void *MoveRatToLayer(pcb_opctx_t *ctx, RatType * Rat) { LineTypePtr newone; /*Coord X1 = Rat->Point1.X, Y1 = Rat->Point1.Y; @@ -493,7 +493,7 @@ longjmp(i->env, 1); } -static void *MoveLineToLayer(LayerType * Layer, LineType * Line) +static void *MoveLineToLayer(pcb_opctx_t *ctx, LayerType * Layer, LineType * Line) { struct via_info info; BoxType sb; @@ -515,7 +515,7 @@ if (Layer->On) EraseLine(Line); RestoreToPolygon(PCB->Data, PCB_TYPE_LINE, Layer, Line); - newone = (LineTypePtr) MoveLineToLayerLowLevel(Layer, Line, Dest); + newone = (LineTypePtr) MoveLineToLayerLowLevel(ctx, Layer, Line, Dest); Line = NULL; ClearFromPolygon(PCB->Data, PCB_TYPE_LINE, Dest, newone); if (Dest->On) @@ -556,7 +556,7 @@ /* --------------------------------------------------------------------------- * moves a text object between layers; lowlevel routines */ -static void *MoveTextToLayerLowLevel(LayerType * Source, TextType * text, LayerType * Destination) +static void *MoveTextToLayerLowLevel(pcb_opctx_t *ctx, LayerType * Source, TextType * text, LayerType * Destination) { RestoreToPolygon(PCB->Data, PCB_TYPE_TEXT, Source, text); r_delete_entry(Source->text_tree, (BoxType *) text); @@ -582,7 +582,7 @@ /* --------------------------------------------------------------------------- * moves a text object between layers */ -static void *MoveTextToLayer(LayerType * layer, TextType * text) +static void *MoveTextToLayer(pcb_opctx_t *ctx, LayerType * layer, TextType * text) { if (TEST_FLAG(PCB_FLAG_LOCK, text)) { Message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); @@ -592,7 +592,7 @@ AddObjectToMoveToLayerUndoList(PCB_TYPE_TEXT, layer, text, text); if (layer->On) EraseText(layer, text); - text = MoveTextToLayerLowLevel(layer, text, Dest); + text = MoveTextToLayerLowLevel(ctx, layer, text, Dest); if (Dest->On) DrawText(Dest, text); if (layer->On || Dest->On) @@ -604,7 +604,7 @@ /* --------------------------------------------------------------------------- * moves a polygon between layers; lowlevel routines */ -static void *MovePolygonToLayerLowLevel(LayerType * Source, PolygonType * polygon, LayerType * Destination) +static void *MovePolygonToLayerLowLevel(pcb_opctx_t *ctx, LayerType * Source, PolygonType * polygon, LayerType * Destination) { r_delete_entry(Source->polygon_tree, (BoxType *) polygon); @@ -642,7 +642,7 @@ /* --------------------------------------------------------------------------- * moves a polygon between layers */ -static void *MovePolygonToLayer(LayerType * Layer, PolygonType * Polygon) +static void *MovePolygonToLayer(pcb_opctx_t *ctx, LayerType * Layer, PolygonType * Polygon) { PolygonTypePtr newone; struct mptlc d; @@ -664,7 +664,7 @@ r_search(PCB->Data->pin_tree, &Polygon->BoundingBox, NULL, mptl_pin_callback, &d, NULL); d.type = PCB_TYPE_VIA; r_search(PCB->Data->via_tree, &Polygon->BoundingBox, NULL, mptl_pin_callback, &d, NULL); - newone = (struct polygon_st *) MovePolygonToLayerLowLevel(Layer, Polygon, Dest); + newone = (struct polygon_st *) MovePolygonToLayerLowLevel(ctx, Layer, Polygon, Dest); InitClip(PCB->Data, Dest, newone); if (Dest->On) { DrawPolygon(Dest, newone); @@ -680,11 +680,13 @@ void *MoveObject(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord DX, Coord DY) { void *result; + pcb_opctx_t ctx; + /* setup offset */ DeltaX = DX; DeltaY = DY; AddObjectToMoveUndoList(Type, Ptr1, Ptr2, Ptr3, DX, DY); - result = ObjectOperation(&MoveFunctions, Type, Ptr1, Ptr2, Ptr3); + result = ObjectOperation(&MoveFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3); return (result); } @@ -695,6 +697,7 @@ void *MoveObjectAndRubberband(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord DX, Coord DY) { RubberbandTypePtr ptr; + pcb_opctx_t ctx; void *ptr2; pcb_draw_inhibit_inc(); @@ -718,13 +721,13 @@ /* first clear any marks that we made in the line flags */ CLEAR_FLAG(PCB_FLAG_RUBBEREND, ptr->Line); AddObjectToMoveUndoList(PCB_TYPE_LINE_POINT, ptr->Layer, ptr->Line, ptr->MovedPoint, DX, DY); - MoveLinePoint(ptr->Layer, ptr->Line, ptr->MovedPoint); + MoveLinePoint(&ctx, ptr->Layer, ptr->Line, ptr->MovedPoint); Crosshair.AttachedObject.RubberbandN--; ptr++; } AddObjectToMoveUndoList(Type, Ptr1, Ptr2, Ptr3, DX, DY); - ptr2 = ObjectOperation(&MoveFunctions, Type, Ptr1, Ptr2, Ptr3); + ptr2 = ObjectOperation(&MoveFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3); IncrementUndoSerialNumber(); pcb_draw_inhibit_dec(); @@ -740,11 +743,12 @@ void *MoveObjectToLayer(int Type, void *Ptr1, void *Ptr2, void *Ptr3, LayerTypePtr Target, pcb_bool enmasse) { void *result; + pcb_opctx_t ctx; /* setup global identifiers */ Dest = Target; MoreToCome = enmasse; - result = ObjectOperation(&MoveToLayerFunctions, Type, Ptr1, Ptr2, Ptr3); + result = ObjectOperation(&MoveToLayerFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3); IncrementUndoSerialNumber(); return (result); } @@ -756,11 +760,12 @@ pcb_bool MoveSelectedObjectsToLayer(LayerTypePtr Target) { pcb_bool changed; + pcb_opctx_t ctx; /* setup global identifiers */ Dest = Target; MoreToCome = pcb_true; - changed = SelectedOperation(&MoveToLayerFunctions, pcb_true, PCB_TYPEMASK_ALL); + changed = SelectedOperation(&MoveToLayerFunctions, &ctx, pcb_true, PCB_TYPEMASK_ALL); /* passing pcb_true to above operation causes Undoserial to auto-increment */ return (changed); } Index: trunk/src/obj_arc.c =================================================================== --- trunk/src/obj_arc.c (revision 4550) +++ trunk/src/obj_arc.c (revision 4551) @@ -36,6 +36,7 @@ #include "polygon.h" #include "box.h" #include "undo.h" +#include "obj_arc.h" #include "create.h" @@ -178,7 +179,7 @@ } /* copies an arc to buffer */ -void *AddArcToBuffer(LayerTypePtr Layer, ArcTypePtr Arc) +void *AddArcToBuffer(pcb_opctx_t *ctx, LayerTypePtr Layer, ArcTypePtr Arc) { LayerTypePtr layer = &pcb_buffer_dest->Layer[GetLayerNumber(pcb_buffer_src, Layer)]; @@ -188,7 +189,7 @@ } /* moves an arc to buffer */ -void *MoveArcToBuffer(LayerType * layer, ArcType * arc) +void *MoveArcToBuffer(pcb_opctx_t *ctx, LayerType * layer, ArcType * arc) { LayerType *lay = &pcb_buffer_dest->Layer[GetLayerNumber(pcb_buffer_src, layer)]; Index: trunk/src/obj_arc.h =================================================================== --- trunk/src/obj_arc.h (revision 4550) +++ trunk/src/obj_arc.h (revision 4551) @@ -27,6 +27,7 @@ /* Drawing primitive: (elliptical) arc */ #include "global_typedefs.h" +#include "operation.h" /*** Memory ***/ ArcTypePtr GetArcMemory(LayerTypePtr); @@ -41,8 +42,8 @@ /*** Operations ***/ -void *AddArcToBuffer(LayerTypePtr Layer, ArcTypePtr Arc); -void *MoveArcToBuffer(LayerType *layer, ArcType *arc); +void *AddArcToBuffer(pcb_opctx_t *ctx, LayerTypePtr Layer, ArcTypePtr Arc); +void *MoveArcToBuffer(pcb_opctx_t *ctx, LayerType *layer, ArcType *arc); #define ARC_LOOP(element) do { \ Index: trunk/src/operation.h =================================================================== --- trunk/src/operation.h (revision 4550) +++ trunk/src/operation.h (revision 4551) @@ -25,22 +25,39 @@ * */ +#ifndef PCB_OPERATION_H +#define PCB_OPERATION_H + +#include "global_typedefs.h" #include "global_element.h" -/* ---------------------------------------------------------------------- - * pointer to low-level copy, move and rotate functions - */ typedef struct { - void *(*Line) (LayerTypePtr, LineTypePtr); - void *(*Text) (LayerTypePtr, TextTypePtr); - void *(*Polygon) (LayerTypePtr, PolygonTypePtr); - void *(*Via) (PinTypePtr); - void *(*Element) (ElementTypePtr); - void *(*ElementName) (ElementTypePtr); - void *(*Pin) (ElementTypePtr, PinTypePtr); - void *(*Pad) (ElementTypePtr, PadTypePtr); - void *(*LinePoint) (LayerTypePtr, LineTypePtr, PointTypePtr); - void *(*Point) (LayerTypePtr, PolygonTypePtr, PointTypePtr); - void *(*Arc) (LayerTypePtr, ArcTypePtr); - void *(*Rat) (RatTypePtr); -} ObjectFunctionType, *ObjectFunctionTypePtr; + PCBType *pcb; +} pcb_opctx_copy_t; + +typedef struct { + PCBType *pcb; +} pcb_opctx_move_t; + +typedef union { + pcb_opctx_copy_t copy; + pcb_opctx_move_t move; +} pcb_opctx_t; + +/* pointer to low-level operation (copy, move and rotate) functions */ +typedef struct { + void *(*Line)(pcb_opctx_t *ctx, LayerTypePtr, LineTypePtr); + void *(*Text)(pcb_opctx_t *ctx, LayerTypePtr, TextTypePtr); + void *(*Polygon)(pcb_opctx_t *ctx, LayerTypePtr, PolygonTypePtr); + void *(*Via)(pcb_opctx_t *ctx, PinTypePtr); + void *(*Element)(pcb_opctx_t *ctx, ElementTypePtr); + void *(*ElementName)(pcb_opctx_t *ctx, ElementTypePtr); + void *(*Pin)(pcb_opctx_t *ctx, ElementTypePtr, PinTypePtr); + void *(*Pad)(pcb_opctx_t *ctx, ElementTypePtr, PadTypePtr); + void *(*LinePoint)(pcb_opctx_t *ctx, LayerTypePtr, LineTypePtr, PointTypePtr); + void *(*Point)(pcb_opctx_t *ctx, LayerTypePtr, PolygonTypePtr, PointTypePtr); + void *(*Arc)(pcb_opctx_t *ctx, LayerTypePtr, ArcTypePtr); + void *(*Rat)(pcb_opctx_t *ctx, RatTypePtr); +} pcb_opfunc_t; + +#endif Index: trunk/src/remove.c =================================================================== --- trunk/src/remove.c (revision 4550) +++ trunk/src/remove.c (revision 4551) @@ -48,39 +48,45 @@ /* --------------------------------------------------------------------------- * some local prototypes */ -static void *DestroyVia(PinTypePtr); -static void *DestroyRat(RatTypePtr); -static void *DestroyLine(LayerTypePtr, LineTypePtr); -static void *DestroyArc(LayerTypePtr, ArcTypePtr); -static void *DestroyText(LayerTypePtr, TextTypePtr); -static void *DestroyPolygon(LayerTypePtr, PolygonTypePtr); -static void *DestroyElement(ElementTypePtr); -static void *RemoveVia(PinTypePtr); -static void *RemoveRat(RatTypePtr); -static void *DestroyPolygonPoint(LayerTypePtr, PolygonTypePtr, PointTypePtr); -static void *RemovePolygonContour(LayerTypePtr, PolygonTypePtr, pcb_cardinal_t); -static void *RemovePolygonPoint(LayerTypePtr, PolygonTypePtr, PointTypePtr); -static void *RemoveLinePoint(LayerTypePtr, LineTypePtr, PointTypePtr); +static void *DestroyVia(pcb_opctx_t *ctx, PinTypePtr); +static void *DestroyRat(pcb_opctx_t *ctx, RatTypePtr); +static void *DestroyLine(pcb_opctx_t *ctx, LayerTypePtr, LineTypePtr); +static void *DestroyArc(pcb_opctx_t *ctx, LayerTypePtr, ArcTypePtr); +static void *DestroyText(pcb_opctx_t *ctx, LayerTypePtr, TextTypePtr); +static void *DestroyPolygon(pcb_opctx_t *ctx, LayerTypePtr, PolygonTypePtr); +static void *DestroyElement(pcb_opctx_t *ctx, ElementTypePtr); +static void *RemoveVia(pcb_opctx_t *ctx, PinTypePtr); +static void *RemoveRat(pcb_opctx_t *ctx, RatTypePtr); +static void *DestroyPolygonPoint(pcb_opctx_t *ctx, LayerTypePtr, PolygonTypePtr, PointTypePtr); +static void *RemovePolygonContour(pcb_opctx_t *ctx, LayerTypePtr, PolygonTypePtr, pcb_cardinal_t); +static void *RemovePolygonPoint(pcb_opctx_t *ctx, LayerTypePtr, PolygonTypePtr, PointTypePtr); +static void *RemoveLinePoint(pcb_opctx_t *ctx, LayerTypePtr, LineTypePtr, PointTypePtr); +static void *RemoveElement_op(pcb_opctx_t *ctx, ElementTypePtr Element); +static void *RemoveLine_op(pcb_opctx_t *ctx, LayerTypePtr Layer, LineTypePtr Line); +static void *RemoveArc_op(pcb_opctx_t *ctx, LayerTypePtr Layer, ArcTypePtr Arc); +static void *RemoveText_op(pcb_opctx_t *ctx, LayerTypePtr Layer, TextTypePtr Text); +static void *RemovePolygon_op(pcb_opctx_t *ctx, LayerTypePtr Layer, PolygonTypePtr Polygon); + /* --------------------------------------------------------------------------- * some local types */ -static ObjectFunctionType RemoveFunctions = { - RemoveLine, - RemoveText, - RemovePolygon, +static pcb_opfunc_t RemoveFunctions = { + RemoveLine_op, + RemoveText_op, + RemovePolygon_op, RemoveVia, - RemoveElement, + RemoveElement_op, NULL, NULL, NULL, RemoveLinePoint, RemovePolygonPoint, - RemoveArc, + RemoveArc_op, RemoveRat }; -static ObjectFunctionType DestroyFunctions = { +static pcb_opfunc_t DestroyFunctions = { DestroyLine, DestroyText, DestroyPolygon, @@ -111,7 +117,7 @@ /* --------------------------------------------------------------------------- * destroys a via */ -static void *DestroyVia(PinTypePtr Via) +static void *DestroyVia(pcb_opctx_t *ctx, PinTypePtr Via) { r_delete_entry(DestroyTarget->via_tree, (BoxTypePtr) Via); free(Via->Name); @@ -123,7 +129,7 @@ /* --------------------------------------------------------------------------- * destroys a line from a layer */ -static void *DestroyLine(LayerTypePtr Layer, LineTypePtr Line) +static void *DestroyLine(pcb_opctx_t *ctx, LayerTypePtr Layer, LineTypePtr Line) { r_delete_entry(Layer->line_tree, (BoxTypePtr) Line); free(Line->Number); @@ -135,7 +141,7 @@ /* --------------------------------------------------------------------------- * destroys an arc from a layer */ -static void *DestroyArc(LayerTypePtr Layer, ArcTypePtr Arc) +static void *DestroyArc(pcb_opctx_t *ctx, LayerTypePtr Layer, ArcTypePtr Arc) { r_delete_entry(Layer->arc_tree, (BoxTypePtr) Arc); @@ -147,7 +153,7 @@ /* --------------------------------------------------------------------------- * destroys a polygon from a layer */ -static void *DestroyPolygon(LayerTypePtr Layer, PolygonTypePtr Polygon) +static void *DestroyPolygon(pcb_opctx_t *ctx, LayerTypePtr Layer, PolygonTypePtr Polygon) { r_delete_entry(Layer->polygon_tree, (BoxTypePtr) Polygon); FreePolygonMemory(Polygon); @@ -160,7 +166,7 @@ /* --------------------------------------------------------------------------- * removes a polygon-point from a polygon and destroys the data */ -static void *DestroyPolygonPoint(LayerTypePtr Layer, PolygonTypePtr Polygon, PointTypePtr Point) +static void *DestroyPolygonPoint(pcb_opctx_t *ctx, LayerTypePtr Layer, PolygonTypePtr Polygon, PointTypePtr Point) { pcb_cardinal_t point_idx; pcb_cardinal_t i; @@ -174,7 +180,7 @@ contour_points = contour_end - contour_start; if (contour_points <= 3) - return RemovePolygonContour(Layer, Polygon, contour); + return RemovePolygonContour(ctx, Layer, Polygon, contour); r_delete_entry(Layer->polygon_tree, (BoxType *) Polygon); @@ -197,7 +203,7 @@ /* --------------------------------------------------------------------------- * destroys a text from a layer */ -static void *DestroyText(LayerTypePtr Layer, TextTypePtr Text) +static void *DestroyText(pcb_opctx_t *ctx, LayerTypePtr Layer, TextTypePtr Text) { free(Text->TextString); r_delete_entry(Layer->text_tree, (BoxTypePtr) Text); @@ -210,7 +216,7 @@ /* --------------------------------------------------------------------------- * destroys a element */ -static void *DestroyElement(ElementTypePtr Element) +static void *DestroyElement(pcb_opctx_t *ctx, ElementTypePtr Element) { if (DestroyTarget->element_tree) r_delete_entry(DestroyTarget->element_tree, (BoxType *) Element); @@ -244,7 +250,7 @@ /* --------------------------------------------------------------------------- * destroys a rat */ -static void *DestroyRat(RatTypePtr Rat) +static void *DestroyRat(pcb_opctx_t *ctx, RatTypePtr Rat) { if (DestroyTarget->rat_tree) r_delete_entry(DestroyTarget->rat_tree, &Rat->BoundingBox); @@ -257,7 +263,7 @@ /* --------------------------------------------------------------------------- * removes a via */ -static void *RemoveVia(PinTypePtr Via) +static void *RemoveVia(pcb_opctx_t *ctx, PinTypePtr Via) { /* erase from screen and memory */ if (PCB->ViaOn) { @@ -272,7 +278,7 @@ /* --------------------------------------------------------------------------- * removes a rat */ -static void *RemoveRat(RatTypePtr Rat) +static void *RemoveRat(pcb_opctx_t *ctx, RatTypePtr Rat) { /* erase from screen and memory */ if (PCB->RatOn) { @@ -313,7 +319,7 @@ /* --------------------------------------------------------------------------- * removes a line point, or a line if the selected point is the end */ -static void *RemoveLinePoint(LayerTypePtr Layer, LineTypePtr Line, PointTypePtr Point) +static void *RemoveLinePoint(pcb_opctx_t *ctx, LayerTypePtr Layer, LineTypePtr Line, PointTypePtr Point) { PointType other; struct rlp_info info; @@ -325,16 +331,16 @@ info.point = Point; if (setjmp(info.env) == 0) { r_search(Layer->line_tree, (const BoxType *) Point, NULL, remove_point, &info, NULL); - return RemoveLine(Layer, Line); + return RemoveLine_op(ctx, Layer, Line); } MoveObject(PCB_TYPE_LINE_POINT, Layer, info.line, info.point, other.X - Point->X, other.Y - Point->Y); - return (RemoveLine(Layer, Line)); + return (RemoveLine_op(ctx, Layer, Line)); } /* --------------------------------------------------------------------------- * removes a line from a layer */ -void *RemoveLine(LayerTypePtr Layer, LineTypePtr Line) +static void *RemoveLine_op(pcb_opctx_t *ctx, LayerTypePtr Layer, LineTypePtr Line) { /* erase from screen */ if (Layer->On) { @@ -346,10 +352,17 @@ return NULL; } +void *RemoveLine(LayerTypePtr Layer, LineTypePtr Line) +{ + pcb_opctx_t ctx; + return RemoveLine_op(&ctx, Layer, Line); +} + + /* --------------------------------------------------------------------------- * removes an arc from a layer */ -void *RemoveArc(LayerTypePtr Layer, ArcTypePtr Arc) +static void *RemoveArc_op(pcb_opctx_t *ctx, LayerTypePtr Layer, ArcTypePtr Arc) { /* erase from screen */ if (Layer->On) { @@ -361,10 +374,17 @@ return NULL; } +void *RemoveArc(LayerTypePtr Layer, ArcTypePtr Arc) +{ + pcb_opctx_t ctx; + return RemoveArc_op(&ctx, Layer, Arc); +} + + /* --------------------------------------------------------------------------- * removes a text from a layer */ -void *RemoveText(LayerTypePtr Layer, TextTypePtr Text) +static void *RemoveText_op(pcb_opctx_t *ctx, LayerTypePtr Layer, TextTypePtr Text) { /* erase from screen */ if (Layer->On) { @@ -376,10 +396,16 @@ return NULL; } +void *RemoveText(LayerTypePtr Layer, TextTypePtr Text) +{ + pcb_opctx_t ctx; + return RemoveText_op(&ctx, Layer, Text); +} + /* --------------------------------------------------------------------------- * removes a polygon from a layer */ -void *RemovePolygon(LayerTypePtr Layer, PolygonTypePtr Polygon) +static void *RemovePolygon_op(pcb_opctx_t *ctx, LayerTypePtr Layer, PolygonTypePtr Polygon) { /* erase from screen */ if (Layer->On) { @@ -391,11 +417,17 @@ return NULL; } +void *RemovePolygon(LayerTypePtr Layer, PolygonTypePtr Polygon) +{ + pcb_opctx_t ctx; + return RemovePolygon_op(&ctx, Layer, Polygon); +} + /* --------------------------------------------------------------------------- * removes a contour from a polygon. * If removing the outer contour, it removes the whole polygon. */ -static void *RemovePolygonContour(LayerTypePtr Layer, PolygonTypePtr Polygon, pcb_cardinal_t contour) +static void *RemovePolygonContour(pcb_opctx_t *ctx, LayerTypePtr Layer, PolygonTypePtr Polygon, pcb_cardinal_t contour) { pcb_cardinal_t contour_start, contour_end, contour_points; pcb_cardinal_t i; @@ -439,7 +471,7 @@ /* --------------------------------------------------------------------------- * removes a polygon-point from a polygon */ -static void *RemovePolygonPoint(LayerTypePtr Layer, PolygonTypePtr Polygon, PointTypePtr Point) +static void *RemovePolygonPoint(pcb_opctx_t *ctx, LayerTypePtr Layer, PolygonTypePtr Polygon, PointTypePtr Point) { pcb_cardinal_t point_idx; pcb_cardinal_t i; @@ -453,7 +485,7 @@ contour_points = contour_end - contour_start; if (contour_points <= 3) - return RemovePolygonContour(Layer, Polygon, contour); + return RemovePolygonContour(ctx, Layer, Polygon, contour); if (Layer->On) ErasePolygon(Polygon); @@ -489,7 +521,7 @@ /* --------------------------------------------------------------------------- * removes an element */ -void *RemoveElement(ElementTypePtr Element) +static void *RemoveElement_op(pcb_opctx_t *ctx, ElementTypePtr Element) { /* erase from screen */ if ((PCB->ElementOn || PCB->PinOn) && (FRONT(Element) || PCB->InvisibleObjectsOn)) { @@ -501,6 +533,12 @@ return NULL; } +void *RemoveElement(ElementTypePtr Element) +{ + pcb_opctx_t ctx; + return RemoveElement_op(&ctx, Element); +} + /* ---------------------------------------------------------------------- * removes all selected and visible objects * returns pcb_true if any objects have been removed @@ -507,8 +545,9 @@ */ pcb_bool RemoveSelected(void) { + pcb_opctx_t ctx; Bulk = pcb_true; - if (SelectedOperation(&RemoveFunctions, pcb_false, PCB_TYPEMASK_ALL)) { + if (SelectedOperation(&RemoveFunctions, &ctx, pcb_false, PCB_TYPEMASK_ALL)) { IncrementUndoSerialNumber(); Draw(); Bulk = pcb_false; @@ -524,7 +563,8 @@ */ void *RemoveObject(int Type, void *Ptr1, void *Ptr2, void *Ptr3) { - void *ptr = ObjectOperation(&RemoveFunctions, Type, Ptr1, Ptr2, Ptr3); + pcb_opctx_t ctx; + void *ptr = ObjectOperation(&RemoveFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3); return (ptr); } @@ -535,6 +575,7 @@ pcb_bool DeleteRats(pcb_bool selected) { + pcb_opctx_t ctx; pcb_bool changed = pcb_false; Bulk = pcb_true; RAT_LOOP(PCB->Data); @@ -541,7 +582,7 @@ { if ((!selected) || TEST_FLAG(PCB_FLAG_SELECTED, line)) { changed = pcb_true; - RemoveRat(line); + RemoveRat(&ctx, line); } } END_LOOP; @@ -559,6 +600,7 @@ */ void *DestroyObject(DataTypePtr Target, int Type, void *Ptr1, void *Ptr2, void *Ptr3) { + pcb_opctx_t ctx; DestroyTarget = Target; - return (ObjectOperation(&DestroyFunctions, Type, Ptr1, Ptr2, Ptr3)); + return (ObjectOperation(&DestroyFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3)); } Index: trunk/src/rotate.c =================================================================== --- trunk/src/rotate.c (revision 4550) +++ trunk/src/rotate.c (revision 4551) @@ -52,11 +52,11 @@ /* --------------------------------------------------------------------------- * some local prototypes */ -static void *RotateText(LayerTypePtr, TextTypePtr); -static void *RotateArc(LayerTypePtr, ArcTypePtr); -static void *RotateElement(ElementTypePtr); -static void *RotateElementName(ElementTypePtr); -static void *RotateLinePoint(LayerTypePtr, LineTypePtr, PointTypePtr); +static void *RotateText(pcb_opctx_t *ctx, LayerTypePtr, TextTypePtr); +static void *RotateArc(pcb_opctx_t *ctx, LayerTypePtr, ArcTypePtr); +static void *RotateElement(pcb_opctx_t *ctx, ElementTypePtr); +static void *RotateElementName(pcb_opctx_t *ctx, ElementTypePtr); +static void *RotateLinePoint(pcb_opctx_t *ctx, LayerTypePtr, LineTypePtr, PointTypePtr); /* ---------------------------------------------------------------------- * some local identifiers @@ -63,7 +63,7 @@ */ static Coord CenterX, CenterY; /* center of rotation */ static unsigned Number; /* number of rotations */ -static ObjectFunctionType RotateFunctions = { +static pcb_opfunc_t RotateFunctions = { NULL, RotateText, NULL, @@ -150,7 +150,7 @@ /* --------------------------------------------------------------------------- * rotates a text object and redraws it */ -static void *RotateText(LayerTypePtr Layer, TextTypePtr Text) +static void *RotateText(pcb_opctx_t *ctx, LayerTypePtr Layer, TextTypePtr Text) { EraseText(Layer, Text); RestoreToPolygon(PCB->Data, PCB_TYPE_TEXT, Layer, Text); @@ -237,7 +237,7 @@ /* --------------------------------------------------------------------------- * rotates a line's point */ -static void *RotateLinePoint(LayerTypePtr Layer, LineTypePtr Line, PointTypePtr Point) +static void *RotateLinePoint(pcb_opctx_t *ctx, LayerTypePtr Layer, LineTypePtr Line, PointTypePtr Point) { EraseLine(Line); if (Layer) { @@ -264,7 +264,7 @@ /* --------------------------------------------------------------------------- * rotates an arc */ -static void *RotateArc(LayerTypePtr Layer, ArcTypePtr Arc) +static void *RotateArc(pcb_opctx_t *ctx, LayerTypePtr Layer, ArcTypePtr Arc) { EraseArc(Arc); r_delete_entry(Layer->arc_tree, (BoxTypePtr) Arc); @@ -278,7 +278,7 @@ /* --------------------------------------------------------------------------- * rotates an element */ -static void *RotateElement(ElementTypePtr Element) +static void *RotateElement(pcb_opctx_t *ctx, ElementTypePtr Element) { EraseElement(Element); RotateElementLowLevel(PCB->Data, Element, CenterX, CenterY, Number); @@ -290,7 +290,7 @@ /* ---------------------------------------------------------------------- * rotates the name of an element */ -static void *RotateElementName(ElementTypePtr Element) +static void *RotateElementName(pcb_opctx_t *ctx, ElementTypePtr Element) { EraseElementName(Element); ELEMENTTEXT_LOOP(Element); @@ -329,6 +329,7 @@ RubberbandTypePtr ptr; void *ptr2; pcb_bool changed = pcb_false; + pcb_opctx_t ctx; /* setup default global identifiers */ Number = Steps; @@ -363,7 +364,7 @@ ptr++; } AddObjectToRotateUndoList(Type, Ptr1, Ptr2, Ptr3, CenterX, CenterY, Number); - ptr2 = ObjectOperation(&RotateFunctions, Type, Ptr1, Ptr2, Ptr3); + ptr2 = ObjectOperation(&RotateFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3); changed |= (ptr2 != NULL); if (changed) { Draw(); Index: trunk/src/select.c =================================================================== --- trunk/src/select.c (revision 4550) +++ trunk/src/select.c (revision 4551) @@ -438,67 +438,68 @@ /* ---------------------------------------------------------------------- * performs several operations on the passed object */ -void *ObjectOperation(ObjectFunctionTypePtr F, int Type, void *Ptr1, void *Ptr2, void *Ptr3) +#warning TODO: maybe move this to operation.c +void *ObjectOperation(pcb_opfunc_t *F, pcb_opctx_t *ctx, int Type, void *Ptr1, void *Ptr2, void *Ptr3) { switch (Type) { case PCB_TYPE_LINE: if (F->Line) - return (F->Line((LayerTypePtr) Ptr1, (LineTypePtr) Ptr2)); + return (F->Line(ctx, (LayerTypePtr) Ptr1, (LineTypePtr) Ptr2)); break; case PCB_TYPE_ARC: if (F->Arc) - return (F->Arc((LayerTypePtr) Ptr1, (ArcTypePtr) Ptr2)); + return (F->Arc(ctx, (LayerTypePtr) Ptr1, (ArcTypePtr) Ptr2)); break; case PCB_TYPE_LINE_POINT: if (F->LinePoint) - return (F->LinePoint((LayerTypePtr) Ptr1, (LineTypePtr) Ptr2, (PointTypePtr) Ptr3)); + return (F->LinePoint(ctx, (LayerTypePtr) Ptr1, (LineTypePtr) Ptr2, (PointTypePtr) Ptr3)); break; case PCB_TYPE_TEXT: if (F->Text) - return (F->Text((LayerTypePtr) Ptr1, (TextTypePtr) Ptr2)); + return (F->Text(ctx, (LayerTypePtr) Ptr1, (TextTypePtr) Ptr2)); break; case PCB_TYPE_POLYGON: if (F->Polygon) - return (F->Polygon((LayerTypePtr) Ptr1, (PolygonTypePtr) Ptr2)); + return (F->Polygon(ctx, (LayerTypePtr) Ptr1, (PolygonTypePtr) Ptr2)); break; case PCB_TYPE_POLYGON_POINT: if (F->Point) - return (F->Point((LayerTypePtr) Ptr1, (PolygonTypePtr) Ptr2, (PointTypePtr) Ptr3)); + return (F->Point(ctx, (LayerTypePtr) Ptr1, (PolygonTypePtr) Ptr2, (PointTypePtr) Ptr3)); break; case PCB_TYPE_VIA: if (F->Via) - return (F->Via((PinTypePtr) Ptr1)); + return (F->Via(ctx, (PinTypePtr) Ptr1)); break; case PCB_TYPE_ELEMENT: if (F->Element) - return (F->Element((ElementTypePtr) Ptr1)); + return (F->Element(ctx, (ElementTypePtr) Ptr1)); break; case PCB_TYPE_PIN: if (F->Pin) - return (F->Pin((ElementTypePtr) Ptr1, (PinTypePtr) Ptr2)); + return (F->Pin(ctx, (ElementTypePtr) Ptr1, (PinTypePtr) Ptr2)); break; case PCB_TYPE_PAD: if (F->Pad) - return (F->Pad((ElementTypePtr) Ptr1, (PadTypePtr) Ptr2)); + return (F->Pad(ctx, (ElementTypePtr) Ptr1, (PadTypePtr) Ptr2)); break; case PCB_TYPE_ELEMENT_NAME: if (F->ElementName) - return (F->ElementName((ElementTypePtr) Ptr1)); + return (F->ElementName(ctx, (ElementTypePtr) Ptr1)); break; case PCB_TYPE_RATLINE: if (F->Rat) - return (F->Rat((RatTypePtr) Ptr1)); + return (F->Rat(ctx, (RatTypePtr) Ptr1)); break; } return (NULL); @@ -510,7 +511,7 @@ * resets the selected flag if requested * returns pcb_true if anything has changed */ -pcb_bool SelectedOperation(ObjectFunctionTypePtr F, pcb_bool Reset, int type) +pcb_bool SelectedOperation(pcb_opfunc_t *F, pcb_opctx_t *ctx, pcb_bool Reset, int type) { pcb_bool changed = pcb_false; @@ -523,7 +524,7 @@ AddObjectToFlagUndoList(PCB_TYPE_LINE, layer, line, line); CLEAR_FLAG(PCB_FLAG_SELECTED, line); } - F->Line(layer, line); + F->Line(ctx, layer, line); changed = pcb_true; } } @@ -538,7 +539,7 @@ AddObjectToFlagUndoList(PCB_TYPE_ARC, layer, arc, arc); CLEAR_FLAG(PCB_FLAG_SELECTED, arc); } - F->Arc(layer, arc); + F->Arc(ctx, layer, arc); changed = pcb_true; } } @@ -553,7 +554,7 @@ AddObjectToFlagUndoList(PCB_TYPE_TEXT, layer, text, text); CLEAR_FLAG(PCB_FLAG_SELECTED, text); } - F->Text(layer, text); + F->Text(ctx, layer, text); changed = pcb_true; } } @@ -568,7 +569,7 @@ AddObjectToFlagUndoList(PCB_TYPE_POLYGON, layer, polygon, polygon); CLEAR_FLAG(PCB_FLAG_SELECTED, polygon); } - F->Polygon(layer, polygon); + F->Polygon(ctx, layer, polygon); changed = pcb_true; } } @@ -583,7 +584,7 @@ AddObjectToFlagUndoList(PCB_TYPE_ELEMENT, element, element, element); CLEAR_FLAG(PCB_FLAG_SELECTED, element); } - F->Element(element); + F->Element(ctx, element); changed = pcb_true; } } @@ -596,7 +597,7 @@ AddObjectToFlagUndoList(PCB_TYPE_ELEMENT_NAME, element, &ELEMENT_TEXT(PCB, element), &ELEMENT_TEXT(PCB, element)); CLEAR_FLAG(PCB_FLAG_SELECTED, &ELEMENT_TEXT(PCB, element)); } - F->ElementName(element); + F->ElementName(ctx, element); changed = pcb_true; } } @@ -612,7 +613,7 @@ AddObjectToFlagUndoList(PCB_TYPE_PIN, element, pin, pin); CLEAR_FLAG(PCB_FLAG_SELECTED, pin); } - F->Pin(element, pin); + F->Pin(ctx, element, pin); changed = pcb_true; } } @@ -630,7 +631,7 @@ AddObjectToFlagUndoList(PCB_TYPE_PAD, element, pad, pad); CLEAR_FLAG(PCB_FLAG_SELECTED, pad); } - F->Pad(element, pad); + F->Pad(ctx, element, pad); changed = pcb_true; } } @@ -647,7 +648,7 @@ AddObjectToFlagUndoList(PCB_TYPE_VIA, via, via, via); CLEAR_FLAG(PCB_FLAG_SELECTED, via); } - F->Via(via); + F->Via(ctx, via); changed = pcb_true; } } @@ -661,7 +662,7 @@ AddObjectToFlagUndoList(PCB_TYPE_RATLINE, line, line, line); CLEAR_FLAG(PCB_FLAG_SELECTED, line); } - F->Rat(line); + F->Rat(ctx, line); changed = pcb_true; } } Index: trunk/src/select.h =================================================================== --- trunk/src/select.h (revision 4550) +++ trunk/src/select.h (revision 4551) @@ -39,10 +39,13 @@ pcb_bool SelectObject(void); pcb_bool SelectBlock(BoxTypePtr, pcb_bool); long int *ListBlock(BoxTypePtr Box, int *len); -pcb_bool SelectedOperation(ObjectFunctionTypePtr, pcb_bool, int); -void *ObjectOperation(ObjectFunctionTypePtr, int, void *, void *, void *); + +void *ObjectOperation(pcb_opfunc_t *F, pcb_opctx_t *ctx, int Type, void *Ptr1, void *Ptr2, void *Ptr3); +pcb_bool SelectedOperation(pcb_opfunc_t *F, pcb_opctx_t *ctx, pcb_bool Reset, int type); + pcb_bool SelectConnection(pcb_bool); + typedef enum { SM_REGEX = 0, SM_LIST = 1