Formatting

This commit is contained in:
WhiteChairFromIkea 2022-09-04 01:38:41 +03:00 committed by Jeff Young
parent 56e4b3b2c3
commit 2958f66407
3 changed files with 69 additions and 69 deletions

View File

@ -337,9 +337,9 @@ ASCH_POLYGON::ASCH_POLYGON( const std::map<wxString, wxString>& aProps )
{ {
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::POLYGON ); wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::POLYGON );
ownerindex = ReadOwnerIndex( aProps ); OwnerIndex = ReadOwnerIndex( aProps );
ownerpartid = ReadOwnerPartId( aProps ); OwnerPartID = ReadOwnerPartId( aProps );
ownerpartdisplaymode = ALTIUM_PARSER::ReadInt( aProps, "OWNERPARTDISPLAYMODE", 0 ); OwnerPartDisplayMode = ALTIUM_PARSER::ReadInt( aProps, "OWNERPARTDISPLAYMODE", 0 );
int locationCount = ALTIUM_PARSER::ReadInt( aProps, "LOCATIONCOUNT", 0 ); int locationCount = ALTIUM_PARSER::ReadInt( aProps, "LOCATIONCOUNT", 0 );
@ -350,11 +350,11 @@ ASCH_POLYGON::ASCH_POLYGON( const std::map<wxString, wxString>& aProps )
-ReadKiCadUnitFrac( aProps, "Y" + si ) ); -ReadKiCadUnitFrac( aProps, "Y" + si ) );
} }
lineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" ); LineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
isSolid = ALTIUM_PARSER::ReadBool( aProps, "ISSOLID", false ); IsSolid = ALTIUM_PARSER::ReadBool( aProps, "ISSOLID", false );
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 );
} }
@ -362,24 +362,24 @@ ASCH_ROUND_RECTANGLE::ASCH_ROUND_RECTANGLE( const std::map<wxString, wxString>&
{ {
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::ROUND_RECTANGLE ); wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::ROUND_RECTANGLE );
ownerindex = ReadOwnerIndex( aProps ); OwnerIndex = ReadOwnerIndex( aProps );
ownerpartid = ReadOwnerPartId( aProps ); OwnerPartID = ReadOwnerPartId( aProps );
ownerpartdisplaymode = ALTIUM_PARSER::ReadInt( aProps, "OWNERPARTDISPLAYMODE", 0 ); OwnerPartDisplayMode = ALTIUM_PARSER::ReadInt( aProps, "OWNERPARTDISPLAYMODE", 0 );
bottomLeft = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ), BottomLeft = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) ); -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
topRight = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ), TopRight = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
-ReadKiCadUnitFrac( aProps, "CORNER.Y" ) ); -ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
cornerradius = wxSize( ReadKiCadUnitFrac( aProps, "CORNERXRADIUS" ), CornerRadius = wxSize( ReadKiCadUnitFrac( aProps, "CORNERXRADIUS" ),
-ReadKiCadUnitFrac( aProps, "CORNERYRADIUS" ) ); -ReadKiCadUnitFrac( aProps, "CORNERYRADIUS" ) );
lineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" ); LineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
isSolid = ALTIUM_PARSER::ReadBool( aProps, "ISSOLID", false ); IsSolid = ALTIUM_PARSER::ReadBool( aProps, "ISSOLID", false );
isTransparent = ALTIUM_PARSER::ReadBool( aProps, "TRANSPARENT", false ); IsTransparent = ALTIUM_PARSER::ReadBool( aProps, "TRANSPARENT", false );
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 );
} }
@ -511,21 +511,21 @@ ASCH_RECTANGLE::ASCH_RECTANGLE( const std::map<wxString, wxString>& aProps )
{ {
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::RECTANGLE ); wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::RECTANGLE );
ownerindex = ReadOwnerIndex( aProps ); OwnerIndex = ReadOwnerIndex( aProps );
ownerpartid = ReadOwnerPartId( aProps ); OwnerPartID = ReadOwnerPartId( aProps );
ownerpartdisplaymode = ALTIUM_PARSER::ReadInt( aProps, "OWNERPARTDISPLAYMODE", 0 ); OwnerPartDisplayMode = ALTIUM_PARSER::ReadInt( aProps, "OWNERPARTDISPLAYMODE", 0 );
bottomLeft = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ), BottomLeft = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) ); -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
topRight = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ), TopRight = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
-ReadKiCadUnitFrac( aProps, "CORNER.Y" ) ); -ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
lineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" ); LineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
isSolid = ALTIUM_PARSER::ReadBool( aProps, "ISSOLID", false ); IsSolid = ALTIUM_PARSER::ReadBool( aProps, "ISSOLID", false );
isTransparent = ALTIUM_PARSER::ReadBool( aProps, "TRANSPARENT", false ); IsTransparent = ALTIUM_PARSER::ReadBool( aProps, "TRANSPARENT", false );
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 );
} }

