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 )
{
aReader.Skip( 5 );
filename = aReader.ReadWxString();
FileName = aReader.ReadWxString();
uint32_t dataSize = aReader.Read<uint32_t>();
data = aReader.ReadVector( dataSize );
Data = aReader.ReadVector( dataSize );
if( aReader.HasParsingError() )
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 );
ownerpartid = ReadOwnerPartId( aProps );
OwnerPartID = ReadOwnerPartId( aProps );
int locationCount = ALTIUM_PARSER::ReadInt( aProps, "LOCATIONCOUNT", 0 );
for( int i = 1; i <= locationCount; 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 ) );
}
indexInSheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", 0 );
IndexInSheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", 0 );
color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
lineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
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 );
ownerpartid = ReadOwnerPartId( aProps );
OwnerPartID = ReadOwnerPartId( aProps );
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
Location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-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 );
areaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 );
Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 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 );
// 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 );
areaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 );
textColor = ALTIUM_PARSER::ReadInt( aProps, "TEXTCOLOR", 0 );
textFontId = ALTIUM_PARSER::ReadInt( aProps, "TEXTFONTID", 0 );
Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
AreaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 );
TextColor = ALTIUM_PARSER::ReadInt( aProps, "TEXTCOLOR", 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 );
//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" ) );
isHidden = ALTIUM_PARSER::ReadBool( aProps, "ISHIDDEN", false );
ownerIndexAdditionalList = ALTIUM_PARSER::ReadBool( aProps, "OWNERINDEXADDITIONALLIST", true );
IsHidden = ALTIUM_PARSER::ReadBool( aProps, "ISHIDDEN", false );
OwnerIndexAdditionalList = ALTIUM_PARSER::ReadBool( aProps, "OWNERINDEXADDITIONALLIST", true );
indexInSheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", 0 );
color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
fontId = ALTIUM_PARSER::ReadInt( aProps, "TEXTFONTID", 0 );
IndexInSheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", 0 );
Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 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 );
ownerpartid = ReadOwnerPartId( aProps );
OwnerPartID = ReadOwnerPartId( aProps );
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
Location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
name = ALTIUM_PARSER::ReadString( aProps, "NAME", "" );
harnessType = ALTIUM_PARSER::ReadString( aProps, "HARNESSTYPE", "" );
Name = ALTIUM_PARSER::ReadString( aProps, "NAME", "" );
HarnessType = ALTIUM_PARSER::ReadString( aProps, "HARNESSTYPE", "" );
width = ReadKiCadUnitFrac( aProps, "WIDTH" );
height = ReadKiCadUnitFrac( aProps, "HEIGHT" );
Width = ReadKiCadUnitFrac( aProps, "WIDTH" );
Height = ReadKiCadUnitFrac( aProps, "HEIGHT" );
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 );
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 );
areaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 );
color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
fontId = ALTIUM_PARSER::ReadInt( aProps, "TEXTFONTID", 0 );
textColor = ALTIUM_PARSER::ReadInt( aProps, "TEXTCOLOR", 0 );
AreaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 );
Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
FontID = ALTIUM_PARSER::ReadInt( aProps, "TEXTFONTID", 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 );
fontname = ALTIUM_PARSER::ReadString( aProps, "FONTNAME" + sid, "" );
FontName = ALTIUM_PARSER::ReadString( aProps, "FONTNAME" + sid, "" );
size = ReadKiCadUnitFrac( aProps, "SIZE" + sid );
rotation = ALTIUM_PARSER::ReadInt( aProps, "ROTATION" + sid, 0 );
Size = ReadKiCadUnitFrac( aProps, "SIZE" + sid );
Rotation = ALTIUM_PARSER::ReadInt( aProps, "ROTATION" + sid, 0 );
italic = ALTIUM_PARSER::ReadBool( aProps, "ITALIC" + sid, false );
bold = ALTIUM_PARSER::ReadBool( aProps, "BOLD" + sid, false );
underline = ALTIUM_PARSER::ReadBool( aProps, "UNDERLINE" + sid, false );
Italic = ALTIUM_PARSER::ReadBool( aProps, "ITALIC" + sid, false );
Bold = ALTIUM_PARSER::ReadBool( aProps, "BOLD" + 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 )

View File

