58#include <compoundfilereader.h>
68#include <wx/mstream.h>
69#include <wx/zstream.h>
70#include <wx/wfstream.h>
71#include <magic_enum.hpp>
77#define HARNESS_PORT_COLOR_DEFAULT_BACKGROUND COLOR4D( 0.92941176470588238, \
78 0.94901960784313721, \
79 0.98431372549019602, 1.0 )
81#define HARNESS_PORT_COLOR_DEFAULT_OUTLINE COLOR4D( 0.56078431372549020, \
82 0.61960784313725492, \
83 0.78823529411764703, 1.0 )
95 int red = color & 0x0000FF;
96 int green = ( color & 0x00FF00 ) >> 8;
97 int blue = ( color & 0xFF0000 ) >> 16;
169 if( stroke.
GetColor() == default_color || stroke.
GetColor() == alt_default_color )
206 else if( elem.
AreaColor == aStrokeColor )
212 else if( bgcolor.
WithAlpha( 1.0 ) == default_bgcolor )
257 for(
auto& [
name, symbol] : lib )
309 std::vector<SCH_PIN*> pins;
312 pins =
static_cast<SCH_SYMBOL*
>( aSymbol )->GetPins(
nullptr );
314 pins =
static_cast<LIB_SYMBOL*
>( aSymbol )->GetGraphicalPins( 0, 0 );
317 bool names_visible =
false;
318 bool numbers_visible =
false;
322 if(
pin->GetNameTextSize() > 0 && !
pin->GetName().empty() )
323 names_visible =
true;
325 if(
pin->GetNumberTextSize() > 0 && !
pin->GetNumber().empty() )
326 numbers_visible =
true;
337 if( !numbers_visible )
386 std::map<wxString, SCH_SHEET*> sheets;
387 wxFileName
project( aProperties->at(
"project_file" ) );
389 for(
auto& [ key, filestring] : *aProperties )
391 if( !key.starts_with(
"sch" ) )
394 wxFileName fn( filestring );
401 m_rootSheet->SearchHierarchy( fn.GetFullPath(), &existingScreen );
406 if( !existingScreen )
412 wxFileName screenFn( screen->GetFileName() );
413 wxFileName checkFn( fn.GetFullPath() );
415 if( screenFn.GetName().IsSameAs( checkFn.GetName(),
false ) )
417 existingScreen = screen;
429 wxFileName kicad_fn( fn );
430 std::unique_ptr<SCH_SHEET> sheet = std::make_unique<SCH_SHEET>(
m_rootSheet, pos );
432 sheet->SetScreen( screen );
439 sheet->SetFileName( kicad_fn.GetFullName() );
442 wxCHECK2( sheet && screen,
continue );
444 wxString pageNo = wxString::Format( wxT(
"%d" ), page++ );
453 if( sheet->GetName().Trim().empty() )
455 wxString baseName = wxFileName( fn ).GetName();
456 baseName.Replace( wxT(
"/" ), wxT(
"_" ) );
458 wxString sheetName = baseName;
459 std::set<wxString> existingNames;
461 for(
auto& [
path, existing] : sheets )
462 existingNames.insert( existing->GetName() );
464 for(
int ii = 1; existingNames.count( sheetName ); ++ii )
465 sheetName = baseName + wxString::Format( wxT(
"_%d" ), ii );
467 sheet->SetName( sheetName );
475 wxCHECK2( currentScreen,
continue );
479 currentScreen->
Append( sheetPtr );
482 sheets[kicad_fn.GetFullPath()] = sheetPtr;
496 for(
auto& [ filestring, sheet ] : sheets )
508 const std::map<std::string, UTF8>* aProperties )
510 wxCHECK( ( !aFileName.IsEmpty() || !aProperties->empty() ) && aSchematic,
nullptr );
512 wxFileName fileName( aFileName );
520 std::unique_ptr<SCH_SHEET> deleter( aAppendToMe ?
nullptr :
m_rootSheet );
524 wxCHECK_MSG( aSchematic->
IsValid(),
nullptr,
"Can't append to a schematic with no root!" );
530 m_rootSheet->SetFileName( fileName.GetFullPath() );
535 if( aFileName.empty() )
558 if( !aFileName.empty() )
565 wxCHECK( rootScreen,
nullptr );
574 if( aFileName.empty() )
579 if( aFileName.empty() )
581 std::vector<SCH_SHEET*> topLevelSheets;
589 topLevelSheets.push_back( sheet );
595 rootScreen->
Remove( sheet );
597 if( !topLevelSheets.empty() )
609 std::vector<SCH_HIERLABEL*> hierLabels;
617 hierLabel->GetText() );
618 globalLabel->
SetShape( hierLabel->GetShape() );
622 screen->
Remove( hierLabel );
623 screen->
Append( globalLabel );
644 if( aProperties && aProperties->count(
"project_file" ) )
648 if( !variants.empty() )
654 std::vector<std::pair<wxString, const ALTIUM_VARIANT_ENTRY*>>;
656 std::map<wxString, ENTRY_LIST> variantsByUid;
657 std::map<wxString, ENTRY_LIST> variantsByDesignator;
663 if( !pv.description.empty() && pv.description != pv.name )
664 m_schematic->SetVariantDescription( pv.name, pv.description );
669 variantsByUid[entry.
uniqueId].push_back( { pv.name, &entry } );
671 variantsByDesignator[entry.
designator].push_back( { pv.name, &entry } );
688 const ENTRY_LIST* entries =
nullptr;
694 auto varIt = variantsByUid.find( symUidIt->second );
696 if( varIt != variantsByUid.end() )
697 entries = &varIt->second;
703 auto varIt = variantsByDesignator.find( ref );
705 if( varIt != variantsByDesignator.end() )
706 entries = &varIt->second;
712 for(
const auto& [variantName, entry] : *entries )
717 if( entry->kind == 1 )
719 variant.
m_DNP =
true;
723 else if( entry->kind == 0 )
725 for(
const auto& [key, value] : entry->alternateFields )
727 if( key.CmpNoCase( wxS(
"LibReference" ) ) == 0 )
728 variant.
m_Fields[wxS(
"Value" )] = value;
729 else if( key.CmpNoCase( wxS(
"Description" ) ) == 0 )
730 variant.
m_Fields[wxS(
"Description" )] = value;
731 else if( key.CmpNoCase( wxS(
"Footprint" ) ) == 0 )
732 variant.
m_Fields[wxS(
"Footprint" )] = value;
746 int minWireWidth = std::numeric_limits<int>::max();
747 int minBusWidth = std::numeric_limits<int>::max();
751 std::vector<SCH_MARKER*> markers;
758 minWireWidth = std::min( minWireWidth, line->
GetLineWidth() );
761 minBusWidth = std::min( minBusWidth, line->
GetLineWidth() );
765 std::shared_ptr<NET_SETTINGS>& netSettings =
m_schematic->Project().GetProjectFile().NetSettings();
767 if( minWireWidth < std::numeric_limits<int>::max() )
768 netSettings->GetDefaultNetclass()->SetWireWidth( minWireWidth );
770 if( minBusWidth < std::numeric_limits<int>::max() )
771 netSettings->GetDefaultNetclass()->SetBusWidth( minBusWidth );
794 std::vector<SCH_LINE*> busLines;
795 std::map<VECTOR2I, std::vector<SCH_LINE*>> busLineMap;
803 busLines.push_back( line );
805 busLineMap[ line->
GetEndPoint() ].push_back( line );
812 auto it = busLineMap.find( aStart );
814 if( it == busLineMap.end() )
820 if( aVisited.count( line ) )
823 aVisited.insert( line );
844 std::shared_ptr<BUS_ALIAS> alias = std::make_shared<BUS_ALIAS>();
845 alias->SetName( harness.m_name );
848 alias->AddMember( port.
m_name );
853 BOX2I box( harness.m_location, harness.m_size );
883 int delta_x =
center.x - pos.
x;
884 int delta_y =
center.y - pos.
y;
891 screen->
Append( busLine );
898 screen->
Append( busLine );
908 std::set<SCH_LINE*> visited;
909 SCH_LABEL* label = walkBusLine( pos, visited );
916 if( label && !label->
GetText().StartsWith( wxT(
"{" ) ) )
917 label->
SetText( label->
GetText() + wxT(
"{" ) + harness.m_name + wxT(
"}" ) );
934 bool isVertical =
true;
936 if( harness.m_ports.size() > 1 )
938 VECTOR2I first = harness.m_ports.front().m_location;
939 VECTOR2I last = harness.m_ports.back().m_location;
941 if( first.
y == last.
y )
947 VECTOR2I bottom = harness.m_ports.front().m_entryLocation;
948 VECTOR2I top = harness.m_ports.front().m_entryLocation;
1013 wxFileName parentFileName( aFileName );
1020 wxFileName relative = parentFileName;
1023 m_progressReporter->Report( wxString::Format(
_(
"Importing %s" ), relative.GetFullPath() ) );
1041 catch(
const CFB::CFBException& exception )
1045 catch(
const std::exception& exc )
1047 THROW_IO_ERROR( wxString::Format(
_(
"Error parsing Altium schematic: %s" ), exc.what() ) );
1056 wxCHECK( currentScreen, );
1064 wxCHECK2( sheet,
continue );
1068 wxFileName loadAltiumFileName( parentFileName.GetPath(), sheet->
GetFileName() );
1070 if( !loadAltiumFileName.IsFileReadable() )
1074 if( !loadAltiumFileName.HasExt() )
1076 wxFileName withExt( loadAltiumFileName );
1077 withExt.SetExt( wxT(
"SchDoc" ) );
1079 if( withExt.IsFileReadable() )
1080 loadAltiumFileName = withExt;
1084 if( !loadAltiumFileName.IsFileReadable() )
1089 bool extensionless = !sheetFn.HasExt();
1091 wxArrayString files;
1092 wxDir::GetAllFiles( parentFileName.GetPath(), &files, wxEmptyString,
1093 wxDIR_FILES | wxDIR_HIDDEN );
1095 for(
const wxString& candidate : files )
1097 wxFileName candidateFname( candidate );
1099 if( candidateFname.GetFullName().IsSameAs( sheet->
GetFileName(),
false )
1101 && !sheetFn.GetName().empty()
1102 && candidateFname.GetName().IsSameAs( sheetFn.GetName(),
false )
1103 && candidateFname.GetExt().IsSameAs( wxT(
"SchDoc" ),
false ) ) )
1105 loadAltiumFileName = candidateFname;
1111 if( loadAltiumFileName.GetFullName().IsEmpty() || !loadAltiumFileName.IsFileReadable() )
1113 m_errorMessages.emplace( wxString::Format(
_(
"The file name for sheet %s is undefined, "
1114 "this is probably an Altium signal harness "
1115 "that got converted to a sheet." ),
1122 m_rootSheet->SearchHierarchy( loadAltiumFileName.GetFullPath(), &loadedScreen );
1128 wxFileName projectFileName = loadAltiumFileName;
1129 projectFileName.SetPath(
m_schematic->Project().GetProjectPath() );
1131 sheet->
SetFileName( projectFileName.GetFullName() );
1151 if( baseRef.StartsWith( wxT(
"#" ) ) )
1158 wxString newRef = baseRef + wxT(
"_" ) + sheet->
GetName();
1170 if( sheet->
GetName().Trim().empty() )
1172 wxString baseName = loadAltiumFileName.GetName();
1173 baseName.Replace( wxT(
"/" ), wxT(
"_" ) );
1175 wxString sheetName = baseName;
1176 std::set<wxString> sheetNames;
1181 sheetNames.insert( otherSheet->
GetName() );
1184 for(
int ii = 1; ; ++ii )
1186 if( sheetNames.find( sheetName ) == sheetNames.end() )
1189 sheetName = baseName + wxString::Format( wxT(
"_%d" ), ii );
1195 wxCHECK2( screen,
continue );
1202 wxFileName projectFileName = loadAltiumFileName;
1203 projectFileName.SetPath(
m_schematic->Project().GetProjectPath() );
1205 sheet->
SetFileName( projectFileName.GetFullName() );
1206 screen->
SetFileName( projectFileName.GetFullPath() );
1216 const CFB::COMPOUND_FILE_ENTRY* file = aAltiumSchFile.
FindStream( {
"Storage" } );
1218 if( file ==
nullptr )
1223 std::map<wxString, wxString> properties = reader.
ReadProperties();
1230 for(
int i = 0; i < weight; i++ )
1240 m_errorMessages.emplace( wxString::Format(
_(
"Storage file not fully parsed (%d bytes remaining)." ),
1249 wxString streamName = wxS(
"Additional" );
1251 const CFB::COMPOUND_FILE_ENTRY* file =
1252 aAltiumSchFile.
FindStream( { streamName.ToStdString() } );
1254 if( file ==
nullptr )
1261 THROW_IO_ERROR(
"Additional section does not contain any data" );
1265 std::map<wxString, wxString> properties = reader.
ReadProperties();
1276 std::map<wxString, wxString> properties = reader.
ReadProperties();
1300 wxString streamName = wxS(
"FileHeader" );
1302 const CFB::COMPOUND_FILE_ENTRY* file = aAltiumSchFile.
FindStream( { streamName.ToStdString() } );
1304 if( file ==
nullptr )
1315 std::map<wxString, wxString> properties = reader.
ReadProperties();
1319 if( libtype.CmpNoCase(
"Protel for Windows - Schematic Capture Binary File Version 5.0" ) )
1332 std::map<wxString, wxString> properties = reader.
ReadProperties();
1344 for( std::pair<const int, SCH_SYMBOL*>& symbol :
m_symbols )
1354 symbol.second->SetLibSymbol( libSymbolIt->second );
1391 while( storageReader.
CanRead() )
1393 std::map<wxString, wxString> properties = storageReader.
ReadProperties();
1396 if( properties.find( wxS(
"BINARY" ) ) != properties.end() )
1410 std::map<wxString, wxString> properties = reader.
ReadProperties();
1414 if( libtype.CmpNoCase(
"Protel for Windows - Schematic Capture Ascii File Version 5.0" ) )
1429 std::map<wxString, wxString> properties = reader.
ReadProperties();
1432 if( properties.find( wxS(
"HEADER" ) ) != properties.end() )
1438 if( properties.find( wxS(
"RECORD" ) ) != properties.end() )
1451 for( std::pair<const int, SCH_SYMBOL*>& symbol :
m_symbols )
1461 symbol.second->SetLibSymbol( libSymbolIt->second );
1501 const wxString& aSectionName )
1697 wxString::Format(
_(
"Unknown or unexpected record id %d found in %s." ), recordId,
1714 if( file.filename.IsSameAs( aFilename ) )
1717 if( file.filename.EndsWith( aFilename ) )
1718 nonExactMatch = &file;
1721 return nonExactMatch;
1728 wxCHECK( currentSheet, );
1730 wxString sheetName = currentSheet->
GetName();
1732 if( sheetName.IsEmpty() )
1733 sheetName = wxT(
"root" );
1741 m_errorMessages.emplace( wxString::Format(
_(
"Symbol '%s' in sheet '%s' at index %d "
1742 "replaced with symbol \"%s\"." ),
1754 wxString
name = wxString::Format(
"%s_%d%s_%s_%s",
1774 std::vector<wxString> bodyStyleNames;
1777 bodyStyleNames.push_back( wxString::Format(
"Display %d", i + 1 ) );
1790 field.SetVisible(
false );
1831 screen->
Append( symbol );
1843 wxCHECK( currentSheet, );
1845 wxString sheetName = currentSheet->
GetName();
1847 if( sheetName.IsEmpty() )
1848 sheetName = wxT(
"root" );
1853 wxString baseName = altiumTemplate.
filename.AfterLast(
'\\' ).BeforeLast(
'.' );
1855 if( baseName.IsEmpty() )
1856 baseName = wxS(
"Template" );
1864 std::vector<LIB_SYMBOL*>& aSymbol )
1868 LIB_SYMBOL* symbol = aSymbol.empty() ? nullptr : aSymbol[0];
1878 m_errorMessages.emplace( wxString::Format( wxT(
"Pin's owner (%d) not found." ),
1884 schSymbol =
m_symbols.at( libSymbolIt->first );
1885 symbol = libSymbolIt->second;
1901 if( !aSymbol.empty() )
1919 pin->SetVisible(
false );
1922 pin->SetNumberTextSize( 0 );
1925 pin->SetNameTextSize( 0 );
1963 VECTOR2I dir = bodyEnd - pinLocation;
1971 pin->SetPosition( pinLocation );
2069 int vjustify, hjustify;
2072 switch( justification )
2095 switch( justification )
2118 switch( orientation )
2141 text->SetTextAngle( angle );
2211 int nRenderRotations = ( aSymbol.
orientation + 1 ) % 4;
2225 for(
int i = 0; i < nRenderRotations; i++ )
2245 std::vector<LIB_SYMBOL*>& aSymbol, std::vector<int>& aFontSizes )
2251 static const std::map<wxString, wxString> variableMap = {
2252 {
"APPLICATION_BUILDNUMBER",
"KICAD_VERSION" },
2253 {
"SHEETNUMBER",
"#" },
2254 {
"SHEETTOTAL",
"##" },
2255 {
"TITLE",
"TITLE" },
2256 {
"REVISION",
"REVISION" },
2257 {
"DATE",
"ISSUE_DATE" },
2258 {
"CURRENTDATE",
"CURRENT_DATE" },
2259 {
"COMPANYNAME",
"COMPANY" },
2260 {
"DOCUMENTNAME",
"FILENAME" },
2261 {
"DOCUMENTFULLPATHANDNAME",
"FILEPATH" },
2262 {
"PROJECTNAME",
"PROJECTNAME" },
2270 size_t fontId =
static_cast<int>( elem.
fontId );
2287 screen->
Append( textItem );
2291 LIB_SYMBOL* symbol = aSymbol.empty() ? nullptr : aSymbol[0];
2306 symbol = libSymbolIt->second;
2307 schsym =
m_symbols.at( libSymbolIt->first );
2316 if( !aSymbol.empty() )
2345 size_t fontId = elem.
fontId;
2356 else if( fontId > 0 && fontId <= aFontSizes.size() )
2358 int size = aFontSizes[fontId - 1];
2366 std::vector<LIB_SYMBOL*>& aSymbol,
2367 std::vector<int>& aFontSizes )
2394 textBox->
SetStart( sheetTopRight );
2395 textBox->
SetEnd( sheetBottomLeft );
2425 size_t fontId =
static_cast<int>( aElem->
FontID );
2443 screen->
Append( textBox );
2448 std::vector<int>& aFontSizes )
2450 LIB_SYMBOL* symbol = aSymbol.empty() ? nullptr : aSymbol[0];
2465 symbol = libSymbolIt->second;
2466 schsym =
m_symbols.at( libSymbolIt->first );
2476 if( !aSymbol.empty() )
2529 if( aElem->
FontID > 0 && aElem->
FontID <=
static_cast<int>( aFontSizes.size() ) )
2531 int size = aFontSizes[aElem->
FontID - 1];
2538 std::vector<LIB_SYMBOL*>& aSymbol )
2542 if( elem.
points.size() < 2 )
2544 m_errorMessages.emplace( wxString::Format(
_(
"Bezier has %d control points. At least 2 are expected." ),
2545 static_cast<int>( elem.
points.size() ) ),
2553 wxCHECK( currentScreen, );
2555 for(
size_t i = 0; i + 1 < elem.
points.size(); i += 3 )
2557 if( i + 2 == elem.
points.size() )
2568 currentScreen->
Append( line );
2573 std::vector<VECTOR2I> bezierPoints;
2574 std::vector<VECTOR2I> polyPoints;
2576 for(
size_t j = i; j < elem.
points.size() && j < i + 4; j++ )
2577 bezierPoints.push_back( elem.
points.at( j ) );
2580 converter.
GetPoly( polyPoints );
2582 for(
size_t k = 0; k + 1 < polyPoints.size(); k++ )
2591 currentScreen->
Append( line );
2598 LIB_SYMBOL* symbol = aSymbol.empty() ? nullptr : aSymbol[0];
2608 m_errorMessages.emplace( wxString::Format( wxT(
"Bezier's owner (%d) not found." ),
2614 symbol = libSymbolIt->second;
2615 schsym =
m_symbols.at( libSymbolIt->first );
2622 if( !aSymbol.empty() )
2635 for(
size_t i = 0; i + 1 < elem.
points.size(); i += 3 )
2637 if( i + 2 == elem.
points.size() )
2648 for(
size_t j = i; j < elem.
points.size() && j < i + 2; j++ )
2660 else if( i + 3 == elem.
points.size() )
2674 for(
size_t j = i; j < elem.
points.size() && j < i + 2; j++ )
2697 for(
size_t j = i; j < elem.
points.size() && j < i + 4; j++ )
2706 case 0: bezier->
SetStart( pos );
break;
2709 case 3: bezier->
SetEnd( pos );
break;
2723 std::vector<LIB_SYMBOL*>& aSymbol )
2727 if( elem.
Points.size() < 2 )
2735 for(
size_t i = 1; i < elem.
Points.size(); i++ )
2752 LIB_SYMBOL* symbol = aSymbol.empty() ? nullptr : aSymbol[0];
2762 m_errorMessages.emplace( wxString::Format( wxT(
"Polyline's owner (%d) not found." ),
2768 symbol = libSymbolIt->second;
2769 schsym =
m_symbols.at( libSymbolIt->first );
2779 if( !aSymbol.empty() )
2810 std::vector<LIB_SYMBOL*>& aSymbol )
2833 LIB_SYMBOL* symbol = aSymbol.empty() ? nullptr : aSymbol[0];
2843 m_errorMessages.emplace( wxString::Format( wxT(
"Polygon's owner (%d) not found." ),
2849 symbol = libSymbolIt->second;
2850 schsym =
m_symbols.at( libSymbolIt->first );
2860 if( !aSymbol.empty() )
2903 std::vector<LIB_SYMBOL*>& aSymbol )
2925 LIB_SYMBOL* symbol = aSymbol.empty() ? nullptr : aSymbol[0];
2935 m_errorMessages.emplace( wxString::Format( wxT(
"Rounded rectangle's owner (%d) not found." ),
2941 symbol = libSymbolIt->second;
2942 schsym =
m_symbols.at( libSymbolIt->first );
2957 int radius = std::min( width / 2, height / 2 );
2991 if( !aSymbol.empty() )
3008 std::vector<LIB_SYMBOL*>& aSymbol )
3016 VECTOR2I startOffset =
KiROUND( arc_radius * startAngle.
Cos(), -( arc_radius * startAngle.
Sin() ) );
3022 wxCHECK( currentScreen, );
3047 currentScreen->
Append( arc );
3052 LIB_SYMBOL* symbol = aSymbol.empty() ? nullptr : aSymbol[0];
3067 symbol = libSymbolIt->second;
3068 schsym =
m_symbols.at( libSymbolIt->first );
3075 if( !aSymbol.empty() )
3096 circle->SetBodyStyle( bodyStyle );
3137 std::vector<LIB_SYMBOL*>& aSymbol )
3151 wxCHECK( currentScreen, );
3157 std::vector<BEZIER<int>> beziers;
3164 schbezier->
SetStart( bezier.Start );
3167 schbezier->
SetEnd( bezier.End );
3171 currentScreen->
Append( schbezier );
3176 LIB_SYMBOL* symbol = aSymbol.empty() ? nullptr : aSymbol[0];
3186 m_errorMessages.emplace( wxString::Format( wxT(
"Elliptical Arc's owner (%d) not found." ),
3192 symbol = libSymbolIt->second;
3193 schsym =
m_symbols.at( libSymbolIt->first );
3200 if( !aSymbol.empty() )
3217 std::vector<BEZIER<int>> beziers;
3240 schbezier->
SetStart( bezier.Start );
3243 schbezier->
SetEnd( bezier.End );
3254 std::vector<LIB_SYMBOL*>& aSymbol )
3264 VECTOR2I startOffset =
KiROUND( arc_radius * startAngle.
Cos(), -( arc_radius * startAngle.
Sin() ) );
3289 LIB_SYMBOL* symbol = aSymbol.empty() ? nullptr : aSymbol[0];
3299 m_errorMessages.emplace( wxString::Format( wxT(
"Piechart's owner (%d) not found." ),
3305 symbol = libSymbolIt->second;
3306 schsym =
m_symbols.at( libSymbolIt->first );
3316 if( !aSymbol.empty() )
3348 std::vector<LIB_SYMBOL*>& aSymbol )
3373 std::vector<BEZIER<int>> beziers;
3374 std::vector<VECTOR2I> polyPoints;
3381 schbezier->
SetStart( bezier.Start );
3384 schbezier->
SetEnd( bezier.End );
3390 screen->
Append( schbezier );
3392 polyPoints.push_back( bezier.Start );
3402 for(
const VECTOR2I& point : polyPoints )
3405 schpoly->
AddPoint( polyPoints[0] );
3407 screen->
Append( schpoly );
3412 LIB_SYMBOL* symbol = aSymbol.empty() ? nullptr : aSymbol[0];
3427 symbol = libSymbolIt->second;
3428 schsym =
m_symbols.at( libSymbolIt->first );
3435 if( !aSymbol.empty() )
3451 std::vector<BEZIER<int>> beziers;
3452 std::vector<VECTOR2I> polyPoints;
3467 libbezier->
SetStart( bezier.Start );
3470 libbezier->
SetEnd( bezier.End );
3484 polyPoints.push_back( libbezier->
GetStart() );
3498 for(
const VECTOR2I& point : polyPoints )
3501 libline->
AddPoint( polyPoints[0] );
3511 std::vector<LIB_SYMBOL*>& aSymbol )
3531 circle->SetFilled(
false );
3537 LIB_SYMBOL* symbol = aSymbol.empty() ? nullptr : aSymbol[0];
3552 symbol = libSymbolIt->second;
3553 schsym =
m_symbols.at( libSymbolIt->first );
3564 if( !aSymbol.empty() )
3590 std::vector<LIB_SYMBOL*>& aSymbol )
3610 LIB_SYMBOL* symbol = aSymbol.empty() ? nullptr : aSymbol[0];
3625 symbol = libSymbolIt->second;
3626 schsym =
m_symbols.at( libSymbolIt->first );
3636 if( !aSymbol.empty() )
3675 for(
size_t ii = 0; ii < elem.
points.size() - 1; ii++ )
3688 m_errorMessages.emplace( wxT(
"Signal harness, belonging to the part is not currently supported." ),
3695 wxString>& aProperties )
3704 HARNESS& harness = it->second;
3732 m_errorMessages.emplace( wxT(
"Harness connector, belonging to the part is not currently supported." ),
3746 m_errorMessages.emplace( wxString::Format( wxT(
"Harness entry's parent (%d) not found." ),
3752 HARNESS& harness = harnessIt->second;
3789 harness.
m_ports.emplace_back( port );
3801 m_errorMessages.emplace( wxString::Format( wxT(
"Harness type's parent (%d) not found." ),
3807 HARNESS& harness = harnessIt->second;
3813 std::vector<LIB_SYMBOL*>& aSymbol )
3828 rect->
SetEnd( sheetBottomLeft );
3837 LIB_SYMBOL* symbol = aSymbol.empty() ? nullptr : aSymbol[0];
3847 m_errorMessages.emplace( wxString::Format( wxT(
"Rectangle's owner (%d) not found." ),
3853 symbol = libSymbolIt->second;
3854 schsym =
m_symbols.at( libSymbolIt->first );
3864 if( !aSymbol.empty() )
3880 rect->
SetEnd( sheetBottomLeft );
3908 wxCHECK( currentScreen, );
3909 currentScreen->
Append( sheet );
3918 wxCHECK( rootScreen, );
3926 m_sheets.insert( { aIndex, sheet } );
3944 sheetIt->second->AddPin( sheetPin );
3946 wxString pinName = elem.
name;
3949 pinName += wxT(
"{" ) + elem.
harnessType + wxT(
"}" );
3956 VECTOR2I pos = sheetIt->second->GetPosition();
3957 VECTOR2I size = sheetIt->second->GetSize();
4194 aReporter->
Report(
_(
"Power Port with unknown style imported as 'Bar' type." ),
4219 wxString symName( elem.
text );
4220 std::string styleName( magic_enum::enum_name<ASCH_POWER_PORT_STYLE>( elem.
style ) );
4222 if( !styleName.empty() )
4223 symName <<
'_' << styleName;
4232 libSymbol = powerSymbolIt->second;
4238 libSymbol->
SetName( symName );
4243 libSymbol->
SetDescription( wxString::Format(
_(
"Power symbol creates a global label with name '%s'" ),
4253 pin->SetPosition( { 0, 0 } );
4254 pin->SetLength( 0 );
4256 pin->SetVisible(
false );
4313 screen->
Append( symbol );
4341 switch( aElem.
Style )
4371 bool connectionFound = startIsWireTerminal
4372 || startIsBusTerminal
4373 || endIsWireTerminal
4374 || endIsBusTerminal;
4376 if( !connectionFound )
4380 if( harness.m_name.CmpNoCase( aElem.
HarnessType ) != 0 )
4383 BOX2I bbox( harness.m_location, harness.m_size );
4388 startIsBusTerminal =
true;
4389 connectionFound =
true;
4395 endIsBusTerminal =
true;
4396 connectionFound =
true;
4401 if( !connectionFound )
4409 VECTOR2I position = ( startIsWireTerminal || startIsBusTerminal ) ? start :
end;
4412 wxString labelName = aElem.
Name;
4415 labelName += wxT(
"{" ) + aElem.
HarnessType + wxT(
"}" );
4438 switch( aElem.
Style )
4445 if( ( startIsWireTerminal || startIsBusTerminal ) )
4456 if( ( startIsWireTerminal || startIsBusTerminal ) )
4470 if( ( startIsWireTerminal && endIsWireTerminal ) )
4478 else if( startIsBusTerminal && endIsBusTerminal )
4501 screen->
Append( noConnect );
4529 for(
size_t i = 0; i + 1 < elem.
points.size(); i++ )
4548 for(
size_t i = 0; i + 1 < elem.
points.size(); i++ )
4570 screen->
Append( junction );
4582 && component->second.currentpartid != elem.
ownerpartid )
4586 std::unique_ptr<SCH_BITMAP> bitmap = std::make_unique<SCH_BITMAP>(
center );
4598 m_errorMessages.emplace( wxString::Format(
_(
"Embedded file %s not found in storage." ),
4604 wxString storagePath = wxFileName::CreateTempFileName(
"kicad_import_" );
4607 wxMemoryInputStream fileStream( storageFile->
data.data(), storageFile->
data.size() );
4608 wxZlibInputStream zlibInputStream( fileStream );
4609 wxFFileOutputStream outputStream( storagePath );
4610 outputStream.Write( zlibInputStream );
4611 outputStream.Close();
4615 m_errorMessages.emplace( wxString::Format(
_(
"Error reading image %s." ), storagePath ),
4621 wxRemoveFile( storagePath );
4625 if( !wxFileExists( elem.
filename ) )
4643 const double scaleX =
std::abs(
static_cast<double>( expectedImageSize.
x ) / currentImageSize.
x );
4644 const double scaleY =
std::abs(
static_cast<double>( expectedImageSize.
y ) / currentImageSize.
y );
4647 bitmap->SetFlags(
IS_NEW );
4648 screen->
Append( bitmap.release() );
4654 m_altiumSheet = std::make_unique<ASCH_SHEET>( aProperties );
4706 wxCHECK( currentScreen, );
4712 m_errorMessages.emplace( wxString::Format( wxT(
"Sheetname's owner (%d) not found." ),
4718 wxString baseName = elem.
text;
4719 baseName.Replace( wxT(
"/" ), wxT(
"_" ) );
4721 wxString sheetName = baseName;
4722 std::set<wxString> sheetNames;
4727 sheetNames.insert( sheet->
GetName() );
4730 for(
int ii = 1; ; ++ii )
4732 if( sheetNames.find( sheetName ) == sheetNames.end() )
4735 sheetName = baseName + wxString::Format( wxT(
"_%d" ), ii );
4741 sheetNameField->
SetText( sheetName );
4755 m_errorMessages.emplace( wxString::Format( wxT(
"Filename's owner (%d) not found." ),
4781 m_errorMessages.emplace( wxString::Format( wxT(
"Designator's owner (%d) not found." ),
4795 bool emptyRef = elem.
text.IsEmpty();
4800 bool visible = !emptyRef;
4817 std::vector<LIB_SYMBOL*>& aSymbol,
4818 std::vector<int>& aFontSizes )
4827 bool emptyRef = elem.
text.IsEmpty();
4828 SCH_FIELD& refField = symbol->GetReferenceField();
4831 refField.
SetText( wxT(
"X" ) );
4838 if( elem.
fontId > 0 && elem.
fontId <=
static_cast<int>( aFontSizes.size() ) )
4840 int size = aFontSizes[elem.
fontId - 1];
4857 busWireEntry->
SetSize( { vector.
x, vector.
y } );
4860 screen->
Append( busWireEntry );
4869 static const std::map<wxString, wxString> variableMap = {
4870 {
"COMMENT",
"VALUE" },
4871 {
"VALUE",
"ALTIUM_VALUE" },
4877 if( elem.
text ==
"*" )
4880 wxString paramName = elem.
name.Upper();
4882 if( paramName ==
"SHEETNUMBER" )
4886 else if( paramName ==
"TITLE" )
4890 else if( paramName ==
"REVISION" )
4894 else if( paramName ==
"DATE" )
4898 else if( paramName ==
"COMPANYNAME" )
4919 wxString upperName = elem.
name.Upper();
4921 if( upperName ==
"COMMENT" )
4927 wxString fieldName = elem.
name.Upper();
4929 if( fieldName.IsEmpty() )
4931 int disambiguate = 1;
4935 fieldName = wxString::Format(
"ALTIUM_UNNAMED_%d", disambiguate++ );
4937 if( !symbol->
GetField( fieldName ) )
4941 else if( fieldName ==
"VALUE" )
4943 fieldName =
"ALTIUM_VALUE";
4965 std::vector<LIB_SYMBOL*>& aSymbol,
4966 std::vector<int>& aFontSizes )
4990 std::map<wxString, wxString> variableMap = {
4991 {
"COMMENT",
"VALUE" },
4997 wxString upperName = elem.
name.Upper();
4999 if( upperName ==
"COMMENT" )
5001 field = &libSymbol->GetValueField();
5005 wxString fieldNameStem = elem.
name;
5006 wxString fieldName = fieldNameStem;
5007 int disambiguate = 1;
5009 if( fieldName.IsEmpty() )
5011 fieldNameStem =
"ALTIUM_UNNAMED";
5012 fieldName =
"ALTIUM_UNNAMED_1";
5015 else if( upperName ==
"VALUE" )
5017 fieldNameStem =
"ALTIUM_VALUE";
5018 fieldName =
"ALTIUM_VALUE";
5022 while( libSymbol->GetField( fieldName ) )
5023 fieldName = wxString::Format(
"%s_%d", fieldNameStem, disambiguate++ );
5026 libSymbol->AddField( new_field );
5037 if( elem.
fontId > 0 && elem.
fontId <=
static_cast<int>( aFontSizes.size() ) )
5039 int size = aFontSizes[elem.
fontId - 1];
5053 const std::map<wxString, wxString>& aProperties )
5062 std::vector<LIB_SYMBOL*>& aSymbol )
5066 if( elem.
type != wxS(
"PCBLIB" ) )
5070 if( aSymbol.size() == 0 && !elem.
isCurrent )
5076 wxArrayString fpFilters;
5077 fpFilters.Add( wxString::Format( wxS(
"*%s*" ), elem.
name ) );
5080 if( !aSymbol.empty() )
5086 symbol->SetFPFilters( fpFilters );
5097 m_errorMessages.emplace( wxString::Format( wxT(
"Implementation's owner (%d) not found." ),
5103 const auto& libSymbolIt =
m_libSymbols.find( implementationOwnerIt->second );
5107 m_errorMessages.emplace( wxString::Format( wxT(
"Footprint's owner (%d) not found." ),
5108 implementationOwnerIt->second ),
5115 libSymbolIt->second->SetFPFilters( fpFilters );
5125 wxString>& aProperties )
5142 std::vector<wxString> bodyStyleNames;
5145 bodyStyleNames.push_back( wxString::Format(
"Display %d", i + 1 ) );
5158 std::vector<int> fontSizes;
5159 struct SYMBOL_PIN_FRAC
5168 std::map<wxString, ALTIUM_SYMBOL_DATA> syms = aAltiumLibFile.
GetLibSymbols(
nullptr );
5170 for(
auto& [
name, entry] : syms )
5172 std::map<int, SYMBOL_PIN_FRAC> pinFracs;
5174 if( entry.m_pinsFrac )
5176 auto parse_binary_pin_frac =
5177 [&](
const std::string& binaryData ) -> std::map<wxString, wxString>
5179 std::map<wxString, wxString>
result;
5185 SYMBOL_PIN_FRAC pinFrac;
5189 pinFrac.len_frac = binreader.
ReadInt32();
5190 pinFracs.insert( { pinFracData.first, pinFrac } );
5202 std::vector<LIB_SYMBOL*> symbols;
5209 std::map<wxString, wxString> properties = reader.
ReadProperties();
5214 THROW_IO_ERROR(
"LibSymbol does not start with COMPONENT record" );
5219 auto handleBinaryPinLambda =
5220 [&](
const std::string& binaryData ) -> std::map<wxString, wxString>
5222 std::map<wxString, wxString>
result;
5226 int32_t recordId = binreader.
ReadInt32();
5231 result[
"RECORD"] = wxString::Format(
"%d", recordId );
5233 result[
"OWNERPARTID"] = wxString::Format(
"%d", binreader.
ReadInt16() );
5234 result[
"OWNERPARTDISPLAYMODE"] = wxString::Format(
"%d", binreader.
ReadByte() );
5235 result[
"SYMBOL_INNEREDGE"] = wxString::Format(
"%d", binreader.
ReadByte() );
5236 result[
"SYMBOL_OUTEREDGE"] = wxString::Format(
"%d", binreader.
ReadByte() );
5237 result[
"SYMBOL_INNER"] = wxString::Format(
"%d", binreader.
ReadByte() );
5238 result[
"SYMBOL_OUTER"] = wxString::Format(
"%d", binreader.
ReadByte() );
5241 result[
"ELECTRICAL"] = wxString::Format(
"%d", binreader.
ReadByte() );
5242 result[
"PINCONGLOMERATE"] = wxString::Format(
"%d", binreader.
ReadByte() );
5243 result[
"PINLENGTH"] = wxString::Format(
"%d", binreader.
ReadInt16() );
5244 result[
"LOCATION.X"] = wxString::Format(
"%d", binreader.
ReadInt16() );
5245 result[
"LOCATION.Y"] = wxString::Format(
"%d", binreader.
ReadInt16() );
5251 if(
auto it = pinFracs.find( pin_index ); it != pinFracs.end() )
5253 result[
"LOCATION.X_FRAC"] = wxString::Format(
"%d", it->second.x_frac );
5254 result[
"LOCATION.Y_FRAC"] = wxString::Format(
"%d", it->second.y_frac );
5255 result[
"PINLENGTH_FRAC"] = wxString::Format(
"%d", it->second.len_frac );
5259 std::vector<std::string> partSeqSplit =
split( partSeq,
"|" );
5261 if( partSeqSplit.size() == 3 )
5263 result[
"PART"] = partSeqSplit[0];
5264 result[
"SEQ"] = partSeqSplit[2];
5272 std::map<wxString, wxString> properties = reader.
ReadProperties( handleBinaryPinLambda );
5274 if( properties.empty() )
5323 m_errorMessages.emplace( wxString::Format(
_(
"Unknown or unexpected record id %d found in %s." ),
5343 if( valField.
GetText().IsEmpty() )
5356 wxFileName fn( aLibraryPath );
5358 if( fn.IsFileReadable() && fn.GetModificationTime().IsValid() )
5359 return fn.GetModificationTime().GetValue().GetValue();
5366 const std::map<std::string, UTF8>* aProperties )
5379 std::vector<std::unique_ptr<ALTIUM_COMPOUND_FILE>> compoundFiles;
5381 wxFileName fileName( aLibraryPath );
5386 if( aLibraryPath.Lower().EndsWith( wxS(
".schlib" ) ) )
5390 compoundFiles.push_back( std::make_unique<ALTIUM_COMPOUND_FILE>( aLibraryPath ) );
5392 else if( aLibraryPath.Lower().EndsWith( wxS(
".intlib" ) ) )
5396 std::unique_ptr<ALTIUM_COMPOUND_FILE> intCom = std::make_unique<ALTIUM_COMPOUND_FILE>( aLibraryPath );
5398 std::map<wxString, const CFB::COMPOUND_FILE_ENTRY*> schLibFiles = intCom->EnumDir(
L"SchLib" );
5400 for(
const auto& [schLibName, cfe] : schLibFiles )
5402 std::unique_ptr<ALTIUM_COMPOUND_FILE> decodedStream = std::make_unique<ALTIUM_COMPOUND_FILE>();
5404 if( intCom->DecodeIntLibStream( *cfe, decodedStream.get() ) )
5405 compoundFiles.emplace_back( std::move( decodedStream ) );
5411 for(
const std::unique_ptr<ALTIUM_COMPOUND_FILE>& altiumSchFilePtr : compoundFiles )
5414 cacheMapRef.insert( parsed.begin(), parsed.end() );
5419 catch(
const CFB::CFBException& exception )
5423 catch(
const std::exception& exc )
5425 THROW_IO_ERROR( wxString::Format(
_(
"Error parsing Altium library: %s" ), exc.what() ) );
5431 std::vector<int>& aFontSizes )
5433 const CFB::COMPOUND_FILE_ENTRY* file = aAltiumSchFile.
FindStream( {
"FileHeader" } );
5435 if( file ==
nullptr )
5443 std::map<wxString, wxString> properties = reader.
ReadProperties();
5447 if( libtype.CmpNoCase(
"Protel for Windows - Schematic Library Editor Binary File Version 5.0" ) )
5448 THROW_IO_ERROR(
_(
"Expected Altium Schematic Library file version 5.0" ) );
5450 for(
auto& [key, value] : properties )
5452 wxString upperKey = key.Upper();
5455 if( upperKey.StartsWith(
"SIZE", &remaining ) )
5457 if( !remaining.empty() )
5459 int ind = wxAtoi( remaining );
5461 if(
static_cast<int>( aFontSizes.size() ) < ind )
5462 aFontSizes.resize( ind );
5465 int scaled =
schIUScale.MilsToIU( wxAtoi( value ) * 72.0 / 10.0 );
5466 aFontSizes[ind - 1] = scaled;
5474 const std::map<std::string, UTF8>* aProperties,
5475 std::function<
void(
const wxString&,
LIB_SYMBOL*)> aInserter )
5479 bool powerSymbolsOnly = ( aProperties &&
5486 for(
auto& [libnameStr, libSymbol] : it->second )
5488 if( powerSymbolsOnly && !libSymbol->IsPower() )
5491 aInserter( libnameStr, libSymbol );
5498 const std::map<std::string, UTF8>* aProperties )
5503 aSymbolNameList.Add( aStr );
5509 const wxString& aLibraryPath,
5510 const std::map<std::string, UTF8>* aProperties )
5515 aSymbolList.emplace_back( aSymbol );
5521 const std::map<std::string, UTF8>* aProperties )
5529 auto it2 = it->second.find( aAliasName );
5531 if( it2 != it->second.end() )
const int ALTIUM_COMPONENT_NONE
wxString AltiumPinDesignatorToKiCad(const wxString &aDesignator)
Convert an Altium pin designator string to the equivalent KiCad pin number.
wxString AltiumSchSpecialStringsToKiCadVariables(const wxString &aString, const std::map< wxString, wxString > &aOverrides)
wxString AltiumPinNamesToKiCad(wxString &aString)
LIB_ID AltiumToKiCadLibID(const wxString &aLibName, const wxString &aLibReference)
std::vector< ALTIUM_PROJECT_VARIANT > ParseAltiumProjectVariants(const wxString &aPrjPcbPath)
Parse all [ProjectVariantN] sections from an Altium .PrjPcb project file.
constexpr EDA_IU_SCALE schIUScale
constexpr double ARC_LOW_DEF_MM
void TransformEllipseToBeziers(const ELLIPSE< T > &aEllipse, std::vector< BEZIER< T > > &aBeziers)
Transforms an ellipse or elliptical arc into a set of quadratic Bezier curves that approximate it.
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
std::map< wxString, ValueType, DETAIL::CASE_INSENSITIVE_COMPARER > CASE_INSENSITIVE_MAP
std::map< wxString, wxString > ReadProperties()
size_t GetRemainingBytes() const
std::map< wxString, wxString > ReadProperties(std::function< std::map< wxString, wxString >(const std::string &)> handleBinaryData=[](const std::string &) { return std::map< wxString, wxString >();})
std::string ReadShortPascalString()
std::map< wxString, ALTIUM_SYMBOL_DATA > GetLibSymbols(const CFB::COMPOUND_FILE_ENTRY *aStart) const
const CFB::COMPOUND_FILE_ENTRY * FindStream(const std::vector< std::string > &aStreamPath) const
std::pair< int, std::string * > ReadCompressedString()
static int ReadInt(const std::map< wxString, wxString > &aProps, const wxString &aKey, int aDefault)
static wxString ReadString(const std::map< wxString, wxString > &aProps, const wxString &aKey, const wxString &aDefault)
Bezier curves to polygon converter.
void GetPoly(std::vector< VECTOR2I > &aOutput, int aMaxError=10)
Convert a Bezier curve to a polygon.
Generic cubic Bezier representation.
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr const Vec GetCenter() const
constexpr bool Contains(const Vec &aPoint) const
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
bool IsHorizontal() const
A base class for most all the KiCad significant classes used in schematics and boards.
void SetFlags(EDA_ITEM_FLAGS aMask)
KICAD_T Type() const
Returns the type of object.
void SetBezierC2(const VECTOR2I &aPt)
void SetCenter(const VECTOR2I &aCenter)
FILL_T GetFillMode() const
void SetLineStyle(const LINE_STYLE aStyle)
void SetFillColor(const COLOR4D &aColor)
void RebuildBezierToSegmentsPointsList(int aMaxError)
Rebuild the m_bezierPoints vertex list that approximate the Bezier curve by a list of segments.
void SetStart(const VECTOR2I &aStart)
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
COLOR4D GetFillColor() const
void SetEnd(const VECTOR2I &aEnd)
void SetBezierC1(const VECTOR2I &aPt)
void SetWidth(int aWidth)
void SetFillMode(FILL_T aFill)
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
const EDA_ANGLE & GetTextAngle() const
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
virtual const wxString & GetText() const
Return the string associated with the text object.
void SetTextPos(const VECTOR2I &aPoint)
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
GR_TEXT_H_ALIGN_T GetHorizJustify() const
virtual void SetVisible(bool aVisible)
void SetBold(bool aBold)
Set the text to be bold - this will also update the font if needed.
GR_TEXT_V_ALIGN_T GetVertJustify() const
virtual void SetText(const wxString &aText)
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
EE_TYPE Overlapping(const BOX2I &aRect) const
EE_TYPE OfType(KICAD_T aType) const
This class was created to handle importing ellipses from other file formats that support them nativel...
RAII class to set and restore the fontconfig reporter.
const wxString & GetName() const
Return a brief hard coded name for this IO interface.
REPORTER * m_reporter
Reporter to log errors/warnings to, may be nullptr.
PROGRESS_REPORTER * m_progressReporter
Progress reporter to track the progress of the operation, may be nullptr.
virtual bool CanReadLibrary(const wxString &aFileName) const
Checks if this IO object can read the specified library file/directory.
A color representation with 4 components: red, green, blue, alpha.
COLOR4D WithAlpha(double aAlpha) const
Return a color with the same color, but the given alpha.
COLOR4D & FromCSSRGBA(int aRed, int aGreen, int aBlue, double aAlpha=1.0)
Initialize the color from a RGBA value with 0-255 red/green/blue and 0-1 alpha.
A logical library item identifier and consists of various portions much like a URI.
int SetLibNickname(const UTF8 &aLibNickname)
Override the logical library name portion of the LIB_ID to aLibNickname.
static UTF8 FixIllegalChars(const UTF8 &aLibItemName, bool aLib)
Replace illegal LIB_ID item name characters with underscores '_'.
Define a library symbol object.
void FixupDrawItems()
This function finds the filled draw items that are covering up smaller draw items and replaces their ...
void SetBodyStyleNames(const std::vector< wxString > &aBodyStyleNames)
wxString GetName() const override
void SetUnitCount(int aCount, bool aDuplicateDrawItems)
Set the units per symbol count.
void SetDescription(const wxString &aDescription)
Gets the Description field text value */.
void SetKeyWords(const wxString &aKeyWords)
SCH_FIELD & GetValueField()
Return reference to the value field.
int GetBodyStyleCount() const override
int GetUnitCount() const override
void SetLibId(const LIB_ID &aLibId)
void AddDrawItem(SCH_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
virtual void SetName(const wxString &aName)
SCH_FIELD & GetReferenceField()
Return reference to the reference designator field.
static LOAD_INFO_REPORTER & GetInstance()
Describe the page size and margins of a paper page on which to eventually print or plot.
int GetHeightIU(double aIUScale) const
Gets the page height in IU.
bool SetType(PAGE_SIZE_TYPE aPageSize, bool aIsPortrait=false)
Set the name of the page type and also the sizes and margins commonly associated with that type name.
static void SetCustomWidthMils(double aWidthInMils)
Set the width of Custom page in mils for any custom page constructed or made via SetType() after maki...
static void SetCustomHeightMils(double aHeightInMils)
Set the height of Custom page in mils for any custom page constructed or made via SetType() after mak...
virtual const wxString GetProjectPath() const
Return the full path of the project.
A REFERENCE_IMAGE is a wrapper around a BITMAP_IMAGE that is displayed in an editor as a reference fo...
bool ReadImageFile(const wxString &aFullFilename)
Read and store an image file.
void SetImageScale(double aScale)
Set the image "zoom" value.
A pure virtual class used to derive REPORTER objects from.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Report a string with a given severity.
Holds all the data relating to one schematic.
PROJECT & Project() const
Return a reference to the project this schematic is part of.
bool IsValid() const
A simple test if the schematic is loaded, not a complete one.
void SetTopLevelSheets(const std::vector< SCH_SHEET * > &aSheets)
void SetSize(const VECTOR2I &aSize)
VECTOR2I GetPosition() const override
Class for a wire to bus entry.
VECTOR2I GetPosition() const override
virtual const wxString & GetText() const override
Return the string associated with the text object.
void SetPosition(const VECTOR2I &aPosition) override
void SetText(const wxString &aText) override
void SetNameShown(bool aShown=true)
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this label.
void SetSpinStyle(SPIN_STYLE aSpinStyle) override
void SetSpinStyle(SPIN_STYLE aSpinStyle) override
void ParseFileHeader(const ALTIUM_COMPOUND_FILE &aAltiumSchFile)
void ParseSignalHarness(const std::map< wxString, wxString > &aProperties)
std::map< int, ASCH_TEMPLATE > m_altiumTemplates
std::map< int, ASCH_SYMBOL > m_altiumComponents
void ParsePort(const ASCH_PORT &aElem)
void ParseNote(const std::map< wxString, wxString > &aProperties)
void ParseAltiumSch(const wxString &aFileName)
std::vector< ASCH_PORT > m_altiumPortsCurrentSheet
void ParseSheetName(const std::map< wxString, wxString > &aProperties)
void ParseBusEntry(const std::map< wxString, wxString > &aProperties)
SCH_SHEET * getCurrentSheet()
void ParseStorage(const ALTIUM_COMPOUND_FILE &aAltiumSchFile)
std::map< wxString, LIB_SYMBOL * > m_powerSymbols
void ParseBus(const std::map< wxString, wxString > &aProperties)
void ParseFileName(const std::map< wxString, wxString > &aProperties)
static bool isASCIIFile(const wxString &aFileName)
LIB_SYMBOL * LoadSymbol(const wxString &aLibraryPath, const wxString &aAliasName, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Load a LIB_SYMBOL object having aPartName from the aLibraryPath containing a library format that this...
std::map< int, SCH_SHEET * > m_sheets
void ParseLibHeader(const ALTIUM_COMPOUND_FILE &aAltiumSchFile, std::vector< int > &aFontSizes)
void ParseHarnessPort(const ASCH_PORT &aElem)
void ParseRoundRectangle(const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
int GetModifyHash() const override
Return the modification hash from the library cache.
void ParseLibDesignator(const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym, std::vector< int > &aFontSize=nullint)
std::map< wxString, CASE_INSENSITIVE_MAP< LIB_SYMBOL * > > m_libCache
std::map< int, int > m_altiumImplementationList
void ParseTextFrame(const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym, std::vector< int > &aFontSize=nullint)
void ParsePolygon(const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
void fixupSymbolPinNameNumbers(SYMBOL *aSymbol)
void ParseRecord(int index, std::map< wxString, wxString > &properties, const wxString &aSectionName)
std::vector< ASCH_PORT > m_altiumHarnessPortsCurrentSheet
void ParseDesignator(const std::map< wxString, wxString > &aProperties)
int m_harnessOwnerIndexOffset
void ParsePortHelper(const ASCH_PORT &aElem)
static bool checkFileHeader(const wxString &aFileName)
long long getLibraryTimestamp(const wxString &aLibraryPath) const
void ParseSheetEntry(const std::map< wxString, wxString > &aProperties)
static bool isBinaryFile(const wxString &aFileName)
void ParseHarnessType(const std::map< wxString, wxString > &aProperties)
void ParseJunction(const std::map< wxString, wxString > &aProperties)
void ParseLibParameter(const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym, std::vector< int > &aFontSize=nullint)
void ParseASCIISchematic(const wxString &aFileName)
void ParsePolyline(const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
std::unique_ptr< ASCH_SHEET > m_altiumSheet
void ParseComponent(int aIndex, const std::map< wxString, wxString > &aProperties)
std::unique_ptr< TITLE_BLOCK > m_currentTitleBlock
SCH_SHEET * LoadSchematicProject(SCHEMATIC *aSchematic, const std::map< std::string, UTF8 > *aProperties)
void ParseImage(const std::map< wxString, wxString > &aProperties)
void ParseArc(const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
void ParseNetLabel(const std::map< wxString, wxString > &aProperties)
void ParseNoERC(const std::map< wxString, wxString > &aProperties)
SCH_SHEET * LoadSchematicFile(const wxString &aFileName, SCHEMATIC *aSchematic, SCH_SHEET *aAppendToMe=nullptr, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Load information from some input file format that this SCH_IO implementation knows about,...
std::unordered_map< wxString, SEVERITY > m_errorMessages
void ParseImplementationList(int aIndex, const std::map< wxString, wxString > &aProperties)
std::vector< LIB_SYMBOL * > ParseLibComponent(const std::map< wxString, wxString > &aProperties)
void ParseSheet(const std::map< wxString, wxString > &aProperties)
void ParseParameter(const std::map< wxString, wxString > &aProperties)
bool ShouldPutItemOnSheet(int aOwnerindex)
void AddLibTextBox(const ASCH_TEXT_FRAME *aElem, std::vector< LIB_SYMBOL * > &aSymbol=nullsym, std::vector< int > &aFontSize=nullint)
bool CanReadSchematicFile(const wxString &aFileName) const override
Checks if this SCH_IO can read the specified schematic file.
void ParsePieChart(const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
void ParseEllipticalArc(const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
std::map< int, HARNESS > m_altiumHarnesses
void ParseEllipse(const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
void ParseWire(const std::map< wxString, wxString > &aProperties)
void ParseHarnessEntry(const std::map< wxString, wxString > &aProperties)
void EnumerateSymbolLib(wxArrayString &aSymbolNameList, const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Populate a list of LIB_SYMBOL alias names contained within the library aLibraryPath.
void ParseImplementation(const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
void ParseTemplate(int aIndex, const std::map< wxString, wxString > &aProperties)
void ParseAdditional(const ALTIUM_COMPOUND_FILE &aAltiumSchFile)
void AddTextBox(const ASCH_TEXT_FRAME *aElem)
void ParsePowerPort(const std::map< wxString, wxString > &aProperties)
bool CanReadLibrary(const wxString &aFileName) const override
Checks if this IO object can read the specified library file/directory.
std::map< const SCH_SYMBOL *, wxString > m_altiumSymbolToUid
const ASCH_STORAGE_FILE * GetFileFromStorage(const wxString &aFilename) const
void ParseRectangle(const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
void doEnumerateSymbolLib(const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties, std::function< void(const wxString &, LIB_SYMBOL *)> aInserter)
std::vector< ASCH_STORAGE_FILE > m_altiumStorage
SCH_SHEET_PATH m_sheetPath
void ParseLabel(const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym, std::vector< int > &aFontSize=nullint)
CASE_INSENSITIVE_MAP< LIB_SYMBOL * > ParseLibFile(const ALTIUM_COMPOUND_FILE &aAltiumSchFile)
void ParseBezier(const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
void ParseLine(const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
void ParseCircle(const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
std::map< int, SCH_SYMBOL * > m_symbols
void ParseSheetSymbol(int aIndex, const std::map< wxString, wxString > &aProperties)
std::map< wxString, long long > m_timestamps
wxFileName getLibFileName()
SCH_SCREEN * getCurrentScreen()
void ParsePin(const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
std::map< int, LIB_SYMBOL * > m_libSymbols
void ParseHarnessConnector(int aIndex, const std::map< wxString, wxString > &aProperties)
void ensureLoadedLibrary(const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties)
virtual bool CanReadSchematicFile(const wxString &aFileName) const
Checks if this SCH_IO can read the specified schematic file.
SCH_IO(const wxString &aName)
Base class for any item which can be embedded within the SCHEMATIC container class,...
virtual void SetBodyStyle(int aBodyStyle)
virtual void SetUnit(int aUnit)
void SetShape(LABEL_FLAG_SHAPE aShape)
void AutoplaceFields(SCH_SCREEN *aScreen, AUTOPLACE_ALGO aAlgo) override
virtual void SetSpinStyle(SPIN_STYLE aSpinStyle)
Segment description base class to describe items which have 2 end points (track, wire,...
void SetStartPoint(const VECTOR2I &aPosition)
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
bool IsWire() const
Return true if the line is a wire.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void SetLineColor(const COLOR4D &aColor)
void SetLineWidth(const int aSize)
VECTOR2I GetEndPoint() const
VECTOR2I GetStartPoint() const
SEG GetSeg() const
Get the geometric aspect of the wire as a SEG.
bool IsBus() const
Return true if the line is a bus.
virtual void SetStroke(const STROKE_PARAMS &aStroke) override
COLOR4D GetLineColor() const
Return COLOR4D::UNSPECIFIED if a custom color hasn't been set for this line.
void SetEndPoint(const VECTOR2I &aPosition)
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
void UpdateSymbolLinks(REPORTER *aReporter=nullptr)
Initialize the LIB_SYMBOL reference for each SCH_SYMBOL found in the full schematic.
std::vector< SCH_SHEET_INSTANCE > m_sheetInstances
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
void Append(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
void AddBusAlias(std::shared_ptr< BUS_ALIAS > aAlias)
Add a bus alias definition.
void SetPageSettings(const PAGE_INFO &aPageSettings)
EE_RTREE & Items()
Get the full RTree, usually for iterating.
const KIID & GetUuid() const
bool IsTerminalPoint(const VECTOR2I &aPosition, int aLayer) const
Test if aPosition is a connection point on aLayer.
void SetFileName(const wxString &aFileName)
Set the file name for this screen to aFileName.
bool Remove(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
Remove aItem from the schematic associated with this screen.
void SetPosition(const VECTOR2I &aPos) override
void SetFilled(bool aFilled) override
void SetStroke(const STROKE_PARAMS &aStroke) override
void AddPoint(const VECTOR2I &aPosition)
STROKE_PARAMS GetStroke() const override
VECTOR2I GetPosition() const override
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
void SetPageNumber(const wxString &aPageNumber)
Set the sheet instance user definable page number.
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
Define a sheet pin (label) used in sheets to create hierarchical schematics.
void SetPosition(const VECTOR2I &aPosition) override
void SetSide(SHEET_SIDE aEdge)
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
void SetBorderColor(KIGFX::COLOR4D aColor)
void SetFileName(const wxString &aFilename)
wxString GetFileName() const
Return the filename corresponding to this sheet.
void SetBackgroundColor(KIGFX::COLOR4D aColor)
void SetName(const wxString &aName)
SCH_SCREEN * GetScreen() const
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
Variant information for a schematic symbol.
void InitializeAttributes(const SCH_SYMBOL &aSymbol)
void SetLibId(const LIB_ID &aName)
const std::vector< SCH_SYMBOL_INSTANCE > & GetInstances() const
void SetPosition(const VECTOR2I &aPosition) override
void SetBodyStyle(int aBodyStyle) override
bool AddSheetPathReferenceEntryIfMissing(const KIID_PATH &aSheetPath)
Add an instance to the alternate references list (m_instances), if this entry does not already exist.
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly) const override
Populate a std::vector with SCH_FIELDs, sorted in ordinal order.
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
void SetFootprintFieldText(const wxString &aFootprint)
VECTOR2I GetPosition() const override
void SetValueFieldText(const wxString &aValue, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
void AddVariant(const SCH_SHEET_PATH &aInstance, const SCH_SYMBOL_VARIANT &aVariant)
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
void SetLibSymbol(LIB_SYMBOL *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
VECTOR2I GetPosition() const override
virtual void Rotate90(bool aClockwise)
void SetPosition(const VECTOR2I &aPosition) override
Simple container to manage line stroke parameters.
void SetLineStyle(LINE_STYLE aLineStyle)
void SetWidth(int aWidth)
void SetColor(const KIGFX::COLOR4D &aColor)
KIGFX::COLOR4D GetColor() const
static const char * PropPowerSymsOnly
A base class for LIB_SYMBOL and SCH_SYMBOL.
virtual void SetShowPinNumbers(bool aShow)
Set or clear the pin number visibility flag.
const TRANSFORM & GetTransform() const
virtual void SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
std::map< wxString, wxString > m_Fields
bool m_ExcludedFromPosFiles
constexpr extended_type SquaredEuclideanNorm() const
Compute the squared euclidean norm of the vector, which is defined as (x ** 2 + y ** 2).
static REPORTER & GetInstance()
#define DEFAULT_PINNUM_SIZE
The default pin name size when creating pins(can be changed in preference menu)
#define DEFAULT_PINNAME_SIZE
The default selection highlight thickness (can be changed in preference menu)
#define DEFAULT_TEXT_SIZE
Ratio of the font height to the baseline of the text above the wire.
static constexpr EDA_ANGLE ANGLE_0
static constexpr EDA_ANGLE ANGLE_VERTICAL
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
#define IS_NEW
New item, just created.
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
@ FILLED_WITH_BG_BODYCOLOR
@ FILLED_SHAPE
Fill with object color.
static const std::string KiCadSchematicFileExtension
static const std::string KiCadSymbolLibFileExtension
#define THROW_IO_ERROR(msg)
macro which captures the "call site" values of FILE_, __FUNCTION & LINE
constexpr int Mils2IU(const EDA_IU_SCALE &aIuScale, int mils)
bool fileStartsWithPrefix(const wxString &aFilePath, const wxString &aPrefix, bool aIgnoreWhitespace)
Check if a file starts with a defined string.
const std::vector< uint8_t > COMPOUND_FILE_HEADER
bool fileHasBinaryHeader(const wxString &aFilePath, const std::vector< uint8_t > &aHeader, size_t aOffset)
Check if a file starts with a defined binary header.
const VECTOR2I & GetOtherEnd(const SEG &aSeg, const VECTOR2I &aPoint)
Get the end point of the segment that is not the given point.
bool signbit(T v)
Integral version of std::signbit that works all compilers.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
@ PT_INPUT
usual pin input: must be connected
@ PT_TRISTATE
tri state bus pin
@ PT_BIDI
input or output (like port for a microprocessor)
@ PT_OPENEMITTER
pin type open emitter
@ PT_OPENCOLLECTOR
pin type open collector
@ PT_POWER_IN
power input (GND, VCC for ICs). Must be connected to a power output.
@ PT_UNSPECIFIED
unknown electrical properties: creates always a warning when connected
@ PT_PASSIVE
pin for passive symbols: must be connected, and can be connected to any pin.
@ PIN_UP
The pin extends upwards from the connection point: Probably on the bottom side of the symbol.
@ PIN_RIGHT
The pin extends rightwards from the connection point.
@ PIN_LEFT
The pin extends leftwards from the connection point: Probably on the right side of the symbol.
@ PIN_DOWN
The pin extends downwards from the connection: Probably on the top side of the symbol.
static COLOR4D GetColorFromInt(int color)
static void SetLibShapeFillAndColor(const ASCH_FILL_INTERFACE &elem, SCH_SHAPE *shape, ALTIUM_SCH_RECORD aType, int aStrokeColor)
VECTOR2I HelperGeneratePowerPortGraphics(LIB_SYMBOL *aKsymbol, ASCH_POWER_PORT_STYLE aStyle, REPORTER *aReporter)
static void SetSchShapeLine(const ASCH_BORDER_INTERFACE &elem, SCH_SHAPE *shape)
static const VECTOR2I GetRelativePosition(const VECTOR2I &aPosition, const SCH_SYMBOL *aSymbol)
static void SetLibShapeLine(const ASCH_BORDER_INTERFACE &elem, SCH_SHAPE *shape, ALTIUM_SCH_RECORD aType)
void AdjustTextForSymbolOrientation(SCH_TEXT *aText, const ASCH_SYMBOL &aSymbol)
static LINE_STYLE GetPlotDashType(const ASCH_POLYLINE_LINESTYLE linestyle)
static void SetSchShapeFillAndColor(const ASCH_FILL_INTERFACE &elem, SCH_SHAPE *shape)
void AdjustFieldForSymbolOrientation(SCH_FIELD *aField, const ASCH_SYMBOL &aSymbol)
void SetTextPositioning(EDA_TEXT *text, ASCH_LABEL_JUSTIFICATION justification, ASCH_RECORD_ORIENTATION orientation)
Utility functions for working with shapes.
static std::vector< std::string > split(const std::string &aStr, const std::string &aDelim)
Split the input string into a vector of output strings.
LINE_STYLE
Dashed line types.
A project-level assembly variant parsed from an Altium .PrjPcb file.
A single component variation within an Altium project variant.
std::vector< VECTOR2I > points
std::vector< VECTOR2I > points
ASCH_LABEL_JUSTIFICATION justification
ASCH_RECORD_ORIENTATION orientation
ASCH_RECORD_ORIENTATION orientation
int m_primaryConnectionPosition
ASCH_SHEET_ENTRY_SIDE m_harnessConnectorSide
ASCH_SHEET_ENTRY_SIDE Side
ASCH_RECORD_ORIENTATION orientation
ASCH_LABEL_JUSTIFICATION justification
ASCH_POLYLINE_LINESTYLE LineStyle
ASCH_LABEL_JUSTIFICATION justification
ASCH_RECORD_ORIENTATION orientation
ASCH_RECORD_ORIENTATION orientation
ASCH_LABEL_JUSTIFICATION justification
ASCH_PIN_SYMBOL::PTYPE symbolOuterEdge
ASCH_PIN_ELECTRICAL electrical
ASCH_PIN_SYMBOL::PTYPE symbolInnerEdge
ASCH_RECORD_ORIENTATION orientation
std::vector< VECTOR2I > points
ASCH_POLYLINE_LINESTYLE LineStyle
std::vector< VECTOR2I > Points
ASCH_POWER_PORT_STYLE style
ASCH_RECORD_ORIENTATION orientation
ASCH_SHEET_ENTRY_SIDE side
ASCH_RECORD_ORIENTATION orientation
std::vector< VECTOR2I > points
wxString componentdescription
wxString sourcelibraryname
ASCH_TEXT_FRAME_ALIGNMENT Alignment
std::vector< VECTOR2I > points
int m_primaryConnectionPosition
ASCH_SHEET_ENTRY_SIDE m_harnessConnectorSide
std::vector< HARNESS_PORT > m_ports
A simple container for sheet instance information.
@ USER
The field ID hasn't been set yet; field is invalid.
@ INTERSHEET_REFS
Global label cross-reference page numbers.
@ DESCRIPTION
Field Description of part, i.e. "1/4W 1% Metal Film Resistor".
@ FOOTPRINT
Field Name Module PCB, i.e. "16DIP300".
@ REFERENCE
Field Reference of part, i.e. "IC21".
@ VALUE
Field Value of part, i.e. "3.3K".
KIBIS top(path, &reporter)
SHAPE_CIRCLE circle(c.m_circle_center, c.m_circle_radius)
wxString result
Test unit parsing edge cases and error handling.
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
GR_TEXT_V_ALIGN_T
This is API surface mapped to common.types.VertialAlignment.
VECTOR2< int32_t > VECTOR2I
Definition of file extensions used in Kicad.