Correctly report body style in symbol checker.
Also fixes a bug where off-grid pin locations were truncated. Fixes https://gitlab.com/kicad/code/kicad/-/issues/16770
This commit is contained in:
parent
cc9f8f5b83
commit
fb8f05fb34
|
@ -43,27 +43,42 @@ LIB_ITEM::LIB_ITEM( KICAD_T aType, LIB_SYMBOL* aSymbol, int aUnit, int aConvert
|
|||
}
|
||||
|
||||
|
||||
wxString LIB_ITEM::GetUnitDescription( int aUnit )
|
||||
{
|
||||
if( aUnit == 0 )
|
||||
return _( "All" );
|
||||
else
|
||||
return LIB_SYMBOL::LetterSubReference( aUnit, 'A' );
|
||||
}
|
||||
|
||||
|
||||
wxString LIB_ITEM::GetBodyStyleDescription( int aBodyStyle )
|
||||
{
|
||||
if( aBodyStyle == 0 )
|
||||
return _( "All" );
|
||||
else if( aBodyStyle == LIB_ITEM::BODY_STYLE::DEMORGAN )
|
||||
return _( "Alternate" );
|
||||
else if( aBodyStyle == LIB_ITEM::BODY_STYLE::BASE )
|
||||
return _( "Standard" );
|
||||
else
|
||||
return wxT( "?" );
|
||||
}
|
||||
|
||||
|
||||
void LIB_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
aList.emplace_back( _( "Type" ), GetTypeName() );
|
||||
|
||||
if( m_unit == 0 )
|
||||
msg = _( "All" );
|
||||
else
|
||||
msg = LIB_SYMBOL::LetterSubReference( m_unit, 'A' );
|
||||
if( LIB_SYMBOL* parent = GetParent() )
|
||||
{
|
||||
if( parent->GetUnitCount() )
|
||||
aList.emplace_back( _( "Unit" ), GetUnitDescription( m_unit ) );
|
||||
|
||||
aList.emplace_back( _( "Unit" ), msg );
|
||||
|
||||
if( m_bodyStyle == LIB_ITEM::BODY_STYLE::BASE )
|
||||
msg = _( "no" );
|
||||
else if( m_bodyStyle == LIB_ITEM::BODY_STYLE::DEMORGAN )
|
||||
msg = _( "yes" );
|
||||
else
|
||||
msg = wxT( "?" );
|
||||
|
||||
aList.emplace_back( _( "Converted" ), msg );
|
||||
if( parent->HasAlternateBodyStyle() )
|
||||
aList.emplace_back( _( "Body Style" ), GetBodyStyleDescription( m_bodyStyle ) );
|
||||
}
|
||||
|
||||
if( IsPrivate() )
|
||||
aList.emplace_back( _( "Private" ), wxEmptyString );
|
||||
|
|
|
@ -123,6 +123,9 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
static wxString GetUnitDescription( int aUnit );
|
||||
static wxString GetBodyStyleDescription( int aBodyStyle );
|
||||
|
||||
/**
|
||||
* Create a copy of this #LIB_ITEM (with a new Uuid).
|
||||
*/
|
||||
|
|
|
@ -158,7 +158,8 @@ void SCH_EDIT_FRAME::FlipBodyStyle( SCH_SYMBOL* aSymbol )
|
|||
if( aSymbol->IsSelected() )
|
||||
m_toolManager->RunAction<EDA_ITEM*>( EE_ACTIONS::addItemToSel, aSymbol );
|
||||
|
||||
// TODO: 9.0 "Change Body Style"
|
||||
// TODO: 9.0 It would be better as "Change Body Style", but we're past string freeze so
|
||||
// this (existing) string will have to do....
|
||||
commit.Push( _( "Convert Symbol" ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -211,18 +211,25 @@ wxString SCH_PIN::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
|
|||
|
||||
void SCH_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
|
||||
{
|
||||
wxString msg;
|
||||
wxString msg;
|
||||
SCH_SYMBOL* symbol = GetParentSymbol();
|
||||
|
||||
aList.emplace_back( _( "Type" ), _( "Pin" ) );
|
||||
|
||||
if( m_libPin->GetBodyStyle() == LIB_ITEM::BODY_STYLE::BASE )
|
||||
msg = _( "no" );
|
||||
else if( m_libPin->GetBodyStyle() == LIB_ITEM::BODY_STYLE::DEMORGAN )
|
||||
msg = _( "yes" );
|
||||
else
|
||||
msg = wxT( "?" );
|
||||
if( LIB_SYMBOL* libSymbol = symbol->GetLibSymbolRef().get() )
|
||||
{
|
||||
if( libSymbol->GetUnitCount() )
|
||||
{
|
||||
aList.emplace_back( _( "Unit" ),
|
||||
LIB_ITEM::GetUnitDescription( m_libPin->GetUnit() ) );
|
||||
}
|
||||
|
||||
aList.emplace_back( _( "Converted" ), msg );
|
||||
if( libSymbol->HasAlternateBodyStyle() )
|
||||
{
|
||||
aList.emplace_back( _( "Body Style" ),
|
||||
LIB_ITEM::GetBodyStyleDescription( m_libPin->GetBodyStyle() ) );
|
||||
}
|
||||
}
|
||||
|
||||
aList.emplace_back( _( "Name" ), GetShownName() );
|
||||
aList.emplace_back( _( "Number" ), GetShownNumber() );
|
||||
|
@ -237,7 +244,6 @@ void SCH_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITE
|
|||
|
||||
SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( aFrame );
|
||||
SCH_SHEET_PATH* currentSheet = schframe ? &schframe->GetCurrentSheet() : nullptr;
|
||||
SCH_SYMBOL* symbol = GetParentSymbol();
|
||||
|
||||
// Don't use GetShownText(); we want to see the variable references here
|
||||
aList.emplace_back( symbol->GetRef( currentSheet ),
|
||||
|
|
|
@ -115,10 +115,9 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
|
|||
{
|
||||
if( pin->GetUnit() == 0 || next->GetUnit() == 0 )
|
||||
{
|
||||
// TODO: 9.0: change "of converted" to "of alternate body style"
|
||||
msg.Printf( _( "<b>Duplicate pin %s</b> %s at location <b>(%s, %s)</b>"
|
||||
" conflicts with pin %s%s at location <b>(%s, %s)</b>"
|
||||
" of converted." ),
|
||||
" in %s body style." ),
|
||||
next->GetNumber(),
|
||||
nextName,
|
||||
aUnitsProvider->MessageTextFromValue( next->GetPosition().x ),
|
||||
|
@ -126,14 +125,14 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
|
|||
pin->GetNumber(),
|
||||
pin->GetName(),
|
||||
aUnitsProvider->MessageTextFromValue( pin->GetPosition().x ),
|
||||
aUnitsProvider->MessageTextFromValue( -pin->GetPosition().y ) );
|
||||
aUnitsProvider->MessageTextFromValue( -pin->GetPosition().y ),
|
||||
LIB_ITEM::GetBodyStyleDescription( pin->GetBodyStyle() ).Lower() );
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: 9.0: change "of converted" to "of alternate body style"
|
||||
msg.Printf( _( "<b>Duplicate pin %s</b> %s at location <b>(%s, %s)</b>"
|
||||
" conflicts with pin %s%s at location <b>(%s, %s)</b>"
|
||||
" in units %s and %s of converted." ),
|
||||
" in units %s and %s of %s body style." ),
|
||||
next->GetNumber(),
|
||||
nextName,
|
||||
aUnitsProvider->MessageTextFromValue( next->GetPosition().x ),
|
||||
|
@ -143,7 +142,8 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
|
|||
aUnitsProvider->MessageTextFromValue( pin->GetPosition().x ),
|
||||
aUnitsProvider->MessageTextFromValue( -pin->GetPosition().y ),
|
||||
aSymbol->GetUnitReference( next->GetUnit() ),
|
||||
aSymbol->GetUnitReference( pin->GetUnit() ) );
|
||||
aSymbol->GetUnitReference( pin->GetUnit() ),
|
||||
LIB_ITEM::GetBodyStyleDescription( pin->GetBodyStyle() ).Lower() );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -245,24 +245,24 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
|
|||
{
|
||||
if( aSymbol->GetUnitCount() <= 1 )
|
||||
{
|
||||
// TODO: 9.0: change "of converted" to "of alternate body style"
|
||||
msg.Printf( _( "Info: <b>Hidden power pin %s</b> %s at location <b>(%s, %s)</b>"
|
||||
" of converted." ),
|
||||
pin->GetNumber(),
|
||||
pinName,
|
||||
aUnitsProvider->MessageTextFromValue( pin->GetPosition().x ),
|
||||
aUnitsProvider->MessageTextFromValue( -pin->GetPosition().y ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: 9.0: change "of converted" to "of alternate body style"
|
||||
msg.Printf( _( "Info: <b>Hidden power pin %s</b> %s at location <b>(%s, %s)</b>"
|
||||
" in unit %c of converted." ),
|
||||
" in %s body style." ),
|
||||
pin->GetNumber(),
|
||||
pinName,
|
||||
aUnitsProvider->MessageTextFromValue( pin->GetPosition().x ),
|
||||
aUnitsProvider->MessageTextFromValue( -pin->GetPosition().y ),
|
||||
'A' + pin->GetUnit() - 1 );
|
||||
LIB_ITEM::GetBodyStyleDescription( pin->GetBodyStyle() ).Lower() );
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.Printf( _( "Info: <b>Hidden power pin %s</b> %s at location <b>(%s, %s)</b>"
|
||||
" in unit %c of %s body style." ),
|
||||
pin->GetNumber(),
|
||||
pinName,
|
||||
aUnitsProvider->MessageTextFromValue( pin->GetPosition().x ),
|
||||
aUnitsProvider->MessageTextFromValue( -pin->GetPosition().y ),
|
||||
'A' + pin->GetUnit() - 1,
|
||||
LIB_ITEM::GetBodyStyleDescription( pin->GetBodyStyle() ).Lower() );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -303,24 +303,24 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
|
|||
{
|
||||
if( aSymbol->GetUnitCount() <= 1 )
|
||||
{
|
||||
// TODO: 9.0: change "of converted" to "of alternate body style"
|
||||
msg.Printf( _( "<b>Off grid pin %s</b> %s at location <b>(%s, %s)</b>"
|
||||
" of converted." ),
|
||||
pin->GetNumber(),
|
||||
pinName,
|
||||
aUnitsProvider->MessageTextFromValue( pin->GetPosition().x ),
|
||||
aUnitsProvider->MessageTextFromValue( -pin->GetPosition().y ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: 9.0: change "of converted" to "of alternate body style"
|
||||
msg.Printf( _( "<b>Off grid pin %s</b> %s at location <b>(%.3s, %.3s)</b>"
|
||||
" in unit %c of converted." ),
|
||||
" of %s body style." ),
|
||||
pin->GetNumber(),
|
||||
pinName,
|
||||
aUnitsProvider->MessageTextFromValue( pin->GetPosition().x ),
|
||||
aUnitsProvider->MessageTextFromValue( -pin->GetPosition().y ),
|
||||
'A' + pin->GetUnit() - 1 );
|
||||
LIB_ITEM::GetBodyStyleDescription( pin->GetBodyStyle() ).Lower() );
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.Printf( _( "<b>Off grid pin %s</b> %s at location <b>(%s, %s)</b>"
|
||||
" in unit %c of %s body style." ),
|
||||
pin->GetNumber(),
|
||||
pinName,
|
||||
aUnitsProvider->MessageTextFromValue( pin->GetPosition().x ),
|
||||
aUnitsProvider->MessageTextFromValue( -pin->GetPosition().y ),
|
||||
'A' + pin->GetUnit() - 1,
|
||||
LIB_ITEM::GetBodyStyleDescription( pin->GetBodyStyle() ).Lower() );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1277,10 +1277,12 @@ void SYMBOL_EDIT_FRAME::UpdateSymbolMsgPanelInfo()
|
|||
|
||||
AppendMsgPanel( _( "Unit" ), msg, 8 );
|
||||
|
||||
if( m_bodyStyle > 1 )
|
||||
if( m_bodyStyle == LIB_ITEM::BODY_STYLE::DEMORGAN )
|
||||
msg = _( "Alternate" );
|
||||
else
|
||||
else if( m_bodyStyle == LIB_ITEM::BODY_STYLE::BASE )
|
||||
msg = _( "Standard" );
|
||||
else
|
||||
wxT( "?" );
|
||||
|
||||
AppendMsgPanel( _( "Body" ), msg, 8 );
|
||||
|
||||
|
|
Loading…
Reference in New Issue