CVPCB: Add warning if footprint is missing

This commit is contained in:
Scott Hanson 2022-09-29 19:27:08 +00:00 committed by Mike Williams
parent 4b276b339a
commit ed42f95794
4 changed files with 68 additions and 1 deletions

View File

@ -655,6 +655,18 @@ void CVPCB_MAINFRAME::AssociateFootprint( const CVPCB_ASSOCIATION& aAssociation,
candidate->GetValue(),
candidate->GetFPID().Format().wx_str() );
m_symbolsListBox->SetString( idx, description );
FOOTPRINT_INFO* fp =
m_FootprintsList->GetFootprintInfo( symbol->GetFPID().Format().wx_str() );
if( !fp )
{
m_symbolsListBox->AppendWarning( idx );
}
else
{
m_symbolsListBox->RemoveWarning( idx );
}
}
}
@ -1021,6 +1033,14 @@ void CVPCB_MAINFRAME::BuildSymbolsListBox()
symbol->GetValue(),
symbol->GetFPID().Format().wx_str() );
m_symbolsListBox->m_SymbolList.Add( msg );
FOOTPRINT_INFO* fp =
m_FootprintsList->GetFootprintInfo( symbol->GetFPID().Format().wx_str() );
if( !fp )
{
m_symbolsListBox->AppendWarning( i );
}
}
if( m_symbolsListBox->m_SymbolList.Count() )

View File

@ -26,6 +26,7 @@
#include <wx/listctrl.h>
#include <footprint_filter.h>
#include <memory>
/* Forward declarations of all top-level window classes. */
class CVPCB_MAINFRAME;
@ -192,6 +193,7 @@ public:
* because real data is not handled by #ITEMS_LISTBOX_BASE.
*/
wxString OnGetItemText( long item, long column ) const override;
wxListItemAttr* OnGetItemAttr( long item) const override;
/*
* Enable or disable an item
@ -199,6 +201,8 @@ public:
void SetSelection( int index, bool State = true );
void SetString( unsigned linecount, const wxString& text );
void AppendLine( const wxString& text );
void AppendWarning( int index );
void RemoveWarning( int index );
// Events functions:
@ -221,6 +225,10 @@ public:
public:
wxArrayString m_SymbolList;
private:
std::vector<long> m_symbolWarning;
std::unique_ptr<wxListItemAttr> m_warningAttr;
};

View File

@ -269,6 +269,14 @@ bool CVPCB_MAINFRAME::readNetListAndFpFiles( const std::string& aNetlist )
FROM_UTF8( component->GetFPID().Format().c_str() ) );
m_symbolsListBox->AppendLine( msg );
FOOTPRINT_INFO* fp =
m_FootprintsList->GetFootprintInfo( component->GetFPID().Format().wx_str() );
if( !fp )
{
m_symbolsListBox->AppendWarning( i );
}
}
if( !m_netlist.IsEmpty() )

View File

@ -34,8 +34,10 @@
SYMBOLS_LISTBOX::SYMBOLS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id ) :
ITEMS_LISTBOX_BASE( parent, id )
ITEMS_LISTBOX_BASE( parent, id ),
m_warningAttr( std::make_unique<wxListItemAttr>() )
{
m_warningAttr->SetBackgroundColour( *wxYELLOW );
}
@ -85,12 +87,41 @@ void SYMBOLS_LISTBOX::AppendLine( const wxString& text )
}
void SYMBOLS_LISTBOX::AppendWarning( int index )
{
if( !std::count( m_symbolWarning.begin(), m_symbolWarning.end(), index ) )
{
m_symbolWarning.emplace_back( index );
}
}
void SYMBOLS_LISTBOX::RemoveWarning( int index )
{
if( auto const found{ std::find( m_symbolWarning.begin(), m_symbolWarning.end(), index ) };
found != m_symbolWarning.end() )
{
m_symbolWarning.erase( found );
}
}
wxString SYMBOLS_LISTBOX::OnGetItemText( long item, long column ) const
{
return m_SymbolList.Item( item );
}
wxListItemAttr* SYMBOLS_LISTBOX::OnGetItemAttr( long item ) const
{
if( std::count( m_symbolWarning.begin(), m_symbolWarning.end(), item ) )
{
return m_warningAttr.get();
}
return nullptr;
}
void SYMBOLS_LISTBOX::SetSelection( int index, bool State )
{
if( index >= GetCount() )