Formatting

This commit is contained in:
WhiteChairFromIkea 2022-08-10 11:00:41 +03:00 committed by Jeff Young
parent 94d386d7ee
commit 088ddf82eb
3 changed files with 159 additions and 159 deletions

View File

@ -111,9 +111,9 @@ ASCH_STORAGE_FILE::ASCH_STORAGE_FILE( ALTIUM_PARSER& aReader )
ASCH_ADDITIONAL_FILE::ASCH_ADDITIONAL_FILE( ALTIUM_PARSER& aReader ) ASCH_ADDITIONAL_FILE::ASCH_ADDITIONAL_FILE( ALTIUM_PARSER& aReader )
{ {
aReader.Skip( 5 ); aReader.Skip( 5 );
filename = aReader.ReadWxString(); FileName = aReader.ReadWxString();
uint32_t dataSize = aReader.Read<uint32_t>(); uint32_t dataSize = aReader.Read<uint32_t>();
data = aReader.ReadVector( dataSize ); Data = aReader.ReadVector( dataSize );
if( aReader.HasParsingError() ) if( aReader.HasParsingError() )
THROW_IO_ERROR( "Additional stream was not parsed correctly" ); THROW_IO_ERROR( "Additional stream was not parsed correctly" );
@ -415,21 +415,21 @@ ASCH_SIGNAL_HARNESS::ASCH_SIGNAL_HARNESS( const std::map<wxString, wxString>& aP
{ {
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::SIGNAL_HARNESS ); wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::SIGNAL_HARNESS );
ownerpartid = ReadOwnerPartId( aProps ); OwnerPartID = ReadOwnerPartId( aProps );
int locationCount = ALTIUM_PARSER::ReadInt( aProps, "LOCATIONCOUNT", 0 ); int locationCount = ALTIUM_PARSER::ReadInt( aProps, "LOCATIONCOUNT", 0 );
for( int i = 1; i <= locationCount; i++ ) for( int i = 1; i <= locationCount; i++ )
{ {
const wxString si = std::to_string( i ); const wxString si = std::to_string( i );
points.emplace_back( ReadKiCadUnitFrac( aProps, "X" + si ), Points.emplace_back( ReadKiCadUnitFrac( aProps, "X" + si ),
-ReadKiCadUnitFrac( aProps, "Y" + si ) ); -ReadKiCadUnitFrac( aProps, "Y" + si ) );
} }
indexInSheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", 0 ); IndexInSheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", 0 );
color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 ); Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
lineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" ); LineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
} }
@ -437,14 +437,14 @@ ASCH_HARNESS_CONNECTOR::ASCH_HARNESS_CONNECTOR( const std::map<wxString, wxStrin
{ {
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::HARNESS_CONNECTOR ); wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::HARNESS_CONNECTOR );
ownerpartid = ReadOwnerPartId( aProps ); OwnerPartID = ReadOwnerPartId( aProps );
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ), Location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) ); -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
size = wxSize( ReadKiCadUnitFrac( aProps, "XSIZE" ), ReadKiCadUnitFrac( aProps, "YSIZE" ) ); Size = wxSize( ReadKiCadUnitFrac( aProps, "XSIZE" ), ReadKiCadUnitFrac( aProps, "YSIZE" ) );
color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 ); Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
areaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 ); AreaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 );
} }
@ -454,22 +454,22 @@ ASCH_HARNESS_ENTRY::ASCH_HARNESS_ENTRY( const std::map<wxString, wxString>& aPro
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::HARNESS_ENTRY ); wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::HARNESS_ENTRY );
// ownerindex = ReadOwnerIndex( aProps ); // use SCH_ALTIUM_PLUGIN::m_harnessEntryParent instead, because this property sometimes does not exist in altium file! // ownerindex = ReadOwnerIndex( aProps ); // use SCH_ALTIUM_PLUGIN::m_harnessEntryParent instead, because this property sometimes does not exist in altium file!
ownerpartid = ReadOwnerPartId( aProps ); OwnerPartID = ReadOwnerPartId( aProps );
indexInSheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", 0 ); IndexInSheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", 0 );
distanceFromTop = ReadKiCadUnitFrac1( aProps, "DISTANCEFROMTOP" ); DistanceFromTop = ReadKiCadUnitFrac1( aProps, "DISTANCEFROMTOP" );
side = ReadEnum<ASCH_SHEET_ENTRY_SIDE>( aProps, "SIDE", 0, 3, ASCH_SHEET_ENTRY_SIDE::LEFT ); Side = ReadEnum<ASCH_SHEET_ENTRY_SIDE>( aProps, "SIDE", 0, 3, ASCH_SHEET_ENTRY_SIDE::LEFT );
name = ALTIUM_PARSER::ReadString( aProps, "NAME", "" ); Name = ALTIUM_PARSER::ReadString( aProps, "NAME", "" );
ownerIndexAdditionalList = ALTIUM_PARSER::ReadBool( aProps, "OWNERINDEXADDITIONALLIST", true ); OwnerIndexAdditionalList = ALTIUM_PARSER::ReadBool( aProps, "OWNERINDEXADDITIONALLIST", true );
color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 ); Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
areaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 ); AreaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 );
textColor = ALTIUM_PARSER::ReadInt( aProps, "TEXTCOLOR", 0 ); TextColor = ALTIUM_PARSER::ReadInt( aProps, "TEXTCOLOR", 0 );
textFontId = ALTIUM_PARSER::ReadInt( aProps, "TEXTFONTID", 0 ); TextFontID = ALTIUM_PARSER::ReadInt( aProps, "TEXTFONTID", 0 );
} }
@ -478,19 +478,19 @@ ASCH_HARNESS_TYPE::ASCH_HARNESS_TYPE( const std::map<wxString, wxString>& aProps
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::HARNESS_TYPE ); wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::HARNESS_TYPE );
//ownerindex = ReadOwnerIndex( aProps ); // use SCH_ALTIUM_PLUGIN::m_harnessEntryParent instead! //ownerindex = ReadOwnerIndex( aProps ); // use SCH_ALTIUM_PLUGIN::m_harnessEntryParent instead!
ownerpartid = ReadOwnerPartId( aProps ); OwnerPartID = ReadOwnerPartId( aProps );
text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" ); Text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" );
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ), Location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) ); -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
isHidden = ALTIUM_PARSER::ReadBool( aProps, "ISHIDDEN", false ); IsHidden = ALTIUM_PARSER::ReadBool( aProps, "ISHIDDEN", false );
ownerIndexAdditionalList = ALTIUM_PARSER::ReadBool( aProps, "OWNERINDEXADDITIONALLIST", true ); OwnerIndexAdditionalList = ALTIUM_PARSER::ReadBool( aProps, "OWNERINDEXADDITIONALLIST", true );
indexInSheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", 0 ); IndexInSheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", 0 );
color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 ); Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
fontId = ALTIUM_PARSER::ReadInt( aProps, "TEXTFONTID", 0 ); FontID = ALTIUM_PARSER::ReadInt( aProps, "TEXTFONTID", 0 );
} }
@ -574,26 +574,26 @@ ASCH_PORT::ASCH_PORT( const std::map<wxString, wxString>& aProps )
{ {
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::PORT ); wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::PORT );
ownerpartid = ReadOwnerPartId( aProps ); OwnerPartID = ReadOwnerPartId( aProps );
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ), Location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) ); -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
name = ALTIUM_PARSER::ReadString( aProps, "NAME", "" ); Name = ALTIUM_PARSER::ReadString( aProps, "NAME", "" );
harnessType = ALTIUM_PARSER::ReadString( aProps, "HARNESSTYPE", "" ); HarnessType = ALTIUM_PARSER::ReadString( aProps, "HARNESSTYPE", "" );
width = ReadKiCadUnitFrac( aProps, "WIDTH" ); Width = ReadKiCadUnitFrac( aProps, "WIDTH" );
height = ReadKiCadUnitFrac( aProps, "HEIGHT" ); Height = ReadKiCadUnitFrac( aProps, "HEIGHT" );
iotype = ReadEnum<ASCH_PORT_IOTYPE>( aProps, "IOTYPE", 0, 3, ASCH_PORT_IOTYPE::UNSPECIFIED ); IOtype = ReadEnum<ASCH_PORT_IOTYPE>( aProps, "IOTYPE", 0, 3, ASCH_PORT_IOTYPE::UNSPECIFIED );
style = ReadEnum<ASCH_PORT_STYLE>( aProps, "STYLE", 0, 7, ASCH_PORT_STYLE::NONE_HORIZONTAL ); Style = ReadEnum<ASCH_PORT_STYLE>( aProps, "STYLE", 0, 7, ASCH_PORT_STYLE::NONE_HORIZONTAL );
areaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 ); AreaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 );
color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 ); Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
fontId = ALTIUM_PARSER::ReadInt( aProps, "TEXTFONTID", 0 ); FontID = ALTIUM_PARSER::ReadInt( aProps, "TEXTFONTID", 0 );
textColor = ALTIUM_PARSER::ReadInt( aProps, "TEXTCOLOR", 0 ); TextColor = ALTIUM_PARSER::ReadInt( aProps, "TEXTCOLOR", 0 );
alignment = ReadEnum<ASCH_TEXT_FRAME_ALIGNMENT>( aProps, "ALIGNMENT", 1, 3, ASCH_TEXT_FRAME_ALIGNMENT::LEFT ); Alignment = ReadEnum<ASCH_TEXT_FRAME_ALIGNMENT>( aProps, "ALIGNMENT", 1, 3, ASCH_TEXT_FRAME_ALIGNMENT::LEFT );
} }
@ -697,16 +697,16 @@ ASCH_SHEET_FONT::ASCH_SHEET_FONT( const std::map<wxString, wxString>& aProps, in
const wxString sid = std::to_string( aId ); const wxString sid = std::to_string( aId );
fontname = ALTIUM_PARSER::ReadString( aProps, "FONTNAME" + sid, "" ); FontName = ALTIUM_PARSER::ReadString( aProps, "FONTNAME" + sid, "" );
size = ReadKiCadUnitFrac( aProps, "SIZE" + sid ); Size = ReadKiCadUnitFrac( aProps, "SIZE" + sid );
rotation = ALTIUM_PARSER::ReadInt( aProps, "ROTATION" + sid, 0 ); Rotation = ALTIUM_PARSER::ReadInt( aProps, "ROTATION" + sid, 0 );
italic = ALTIUM_PARSER::ReadBool( aProps, "ITALIC" + sid, false ); Italic = ALTIUM_PARSER::ReadBool( aProps, "ITALIC" + sid, false );
bold = ALTIUM_PARSER::ReadBool( aProps, "BOLD" + sid, false ); Bold = ALTIUM_PARSER::ReadBool( aProps, "BOLD" + sid, false );
underline = ALTIUM_PARSER::ReadBool( aProps, "UNDERLINE" + sid, false ); Underline = ALTIUM_PARSER::ReadBool( aProps, "UNDERLINE" + sid, false );
areaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR" + sid, 0 ); AreaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR" + sid, 0 );
} }
VECTOR2I ASchSheetGetSize( ASCH_SHEET_SIZE aSheetSize ) VECTOR2I ASchSheetGetSize( ASCH_SHEET_SIZE aSheetSize )

