2016-03-16 14:14:00 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2019-02-19 19:04:40 +00:00
|
|
|
* Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
|
|
|
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
2016-03-16 14:14:00 +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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <fctsys.h>
|
|
|
|
#include <kicad_string.h>
|
|
|
|
#include <pcbnew.h>
|
2019-08-12 14:41:45 +00:00
|
|
|
#include <tools/pcb_inspection_tool.h>
|
2016-03-16 14:14:00 +00:00
|
|
|
#include <class_board.h>
|
|
|
|
#include <dialog_select_net_from_list_base.h>
|
|
|
|
#include <eda_pattern_match.h>
|
2019-04-15 08:10:51 +00:00
|
|
|
#include <wildcards_and_files_ext.h>
|
2016-03-16 14:14:00 +00:00
|
|
|
#include <view/view.h>
|
|
|
|
#include <view/view_controls.h>
|
|
|
|
#include <pcb_painter.h>
|
2018-10-12 06:17:15 +00:00
|
|
|
#include <connectivity/connectivity_data.h>
|
2016-03-16 14:14:00 +00:00
|
|
|
|
|
|
|
class DIALOG_SELECT_NET_FROM_LIST: public DIALOG_SELECT_NET_FROM_LIST_BASE
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
public:
|
2018-02-15 14:35:29 +00:00
|
|
|
DIALOG_SELECT_NET_FROM_LIST( PCB_EDIT_FRAME* aParent );
|
2016-03-16 14:14:00 +00:00
|
|
|
~DIALOG_SELECT_NET_FROM_LIST();
|
|
|
|
|
|
|
|
// returns true if a net was selected, and its name in aName
|
|
|
|
bool GetNetName( wxString& aName );
|
|
|
|
|
2018-02-15 14:35:29 +00:00
|
|
|
/**
|
|
|
|
* Visually highlights a net.
|
2018-02-28 09:44:22 +00:00
|
|
|
* @param aNetName is the name of net to be highlighted. An empty string will unhighlight
|
|
|
|
* any currently highlighted net.
|
2018-02-15 14:35:29 +00:00
|
|
|
*/
|
2018-02-28 09:44:22 +00:00
|
|
|
void HighlightNet( const wxString& aNetName );
|
2018-02-15 14:35:29 +00:00
|
|
|
|
2016-03-16 14:14:00 +00:00
|
|
|
private:
|
2018-02-28 09:44:22 +00:00
|
|
|
void onSelChanged( wxDataViewEvent& event ) override;
|
2018-02-15 14:35:29 +00:00
|
|
|
void onFilterChange( wxCommandEvent& event ) override;
|
2018-02-28 09:44:22 +00:00
|
|
|
void onListSize( wxSizeEvent& event ) override;
|
2019-04-15 08:10:51 +00:00
|
|
|
void onReport( wxCommandEvent& event ) override;
|
2016-03-16 14:14:00 +00:00
|
|
|
|
|
|
|
void buildNetsList();
|
2018-09-25 09:31:17 +00:00
|
|
|
wxString getListColumnHeaderNet() { return _( "Net" ); };
|
|
|
|
wxString getListColumnHeaderName() { return _( "Name" ); };
|
|
|
|
wxString getListColumnHeaderCount() { return _( "Pad Count" ); };
|
2019-02-22 08:45:27 +00:00
|
|
|
wxString getListColumnHeaderVias() { return _( "Via Count" ); };
|
|
|
|
wxString getListColumnHeaderBoard() { return _( "Board Length" ); };
|
|
|
|
wxString getListColumnHeaderDie() { return _( "Die Length" ); };
|
|
|
|
wxString getListColumnHeaderLength() { return _( "Length" ); };
|
2019-02-19 19:04:40 +00:00
|
|
|
void adjustListColumns();
|
2018-02-15 14:35:29 +00:00
|
|
|
|
2019-04-08 13:35:44 +00:00
|
|
|
wxArrayString m_netsInitialNames; // The list of escaped netnames (original names)
|
2018-02-28 09:44:22 +00:00
|
|
|
wxString m_selection;
|
|
|
|
bool m_wasSelected;
|
|
|
|
BOARD* m_brd;
|
2018-02-15 14:35:29 +00:00
|
|
|
PCB_EDIT_FRAME* m_frame;
|
2016-03-16 14:14:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2019-08-12 14:41:45 +00:00
|
|
|
int PCB_INSPECTION_TOOL::ListNets( const TOOL_EVENT& aEvent )
|
2016-03-16 14:14:00 +00:00
|
|
|
{
|
2019-06-03 13:49:17 +00:00
|
|
|
DIALOG_SELECT_NET_FROM_LIST dlg( m_frame );
|
2016-03-16 14:14:00 +00:00
|
|
|
wxString netname;
|
|
|
|
|
2018-02-15 14:35:29 +00:00
|
|
|
if( dlg.ShowModal() == wxID_CANCEL )
|
2016-03-16 14:14:00 +00:00
|
|
|
{
|
2018-02-15 14:35:29 +00:00
|
|
|
// Clear highlight
|
2018-02-28 09:44:22 +00:00
|
|
|
dlg.HighlightNet( "" );
|
2016-03-16 14:14:00 +00:00
|
|
|
}
|
2019-06-03 13:49:17 +00:00
|
|
|
|
|
|
|
return 0;
|
2016-03-16 14:14:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DIALOG_SELECT_NET_FROM_LIST::DIALOG_SELECT_NET_FROM_LIST( PCB_EDIT_FRAME* aParent )
|
2018-02-15 14:35:29 +00:00
|
|
|
: DIALOG_SELECT_NET_FROM_LIST_BASE( aParent ), m_frame( aParent )
|
2016-03-16 14:14:00 +00:00
|
|
|
{
|
|
|
|
m_brd = aParent->GetBoard();
|
|
|
|
m_wasSelected = false;
|
|
|
|
|
2019-02-22 08:45:27 +00:00
|
|
|
m_netsList->AppendTextColumn( getListColumnHeaderNet(), wxDATAVIEW_CELL_INERT, 0, wxALIGN_LEFT, 0 );
|
|
|
|
m_netsList->AppendTextColumn( getListColumnHeaderName(), wxDATAVIEW_CELL_INERT, 0, wxALIGN_LEFT, 0 );
|
|
|
|
m_netsList->AppendTextColumn( getListColumnHeaderCount(), wxDATAVIEW_CELL_INERT, 0, wxALIGN_CENTER, 0 );
|
|
|
|
m_netsList->AppendTextColumn( getListColumnHeaderVias(), wxDATAVIEW_CELL_INERT, 0, wxALIGN_CENTER, 0 );
|
|
|
|
m_netsList->AppendTextColumn( getListColumnHeaderBoard(), wxDATAVIEW_CELL_INERT, 0, wxALIGN_CENTER, 0 );
|
|
|
|
m_netsList->AppendTextColumn( getListColumnHeaderDie(), wxDATAVIEW_CELL_INERT, 0, wxALIGN_CENTER, 0 );
|
|
|
|
m_netsList->AppendTextColumn( getListColumnHeaderLength(), wxDATAVIEW_CELL_INERT, 0, wxALIGN_CENTER, 0 );
|
2018-02-28 09:44:22 +00:00
|
|
|
|
|
|
|
// The fact that we're a list should keep the control from reserving space for the
|
|
|
|
// expander buttons... but it doesn't. Fix by forcing the indent to 0.
|
|
|
|
m_netsList->SetIndent( 0 );
|
|
|
|
|
2016-03-16 14:14:00 +00:00
|
|
|
buildNetsList();
|
|
|
|
|
2019-02-19 19:04:40 +00:00
|
|
|
adjustListColumns();
|
2018-02-28 09:44:22 +00:00
|
|
|
|
2016-03-16 14:14:00 +00:00
|
|
|
m_sdbSizerOK->SetDefault();
|
2018-05-17 23:42:27 +00:00
|
|
|
|
2018-02-28 09:44:22 +00:00
|
|
|
FinishDialogSettings();
|
2016-03-16 14:14:00 +00:00
|
|
|
}
|
|
|
|
|
2018-02-15 14:35:29 +00:00
|
|
|
|
2016-03-16 14:14:00 +00:00
|
|
|
void DIALOG_SELECT_NET_FROM_LIST::buildNetsList()
|
|
|
|
{
|
2018-02-28 09:44:22 +00:00
|
|
|
wxString netFilter = m_textCtrlFilter->GetValue();
|
2016-03-16 14:14:00 +00:00
|
|
|
EDA_PATTERN_MATCH_WILDCARD filter;
|
2018-02-28 09:44:22 +00:00
|
|
|
|
2019-02-22 08:45:27 +00:00
|
|
|
constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, PCB_PAD_T, EOT };
|
|
|
|
|
2016-03-16 14:14:00 +00:00
|
|
|
filter.SetPattern( netFilter.MakeUpper() );
|
|
|
|
|
2018-02-28 09:44:22 +00:00
|
|
|
m_netsList->DeleteAllItems();
|
2019-04-08 13:35:44 +00:00
|
|
|
m_netsInitialNames.Clear();
|
2016-03-16 14:14:00 +00:00
|
|
|
|
2019-02-22 08:45:27 +00:00
|
|
|
auto connectivity = m_brd->GetConnectivity();
|
|
|
|
|
|
|
|
auto units = GetUserUnits();
|
|
|
|
|
2016-03-16 14:14:00 +00:00
|
|
|
// Populate the nets list with nets names matching the filters:
|
|
|
|
// Note: the filtering is case insensitive.
|
|
|
|
for( unsigned netcode = 0; netcode < m_brd->GetNetCount(); netcode++ )
|
|
|
|
{
|
|
|
|
NETINFO_ITEM* net = m_brd->GetNetInfo().GetNetItem( netcode );
|
|
|
|
|
|
|
|
if( !netFilter.IsEmpty() )
|
|
|
|
{
|
2018-10-19 11:28:34 +00:00
|
|
|
wxString netname = UnescapeString( net->GetNetname() );
|
2019-04-14 22:13:46 +00:00
|
|
|
|
2016-03-16 14:14:00 +00:00
|
|
|
if( filter.Find( netname.MakeUpper() ) == EDA_PATTERN_NOT_FOUND )
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2018-06-04 05:55:03 +00:00
|
|
|
unsigned nodes = m_brd->GetNodesCount( netcode );
|
2017-03-22 13:51:07 +00:00
|
|
|
|
2018-06-04 05:55:03 +00:00
|
|
|
if( !m_cbShowZeroPad->IsChecked() && nodes == 0 )
|
2016-03-16 14:14:00 +00:00
|
|
|
continue;
|
|
|
|
|
2018-02-28 09:44:22 +00:00
|
|
|
wxVector<wxVariant> dataLine;
|
2016-03-16 14:14:00 +00:00
|
|
|
|
2018-09-05 11:59:20 +00:00
|
|
|
dataLine.push_back( wxVariant( wxString::Format( "%.3d", netcode ) ) );
|
2018-10-19 11:28:34 +00:00
|
|
|
dataLine.push_back( wxVariant( UnescapeString( net->GetNetname() ) ) );
|
2019-04-08 13:35:44 +00:00
|
|
|
m_netsInitialNames.Add( net->GetNetname() );
|
2016-03-16 14:14:00 +00:00
|
|
|
|
|
|
|
if( netcode )
|
2019-02-22 08:45:27 +00:00
|
|
|
{
|
2018-09-05 11:59:20 +00:00
|
|
|
dataLine.push_back( wxVariant( wxString::Format( "%u", nodes ) ) );
|
2019-02-22 08:45:27 +00:00
|
|
|
|
|
|
|
int lenPadToDie = 0;
|
|
|
|
int len = 0;
|
|
|
|
int viaCount = 0;
|
|
|
|
|
|
|
|
for( auto item : connectivity->GetNetItems( netcode, types ) )
|
|
|
|
{
|
|
|
|
|
|
|
|
if( item->Type() == PCB_PAD_T )
|
|
|
|
{
|
|
|
|
D_PAD *pad = dyn_cast<D_PAD*>( item );
|
|
|
|
lenPadToDie += pad->GetPadToDieLength();
|
|
|
|
}
|
|
|
|
else if( item->Type() == PCB_TRACE_T )
|
|
|
|
{
|
|
|
|
TRACK *track = dyn_cast<TRACK*>( item );
|
|
|
|
len += track->GetLength();
|
|
|
|
}
|
|
|
|
else if( item->Type() == PCB_VIA_T )
|
|
|
|
{
|
|
|
|
viaCount++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-15 08:10:51 +00:00
|
|
|
dataLine.push_back( wxVariant( wxString::Format( "%u", viaCount ) ) );
|
2019-04-14 22:13:46 +00:00
|
|
|
dataLine.push_back( wxVariant( MessageTextFromValue( units, len ) ) );
|
|
|
|
dataLine.push_back( wxVariant( MessageTextFromValue( units, lenPadToDie ) ) );
|
|
|
|
dataLine.push_back( wxVariant( MessageTextFromValue( units, len + lenPadToDie ) ) );
|
2019-02-22 08:45:27 +00:00
|
|
|
}
|
2016-03-16 14:14:00 +00:00
|
|
|
else // For the net 0 (unconnected pads), the pad count is not known
|
2019-02-22 08:45:27 +00:00
|
|
|
{
|
2019-04-15 08:10:51 +00:00
|
|
|
dataLine.push_back( wxVariant( "---" ) );
|
|
|
|
dataLine.push_back( wxVariant( "---" ) ); // vias
|
|
|
|
dataLine.push_back( wxVariant( "---" ) ); // board
|
|
|
|
dataLine.push_back( wxVariant( "---" ) ); // die
|
|
|
|
dataLine.push_back( wxVariant( "---" ) ); // length
|
2019-02-22 08:45:27 +00:00
|
|
|
}
|
|
|
|
|
2018-02-28 09:44:22 +00:00
|
|
|
m_netsList->AppendItem( dataLine );
|
2016-03-16 14:14:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_wasSelected = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-28 09:44:22 +00:00
|
|
|
void DIALOG_SELECT_NET_FROM_LIST::HighlightNet( const wxString& aNetName )
|
2018-02-15 14:35:29 +00:00
|
|
|
{
|
2018-02-28 09:44:22 +00:00
|
|
|
int netCode = -1;
|
|
|
|
|
|
|
|
if( !aNetName.IsEmpty() )
|
|
|
|
{
|
2019-04-15 08:10:51 +00:00
|
|
|
NETINFO_ITEM* net = m_brd->FindNet( aNetName );
|
2019-04-08 13:35:44 +00:00
|
|
|
|
|
|
|
if( net )
|
|
|
|
netCode = net->GetNet();
|
2018-02-28 09:44:22 +00:00
|
|
|
}
|
2018-02-15 14:35:29 +00:00
|
|
|
|
2019-06-13 17:28:55 +00:00
|
|
|
KIGFX::RENDER_SETTINGS* render = m_frame->GetCanvas()->GetView()->GetPainter()->GetSettings();
|
2019-05-27 16:16:54 +00:00
|
|
|
render->SetHighlight( netCode >= 0, netCode );
|
2018-02-15 14:35:29 +00:00
|
|
|
|
2019-06-13 17:28:55 +00:00
|
|
|
m_frame->GetCanvas()->GetView()->UpdateAllLayersColor();
|
|
|
|
m_frame->GetCanvas()->Refresh();
|
2018-02-15 14:35:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-03-16 14:14:00 +00:00
|
|
|
DIALOG_SELECT_NET_FROM_LIST::~DIALOG_SELECT_NET_FROM_LIST()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-02-15 14:35:29 +00:00
|
|
|
|
2016-03-16 14:14:00 +00:00
|
|
|
void DIALOG_SELECT_NET_FROM_LIST::onFilterChange( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
buildNetsList();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-28 09:44:22 +00:00
|
|
|
void DIALOG_SELECT_NET_FROM_LIST::onSelChanged( wxDataViewEvent& )
|
2018-05-17 23:42:27 +00:00
|
|
|
{
|
2018-02-28 09:44:22 +00:00
|
|
|
int selected_row = m_netsList->GetSelectedRow();
|
2018-05-17 23:42:27 +00:00
|
|
|
|
2018-02-28 09:44:22 +00:00
|
|
|
if( selected_row >= 0 )
|
|
|
|
{
|
2019-04-08 13:35:44 +00:00
|
|
|
// We no not use the displayed net name returnded by
|
|
|
|
// m_netsList->GetTextValue( selected_row, 1 ); because we need the initial escaped net name
|
|
|
|
m_selection = m_netsInitialNames[ selected_row ];
|
2018-02-28 09:44:22 +00:00
|
|
|
m_wasSelected = true;
|
2018-05-17 23:42:27 +00:00
|
|
|
|
2018-02-28 09:44:22 +00:00
|
|
|
HighlightNet( m_selection );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
HighlightNet( "" );
|
|
|
|
m_wasSelected = false;
|
|
|
|
}
|
2018-05-17 23:42:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-02-19 19:04:40 +00:00
|
|
|
void DIALOG_SELECT_NET_FROM_LIST::adjustListColumns()
|
2018-05-17 23:42:27 +00:00
|
|
|
{
|
2019-02-22 08:45:27 +00:00
|
|
|
int w0, w1, w2, w3, w4, w5, w6;
|
2018-09-25 09:31:17 +00:00
|
|
|
|
2019-02-19 19:04:40 +00:00
|
|
|
/**
|
|
|
|
* Calculating optimal width of the first (Net) and
|
|
|
|
* the last (Pad Count) columns. That width must be
|
|
|
|
* enough to fit column header label and be not less
|
|
|
|
* than width of four chars (0000).
|
|
|
|
*/
|
2018-09-25 09:31:17 +00:00
|
|
|
|
2019-02-19 19:04:40 +00:00
|
|
|
wxClientDC dc( GetParent() );
|
2019-04-15 08:10:51 +00:00
|
|
|
int h, minw, minw_col0;
|
2018-09-25 09:31:17 +00:00
|
|
|
|
2019-02-19 19:04:40 +00:00
|
|
|
dc.GetTextExtent( getListColumnHeaderNet()+"MM", &w0, &h );
|
|
|
|
dc.GetTextExtent( getListColumnHeaderCount()+"MM", &w2, &h );
|
2019-02-22 08:45:27 +00:00
|
|
|
dc.GetTextExtent( getListColumnHeaderVias()+"MM", &w3, &h );
|
|
|
|
dc.GetTextExtent( getListColumnHeaderBoard()+"MM", &w4, &h );
|
|
|
|
dc.GetTextExtent( getListColumnHeaderDie()+"MM", &w5, &h );
|
|
|
|
dc.GetTextExtent( getListColumnHeaderLength()+"MM", &w6, &h );
|
|
|
|
dc.GetTextExtent( "M00000,000 mmM", &minw, &h );
|
2019-04-15 08:10:51 +00:00
|
|
|
dc.GetTextExtent( "M00000M", &minw_col0, &h );
|
2018-09-25 09:31:17 +00:00
|
|
|
|
2019-02-19 19:04:40 +00:00
|
|
|
// Considering left and right margins.
|
|
|
|
// For wxRenderGeneric it is 5px.
|
2019-04-15 08:10:51 +00:00
|
|
|
w0 = std::max( w0+10, minw_col0);
|
2019-02-19 19:04:40 +00:00
|
|
|
w2 = std::max( w2+10, minw);
|
2019-02-22 08:45:27 +00:00
|
|
|
w3 = std::max( w3+10, minw);
|
|
|
|
w4 = std::max( w4+10, minw);
|
|
|
|
w5 = std::max( w5+10, minw);
|
|
|
|
w6 = std::max( w6+10, minw);
|
2018-09-25 09:31:17 +00:00
|
|
|
|
2019-02-19 19:04:40 +00:00
|
|
|
m_netsList->GetColumn( 0 )->SetWidth( w0 );
|
|
|
|
m_netsList->GetColumn( 2 )->SetWidth( w2 );
|
2019-02-22 08:45:27 +00:00
|
|
|
m_netsList->GetColumn( 3 )->SetWidth( w3 );
|
|
|
|
m_netsList->GetColumn( 4 )->SetWidth( w4 );
|
|
|
|
m_netsList->GetColumn( 5 )->SetWidth( w5 );
|
|
|
|
m_netsList->GetColumn( 6 )->SetWidth( w6 );
|
2018-05-17 23:42:27 +00:00
|
|
|
|
2019-02-19 19:04:40 +00:00
|
|
|
// At resizing of the list the width of middle column (Net Names) changes only.
|
|
|
|
int width = m_netsList->GetClientSize().x;
|
2019-02-22 08:45:27 +00:00
|
|
|
w1 = width - w0 - w2 - w3 - w4 - w5 - w6;
|
2018-05-17 23:42:27 +00:00
|
|
|
|
2019-04-15 08:10:51 +00:00
|
|
|
// Column 1 (net names) need a minimal width to display net names
|
|
|
|
dc.GetTextExtent( "MMMMMMMMMMMMMMMMMMMM", &minw, &h );
|
|
|
|
w1 = std::max( w1, minw );
|
|
|
|
|
2018-09-25 09:31:17 +00:00
|
|
|
m_netsList->GetColumn( 1 )->SetWidth( w1 );
|
2019-04-15 08:10:51 +00:00
|
|
|
|
|
|
|
m_netsList->Refresh();
|
2018-05-17 23:42:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-28 09:44:22 +00:00
|
|
|
void DIALOG_SELECT_NET_FROM_LIST::onListSize( wxSizeEvent& aEvent )
|
2016-03-16 14:14:00 +00:00
|
|
|
{
|
2019-02-19 19:04:40 +00:00
|
|
|
aEvent.Skip();
|
|
|
|
adjustListColumns();
|
2016-03-16 14:14:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool DIALOG_SELECT_NET_FROM_LIST::GetNetName( wxString& aName )
|
|
|
|
{
|
|
|
|
aName = m_selection;
|
|
|
|
return m_wasSelected;
|
|
|
|
}
|
2019-02-22 08:45:27 +00:00
|
|
|
|
|
|
|
|
2019-04-15 08:10:51 +00:00
|
|
|
void DIALOG_SELECT_NET_FROM_LIST::onReport( wxCommandEvent& aEvent )
|
2019-02-22 08:45:27 +00:00
|
|
|
{
|
2019-04-15 08:10:51 +00:00
|
|
|
wxFileDialog dlg( this, _( "Report file" ), "", "",
|
|
|
|
_( "Report file" ) + AddFileExtListToFilter( { "csv" } ),
|
|
|
|
wxFD_SAVE );
|
2019-04-14 22:13:46 +00:00
|
|
|
|
2019-04-15 08:10:51 +00:00
|
|
|
if( dlg.ShowModal() == wxID_CANCEL )
|
2019-04-14 22:13:46 +00:00
|
|
|
return;
|
|
|
|
|
2019-04-15 08:10:51 +00:00
|
|
|
wxTextFile f( dlg.GetPath() );
|
|
|
|
|
|
|
|
f.Create();
|
2019-04-14 22:13:46 +00:00
|
|
|
|
2019-04-15 08:10:51 +00:00
|
|
|
int rows = m_netsList->GetItemCount();
|
|
|
|
wxString txt;
|
2019-04-14 22:13:46 +00:00
|
|
|
|
2019-04-15 08:10:51 +00:00
|
|
|
// Print Header:
|
|
|
|
txt.Printf( "\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";",
|
|
|
|
_( "Net Id" ), _( "Net name" ),
|
|
|
|
_( "Pad count" ), _( "Via count" ),
|
|
|
|
_( "Board length" ), _( "Die length" ), _( "Net length" ) );
|
|
|
|
f.AddLine( txt );
|
2019-04-14 22:13:46 +00:00
|
|
|
|
2019-04-15 08:10:51 +00:00
|
|
|
// Print list of nets:
|
|
|
|
for( int row = 1; row < rows; row++ )
|
2019-04-14 22:13:46 +00:00
|
|
|
{
|
2019-04-15 08:10:51 +00:00
|
|
|
txt.Printf( "%s;\"%s\";%s;%s;%s;%s;%s;",
|
|
|
|
m_netsList->GetTextValue( row, 0 ), // net id
|
|
|
|
m_netsList->GetTextValue( row, 1 ), // net name
|
|
|
|
m_netsList->GetTextValue( row, 2 ), // Pad count
|
|
|
|
m_netsList->GetTextValue( row, 3 ), // Via count
|
|
|
|
m_netsList->GetTextValue( row, 4 ), // Board length
|
|
|
|
m_netsList->GetTextValue( row, 5 ), // Die length
|
|
|
|
m_netsList->GetTextValue( row, 6 ) ); // net length
|
|
|
|
|
|
|
|
f.AddLine( txt );
|
2019-04-14 22:13:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
f.Write();
|
|
|
|
f.Close();
|
2019-02-22 08:45:27 +00:00
|
|
|
}
|
|
|
|
|