Fix some layout and selection issues on Mac.
Some of these are due to moving to wxWidgets 3.2, but I'm not sure all of them are. In particular, the need for CallAfter() in the search pane's selection handler is probably just a wxWidgets bug on Mac (the control lies about the current selection inside the event handler). Also sets better column widths in the search pane.
This commit is contained in:
parent
a7df573748
commit
4e47b5c25f
|
@ -43,7 +43,7 @@ void SEARCH_PANE::OnLanguageChange()
|
||||||
SEARCH_PANE_TAB* tab = dynamic_cast<SEARCH_PANE_TAB*>( page );
|
SEARCH_PANE_TAB* tab = dynamic_cast<SEARCH_PANE_TAB*>( page );
|
||||||
|
|
||||||
tab->RefreshColumnNames();
|
tab->RefreshColumnNames();
|
||||||
m_notebook->SetPageText( i, _( tab->GetSearchHandler()->GetName() ) );
|
m_notebook->SetPageText( i, wxGetTranslation( tab->GetSearchHandler()->GetName() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ void SEARCH_PANE::AddSearcher( SEARCH_HANDLER* aHandler )
|
||||||
{
|
{
|
||||||
SEARCH_PANE_TAB* tab = new SEARCH_PANE_TAB( aHandler, m_notebook );
|
SEARCH_PANE_TAB* tab = new SEARCH_PANE_TAB( aHandler, m_notebook );
|
||||||
|
|
||||||
m_notebook->AddPage( tab, _( aHandler->GetName() ) );
|
m_notebook->AddPage( tab, wxGetTranslation( aHandler->GetName() ) );
|
||||||
m_handlers.push_back( aHandler );
|
m_handlers.push_back( aHandler );
|
||||||
m_tabs.push_back( tab );
|
m_tabs.push_back( tab );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
|
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||||
|
@ -11,7 +11,6 @@
|
||||||
|
|
||||||
SEARCH_PANE_BASE::SEARCH_PANE_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
|
SEARCH_PANE_BASE::SEARCH_PANE_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
|
||||||
{
|
{
|
||||||
this->SetFont( wxFont( 10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
|
|
||||||
this->SetMinSize( wxSize( 360,100 ) );
|
this->SetMinSize( wxSize( 360,100 ) );
|
||||||
|
|
||||||
m_sizerOuter = new wxBoxSizer( wxVERTICAL );
|
m_sizerOuter = new wxBoxSizer( wxVERTICAL );
|
||||||
|
@ -21,7 +20,7 @@ SEARCH_PANE_BASE::SEARCH_PANE_BASE( wxWindow* parent, wxWindowID id, const wxPoi
|
||||||
m_searchCtrl1->ShowSearchButton( true );
|
m_searchCtrl1->ShowSearchButton( true );
|
||||||
#endif
|
#endif
|
||||||
m_searchCtrl1->ShowCancelButton( false );
|
m_searchCtrl1->ShowCancelButton( false );
|
||||||
m_sizerOuter->Add( m_searchCtrl1, 0, wxALL|wxEXPAND, 5 );
|
m_sizerOuter->Add( m_searchCtrl1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
m_notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
m_notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
<property name="enabled">1</property>
|
<property name="enabled">1</property>
|
||||||
<property name="event_handler">impl_virtual</property>
|
<property name="event_handler">impl_virtual</property>
|
||||||
<property name="fg"></property>
|
<property name="fg"></property>
|
||||||
<property name="font">,90,90,10,70,0</property>
|
<property name="font"></property>
|
||||||
<property name="hidden">0</property>
|
<property name="hidden">0</property>
|
||||||
<property name="id">wxID_ANY</property>
|
<property name="id">wxID_ANY</property>
|
||||||
<property name="maximum_size"></property>
|
<property name="maximum_size"></property>
|
||||||
|
@ -61,7 +61,7 @@
|
||||||
<property name="permission">protected</property>
|
<property name="permission">protected</property>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxALL|wxEXPAND</property>
|
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxSearchCtrl" expanded="1">
|
<object class="wxSearchCtrl" expanded="1">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
|
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||||
|
|
|
@ -56,7 +56,8 @@ void SEARCH_PANE_LISTVIEW::GetSelectRowsList( std::vector<long>& aSelectedList )
|
||||||
aSelectedList.emplace_back( idx );
|
aSelectedList.emplace_back( idx );
|
||||||
|
|
||||||
idx = GetNextSelected( idx );
|
idx = GetNextSelected( idx );
|
||||||
while( idx > 0 )
|
|
||||||
|
while( idx >= 0 )
|
||||||
{
|
{
|
||||||
aSelectedList.emplace_back( idx );
|
aSelectedList.emplace_back( idx );
|
||||||
idx = GetNextSelected( idx );
|
idx = GetNextSelected( idx );
|
||||||
|
@ -66,9 +67,13 @@ void SEARCH_PANE_LISTVIEW::GetSelectRowsList( std::vector<long>& aSelectedList )
|
||||||
|
|
||||||
void SEARCH_PANE_LISTVIEW::OnItemSelected( wxListEvent& aEvent )
|
void SEARCH_PANE_LISTVIEW::OnItemSelected( wxListEvent& aEvent )
|
||||||
{
|
{
|
||||||
std::vector<long> list;
|
CallAfter(
|
||||||
GetSelectRowsList( list );
|
[&]()
|
||||||
m_handler->SelectItems( list );
|
{
|
||||||
|
std::vector<long> list;
|
||||||
|
GetSelectRowsList( list );
|
||||||
|
m_handler->SelectItems( list );
|
||||||
|
} );
|
||||||
|
|
||||||
aEvent.Skip();
|
aEvent.Skip();
|
||||||
}
|
}
|
||||||
|
@ -76,9 +81,15 @@ void SEARCH_PANE_LISTVIEW::OnItemSelected( wxListEvent& aEvent )
|
||||||
|
|
||||||
void SEARCH_PANE_LISTVIEW::OnItemDeselected( wxListEvent& aEvent )
|
void SEARCH_PANE_LISTVIEW::OnItemDeselected( wxListEvent& aEvent )
|
||||||
{
|
{
|
||||||
std::vector<long> list;
|
CallAfter(
|
||||||
GetSelectRowsList( list );
|
[&]()
|
||||||
m_handler->SelectItems( list );
|
{
|
||||||
|
std::vector<long> list;
|
||||||
|
GetSelectRowsList( list );
|
||||||
|
m_handler->SelectItems( list );
|
||||||
|
} );
|
||||||
|
|
||||||
|
aEvent.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,11 +98,15 @@ void SEARCH_PANE_LISTVIEW::RefreshColumnNames()
|
||||||
Freeze();
|
Freeze();
|
||||||
DeleteAllColumns();
|
DeleteAllColumns();
|
||||||
|
|
||||||
std::vector<wxString> columns = m_handler->GetColumnNames();
|
std::vector<std::pair<wxString, int>> columns = m_handler->GetColumns();
|
||||||
for( wxString& columnName : columns )
|
|
||||||
{
|
for( auto& [ columnName, colProportion ] : columns )
|
||||||
AppendColumn( _( columnName ) );
|
AppendColumn( wxGetTranslation( columnName ) );
|
||||||
}
|
|
||||||
|
int widthUnit = GetClientSize().GetWidth() / 4;
|
||||||
|
|
||||||
|
for( int ii = 0; ii < (int) columns.size(); ++ii )
|
||||||
|
SetColumnWidth( ii, widthUnit * columns[ ii ].second );
|
||||||
|
|
||||||
Thaw();
|
Thaw();
|
||||||
}
|
}
|
||||||
|
@ -99,7 +114,7 @@ void SEARCH_PANE_LISTVIEW::RefreshColumnNames()
|
||||||
|
|
||||||
wxString SEARCH_PANE_LISTVIEW::OnGetItemText( long item, long column ) const
|
wxString SEARCH_PANE_LISTVIEW::OnGetItemText( long item, long column ) const
|
||||||
{
|
{
|
||||||
return m_handler->GetResultCell( item, column );
|
return m_handler->GetResultCell( (int) item, (int) column );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ public:
|
||||||
|
|
||||||
wxString GetName() const { return m_name; }
|
wxString GetName() const { return m_name; }
|
||||||
|
|
||||||
std::vector<wxString> GetColumnNames() const { return m_columnNames; }
|
std::vector<std::pair<wxString, int>> GetColumns() const { return m_columns; }
|
||||||
|
|
||||||
virtual int Search( const wxString& string ) = 0;
|
virtual int Search( const wxString& string ) = 0;
|
||||||
virtual wxString GetResultCell( int row, int col ) = 0;
|
virtual wxString GetResultCell( int row, int col ) = 0;
|
||||||
|
@ -42,8 +42,8 @@ public:
|
||||||
virtual void SelectItems( std::vector<long>& aItemRows ) {}
|
virtual void SelectItems( std::vector<long>& aItemRows ) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxString m_name;
|
wxString m_name;
|
||||||
std::vector<wxString> m_columnNames;
|
std::vector<std::pair<wxString, int>> m_columns;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SEARCH_PANE : public SEARCH_PANE_BASE
|
class SEARCH_PANE : public SEARCH_PANE_BASE
|
||||||
|
|
|
@ -657,11 +657,11 @@ void APPEARANCE_CONTROLS::createControls()
|
||||||
|
|
||||||
m_layerDisplaySeparator = new wxStaticLine( layerDisplayPane, wxID_ANY, wxDefaultPosition,
|
m_layerDisplaySeparator = new wxStaticLine( layerDisplayPane, wxID_ANY, wxDefaultPosition,
|
||||||
wxDefaultSize, wxLI_HORIZONTAL );
|
wxDefaultSize, wxLI_HORIZONTAL );
|
||||||
layerDisplayOptionsSizer->Add( m_layerDisplaySeparator, 0, wxEXPAND | wxTOP | wxBOTTOM, 5 );
|
layerDisplayOptionsSizer->Add( m_layerDisplaySeparator, 0, wxEXPAND, 5 );
|
||||||
|
|
||||||
m_cbFlipBoard = new wxCheckBox( layerDisplayPane, wxID_ANY, _( "Flip board view" ) );
|
m_cbFlipBoard = new wxCheckBox( layerDisplayPane, wxID_ANY, _( "Flip board view" ) );
|
||||||
m_cbFlipBoard->SetFont( infoFont );
|
m_cbFlipBoard->SetFont( infoFont );
|
||||||
layerDisplayOptionsSizer->Add( m_cbFlipBoard, 0, 0, 5 );
|
layerDisplayOptionsSizer->Add( m_cbFlipBoard, 0, wxTOP | wxBOTTOM, 5 );
|
||||||
|
|
||||||
layerDisplayPane->SetSizer( layerDisplayOptionsSizer );
|
layerDisplayPane->SetSizer( layerDisplayOptionsSizer );
|
||||||
layerDisplayPane->Layout();
|
layerDisplayPane->Layout();
|
||||||
|
|
|
@ -150,7 +150,7 @@ APPEARANCE_CONTROLS_BASE::APPEARANCE_CONTROLS_BASE( wxWindow* parent, wxWindowID
|
||||||
m_netsTabOuterSizer->Fit( m_panelNetsAndClasses );
|
m_netsTabOuterSizer->Fit( m_panelNetsAndClasses );
|
||||||
m_notebook->AddPage( m_panelNetsAndClasses, _("Nets"), false );
|
m_notebook->AddPage( m_panelNetsAndClasses, _("Nets"), false );
|
||||||
|
|
||||||
m_sizerOuter->Add( m_notebook, 1, wxEXPAND, 5 );
|
m_sizerOuter->Add( m_notebook, 1, wxEXPAND|wxBOTTOM, 5 );
|
||||||
|
|
||||||
wxBoxSizer* bBottomMargin;
|
wxBoxSizer* bBottomMargin;
|
||||||
bBottomMargin = new wxBoxSizer( wxVERTICAL );
|
bBottomMargin = new wxBoxSizer( wxVERTICAL );
|
||||||
|
@ -191,7 +191,7 @@ APPEARANCE_CONTROLS_BASE::APPEARANCE_CONTROLS_BASE( wxWindow* parent, wxWindowID
|
||||||
bBottomMargin->Add( bViewports, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
bBottomMargin->Add( bViewports, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
|
||||||
m_sizerOuter->Add( bBottomMargin, 0, wxBOTTOM|wxEXPAND, 2 );
|
m_sizerOuter->Add( bBottomMargin, 0, wxEXPAND|wxTOP|wxBOTTOM, 2 );
|
||||||
|
|
||||||
|
|
||||||
this->SetSizer( m_sizerOuter );
|
this->SetSizer( m_sizerOuter );
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
<property name="permission">protected</property>
|
<property name="permission">protected</property>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxEXPAND</property>
|
<property name="flag">wxEXPAND|wxBOTTOM</property>
|
||||||
<property name="proportion">1</property>
|
<property name="proportion">1</property>
|
||||||
<object class="wxNotebook" expanded="1">
|
<object class="wxNotebook" expanded="1">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
|
@ -1112,7 +1112,7 @@
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">2</property>
|
<property name="border">2</property>
|
||||||
<property name="flag">wxBOTTOM|wxEXPAND</property>
|
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxBoxSizer" expanded="1">
|
<object class="wxBoxSizer" expanded="1">
|
||||||
<property name="minimum_size"></property>
|
<property name="minimum_size"></property>
|
||||||
|
|
|
@ -28,9 +28,7 @@ PCB_SEARCH_PANE::PCB_SEARCH_PANE( PCB_EDIT_FRAME* aFrame ) :
|
||||||
m_brd = m_pcbFrame->GetBoard();
|
m_brd = m_pcbFrame->GetBoard();
|
||||||
|
|
||||||
if( m_brd != nullptr )
|
if( m_brd != nullptr )
|
||||||
{
|
|
||||||
m_brd->AddListener( this );
|
m_brd->AddListener( this );
|
||||||
}
|
|
||||||
|
|
||||||
m_pcbFrame->Connect( UNITS_CHANGED, wxCommandEventHandler( PCB_SEARCH_PANE::onUnitsChanged ),
|
m_pcbFrame->Connect( UNITS_CHANGED, wxCommandEventHandler( PCB_SEARCH_PANE::onUnitsChanged ),
|
||||||
nullptr, this );
|
nullptr, this );
|
||||||
|
@ -38,6 +36,10 @@ PCB_SEARCH_PANE::PCB_SEARCH_PANE( PCB_EDIT_FRAME* aFrame ) :
|
||||||
m_pcbFrame->Connect( BOARD_CHANGED, wxCommandEventHandler( PCB_SEARCH_PANE::onBoardChanged ),
|
m_pcbFrame->Connect( BOARD_CHANGED, wxCommandEventHandler( PCB_SEARCH_PANE::onBoardChanged ),
|
||||||
nullptr, this );
|
nullptr, this );
|
||||||
|
|
||||||
|
wxFont infoFont = KIUI::GetInfoFont( this );
|
||||||
|
SetFont( infoFont );
|
||||||
|
m_notebook->SetFont( infoFont );
|
||||||
|
|
||||||
AddSearcher( new FOOTPRINT_SEARCH_HANDLER( aFrame ) );
|
AddSearcher( new FOOTPRINT_SEARCH_HANDLER( aFrame ) );
|
||||||
AddSearcher( new ZONE_SEARCH_HANDLER( aFrame ) );
|
AddSearcher( new ZONE_SEARCH_HANDLER( aFrame ) );
|
||||||
AddSearcher( new NETS_SEARCH_HANDLER( aFrame ) );
|
AddSearcher( new NETS_SEARCH_HANDLER( aFrame ) );
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <base_units.h>
|
|
||||||
#include <footprint.h>
|
#include <footprint.h>
|
||||||
#include <pcb_edit_frame.h>
|
#include <pcb_edit_frame.h>
|
||||||
#include <pcb_marker.h>
|
#include <pcb_marker.h>
|
||||||
|
@ -32,13 +31,14 @@
|
||||||
|
|
||||||
|
|
||||||
FOOTPRINT_SEARCH_HANDLER::FOOTPRINT_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame ) :
|
FOOTPRINT_SEARCH_HANDLER::FOOTPRINT_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame ) :
|
||||||
SEARCH_HANDLER( wxT( "Footprint" ) ), m_frame( aFrame )
|
SEARCH_HANDLER( wxT( "Footprints" ) ),
|
||||||
|
m_frame( aFrame )
|
||||||
{
|
{
|
||||||
m_columnNames.emplace_back( wxT( "Reference" ) );
|
m_columns.emplace_back( wxT( "Reference" ), 1 );
|
||||||
m_columnNames.emplace_back( wxT( "Value" ) );
|
m_columns.emplace_back( wxT( "Value" ), 2 );
|
||||||
m_columnNames.emplace_back( wxT( "Layer" ) );
|
m_columns.emplace_back( wxT( "Layer" ), 1 );
|
||||||
m_columnNames.emplace_back( wxT( "X" ) );
|
m_columns.emplace_back( wxT( "X" ), 1 );
|
||||||
m_columnNames.emplace_back( wxT( "Y" ) );
|
m_columns.emplace_back( wxT( "Y" ), 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,15 +53,15 @@ int FOOTPRINT_SEARCH_HANDLER::Search( const wxString& aQuery )
|
||||||
|
|
||||||
for( FOOTPRINT* fp : board->Footprints() )
|
for( FOOTPRINT* fp : board->Footprints() )
|
||||||
{
|
{
|
||||||
if( aQuery.IsEmpty() ||
|
if( aQuery.IsEmpty()
|
||||||
( fp->Reference().Matches( frp, nullptr )
|
|| fp->Reference().Matches( frp, nullptr )
|
||||||
|| fp->Value().Matches( frp, nullptr ) ) )
|
|| fp->Value().Matches( frp, nullptr ) )
|
||||||
{
|
{
|
||||||
m_hitlist.push_back( fp );
|
m_hitlist.push_back( fp );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_hitlist.size();
|
return (int) m_hitlist.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ void FOOTPRINT_SEARCH_HANDLER::SelectItems( std::vector<long>& aItemRows )
|
||||||
|
|
||||||
for( long row : aItemRows )
|
for( long row : aItemRows )
|
||||||
{
|
{
|
||||||
if( row >= 0 && row < (long)m_hitlist.size() )
|
if( row >= 0 && row < (long) m_hitlist.size() )
|
||||||
{
|
{
|
||||||
FOOTPRINT* fp = m_hitlist[row];
|
FOOTPRINT* fp = m_hitlist[row];
|
||||||
selectedItems.push_back( fp );
|
selectedItems.push_back( fp );
|
||||||
|
@ -102,19 +102,20 @@ void FOOTPRINT_SEARCH_HANDLER::SelectItems( std::vector<long>& aItemRows )
|
||||||
if( selectedItems.size() )
|
if( selectedItems.size() )
|
||||||
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectItems, true, &selectedItems );
|
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectItems, true, &selectedItems );
|
||||||
|
|
||||||
m_frame->GetCanvas()->Refresh(0);
|
m_frame->GetCanvas()->Refresh( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ZONE_SEARCH_HANDLER::ZONE_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame ) :
|
ZONE_SEARCH_HANDLER::ZONE_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame ) :
|
||||||
SEARCH_HANDLER( wxT( "Zones" ) ), m_frame( aFrame )
|
SEARCH_HANDLER( wxT( "Zones" ) ),
|
||||||
|
m_frame( aFrame )
|
||||||
{
|
{
|
||||||
m_columnNames.emplace_back( wxT( "Name" ) );
|
m_columns.emplace_back( wxT( "Name" ), 2 );
|
||||||
m_columnNames.emplace_back( wxT( "Net" ) );
|
m_columns.emplace_back( wxT( "Net" ), 1 );
|
||||||
m_columnNames.emplace_back( wxT( "Layer" ) );
|
m_columns.emplace_back( wxT( "Layer" ), 1 );
|
||||||
m_columnNames.emplace_back( wxT( "Priority" ) );
|
m_columns.emplace_back( wxT( "Priority" ), 1 );
|
||||||
m_columnNames.emplace_back( wxT( "X" ) );
|
m_columns.emplace_back( wxT( "X" ), 1 );
|
||||||
m_columnNames.emplace_back( wxT( "Y" ) );
|
m_columns.emplace_back( wxT( "Y" ), 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -132,12 +133,10 @@ int ZONE_SEARCH_HANDLER::Search( const wxString& aQuery )
|
||||||
ZONE* zoneItem = dynamic_cast<ZONE*>( item );
|
ZONE* zoneItem = dynamic_cast<ZONE*>( item );
|
||||||
|
|
||||||
if( zoneItem && ( aQuery.IsEmpty() || zoneItem->Matches( frp, nullptr ) ) )
|
if( zoneItem && ( aQuery.IsEmpty() || zoneItem->Matches( frp, nullptr ) ) )
|
||||||
{
|
|
||||||
m_hitlist.push_back( zoneItem );
|
m_hitlist.push_back( zoneItem );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_hitlist.size();
|
return (int) m_hitlist.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -155,9 +154,7 @@ wxString ZONE_SEARCH_HANDLER::GetResultCell( int aRow, int aCol )
|
||||||
BOARD* board = m_frame->GetBoard();
|
BOARD* board = m_frame->GetBoard();
|
||||||
|
|
||||||
for( PCB_LAYER_ID layer : zone->GetLayerSet().Seq() )
|
for( PCB_LAYER_ID layer : zone->GetLayerSet().Seq() )
|
||||||
{
|
|
||||||
layers.Add( board->GetLayerName( layer ) );
|
layers.Add( board->GetLayerName( layer ) );
|
||||||
}
|
|
||||||
|
|
||||||
return wxJoin( layers, ',' );
|
return wxJoin( layers, ',' );
|
||||||
}
|
}
|
||||||
|
@ -175,9 +172,10 @@ wxString ZONE_SEARCH_HANDLER::GetResultCell( int aRow, int aCol )
|
||||||
void ZONE_SEARCH_HANDLER::SelectItems( std::vector<long>& aItemRows )
|
void ZONE_SEARCH_HANDLER::SelectItems( std::vector<long>& aItemRows )
|
||||||
{
|
{
|
||||||
std::vector<EDA_ITEM*> selectedItems;
|
std::vector<EDA_ITEM*> selectedItems;
|
||||||
|
|
||||||
for( long row : aItemRows )
|
for( long row : aItemRows )
|
||||||
{
|
{
|
||||||
if( row >= 0 && row < (long)m_hitlist.size() )
|
if( row >= 0 && row < (long) m_hitlist.size() )
|
||||||
{
|
{
|
||||||
ZONE* zone = m_hitlist[row];
|
ZONE* zone = m_hitlist[row];
|
||||||
selectedItems.push_back( zone );
|
selectedItems.push_back( zone );
|
||||||
|
@ -189,18 +187,19 @@ void ZONE_SEARCH_HANDLER::SelectItems( std::vector<long>& aItemRows )
|
||||||
if( selectedItems.size() )
|
if( selectedItems.size() )
|
||||||
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectItems, true, &selectedItems );
|
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectItems, true, &selectedItems );
|
||||||
|
|
||||||
m_frame->GetCanvas()->Refresh(0);
|
m_frame->GetCanvas()->Refresh( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEXT_SEARCH_HANDLER::TEXT_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame ) :
|
TEXT_SEARCH_HANDLER::TEXT_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame ) :
|
||||||
SEARCH_HANDLER( wxT( "Text" ) ), m_frame( aFrame )
|
SEARCH_HANDLER( wxT( "Text" ) ),
|
||||||
|
m_frame( aFrame )
|
||||||
{
|
{
|
||||||
m_columnNames.emplace_back( wxT( "Type" ) );
|
m_columns.emplace_back( wxT( "Type" ), 1 );
|
||||||
m_columnNames.emplace_back( wxT( "Text" ) );
|
m_columns.emplace_back( wxT( "Text" ), 3 );
|
||||||
m_columnNames.emplace_back( wxT( "Layer" ) );
|
m_columns.emplace_back( wxT( "Layer" ), 1 );
|
||||||
m_columnNames.emplace_back( wxT( "X" ) );
|
m_columns.emplace_back( wxT( "X" ), 1 );
|
||||||
m_columnNames.emplace_back( wxT( "Y" ) );
|
m_columns.emplace_back( wxT( "Y" ), 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -219,16 +218,12 @@ int TEXT_SEARCH_HANDLER::Search( const wxString& aQuery )
|
||||||
PCB_TEXTBOX* textBoxItem = dynamic_cast<PCB_TEXTBOX*>( item );
|
PCB_TEXTBOX* textBoxItem = dynamic_cast<PCB_TEXTBOX*>( item );
|
||||||
|
|
||||||
if( textItem && ( aQuery.IsEmpty() || textItem->Matches( frp, nullptr ) ) )
|
if( textItem && ( aQuery.IsEmpty() || textItem->Matches( frp, nullptr ) ) )
|
||||||
{
|
|
||||||
m_hitlist.push_back( textItem );
|
m_hitlist.push_back( textItem );
|
||||||
}
|
|
||||||
else if( textBoxItem && ( aQuery.IsEmpty() || textBoxItem->Matches( frp, nullptr ) ) )
|
else if( textBoxItem && ( aQuery.IsEmpty() || textBoxItem->Matches( frp, nullptr ) ) )
|
||||||
{
|
|
||||||
m_hitlist.push_back( textBoxItem );
|
m_hitlist.push_back( textBoxItem );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_hitlist.size();
|
return (int) m_hitlist.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -239,24 +234,16 @@ wxString TEXT_SEARCH_HANDLER::GetResultCell( int aRow, int aCol )
|
||||||
if( aCol == 0 )
|
if( aCol == 0 )
|
||||||
{
|
{
|
||||||
if( PCB_TEXT::ClassOf( text ) )
|
if( PCB_TEXT::ClassOf( text ) )
|
||||||
{
|
|
||||||
return _( "Text" );
|
return _( "Text" );
|
||||||
}
|
|
||||||
else if( PCB_TEXTBOX::ClassOf( text ) )
|
else if( PCB_TEXTBOX::ClassOf( text ) )
|
||||||
{
|
|
||||||
return _( "Textbox" );
|
return _( "Textbox" );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if( aCol == 1 )
|
else if( aCol == 1 )
|
||||||
{
|
{
|
||||||
if( PCB_TEXT::ClassOf( text ) )
|
if( PCB_TEXT::ClassOf( text ) )
|
||||||
{
|
|
||||||
return UnescapeString( static_cast<PCB_TEXT*>( text )->GetText() );
|
return UnescapeString( static_cast<PCB_TEXT*>( text )->GetText() );
|
||||||
}
|
|
||||||
else if( PCB_TEXTBOX::ClassOf( text ) )
|
else if( PCB_TEXTBOX::ClassOf( text ) )
|
||||||
{
|
|
||||||
return UnescapeString( static_cast<PCB_TEXTBOX*>( text )->GetShownText() );
|
return UnescapeString( static_cast<PCB_TEXTBOX*>( text )->GetShownText() );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if( aCol == 2 )
|
if( aCol == 2 )
|
||||||
return text->GetLayerName();
|
return text->GetLayerName();
|
||||||
|
@ -272,9 +259,10 @@ wxString TEXT_SEARCH_HANDLER::GetResultCell( int aRow, int aCol )
|
||||||
void TEXT_SEARCH_HANDLER::SelectItems( std::vector<long>& aItemRows )
|
void TEXT_SEARCH_HANDLER::SelectItems( std::vector<long>& aItemRows )
|
||||||
{
|
{
|
||||||
std::vector<EDA_ITEM*> selectedItems;
|
std::vector<EDA_ITEM*> selectedItems;
|
||||||
|
|
||||||
for( long row : aItemRows )
|
for( long row : aItemRows )
|
||||||
{
|
{
|
||||||
if( row >= 0 && row < (long)m_hitlist.size() )
|
if( row >= 0 && row < (long) m_hitlist.size() )
|
||||||
{
|
{
|
||||||
BOARD_ITEM* text = m_hitlist[row];
|
BOARD_ITEM* text = m_hitlist[row];
|
||||||
selectedItems.push_back( text );
|
selectedItems.push_back( text );
|
||||||
|
@ -286,15 +274,16 @@ void TEXT_SEARCH_HANDLER::SelectItems( std::vector<long>& aItemRows )
|
||||||
if( selectedItems.size() )
|
if( selectedItems.size() )
|
||||||
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectItems, true, &selectedItems );
|
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectItems, true, &selectedItems );
|
||||||
|
|
||||||
m_frame->GetCanvas()->Refresh(0);
|
m_frame->GetCanvas()->Refresh( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NETS_SEARCH_HANDLER::NETS_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame ) :
|
NETS_SEARCH_HANDLER::NETS_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame ) :
|
||||||
SEARCH_HANDLER( wxT( "Nets" ) ), m_frame( aFrame )
|
SEARCH_HANDLER( wxT( "Nets" ) ),
|
||||||
|
m_frame( aFrame )
|
||||||
{
|
{
|
||||||
m_columnNames.emplace_back( wxT( "Name" ) );
|
m_columns.emplace_back( wxT( "Name" ), 2 );
|
||||||
m_columnNames.emplace_back( wxT( "Class" ) );
|
m_columns.emplace_back( wxT( "Class" ), 2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -307,15 +296,14 @@ int NETS_SEARCH_HANDLER::Search( const wxString& aQuery )
|
||||||
frp.matchMode = EDA_SEARCH_MATCH_MODE::WILDCARD;
|
frp.matchMode = EDA_SEARCH_MATCH_MODE::WILDCARD;
|
||||||
|
|
||||||
BOARD* board = m_frame->GetBoard();
|
BOARD* board = m_frame->GetBoard();
|
||||||
|
|
||||||
for( NETINFO_ITEM* net : board->GetNetInfo() )
|
for( NETINFO_ITEM* net : board->GetNetInfo() )
|
||||||
{
|
{
|
||||||
if( net && ( aQuery.IsEmpty() || net->Matches( frp, nullptr ) ) )
|
if( net && ( aQuery.IsEmpty() || net->Matches( frp, nullptr ) ) )
|
||||||
{
|
|
||||||
m_hitlist.push_back( net );
|
m_hitlist.push_back( net );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_hitlist.size();
|
return (int) m_hitlist.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -338,6 +326,7 @@ void NETS_SEARCH_HANDLER::SelectItems( std::vector<long>& aItemRows )
|
||||||
ps->SetHighlight( false );
|
ps->SetHighlight( false );
|
||||||
|
|
||||||
std::vector<NETINFO_ITEM*> selectedItems;
|
std::vector<NETINFO_ITEM*> selectedItems;
|
||||||
|
|
||||||
for( long row : aItemRows )
|
for( long row : aItemRows )
|
||||||
{
|
{
|
||||||
if( row >= 0 && row < (long) m_hitlist.size() )
|
if( row >= 0 && row < (long) m_hitlist.size() )
|
||||||
|
|
Loading…
Reference in New Issue