/*----------------------------------------------------------- * Draws the outline of an arc */ static void XORDrawAttachedArc (BDimension thick) { ArcType arc; BoxTypePtr bx; LocationType wx, wy; int sa, dir; BDimension wid = thick / 2; wx = Crosshair.X - Crosshair.AttachedBox.Point1.X; wy = Crosshair.Y - Crosshair.AttachedBox.Point1.Y; if (wx == 0 && wy == 0) return; arc.X = Crosshair.AttachedBox.Point1.X; arc.Y = Crosshair.AttachedBox.Point1.Y; if (XOR (Crosshair.AttachedBox.otherway, abs (wy) > abs (wx))) { arc.X = Crosshair.AttachedBox.Point1.X + abs (wy) * SGNZ (wx); sa = (wx >= 0) ? 0 : 180; #ifdef ARC45 if (abs (wy) >= 2 * abs (wx)) dir = (SGNZ (wx) == SGNZ (wy)) ? 45 : -45; else #endif dir = (SGNZ (wx) == SGNZ (wy)) ? 90 : -90; } else { arc.Y = Crosshair.AttachedBox.Point1.Y + abs (wx) * SGNZ (wy); sa = (wy >= 0) ? -90 : 90; #ifdef ARC45 if (abs (wx) >= 2 * abs (wy)) dir = (SGNZ (wx) == SGNZ (wy)) ? -45 : 45; else #endif dir = (SGNZ (wx) == SGNZ (wy)) ? -90 : 90; wy = wx; } wy = abs (wy); arc.StartAngle = sa; arc.Delta = dir; arc.Width = arc.Height = wy; bx = GetArcEnds (&arc); /* sa = sa - 180; */ gui->draw_arc (Crosshair.GC, arc.X, arc.Y, wy + wid, wy + wid, sa, dir); if (wid > pixel_slop) { gui->draw_arc (Crosshair.GC, arc.X, arc.Y, wy - wid, wy - wid, sa, dir); gui->draw_arc (Crosshair.GC, bx->X1, bx->Y1, wid, wid, sa, -180 * SGN (dir)); gui->draw_arc (Crosshair.GC, bx->X2, bx->Y2, wid, wid, sa + dir, 180 * SGN (dir)); } }
static int ReportDialog (int argc, char **argv, Coord x, Coord y) { void *ptr1, *ptr2, *ptr3; int type; char report[2048]; type = SearchScreen (x, y, REPORT_TYPES, &ptr1, &ptr2, &ptr3); if (type == NO_TYPE) type = SearchScreen (x, y, REPORT_TYPES | LOCKED_TYPE, &ptr1, &ptr2, &ptr3); switch (type) { case VIA_TYPE: { PinType *via; #ifndef NDEBUG if (gui->shift_is_pressed ()) { __r_dump_tree (PCB->Data->via_tree->root, 0); return 0; } #endif via = (PinType *) ptr2; if (TEST_FLAG (HOLEFLAG, via)) pcb_snprintf (report, sizeof (report), _("%m+VIA ID# %ld; Flags:%s\n" "(X,Y) = %$mD.\n" "It is a pure hole of diameter %$mS.\n" "Name = \"%s\"." "%s"), USER_UNITMASK, via->ID, flags_to_string (via->Flags, VIA_TYPE), via->X, via->Y, via->DrillingHole, EMPTY (via->Name), TEST_FLAG (LOCKFLAG, via) ? _("It is LOCKED.\n") : ""); else pcb_snprintf (report, sizeof (report), _("%m+VIA ID# %ld; Flags:%s\n" "(X,Y) = %$mD.\n" "Copper width = %$mS. Drill width = %$mS.\n" "Clearance width in polygons = %$mS.\n" "Annulus = %$mS.\n" "Solder mask hole = %$mS (gap = %$mS).\n" "Name = \"%s\"." "%s"), USER_UNITMASK, via->ID, flags_to_string (via->Flags, VIA_TYPE), via->X, via->Y, via->Thickness, via->DrillingHole, via->Clearance / 2, (via->Thickness - via->DrillingHole) / 2, via->Mask, (via->Mask - via->Thickness) / 2, EMPTY (via->Name), TEST_FLAG (LOCKFLAG, via) ? _("It is LOCKED.\n") : ""); break; } case PIN_TYPE: { PinType *Pin; ElementType *element; #ifndef NDEBUG if (gui->shift_is_pressed ()) { __r_dump_tree (PCB->Data->pin_tree->root, 0); return 0; } #endif Pin = (PinType *) ptr2; element = (ElementType *) ptr1; PIN_LOOP (element); { if (pin == Pin) break; } END_LOOP; if (TEST_FLAG (HOLEFLAG, Pin)) pcb_snprintf (report, sizeof (report), _("%m+PIN ID# %ld; Flags:%s\n" "(X,Y) = %$mD.\n" "It is a mounting hole. Drill width = %$mS.\n" "It is owned by element %$mS.\n" "%s"), USER_UNITMASK, Pin->ID, flags_to_string (Pin->Flags, PIN_TYPE), Pin->X, Pin->Y, Pin->DrillingHole, EMPTY (element->Name[1].TextString), TEST_FLAG (LOCKFLAG, Pin) ? _("It is LOCKED.\n") : ""); else pcb_snprintf (report, sizeof (report), _("%m+PIN ID# %ld; Flags:%s\n" "(X,Y) = %$mD.\n" "Copper width = %$mS. Drill width = %$mS.\n" "Clearance width to Polygon = %$mS.\n" "Annulus = %$mS.\n" "Solder mask hole = %$mS (gap = %$mS).\n" "Name = \"%s\".\n" "It is owned by element %s\n as pin number %s.\n" "%s"), USER_UNITMASK, Pin->ID, flags_to_string (Pin->Flags, PIN_TYPE), Pin->X, Pin->Y, Pin->Thickness, Pin->DrillingHole, Pin->Clearance / 2, (Pin->Thickness - Pin->DrillingHole) / 2, Pin->Mask, (Pin->Mask - Pin->Thickness) / 2, EMPTY (Pin->Name), EMPTY (element->Name[1].TextString), EMPTY (Pin->Number), TEST_FLAG (LOCKFLAG, Pin) ? _("It is LOCKED.\n") : ""); break; } case LINE_TYPE: { LineType *line; #ifndef NDEBUG if (gui->shift_is_pressed ()) { LayerType *layer = (LayerType *) ptr1; __r_dump_tree (layer->line_tree->root, 0); return 0; } #endif line = (LineType *) ptr2; pcb_snprintf (report, sizeof (report), _("%m+LINE ID# %ld; Flags:%s\n" "FirstPoint(X,Y) = %$mD, ID = %ld.\n" "SecondPoint(X,Y) = %$mD, ID = %ld.\n" "Width = %$mS.\nClearance width in polygons = %$mS.\n" "It is on layer %d\n" "and has name \"%s\".\n" "%s"), USER_UNITMASK, line->ID, flags_to_string (line->Flags, LINE_TYPE), line->Point1.X, line->Point1.Y, line->Point1.ID, line->Point2.X, line->Point2.Y, line->Point2.ID, line->Thickness, line->Clearance / 2, GetLayerNumber (PCB->Data, (LayerType *) ptr1), UNKNOWN (line->Number), TEST_FLAG (LOCKFLAG, line) ? _("It is LOCKED.\n") : ""); break; } case RATLINE_TYPE: { RatType *line; #ifndef NDEBUG if (gui->shift_is_pressed ()) { __r_dump_tree (PCB->Data->rat_tree->root, 0); return 0; } #endif line = (RatType *) ptr2; pcb_snprintf (report, sizeof (report), _("%m+RAT-LINE ID# %ld; Flags:%s\n" "FirstPoint(X,Y) = %$mD; ID = %ld; " "connects to layer group %d.\n" "SecondPoint(X,Y) = %$mD; ID = %ld; " "connects to layer group %d.\n"), USER_UNITMASK, line->ID, flags_to_string (line->Flags, LINE_TYPE), line->Point1.X, line->Point1.Y, line->Point1.ID, line->group1, line->Point2.X, line->Point2.Y, line->Point2.ID, line->group2); break; } case ARC_TYPE: { ArcType *Arc; BoxType *box; #ifndef NDEBUG if (gui->shift_is_pressed ()) { LayerType *layer = (LayerType *) ptr1; __r_dump_tree (layer->arc_tree->root, 0); return 0; } #endif Arc = (ArcType *) ptr2; box = GetArcEnds (Arc); pcb_snprintf (report, sizeof (report), _("%m+ARC ID# %ld; Flags:%s\n" "CenterPoint(X,Y) = %$mD.\n" "Radius = %$mS, Thickness = %$mS.\n" "Clearance width in polygons = %$mS.\n" "StartAngle = %ma degrees, DeltaAngle = %ma degrees.\n" "Bounding Box is %$mD, %$mD.\n" "That makes the end points at %$mD and %$mD.\n" "It is on layer %d.\n" "%s"), USER_UNITMASK, Arc->ID, flags_to_string (Arc->Flags, ARC_TYPE), Arc->X, Arc->Y, Arc->Width, Arc->Thickness, Arc->Clearance / 2, Arc->StartAngle, Arc->Delta, Arc->BoundingBox.X1, Arc->BoundingBox.Y1, Arc->BoundingBox.X2, Arc->BoundingBox.Y2, box->X1, box->Y1, box->X2, box->Y2, GetLayerNumber (PCB->Data, (LayerType *) ptr1), TEST_FLAG (LOCKFLAG, Arc) ? _("It is LOCKED.\n") : ""); break; } case POLYGON_TYPE: { PolygonType *Polygon; #ifndef NDEBUG if (gui->shift_is_pressed ()) { LayerType *layer = (LayerType *) ptr1; __r_dump_tree (layer->polygon_tree->root, 0); return 0; } #endif Polygon = (PolygonType *) ptr2; pcb_snprintf (report, sizeof (report), _("%m+POLYGON ID# %ld; Flags:%s\n" "Its bounding box is %$mD %$mD.\n" "It has %d points and could store %d more\n" " without using more memory.\n" "It has %d holes and resides on layer %d.\n" "%s"), USER_UNITMASK, Polygon->ID, flags_to_string (Polygon->Flags, POLYGON_TYPE), Polygon->BoundingBox.X1, Polygon->BoundingBox.Y1, Polygon->BoundingBox.X2, Polygon->BoundingBox.Y2, Polygon->PointN, Polygon->PointMax - Polygon->PointN, Polygon->HoleIndexN, GetLayerNumber (PCB->Data, (LayerType *) ptr1), TEST_FLAG (LOCKFLAG, Polygon) ? _("It is LOCKED.\n") : ""); break; } case PAD_TYPE: { Coord len; PadType *Pad; ElementType *element; #ifndef NDEBUG if (gui->shift_is_pressed ()) { __r_dump_tree (PCB->Data->pad_tree->root, 0); return 0; } #endif Pad = (PadType *) ptr2; element = (ElementType *) ptr1; PAD_LOOP (element); { { if (pad == Pad) break; } } END_LOOP; len = Distance (Pad->Point1.X, Pad->Point1.Y, Pad->Point2.X, Pad->Point2.Y); pcb_snprintf (report, sizeof (report), _("%m+PAD ID# %ld; Flags:%s\n" "FirstPoint(X,Y) = %$mD; ID = %ld.\n" "SecondPoint(X,Y) = %$mD; ID = %ld.\n" "Width = %$mS. Length = %$mS.\n" "Clearance width in polygons = %$mS.\n" "Solder mask = %$mS x %$mS (gap = %$mS).\n" "Name = \"%s\".\n" "It is owned by SMD element %s\n" " as pin number %s and is on the %s\n" "side of the board.\n" "%s"), USER_UNITMASK, Pad->ID, flags_to_string (Pad->Flags, PAD_TYPE), Pad->Point1.X, Pad->Point1.Y, Pad->Point1.ID, Pad->Point2.X, Pad->Point2.Y, Pad->Point2.ID, Pad->Thickness, len + Pad->Thickness, Pad->Clearance / 2, Pad->Mask, len + Pad->Mask, (Pad->Mask - Pad->Thickness) / 2, EMPTY (Pad->Name), EMPTY (element->Name[1].TextString), EMPTY (Pad->Number), TEST_FLAG (ONSOLDERFLAG, Pad) ? _("solder (bottom)") : _("component"), TEST_FLAG (LOCKFLAG, Pad) ? _("It is LOCKED.\n") : ""); break; } case ELEMENT_TYPE: { ElementType *element; #ifndef NDEBUG if (gui->shift_is_pressed ()) { __r_dump_tree (PCB->Data->element_tree->root, 0); return 0; } #endif element = (ElementType *) ptr2; pcb_snprintf (report, sizeof (report), _("%m+ELEMENT ID# %ld; Flags:%s\n" "BoundingBox %$mD %$mD.\n" "Descriptive Name \"%s\".\n" "Name on board \"%s\".\n" "Part number name \"%s\".\n" "It is %$mS tall and is located at (X,Y) = %$mD %s.\n" "Mark located at point (X,Y) = %$mD.\n" "It is on the %s side of the board.\n" "%s"), USER_UNITMASK, element->ID, flags_to_string (element->Flags, ELEMENT_TYPE), element->BoundingBox.X1, element->BoundingBox.Y1, element->BoundingBox.X2, element->BoundingBox.Y2, EMPTY (element->Name[0].TextString), EMPTY (element->Name[1].TextString), EMPTY (element->Name[2].TextString), SCALE_TEXT (FONT_CAPHEIGHT, element->Name[1].Scale), element->Name[1].X, element->Name[1].Y, TEST_FLAG (HIDENAMEFLAG, element) ? _(",\n but it's hidden") : "", element->MarkX, element->MarkY, TEST_FLAG (ONSOLDERFLAG, element) ? _("solder (bottom)") : _("component"), TEST_FLAG (LOCKFLAG, element) ? _("It is LOCKED.\n") : ""); break; } case TEXT_TYPE: #ifndef NDEBUG if (gui->shift_is_pressed ()) { LayerType *layer = (LayerType *) ptr1; __r_dump_tree (layer->text_tree->root, 0); return 0; } #endif case ELEMENTNAME_TYPE: { char laynum[32]; TextType *text; #ifndef NDEBUG if (gui->shift_is_pressed ()) { __r_dump_tree (PCB->Data->name_tree[NAME_INDEX (PCB)]->root, 0); return 0; } #endif text = (TextType *) ptr2; if (type == TEXT_TYPE) sprintf (laynum, _("It is on layer %d."), GetLayerNumber (PCB->Data, (LayerType *) ptr1)); pcb_snprintf (report, sizeof (report), _("%m+TEXT ID# %ld; Flags:%s\n" "Located at (X,Y) = %$mD.\n" "Characters are %$mS tall.\n" "Value is \"%s\".\n" "Direction is %d.\n" "The bounding box is %$mD %$mD.\n" "%s\n" "%s"), USER_UNITMASK, text->ID, flags_to_string (text->Flags, TEXT_TYPE), text->X, text->Y, SCALE_TEXT (FONT_CAPHEIGHT, text->Scale), text->TextString, text->Direction, text->BoundingBox.X1, text->BoundingBox.Y1, text->BoundingBox.X2, text->BoundingBox.Y2, (type == TEXT_TYPE) ? laynum : _("It is an element name."), TEST_FLAG (LOCKFLAG, text) ? _("It is LOCKED.\n") : ""); break; } case LINEPOINT_TYPE: case POLYGONPOINT_TYPE: { PointType *point = (PointType *) ptr2; pcb_snprintf (report, sizeof (report), _("%m+POINT ID# %ld.\n" "Located at (X,Y) = %$mD.\n" "It belongs to a %s on layer %d.\n"), USER_UNITMASK, point->ID, point->X, point->Y, (type == LINEPOINT_TYPE) ? C_("report", "line") : C_("report", "polygon"), GetLayerNumber (PCB->Data, (LayerType *) ptr1)); break; } case NO_TYPE: report[0] = '\0'; break; default: sprintf (report, _("Unknown\n")); break; } if (report[0] == '\0') { Message (_("Nothing found to report on\n")); return 1; } /* create dialog box */ gui->report_dialog (_("Report"), report); return 0; }
static int ReportDialog (int argc, char **argv, int x, int y) { void *ptr1, *ptr2, *ptr3; int type, prec = Settings.grid_units_mm? 4: 2; char report[2048]; type = SearchScreen (x, y, REPORT_TYPES, &ptr1, &ptr2, &ptr3); if (type == NO_TYPE) type = SearchScreen (x, y, REPORT_TYPES | LOCKED_TYPE, &ptr1, &ptr2, &ptr3); switch (type) { case VIA_TYPE: { PinTypePtr via; #ifndef NDEBUG if (gui->shift_is_pressed ()) { __r_dump_tree (PCB->Data->via_tree->root, 0); return 0; } #endif via = (PinTypePtr) ptr2; if (TEST_FLAG (HOLEFLAG, via)) sprintf (&report[0], "VIA ID# %ld; Flags:%s\n" "(X,Y) = (%.*f, %.*f) %s.\n" "It is a pure hole of diameter %.*f %s.\n" "Name = \"%s\"." "%s", via->ID, flags_to_string (via->Flags, VIA_TYPE), prec, units (via->X), prec, UNIT (via->Y), prec, UNIT (via->DrillingHole), EMPTY (via->Name), TEST_FLAG (LOCKFLAG, via) ? "It is LOCKED.\n" : ""); else sprintf (&report[0], "VIA ID# %ld; Flags:%s\n" "(X,Y) = (%.*f, %.*f) %s.\n" "Copper width = %0.*f %s. Drill width = %0.*f %s.\n" "Clearance width in polygons = %0.*f %s.\n" "Annulus = %0.*f %s.\n" "Solder mask hole = %0.*f %s (gap = %0.*f %s).\n" "Name = \"%s\"." "%s", via->ID, flags_to_string (via->Flags, VIA_TYPE), prec, units (via->X), prec, UNIT (via->Y), prec, UNIT (via->Thickness), prec, UNIT (via->DrillingHole), prec, UNIT (via->Clearance / 2.), prec, UNIT ((via->Thickness - via->DrillingHole)/2), prec, UNIT (via->Mask), prec, UNIT ((via->Mask - via->Thickness)/2), EMPTY (via->Name), TEST_FLAG (LOCKFLAG, via) ? "It is LOCKED.\n" : ""); break; } case PIN_TYPE: { PinTypePtr Pin; ElementTypePtr element; #ifndef NDEBUG if (gui->shift_is_pressed ()) { __r_dump_tree (PCB->Data->pin_tree->root, 0); return 0; } #endif Pin = (PinTypePtr) ptr2; element = (ElementTypePtr) ptr1; PIN_LOOP (element); { if (pin == Pin) break; } END_LOOP; if (TEST_FLAG (HOLEFLAG, Pin)) sprintf (&report[0], "PIN ID# %ld; Flags:%s\n" "(X,Y) = (%.*f, %.*f) %s.\n" "It is a mounting hole. Drill width = %0.*f %s.\n" "It is owned by element %s.\n" "%s", Pin->ID, flags_to_string (Pin->Flags, PIN_TYPE), prec, units (Pin->X), prec, UNIT (Pin->Y), prec, UNIT (Pin->DrillingHole), EMPTY (element->Name[1].TextString), TEST_FLAG (LOCKFLAG, Pin) ? "It is LOCKED.\n" : ""); else sprintf (&report[0], "PIN ID# %ld; Flags:%s\n" "(X,Y) = (%.*f, %.*f) %s.\n" "Copper width = %0.*f %s. Drill width = %0.*f %s.\n" "Clearance width to Polygon = %0.*f %s.\n" "Annulus = %0.*f %s.\n" "Solder mask hole = %0.*f %s (gap = %0.*f %s).\n" "Name = \"%s\".\n" "It is owned by element %s\n as pin number %s.\n" "%s", Pin->ID, flags_to_string (Pin->Flags, PIN_TYPE), prec, units(Pin->X), prec, UNIT(Pin->Y), prec, UNIT (Pin->Thickness), prec, UNIT (Pin->DrillingHole), prec, UNIT (Pin->Clearance / 2.), prec, UNIT ((Pin->Thickness - Pin->DrillingHole)/2), prec, UNIT (Pin->Mask), prec, UNIT ((Pin->Mask - Pin->Thickness)/2), EMPTY (Pin->Name), EMPTY (element->Name[1].TextString), EMPTY (Pin->Number), TEST_FLAG (LOCKFLAG, Pin) ? "It is LOCKED.\n" : ""); break; } case LINE_TYPE: { LineTypePtr line; #ifndef NDEBUG if (gui->shift_is_pressed ()) { LayerTypePtr layer = (LayerTypePtr) ptr1; __r_dump_tree (layer->line_tree->root, 0); return 0; } #endif line = (LineTypePtr) ptr2; sprintf (&report[0], "LINE ID# %ld; Flags:%s\n" "FirstPoint(X,Y) = (%.*f, %.*f) %s, ID = %ld.\n" "SecondPoint(X,Y) = (%.*f, %.*f) %s, ID = %ld.\n" "Width = %0.*f %s.\nClearance width in polygons = %0.*f %s.\n" "It is on layer %d\n" "and has name \"%s\".\n" "%s", line->ID, flags_to_string (line->Flags, LINE_TYPE), prec, units (line->Point1.X), prec, UNIT (line->Point1.Y), line->Point1.ID, prec, units (line->Point2.X), prec, UNIT (line->Point2.Y), line->Point2.ID, prec, UNIT (line->Thickness), prec, UNIT (line->Clearance / 2.), GetLayerNumber (PCB->Data, (LayerTypePtr) ptr1), UNKNOWN (line->Number), TEST_FLAG (LOCKFLAG, line) ? "It is LOCKED.\n" : ""); break; } case RATLINE_TYPE: { RatTypePtr line; #ifndef NDEBUG if (gui->shift_is_pressed ()) { __r_dump_tree (PCB->Data->rat_tree->root, 0); return 0; } #endif line = (RatTypePtr) ptr2; sprintf (&report[0], "RAT-LINE ID# %ld; Flags:%s\n" "FirstPoint(X,Y) = (%.*f, %.*f) %s; ID = %ld; " "connects to layer group %d.\n" "SecondPoint(X,Y) = (%.*f, %.*f) %s; ID = %ld; " "connects to layer group %d.\n", line->ID, flags_to_string (line->Flags, LINE_TYPE), prec, units (line->Point1.X), prec, UNIT (line->Point1.Y), line->Point1.ID, line->group1, prec, units (line->Point2.X), prec, UNIT (line->Point2.Y), line->Point2.ID, line->group2); break; } case ARC_TYPE: { ArcTypePtr Arc; BoxTypePtr box; #ifndef NDEBUG if (gui->shift_is_pressed ()) { LayerTypePtr layer = (LayerTypePtr) ptr1; __r_dump_tree (layer->arc_tree->root, 0); return 0; } #endif Arc = (ArcTypePtr) ptr2; box = GetArcEnds (Arc); sprintf (&report[0], "ARC ID# %ld; Flags:%s\n" "CenterPoint(X,Y) = (%.*f, %.*f) %s.\n" "Radius = %0.*f %s, Thickness = %0.*f %s.\n" "Clearance width in polygons = %0.*f %s.\n" "StartAngle = %ld degrees, DeltaAngle = %ld degrees.\n" "Bounding Box is (%.*f,%.*f), (%.*f,%.*f) %s.\n" "That makes the end points at (%.*f,%.*f) %s and (%.*f,%.*f) %s.\n" "It is on layer %d.\n" "%s", Arc->ID, flags_to_string (Arc->Flags, ARC_TYPE), prec, units(Arc->X), prec, UNIT(Arc->Y), prec, UNIT (Arc->Width), prec, UNIT (Arc->Thickness), prec, UNIT (Arc->Clearance / 2.), Arc->StartAngle, Arc->Delta, prec, units (Arc->BoundingBox.X1), prec, units (Arc->BoundingBox.Y1), prec, units (Arc->BoundingBox.X2), prec, UNIT (Arc->BoundingBox.Y2), prec, units (box->X1), prec, UNIT (box->Y1), prec, units (box->X2), prec, UNIT (box->Y2), GetLayerNumber (PCB->Data, (LayerTypePtr) ptr1), TEST_FLAG (LOCKFLAG, Arc) ? "It is LOCKED.\n" : ""); break; } case POLYGON_TYPE: { PolygonTypePtr Polygon; #ifndef NDEBUG if (gui->shift_is_pressed ()) { LayerTypePtr layer = (LayerTypePtr) ptr1; __r_dump_tree (layer->polygon_tree->root, 0); return 0; } #endif Polygon = (PolygonTypePtr) ptr2; sprintf (&report[0], "POLYGON ID# %ld; Flags:%s\n" "Its bounding box is (%.*f,%.*f) (%.*f,%.*f) %s.\n" "It has %d points and could store %d more\n" " without using more memory.\n" "It has %d holes and resides on layer %d.\n" "%s", Polygon->ID, flags_to_string (Polygon->Flags, POLYGON_TYPE), prec, units(Polygon->BoundingBox.X1), prec, units(Polygon->BoundingBox.Y1), prec, units(Polygon->BoundingBox.X2), prec, UNIT(Polygon->BoundingBox.Y2), Polygon->PointN, Polygon->PointMax - Polygon->PointN, Polygon->HoleIndexN, GetLayerNumber (PCB->Data, (LayerTypePtr) ptr1), TEST_FLAG (LOCKFLAG, Polygon) ? "It is LOCKED.\n" : ""); break; } case PAD_TYPE: { int len, dx, dy, mgap; PadTypePtr Pad; ElementTypePtr element; #ifndef NDEBUG if (gui->shift_is_pressed ()) { __r_dump_tree (PCB->Data->pad_tree->root, 0); return 0; } #endif Pad = (PadTypePtr) ptr2; element = (ElementTypePtr) ptr1; PAD_LOOP (element); { { if (pad == Pad) break; } } END_LOOP; dx = Pad->Point1.X - Pad->Point2.X; dy = Pad->Point1.Y - Pad->Point2.Y; len = sqrt (dx*dx+dy*dy); mgap = (Pad->Mask - Pad->Thickness)/2; sprintf (&report[0], "PAD ID# %ld; Flags:%s\n" "FirstPoint(X,Y) = (%.*f, %.*f) %s; ID = %ld.\n" "SecondPoint(X,Y) = (%.*f, %.*f) %s; ID = %ld.\n" "Width = %0.*f %s. Length = %0.*f %s.\n" "Clearance width in polygons = %0.*f %s.\n" "Solder mask = %0.*f x %0.*f %s (gap = %0.*f %s).\n" "Name = \"%s\".\n" "It is owned by SMD element %s\n" " as pin number %s and is on the %s\n" "side of the board.\n" "%s", Pad->ID, flags_to_string (Pad->Flags, PAD_TYPE), prec, units (Pad->Point1.X), prec, UNIT (Pad->Point1.Y), Pad->Point1.ID, prec, units (Pad->Point2.X), prec, UNIT (Pad->Point2.Y), Pad->Point2.ID, prec, UNIT (Pad->Thickness), prec, UNIT (len + Pad->Thickness), prec, UNIT (Pad->Clearance / 2.), prec, units (Pad->Mask), prec, UNIT (Pad->Mask + len), prec, UNIT (mgap), EMPTY (Pad->Name), EMPTY (element->Name[1].TextString), EMPTY (Pad->Number), TEST_FLAG (ONSOLDERFLAG, Pad) ? "solder (bottom)" : "component", TEST_FLAG (LOCKFLAG, Pad) ? "It is LOCKED.\n" : ""); break; } case ELEMENT_TYPE: { ElementTypePtr element; #ifndef NDEBUG if (gui->shift_is_pressed ()) { __r_dump_tree (PCB->Data->element_tree->root, 0); return 0; } #endif element = (ElementTypePtr) ptr2; sprintf (&report[0], "ELEMENT ID# %ld; Flags:%s\n" "BoundingBox (%.*f,%.*f) (%.*f,%.*f) %s.\n" "Descriptive Name \"%s\".\n" "Name on board \"%s\".\n" "Part number name \"%s\".\n" "It is %.*f %s tall and is located at (X,Y) = (%.*f,%.*f)%s.\n" "Mark located at point (X,Y) = (%.*f,%.*f).\n" "It is on the %s side of the board.\n" "%s", element->ID, flags_to_string (element->Flags, ELEMENT_TYPE), prec, units(element->BoundingBox.X1), prec, units (element->BoundingBox.Y1), prec, units(element->BoundingBox.X2), prec, UNIT (element->BoundingBox.Y2), EMPTY (element->Name[0].TextString), EMPTY (element->Name[1].TextString), EMPTY (element->Name[2].TextString), prec, UNIT (0.45 * element->Name[1].Scale * 100.), prec, units(element->Name[1].X), prec, units(element->Name[1].Y), TEST_FLAG (HIDENAMEFLAG, element) ? ",\n but it's hidden" : "", prec, units(element->MarkX), prec, units(element->MarkY), TEST_FLAG (ONSOLDERFLAG, element) ? "solder (bottom)" : "component", TEST_FLAG (LOCKFLAG, element) ? "It is LOCKED.\n" : ""); break; } case TEXT_TYPE: #ifndef NDEBUG if (gui->shift_is_pressed ()) { LayerTypePtr layer = (LayerTypePtr) ptr1; __r_dump_tree (layer->text_tree->root, 0); return 0; } #endif case ELEMENTNAME_TYPE: { char laynum[32]; TextTypePtr text; #ifndef NDEBUG if (gui->shift_is_pressed ()) { __r_dump_tree (PCB->Data->name_tree[NAME_INDEX (PCB)]->root, 0); return 0; } #endif text = (TextTypePtr) ptr2; if (type == TEXT_TYPE) sprintf (laynum, "It is on layer %d.", GetLayerNumber (PCB->Data, (LayerTypePtr) ptr1)); sprintf (&report[0], "TEXT ID# %ld; Flags:%s\n" "Located at (X,Y) = (%.*f,%.*f) %s.\n" "Characters are %0.*f %s tall.\n" "Value is \"%s\".\n" "Direction is %d.\n" "The bounding box is (%.*f,%.*f) (%.*f, %.*f) %s.\n" "%s\n" "%s", text->ID, flags_to_string (text->Flags, TEXT_TYPE), prec, units(text->X), prec, UNIT (text->Y), prec, UNIT (0.45 * text->Scale * 100.), text->TextString, text->Direction, prec, units(text->BoundingBox.X1), prec, units(text->BoundingBox.Y1), prec, units(text->BoundingBox.X2), prec, UNIT (text->BoundingBox.Y2), (type == TEXT_TYPE) ? laynum : "It is an element name.", TEST_FLAG (LOCKFLAG, text) ? "It is LOCKED.\n" : ""); break; } case LINEPOINT_TYPE: case POLYGONPOINT_TYPE: { PointTypePtr point = (PointTypePtr) ptr2; sprintf (&report[0], "POINT ID# %ld.\n" "Located at (X,Y) = (%.*f,%.*f) %s.\n" "It belongs to a %s on layer %d.\n", point->ID, prec, units (point->X), prec, UNIT (point->Y), (type == LINEPOINT_TYPE) ? "line" : "polygon", GetLayerNumber (PCB->Data, (LayerTypePtr) ptr1)); break; } case NO_TYPE: report[0] = '\0'; break; default: sprintf (&report[0], "Unknown\n"); break; } if (report[0] == '\0') { Message (_("Nothing found to report on\n")); return 1; } HideCrosshair (false); /* create dialog box */ gui->report_dialog ("Report", &report[0]); RestoreCrosshair (false); return 0; }