42 std::vector<SCH_PIN*> pinList = aSymbol->
GetPins();
49 for(
unsigned ii = 1; ii < pinList.size(); ii++ )
54 if(
pin->GetNumber() !=
next->GetNumber() )
59 if(
pin->GetBodyStyle() != 0 &&
next->GetBodyStyle() != 0 )
61 if(
pin->GetBodyStyle() !=
next->GetBodyStyle() )
68 if( !
pin->GetName().IsEmpty() )
69 pinName =
" '" +
pin->GetName() +
"'";
71 if( !
next->GetName().IsEmpty() )
72 nextName =
" '" +
next->GetName() +
"'";
76 if(
pin->GetUnit() == 0 ||
next->GetUnit() == 0 )
78 msg.Printf(
_(
"<b>Duplicate pin %s</b> %s at location <b>(%s, %s)</b>"
79 " conflicts with pin %s%s at location <b>(%s, %s)</b>"
80 " in %s body style." ),
93 msg.Printf(
_(
"<b>Duplicate pin %s</b> %s at location <b>(%s, %s)</b>"
94 " conflicts with pin %s%s at location <b>(%s, %s)</b>"
95 " in units %s and %s of %s body style." ),
111 if(
pin->GetUnit() == 0 ||
next->GetUnit() == 0 )
113 msg.Printf(
_(
"<b>Duplicate pin %s</b> %s at location <b>(%s, %s)</b>"
114 " conflicts with pin %s%s at location <b>(%s, %s)</b>." ),
126 msg.Printf(
_(
"<b>Duplicate pin %s</b> %s at location <b>(%s, %s)</b>"
127 " conflicts with pin %s%s at location <b>(%s, %s)</b>"
128 " in units %s and %s." ),
142 msg += wxT(
"<br><br>" );
143 aMessages.push_back( msg );
176 if( reference_base.IsEmpty() )
178 aMessages.push_back(
_(
"<b>Warning: reference is empty</b><br><br>" ) );
182 wxString illegal_end( wxT(
"0123456789?" ) );
183 wxUniChar last_char = reference_base.Last();
185 if( illegal_end.Find( last_char ) != wxNOT_FOUND )
187 msg.Printf(
_(
"<b>Warning: reference prefix</b><br>prefix ending by '%s' can create"
188 " issues if saved in a symbol library" ),
190 msg += wxT(
"<br><br>" );
191 aMessages.push_back( msg );
197 std::vector<SCH_PIN*> pinList = aSymbol->
GetPins();
205 const int min_grid_size =
schIUScale.MilsToIU( 25 );
206 const int clamped_grid_size = ( aGridForPins < min_grid_size ) ? min_grid_size : aGridForPins;
216 msg.Printf(
_(
"<b>A Power Symbol should have only one unit</b><br><br>" ) );
217 aMessages.push_back( msg );
220 if( pinList.size() != 1 )
222 msg.Printf(
_(
"<b>A Power Symbol should have only one pin</b><br><br>" ) );
223 aMessages.push_back( msg );
231 msg.Printf(
_(
"<b>Suspicious Power Symbol</b><br>"
232 "Only an input or output power pin has meaning<br><br>" ) );
233 aMessages.push_back( msg );
238 msg.Printf(
_(
"<b>Suspicious Power Symbol</b><br>"
239 "Invisible input power pins are no longer required<br><br>" ) );
240 aMessages.push_back( msg );
247 wxString pinName =
pin->GetName();
249 if( pinName.IsEmpty() || pinName ==
"~" )
252 pinName =
"'" + pinName +
"'";
256 && !
pin->IsVisible() )
263 msg.Printf(
_(
"Info: <b>Hidden power pin %s</b> %s at location <b>(%s, %s)</b>"
264 " in %s body style." ),
273 msg.Printf(
_(
"Info: <b>Hidden power pin %s</b> %s at location <b>(%s, %s)</b>"
274 " in unit %c of %s body style." ),
279 'A' +
pin->GetUnit() - 1,
287 msg.Printf(
_(
"Info: <b>Hidden power pin %s</b> %s at location <b>"
296 msg.Printf(
_(
"Info: <b>Hidden power pin %s</b> %s at location <b>(%s, %s)</b>"
302 'A' +
pin->GetUnit() - 1 );
306 msg += wxT(
"<br>" );
307 msg +=
_(
"(Hidden power pins will drive their pin names on to any connected nets.)" );
308 msg += wxT(
"<br><br>" );
309 aMessages.push_back( msg );
312 if( ( (
pin->GetPosition().x % clamped_grid_size) != 0 )
313 || ( (
pin->GetPosition().y % clamped_grid_size) != 0 ) )
322 msg.Printf(
_(
"<b>Off grid pin %s</b> %s at location <b>(%s, %s)</b>"
323 " of %s body style." ),
332 msg.Printf(
_(
"<b>Off grid pin %s</b> %s at location <b>(%s, %s)</b>"
333 " in unit %c of %s body style." ),
338 'A' +
pin->GetUnit() - 1,
346 msg.Printf(
_(
"<b>Off grid pin %s</b> %s at location <b>(%s, %s)</b>." ),
354 msg.Printf(
_(
"<b>Off grid pin %s</b> %s at location <b>(%s, %s)</b>"
360 'A' +
pin->GetUnit() - 1 );
364 msg += wxT(
"<br><br>" );
365 aMessages.push_back( msg );
396 msg.Printf(
_(
"<b>Graphic circle has radius = 0</b> at location "
397 "<b>(%s, %s)</b>." ),
400 msg += wxT(
"<br>" );
401 aMessages.push_back( msg );
408 msg.Printf(
_(
"<b>Graphic rectangle has size 0</b> at location <b>(%s, %s)</b>." ),
411 msg += wxT(
"<br>" );
412 aMessages.push_back( msg );
constexpr EDA_IU_SCALE schIUScale
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
wxString SHAPE_T_asString() const
virtual const wxString & GetText() const
Return the string associated with the text object.
Define a library symbol object.
bool IsPower() const override
bool IsMultiBodyStyle() const override
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
std::vector< SCH_PIN * > GetPins() const override
bool IsGlobalPower() const override
wxString GetBodyStyleDescription(int aBodyStyle, bool aLabel) const override
int GetUnitCount() const override
wxString GetUnitDisplayName(int aUnit, bool aLabel) const override
Return the user-defined display name for aUnit for symbols with units.
SCH_FIELD & GetReferenceField()
Return reference to the reference designator field.
Base class for any item which can be embedded within the SCHEMATIC container class,...
const wxString & GetNumber() const
VECTOR2I GetPosition() const override
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
This file contains miscellaneous commonly used macros and functions.
#define UNIMPLEMENTED_FOR(type)
@ PT_POWER_OUT
output of a regulator: intended to be connected to power input pins
@ PT_POWER_IN
power input (GND, VCC for ICs). Must be connected to a power output.
static bool sort_by_pin_number(const SCH_PIN *ref, const SCH_PIN *tst)
void CheckDuplicatePins(LIB_SYMBOL *aSymbol, std::vector< wxString > &aMessages, UNITS_PROVIDER *aUnitsProvider)
void CheckLibSymbol(LIB_SYMBOL *aSymbol, std::vector< wxString > &aMessages, int aGridForPins, UNITS_PROVIDER *aUnitsProvider)
Check a library symbol to find incorrect settings.
static void CheckLibSymbolGraphics(LIB_SYMBOL *aSymbol, std::vector< wxString > &aMessages, UNITS_PROVIDER *aUnitsProvider)