View File

@ -118,15 +118,15 @@ enum class ASCH_RECORD_ORIENTATION
struct ASCH_SHAPE_INTERFACE struct ASCH_SHAPE_INTERFACE
{ {
int ownerindex; int OwnerIndex;
int ownerpartid; int OwnerPartID;
int ownerpartdisplaymode; int OwnerPartDisplayMode;
int lineWidth; int LineWidth;
bool isSolid; bool IsSolid;
int color; int Color;
int areacolor; int AreaColor;
}; };
@ -379,12 +379,12 @@ struct ASCH_POLYGON : ASCH_SHAPE_INTERFACE
struct ASCH_ROUND_RECTANGLE : ASCH_SHAPE_INTERFACE struct ASCH_ROUND_RECTANGLE : ASCH_SHAPE_INTERFACE
{ {
VECTOR2I bottomLeft; VECTOR2I BottomLeft;
VECTOR2I topRight; VECTOR2I TopRight;
wxSize cornerradius; wxSize CornerRadius;
bool isTransparent; bool IsTransparent;
explicit ASCH_ROUND_RECTANGLE( const std::map<wxString, wxString>& aProps ); explicit ASCH_ROUND_RECTANGLE( const std::map<wxString, wxString>& aProps );
}; };
@ -504,10 +504,10 @@ struct ASCH_HARNESS_TYPE
struct ASCH_RECTANGLE : ASCH_SHAPE_INTERFACE struct ASCH_RECTANGLE : ASCH_SHAPE_INTERFACE
{ {
VECTOR2I bottomLeft; VECTOR2I BottomLeft;
VECTOR2I topRight; VECTOR2I TopRight;
bool isTransparent; bool IsTransparent;
explicit ASCH_RECTANGLE( const std::map<wxString, wxString>& aProps ); explicit ASCH_RECTANGLE( const std::map<wxString, wxString>& aProps );
}; };

View File

