Expose exclusion flags in search pane.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15776
This commit is contained in:
Jeff Young 2023-10-01 22:45:12 +01:00
parent 904bdc3c66
commit cf02bb171f
6 changed files with 65 additions and 50 deletions

View File

@ -20,11 +20,11 @@ SEARCH_PANE_BASE::SEARCH_PANE_BASE( wxWindow* parent, wxWindowID id, const wxPoi
m_searchCtrl1->ShowSearchButton( true );
#endif
m_searchCtrl1->ShowCancelButton( false );
m_sizerOuter->Add( m_searchCtrl1, 0, wxEXPAND|wxTOP, 5 );
m_sizerOuter->Add( m_searchCtrl1, 0, wxEXPAND, 5 );
m_notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_sizerOuter->Add( m_notebook, 1, wxEXPAND|wxTOP, 5 );
m_sizerOuter->Add( m_notebook, 1, wxEXPAND|wxBOTTOM, 4 );
this->SetSizer( m_sizerOuter );

View File

@ -61,7 +61,7 @@
<property name="permission">protected</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxSearchCtrl" expanded="1">
<property name="BottomDockable">1</property>
@ -126,8 +126,8 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP</property>
<property name="border">4</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="proportion">1</property>
<object class="wxNotebook" expanded="1">
<property name="BottomDockable">1</property>

View File

@ -146,15 +146,15 @@ void SEARCH_PANE_LISTVIEW::RefreshColumnNames()
Freeze();
DeleteAllColumns();
std::vector<std::pair<wxString, int>> columns = m_handler->GetColumns();
std::vector<std::tuple<wxString, int, wxListColumnFormat>> columns = m_handler->GetColumns();
for( auto& [ columnName, colProportion ] : columns )
AppendColumn( wxGetTranslation( columnName ) );
for( auto& [ columnName, colProportion, colAlign ] : columns )
AppendColumn( wxGetTranslation( columnName ), colAlign );
int widthUnit = GetClientSize().GetWidth() / 4;
int widthUnit = GetClientSize().GetWidth() / 10;
for( int ii = 0; ii < (int) columns.size(); ++ii )
SetColumnWidth( ii, widthUnit * columns[ ii ].second );
SetColumnWidth( ii, widthUnit * std::get<1>( columns[ ii ] ) );
Thaw();
}

View File

