Move Net Inspector dialog to a widget panel in pcbnew

Introduces some updates to the inspector, and a number of bug fixes:

- Correctly handles changes in board stackup
- Correctly handles unit change events
- Correctly handles language change events
- All layout / panel settings are stored to the project settings
- Retains ability to create net report
- Simple filter searches on net name and net class name (stored in settings)
- Allows hide / show of columns (stored in settings)
- Grouping by netclass (stored in settings)
- Optional filtering by net name (stored in settings)
- Optional filtering by net class (stored in settings)
- Custom grouping by net name match
This commit is contained in:
JamesJ 2024-03-04 23:00:26 +00:00 committed by Jon Evans
parent 4e6cd0d293
commit a763d613e5
31 changed files with 3524 additions and 3738 deletions

View File

@ -61,6 +61,7 @@
#include <drawing_sheet/ds_draw_item.h>
#include <widgets/msgpanel.h>
#include <widgets/properties_panel.h>
#include <widgets/net_inspector_panel.h>
#include <wx/event.h>
#include <wx/snglinst.h>
#include <widgets/ui_common.h>
@ -119,6 +120,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
m_findReplaceData = std::make_unique<EDA_SEARCH_DATA>();
m_hotkeyPopup = nullptr;
m_propertiesPanel = nullptr;
m_netInspectorPanel = nullptr;
SetUserUnits( EDA_UNITS::MILLIMETRES );
@ -1197,6 +1199,12 @@ void EDA_DRAW_FRAME::ShowChangedLanguage()
wxAuiPaneInfo& properties_pane_info = m_auimgr.GetPane( m_propertiesPanel );
properties_pane_info.Caption( _( "Properties" ) );
}
if( m_netInspectorPanel )
{
wxAuiPaneInfo& net_inspector_panel_info = m_auimgr.GetPane( m_netInspectorPanel );
net_inspector_panel_info.Caption( _( "Net Inspector" ) );
}
}

View File

@ -189,6 +189,36 @@ PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS( PROJECT* aProject, const wxStrin
m_params.emplace_back( new PARAM<wxString>( "git.ssh_key",
&m_GitSSHKey, "" ) );
m_params.emplace_back( new PARAM<wxString>( "net_inspector_panel.filter_text",
&m_NetInspectorPanel.filter_text, "" ) );
m_params.emplace_back( new PARAM<bool>( "net_inspector_panel.filter_by_net_name",
&m_NetInspectorPanel.filter_by_net_name, true ) );
m_params.emplace_back( new PARAM<bool>( "net_inspector_panel.filter_by_netclass",
&m_NetInspectorPanel.filter_by_netclass, true ) );
m_params.emplace_back( new PARAM<bool>( "net_inspector_panel.group_by_netclass",
&m_NetInspectorPanel.group_by_netclass, false ) );
m_params.emplace_back( new PARAM<bool>( "net_inspector_panel.group_by_constraint",
&m_NetInspectorPanel.group_by_constraint, false ) );
m_params.emplace_back( new PARAM_LIST<wxString>( "net_inspector_panel.custom_group_rules",
&m_NetInspectorPanel.custom_group_rules,
{} ) );
m_params.emplace_back( new PARAM<bool>( "net_inspector_panel.show_zero_pad_nets",
&m_NetInspectorPanel.show_zero_pad_nets, false ) );
m_params.emplace_back( new PARAM<bool>( "net_inspector_panel.show_unconnected_nets",
&m_NetInspectorPanel.show_unconnected_nets, false ) );
m_params.emplace_back( new PARAM<int>( "net_inspector_panel.sorting_column",
&m_NetInspectorPanel.sorting_column, -1 ) );
m_params.emplace_back( new PARAM<bool>( "net_inspector_panel.sort_ascending",
&m_NetInspectorPanel.sort_order_asc, true ) );
m_params.emplace_back( new PARAM_LIST<int>( "net_inspector_panel.col_order",
&m_NetInspectorPanel.col_order, {} ) );
m_params.emplace_back( new PARAM_LIST<int>( "net_inspector_panel.col_widths",
&m_NetInspectorPanel.col_widths, {} ) );
m_params.emplace_back( new PARAM_LIST<bool>( "net_inspector_panel.col_hidden",
&m_NetInspectorPanel.col_hidden, {} ) );
m_params.emplace_back( new PARAM_LIST<wxString>( "net_inspector_panel.expanded_rows",
&m_NetInspectorPanel.expanded_rows, {} ) );
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "project.files",
[&]() -> nlohmann::json
{

View File

@ -140,6 +140,7 @@ bool PARAM_LIST<ValueType>::MatchesFile( JSON_SETTINGS* aSettings ) const
}
template class PARAM_LIST<bool>;
template class PARAM_LIST<int>;
template class PARAM_LIST<double>;
template class PARAM_LIST<wxString>;

View File

@ -46,6 +46,7 @@ class wxFindReplaceData;
class SEARCH_PANE;
class HOTKEY_CYCLE_POPUP;
class PROPERTIES_PANEL;
class NET_INSPECTOR_PANEL;
enum class BITMAP_TYPE;
namespace KIGFX
@ -401,6 +402,8 @@ public:
static const wxString PropertiesPaneName() { return wxS( "PropertiesManager" ); }
static const wxString NetInspectorPanelName() { return wxS( "NetInspector" ); }
/**
* Fetch an item by KIID. Frame-type-specific implementation.
*/
@ -528,33 +531,34 @@ protected:
///< Prevents opening same file multiple times.
std::unique_ptr<LOCKFILE> m_file_checker;
COLOR4D m_gridColor; // Grid color
COLOR4D m_drawBgColor; // The background color of the draw canvas; BLACK for
// Pcbnew, BLACK or WHITE for Eeschema
int m_undoRedoCountMax; // Default Undo/Redo command Max depth, to be handed
// to screens
bool m_polarCoords; // For those frames that support polar coordinates
COLOR4D m_gridColor; // Grid color
COLOR4D m_drawBgColor; // The background color of the draw canvas; BLACK for
// Pcbnew, BLACK or WHITE for Eeschema
int m_undoRedoCountMax; // Default Undo/Redo command Max depth, to be handed
// to screens
bool m_polarCoords; // For those frames that support polar coordinates
bool m_showBorderAndTitleBlock; // Show the drawing sheet (border & title block).
bool m_showBorderAndTitleBlock; // Show the drawing sheet (border & title block).
wxChoice* m_gridSelectBox;
wxChoice* m_zoomSelectBox;
wxChoice* m_gridSelectBox;
wxChoice* m_zoomSelectBox;
ACTION_TOOLBAR* m_mainToolBar;
ACTION_TOOLBAR* m_auxiliaryToolBar; // Additional tools under main toolbar
ACTION_TOOLBAR* m_drawToolBar; // Drawing tools (typically on right edge of window)
ACTION_TOOLBAR* m_optionsToolBar; // Options (typically on left edge of window)
ACTION_TOOLBAR* m_mainToolBar;
ACTION_TOOLBAR* m_auxiliaryToolBar; // Additional tools under main toolbar
ACTION_TOOLBAR* m_drawToolBar; // Drawing tools (typically on right edge of window)
ACTION_TOOLBAR* m_optionsToolBar; // Options (typically on left edge of window)
std::unique_ptr<EDA_SEARCH_DATA> m_findReplaceData;
wxArrayString m_findStringHistoryList;
wxArrayString m_replaceStringHistoryList;
wxArrayString m_findStringHistoryList;
wxArrayString m_replaceStringHistoryList;
EDA_MSG_PANEL* m_messagePanel;
int m_msgFrameHeight;
EDA_MSG_PANEL* m_messagePanel;
int m_msgFrameHeight;
COLOR_SETTINGS* m_colorSettings;
SEARCH_PANE* m_searchPane;
PROPERTIES_PANEL* m_propertiesPanel;
COLOR_SETTINGS* m_colorSettings;
SEARCH_PANE* m_searchPane;
PROPERTIES_PANEL* m_propertiesPanel;
NET_INSPECTOR_PANEL* m_netInspectorPanel;
HOTKEY_CYCLE_POPUP* m_hotkeyPopup;

View File

@ -257,5 +257,40 @@ private:
std::vector<VIEWPORT3D>* m_viewports;
};
/**
* Persisted state for the net inspector panel
*/
struct PANEL_NET_INSPECTOR_SETTINGS
{
wxString filter_text;
bool filter_by_net_name;
bool filter_by_netclass;
bool group_by_netclass;
bool group_by_constraint;
std::vector<wxString> custom_group_rules;
bool show_zero_pad_nets;
bool show_unconnected_nets;
int sorting_column;
bool sort_order_asc;
std::vector<int> col_order;
std::vector<int> col_widths;
std::vector<bool> col_hidden;
std::vector<wxString> expanded_rows;
PANEL_NET_INSPECTOR_SETTINGS()
{
filter_text = "";
filter_by_net_name = true;
filter_by_netclass = true;
group_by_netclass = false;
group_by_constraint = false;
show_zero_pad_nets = false;
show_unconnected_nets = false;
sorting_column = -1;
sort_order_asc = true;
}
};
#endif // KICAD_BOARD_PROJECT_SETTINGS_H

View File

@ -114,6 +114,9 @@ public:
/// The current net color mode
NET_COLOR_MODE m_NetColorMode;
/// The state of the net inspector panel
PANEL_NET_INSPECTOR_SETTINGS m_NetInspectorPanel;
/// The current setting for whether to automatically adjust track widths to match
bool m_AutoTrackWidth;

View File

@ -113,8 +113,6 @@ set( PCBNEW_DIALOGS
dialogs/dialog_layer_selection_base.cpp
dialogs/dialog_move_exact.cpp
dialogs/dialog_move_exact_base.cpp
dialogs/dialog_net_inspector.cpp
dialogs/dialog_net_inspector_base.cpp
dialogs/dialog_import_netlist.cpp
dialogs/dialog_import_netlist_base.cpp
dialogs/dialog_non_copper_zones_properties.cpp
@ -397,6 +395,8 @@ set( PCBNEW_CLASS_SRCS
widgets/pcb_properties_panel.cpp
widgets/pcb_search_pane.cpp
widgets/search_handlers.cpp
widgets/net_inspector_panel.cpp
widgets/pcb_net_inspector_panel.cpp
)

File diff suppressed because it is too large Load Diff

View File

@ -1,125 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 Oleg Endo <olegendo@gcc.gnu.org>
* Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#pragma once
#include <board.h>
#include <optional>
#include <dialog_net_inspector_base.h>
class PCB_EDIT_FRAME;
class NETINFO_ITEM;
class BOARD;
class BOARD_ITEM;
class CN_ITEM;
class EDA_PATTERN_MATCH;
class PCB_TRACK;
/**
* Event sent to parent when dialog is mode-less.
*/
wxDECLARE_EVENT( EDA_EVT_CLOSE_NET_INSPECTOR_DIALOG, wxCommandEvent );
class DIALOG_NET_INSPECTOR : public DIALOG_NET_INSPECTOR_BASE, public BOARD_LISTENER
{
public:
DIALOG_NET_INSPECTOR( PCB_EDIT_FRAME* aParent );
~DIALOG_NET_INSPECTOR();
virtual void OnBoardItemAdded( BOARD& aBoard, BOARD_ITEM* aBoardItem ) override;
virtual void OnBoardItemsAdded( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItems ) override;
virtual void OnBoardItemRemoved( BOARD& aBoard, BOARD_ITEM* aBoardItem ) override;
virtual void OnBoardItemsRemoved( BOARD& aBoard,
std::vector<BOARD_ITEM*>& aBoardItems ) override;
virtual void OnBoardNetSettingsChanged( BOARD& aBoard ) override;
virtual void OnBoardItemChanged( BOARD& aBoard, BOARD_ITEM* aBoardItem ) override;
virtual void OnBoardItemsChanged( BOARD& aBoard,
std::vector<BOARD_ITEM*>& aBoardItems ) override;
virtual void OnBoardHighlightNetChanged( BOARD& aBoard ) override;
protected:
virtual void onClose( wxCloseEvent& aEvent ) override;
private:
struct COLUMN_DESC;
class LIST_ITEM;
struct LIST_ITEM_NETCODE_CMP_LESS;
using LIST_ITEM_ITER = std::vector<std::unique_ptr<LIST_ITEM>>::iterator;
using LIST_ITEM_CONST_ITER = std::vector<std::unique_ptr<LIST_ITEM>>::const_iterator;
wxString formatNetCode( const NETINFO_ITEM* aNet ) const;
wxString formatNetName( const NETINFO_ITEM* aNet ) const;
wxString formatCount( unsigned int aValue ) const;
wxString formatLength( int64_t aValue ) const;
std::vector<CN_ITEM*> relevantConnectivityItems() const;
bool netFilterMatches( NETINFO_ITEM* aNet ) const;
void updateNet( NETINFO_ITEM* aNet );
unsigned int calculateViaLength( const PCB_TRACK* ) const;
void onSelChanged( wxDataViewEvent& event ) override;
void onSelChanged();
void onSortingChanged( wxDataViewEvent& event ) override;
void onFilterChange( wxCommandEvent& event ) override;
void onAddNet( wxCommandEvent& event ) override;
void onRenameNet( wxCommandEvent& event ) override;
void onDeleteNet( wxCommandEvent& event ) override;
void onReport( wxCommandEvent& event ) override;
std::unique_ptr<LIST_ITEM> buildNewItem( NETINFO_ITEM* aNet, unsigned int aPadCount,
const std::vector<CN_ITEM*>& aCNItems );
void buildNetsList();
void setColumnWidths();
void adjustListColumns();
void onUnitsChanged( wxCommandEvent& event );
void onBoardChanged( wxCommandEvent& event );
void updateDisplayedRowValues( const std::optional<LIST_ITEM_ITER>& aRow );
// special zero-netcode item. unconnected pads etc might use different
// (dummy) NETINFO_ITEM. redirect all of them to this item, which we get
// from the board object in buildNetsList.
NETINFO_ITEM* m_zero_netitem;
std::vector<std::unique_ptr<EDA_PATTERN_MATCH>> m_netFilter;
std::vector<std::unique_ptr<EDA_PATTERN_MATCH>> m_groupFilter;
BOARD* m_brd;
PCB_EDIT_FRAME* m_frame;
bool m_in_reporting = false;
bool m_in_build_nets_list = false;
bool m_filter_change_no_rebuild = false;
wxSize m_size;
std::vector<COLUMN_DESC> m_columns;
class DATA_MODEL;
wxObjectDataPtr<DATA_MODEL> m_data_model;
friend DATA_MODEL;
};

View File

@ -1,141 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "widgets/std_bitmap_button.h"
#include "dialog_net_inspector_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_NET_INSPECTOR_BASE::DIALOG_NET_INSPECTOR_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bTopSizer;
bTopSizer = new wxBoxSizer( wxHORIZONTAL );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 0, 3, 5, 5 );
fgSizer1->AddGrowableCol( 1 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextFilter = new wxStaticText( this, wxID_ANY, _("Net name filter:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextFilter->Wrap( -1 );
fgSizer1->Add( m_staticTextFilter, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5 );
m_textCtrlFilter = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_textCtrlFilter, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_cbShowZeroPad = new wxCheckBox( this, wxID_ANY, _("Show zero pad nets"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbShowZeroPad->SetValue(true);
fgSizer1->Add( m_cbShowZeroPad, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_groupBy = new wxCheckBox( this, wxID_ANY, _("Group by:"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_groupBy, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5 );
m_groupByText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_groupByText, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_groupByKind = new wxComboBox( this, wxID_ANY, _("Wildcard"), wxDefaultPosition, wxSize( -1,-1 ), 0, NULL, wxCB_DROPDOWN|wxCB_READONLY );
m_groupByKind->Append( _("Wildcard") );
m_groupByKind->Append( _("RegEx") );
m_groupByKind->Append( _("Wildcard Substr") );
m_groupByKind->Append( _("RegEx Substr") );
m_groupByKind->SetSelection( 0 );
fgSizer1->Add( m_groupByKind, 0, wxALIGN_CENTER|wxLEFT, 5 );
bTopSizer->Add( fgSizer1, 1, wxEXPAND, 5 );
bSizerMain->Add( bTopSizer, 0, wxEXPAND|wxALL, 5 );
wxBoxSizer* bMidSizer;
bMidSizer = new wxBoxSizer( wxHORIZONTAL );
bSizerMain->Add( bMidSizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_netsList = new wxDataViewCtrl( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxDV_HORIZ_RULES|wxDV_MULTIPLE|wxDV_VERT_RULES );
m_netsList->SetMinSize( wxSize( 480,200 ) );
bSizerMain->Add( m_netsList, 1, wxEXPAND|wxLEFT|wxRIGHT, 5 );
wxBoxSizer* bSizerListButtons;
bSizerListButtons = new wxBoxSizer( wxHORIZONTAL );
m_addNet = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
bSizerListButtons->Add( m_addNet, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_renameNet = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
bSizerListButtons->Add( m_renameNet, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
bSizerListButtons->Add( 20, 0, 0, wxEXPAND, 5 );
m_deleteNet = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
bSizerListButtons->Add( m_deleteNet, 0, wxALIGN_CENTER_VERTICAL, 5 );
bSizerListButtons->Add( 0, 0, 1, wxEXPAND, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
bSizerListButtons->Add( m_sdbSizer, 0, wxEXPAND, 5 );
m_ReportButt = new wxButton( this, wxID_ANY, _("Create Report..."), wxDefaultPosition, wxDefaultSize, 0 );
bSizerListButtons->Add( m_ReportButt, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
bSizerMain->Add( bSizerListButtons, 0, wxEXPAND|wxALL, 5 );
this->SetSizer( bSizerMain );
this->Layout();
bSizerMain->Fit( this );
this->Centre( wxBOTH );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_NET_INSPECTOR_BASE::onClose ) );
m_textCtrlFilter->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_NET_INSPECTOR_BASE::onFilterChange ), NULL, this );
m_cbShowZeroPad->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NET_INSPECTOR_BASE::onFilterChange ), NULL, this );
m_groupBy->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NET_INSPECTOR_BASE::onFilterChange ), NULL, this );
m_groupByText->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_NET_INSPECTOR_BASE::onFilterChange ), NULL, this );
m_groupByKind->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_NET_INSPECTOR_BASE::onFilterChange ), NULL, this );
m_netsList->Connect( wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED, wxDataViewEventHandler( DIALOG_NET_INSPECTOR_BASE::onSortingChanged ), NULL, this );
m_netsList->Connect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_NET_INSPECTOR_BASE::onSelChanged ), NULL, this );
m_addNet->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NET_INSPECTOR_BASE::onAddNet ), NULL, this );
m_renameNet->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NET_INSPECTOR_BASE::onRenameNet ), NULL, this );
m_deleteNet->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NET_INSPECTOR_BASE::onDeleteNet ), NULL, this );
m_ReportButt->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NET_INSPECTOR_BASE::onReport ), NULL, this );
}
DIALOG_NET_INSPECTOR_BASE::~DIALOG_NET_INSPECTOR_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_NET_INSPECTOR_BASE::onClose ) );
m_textCtrlFilter->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_NET_INSPECTOR_BASE::onFilterChange ), NULL, this );
m_cbShowZeroPad->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NET_INSPECTOR_BASE::onFilterChange ), NULL, this );
m_groupBy->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NET_INSPECTOR_BASE::onFilterChange ), NULL, this );
m_groupByText->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_NET_INSPECTOR_BASE::onFilterChange ), NULL, this );
m_groupByKind->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_NET_INSPECTOR_BASE::onFilterChange ), NULL, this );
m_netsList->Disconnect( wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED, wxDataViewEventHandler( DIALOG_NET_INSPECTOR_BASE::onSortingChanged ), NULL, this );
m_netsList->Disconnect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_NET_INSPECTOR_BASE::onSelChanged ), NULL, this );
m_addNet->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NET_INSPECTOR_BASE::onAddNet ), NULL, this );
m_renameNet->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NET_INSPECTOR_BASE::onRenameNet ), NULL, this );
m_deleteNet->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NET_INSPECTOR_BASE::onDeleteNet ), NULL, this );
m_ReportButt->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NET_INSPECTOR_BASE::onReport ), NULL, this );
}

View File

@ -1,869 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="16" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">dialog_net_inspector_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">dialog_net_inspector</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="center">wxBOTH</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size">-1,-1</property>
<property name="name">DIALOG_NET_INSPECTOR_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Net Inspector</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnClose">onClose</event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerMain</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bTopSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">3</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1</property>
<property name="growablerows"></property>
<property name="hgap">5</property>
<property name="minimum_size"></property>
<property name="name">fgSizer1</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">0</property>
<property name="vgap">5</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Net name filter:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticTextFilter</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_textCtrlFilter</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnText">onFilterChange</event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">1</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Show zero pad nets</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_cbShowZeroPad</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnCheckBox">onFilterChange</event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Group by:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_groupBy</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnCheckBox">onFilterChange</event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT</property>
<property name="proportion">1</property>
<object class="wxTextCtrl" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_groupByText</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnText">onFilterChange</event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxComboBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;Wildcard&quot; &quot;RegEx&quot; &quot;Wildcard Substr&quot; &quot;RegEx Substr&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">0</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_groupByKind</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">0</property>
<property name="show">1</property>
<property name="size">-1,-1</property>
<property name="style">wxCB_DROPDOWN|wxCB_READONLY</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">Wildcard</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnCombobox">onFilterChange</event>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bMidSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">1</property>
<object class="wxDataViewCtrl" expanded="0">
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size">480,200</property>
<property name="name">m_netsList</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="style">wxDV_HORIZ_RULES|wxDV_MULTIPLE|wxDV_VERT_RULES</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnDataViewCtrlColumnSorted">onSortingChanged</event>
<event name="OnDataViewCtrlSelectionChanged">onSelChanged</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerListButtons</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Add Net</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_addNet</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">onAddNet</event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Rename Net</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_renameNet</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">onRenameNet</event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="0">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">20</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Delete Net</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_deleteNet</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">onDeleteNet</event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="0">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="1">
<property name="Apply">0</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="No">0</property>
<property name="OK">0</property>
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="name">m_sdbSizer</property>
<property name="permission">protected</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Create Report...</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_ReportButt</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">onReport</event>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

View File

@ -1,77 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class STD_BITMAP_BUTTON;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/checkbox.h>
#include <wx/combobox.h>
#include <wx/sizer.h>
#include <wx/dataview.h>
#include <wx/bmpbuttn.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_NET_INSPECTOR_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_NET_INSPECTOR_BASE : public DIALOG_SHIM
{
private:
protected:
wxStaticText* m_staticTextFilter;
wxTextCtrl* m_textCtrlFilter;
wxCheckBox* m_cbShowZeroPad;
wxCheckBox* m_groupBy;
wxTextCtrl* m_groupByText;
wxComboBox* m_groupByKind;
wxDataViewCtrl* m_netsList;
STD_BITMAP_BUTTON* m_addNet;
STD_BITMAP_BUTTON* m_renameNet;
STD_BITMAP_BUTTON* m_deleteNet;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerCancel;
wxButton* m_ReportButt;
// Virtual event handlers, override them in your derived class
virtual void onClose( wxCloseEvent& event ) { event.Skip(); }
virtual void onFilterChange( wxCommandEvent& event ) { event.Skip(); }
virtual void onSortingChanged( wxDataViewEvent& event ) { event.Skip(); }
virtual void onSelChanged( wxDataViewEvent& event ) { event.Skip(); }
virtual void onAddNet( wxCommandEvent& event ) { event.Skip(); }
virtual void onRenameNet( wxCommandEvent& event ) { event.Skip(); }
virtual void onDeleteNet( wxCommandEvent& event ) { event.Skip(); }
virtual void onReport( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_NET_INSPECTOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Net Inspector"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_NET_INSPECTOR_BASE();
};

View File

@ -280,6 +280,7 @@ void PCB_EDIT_FRAME::doReCreateMenuBar()
viewMenu->Add( ACTIONS::showProperties, ACTION_MENU::CHECK );
viewMenu->Add( PCB_ACTIONS::showSearch, ACTION_MENU::CHECK );
viewMenu->Add( PCB_ACTIONS::showLayersManager, ACTION_MENU::CHECK );
viewMenu->Add( PCB_ACTIONS::showNetInspector, ACTION_MENU::CHECK );
#ifdef __APPLE__
viewMenu->AppendSeparator();
@ -370,7 +371,6 @@ void PCB_EDIT_FRAME::doReCreateMenuBar()
//
ACTION_MENU* inspectMenu = new ACTION_MENU( false, selTool );
inspectMenu->Add( PCB_ACTIONS::listNets );
inspectMenu->Add( PCB_ACTIONS::boardStatistics );
inspectMenu->Add( ACTIONS::measureTool );

View File

@ -38,7 +38,6 @@
#include <dialog_find.h>
#include <dialog_footprint_properties.h>
#include <dialogs/dialog_exchange_footprints.h>
#include <dialogs/dialog_net_inspector.h>
#include <dialog_board_setup.h>
#include <invoke_pcb_dialog.h>
#include <gal/graphics_abstraction_layer.h>
@ -102,6 +101,7 @@
#include <widgets/wx_infobar.h>
#include <widgets/panel_selection_filter.h>
#include <widgets/pcb_properties_panel.h>
#include <widgets/pcb_net_inspector_panel.h>
#include <widgets/wx_aui_utils.h>
#include <kiplatform/app.h>
#include <core/profile.h>
@ -193,7 +193,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_inspectClearanceDlg( nullptr ),
m_inspectConstraintsDlg( nullptr ),
m_footprintDiffDlg( nullptr ),
m_netInspectorDlg( nullptr ),
m_importProperties( nullptr )
{
m_maximizeByDefault = true;
@ -205,6 +204,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_supportsAutoSave = true;
m_probingSchToPcb = false;
m_show_search = false;
m_show_net_inspector = false;
// We don't know what state board was in when it was last saved, so we have to
// assume dirty
@ -270,6 +270,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_appearancePanel = new APPEARANCE_CONTROLS( this, GetCanvas() );
m_searchPane = new PCB_SEARCH_PANE( this );
m_netInspectorPanel = new PCB_NET_INSPECTOR_PANEL( this, this );
m_auimgr.SetManagedWindow( this );
@ -317,6 +318,14 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( wxS( "DrawFrame" ) )
.Center() );
m_auimgr.AddPane( m_netInspectorPanel, EDA_PANE()
.Name( NetInspectorPanelName() )
.Bottom()
.Caption( _( "Net Inspector" ) )
.PaneBorder( false )
.MinSize( FromDIP( wxSize( 240, 60 ) ) )
.BestSize( FromDIP( wxSize( 300, 200 ) ) ) );
m_auimgr.AddPane( m_searchPane, EDA_PANE().Name( SearchPaneName() )
.Bottom()
.Caption( _( "Search" ) ).PaneBorder( false )
@ -324,10 +333,11 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
.FloatingSize( FromDIP( wxSize( 480, 200 ) ) )
.DestroyOnClose( false ) );
m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
m_auimgr.GetPane( "SelectionFilter" ).Show( m_show_layer_manager_tools );
m_auimgr.GetPane( PropertiesPaneName() ).Show( GetPcbNewSettings()->m_AuiPanels.show_properties );
m_auimgr.GetPane( NetInspectorPanelName() ).Show( m_show_net_inspector );
m_auimgr.GetPane( SearchPaneName() ).Show( m_show_search );
// The selection filter doesn't need to grow in the vertical direction when docked
@ -489,8 +499,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
Bind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &PCB_EDIT_FRAME::onCloseModelessBookReporterDialogs,
this );
Bind( EDA_EVT_CLOSE_NET_INSPECTOR_DIALOG, &PCB_EDIT_FRAME::onCloseNetInspectorDialog, this );
Bind( EDA_EVT_UNITS_CHANGED, &PCB_EDIT_FRAME::onUnitsChanged, this );
m_acceptedExts.emplace( FILEEXT::KiCadPcbFileExtension, &PCB_ACTIONS::ddAppendBoard );
m_acceptedExts.emplace( FILEEXT::LegacyPcbFileExtension, &PCB_ACTIONS::ddAppendBoard );
DragAcceptFiles( true );
@ -520,6 +528,7 @@ PCB_EDIT_FRAME::~PCB_EDIT_FRAME()
delete m_appearancePanel;
delete m_exportNetlistAction;
delete m_propertiesPanel;
delete m_netInspectorPanel;
}
@ -796,6 +805,12 @@ void PCB_EDIT_FRAME::setupUIConditions()
return PropertiesShown();
};
auto netInspectorCond =
[this] ( const SELECTION& )
{
return NetInspectorShown();
};
auto searchPaneCond =
[this] ( const SELECTION& )
{
@ -843,6 +858,7 @@ void PCB_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( PCB_ACTIONS::toggleNetHighlight, CHECK( netHighlightCond )
.Enable( enableNetHighlightCond ) );
mgr->SetConditions( PCB_ACTIONS::showProperties, CHECK( propertiesCond ) );
mgr->SetConditions( PCB_ACTIONS::showNetInspector, CHECK( netInspectorCond ) );
mgr->SetConditions( PCB_ACTIONS::showSearch, CHECK( searchPaneCond ) );
auto isArcKeepCenterMode =
@ -1108,10 +1124,8 @@ void PCB_EDIT_FRAME::doCloseWindow()
GetCanvas()->StopDrawing();
// Clean up mode-less dialogs.
Unbind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER,
&PCB_EDIT_FRAME::onCloseModelessBookReporterDialogs, this );
Unbind( EDA_EVT_CLOSE_NET_INSPECTOR_DIALOG, &PCB_EDIT_FRAME::onCloseNetInspectorDialog, this );
Unbind( EDA_EVT_UNITS_CHANGED, &PCB_EDIT_FRAME::onUnitsChanged, this );
Unbind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &PCB_EDIT_FRAME::onCloseModelessBookReporterDialogs,
this );
wxWindow* open_dlg = wxWindow::FindWindowByName( DIALOG_DRC_WINDOW_NAME );
@ -1148,13 +1162,6 @@ void PCB_EDIT_FRAME::doCloseWindow()
m_footprintDiffDlg = nullptr;
}
if( m_netInspectorDlg )
{
RemoveBoardChangeListener( m_netInspectorDlg );
m_netInspectorDlg->Destroy();
m_netInspectorDlg = nullptr;
}
// Delete the auto save file if it exists.
wxFileName fn = GetBoard()->GetFileName();
@ -1309,6 +1316,7 @@ void PCB_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
{
m_show_layer_manager_tools = cfg->m_AuiPanels.show_layer_manager;
m_show_search = cfg->m_AuiPanels.show_search;
m_show_net_inspector = cfg->m_AuiPanels.show_net_inspector;
}
}
@ -1339,6 +1347,13 @@ void PCB_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
cfg->m_AuiPanels.search_panel_width = m_searchPane->GetSize().x;
cfg->m_AuiPanels.search_panel_dock_direction = searchPaneInfo.dock_direction;
if( m_netInspectorPanel )
{
wxAuiPaneInfo& netInspectorhPaneInfo = m_auimgr.GetPane( NetInspectorPanelName() );
m_show_net_inspector = netInspectorhPaneInfo.IsShown();
cfg->m_AuiPanels.show_net_inspector = m_show_net_inspector;
}
if( m_appearancePanel )
{
cfg->m_AuiPanels.right_panel_width = m_appearancePanel->GetSize().x;
@ -1580,6 +1595,7 @@ void PCB_EDIT_FRAME::ShowChangedLanguage()
m_auimgr.GetPane( m_appearancePanel ).Caption( _( "Appearance" ) );
m_auimgr.GetPane( m_selectionFilterPanel ).Caption( _( "Selection Filter" ) );
m_auimgr.GetPane( m_propertiesPanel ).Caption( _( "Properties" ) );
m_auimgr.GetPane( m_netInspectorPanel ).Caption( _( "Net Inspector" ) );
m_auimgr.Update();
UpdateTitle();
@ -1711,6 +1727,7 @@ void PCB_EDIT_FRAME::UpdateUserInterface()
// Stackup and/or color theme may have changed
m_appearancePanel->OnBoardChanged();
m_netInspectorPanel->OnParentSetupChanged();
}
@ -2472,6 +2489,12 @@ bool PCB_EDIT_FRAME::PropertiesShown()
}
bool PCB_EDIT_FRAME::NetInspectorShown()
{
return m_auimgr.GetPane( NetInspectorPanelName() ).IsShown();
}
void PCB_EDIT_FRAME::onSize( wxSizeEvent& aEvent )
{
if( IsShownOnScreen() )
@ -2550,35 +2573,3 @@ void PCB_EDIT_FRAME::onCloseModelessBookReporterDialogs( wxCommandEvent& aEvent
m_footprintDiffDlg = nullptr;
}
}
DIALOG_NET_INSPECTOR* PCB_EDIT_FRAME::GetNetInspectorDialog()
{
if( !m_netInspectorDlg )
{
m_netInspectorDlg = new DIALOG_NET_INSPECTOR( this );
AddBoardChangeListener( m_netInspectorDlg );
}
return m_netInspectorDlg;
}
void PCB_EDIT_FRAME::onCloseNetInspectorDialog( wxCommandEvent& aEvent )
{
if( m_netInspectorDlg )
{
RemoveBoardChangeListener( m_netInspectorDlg );
m_netInspectorDlg->Destroy();
m_netInspectorDlg = nullptr;
}
}
void PCB_EDIT_FRAME::onUnitsChanged( wxCommandEvent& aEvent )
{
wxCommandEvent evt( EDA_EVT_UNITS_CHANGED );
if( m_netInspectorDlg )
m_netInspectorDlg->HandleWindowEvent( evt );
}

View File