@ -99,28 +99,28 @@ static PLOT_DASH_TYPE GetPlotDashType( const ASCH_POLYLINE_LINESTYLE linestyle )
static void SetSchShapeFillAndColor( const ASCH_SHAPE_INTERFACE& elem, SCH_SHAPE* shape ) static void SetSchShapeFillAndColor( const ASCH_SHAPE_INTERFACE& elem, SCH_SHAPE* shape )
{ {
shape->SetStroke( STROKE_PARAMS( elem.lineWidth, PLOT_DASH_TYPE::SOLID ) ); shape->SetStroke( STROKE_PARAMS( elem.LineWidth, PLOT_DASH_TYPE::SOLID ) );
if( !elem.isSolid ) if( !elem.IsSolid )
{ {
shape->SetFillMode( FILL_T::NO_FILL ); shape->SetFillMode( FILL_T::NO_FILL );
} }
else else
{ {
shape->SetFillMode( FILL_T::FILLED_WITH_COLOR ); shape->SetFillMode( FILL_T::FILLED_WITH_COLOR );
shape->SetFillColor( GetColorFromInt( elem.areacolor ) ); shape->SetFillColor( GetColorFromInt( elem.AreaColor ) );
} }
} }
static void SetLibShapeFillAndColor( const ASCH_SHAPE_INTERFACE& elem, LIB_SHAPE* shape ) static void SetLibShapeFillAndColor( const ASCH_SHAPE_INTERFACE& elem, LIB_SHAPE* shape )
{ {
shape->SetStroke( STROKE_PARAMS( elem.lineWidth, PLOT_DASH_TYPE::SOLID ) ); shape->SetStroke( STROKE_PARAMS( elem.LineWidth, PLOT_DASH_TYPE::SOLID ) );
if( !elem.isSolid ) if( !elem.IsSolid )
{ {
shape->SetFillMode( FILL_T::NO_FILL ); shape->SetFillMode( FILL_T::NO_FILL );
} }
else if( elem.color == elem.areacolor ) else if( elem.Color == elem.AreaColor )
{ {
shape->SetFillMode( FILL_T::FILLED_SHAPE ); shape->SetFillMode( FILL_T::FILLED_SHAPE );
} }
@ -1242,7 +1242,7 @@ void SCH_ALTIUM_PLUGIN::ParsePolygon( const std::map<wxString, wxString>& aPrope
{ {
ASCH_POLYGON elem( aProperties ); ASCH_POLYGON 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 );
@ -1257,25 +1257,25 @@ void SCH_ALTIUM_PLUGIN::ParsePolygon( const std::map<wxString, wxString>& aPrope
} }
else else
{ {
const auto& libSymbolIt = m_libSymbols.find( elem.ownerindex ); const auto& libSymbolIt = m_libSymbols.find( elem.OwnerIndex );
if( libSymbolIt == m_libSymbols.end() ) if( libSymbolIt == m_libSymbols.end() )
{ {
// TODO: e.g. can depend on Template (RECORD=39 // TODO: e.g. can depend on Template (RECORD=39
m_reporter->Report( wxString::Format( _( "Polygon's owner (%d) not found." ), m_reporter->Report( wxString::Format( _( "Polygon's owner (%d) not found." ),
elem.ownerindex ), elem.OwnerIndex ),
RPT_SEVERITY_ERROR ); RPT_SEVERITY_ERROR );
return; return;
} }
if( !IsComponentPartVisible( elem.ownerindex, elem.ownerpartdisplaymode ) ) if( !IsComponentPartVisible( elem.OwnerIndex, elem.OwnerPartDisplayMode ) )
return; return;
SCH_SYMBOL* symbol = m_symbols.at( libSymbolIt->first ); SCH_SYMBOL* symbol = m_symbols.at( libSymbolIt->first );
LIB_SHAPE* line = new LIB_SHAPE( libSymbolIt->second, SHAPE_T::POLY ); LIB_SHAPE* line = new LIB_SHAPE( libSymbolIt->second, SHAPE_T::POLY );
libSymbolIt->second->AddDrawItem( line ); libSymbolIt->second->AddDrawItem( line );
line->SetUnit( elem.ownerpartid ); line->SetUnit( elem.OwnerPartID );
for( VECTOR2I& point : elem.points ) for( VECTOR2I& point : elem.points )
line->AddPoint( GetRelativePosition( point + m_sheetOffset, symbol ) ); line->AddPoint( GetRelativePosition( point + m_sheetOffset, symbol ) );
@ -1290,10 +1290,10 @@ void SCH_ALTIUM_PLUGIN::ParseRoundRectangle( const std::map<wxString, wxString>&
{ {
ASCH_ROUND_RECTANGLE elem( aProperties ); ASCH_ROUND_RECTANGLE elem( aProperties );
VECTOR2I sheetTopRight = elem.topRight + m_sheetOffset; VECTOR2I sheetTopRight = elem.TopRight + m_sheetOffset;
VECTOR2I sheetBottomLeft = elem.bottomLeft + m_sheetOffset; VECTOR2I sheetBottomLeft = elem.BottomLeft + m_sheetOffset;
if( elem.ownerpartid == ALTIUM_COMPONENT_NONE ) if( elem.OwnerPartID == ALTIUM_COMPONENT_NONE )
{ {
// TODO: misses rounded edges // TODO: misses rounded edges
SCH_SHAPE* rect = new SCH_SHAPE( SHAPE_T::RECT ); SCH_SHAPE* rect = new SCH_SHAPE( SHAPE_T::RECT );
@ -1307,18 +1307,18 @@ void SCH_ALTIUM_PLUGIN::ParseRoundRectangle( const std::map<wxString, wxString>&
} }
else else
{ {
const auto& libSymbolIt = m_libSymbols.find( elem.ownerindex ); const auto& libSymbolIt = m_libSymbols.find( elem.OwnerIndex );
if( libSymbolIt == m_libSymbols.end() ) if( libSymbolIt == m_libSymbols.end() )
{ {
// TODO: e.g. can depend on Template (RECORD=39 // TODO: e.g. can depend on Template (RECORD=39
m_reporter->Report( wxString::Format( _( "Rounded rectangle's owner (%d) not found." ), m_reporter->Report( wxString::Format( _( "Rounded rectangle's owner (%d) not found." ),
elem.ownerindex ), elem.OwnerIndex ),
RPT_SEVERITY_ERROR ); RPT_SEVERITY_ERROR );
return; return;
} }
if( !IsComponentPartVisible( elem.ownerindex, elem.ownerpartdisplaymode ) ) if( !IsComponentPartVisible( elem.OwnerIndex, elem.OwnerPartDisplayMode ) )
return; return;
SCH_SYMBOL* symbol = m_symbols.at( libSymbolIt->first ); SCH_SYMBOL* symbol = m_symbols.at( libSymbolIt->first );
@ -1326,10 +1326,10 @@ void SCH_ALTIUM_PLUGIN::ParseRoundRectangle( const std::map<wxString, wxString>&
LIB_SHAPE* rect = new LIB_SHAPE( libSymbolIt->second, SHAPE_T::RECT ); LIB_SHAPE* rect = new LIB_SHAPE( libSymbolIt->second, SHAPE_T::RECT );
libSymbolIt->second->AddDrawItem( rect ); libSymbolIt->second->AddDrawItem( rect );
rect->SetUnit( elem.ownerpartid ); rect->SetUnit( elem.OwnerPartID );
rect->SetPosition( GetRelativePosition( elem.topRight + m_sheetOffset, symbol ) ); rect->SetPosition( GetRelativePosition( elem.TopRight + m_sheetOffset, symbol ) );
rect->SetEnd( GetRelativePosition( elem.bottomLeft + m_sheetOffset, symbol ) ); rect->SetEnd( GetRelativePosition( elem.BottomLeft + m_sheetOffset, symbol ) );
SetLibShapeFillAndColor( elem, rect ); SetLibShapeFillAndColor( elem, rect );
} }
} }
@ -1613,10 +1613,10 @@ void SCH_ALTIUM_PLUGIN::ParseRectangle( const std::map<wxString, wxString>& aPro
{ {
ASCH_RECTANGLE elem( aProperties ); ASCH_RECTANGLE elem( aProperties );
VECTOR2I sheetTopRight = elem.topRight + m_sheetOffset; VECTOR2I sheetTopRight = elem.TopRight + m_sheetOffset;
VECTOR2I sheetBottomLeft = elem.bottomLeft + m_sheetOffset; VECTOR2I sheetBottomLeft = elem.BottomLeft + m_sheetOffset;
if( elem.ownerpartid == ALTIUM_COMPONENT_NONE ) if( elem.OwnerPartID == ALTIUM_COMPONENT_NONE )
{ {
SCH_SHAPE* rect = new SCH_SHAPE( SHAPE_T::RECT ); SCH_SHAPE* rect = new SCH_SHAPE( SHAPE_T::RECT );
@ -1629,25 +1629,25 @@ void SCH_ALTIUM_PLUGIN::ParseRectangle( const std::map<wxString, wxString>& aPro
} }
else else
{ {
const auto& libSymbolIt = m_libSymbols.find( elem.ownerindex ); const auto& libSymbolIt = m_libSymbols.find( elem.OwnerIndex );
if( libSymbolIt == m_libSymbols.end() ) if( libSymbolIt == m_libSymbols.end() )
{ {
// TODO: e.g. can depend on Template (RECORD=39 // TODO: e.g. can depend on Template (RECORD=39
m_reporter->Report( wxString::Format( _( "Rectangle's owner (%d) not found." ), m_reporter->Report( wxString::Format( _( "Rectangle's owner (%d) not found." ),
elem.ownerindex ), elem.OwnerIndex ),
RPT_SEVERITY_ERROR ); RPT_SEVERITY_ERROR );
return; return;
} }
if( !IsComponentPartVisible( elem.ownerindex, elem.ownerpartdisplaymode ) ) if( !IsComponentPartVisible( elem.OwnerIndex, elem.OwnerPartDisplayMode ) )
return; return;
SCH_SYMBOL* symbol = m_symbols.at( libSymbolIt->first ); SCH_SYMBOL* symbol = m_symbols.at( libSymbolIt->first );
LIB_SHAPE* rect = new LIB_SHAPE( libSymbolIt->second, SHAPE_T::RECT ); LIB_SHAPE* rect = new LIB_SHAPE( libSymbolIt->second, SHAPE_T::RECT );
libSymbolIt->second->AddDrawItem( rect ); libSymbolIt->second->AddDrawItem( rect );
rect->SetUnit( elem.ownerpartid ); rect->SetUnit( elem.OwnerPartID );
rect->SetPosition( GetRelativePosition( sheetTopRight, symbol ) ); rect->SetPosition( GetRelativePosition( sheetTopRight, symbol ) );
rect->SetEnd( GetRelativePosition( sheetBottomLeft, symbol ) ); rect->SetEnd( GetRelativePosition( sheetBottomLeft, symbol ) );