2020-04-12 19:20:30 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2020-04-12 19:53:45 +00:00
|
|
|
* Copyright (C) 2020 Oleg Endo <olegendo@gcc.gnu.org>
|
2020-04-12 19:20:30 +00:00
|
|
|
* Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2023-03-11 19:35:13 +00:00
|
|
|
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2020-04-12 19:20:30 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
2022-09-25 15:19:50 +00:00
|
|
|
#include <board.h>
|
2022-08-25 22:50:47 +00:00
|
|
|
#include <optional>
|
2020-11-11 12:59:59 +00:00
|
|
|
#include <dialog_net_inspector_base.h>
|
2020-04-12 19:20:30 +00:00
|
|
|
|
|
|
|
class PCB_EDIT_FRAME;
|
|
|
|
class NETINFO_ITEM;
|
|
|
|
class BOARD;
|
2022-09-25 15:19:50 +00:00
|
|
|
class BOARD_ITEM;
|
2020-04-12 19:53:45 +00:00
|
|
|
class CN_ITEM;
|
2020-11-04 02:49:19 +00:00
|
|
|
class EDA_PATTERN_MATCH;
|
2022-09-25 15:19:50 +00:00
|
|
|
class PCB_TRACK;
|
2020-04-12 19:20:30 +00:00
|
|
|
|
2023-03-13 16:03:48 +00:00
|
|
|
/**
|
|
|
|
* Event sent to parent when dialog is mode-less.
|
|
|
|
*/
|
|
|
|
wxDECLARE_EVENT( EDA_EVT_CLOSE_NET_INSPECTOR_DIALOG, wxCommandEvent );
|
|
|
|
|
2020-11-11 12:59:59 +00:00
|
|
|
class DIALOG_NET_INSPECTOR : public DIALOG_NET_INSPECTOR_BASE, public BOARD_LISTENER
|
2020-04-12 19:20:30 +00:00
|
|
|
{
|
|
|
|
public:
|
2023-03-13 16:03:48 +00:00
|
|
|
DIALOG_NET_INSPECTOR( PCB_EDIT_FRAME* aParent );
|
2020-11-11 12:59:59 +00:00
|
|
|
~DIALOG_NET_INSPECTOR();
|
2020-04-12 19:20:30 +00:00
|
|
|
|
2020-04-12 19:53:45 +00:00
|
|
|
virtual void OnBoardItemAdded( BOARD& aBoard, BOARD_ITEM* aBoardItem ) override;
|
2020-12-07 23:29:30 +00:00
|
|
|
virtual void OnBoardItemsAdded( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItems ) override;
|
2020-04-12 19:53:45 +00:00
|
|
|
virtual void OnBoardItemRemoved( BOARD& aBoard, BOARD_ITEM* aBoardItem ) override;
|
2023-03-13 16:03:48 +00:00
|
|
|
virtual void OnBoardItemsRemoved( BOARD& aBoard,
|
|
|
|
std::vector<BOARD_ITEM*>& aBoardItems ) override;
|
2020-04-12 19:53:45 +00:00
|
|
|
virtual void OnBoardNetSettingsChanged( BOARD& aBoard ) override;
|
|
|
|
virtual void OnBoardItemChanged( BOARD& aBoard, BOARD_ITEM* aBoardItem ) override;
|
2023-03-13 16:03:48 +00:00
|
|
|
virtual void OnBoardItemsChanged( BOARD& aBoard,
|
|
|
|
std::vector<BOARD_ITEM*>& aBoardItems ) override;
|
2020-04-12 19:53:45 +00:00
|
|
|
virtual void OnBoardHighlightNetChanged( BOARD& aBoard ) override;
|
2020-04-12 19:20:30 +00:00
|
|
|
|
2023-03-13 16:03:48 +00:00
|
|
|
protected:
|
|
|
|
virtual void onClose( wxCloseEvent& aEvent ) override;
|
|
|
|
|
2020-04-12 19:20:30 +00:00
|
|
|
private:
|
2020-11-04 02:49:19 +00:00
|
|
|
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;
|
|
|
|
|
2020-04-12 19:53:45 +00:00
|
|
|
wxString formatNetCode( const NETINFO_ITEM* aNet ) const;
|
|
|
|
wxString formatNetName( const NETINFO_ITEM* aNet ) const;
|
|
|
|
wxString formatCount( unsigned int aValue ) const;
|
2020-11-04 02:49:19 +00:00
|
|
|
wxString formatLength( int64_t aValue ) const;
|
2020-04-12 19:53:45 +00:00
|
|
|
|
|
|
|
std::vector<CN_ITEM*> relevantConnectivityItems() const;
|
|
|
|
bool netFilterMatches( NETINFO_ITEM* aNet ) const;
|
|
|
|
void updateNet( NETINFO_ITEM* aNet );
|
2021-06-11 21:07:02 +00:00
|
|
|
unsigned int calculateViaLength( const PCB_TRACK* ) const;
|
2020-04-12 19:53:45 +00:00
|
|
|
|
2020-04-12 19:20:30 +00:00
|
|
|
void onSelChanged( wxDataViewEvent& event ) override;
|
2020-11-04 02:49:19 +00:00
|
|
|
void onSelChanged();
|
|
|
|
void onSortingChanged( wxDataViewEvent& event ) override;
|
2020-04-12 19:20:30 +00:00
|
|
|
void onFilterChange( wxCommandEvent& event ) override;
|
2020-06-08 18:36:25 +00:00
|
|
|
void onAddNet( wxCommandEvent& event ) override;
|
|
|
|
void onRenameNet( wxCommandEvent& event ) override;
|
|
|
|
void onDeleteNet( wxCommandEvent& event ) override;
|
2020-04-12 19:20:30 +00:00
|
|
|
void onReport( wxCommandEvent& event ) override;
|
|
|
|
|
2020-11-04 03:31:43 +00:00
|
|
|
std::unique_ptr<LIST_ITEM> buildNewItem( NETINFO_ITEM* aNet, unsigned int aPadCount,
|
|
|
|
const std::vector<CN_ITEM*>& aCNItems );
|
2020-11-04 02:49:19 +00:00
|
|
|
|
2020-04-12 19:20:30 +00:00
|
|
|
void buildNetsList();
|
2023-12-02 22:05:56 +00:00
|
|
|
void setColumnWidths();
|
2020-04-12 19:20:30 +00:00
|
|
|
void adjustListColumns();
|
|
|
|
|
2020-04-12 19:53:45 +00:00
|
|
|
void onUnitsChanged( wxCommandEvent& event );
|
|
|
|
void onBoardChanged( wxCommandEvent& event );
|
|
|
|
|
2022-08-25 22:50:47 +00:00
|
|
|
void updateDisplayedRowValues( const std::optional<LIST_ITEM_ITER>& aRow );
|
2020-04-12 19:53:45 +00:00
|
|
|
|
2020-11-04 02:49:19 +00:00
|
|
|
// 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;
|
2020-04-12 19:53:45 +00:00
|
|
|
|
2020-11-04 02:49:19 +00:00
|
|
|
std::vector<std::unique_ptr<EDA_PATTERN_MATCH>> m_netFilter;
|
|
|
|
std::vector<std::unique_ptr<EDA_PATTERN_MATCH>> m_groupFilter;
|
2020-04-12 19:53:45 +00:00
|
|
|
|
2020-04-12 19:20:30 +00:00
|
|
|
BOARD* m_brd;
|
|
|
|
PCB_EDIT_FRAME* m_frame;
|
2023-11-23 11:46:24 +00:00
|
|
|
bool m_in_reporting = false;
|
2020-11-04 02:49:19 +00:00
|
|
|
bool m_in_build_nets_list = false;
|
2024-03-22 22:20:44 +00:00
|
|
|
bool m_in_bulk_update = false;
|
2020-11-04 02:49:19 +00:00
|
|
|
bool m_filter_change_no_rebuild = false;
|
2021-12-17 04:00:24 +00:00
|
|
|
wxSize m_size;
|
2020-11-04 02:49:19 +00:00
|
|
|
|
2022-08-03 23:19:23 +00:00
|
|
|
std::vector<COLUMN_DESC> m_columns;
|
|
|
|
|
2020-11-04 02:49:19 +00:00
|
|
|
class DATA_MODEL;
|
|
|
|
wxObjectDataPtr<DATA_MODEL> m_data_model;
|
2022-08-03 23:19:23 +00:00
|
|
|
|
|
|
|
friend DATA_MODEL;
|
2020-04-12 19:20:30 +00:00
|
|
|
};
|