PCB Search Pane: activate item opens properties dialog

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/12475
This commit is contained in:
Mike Williams 2023-01-25 11:12:13 -05:00
parent d915cb780e
commit 71b687622b
2 changed files with 38 additions and 17 deletions

View File

@ -30,9 +30,23 @@
#include "search_handlers.h"
PCB_SEARCH_HANDLER::PCB_SEARCH_HANDLER( wxString aName, PCB_EDIT_FRAME* aFrame ) :
SEARCH_HANDLER( aName ), m_frame( aFrame )
{
}
void PCB_SEARCH_HANDLER::ActivateItem( long aItemRow )
{
std::vector<long> item = { aItemRow };
SelectItems( item );
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::properties, true );
}
FOOTPRINT_SEARCH_HANDLER::FOOTPRINT_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame ) :
SEARCH_HANDLER( wxT( "Footprints" ) ),
m_frame( aFrame )
PCB_SEARCH_HANDLER( wxT( "Footprints" ), aFrame )
{
m_columns.emplace_back( wxT( "Reference" ), 1 );
m_columns.emplace_back( wxT( "Value" ), 2 );
@ -107,8 +121,7 @@ void FOOTPRINT_SEARCH_HANDLER::SelectItems( std::vector<long>& aItemRows )
ZONE_SEARCH_HANDLER::ZONE_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame ) :
SEARCH_HANDLER( wxT( "Zones" ) ),
m_frame( aFrame )
PCB_SEARCH_HANDLER( wxT( "Zones" ), aFrame )
{
m_columns.emplace_back( wxT( "Name" ), 2 );
m_columns.emplace_back( wxT( "Net" ), 1 );
@ -192,8 +205,7 @@ void ZONE_SEARCH_HANDLER::SelectItems( std::vector<long>& aItemRows )
TEXT_SEARCH_HANDLER::TEXT_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame ) :
SEARCH_HANDLER( wxT( "Text" ) ),
m_frame( aFrame )
PCB_SEARCH_HANDLER( wxT( "Text" ), aFrame )
{
m_columns.emplace_back( wxT( "Type" ), 1 );
m_columns.emplace_back( wxT( "Text" ), 3 );
@ -279,8 +291,7 @@ void TEXT_SEARCH_HANDLER::SelectItems( std::vector<long>& aItemRows )
NETS_SEARCH_HANDLER::NETS_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame ) :
SEARCH_HANDLER( wxT( "Nets" ) ),
m_frame( aFrame )
PCB_SEARCH_HANDLER( wxT( "Nets" ), aFrame )
{
m_columns.emplace_back( wxT( "Name" ), 2 );
m_columns.emplace_back( wxT( "Class" ), 2 );

View File

@ -29,8 +29,21 @@
class ZONE;
class FOOTPRINT;
class PCB_TEXT;
class PCB_EDIT_FRAME;
class FOOTPRINT_SEARCH_HANDLER : public SEARCH_HANDLER
class PCB_SEARCH_HANDLER : public SEARCH_HANDLER
{
public:
PCB_SEARCH_HANDLER( wxString aName, PCB_EDIT_FRAME* aFrame );
void ActivateItem( long aItemRow ) override;
protected:
PCB_EDIT_FRAME* m_frame;
};
class FOOTPRINT_SEARCH_HANDLER : public PCB_SEARCH_HANDLER
{
public:
FOOTPRINT_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame );
@ -40,11 +53,11 @@ public:
void SelectItems( std::vector<long>& aItemRows ) override;
private:
PCB_EDIT_FRAME* m_frame;
std::vector<FOOTPRINT*> m_hitlist;
};
class ZONE_SEARCH_HANDLER : public SEARCH_HANDLER
class ZONE_SEARCH_HANDLER : public PCB_SEARCH_HANDLER
{
public:
ZONE_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame );
@ -54,12 +67,11 @@ public:
void SelectItems( std::vector<long>& aItemRows ) override;
private:
PCB_EDIT_FRAME* m_frame;
std::vector<ZONE*> m_hitlist;
};
class TEXT_SEARCH_HANDLER : public SEARCH_HANDLER
class TEXT_SEARCH_HANDLER : public PCB_SEARCH_HANDLER
{
public:
TEXT_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame );
@ -69,12 +81,11 @@ public:
void SelectItems( std::vector<long>& aItemRows ) override;
private:
PCB_EDIT_FRAME* m_frame;
std::vector<BOARD_ITEM*> m_hitlist;
};
class NETS_SEARCH_HANDLER : public SEARCH_HANDLER
class NETS_SEARCH_HANDLER : public PCB_SEARCH_HANDLER
{
public:
NETS_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame );
@ -84,8 +95,7 @@ public:
void SelectItems( std::vector<long>& aItemRows ) override;
private:
PCB_EDIT_FRAME* m_frame;
std::vector<NETINFO_ITEM*> m_hitlist;
};
#endif
#endif