Allow the search pane to highlight nets

Fix https://gitlab.com/kicad/code/kicad/-/issues/12551
This commit is contained in:
Marek Roszko 2022-10-23 19:53:47 -04:00
parent 2dec37f806
commit d06155f6af
2 changed files with 23 additions and 0 deletions

View File

@ -26,6 +26,7 @@
#include <pcb_textbox.h>
#include <pcb_text.h>
#include <zone.h>
#include <pcb_painter.h>
#include "search_handlers.h"
@ -327,4 +328,25 @@ wxString NETS_SEARCH_HANDLER::GetResultCell( int aRow, int aCol )
return net->GetNetClass()->GetName();
return wxEmptyString;
}
void NETS_SEARCH_HANDLER::SelectItems( std::vector<long>& aItemRows )
{
RENDER_SETTINGS* ps = m_frame->GetCanvas()->GetView()->GetPainter()->GetSettings();
ps->SetHighlight( false );
std::vector<NETINFO_ITEM*> selectedItems;
for( long row : aItemRows )
{
if( row >= 0 && row < (long) m_hitlist.size() )
{
NETINFO_ITEM* net = m_hitlist[row];
ps->SetHighlight( true, net->GetNetCode(), true );
}
}
m_frame->GetCanvas()->GetView()->UpdateAllLayersColor();
m_frame->GetCanvas()->Refresh();
}

View File

@ -81,6 +81,7 @@ public:
int Search( const wxString& aQuery ) override;
wxString GetResultCell( int aRow, int aCol ) override;
void SelectItems( std::vector<long>& aItemRows ) override;
private:
PCB_EDIT_FRAME* m_frame;