@ -50,8 +50,8 @@ struct ASCH_STORAGE_FILE
struct ASCH_ADDITIONAL_FILE
{
wxString filename;
std::vector<char> data;
wxString FileName;
std::vector<char> Data;
explicit ASCH_ADDITIONAL_FILE( ALTIUM_PARSER& aReader );
};
@ -417,16 +417,16 @@ struct ASCH_LINE
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 point2;
VECTOR2I Point1;
VECTOR2I Point2;
std::vector<VECTOR2I> points;
std::vector<VECTOR2I> Points;
int color;
int indexInSheet;
int lineWidth;
int Color;
int IndexInSheet;
int LineWidth;
explicit ASCH_SIGNAL_HARNESS( const std::map<wxString, wxString>& aProps );
};
@ -434,18 +434,18 @@ struct ASCH_SIGNAL_HARNESS
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;
wxSize size;
VECTOR2I Location;
wxSize Size;
int areaColor;
int color;
int indexInSheet; // Keeps increasing nicely
int lineWidth;
int AreaColor;
int Color;
int IndexInSheet; // Keeps increasing nicely
int LineWidth;
//int locationX; // keep just in case
//int locationY;
int locationPrimaryConnectionPosition;
int LocationPrimaryConnectionPosition;
//int xSize; // keep just in case
//int ySize;
@ -456,20 +456,20 @@ struct ASCH_HARNESS_CONNECTOR
struct ASCH_HARNESS_ENTRY
{
// 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 color;
int distanceFromTop;
int indexInSheet;
int textColor;
int textFontId;
int textStyle;
int AreaColor;
int Color;
int DistanceFromTop;
int IndexInSheet;
int TextColor;
int TextFontID;
int TextStyle;
bool ownerIndexAdditionalList; // what is that?
bool OwnerIndexAdditionalList; // what is that?
wxString name;
ASCH_SHEET_ENTRY_SIDE side;
wxString Name;
ASCH_SHEET_ENTRY_SIDE Side;
explicit ASCH_HARNESS_ENTRY( const std::map<wxString, wxString>& aProps );
};
@ -478,18 +478,18 @@ struct ASCH_HARNESS_ENTRY
struct ASCH_HARNESS_TYPE
{
//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 indexInSheet;
int fontId;
int Color;
int IndexInSheet;
int FontID;
bool isHidden;
bool ownerIndexAdditionalList; // what is that?
bool IsHidden;
bool OwnerIndexAdditionalList; // what is that?
VECTOR2I location;
VECTOR2I Location;
wxString text;
wxString Text;
explicit ASCH_HARNESS_TYPE( const std::map<wxString, wxString>& aProps );
};
@ -594,23 +594,23 @@ struct ASCH_POWER_PORT
struct ASCH_PORT
{
int ownerpartid;
int OwnerPartID;
wxString name;
wxString harnessType;
wxString Name;
wxString HarnessType;
VECTOR2I location;
int width;
int height;
int areaColor;
int color;
int textColor;
int fontId;
VECTOR2I Location;
int Width;
int Height;
int AreaColor;
int Color;
int TextColor;
int FontID;
ASCH_TEXT_FRAME_ALIGNMENT alignment;
ASCH_TEXT_FRAME_ALIGNMENT Alignment;
ASCH_PORT_IOTYPE iotype;
ASCH_PORT_STYLE style;
ASCH_PORT_IOTYPE IOtype;
ASCH_PORT_STYLE Style;
explicit ASCH_PORT( const std::map<wxString, wxString>& aProps );
};
@ -689,15 +689,15 @@ struct ASCH_IMAGE
struct ASCH_SHEET_FONT
{
wxString fontname;
wxString FontName;
int size;
int rotation;
int areaColor;
int Size;
int Rotation;
int AreaColor;
bool italic;
bool bold;
bool underline;
bool Italic;
bool Bold;
bool Underline;
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() )
{
const ASCH_SHEET_FONT& font = m_altiumSheet->fonts.at( fontId - 1 );
textItem->SetItalic( font.italic );
textItem->SetBold( font.bold );
textItem->SetTextSize( { font.size / 2, font.size / 2 } );
textItem->SetItalic( font.Italic );
textItem->SetBold( font.Bold );
textItem->SetTextSize( { font.Size / 2, font.Size / 2 } );
}
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() )
{
const ASCH_SHEET_FONT& font = m_altiumSheet->fonts.at( fontId - 1 );
textItem->SetItalic( font.italic );
textItem->SetBold( font.bold );
textItem->SetTextSize( { font.size / 2, font.size / 2 } );
textItem->SetItalic( font.Italic );
textItem->SetBold( font.Bold );
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() )
{
const ASCH_SHEET_FONT& font = m_altiumSheet->fonts.at( fontId - 1 );
text->SetItalic( font.italic );
text->SetBold( font.bold );
text->SetTextSize( { font.size / 2, font.size / 2 } );
text->SetItalic( font.Italic );
text->SetBold( font.Bold );
text->SetTextSize( { font.Size / 2, font.Size / 2 } );
}
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() )
{
const ASCH_SHEET_FONT& font = m_altiumSheet->fonts.at( fontId - 1 );
text->SetItalic( font.italic );
text->SetBold( font.bold );
text->SetTextSize( { font.size / 2, font.size / 2 } );
text->SetItalic( font.Italic );
text->SetBold( font.Bold );
text->SetTextSize( { font.Size / 2, font.Size / 2 } );
}
text->SetFlags( IS_NEW );
@ -1471,15 +1471,15 @@ void SCH_ALTIUM_PLUGIN::ParseSignalHarness( const std::map<wxString, wxString>&
{
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 );
for( VECTOR2I& point : elem.points )
for( VECTOR2I& point : elem.Points )
poly->AddPoint( point + m_sheetOffset );
poly->SetStroke( STROKE_PARAMS( elem.lineWidth, PLOT_DASH_TYPE::SOLID,
GetColorFromInt( elem.color ) ) );
poly->SetStroke( STROKE_PARAMS( elem.LineWidth, PLOT_DASH_TYPE::SOLID,
GetColorFromInt( elem.Color ) ) );
poly->SetFlags( IS_NEW );
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 );
if( elem.ownerpartid == ALTIUM_COMPONENT_NONE )
if( elem.OwnerPartID == ALTIUM_COMPONENT_NONE )
{
SCH_SHEET* sheet = new SCH_SHEET(
/* aParent */ m_currentSheet,
/* aPosition */ elem.location + m_sheetOffset,
/* aSize */ elem.size );
/* aPosition */ elem.Location + m_sheetOffset,
/* aSize */ elem.Size );
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,
// so keep color settings for use in harness ports
m_harnessConnectorBackgroundColor = GetColorFromInt( elem.areaColor );
m_harnessConnectorBorderColor = GetColorFromInt( elem.color );
m_harnessConnectorBackgroundColor = GetColorFromInt( elem.AreaColor );
m_harnessConnectorBorderColor = GetColorFromInt( elem.Color );
sheet->SetBackgroundColor( m_harnessConnectorBackgroundColor );
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 );
sheetIt->second->AddPin( sheetPin );
sheetPin->SetText( elem.name );
sheetPin->SetText( elem.Name );
sheetPin->SetShape( LABEL_FLAG_SHAPE::L_UNSPECIFIED );
VECTOR2I pos = sheetIt->second->GetPosition();
wxSize size = sheetIt->second->GetSize();
switch( elem.side )
switch( elem.Side )
{
default:
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->SetSide( SHEET_SIDE::LEFT );
break;
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->SetSide( SHEET_SIDE::RIGHT );
break;
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->SetSide( SHEET_SIDE::TOP );
break;
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->SetSide( SHEET_SIDE::BOTTOM );
break;
@ -1602,16 +1602,16 @@ void SCH_ALTIUM_PLUGIN::ParseHarnessType( const std::map<wxString, wxString>& aP
SCH_FIELD& sheetNameField = sheetIt->second->GetFields()[SHEETNAME];
sheetNameField.SetPosition( elem.location + m_sheetOffset );
sheetNameField.SetText( elem.text );
sheetNameField.SetPosition( elem.Location + m_sheetOffset );
sheetNameField.SetText( elem.Text );
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 );
sheetNameField.SetTextColor( GetColorFromInt( elem.color ) );
sheetNameField.SetTextColor( GetColorFromInt( elem.Color ) );
m_reporter->Report( wxString::Format( _( "Altium's Harness Connector (%s) was imported as "
"Hierarchical sheet. Please review imported schematic, as "
"KiCad does not natively support these Altium elements." ),
elem.text ),
elem.Text ),
RPT_SEVERITY_WARNING );
}
@ -2071,24 +2071,24 @@ void SCH_ALTIUM_PLUGIN::ParseHarnessPort( const ASCH_PORT& aElem )
{
SCH_TEXTBOX* textBox = new SCH_TEXTBOX();
textBox->SetText( aElem.name );
textBox->SetTextColor( GetColorFromInt( aElem.textColor ) );
textBox->SetText( aElem.Name );
textBox->SetTextColor( GetColorFromInt( aElem.TextColor ) );
int height = aElem.height;
int height = aElem.Height;
if( height <= 0 )
height = Mils2iu( 100 ); // chose default 50 grid
textBox->SetStartX( ( aElem.location + m_sheetOffset ).x );
textBox->SetStartY( ( aElem.location + m_sheetOffset ).y - ( height / 2 ) );
textBox->SetEndX( ( aElem.location + m_sheetOffset ).x + ( aElem.width ) );
textBox->SetEndY( ( aElem.location + m_sheetOffset ).y + ( height / 2 ) );
textBox->SetStartX( ( aElem.Location + m_sheetOffset ).x );
textBox->SetStartY( ( aElem.Location + m_sheetOffset ).y - ( height / 2 ) );
textBox->SetEndX( ( aElem.Location + m_sheetOffset ).x + ( aElem.Width ) );
textBox->SetEndY( ( aElem.Location + m_sheetOffset ).y + ( height / 2 ) );
textBox->SetFillColor( m_harnessConnectorBackgroundColor );
textBox->SetFilled( true );
textBox->SetStroke( STROKE_PARAMS( 2, PLOT_DASH_TYPE::DEFAULT, m_harnessConnectorBorderColor ) );
switch( aElem.alignment )
switch( aElem.Alignment )
{
default:
case ASCH_TEXT_FRAME_ALIGNMENT::LEFT:
@ -2102,14 +2102,14 @@ void SCH_ALTIUM_PLUGIN::ParseHarnessPort( const ASCH_PORT& aElem )
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() )
{
const ASCH_SHEET_FONT& font = m_altiumSheet->fonts.at( fontId - 1 );
textBox->SetItalic( font.italic );
textBox->SetBold( font.bold );
textBox->SetTextSize( { font.size / 2, font.size / 2 } );
textBox->SetItalic( font.Italic );
textBox->SetBold( font.Bold );
textBox->SetTextSize( { font.Size / 2, font.Size / 2 } );
//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 "
"Text box. Please review imported schematic, as "
"KiCad does not natively support these Altium elements." ),
aElem.name ),
aElem.Name ),
RPT_SEVERITY_WARNING );
}
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
m_altiumHarnessPortsCurrentSheet.emplace_back( aElem );
return;
}
VECTOR2I start = aElem.location + m_sheetOffset;
VECTOR2I start = aElem.Location + m_sheetOffset;
VECTOR2I end = start;
switch( aElem.style )
switch( aElem.Style )
{
default:
case ASCH_PORT_STYLE::NONE_HORIZONTAL:
case ASCH_PORT_STYLE::LEFT:
case ASCH_PORT_STYLE::RIGHT:
case ASCH_PORT_STYLE::LEFT_RIGHT:
end.x += aElem.width;
end.x += aElem.Width;
break;
case ASCH_PORT_STYLE::NONE_VERTICAL:
case ASCH_PORT_STYLE::TOP:
case ASCH_PORT_STYLE::BOTTOM:
case ASCH_PORT_STYLE::TOP_BOTTOM:
end.y -= aElem.width;
end.y -= aElem.Width;
break;
}
@ -2172,7 +2172,7 @@ void SCH_ALTIUM_PLUGIN::ParsePort( const ASCH_PORT& aElem )
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 );
}
@ -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_GLOBALLABEL( position, aElem.name );
label = new SCH_GLOBALLABEL( position, aElem.Name );
switch( aElem.iotype )
switch( aElem.IOtype )
{
default:
case ASCH_PORT_IOTYPE::UNSPECIFIED:
@ -2204,7 +2204,7 @@ void SCH_ALTIUM_PLUGIN::ParsePort( const ASCH_PORT& aElem )
break;
}
switch( aElem.style )
switch( aElem.Style )
{
default:
case ASCH_PORT_STYLE::NONE_HORIZONTAL: