|
|
|
@ -34,6 +34,7 @@ |
|
|
|
#include <settings/settings_manager.h>
|
|
|
|
#include <validators.h>
|
|
|
|
#include <wildcards_and_files_ext.h>
|
|
|
|
#include <eda_pattern_match.h>
|
|
|
|
|
|
|
|
#include <wx/wupdlock.h>
|
|
|
|
#include <wx/headerctrl.h>
|
|
|
|
@ -443,7 +444,12 @@ void PCB_NET_INSPECTOR_PANEL::buildNetsList( bool rebuildColumns ) |
|
|
|
} |
|
|
|
|
|
|
|
m_data_model->deleteAllItems(); |
|
|
|
m_custom_group_rules = cfg->custom_group_rules; |
|
|
|
|
|
|
|
m_custom_group_rules.clear(); |
|
|
|
|
|
|
|
for( const wxString& rule : cfg->custom_group_rules ) |
|
|
|
m_custom_group_rules.push_back( std::make_unique<EDA_COMBINED_MATCHER>( rule, CTX_NET ) ); |
|
|
|
|
|
|
|
m_data_model->addCustomGroups(); |
|
|
|
|
|
|
|
std::vector<std::unique_ptr<LIST_ITEM>> new_items; |
|
|
|
@ -1167,13 +1173,13 @@ void PCB_NET_INSPECTOR_PANEL::OnNetsListContextMenu( wxDataViewEvent& event ) |
|
|
|
wxMenu menu; |
|
|
|
|
|
|
|
// Net edit menu items
|
|
|
|
wxMenuItem* highlightNet = |
|
|
|
new wxMenuItem( &menu, ID_HIGHLIGHT_SELECTED_NETS, _( "Highlight Selected Net" ), |
|
|
|
wxMenuItem* highlightNet = new wxMenuItem( &menu, ID_HIGHLIGHT_SELECTED_NETS, |
|
|
|
_( "Highlight Selected Net" ), |
|
|
|
wxEmptyString, wxITEM_NORMAL ); |
|
|
|
menu.Append( highlightNet ); |
|
|
|
|
|
|
|
wxMenuItem* clearHighlighting = |
|
|
|
new wxMenuItem( &menu, ID_CLEAR_HIGHLIGHTING, _( "Clear Net Highlighting" ), |
|
|
|
wxMenuItem* clearHighlighting = new wxMenuItem( &menu, ID_CLEAR_HIGHLIGHTING, |
|
|
|
_( "Clear Net Highlighting" ), |
|
|
|
wxEmptyString, wxITEM_NORMAL ); |
|
|
|
menu.Append( clearHighlighting ); |
|
|
|
|
|
|
|
@ -1245,8 +1251,13 @@ void PCB_NET_INSPECTOR_PANEL::onAddGroup() |
|
|
|
wxString newGroupName; |
|
|
|
NETNAME_VALIDATOR validator( &newGroupName ); |
|
|
|
|
|
|
|
WX_TEXT_ENTRY_DIALOG dlg( this, _( "Group name:" ), _( "New Group" ), newGroupName ); |
|
|
|
WX_TEXT_ENTRY_DIALOG dlg( this, _( "Group name / pattern:" ), _( "New Group" ), newGroupName ); |
|
|
|
wxStaticText* help = new wxStaticText( &dlg, wxID_ANY, |
|
|
|
_( "(Use /.../ to indicate a regular expression.)" ) ); |
|
|
|
help->SetFont( KIUI::GetInfoFont( this ).Italic() ); |
|
|
|
dlg.m_ContentSizer->Add( help, 0, wxALL|wxEXPAND, 5 ); |
|
|
|
dlg.SetTextValidator( validator ); |
|
|
|
dlg.GetSizer()->SetSizeHints( &dlg ); |
|
|
|
|
|
|
|
if( dlg.ShowModal() != wxID_OK || dlg.GetValue().IsEmpty() ) |
|
|
|
return; //Aborted by user
|
|
|
|
@ -1254,19 +1265,16 @@ void PCB_NET_INSPECTOR_PANEL::onAddGroup() |
|
|
|
newGroupName = UnescapeString( dlg.GetValue() ); |
|
|
|
|
|
|
|
if( newGroupName == "" ) |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
auto pred = [&]( wxString& rule ) |
|
|
|
if( std::find_if( m_custom_group_rules.begin(), m_custom_group_rules.end(), |
|
|
|
[&]( std::unique_ptr<EDA_COMBINED_MATCHER>& rule ) |
|
|
|
{ |
|
|
|
return rule.Upper() == newGroupName.Upper(); |
|
|
|
}; |
|
|
|
|
|
|
|
if( std::find_if( m_custom_group_rules.begin(), m_custom_group_rules.end(), pred ) |
|
|
|
== m_custom_group_rules.end() ) |
|
|
|
return rule->GetPattern().Upper() == newGroupName.Upper(); |
|
|
|
} ) == m_custom_group_rules.end() ) |
|
|
|
{ |
|
|
|
m_custom_group_rules.push_back( newGroupName ); |
|
|
|
m_custom_group_rules.push_back( std::make_unique<EDA_COMBINED_MATCHER>( newGroupName, |
|
|
|
CTX_NET ) ); |
|
|
|
SaveSettings(); |
|
|
|
} |
|
|
|
|
|
|
|
@ -1317,13 +1325,15 @@ void PCB_NET_INSPECTOR_PANEL::OnConfigButton( wxCommandEvent& event ) |
|
|
|
wxMenu menu; |
|
|
|
|
|
|
|
// Filtering menu items
|
|
|
|
wxMenuItem* filterByNetName = new wxMenuItem( |
|
|
|
&menu, ID_FILTER_BY_NET_NAME, _( "Filter by Net Name" ), wxEmptyString, wxITEM_CHECK ); |
|
|
|
wxMenuItem* filterByNetName = new wxMenuItem( &menu, ID_FILTER_BY_NET_NAME, |
|
|
|
_( "Filter by Net Name" ), |
|
|
|
wxEmptyString, wxITEM_CHECK ); |
|
|
|
filterByNetName->Check( cfg.filter_by_net_name ); |
|
|
|
menu.Append( filterByNetName ); |
|
|
|
|
|
|
|
wxMenuItem* filterByNetclass = new wxMenuItem( |
|
|
|
&menu, ID_FILTER_BY_NETCLASS, _( "Filter by Netclass" ), wxEmptyString, wxITEM_CHECK ); |
|
|
|
wxMenuItem* filterByNetclass = new wxMenuItem( &menu, ID_FILTER_BY_NETCLASS, |
|
|
|
_( "Filter by Netclass" ), |
|
|
|
wxEmptyString, wxITEM_CHECK ); |
|
|
|
filterByNetclass->Check( cfg.filter_by_netclass ); |
|
|
|
menu.Append( filterByNetclass ); |
|
|
|
|
|
|
|
@ -1347,8 +1357,8 @@ void PCB_NET_INSPECTOR_PANEL::OnConfigButton( wxCommandEvent& event ) |
|
|
|
wxEmptyString, wxITEM_NORMAL ); |
|
|
|
menu.Append( addGroup ); |
|
|
|
|
|
|
|
wxMenuItem* removeSelectedGroup = |
|
|
|
new wxMenuItem( &menu, ID_REMOVE_SELECTED_GROUP, _( "Remove Selected Custom Group" ), |
|
|
|
wxMenuItem* removeSelectedGroup = new wxMenuItem( &menu, ID_REMOVE_SELECTED_GROUP, |
|
|
|
_( "Remove Selected Custom Group" ), |
|
|
|
wxEmptyString, wxITEM_NORMAL ); |
|
|
|
menu.Append( removeSelectedGroup ); |
|
|
|
|
|
|
|
@ -1357,21 +1367,22 @@ void PCB_NET_INSPECTOR_PANEL::OnConfigButton( wxCommandEvent& event ) |
|
|
|
removeSelectedGroup->Enable( false ); |
|
|
|
} |
|
|
|
|
|
|
|
wxMenuItem* removeCustomGroups = |
|
|
|
new wxMenuItem( &menu, ID_REMOVE_GROUPS, _( "Remove All Custom Groups" ), wxEmptyString, |
|
|
|
wxITEM_NORMAL ); |
|
|
|
wxMenuItem* removeCustomGroups = new wxMenuItem( &menu, ID_REMOVE_GROUPS, |
|
|
|
_( "Remove All Custom Groups" ), |
|
|
|
wxEmptyString, wxITEM_NORMAL ); |
|
|
|
menu.Append( removeCustomGroups ); |
|
|
|
removeCustomGroups->Enable( m_custom_group_rules.size() != 0 ); |
|
|
|
|
|
|
|
menu.AppendSeparator(); |
|
|
|
|
|
|
|
wxMenuItem* showZeroNetPads = new wxMenuItem( |
|
|
|
&menu, ID_SHOW_ZERO_NET_PADS, _( "Show Zero Pad Nets" ), wxEmptyString, wxITEM_CHECK ); |
|
|
|
wxMenuItem* showZeroNetPads = new wxMenuItem( &menu, ID_SHOW_ZERO_NET_PADS, |
|
|
|
_( "Show Zero Pad Nets" ), |
|
|
|
wxEmptyString, wxITEM_CHECK ); |
|
|
|
showZeroNetPads->Check( m_show_zero_pad_nets ); |
|
|
|
menu.Append( showZeroNetPads ); |
|
|
|
|
|
|
|
wxMenuItem* showUnconnectedNets = |
|
|
|
new wxMenuItem( &menu, ID_SHOW_UNCONNECTED_NETS, _( "Show Unconnected Nets" ), |
|
|
|
wxMenuItem* showUnconnectedNets = new wxMenuItem( &menu, ID_SHOW_UNCONNECTED_NETS, |
|
|
|
_( "Show Unconnected Nets" ), |
|
|
|
wxEmptyString, wxITEM_CHECK ); |
|
|
|
showUnconnectedNets->Check( m_show_unconnected_nets ); |
|
|
|
menu.Append( showUnconnectedNets ); |
|
|
|
@ -1379,8 +1390,8 @@ void PCB_NET_INSPECTOR_PANEL::OnConfigButton( wxCommandEvent& event ) |
|
|
|
menu.AppendSeparator(); |
|
|
|
|
|
|
|
// Report generation
|
|
|
|
wxMenuItem* generateReport = |
|
|
|
new wxMenuItem( &menu, ID_GENERATE_REPORT, _( "Save Net Inspector Report" ), |
|
|
|
wxMenuItem* generateReport = new wxMenuItem( &menu, ID_GENERATE_REPORT, |
|
|
|
_( "Save Net Inspector Report" ), |
|
|
|
wxEmptyString, wxITEM_NORMAL ); |
|
|
|
menu.Append( generateReport ); |
|
|
|
|
|
|
|
@ -1428,85 +1439,69 @@ void PCB_NET_INSPECTOR_PANEL::onSettingsMenu( wxCommandEvent& event ) |
|
|
|
switch( event.GetId() ) |
|
|
|
{ |
|
|
|
case ID_ADD_NET: |
|
|
|
{ |
|
|
|
onAddNet(); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
case ID_RENAME_NET: |
|
|
|
{ |
|
|
|
onRenameSelectedNet(); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
case ID_DELETE_NET: |
|
|
|
{ |
|
|
|
onDeleteSelectedNet(); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
case ID_ADD_GROUP: |
|
|
|
{ |
|
|
|
onAddGroup(); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
case ID_GROUP_BY_CONSTRAINT: |
|
|
|
{ |
|
|
|
m_group_by_constraint = !m_group_by_constraint; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
case ID_GROUP_BY_NETCLASS: |
|
|
|
{ |
|
|
|
m_group_by_netclass = !m_group_by_netclass; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
case ID_FILTER_BY_NET_NAME: |
|
|
|
{ |
|
|
|
m_filter_by_net_name = !m_filter_by_net_name; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
case ID_FILTER_BY_NETCLASS: |
|
|
|
{ |
|
|
|
m_filter_by_netclass = !m_filter_by_netclass; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
case ID_REMOVE_SELECTED_GROUP: |
|
|
|
{ |
|
|
|
onRemoveSelectedGroup(); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
case ID_REMOVE_GROUPS: |
|
|
|
{ |
|
|
|
m_custom_group_rules.clear(); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
case ID_SHOW_ZERO_NET_PADS: |
|
|
|
{ |
|
|
|
m_show_zero_pad_nets = !m_show_zero_pad_nets; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
case ID_SHOW_UNCONNECTED_NETS: |
|
|
|
{ |
|
|
|
m_show_unconnected_nets = !m_show_unconnected_nets; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
case ID_GENERATE_REPORT: |
|
|
|
{ |
|
|
|
generateReport(); |
|
|
|
saveAndRebuild = false; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
case ID_HIGHLIGHT_SELECTED_NETS: |
|
|
|
{ |
|
|
|
highlightSelectedNets(); |
|
|
|
saveAndRebuild = false; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
case ID_CLEAR_HIGHLIGHTING: |
|
|
|
{ |
|
|
|
onClearHighlighting(); |
|
|
|
saveAndRebuild = false; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
default: |
|
|
|
{ |
|
|
|
if( event.GetId() >= ID_HIDE_COLUMN ) |
|
|
|
{ |
|
|
|
const int columnId = event.GetId() - ID_HIDE_COLUMN; |
|
|
|
@ -1517,7 +1512,6 @@ void PCB_NET_INSPECTOR_PANEL::onSettingsMenu( wxCommandEvent& event ) |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if( saveAndRebuild ) |
|
|
|
{ |
|
|
|
@ -1531,14 +1525,16 @@ void PCB_NET_INSPECTOR_PANEL::onRemoveSelectedGroup() |
|
|
|
{ |
|
|
|
if( m_netsList->GetSelectedItemsCount() == 1 ) |
|
|
|
{ |
|
|
|
const LIST_ITEM* selItem = |
|
|
|
static_cast<const LIST_ITEM*>( m_netsList->GetSelection().GetID() ); |
|
|
|
auto* selItem = static_cast<const LIST_ITEM*>( m_netsList->GetSelection().GetID() ); |
|
|
|
|
|
|
|
if( selItem->GetIsGroup() ) |
|
|
|
{ |
|
|
|
wxString groupName = selItem->GetGroupName(); |
|
|
|
auto groupIter = std::find( m_custom_group_rules.begin(), m_custom_group_rules.end(), |
|
|
|
groupName ); |
|
|
|
auto groupIter = std::find_if( m_custom_group_rules.begin(), m_custom_group_rules.end(), |
|
|
|
[&]( std::unique_ptr<EDA_COMBINED_MATCHER>& rule ) |
|
|
|
{ |
|
|
|
return rule->GetPattern() == groupName; |
|
|
|
} ); |
|
|
|
|
|
|
|
if( groupIter != m_custom_group_rules.end() ) |
|
|
|
{ |
|
|
|
@ -1575,13 +1571,15 @@ void PCB_NET_INSPECTOR_PANEL::generateReport() |
|
|
|
|
|
|
|
if( col.has_units ) |
|
|
|
{ |
|
|
|
txt += wxString::Format( _( "%s (%s)" ), col.csv_name, |
|
|
|
txt += wxString::Format( _( "%s (%s)" ), |
|
|
|
col.csv_name, |
|
|
|
EDA_UNIT_UTILS::GetLabel( m_frame->GetUserUnits() ) ); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
txt += col.csv_name; |
|
|
|
} |
|
|
|
|
|
|
|
txt += wxT( "\";" ); |
|
|
|
} |
|
|
|
|
|
|
|
@ -1958,16 +1956,12 @@ void PCB_NET_INSPECTOR_PANEL::SaveSettings() |
|
|
|
for( std::pair<wxString, wxDataViewItem>& item : groupItems ) |
|
|
|
{ |
|
|
|
if( m_netsList->IsExpanded( item.second ) ) |
|
|
|
{ |
|
|
|
cfg.expanded_rows.push_back( item.first ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Customer group rules
|
|
|
|
cfg.custom_group_rules.clear(); |
|
|
|
|
|
|
|
for( const wxString& rule : m_custom_group_rules ) |
|
|
|
{ |
|
|
|
cfg.custom_group_rules.push_back( rule ); |
|
|
|
} |
|
|
|
for( const std::unique_ptr<EDA_COMBINED_MATCHER>& rule : m_custom_group_rules ) |
|
|
|
cfg.custom_group_rules.push_back( rule->GetPattern() ); |
|
|
|
} |