CVPCB: Add warning if footprint is missing
This commit is contained in:
parent
4b276b339a
commit
ed42f95794
|
@ -655,6 +655,18 @@ void CVPCB_MAINFRAME::AssociateFootprint( const CVPCB_ASSOCIATION& aAssociation,
|
||||||
candidate->GetValue(),
|
candidate->GetValue(),
|
||||||
candidate->GetFPID().Format().wx_str() );
|
candidate->GetFPID().Format().wx_str() );
|
||||||
m_symbolsListBox->SetString( idx, description );
|
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->GetValue(),
|
||||||
symbol->GetFPID().Format().wx_str() );
|
symbol->GetFPID().Format().wx_str() );
|
||||||
m_symbolsListBox->m_SymbolList.Add( msg );
|
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() )
|
if( m_symbolsListBox->m_SymbolList.Count() )
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include <wx/listctrl.h>
|
#include <wx/listctrl.h>
|
||||||
#include <footprint_filter.h>
|
#include <footprint_filter.h>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
/* Forward declarations of all top-level window classes. */
|
/* Forward declarations of all top-level window classes. */
|
||||||
class CVPCB_MAINFRAME;
|
class CVPCB_MAINFRAME;
|
||||||
|
@ -192,6 +193,7 @@ public:
|
||||||
* because real data is not handled by #ITEMS_LISTBOX_BASE.
|
* because real data is not handled by #ITEMS_LISTBOX_BASE.
|
||||||
*/
|
*/
|
||||||
wxString OnGetItemText( long item, long column ) const override;
|
wxString OnGetItemText( long item, long column ) const override;
|
||||||
|
wxListItemAttr* OnGetItemAttr( long item) const override;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enable or disable an item
|
* Enable or disable an item
|
||||||
|
@ -199,6 +201,8 @@ public:
|
||||||
void SetSelection( int index, bool State = true );
|
void SetSelection( int index, bool State = true );
|
||||||
void SetString( unsigned linecount, const wxString& text );
|
void SetString( unsigned linecount, const wxString& text );
|
||||||
void AppendLine( const wxString& text );
|
void AppendLine( const wxString& text );
|
||||||
|
void AppendWarning( int index );
|
||||||
|
void RemoveWarning( int index );
|
||||||
|
|
||||||
// Events functions:
|
// Events functions:
|
||||||
|
|
||||||
|
@ -221,6 +225,10 @@ public:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxArrayString m_SymbolList;
|
wxArrayString m_SymbolList;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<long> m_symbolWarning;
|
||||||
|
std::unique_ptr<wxListItemAttr> m_warningAttr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -269,6 +269,14 @@ bool CVPCB_MAINFRAME::readNetListAndFpFiles( const std::string& aNetlist )
|
||||||
FROM_UTF8( component->GetFPID().Format().c_str() ) );
|
FROM_UTF8( component->GetFPID().Format().c_str() ) );
|
||||||
|
|
||||||
m_symbolsListBox->AppendLine( msg );
|
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() )
|
if( !m_netlist.IsEmpty() )
|
||||||
|
|
|
@ -34,8 +34,10 @@
|
||||||
|
|
||||||
|
|
||||||
SYMBOLS_LISTBOX::SYMBOLS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id ) :
|
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
|
wxString SYMBOLS_LISTBOX::OnGetItemText( long item, long column ) const
|
||||||
{
|
{
|
||||||
return m_SymbolList.Item( item );
|
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 )
|
void SYMBOLS_LISTBOX::SetSelection( int index, bool State )
|
||||||
{
|
{
|
||||||
if( index >= GetCount() )
|
if( index >= GetCount() )
|
||||||
|
|
Loading…
Reference in New Issue