@ -122,12 +122,16 @@ void SCH_SEARCH_HANDLER::SelectItems( std::vector<long>& aItemRows )
SYMBOL_SEARCH_HANDLER::SYMBOL_SEARCH_HANDLER( SCH_EDIT_FRAME* aFrame ) :
SCH_SEARCH_HANDLER( wxT( "Symbols" ), aFrame )
{
m_columns.emplace_back( wxT( "Reference" ), 1 );
m_columns.emplace_back( wxT( "Value" ), 3 );
m_columns.emplace_back( wxT( "Footprint" ), 3 );
m_columns.emplace_back( wxT( "Page" ), 1 );
m_columns.emplace_back( wxT( "X" ), 2 );
m_columns.emplace_back( wxT( "Y" ), 2 );
m_columns.emplace_back( wxT( "Reference" ), 2, wxLIST_FORMAT_LEFT );
m_columns.emplace_back( wxT( "Value" ), 6, wxLIST_FORMAT_LEFT );
m_columns.emplace_back( wxT( "Footprint" ), 10, wxLIST_FORMAT_LEFT );
m_columns.emplace_back( wxT( "Page" ), 1, wxLIST_FORMAT_CENTER );
m_columns.emplace_back( wxT( "X" ), 3, wxLIST_FORMAT_CENTER );
m_columns.emplace_back( wxT( "Y" ), 3, wxLIST_FORMAT_CENTER );
m_columns.emplace_back( wxT( "Excl. sim" ), 2, wxLIST_FORMAT_CENTER );
m_columns.emplace_back( wxT( "Excl. BOM" ), 2, wxLIST_FORMAT_CENTER );
m_columns.emplace_back( wxT( "Excl. board" ), 2, wxLIST_FORMAT_CENTER );
m_columns.emplace_back( wxT( "DNP" ), 2, wxLIST_FORMAT_CENTER );
}
@ -188,7 +192,14 @@ wxString SYMBOL_SEARCH_HANDLER::getResultCell( const SCH_SEARCH_HIT& aHit, int a
return m_frame->MessageTextFromValue( sym->GetPosition().x );
else if( aCol == 5 )
return m_frame->MessageTextFromValue( sym->GetPosition().y );
else if( aCol == 6 )
return sym->GetExcludedFromSim() ? wxS( "X" ) : wxS( " " );
else if( aCol == 7 )
return sym->GetExcludedFromBOM() ? wxS( "X" ) : wxS( " " );
else if( aCol == 8 )
return sym->GetExcludedFromBoard() ? wxS( "X" ) : wxS( " " );
else if( aCol == 9 )
return sym->GetDNP() ? wxS( "X" ) : wxS( " " );
return wxEmptyString;
}
@ -197,11 +208,11 @@ wxString SYMBOL_SEARCH_HANDLER::getResultCell( const SCH_SEARCH_HIT& aHit, int a
TEXT_SEARCH_HANDLER::TEXT_SEARCH_HANDLER( SCH_EDIT_FRAME* aFrame ) :
SCH_SEARCH_HANDLER( wxT( "Text" ), aFrame )
{
m_columns.emplace_back( wxT( "Type" ), 1 );
m_columns.emplace_back( wxT( "Text" ), 5 );
m_columns.emplace_back( wxT( "Page" ), 1 );
m_columns.emplace_back( wxT( "X" ), 2 );
m_columns.emplace_back( wxT( "Y" ), 2 );
m_columns.emplace_back( wxT( "Type" ), 2, wxLIST_FORMAT_LEFT );
m_columns.emplace_back( wxT( "Text" ), 12, wxLIST_FORMAT_LEFT );
m_columns.emplace_back( wxT( "Page" ), 1, wxLIST_FORMAT_CENTER );
m_columns.emplace_back( wxT( "X" ), 3, wxLIST_FORMAT_CENTER );
m_columns.emplace_back( wxT( "Y" ), 3, wxLIST_FORMAT_CENTER );
}
@ -281,11 +292,11 @@ wxString TEXT_SEARCH_HANDLER::getResultCell( const SCH_SEARCH_HIT& aHit, int aCo
LABEL_SEARCH_HANDLER::LABEL_SEARCH_HANDLER( SCH_EDIT_FRAME* aFrame ) :
SCH_SEARCH_HANDLER( wxT( "Labels" ), aFrame )
{
m_columns.emplace_back( wxT( "Type" ), 1 );
m_columns.emplace_back( wxT( "Name" ), 4 );
m_columns.emplace_back( wxT( "Page" ), 1 );
m_columns.emplace_back( wxT( "X" ), 2 );
m_columns.emplace_back( wxT( "Y" ), 2 );
m_columns.emplace_back( wxT( "Type" ), 2, wxLIST_FORMAT_LEFT );
m_columns.emplace_back( wxT( "Name" ), 6, wxLIST_FORMAT_LEFT );
m_columns.emplace_back( wxT( "Page" ), 2, wxLIST_FORMAT_CENTER );
m_columns.emplace_back( wxT( "X" ), 3, wxLIST_FORMAT_CENTER );
m_columns.emplace_back( wxT( "Y" ), 3 , wxLIST_FORMAT_CENTER);
}

View File

@ -22,6 +22,7 @@
#include <widgets/search_pane_base.h>
#include <vector>
#include <wx/listbase.h>
class EDA_DRAW_FRAME;
class SEARCH_PANE_TAB;
@ -35,7 +36,10 @@ public:
wxString GetName() const { return m_name; }
std::vector<std::pair<wxString, int>> GetColumns() const { return m_columns; }
std::vector<std::tuple<wxString, int, wxListColumnFormat>> GetColumns() const
{
return m_columns;
}
virtual int Search( const wxString& string ) = 0;
virtual wxString GetResultCell( int row, int col ) = 0;
@ -45,8 +49,8 @@ public:
virtual void ActivateItem( long aItemRow ) {}
protected:
wxString m_name;
std::vector<std::pair<wxString, int>> m_columns;
wxString m_name;
std::vector<std::tuple<wxString, int, wxListColumnFormat>> m_columns;
};
class SEARCH_PANE : public SEARCH_PANE_BASE

View File

@ -78,11 +78,11 @@ void PCB_SEARCH_HANDLER::SelectItems( std::vector<long>& aItemRows )
FOOTPRINT_SEARCH_HANDLER::FOOTPRINT_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame ) :
PCB_SEARCH_HANDLER( wxT( "Footprints" ), aFrame )
{
m_columns.emplace_back( wxT( "Reference" ), 1 );
m_columns.emplace_back( wxT( "Value" ), 2 );
m_columns.emplace_back( wxT( "Layer" ), 1 );
m_columns.emplace_back( wxT( "X" ), 1 );
m_columns.emplace_back( wxT( "Y" ), 1 );
m_columns.emplace_back( wxT( "Reference" ), 2, wxLIST_FORMAT_LEFT );
m_columns.emplace_back( wxT( "Value" ), 8, wxLIST_FORMAT_LEFT );
m_columns.emplace_back( wxT( "Layer" ), 3, wxLIST_FORMAT_CENTER );
m_columns.emplace_back( wxT( "X" ), 3, wxLIST_FORMAT_CENTER );
m_columns.emplace_back( wxT( "Y" ), 3, wxLIST_FORMAT_CENTER );
}
@ -136,12 +136,12 @@ wxString FOOTPRINT_SEARCH_HANDLER::getResultCell( BOARD_ITEM* aItem, int aCol )
ZONE_SEARCH_HANDLER::ZONE_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame ) :
PCB_SEARCH_HANDLER( wxT( "Zones" ), aFrame )
{
m_columns.emplace_back( wxT( "Name" ), 2 );
m_columns.emplace_back( wxT( "Net" ), 1 );
m_columns.emplace_back( wxT( "Layer" ), 1 );
m_columns.emplace_back( wxT( "Priority" ), 1 );
m_columns.emplace_back( wxT( "X" ), 1 );
m_columns.emplace_back( wxT( "Y" ), 1 );
m_columns.emplace_back( wxT( "Name" ), 6, wxLIST_FORMAT_LEFT );
m_columns.emplace_back( wxT( "Net" ), 6, wxLIST_FORMAT_LEFT);
m_columns.emplace_back( wxT( "Layer" ), 3, wxLIST_FORMAT_CENTER );
m_columns.emplace_back( wxT( "Priority" ), 2, wxLIST_FORMAT_CENTER );
m_columns.emplace_back( wxT( "X" ), 3, wxLIST_FORMAT_CENTER );
m_columns.emplace_back( wxT( "Y" ), 3, wxLIST_FORMAT_CENTER );
}
@ -200,11 +200,11 @@ wxString ZONE_SEARCH_HANDLER::getResultCell( BOARD_ITEM* aItem, int aCol )
TEXT_SEARCH_HANDLER::TEXT_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame ) :
PCB_SEARCH_HANDLER( wxT( "Text" ), aFrame )
{
m_columns.emplace_back( wxT( "Type" ), 1 );
m_columns.emplace_back( wxT( "Text" ), 3 );
m_columns.emplace_back( wxT( "Layer" ), 1 );
m_columns.emplace_back( wxT( "X" ), 1 );
m_columns.emplace_back( wxT( "Y" ), 1 );
m_columns.emplace_back( wxT( "Type" ), 2, wxLIST_FORMAT_LEFT );
m_columns.emplace_back( wxT( "Text" ), 12, wxLIST_FORMAT_LEFT );
m_columns.emplace_back( wxT( "Layer" ), 3, wxLIST_FORMAT_CENTER );
m_columns.emplace_back( wxT( "X" ), 3, wxLIST_FORMAT_CENTER );
m_columns.emplace_back( wxT( "Y" ), 3, wxLIST_FORMAT_CENTER );
}
@ -264,8 +264,8 @@ wxString TEXT_SEARCH_HANDLER::getResultCell( BOARD_ITEM* aItem, int aCol )
NETS_SEARCH_HANDLER::NETS_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame ) :
PCB_SEARCH_HANDLER( wxT( "Nets" ), aFrame )
{
m_columns.emplace_back( wxT( "Name" ), 2 );
m_columns.emplace_back( wxT( "Class" ), 2 );
m_columns.emplace_back( wxT( "Name" ), 6, wxLIST_FORMAT_LEFT );
m_columns.emplace_back( wxT( "Class" ), 6, wxLIST_FORMAT_LEFT );
}
@ -343,8 +343,8 @@ void NETS_SEARCH_HANDLER::ActivateItem( long aItemRow )
RATSNEST_SEARCH_HANDLER::RATSNEST_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame ) :
PCB_SEARCH_HANDLER( wxT( "Ratsnest" ), aFrame )
{
m_columns.emplace_back( wxT( "Name" ), 2 );
m_columns.emplace_back( wxT( "Class" ), 2 );
m_columns.emplace_back( wxT( "Name" ), 6, wxLIST_FORMAT_LEFT );
m_columns.emplace_back( wxT( "Class" ), 6, wxLIST_FORMAT_LEFT );
}