move PCB_INSPECTION_TOOL::ListNets into pcb_inspection_tool.cpp, split out dialog_select_net_from_list.h

This commit is contained in:
Oleg Endo 2020-04-13 04:20:30 +09:00 committed by Jon Evans
parent 4c7471eb79
commit e3aec20f82
3 changed files with 86 additions and 56 deletions

View File

@ -28,68 +28,14 @@
#include <tools/pcb_inspection_tool.h>
#include <class_board.h>
#include <class_track.h>
#include <dialog_select_net_from_list_base.h>
#include <dialog_select_net_from_list.h>
#include <eda_pattern_match.h>
#include <wildcards_and_files_ext.h>
#include <view/view.h>
#include <view/view_controls.h>
#include <pcb_painter.h>
#include <connectivity/connectivity_data.h>
class DIALOG_SELECT_NET_FROM_LIST: public DIALOG_SELECT_NET_FROM_LIST_BASE
{
private:
public:
DIALOG_SELECT_NET_FROM_LIST( PCB_EDIT_FRAME* aParent );
~DIALOG_SELECT_NET_FROM_LIST();
// returns true if a net was selected, and its name in aName
bool GetNetName( wxString& aName );
/**
* Visually highlights a net.
* @param aNetName is the name of net to be highlighted. An empty string will unhighlight
* any currently highlighted net.
*/
void HighlightNet( const wxString& aNetName );
private:
void onSelChanged( wxDataViewEvent& event ) override;
void onFilterChange( wxCommandEvent& event ) override;
void onListSize( wxSizeEvent& event ) override;
void onReport( wxCommandEvent& event ) override;
void buildNetsList();
wxString getListColumnHeaderNet() { return _( "Net" ); };
wxString getListColumnHeaderName() { return _( "Name" ); };
wxString getListColumnHeaderCount() { return _( "Pad Count" ); };
wxString getListColumnHeaderVias() { return _( "Via Count" ); };
wxString getListColumnHeaderBoard() { return _( "Board Length" ); };
wxString getListColumnHeaderDie() { return _( "Die Length" ); };
wxString getListColumnHeaderLength() { return _( "Length" ); };
void adjustListColumns();
wxArrayString m_netsInitialNames; // The list of escaped netnames (original names)
wxString m_selection;
bool m_wasSelected;
BOARD* m_brd;
PCB_EDIT_FRAME* m_frame;
};
int PCB_INSPECTION_TOOL::ListNets( const TOOL_EVENT& aEvent )
{
DIALOG_SELECT_NET_FROM_LIST dlg( m_frame );
wxString netname;
if( dlg.ShowModal() == wxID_CANCEL )
{
// Clear highlight
dlg.HighlightNet( "" );
}
return 0;
}
#include <connectivity/connectivity_algo.h>
DIALOG_SELECT_NET_FROM_LIST::DIALOG_SELECT_NET_FROM_LIST( PCB_EDIT_FRAME* aParent )

View File

@ -0,0 +1,71 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2019 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 <dialog_select_net_from_list_base.h>
class PCB_EDIT_FRAME;
class NETINFO_ITEM;
class BOARD;
class DIALOG_SELECT_NET_FROM_LIST : public DIALOG_SELECT_NET_FROM_LIST_BASE
{
private:
public:
DIALOG_SELECT_NET_FROM_LIST( PCB_EDIT_FRAME* aParent );
~DIALOG_SELECT_NET_FROM_LIST();
// returns true if a net was selected, and its name in aName
bool GetNetName( wxString& aName );
/**
* Visually highlights a net.
* @param aNetName is the name of net to be highlighted. An empty string will unhighlight
* any currently highlighted net.
*/
void HighlightNet( const wxString& aNetName );
private:
void onSelChanged( wxDataViewEvent& event ) override;
void onFilterChange( wxCommandEvent& event ) override;
void onListSize( wxSizeEvent& event ) override;
void onReport( wxCommandEvent& event ) override;
void buildNetsList();
wxString getListColumnHeaderNet() { return _( "Net" ); };
wxString getListColumnHeaderName() { return _( "Name" ); };
wxString getListColumnHeaderCount() { return _( "Pad Count" ); };
wxString getListColumnHeaderVias() { return _( "Via Count" ); };
wxString getListColumnHeaderBoard() { return _( "Board Length" ); };
wxString getListColumnHeaderDie() { return _( "Die Length" ); };
wxString getListColumnHeaderLength() { return _( "Length" ); };
void adjustListColumns();
wxArrayString m_netsInitialNames; // The list of escaped netnames (original names)
wxString m_selection;
bool m_wasSelected;
BOARD* m_brd;
PCB_EDIT_FRAME* m_frame;
};

View File

@ -28,6 +28,7 @@
#include <tools/edit_tool.h>
#include <painter.h>
#include <connectivity/connectivity_data.h>
#include <dialogs/dialog_select_net_from_list.h>
#include <profile.h>
#include "pcb_inspection_tool.h"
@ -443,6 +444,18 @@ void PCB_INSPECTION_TOOL::calculateSelectionRatsnest()
connectivity->ComputeDynamicRatsnest( items );
}
int PCB_INSPECTION_TOOL::ListNets( const TOOL_EVENT& aEvent )
{
DIALOG_SELECT_NET_FROM_LIST dlg( m_frame );
if( dlg.ShowModal() == wxID_CANCEL )
{
// Clear highlight
dlg.HighlightNet( "" );
}
return 0;
}
void PCB_INSPECTION_TOOL::setTransitions()
{