/* --------------------------------------------------------------------------- * copies a via to paste buffer */ static void * AddViaToBuffer (PinType *Via) { return (CreateNewVia (Dest, Via->X, Via->Y, Via->Thickness, Via->Clearance, Via->Mask, Via->DrillingHole, Via->Name, MaskFlags (Via->Flags, NOCOPY_FLAGS | ExtraFlag))); }
/* --------------------------------------------------------------------------- * copies a via */ static void * CopyVia (PinType *Via) { PinType *via; via = CreateNewVia (PCB->Data, Via->X + DeltaX, Via->Y + DeltaY, Via->Thickness, Via->Clearance, Via->Mask, Via->DrillingHole, Via->Name, MaskFlags (Via->Flags, NOCOPY_FLAGS)); if (!via) return (via); DrawVia (via); AddObjectToCreateUndoList (VIA_TYPE, via, via, via); return (via); }
static int moveline_callback (const BoxType * b, void *cl) { struct via_info *i = (struct via_info *) cl; PinTypePtr via; if ((via = CreateNewVia (PCB->Data, i->X, i->Y, Settings.ViaThickness, 2 * Settings.Keepaway, NOFLAG, Settings.ViaDrillingHole, NULL, NoFlags ())) != NULL) { AddObjectToCreateUndoList (VIA_TYPE, via, via, via); DrawVia (via); } longjmp (i->env, 1); }
/*--------------------------------------------------------------------------- * * break buffer element into pieces */ bool SmashBufferElement (BufferType *Buffer) { ElementType *element; Cardinal group; LayerType *clayer, *slayer; if (Buffer->Data->ElementN != 1) { Message (_("Error! Buffer doesn't contain a single element\n")); return (false); } /* * At this point the buffer should contain just a single element. * Now we detach the single element from the buffer and then clear the * buffer, ready to receive the smashed elements. As a result of detaching * it the single element is orphaned from the buffer and thus will not be * free()'d by FreeDataMemory (called via ClearBuffer). This leaves it * around for us to smash bits off it. It then becomes our responsibility, * however, to free the single element when we're finished with it. */ element = Buffer->Data->Element->data; Buffer->Data->Element = NULL; Buffer->Data->ElementN = 0; ClearBuffer (Buffer); ELEMENTLINE_LOOP (element); { CreateNewLineOnLayer (&Buffer->Data->SILKLAYER, line->Point1.X, line->Point1.Y, line->Point2.X, line->Point2.Y, line->Thickness, 0, NoFlags ()); if (line) line->Number = STRDUP (NAMEONPCB_NAME (element)); } END_LOOP; ARC_LOOP (element); { CreateNewArcOnLayer (&Buffer->Data->SILKLAYER, arc->X, arc->Y, arc->Width, arc->Height, arc->StartAngle, arc->Delta, arc->Thickness, 0, NoFlags ()); } END_LOOP; PIN_LOOP (element); { FlagType f = NoFlags (); AddFlags (f, VIAFLAG); if (TEST_FLAG (HOLEFLAG, pin)) AddFlags (f, HOLEFLAG); CreateNewVia (Buffer->Data, pin->X, pin->Y, pin->Thickness, pin->Clearance, pin->Mask, pin->DrillingHole, pin->Number, f); } END_LOOP; group = GetLayerGroupNumberByNumber (SWAP_IDENT ? solder_silk_layer : component_silk_layer); clayer = &Buffer->Data->Layer[PCB->LayerGroups.Entries[group][0]]; group = GetLayerGroupNumberByNumber (SWAP_IDENT ? component_silk_layer : solder_silk_layer); slayer = &Buffer->Data->Layer[PCB->LayerGroups.Entries[group][0]]; PAD_LOOP (element); { LineType *line; line = CreateNewLineOnLayer (TEST_FLAG (ONSOLDERFLAG, pad) ? slayer : clayer, pad->Point1.X, pad->Point1.Y, pad->Point2.X, pad->Point2.Y, pad->Thickness, pad->Clearance, NoFlags ()); if (line) line->Number = STRDUP (pad->Number); } END_LOOP; FreeElementMemory (element); g_slice_free (ElementType, element); return (true); }