@ -31,7 +31,6 @@ class BOARD;
class BOARD_COMMIT;
class BOARD_ITEM_CONTAINER;
class DIALOG_BOOK_REPORTER;
class DIALOG_NET_INSPECTOR;
class FOOTPRINT;
class PCB_TRACK;
class PCB_VIA;
@ -162,6 +161,7 @@ public:
bool LayerManagerShown();
bool PropertiesShown();
bool NetInspectorShown();
void OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent );
void OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent );
@ -301,6 +301,9 @@ public:
void PrepareLayerIndicator( bool aForceRebuild = false );
void ToggleLayersManager();
void ToggleNetInspector();
void ToggleSearch();
/**
@ -705,8 +708,6 @@ public:
DIALOG_BOOK_REPORTER* GetFootprintDiffDialog();
DIALOG_NET_INSPECTOR* GetNetInspectorDialog();
DECLARE_EVENT_TABLE()
protected:
@ -813,10 +814,6 @@ protected:
void onCloseModelessBookReporterDialogs( wxCommandEvent& aEvent );
void onCloseNetInspectorDialog( wxCommandEvent& aEvent );
void onUnitsChanged( wxCommandEvent& aEvent );
public:
PCB_LAYER_BOX_SELECTOR* m_SelLayerBox; // a combo box to display and select active layer
@ -825,6 +822,7 @@ public:
bool m_show_layer_manager_tools;
bool m_show_search;
bool m_show_net_inspector;
bool m_ZoneFillsDirty; // Board has been modified since last zone fill.
@ -848,7 +846,6 @@ private:
DIALOG_BOOK_REPORTER* m_inspectClearanceDlg;
DIALOG_BOOK_REPORTER* m_inspectConstraintsDlg;
DIALOG_BOOK_REPORTER* m_footprintDiffDlg;
DIALOG_NET_INSPECTOR* m_netInspectorDlg;
const STRING_UTF8_MAP* m_importProperties; // Properties used for non-KiCad import.

View File

@ -95,6 +95,9 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
m_params.emplace_back( new PARAM<int>( "aui.right_panel_width",
&m_AuiPanels.right_panel_width, -1 ) );
m_params.emplace_back( new PARAM<int>( "aui.net_inspector_width",
&m_AuiPanels.net_inspector_width, -1 ) );
m_params.emplace_back( new PARAM<int>( "aui.properties_panel_width",
&m_AuiPanels.properties_panel_width, -1 ) );
@ -125,6 +128,9 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
m_params.emplace_back( new PARAM<bool>( "aui.show_search",
&m_AuiPanels.show_search, false ) );
m_params.emplace_back( new PARAM<bool>( "aui.show_net_inspector",
&m_AuiPanels.show_net_inspector, false ) );
m_params.emplace_back( new PARAM<int>( "footprint_chooser.width",
&m_FootprintChooser.width, -1 ) );
@ -585,31 +591,6 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
m_params.emplace_back( new PARAM<wxString>( "reannotate_dialog.annotate_report_file_name",
&m_Reannotate.report_file_name, "" ) );
m_params.emplace_back( new PARAM<wxString>( "net_inspector_dialog.group_by_text",
&m_NetInspector.group_by_text, "" ) );
m_params.emplace_back( new PARAM<bool>( "net_inspector_dialog.group_by",
&m_NetInspector.group_by, false ) );
m_params.emplace_back( new PARAM<int>( "net_inspector_dialog.group_by_kind",
&m_NetInspector.group_by_kind, 0 ) );
m_params.emplace_back( new PARAM<bool>( "net_inspector_dialog.show_zero_pad_nets",
&m_NetInspector.show_zero_pad_nets, true ) );
m_params.emplace_back( new PARAM<int>( "net_inspector_dialog.sorting_column",
&m_NetInspector.sorting_column, -1 ) );
m_params.emplace_back( new PARAM<bool>( "net_inspector_dialog.sort_ascending",
&m_NetInspector.sort_order_asc, true ) );
m_params.emplace_back( new PARAM<int>( "net_inspector_dialog.dlg_width",
&m_NetInspector.dlg_width, 960 ) );
m_params.emplace_back( new PARAM<int>( "net_inspector_dialog.dlg_height",
&m_NetInspector.dlg_height, 520 ) );
const std::vector<int> default_col_order = { };
const std::vector<int> default_widths = { };
m_params.emplace_back( new PARAM_LIST<int>( "net_inspector_dialog.col_order",
&m_NetInspector.col_order, default_col_order ) );
m_params.emplace_back( new PARAM_LIST<int>( "net_inspector_dialog.col_widths",
&m_NetInspector.col_widths, default_widths ) );
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "action_plugins",
[&]() -> nlohmann::json
{

View File

@ -135,18 +135,20 @@ class PCBNEW_SETTINGS : public PCB_VIEWERS_SETTINGS_BASE
public:
struct AUI_PANELS
{
int appearance_panel_tab;
bool appearance_expand_layer_display;
bool appearance_expand_net_display;
int right_panel_width;
int properties_panel_width;
int appearance_panel_tab;
bool appearance_expand_layer_display;
bool appearance_expand_net_display;
int right_panel_width;
int properties_panel_width;
int net_inspector_width;
float properties_splitter;
int search_panel_height;
int search_panel_width;
int search_panel_dock_direction;
bool show_layer_manager;
bool show_properties;
bool show_search;
int search_panel_height;
int search_panel_width;
int search_panel_dock_direction;
bool show_layer_manager;
bool show_properties;
bool show_search;
bool show_net_inspector;
};
struct DIALOG_CLEANUP
@ -311,23 +313,6 @@ public:
wxString report_file_name;
};
struct DIALOG_NET_INSPECTOR
{
wxString group_by_text;
bool group_by;
int group_by_kind;
bool show_zero_pad_nets;
int sorting_column;
bool sort_order_asc;
std::vector<int> col_order;
std::vector<int> col_widths;
int dlg_width;
int dlg_height;
};
struct FOOTPRINT_CHOOSER
{
int width;
@ -409,8 +394,6 @@ public:
DIALOG_REANNOTATE m_Reannotate;
DIALOG_NET_INSPECTOR m_NetInspector;
FOOTPRINT_CHOOSER m_FootprintChooser;
ZONES m_Zones;

View File

@ -48,6 +48,7 @@
#include <tools/pcb_selection_tool.h>
#include <widgets/appearance_controls.h>
#include <widgets/pcb_properties_panel.h>
#include <widgets/net_inspector_panel.h>
#include <widgets/pcb_search_pane.h>
#include <widgets/wx_aui_utils.h>
#include <wx/wupdlock.h>
@ -356,7 +357,7 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar()
// Tools to show/hide toolbars:
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( PCB_ACTIONS::showLayersManager, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::showProperties, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::showProperties, ACTION_TOOLBAR::TOGGLE );
PCB_SELECTION_TOOL* selTool = m_toolManager->GetTool<PCB_SELECTION_TOOL>();
std::unique_ptr<ACTION_MENU> gridMenu = std::make_unique<ACTION_MENU>( false, selTool );
@ -790,6 +791,29 @@ void PCB_EDIT_FRAME::ToggleLayersManager()
}
void PCB_EDIT_FRAME::ToggleNetInspector()
{
PCBNEW_SETTINGS* settings = GetPcbNewSettings();
wxAuiPaneInfo& netInspectorPanel = m_auimgr.GetPane( NetInspectorPanelName() );
m_show_net_inspector = !m_show_net_inspector;
netInspectorPanel.Show( m_show_net_inspector );
if( m_show_net_inspector )
{
SetAuiPaneSize( m_auimgr, netInspectorPanel, settings->m_AuiPanels.net_inspector_width,
-1 );
}
else
{
m_netInspectorPanel->SaveSettings();
settings->m_AuiPanels.net_inspector_width = m_netInspectorPanel->GetSize().x;
m_auimgr.Update();
}
}
void PCB_EDIT_FRAME::ToggleSearch()
{
PCBNEW_SETTINGS* settings = GetPcbNewSettings();

View File

@ -692,6 +692,13 @@ int BOARD_EDITOR_CONTROL::ToggleProperties( const TOOL_EVENT& aEvent )
}
int BOARD_EDITOR_CONTROL::ToggleNetInspector( const TOOL_EVENT& aEvent )
{
getEditFrame<PCB_EDIT_FRAME>()->ToggleNetInspector();
return 0;
}
int BOARD_EDITOR_CONTROL::ToggleSearch( const TOOL_EVENT& aEvent )
{
getEditFrame<PCB_EDIT_FRAME>()->ToggleSearch();
@ -1708,6 +1715,7 @@ void BOARD_EDITOR_CONTROL::setTransitions()
Go( &BOARD_EDITOR_CONTROL::ShowEeschema, PCB_ACTIONS::showEeschema.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::ToggleLayersManager, PCB_ACTIONS::showLayersManager.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::ToggleProperties, ACTIONS::showProperties.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::ToggleNetInspector, PCB_ACTIONS::showNetInspector.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::ToggleSearch, PCB_ACTIONS::showSearch.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::TogglePythonConsole, PCB_ACTIONS::showPythonConsole.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::RepairBoard, PCB_ACTIONS::repairBoard.MakeEvent() );

View File

@ -79,6 +79,7 @@ public:
int ShowEeschema( const TOOL_EVENT& aEvent );
int ToggleLayersManager( const TOOL_EVENT& aEvent );
int ToggleProperties( const TOOL_EVENT& aEvent );
int ToggleNetInspector( const TOOL_EVENT& aEvent );
int ToggleSearch( const TOOL_EVENT& aEvent );
int TogglePythonConsole( const TOOL_EVENT& aEvent );

View File

@ -32,7 +32,6 @@
#include <drc/drc_engine.h>
#include <dialogs/dialog_board_statistics.h>
#include <dialogs/dialog_book_reporter.h>
#include <dialogs/dialog_net_inspector.h>
#include <dialogs/panel_setup_rules_base.h>
#include <dialogs/dialog_footprint_associations.h>
#include <string_utils.h>
@ -2060,20 +2059,6 @@ void BOARD_INSPECTION_TOOL::calculateSelectionRatsnest( const VECTOR2I& aDelta )
}
int BOARD_INSPECTION_TOOL::ListNets( const TOOL_EVENT& aEvent )
{
wxCHECK( m_frame, 0 );
DIALOG_NET_INSPECTOR* dialog = m_frame->GetNetInspectorDialog();
wxCHECK( dialog, 0 );
dialog->Raise();
dialog->Show( true );
return 0;
}
int BOARD_INSPECTION_TOOL::HideNetInRatsnest( const TOOL_EVENT& aEvent )
{
doHideRatsnestNet( aEvent.Parameter<int>(), true );
@ -2131,7 +2116,6 @@ void BOARD_INSPECTION_TOOL::setTransitions()
Go( &BOARD_INSPECTION_TOOL::HideLocalRatsnest, PCB_ACTIONS::hideLocalRatsnest.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::UpdateLocalRatsnest, PCB_ACTIONS::updateLocalRatsnest.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::ListNets, PCB_ACTIONS::listNets.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::ShowBoardStatistics, PCB_ACTIONS::boardStatistics.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::InspectClearance, PCB_ACTIONS::inspectClearance.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::InspectConstraints, PCB_ACTIONS::inspectConstraints.MakeEvent() );

View File

@ -24,7 +24,6 @@
#ifndef BOARD_INSPECTION_TOOL_H
#define BOARD_INSPECTION_TOOL_H
#include <dialogs/dialog_net_inspector.h>
#include <dialogs/dialog_book_reporter.h>
#include <drc/drc_rule.h>
#include <drc/drc_engine.h>
@ -74,8 +73,6 @@ public:
///< Show local ratsnest of a component.
int LocalRatsnestTool( const TOOL_EVENT& aEvent );
int ListNets( const TOOL_EVENT& aEvent );
///< Hide the ratsnest for a given net.
int HideNetInRatsnest( const TOOL_EVENT& aEvent );

View File

@ -1329,13 +1329,6 @@ TOOL_ACTION PCB_ACTIONS::updateLocalRatsnest( TOOL_ACTION_ARGS()
.Scope( AS_GLOBAL )
.Parameter( VECTOR2I() ) );
TOOL_ACTION PCB_ACTIONS::listNets( TOOL_ACTION_ARGS()
.Name( "pcbnew.Control.listNets" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "Net Inspector" ) )
.Tooltip( _( "Show the net inspector" ) )
.Icon( BITMAPS::list_nets ) );
TOOL_ACTION PCB_ACTIONS::showPythonConsole( TOOL_ACTION_ARGS()
.Name( "pcbnew.Control.showPythonConsole" )
.Scope( AS_GLOBAL )
@ -1350,6 +1343,13 @@ TOOL_ACTION PCB_ACTIONS::showLayersManager( TOOL_ACTION_ARGS()
.Tooltip( _( "Show/hide the appearance manager" ) )
.Icon( BITMAPS::layers_manager ) );
TOOL_ACTION PCB_ACTIONS::showNetInspector( TOOL_ACTION_ARGS()
.Name( "pcbnew.Control.showNetInspector" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "Show Net Inspector" ) )
.Tooltip( _( "Show/hide the net inspector" ) )
.Icon( BITMAPS::tools ) );
TOOL_ACTION PCB_ACTIONS::zonesManager( "pcbnew.Control.zonesManager",
AS_GLOBAL, 0, "",
_( "Zone Manager" ), _( "Show the zone manager dialog" ),

View File

@ -430,13 +430,13 @@ public:
static TOOL_ACTION generateD356File;
static TOOL_ACTION generateBOM;
static TOOL_ACTION listNets;
static TOOL_ACTION runDRC;
static TOOL_ACTION editFpInFpEditor;
static TOOL_ACTION editLibFpInFpEditor;
static TOOL_ACTION showLayersManager;
static TOOL_ACTION showNetInspector;
static TOOL_ACTION showPythonConsole;
static TOOL_ACTION zonesManager;

View File

@ -508,8 +508,7 @@ APPEARANCE_CONTROLS::APPEARANCE_CONTROLS( PCB_BASE_FRAME* aParent, wxWindow* aFo
m_btnNetInspector->Bind( wxEVT_BUTTON,
[&]( wxCommandEvent& aEvent )
{
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::listNets );
passOnFocus();
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::showNetInspector );
} );
m_btnConfigureNetClasses->Bind( wxEVT_BUTTON,

View File

@ -0,0 +1,101 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <widgets/net_inspector_panel.h>
#include <eda_base_frame.h>
#include <widgets/ui_common.h>
NET_INSPECTOR_PANEL::NET_INSPECTOR_PANEL( wxWindow* parent, EDA_BASE_FRAME* aFrame, wxWindowID id,
const wxPoint& pos, const wxSize& size, long style,
const wxString& name ) :
wxPanel( parent, id, pos, size, style, name ),
m_frame( aFrame )
{
m_sizerOuter = new wxGridBagSizer( 0, 0 );
m_sizerOuter->SetFlexibleDirection( wxBOTH );
m_sizerOuter->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_searchCtrl =
new wxSearchCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
#ifndef __WXMAC__
m_searchCtrl->ShowSearchButton( true );
#endif
m_searchCtrl->ShowCancelButton( false );
m_searchCtrl->SetDescriptiveText( _( "Filter" ) );
m_sizerOuter->Add( m_searchCtrl, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_configureBtn = new BITMAP_BUTTON( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_configureBtn->SetToolTip( _( "Configure netlist inspector" ) );
m_configureBtn->SetBitmap( KiBitmapBundle( BITMAPS::options_generic_16 ) );
m_configureBtn->SetPadding( 2 );
m_sizerOuter->Add( m_configureBtn, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), 0, 5 );
m_netsList =
new wxDataViewCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_MULTIPLE );
m_netsList->SetFont( KIUI::GetDockedPaneFont( this ) );
m_sizerOuter->Add( m_netsList, wxGBPosition( 1, 0 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
m_sizerOuter->AddGrowableCol( 0 );
m_sizerOuter->AddGrowableRow( 1 );
SetFont( KIUI::GetDockedPaneFont( this ) );
SetSizer( m_sizerOuter );
Layout();
m_sizerOuter->Fit( this );
// Connect Events
m_frame->Bind( EDA_LANG_CHANGED, &NET_INSPECTOR_PANEL::OnLanguageChanged, this );
Bind( wxEVT_SET_FOCUS, &NET_INSPECTOR_PANEL::OnSetFocus, this );
Bind( wxEVT_SIZE, &NET_INSPECTOR_PANEL::OnSize, this );
m_searchCtrl->Bind( wxEVT_COMMAND_TEXT_UPDATED, &NET_INSPECTOR_PANEL::OnSearchTextChanged,
this );
m_netsList->Bind( wxEVT_SET_FOCUS, &NET_INSPECTOR_PANEL::OnSetFocus, this );
m_configureBtn->Bind( wxEVT_BUTTON, &NET_INSPECTOR_PANEL::OnConfigButton, this );
}
NET_INSPECTOR_PANEL::~NET_INSPECTOR_PANEL()
{
// Disconnect Events
m_frame->Unbind( EDA_LANG_CHANGED, &NET_INSPECTOR_PANEL::OnLanguageChanged, this );
Unbind( wxEVT_SET_FOCUS, &NET_INSPECTOR_PANEL::OnSetFocus, this );
Unbind( wxEVT_SIZE, &NET_INSPECTOR_PANEL::OnSize, this );
m_searchCtrl->Unbind( wxEVT_COMMAND_TEXT_UPDATED, &NET_INSPECTOR_PANEL::OnSearchTextChanged,
this );
m_netsList->Unbind( wxEVT_SET_FOCUS, &NET_INSPECTOR_PANEL::OnSetFocus, this );
m_configureBtn->Unbind( wxEVT_BUTTON, &NET_INSPECTOR_PANEL::OnConfigButton, this );
}
void NET_INSPECTOR_PANEL::OnLanguageChanged( wxCommandEvent& event )
{
m_searchCtrl->SetDescriptiveText( _( "Filter" ) );
m_configureBtn->SetToolTip( _( "Configure netlist inspector" ) );
OnLanguageChangedImpl();
event.Skip();
}

View File

@ -0,0 +1,85 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef NET_INSPECTOR_PANEL_BASE_H
#define NET_INSPECTOR_PANEL_BASE_H
#include <bitmaps.h>
#include <widgets/bitmap_button.h>
#include <wx/dataview.h>
#include <wx/gbsizer.h>
#include <wx/panel.h>
#include <wx/settings.h>
#include <wx/srchctrl.h>
#include <wx/string.h>
class EDA_BASE_FRAME;
/**
* A base class used to implement docking net inspector panels.
*
* Provides a filter control, a settings button, and a data-driven wxDataViewCtrl
*/
class NET_INSPECTOR_PANEL : public wxPanel
{
public:
NET_INSPECTOR_PANEL( wxWindow* parent, EDA_BASE_FRAME* aFrame, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxSize( -1, -1 ), long style = wxTAB_TRAVERSAL,
const wxString& name = wxEmptyString );
~NET_INSPECTOR_PANEL();
/**
* Rebuild inspector data if project settings updated
*
* Called by the parent EDA_EDIT_FRAME on change of settings (e.g. stackup, netclass
* definitions)
*/
virtual void OnParentSetupChanged(){};
/**
* Save the net inspector settings - called from EDA_EDIT_FRAME when hiding the panel
*/
virtual void SaveSettings(){};
protected:
// User-driven UI events (override in derrived classes as required)
virtual void OnSetFocus( wxFocusEvent& event ) { event.Skip(); }
virtual void OnSize( wxSizeEvent& event ) { event.Skip(); }
virtual void OnSearchTextChanged( wxCommandEvent& event ) { event.Skip(); }
virtual void OnConfigButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnLanguageChanged( wxCommandEvent& event );
/**
* Implementation-specific implementation of language update handling
*/
virtual void OnLanguageChangedImpl(){};
protected:
EDA_BASE_FRAME* m_frame;
wxGridBagSizer* m_sizerOuter;
wxSearchCtrl* m_searchCtrl;
BITMAP_BUTTON* m_configureBtn;
wxDataViewCtrl* m_netsList;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,355 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PCB_NET_INSPECTOR_H
#define PCB_NET_INSPECTOR_H
#include <board.h>
#include <id.h>
#include <project/project_local_settings.h>
#include <widgets/net_inspector_panel.h>
#include <optional>
#include <vector>
class PCB_EDIT_FRAME;
class NETINFO_ITEM;
class BOARD;
class BOARD_ITEM;
class CN_ITEM;
class PCB_TRACK;
/**
* Net inspection panel for pcbnew
*
* Provides a read-only view of net information, such as routed lengths. Data is updated after
* every change of board items. Note that there is not always a 1:1 relationship between Nets and
* displayed items in the inspector.. This can be the case where there is a constraint which
* selects sub-sections of nets, for example consider a netclass used for a fly-by-routing
* adddress bus. There could be two constraints, e.g.:
* <p>
* FROM/TO=IC1-IC2, Netclass=DDR_ADDR, Net=ADDR_0
* FROM/TO=IC2-IC3, Netclass=DDR_ADDR, Net=ADDR_0
* <p>
* In this instance, a single address net within the DDR_ADDR netclass could have three entries in
* the inspector, each tracking a different set of net statistics:
* <p>
* 1. The whole net
* 2. IC1-IC2
* 3. IC2-IC3
* <p>
* In this instance, all sub-nets as a result of a constraint will be grouped by the constraint.
*/
class PCB_NET_INSPECTOR_PANEL : public NET_INSPECTOR_PANEL, public BOARD_LISTENER
{
public:
PCB_NET_INSPECTOR_PANEL( wxWindow* parent, PCB_EDIT_FRAME* aFrame );
virtual ~PCB_NET_INSPECTOR_PANEL();
/**
* Updates the netlist based on global board changes (e.g. stackup definition)
*
* Called by PCB_EDIT_FRAME after displaying the Board Setup dialog
*/
virtual void OnParentSetupChanged() override;
/*
* BOARD_LISTENER implementation
*/
virtual void OnBoardItemAdded( BOARD& aBoard, BOARD_ITEM* aBoardItem ) override;
virtual void OnBoardItemsAdded( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItems ) override;
virtual void OnBoardItemRemoved( BOARD& aBoard, BOARD_ITEM* aBoardItem ) override;
virtual void OnBoardItemsRemoved( BOARD& aBoard,
std::vector<BOARD_ITEM*>& aBoardItems ) override;
virtual void OnBoardNetSettingsChanged( BOARD& aBoard ) override;
virtual void OnBoardItemChanged( BOARD& aBoard, BOARD_ITEM* aBoardItem ) override;
virtual void OnBoardItemsChanged( BOARD& aBoard,
std::vector<BOARD_ITEM*>& aBoardItems ) override;
virtual void OnBoardHighlightNetChanged( BOARD& aBoard ) override;
/**
* Persist the net inspector configuration to project / global settings
*/
virtual void SaveSettings() override;
protected:
/**
* Reloads strings on an application language change
*/
virtual void OnLanguageChangedImpl() override;
/*
* UI events
*/
virtual void OnSearchTextChanged( wxCommandEvent& event ) override;
virtual void OnConfigButton( wxCommandEvent& event ) override;
void OnExpandCollapseRow( wxCommandEvent& event );
void OnHeaderContextMenu( wxCommandEvent& event );
void OnNetsListContextMenu( wxDataViewEvent& event );
void OnNetsListItemActivated( wxDataViewEvent& event );
private:
/*
* Helper methods for returning fornatted data
*/
wxString formatNetCode( const NETINFO_ITEM* aNet ) const;
wxString formatNetName( const NETINFO_ITEM* aNet ) const;
wxString formatCount( unsigned int aValue ) const;
wxString formatLength( int64_t aValue ) const;
/**
* Generates a sub-menu for the show / hide columns submenu
*/
void generateShowHideColumnMenu( wxMenu* target );
/**
* Filters connectivity items from a board update to remove those not related to
* net / track metrics
*/
std::vector<CN_ITEM*> relevantConnectivityItems() const;
/**
* Filter to determine whether a board net should be included in the net inspector
*/
bool netFilterMatches( NETINFO_ITEM* aNet, PANEL_NET_INSPECTOR_SETTINGS* cfg = nullptr ) const;
/**
* Updates the stored LIST_ITEMs for a given updated board net item
*/
void updateNet( NETINFO_ITEM* aNet );
/**
* Calculates the length of a via from the board stackup
*/
unsigned int calculateViaLength( const PCB_TRACK* ) const;
void buildNetsList( bool rebuildColumns = false );
void buildColumns();
void setColumnWidths();
/**
* Adjust the sizing of list columns
*
* @param cfg the PANEL_NET_INSPECTOR_SETTINGS from which to read column widths
*/
void adjustListColumnSizes( PANEL_NET_INSPECTOR_SETTINGS* cfg );
/**
* Sets the sort column in the grid to that showing the given model ID column
*
* @param sortingColumnId The model ID of the column to sort by
* @param sortOrderAsc True for ascending sort, False for descending sort
* @returns true if the column was found
*/
bool restoreSortColumn( int sortingColumnId, bool sortOrderAsc );
/**
* Fetches the displayed grid view column for the given model column ID
*
* @param columnId The ID (from column static IDs enum) to find
* @returns Pointer to the wxDataViewColumn, or nullptr if not found
*/
wxDataViewColumn* getDisplayedColumnForModelField( int columnId );
/**
* Generates a CSV report from currently disaplyed data
*/
void generateReport();
/**
* Highlight the currently selected net
*/
void highlightSelectedNets();
void onUnitsChanged( wxCommandEvent& event );
void onBoardChanged( wxCommandEvent& event );
void onSettingsMenu( wxCommandEvent& event );
void onItemContextMenu( wxCommandEvent& event );
void onAddNet();
void onRenameSelectedNet();
void onDeleteSelectedNet();
void onRemoveSelectedGroup();
void onAddGroup();
void onClearHighlighting();
/**
* Container class for a set of net data
*/
class LIST_ITEM;
/**
* Ordered comparison of LIST_ITEMs by net code
*/
struct LIST_ITEM_NETCODE_CMP_LESS;
/**
* Ordered comparison of LIST_ITEMs by group number
*/
struct LIST_ITEM_GROUP_NUMBER_CMP_LESS;
using LIST_ITEM_ITER = std::vector<std::unique_ptr<LIST_ITEM>>::iterator;
using LIST_ITEM_CONST_ITER = std::vector<std::unique_ptr<LIST_ITEM>>::const_iterator;
/**
* Constructs a LIST_ITEM for storage in the data model from a board net item
*/
std::unique_ptr<LIST_ITEM> buildNewItem( NETINFO_ITEM* aNet, unsigned int aPadCount,
const std::vector<CN_ITEM*>& aCNItems );
void updateDisplayedRowValues( const std::optional<LIST_ITEM_ITER>& aRow );
// special zero-netcode item. Unconnected pads etc might use different
// (dummy) NETINFO_ITEM. Redirect all of them to this item, which we get
// from the board object in buildNetsList.
NETINFO_ITEM* m_zero_netitem;
/*
* Current board and parent edit frame
*/
BOARD* m_brd = nullptr;
PCB_EDIT_FRAME* m_frame = nullptr;
/**
* Data model which holds LIST_ITEMs
*/
class DATA_MODEL;
/*
* The bound data model to display
*/
wxObjectDataPtr<DATA_MODEL> m_data_model;
friend DATA_MODEL;
/*
* Status flags set during reporting and net rebuild operations
*/
bool m_in_reporting = false;
bool m_in_build_nets_list = false;
/*
* Status flags to indicate whether a board has been loaded in this control's
* lifetime. Required as on PCB_EDIT_FRAME construction, there are multiple events
* triggered which would usually result in saving settings and re-loading the board.
* However, before the board loads the frame is in an inconsistent state: The project
* settings are available, but the board is not yet loaded. This results in overwriting
* settings calculated from an empty board. We do not save settings until the first
* board load operation has occured.
*/
bool m_board_loaded = false;
bool m_board_loading = false;
/*
* Flags to indicate whether certain events should be disabled during programmatic updates
*/
bool m_row_expanding = false;
bool m_highlighting_nets = false;
/*
* Configuration flags - these are all persisted to the project storage
*/
bool m_filter_by_net_name = true;
bool m_filter_by_netclass = true;
bool m_show_zero_pad_nets = false;
bool m_show_unconnected_nets = false;
bool m_group_by_netclass = false;
bool m_group_by_constraint = false;
int m_num_copper_layers = 0;
std::vector<wxString> m_custom_group_rules;
/**
* CSV output control
*/
enum class CSV_COLUMN_DESC : int
{
CSV_NONE = 0,
CSV_QUOTE = 1 << 0
};
/**
* Column metadata
*/
struct COLUMN_DESC
{
COLUMN_DESC( unsigned aNum, PCB_LAYER_ID aLayer, const wxString& aDisp,
const wxString& aCsv, CSV_COLUMN_DESC aFlags, bool aHasUnits ) :
num( aNum ),
layer( aLayer ), display_name( aDisp ), csv_name( aCsv ), csv_flags( aFlags ),
has_units( aHasUnits )
{
}
unsigned int num;
PCB_LAYER_ID layer;
wxString display_name;
wxString csv_name;
CSV_COLUMN_DESC csv_flags;
bool has_units;
operator unsigned int() const { return num; }
};
/**
* All displayed (or hidden) columns
*/
std::vector<COLUMN_DESC> m_columns;
/*
* Column static IDs. Used to refer to columns as use re-ordering can occur.
*/
enum
{
COLUMN_NAME = 0,
COLUMN_NETCLASS,
COLUMN_TOTAL_LENGTH,
COLUMN_VIA_COUNT,
COLUMN_VIA_LENGTH,
COLUMN_BOARD_LENGTH,
COLUMN_PAD_DIE_LENGTH,
COLUMN_PAD_COUNT,
COLUMN_LAST_STATIC_COL = COLUMN_PAD_COUNT
};
/*
* Popup menu item IDs
*/
enum POPUP_MENU_OPTIONS
{
ID_ADD_NET = ID_POPUP_MENU_START,
ID_RENAME_NET,
ID_DELETE_NET,
ID_ADD_GROUP,
ID_GROUP_BY_CONSTRAINT,
ID_GROUP_BY_NETCLASS,
ID_FILTER_BY_NET_NAME,
ID_FILTER_BY_NETCLASS,
ID_REMOVE_SELECTED_GROUP,
ID_REMOVE_GROUPS,
ID_SHOW_ZERO_NET_PADS,
ID_SHOW_UNCONNECTED_NETS,
ID_GENERATE_REPORT,
ID_HIGHLIGHT_SELECTED_NETS,
ID_CLEAR_HIGHLIGHTING,
ID_LAST_STATIC_MENU = ID_CLEAR_HIGHLIGHTING,
ID_HIDE_COLUMN,
};
};
#endif

View File

@ -0,0 +1,865 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PCB_NET_INSPECTOR_PANEL_DATA_MODEL
#define PCB_NET_INSPECTOR_PANEL_DATA_MODEL
/**
* Primary data item for entries in the Net Inspector list.
*
* This class tracks all data for a given net entry in the net inspector list.
*/
class PCB_NET_INSPECTOR_PANEL::LIST_ITEM
{
public:
enum class GROUP_TYPE
{
NONE,
USER_DEFINED,
NETCLASS
};
LIST_ITEM( unsigned int aGroupNumber, const wxString& aGroupName, GROUP_TYPE aGroupType ) :
m_group_type( aGroupType ), m_group_number( aGroupNumber ), m_net_name( aGroupName )
{
m_group_name = aGroupName;
m_column_changed.resize( COLUMN_LAST_STATIC_COL + 1 + MAX_CU_LAYERS, 0 );
}
LIST_ITEM( NETINFO_ITEM* aNet ) : m_group_type( GROUP_TYPE::NONE ), m_net( aNet )
{
wxASSERT( aNet );
m_net_name = UnescapeString( aNet->GetNetname() );
m_net_class = UnescapeString( aNet->GetNetClass()->GetName() );
m_column_changed.resize( COLUMN_LAST_STATIC_COL + 1 + MAX_CU_LAYERS, 0 );
}
LIST_ITEM() { m_column_changed.resize( COLUMN_LAST_STATIC_COL + 1 + MAX_CU_LAYERS, 0 ); }
LIST_ITEM& operator=( const LIST_ITEM& ) = delete;
bool GetIsGroup() const { return m_group_type != GROUP_TYPE::NONE; }
const wxString& GetGroupName() const { return m_group_name; }
GROUP_TYPE GetGroupType() const { return m_group_type; }
int GetGroupNumber() const { return m_group_number; }
auto ChildrenBegin() const { return m_children.begin(); }
auto ChildrenEnd() const { return m_children.end(); }
unsigned int ChildrenCount() const { return m_children.size(); }
NETINFO_ITEM* GetNet() const { return m_net; }
int GetNetCode() const
{
return GetIsGroup() ? ( 0 - int( m_group_number ) - 1 ) : m_net->GetNetCode();
}
const wxString& GetNetName() const { return m_net_name; }
const wxString& GetNetclassName() const { return m_net_class; }
void ResetColumnChangedBits()
{
std::fill( m_column_changed.begin(), m_column_changed.end(), 0 );
}
unsigned int GetPadCount() const { return m_pad_count; }
bool PadCountChanged() const { return m_column_changed[COLUMN_PAD_COUNT]; }
void SetPadCount( unsigned int aValue )
{
if( m_parent )
m_parent->SetPadCount( m_parent->GetPadCount() - m_pad_count + aValue );
m_column_changed[COLUMN_PAD_COUNT] |= ( m_pad_count != aValue );
m_pad_count = aValue;
}
void AddPadCount( unsigned int aValue )
{
if( m_parent )
m_parent->AddPadCount( aValue );
m_column_changed[COLUMN_PAD_COUNT] |= ( aValue != 0 );
m_pad_count += aValue;
}
void SubPadCount( unsigned int aValue )
{
if( m_parent )
m_parent->SubPadCount( aValue );
m_column_changed[COLUMN_PAD_COUNT] |= ( aValue != 0 );
m_pad_count -= aValue;
}
unsigned GetViaCount() const { return m_via_count; }
bool ViaCountChanged() const { return m_column_changed[COLUMN_VIA_COUNT]; }
void SetViaCount( unsigned int aValue )
{
if( m_parent )
m_parent->SetViaCount( m_parent->GetViaCount() - m_via_count + aValue );
m_column_changed[COLUMN_VIA_COUNT] |= ( m_via_count != aValue );
m_via_count = aValue;
}
void AddViaCount( unsigned int aValue )
{
if( m_parent )
m_parent->AddViaCount( aValue );
m_column_changed[COLUMN_VIA_COUNT] |= ( aValue != 0 );
m_via_count += aValue;
}
void SubViaCount( unsigned int aValue )
{
if( m_parent )
m_parent->SubViaCount( aValue );
m_column_changed[COLUMN_VIA_COUNT] |= ( aValue != 0 );
m_via_count -= aValue;
}
uint64_t GetViaLength() const { return m_via_length; }
bool ViaLengthChanged() const { return m_column_changed[COLUMN_VIA_LENGTH]; }
void SetViaLength( unsigned int aValue )
{
if( m_parent )
m_parent->SetViaLength( m_parent->GetViaLength() - m_via_length + aValue );
m_column_changed[COLUMN_VIA_LENGTH] |= ( m_via_length != aValue );
m_via_length = aValue;
}
void AddViaLength( unsigned int aValue )
{
if( m_parent )
m_parent->AddViaLength( aValue );
m_column_changed[COLUMN_VIA_LENGTH] |= ( aValue != 0 );
m_via_length += aValue;
}
void SubViaLength( uint64_t aValue )
{
if( m_parent )
m_parent->SubViaLength( aValue );
m_column_changed[COLUMN_VIA_LENGTH] |= ( aValue != 0 );
m_via_length -= aValue;
}
uint64_t GetBoardWireLength() const
{
uint64_t retval = 0;
for( uint64_t val : m_layer_wire_length )
retval += val;
return retval;
}
uint64_t GetLayerWireLength( size_t aLayer ) const
{
wxCHECK_MSG( aLayer < m_layer_wire_length.size(), 0, wxT( "Invalid layer specified" ) );
return m_layer_wire_length[aLayer];
}
bool BoardWireLengthChanged() const { return m_column_changed[COLUMN_BOARD_LENGTH]; }
void SetLayerWireLength( const uint64_t aValue, size_t aLayer )
{
wxCHECK_RET( aLayer < m_layer_wire_length.size(), wxT( "Invalid layer specified" ) );
if( m_parent )
m_parent->SetLayerWireLength(
m_parent->GetBoardWireLength() - m_layer_wire_length[aLayer] + aValue, aLayer );
m_column_changed[COLUMN_BOARD_LENGTH] |= ( m_layer_wire_length[aLayer] != aValue );
m_layer_wire_length[aLayer] = aValue;
}
void AddLayerWireLength( const uint64_t aValue, size_t aLayer )
{
if( m_parent )
m_parent->AddLayerWireLength( aValue, aLayer );
m_column_changed[COLUMN_BOARD_LENGTH] |= ( m_layer_wire_length[aLayer] != 0 );
m_layer_wire_length[aLayer] += aValue;
}
void SubLayerWireLength( const uint64_t aValue, size_t aLayer )
{
if( m_parent )
m_parent->SubLayerWireLength( aValue, aLayer );
m_column_changed[COLUMN_BOARD_LENGTH] |= ( m_layer_wire_length[aLayer] != 0 );
m_layer_wire_length[aLayer] -= aValue;
}
uint64_t GetPadDieLength() const { return m_pad_die_length; }
bool PadDieLengthChanged() const { return m_column_changed[COLUMN_PAD_DIE_LENGTH]; }
void SetPadDieLength( uint64_t aValue )
{
if( m_parent )
m_parent->SetPadDieLength( m_parent->GetPadDieLength() - m_pad_die_length + aValue );
m_column_changed[COLUMN_PAD_DIE_LENGTH] |= ( m_pad_die_length != aValue );
m_pad_die_length = aValue;
}
void AddPadDieLength( uint64_t aValue )
{
if( m_parent )
m_parent->AddPadDieLength( aValue );
m_column_changed[COLUMN_PAD_DIE_LENGTH] |= ( aValue != 0 );
m_pad_die_length += aValue;
}
void SubPadDieLength( uint64_t aValue )
{
if( m_parent )
m_parent->SubPadDieLength( aValue );
m_column_changed[COLUMN_PAD_DIE_LENGTH] |= ( aValue != 0 );
m_pad_die_length -= aValue;
}
// the total length column is always computed, never stored.
unsigned long long int GetTotalLength() const
{
return GetBoardWireLength() + GetViaLength() + GetPadDieLength();
}
bool TotalLengthChanged() const
{
return BoardWireLengthChanged() || ViaLengthChanged() || PadDieLengthChanged();
}
LIST_ITEM* Parent() const { return m_parent; }
void SetParent( LIST_ITEM* aParent )
{
if( m_parent == aParent )
return;
if( m_parent != nullptr )
{
m_parent->SubPadCount( GetPadCount() );
m_parent->SubViaCount( GetViaCount() );
m_parent->SubViaLength( GetViaLength() );
for( size_t ii = 0; ii < m_layer_wire_length.size(); ++ii )
m_parent->SubLayerWireLength( m_layer_wire_length[ii], ii );
m_parent->SubPadDieLength( GetPadDieLength() );
m_parent->m_children.erase(
std::find( m_parent->m_children.begin(), m_parent->m_children.end(), this ) );
}
m_parent = aParent;
if( m_parent != nullptr )
{
m_parent->AddPadCount( GetPadCount() );
m_parent->AddViaCount( GetViaCount() );
m_parent->AddViaLength( GetViaLength() );
for( size_t ii = 0; ii < m_layer_wire_length.size(); ++ii )
m_parent->AddLayerWireLength( m_layer_wire_length[ii], ii );
m_parent->AddPadDieLength( GetPadDieLength() );
m_parent->m_children.push_back( this );
}
}
private:
LIST_ITEM* m_parent = nullptr;
std::vector<LIST_ITEM*> m_children;
GROUP_TYPE m_group_type = GROUP_TYPE::NONE;
unsigned int m_group_number = 0;
NETINFO_ITEM* m_net = nullptr;
unsigned int m_pad_count = 0;
unsigned int m_via_count = 0;
uint64_t m_via_length = 0;
uint64_t m_pad_die_length = 0;
std::array<uint64_t, MAX_CU_LAYERS> m_layer_wire_length{};
// Dirty bits to record when some attribute has changed, in order to avoid unnecessary sort
// operations.
// The values are semantically bools, but STL auto-promotes a std::vector<bool> to a bitset,
// and then operator|= doesn't work.
std::vector<int> m_column_changed;
// cached formatted names for faster display sorting
wxString m_net_name;
wxString m_net_class;
wxString m_group_name;
};
struct PCB_NET_INSPECTOR_PANEL::LIST_ITEM_NETCODE_CMP_LESS
{
template <typename T>
bool operator()( const T& a, const T& b ) const
{
return a->GetNetCode() < b->GetNetCode();
}
template <typename T>
bool operator()( const T& a, int b ) const
{
return a->GetNetCode() < b;
}
template <typename T>
bool operator()( int a, const T& b ) const
{
return a < b->GetNetCode();
}
};
struct PCB_NET_INSPECTOR_PANEL::LIST_ITEM_GROUP_NUMBER_CMP_LESS
{
template <typename T>
bool operator()( const T& a, const T& b ) const
{
return a->GetGroupNumber() < b->GetGroupNumber();
}
template <typename T>
bool operator()( const T& a, int b ) const
{
return a->GetGroupNumber() < b;
}
template <typename T>
bool operator()( int a, const T& b ) const
{
return a < b->GetGroupNumber();
}
};
/**
* Data model for display in the Net Inspector panel.
*/
class PCB_NET_INSPECTOR_PANEL::DATA_MODEL : public wxDataViewModel
{
public:
DATA_MODEL( PCB_NET_INSPECTOR_PANEL& parent ) : m_parent( parent ) {}
unsigned int columnCount() const { return m_parent.m_columns.size(); }
unsigned int itemCount() const { return m_items.size(); }
wxVariant valueAt( unsigned int aCol, unsigned int aRow ) const
{
wxVariant r;
GetValue( r, wxDataViewItem( const_cast<LIST_ITEM*>( &*( m_items[aRow] ) ) ), aCol );
return r;
}
const LIST_ITEM& itemAt( unsigned int aRow ) const { return *m_items.at( aRow ); }
std::vector<std::pair<wxString, wxDataViewItem>> getGroupDataViewItems()
{
std::vector<std::pair<wxString, wxDataViewItem>> ret;
for( std::unique_ptr<LIST_ITEM>& item : m_items )
{
if( item->GetIsGroup() )
ret.push_back(
std::make_pair( item->GetGroupName(), wxDataViewItem( item.get() ) ) );
}
return ret;
}
std::optional<LIST_ITEM_ITER> findItem( int aNetCode )
{
auto i = std::lower_bound( m_items.begin(), m_items.end(), aNetCode,
LIST_ITEM_NETCODE_CMP_LESS() );
if( i == m_items.end() || ( *i )->GetNetCode() != aNetCode )
return std::nullopt;
return { i };
}
std::optional<LIST_ITEM_ITER> findItem( NETINFO_ITEM* aNet )
{
if( aNet != nullptr )
return findItem( aNet->GetNetCode() );
else
return std::nullopt;
}
std::optional<LIST_ITEM_ITER> findGroupItem( int aGroupNumber )
{
auto i = std::lower_bound( m_items.begin(), m_items.end(), aGroupNumber,
LIST_ITEM_GROUP_NUMBER_CMP_LESS() );
if( i == m_items.end() || ( *i )->GetGroupNumber() != aGroupNumber )
return std::nullopt;
return { i };
}
LIST_ITEM_ITER addGroup( LIST_ITEM_ITER groupsBegin, LIST_ITEM_ITER groupsEnd,
wxString groupName, LIST_ITEM::GROUP_TYPE groupType )
{
LIST_ITEM_ITER group = std::find_if( groupsBegin, groupsEnd,
[&]( const std::unique_ptr<LIST_ITEM>& x )
{
return x->GetGroupName() == groupName
&& x->GetGroupType() == groupType;
} );
if( group == groupsEnd )
{
int dist = std::distance( groupsBegin, groupsEnd );
std::unique_ptr<LIST_ITEM> groupItem =
std::make_unique<LIST_ITEM>( dist, groupName, groupType );
group = m_items.insert( groupsEnd, std::move( groupItem ) );
ItemAdded( wxDataViewItem( ( *group )->Parent() ), wxDataViewItem( &**group ) );
}
return group;
}
std::optional<LIST_ITEM_ITER> addItem( std::unique_ptr<LIST_ITEM> aItem )
{
if( aItem == nullptr )
return {};
bool groupMatched = false;
// First see if item matches a group-by rule
if( m_parent.m_custom_group_rules.size() > 0 )
{
wxString searchName = aItem->GetNetName().Upper();
for( const wxString& groupName : m_parent.m_custom_group_rules )
{
if( searchName.Find( groupName.Upper() ) != wxNOT_FOUND )
{
aItem->SetParent( m_custom_group_map[groupName] );
groupMatched = true;
break;
}
}
}
// Then add any netclass groups required by this item
if( m_parent.m_group_by_netclass && !groupMatched )
{
LIST_ITEM_ITER groups_begin = m_items.begin();
LIST_ITEM_ITER groups_end = std::find_if_not( m_items.begin(), m_items.end(),
[]( const std::unique_ptr<LIST_ITEM>& x )
{
return x->GetIsGroup();
} );
wxString match_str = aItem->GetNetclassName();
LIST_ITEM_ITER group = addGroup( groups_begin, groups_end, match_str,
LIST_ITEM::GROUP_TYPE::NETCLASS );
aItem->SetParent( &**group );
}
// Now add the item itself. Usually when new nets are added,
// they always get a higher netcode number than the already existing ones.
// however, if we've got filtering enabled, we might not have all the nets in
// our list, so do a sorted insertion.
auto new_iter = std::lower_bound( m_items.begin(), m_items.end(), aItem->GetNetCode(),
LIST_ITEM_NETCODE_CMP_LESS() );
new_iter = m_items.insert( new_iter, std::move( aItem ) );
const std::unique_ptr<LIST_ITEM>& new_item = *new_iter;
ItemAdded( wxDataViewItem( new_item->Parent() ), wxDataViewItem( new_item.get() ) );
return { new_iter };
}
void addItems( std::vector<std::unique_ptr<LIST_ITEM>> aItems )
{
m_items.reserve( m_items.size() + aItems.size() );
for( std::unique_ptr<LIST_ITEM>& i : aItems )
addItem( std::move( i ) );
}
std::unique_ptr<LIST_ITEM> deleteItem( const std::optional<LIST_ITEM_ITER>& aRow )
{
if( !aRow )
return {};
std::unique_ptr<LIST_ITEM> i = std::move( **aRow );
LIST_ITEM* parent = i->Parent();
i->SetParent( nullptr );
m_items.erase( *aRow );
ItemDeleted( wxDataViewItem( parent ), wxDataViewItem( &*i ) );
if( parent )
{
ItemChanged( wxDataViewItem( parent ) );
if( m_parent.m_group_by_netclass && parent != nullptr && parent->ChildrenCount() == 0 )
{
auto p = std::find_if( m_items.begin(), m_items.end(),
[&]( std::unique_ptr<LIST_ITEM>& x )
{
return x.get() == parent;
} );
wxASSERT( p != m_items.end() );
m_items.erase( p );
ItemDeleted( wxDataViewItem( parent->Parent() ), wxDataViewItem( parent ) );
}
}
Resort();
return i;
}
/**
* Adds all custom group-by entries to the items table
*
* Note this assumes that m_items is empty prior to adding these groups
*/
void addCustomGroups()
{
m_custom_group_map.clear();
int groupId = 0;
for( const wxString& groupName : m_parent.m_custom_group_rules )
{
std::unique_ptr<LIST_ITEM>& group = m_items.emplace_back( std::make_unique<LIST_ITEM>(
groupId, groupName, LIST_ITEM::GROUP_TYPE::USER_DEFINED ) );
m_custom_group_map[groupName] = group.get();
ItemAdded( wxDataViewItem( group->Parent() ), wxDataViewItem( group.get() ) );
++groupId;
}
}
void deleteAllItems()
{
BeforeReset();
m_items.clear();
AfterReset();
}
void updateItem( const std::optional<LIST_ITEM_ITER>& aRow )
{
if( aRow )
{
const std::unique_ptr<LIST_ITEM>& listItem = *aRow.value();
if( listItem->Parent() )
ItemChanged( wxDataViewItem( listItem->Parent() ) );
ItemChanged( wxDataViewItem( listItem.get() ) );
resortIfChanged( listItem.get() );
}
}
void updateAllItems()
{
for( std::unique_ptr<LIST_ITEM>& i : m_items )
ItemChanged( wxDataViewItem( i.get() ) );
}
void resortIfChanged( LIST_ITEM* aItem )
{
if( wxDataViewColumn* column = m_parent.m_netsList->GetSortingColumn() )
{
bool changed = false;
for( const LIST_ITEM* i = aItem; i != nullptr; i = i->Parent() )
changed |= itemColumnChanged( i, column->GetModelColumn() );
for( LIST_ITEM* i = aItem; i != nullptr; i = i->Parent() )
i->ResetColumnChangedBits();
if( changed )
Resort();
}
}
bool itemColumnChanged( const LIST_ITEM* aItem, unsigned int aCol ) const
{
if( aItem == nullptr || aCol >= m_parent.m_columns.size() )
return false;
if( aCol == COLUMN_PAD_COUNT )
return aItem->PadCountChanged();
else if( aCol == COLUMN_VIA_COUNT )
return aItem->ViaCountChanged();
else if( aCol == COLUMN_VIA_LENGTH )
return aItem->ViaLengthChanged();
else if( aCol == COLUMN_BOARD_LENGTH )
return aItem->BoardWireLengthChanged();
else if( aCol == COLUMN_PAD_DIE_LENGTH )
return aItem->PadDieLengthChanged();
else if( aCol == COLUMN_TOTAL_LENGTH )
return aItem->TotalLengthChanged();
else if( aCol > COLUMN_LAST_STATIC_COL )
return aItem->BoardWireLengthChanged();
return false;
}
// implementation of wxDataViewModel interface
// these are used to query the data model by the GUI view implementation.
// these are not supposed to be used to modify the data model. for that
// use the public functions above.
protected:
unsigned int GetColumnCount() const override { return columnCount(); }
void GetValue( wxVariant& aOutValue, const wxDataViewItem& aItem,
unsigned int aCol ) const override
{
if( LIST_ITEM* i = static_cast<LIST_ITEM*>( aItem.GetID() ) )
{
if( i->GetIsGroup() )
{
if( aCol == COLUMN_NAME )
switch( i->GetGroupType() )
{
case LIST_ITEM::GROUP_TYPE::NETCLASS:
aOutValue = _( "Netclass" ) + ": " + i->GetGroupName();
break;
case LIST_ITEM::GROUP_TYPE::USER_DEFINED:
aOutValue = _( "Custom" ) + ": " + i->GetGroupName();
break;
default: aOutValue = i->GetGroupName(); break;
}
else
aOutValue = "";
}
else if( aCol == COLUMN_NAME )
aOutValue = i->GetNetName();
else if( aCol == COLUMN_NETCLASS )
aOutValue = i->GetNetclassName();
else if( aCol == COLUMN_PAD_COUNT )
aOutValue = m_parent.formatCount( i->GetPadCount() );
else if( aCol == COLUMN_VIA_COUNT )
aOutValue = m_parent.formatCount( i->GetViaCount() );
else if( aCol == COLUMN_VIA_LENGTH )
aOutValue = m_parent.formatLength( i->GetViaLength() );
else if( aCol == COLUMN_BOARD_LENGTH )
aOutValue = m_parent.formatLength( i->GetBoardWireLength() );
else if( aCol == COLUMN_PAD_DIE_LENGTH )
aOutValue = m_parent.formatLength( i->GetPadDieLength() );
else if( aCol == COLUMN_TOTAL_LENGTH )
aOutValue = m_parent.formatLength( i->GetTotalLength() );
else if( aCol > COLUMN_LAST_STATIC_COL && aCol <= m_parent.m_columns.size() )
aOutValue = m_parent.formatLength(
i->GetLayerWireLength( m_parent.m_columns[aCol].layer ) );
else
aOutValue = "";
}
}
static int compareUInt( uint64_t aValue1, uint64_t aValue2, bool aAsc )
{
if( aAsc )
return aValue1 < aValue2 ? -1 : 1;
else
return aValue2 < aValue1 ? -1 : 1;
}
int Compare( const wxDataViewItem& aItem1, const wxDataViewItem& aItem2, unsigned int aCol,
bool aAsc ) const override
{
const LIST_ITEM& i1 = *static_cast<const LIST_ITEM*>( aItem1.GetID() );
const LIST_ITEM& i2 = *static_cast<const LIST_ITEM*>( aItem2.GetID() );
if( i1.GetIsGroup() && !i2.GetIsGroup() )
return -1;
if( i2.GetIsGroup() && !i1.GetIsGroup() )
return 1;
if( aCol == COLUMN_NAME )
{
const wxString& s1 = i1.GetNetName();
const wxString& s2 = i2.GetNetName();
int res = aAsc ? ValueStringCompare( s1, s2 ) : ValueStringCompare( s2, s1 );
if( res != 0 )
return res;
}
else if( aCol == COLUMN_PAD_COUNT && i1.GetPadCount() != i2.GetPadCount() )
return compareUInt( i1.GetPadCount(), i2.GetPadCount(), aAsc );
else if( aCol == COLUMN_VIA_COUNT && i1.GetViaCount() != i2.GetViaCount() )
return compareUInt( i1.GetViaCount(), i2.GetViaCount(), aAsc );
else if( aCol == COLUMN_VIA_LENGTH && i1.GetViaLength() != i2.GetViaLength() )
return compareUInt( i1.GetViaLength(), i2.GetViaLength(), aAsc );
else if( aCol == COLUMN_BOARD_LENGTH && i1.GetBoardWireLength() != i2.GetBoardWireLength() )
return compareUInt( i1.GetBoardWireLength(), i2.GetBoardWireLength(), aAsc );
else if( aCol == COLUMN_PAD_DIE_LENGTH && i1.GetPadDieLength() != i2.GetPadDieLength() )
return compareUInt( i1.GetPadDieLength(), i2.GetPadDieLength(), aAsc );
else if( aCol == COLUMN_TOTAL_LENGTH && i1.GetTotalLength() != i2.GetTotalLength() )
return compareUInt( i1.GetTotalLength(), i2.GetTotalLength(), aAsc );
else if( aCol > COLUMN_LAST_STATIC_COL && aCol < m_parent.m_columns.size()
&& i1.GetLayerWireLength( m_parent.m_columns[aCol].layer )
!= i2.GetLayerWireLength( m_parent.m_columns[aCol].layer ) )
{
return compareUInt( i1.GetLayerWireLength( m_parent.m_columns[aCol].layer ),
i2.GetLayerWireLength( m_parent.m_columns[aCol].layer ), aAsc );
}
// when the item values compare equal resort to pointer comparison.
wxUIntPtr id1 = wxPtrToUInt( aItem1.GetID() );
wxUIntPtr id2 = wxPtrToUInt( aItem2.GetID() );
return aAsc ? id1 - id2 : id2 - id1;
}
bool SetValue( const wxVariant& aInValue, const wxDataViewItem& aItem,
unsigned int aCol ) override
{
return false;
}
wxDataViewItem GetParent( const wxDataViewItem& aItem ) const override
{
if( !aItem.IsOk() )
return wxDataViewItem();
return wxDataViewItem( static_cast<const LIST_ITEM*>( aItem.GetID() )->Parent() );
}
bool IsContainer( const wxDataViewItem& aItem ) const override
{
if( !aItem.IsOk() )
return true;
return static_cast<const LIST_ITEM*>( aItem.GetID() )->GetIsGroup();
}
bool HasContainerColumns( const wxDataViewItem& aItem ) const override
{
return IsContainer( aItem );
}
unsigned int GetChildren( const wxDataViewItem& aParent,
wxDataViewItemArray& aChildren ) const override
{
const LIST_ITEM* p = static_cast<const LIST_ITEM*>( aParent.GetID() );
if( !aParent.IsOk() )
{
aChildren.Alloc( m_items.size() );
for( const std::unique_ptr<LIST_ITEM>& i : m_items )
{
if( i->Parent() == nullptr )
aChildren.Add( wxDataViewItem( &*i ) );
}
return aChildren.GetCount();
}
else if( p->GetIsGroup() )
{
const int count = p->ChildrenCount();
if( count == 0 )
return 0;
aChildren.Alloc( count );
for( auto i = p->ChildrenBegin(), end = p->ChildrenEnd(); i != end; ++i )
aChildren.Add( wxDataViewItem( *i ) );
return aChildren.GetCount();
}
return 0;
}
wxString GetColumnType( unsigned int /* aCol */ ) const override { return wxS( "string" ); }
private:
PCB_NET_INSPECTOR_PANEL& m_parent;
// primary container, sorted by netcode number.
// groups have netcode < 0, so they always come first, in the order
// of the filter strings as input by the user
std::vector<std::unique_ptr<LIST_ITEM>> m_items;
/// Map of custom group names to their representative list item
std::map<wxString, LIST_ITEM*> m_custom_group_map;
};
#endif

View File

@ -95,7 +95,6 @@ PCB_PROPERTIES_PANEL::PCB_PROPERTIES_PANEL( wxWindow* aParent, PCB_BASE_EDIT_FRA
}
PCB_PROPERTIES_PANEL::~PCB_PROPERTIES_PANEL()
{
m_unitEditorInstance->UpdateFrame( nullptr );