View File

@ -50,8 +50,8 @@ struct ASCH_STORAGE_FILE
struct ASCH_ADDITIONAL_FILE struct ASCH_ADDITIONAL_FILE
{ {
wxString filename; wxString FileName;
std::vector<char> data; std::vector<char> Data;
explicit ASCH_ADDITIONAL_FILE( ALTIUM_PARSER& aReader ); explicit ASCH_ADDITIONAL_FILE( ALTIUM_PARSER& aReader );
}; };
@ -417,16 +417,16 @@ struct ASCH_LINE
struct ASCH_SIGNAL_HARNESS struct ASCH_SIGNAL_HARNESS
{ {
int ownerpartid; // always -1, can be safely ignored I think int OwnerPartID; // always -1, can be safely ignored I think
VECTOR2I point1; VECTOR2I Point1;
VECTOR2I point2; VECTOR2I Point2;
std::vector<VECTOR2I> points; std::vector<VECTOR2I> Points;
int color; int Color;
int indexInSheet; int IndexInSheet;
int lineWidth; int LineWidth;
explicit ASCH_SIGNAL_HARNESS( const std::map<wxString, wxString>& aProps ); explicit ASCH_SIGNAL_HARNESS( const std::map<wxString, wxString>& aProps );
}; };
@ -434,18 +434,18 @@ struct ASCH_SIGNAL_HARNESS
struct ASCH_HARNESS_CONNECTOR struct ASCH_HARNESS_CONNECTOR
{ {
int ownerpartid; // always -1, can be safely ignored I think int OwnerPartID; // always -1, can be safely ignored I think
VECTOR2I location; VECTOR2I Location;
wxSize size; wxSize Size;
int areaColor; int AreaColor;
int color; int Color;
int indexInSheet; // Keeps increasing nicely int IndexInSheet; // Keeps increasing nicely
int lineWidth; int LineWidth;
//int locationX; // keep just in case //int locationX; // keep just in case
//int locationY; //int locationY;
int locationPrimaryConnectionPosition; int LocationPrimaryConnectionPosition;
//int xSize; // keep just in case //int xSize; // keep just in case
//int ySize; //int ySize;
@ -456,20 +456,20 @@ struct ASCH_HARNESS_CONNECTOR
struct ASCH_HARNESS_ENTRY struct ASCH_HARNESS_ENTRY
{ {
// int ownerindex; // Completely random, mostly this entry exists, but not always, should not be used! // int ownerindex; // Completely random, mostly this entry exists, but not always, should not be used!
int ownerpartid; // always -1, can be safely ignored I think int OwnerPartID; // always -1, can be safely ignored I think
int areaColor; int AreaColor;
int color; int Color;
int distanceFromTop; int DistanceFromTop;
int indexInSheet; int IndexInSheet;
int textColor; int TextColor;
int textFontId; int TextFontID;
int textStyle; int TextStyle;
bool ownerIndexAdditionalList; // what is that? bool OwnerIndexAdditionalList; // what is that?
wxString name; wxString Name;
ASCH_SHEET_ENTRY_SIDE side; ASCH_SHEET_ENTRY_SIDE Side;
explicit ASCH_HARNESS_ENTRY( const std::map<wxString, wxString>& aProps ); explicit ASCH_HARNESS_ENTRY( const std::map<wxString, wxString>& aProps );
}; };
@ -478,18 +478,18 @@ struct ASCH_HARNESS_ENTRY
struct ASCH_HARNESS_TYPE struct ASCH_HARNESS_TYPE
{ {
//int ownerindex; // use SCH_ALTIUM_PLUGIN::m_harnessEntryParent instead! //int ownerindex; // use SCH_ALTIUM_PLUGIN::m_harnessEntryParent instead!
int ownerpartid; // Always -1, presumably safe to remuve int OwnerPartID; // Always -1, presumably safe to remuve
int color; int Color;
int indexInSheet; int IndexInSheet;
int fontId; int FontID;
bool isHidden; bool IsHidden;
bool ownerIndexAdditionalList; // what is that? bool OwnerIndexAdditionalList; // what is that?
VECTOR2I location; VECTOR2I Location;
wxString text; wxString Text;
explicit ASCH_HARNESS_TYPE( const std::map<wxString, wxString>& aProps ); explicit ASCH_HARNESS_TYPE( const std::map<wxString, wxString>& aProps );
}; };
@ -594,23 +594,23 @@ struct ASCH_POWER_PORT
struct ASCH_PORT struct ASCH_PORT
{ {
int ownerpartid; int OwnerPartID;
wxString name; wxString Name;
wxString harnessType; wxString HarnessType;
VECTOR2I location; VECTOR2I Location;
int width; int Width;
int height; int Height;
int areaColor; int AreaColor;
int color; int Color;
int textColor; int TextColor;
int fontId; int FontID;
ASCH_TEXT_FRAME_ALIGNMENT alignment; ASCH_TEXT_FRAME_ALIGNMENT Alignment;
ASCH_PORT_IOTYPE iotype; ASCH_PORT_IOTYPE IOtype;
ASCH_PORT_STYLE style; ASCH_PORT_STYLE Style;
explicit ASCH_PORT( const std::map<wxString, wxString>& aProps ); explicit ASCH_PORT( const std::map<wxString, wxString>& aProps );
}; };
@ -689,15 +689,15 @@ struct ASCH_IMAGE
struct ASCH_SHEET_FONT struct ASCH_SHEET_FONT
{ {
wxString fontname; wxString FontName;
int size; int Size;
int rotation; int Rotation;
int areaColor; int AreaColor;
bool italic; bool Italic;
bool bold; bool Bold;
bool underline; bool Underline;
explicit ASCH_SHEET_FONT( const std::map<wxString, wxString>& aProps, int aId ); explicit ASCH_SHEET_FONT( const std::map<wxString, wxString>& aProps, int aId );
}; };

View File

@ -928,9 +928,9 @@ void SCH_ALTIUM_PLUGIN::ParseLabel( const std::map<wxString, wxString>& aPropert
if( m_altiumSheet && fontId > 0 && fontId <= m_altiumSheet->fonts.size() ) if( m_altiumSheet && fontId > 0 && fontId <= m_altiumSheet->fonts.size() )
{ {
const ASCH_SHEET_FONT& font = m_altiumSheet->fonts.at( fontId - 1 ); const ASCH_SHEET_FONT& font = m_altiumSheet->fonts.at( fontId - 1 );
textItem->SetItalic( font.italic ); textItem->SetItalic( font.Italic );
textItem->SetBold( font.bold ); textItem->SetBold( font.Bold );
textItem->SetTextSize( { font.size / 2, font.size / 2 } ); textItem->SetTextSize( { font.Size / 2, font.Size / 2 } );
} }
textItem->SetFlags(IS_NEW ); textItem->SetFlags(IS_NEW );
@ -964,9 +964,9 @@ void SCH_ALTIUM_PLUGIN::ParseLabel( const std::map<wxString, wxString>& aPropert
if( m_altiumSheet && fontId > 0 && fontId <= m_altiumSheet->fonts.size() ) if( m_altiumSheet && fontId > 0 && fontId <= m_altiumSheet->fonts.size() )
{ {
const ASCH_SHEET_FONT& font = m_altiumSheet->fonts.at( fontId - 1 ); const ASCH_SHEET_FONT& font = m_altiumSheet->fonts.at( fontId - 1 );
textItem->SetItalic( font.italic ); textItem->SetItalic( font.Italic );
textItem->SetBold( font.bold ); textItem->SetBold( font.Bold );
textItem->SetTextSize( { font.size / 2, font.size / 2 } ); textItem->SetTextSize( { font.Size / 2, font.Size / 2 } );
} }
} }
} }
@ -1002,9 +1002,9 @@ void SCH_ALTIUM_PLUGIN::ParseTextFrame( const std::map<wxString, wxString>& aPro
if( m_altiumSheet && fontId > 0 && fontId <= m_altiumSheet->fonts.size() ) if( m_altiumSheet && fontId > 0 && fontId <= m_altiumSheet->fonts.size() )
{ {
const ASCH_SHEET_FONT& font = m_altiumSheet->fonts.at( fontId - 1 ); const ASCH_SHEET_FONT& font = m_altiumSheet->fonts.at( fontId - 1 );
text->SetItalic( font.italic ); text->SetItalic( font.Italic );
text->SetBold( font.bold ); text->SetBold( font.Bold );
text->SetTextSize( { font.size / 2, font.size / 2 } ); text->SetTextSize( { font.Size / 2, font.Size / 2 } );
} }
text->SetFlags( IS_NEW ); text->SetFlags( IS_NEW );
@ -1044,9 +1044,9 @@ void SCH_ALTIUM_PLUGIN::ParseNote( const std::map<wxString, wxString>& aProperti
if( m_altiumSheet && fontId > 0 && fontId <= m_altiumSheet->fonts.size() ) if( m_altiumSheet && fontId > 0 && fontId <= m_altiumSheet->fonts.size() )
{ {
const ASCH_SHEET_FONT& font = m_altiumSheet->fonts.at( fontId - 1 ); const ASCH_SHEET_FONT& font = m_altiumSheet->fonts.at( fontId - 1 );
text->SetItalic( font.italic ); text->SetItalic( font.Italic );
text->SetBold( font.bold ); text->SetBold( font.Bold );
text->SetTextSize( { font.size / 2, font.size / 2 } ); text->SetTextSize( { font.Size / 2, font.Size / 2 } );
} }
text->SetFlags( IS_NEW ); text->SetFlags( IS_NEW );
@ -1471,15 +1471,15 @@ void SCH_ALTIUM_PLUGIN::ParseSignalHarness( const std::map<wxString, wxString>&
{ {
ASCH_SIGNAL_HARNESS elem( aProperties ); ASCH_SIGNAL_HARNESS elem( aProperties );
if( elem.ownerpartid == ALTIUM_COMPONENT_NONE ) if( elem.OwnerPartID == ALTIUM_COMPONENT_NONE )
{ {
SCH_SHAPE* poly = new SCH_SHAPE( SHAPE_T::POLY ); SCH_SHAPE* poly = new SCH_SHAPE( SHAPE_T::POLY );
for( VECTOR2I& point : elem.points ) for( VECTOR2I& point : elem.Points )
poly->AddPoint( point + m_sheetOffset ); poly->AddPoint( point + m_sheetOffset );
poly->SetStroke( STROKE_PARAMS( elem.lineWidth, PLOT_DASH_TYPE::SOLID, poly->SetStroke( STROKE_PARAMS( elem.LineWidth, PLOT_DASH_TYPE::SOLID,
GetColorFromInt( elem.color ) ) ); GetColorFromInt( elem.Color ) ) );
poly->SetFlags( IS_NEW ); poly->SetFlags( IS_NEW );
m_currentSheet->GetScreen()->Append( poly ); m_currentSheet->GetScreen()->Append( poly );
@ -1496,18 +1496,18 @@ void SCH_ALTIUM_PLUGIN::ParseHarnessConnector( int aIndex, const std::map<wxStri
{ {
ASCH_HARNESS_CONNECTOR elem( aProperties ); ASCH_HARNESS_CONNECTOR elem( aProperties );
if( elem.ownerpartid == ALTIUM_COMPONENT_NONE ) if( elem.OwnerPartID == ALTIUM_COMPONENT_NONE )
{ {
SCH_SHEET* sheet = new SCH_SHEET( SCH_SHEET* sheet = new SCH_SHEET(
/* aParent */ m_currentSheet, /* aParent */ m_currentSheet,
/* aPosition */ elem.location + m_sheetOffset, /* aPosition */ elem.Location + m_sheetOffset,
/* aSize */ elem.size ); /* aSize */ elem.Size );
SCH_SCREEN* screen = new SCH_SCREEN( m_schematic ); SCH_SCREEN* screen = new SCH_SCREEN( m_schematic );
// Harness ports are drawn the same colors as harness connectors, discarding properties, found in Altium's file, // Harness ports are drawn the same colors as harness connectors, discarding properties, found in Altium's file,
// so keep color settings for use in harness ports // so keep color settings for use in harness ports
m_harnessConnectorBackgroundColor = GetColorFromInt( elem.areaColor ); m_harnessConnectorBackgroundColor = GetColorFromInt( elem.AreaColor );
m_harnessConnectorBorderColor = GetColorFromInt( elem.color ); m_harnessConnectorBorderColor = GetColorFromInt( elem.Color );
sheet->SetBackgroundColor( m_harnessConnectorBackgroundColor ); sheet->SetBackgroundColor( m_harnessConnectorBackgroundColor );
sheet->SetBorderColor( m_harnessConnectorBorderColor ); sheet->SetBorderColor( m_harnessConnectorBorderColor );
@ -1553,32 +1553,32 @@ void SCH_ALTIUM_PLUGIN::ParseHarnessEntry( const std::map<wxString, wxString>& a
SCH_SHEET_PIN* sheetPin = new SCH_SHEET_PIN( sheetIt->second ); SCH_SHEET_PIN* sheetPin = new SCH_SHEET_PIN( sheetIt->second );
sheetIt->second->AddPin( sheetPin ); sheetIt->second->AddPin( sheetPin );
sheetPin->SetText( elem.name ); sheetPin->SetText( elem.Name );
sheetPin->SetShape( LABEL_FLAG_SHAPE::L_UNSPECIFIED ); sheetPin->SetShape( LABEL_FLAG_SHAPE::L_UNSPECIFIED );
VECTOR2I pos = sheetIt->second->GetPosition(); VECTOR2I pos = sheetIt->second->GetPosition();
wxSize size = sheetIt->second->GetSize(); wxSize size = sheetIt->second->GetSize();
switch( elem.side ) switch( elem.Side )
{ {
default: default:
case ASCH_SHEET_ENTRY_SIDE::LEFT: case ASCH_SHEET_ENTRY_SIDE::LEFT:
sheetPin->SetPosition( { pos.x, pos.y + elem.distanceFromTop } ); sheetPin->SetPosition( { pos.x, pos.y + elem.DistanceFromTop } );
sheetPin->SetTextSpinStyle( TEXT_SPIN_STYLE::LEFT ); sheetPin->SetTextSpinStyle( TEXT_SPIN_STYLE::LEFT );
sheetPin->SetSide( SHEET_SIDE::LEFT ); sheetPin->SetSide( SHEET_SIDE::LEFT );
break; break;
case ASCH_SHEET_ENTRY_SIDE::RIGHT: case ASCH_SHEET_ENTRY_SIDE::RIGHT:
sheetPin->SetPosition( { pos.x + size.x, pos.y + elem.distanceFromTop } ); sheetPin->SetPosition( { pos.x + size.x, pos.y + elem.DistanceFromTop } );
sheetPin->SetTextSpinStyle( TEXT_SPIN_STYLE::RIGHT ); sheetPin->SetTextSpinStyle( TEXT_SPIN_STYLE::RIGHT );
sheetPin->SetSide( SHEET_SIDE::RIGHT ); sheetPin->SetSide( SHEET_SIDE::RIGHT );
break; break;
case ASCH_SHEET_ENTRY_SIDE::TOP: case ASCH_SHEET_ENTRY_SIDE::TOP:
sheetPin->SetPosition( { pos.x + elem.distanceFromTop, pos.y } ); sheetPin->SetPosition( { pos.x + elem.DistanceFromTop, pos.y } );
sheetPin->SetTextSpinStyle( TEXT_SPIN_STYLE::UP ); sheetPin->SetTextSpinStyle( TEXT_SPIN_STYLE::UP );
sheetPin->SetSide( SHEET_SIDE::TOP ); sheetPin->SetSide( SHEET_SIDE::TOP );
break; break;
case ASCH_SHEET_ENTRY_SIDE::BOTTOM: case ASCH_SHEET_ENTRY_SIDE::BOTTOM:
sheetPin->SetPosition( { pos.x + elem.distanceFromTop, pos.y + size.y } ); sheetPin->SetPosition( { pos.x + elem.DistanceFromTop, pos.y + size.y } );
sheetPin->SetTextSpinStyle( TEXT_SPIN_STYLE::BOTTOM ); sheetPin->SetTextSpinStyle( TEXT_SPIN_STYLE::BOTTOM );
sheetPin->SetSide( SHEET_SIDE::BOTTOM ); sheetPin->SetSide( SHEET_SIDE::BOTTOM );
break; break;
@ -1602,16 +1602,16 @@ void SCH_ALTIUM_PLUGIN::ParseHarnessType( const std::map<wxString, wxString>& aP
SCH_FIELD& sheetNameField = sheetIt->second->GetFields()[SHEETNAME]; SCH_FIELD& sheetNameField = sheetIt->second->GetFields()[SHEETNAME];
sheetNameField.SetPosition( elem.location + m_sheetOffset ); sheetNameField.SetPosition( elem.Location + m_sheetOffset );
sheetNameField.SetText( elem.text ); sheetNameField.SetText( elem.Text );
sheetNameField.SetVisible( true ); // Always set as visible so user is aware about ( !elem.isHidden ); sheetNameField.SetVisible( true ); // Always set as visible so user is aware about ( !elem.isHidden );
SetTextPositioning( &sheetNameField, ASCH_LABEL_JUSTIFICATION::BOTTOM_LEFT, ASCH_RECORD_ORIENTATION::RIGHTWARDS ); SetTextPositioning( &sheetNameField, ASCH_LABEL_JUSTIFICATION::BOTTOM_LEFT, ASCH_RECORD_ORIENTATION::RIGHTWARDS );
sheetNameField.SetTextColor( GetColorFromInt( elem.color ) ); sheetNameField.SetTextColor( GetColorFromInt( elem.Color ) );
m_reporter->Report( wxString::Format( _( "Altium's Harness Connector (%s) was imported as " m_reporter->Report( wxString::Format( _( "Altium's Harness Connector (%s) was imported as "
"Hierarchical sheet. Please review imported schematic, as " "Hierarchical sheet. Please review imported schematic, as "
"KiCad does not natively support these Altium elements." ), "KiCad does not natively support these Altium elements." ),
elem.text ), elem.Text ),
RPT_SEVERITY_WARNING ); RPT_SEVERITY_WARNING );
} }
@ -2071,24 +2071,24 @@ void SCH_ALTIUM_PLUGIN::ParseHarnessPort( const ASCH_PORT& aElem )
{ {
SCH_TEXTBOX* textBox = new SCH_TEXTBOX(); SCH_TEXTBOX* textBox = new SCH_TEXTBOX();
textBox->SetText( aElem.name ); textBox->SetText( aElem.Name );
textBox->SetTextColor( GetColorFromInt( aElem.textColor ) ); textBox->SetTextColor( GetColorFromInt( aElem.TextColor ) );
int height = aElem.height; int height = aElem.Height;
if( height <= 0 ) if( height <= 0 )
height = Mils2iu( 100 ); // chose default 50 grid height = Mils2iu( 100 ); // chose default 50 grid
textBox->SetStartX( ( aElem.location + m_sheetOffset ).x ); textBox->SetStartX( ( aElem.Location + m_sheetOffset ).x );
textBox->SetStartY( ( aElem.location + m_sheetOffset ).y - ( height / 2 ) ); textBox->SetStartY( ( aElem.Location + m_sheetOffset ).y - ( height / 2 ) );
textBox->SetEndX( ( aElem.location + m_sheetOffset ).x + ( aElem.width ) ); textBox->SetEndX( ( aElem.Location + m_sheetOffset ).x + ( aElem.Width ) );
textBox->SetEndY( ( aElem.location + m_sheetOffset ).y + ( height / 2 ) ); textBox->SetEndY( ( aElem.Location + m_sheetOffset ).y + ( height / 2 ) );
textBox->SetFillColor( m_harnessConnectorBackgroundColor ); textBox->SetFillColor( m_harnessConnectorBackgroundColor );
textBox->SetFilled( true ); textBox->SetFilled( true );
textBox->SetStroke( STROKE_PARAMS( 2, PLOT_DASH_TYPE::DEFAULT, m_harnessConnectorBorderColor ) ); textBox->SetStroke( STROKE_PARAMS( 2, PLOT_DASH_TYPE::DEFAULT, m_harnessConnectorBorderColor ) );
switch( aElem.alignment ) switch( aElem.Alignment )
{ {
default: default:
case ASCH_TEXT_FRAME_ALIGNMENT::LEFT: case ASCH_TEXT_FRAME_ALIGNMENT::LEFT:
@ -2102,14 +2102,14 @@ void SCH_ALTIUM_PLUGIN::ParseHarnessPort( const ASCH_PORT& aElem )
break; break;
} }
size_t fontId = static_cast<int>( aElem.fontId ); size_t fontId = static_cast<int>( aElem.FontID );
if( m_altiumSheet && fontId > 0 && fontId <= m_altiumSheet->fonts.size() ) if( m_altiumSheet && fontId > 0 && fontId <= m_altiumSheet->fonts.size() )
{ {
const ASCH_SHEET_FONT& font = m_altiumSheet->fonts.at( fontId - 1 ); const ASCH_SHEET_FONT& font = m_altiumSheet->fonts.at( fontId - 1 );
textBox->SetItalic( font.italic ); textBox->SetItalic( font.Italic );
textBox->SetBold( font.bold ); textBox->SetBold( font.Bold );
textBox->SetTextSize( { font.size / 2, font.size / 2 } ); textBox->SetTextSize( { font.Size / 2, font.Size / 2 } );
//textBox->SetFont( //how to set font, we have a font mane here: ( font.fontname ); //textBox->SetFont( //how to set font, we have a font mane here: ( font.fontname );
} }
@ -2120,37 +2120,37 @@ void SCH_ALTIUM_PLUGIN::ParseHarnessPort( const ASCH_PORT& aElem )
m_reporter->Report( wxString::Format( _( "Altium's Harness port (%s) was imported as " m_reporter->Report( wxString::Format( _( "Altium's Harness port (%s) was imported as "
"Text box. Please review imported schematic, as " "Text box. Please review imported schematic, as "
"KiCad does not natively support these Altium elements." ), "KiCad does not natively support these Altium elements." ),
aElem.name ), aElem.Name ),
RPT_SEVERITY_WARNING ); RPT_SEVERITY_WARNING );
} }
void SCH_ALTIUM_PLUGIN::ParsePort( const ASCH_PORT& aElem ) void SCH_ALTIUM_PLUGIN::ParsePort( const ASCH_PORT& aElem )
{ {
if( !aElem.harnessType.IsEmpty() ) if( !aElem.HarnessType.IsEmpty() )
{ {
// Parse harness ports after "Additional" compound section is parsed // Parse harness ports after "Additional" compound section is parsed
m_altiumHarnessPortsCurrentSheet.emplace_back( aElem ); m_altiumHarnessPortsCurrentSheet.emplace_back( aElem );
return; return;
} }
VECTOR2I start = aElem.location + m_sheetOffset; VECTOR2I start = aElem.Location + m_sheetOffset;
VECTOR2I end = start; VECTOR2I end = start;
switch( aElem.style ) switch( aElem.Style )
{ {
default: default:
case ASCH_PORT_STYLE::NONE_HORIZONTAL: case ASCH_PORT_STYLE::NONE_HORIZONTAL:
case ASCH_PORT_STYLE::LEFT: case ASCH_PORT_STYLE::LEFT:
case ASCH_PORT_STYLE::RIGHT: case ASCH_PORT_STYLE::RIGHT:
case ASCH_PORT_STYLE::LEFT_RIGHT: case ASCH_PORT_STYLE::LEFT_RIGHT:
end.x += aElem.width; end.x += aElem.Width;
break; break;
case ASCH_PORT_STYLE::NONE_VERTICAL: case ASCH_PORT_STYLE::NONE_VERTICAL:
case ASCH_PORT_STYLE::TOP: case ASCH_PORT_STYLE::TOP:
case ASCH_PORT_STYLE::BOTTOM: case ASCH_PORT_STYLE::BOTTOM:
case ASCH_PORT_STYLE::TOP_BOTTOM: case ASCH_PORT_STYLE::TOP_BOTTOM:
end.y -= aElem.width; end.y -= aElem.Width;
break; break;
} }
@ -2172,7 +2172,7 @@ void SCH_ALTIUM_PLUGIN::ParsePort( const ASCH_PORT& aElem )
if( !connectionFound ) if( !connectionFound )
{ {
m_reporter->Report( wxString::Format( _( "Port %s has no connections." ), aElem.name ), m_reporter->Report( wxString::Format( _( "Port %s has no connections." ), aElem.Name ),
RPT_SEVERITY_WARNING ); RPT_SEVERITY_WARNING );
} }
@ -2185,9 +2185,9 @@ void SCH_ALTIUM_PLUGIN::ParsePort( const ASCH_PORT& aElem )
// label = new SCH_HIERLABEL( elem.location + m_sheetOffset, elem.name ); // label = new SCH_HIERLABEL( elem.location + m_sheetOffset, elem.name );
//} //}
label = new SCH_GLOBALLABEL( position, aElem.name ); label = new SCH_GLOBALLABEL( position, aElem.Name );
switch( aElem.iotype ) switch( aElem.IOtype )
{ {
default: default:
case ASCH_PORT_IOTYPE::UNSPECIFIED: case ASCH_PORT_IOTYPE::UNSPECIFIED:
@ -2204,7 +2204,7 @@ void SCH_ALTIUM_PLUGIN::ParsePort( const ASCH_PORT& aElem )
break; break;
} }
switch( aElem.style ) switch( aElem.Style )
{ {
default: default:
case ASCH_PORT_STYLE::NONE_HORIZONTAL: case ASCH_PORT_STYLE::NONE_HORIZONTAL: