2007-05-06 16:03:28 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: dialog_netlist.cpp
|
|
|
|
// Author: jean-pierre Charras
|
2009-04-24 07:36:36 +00:00
|
|
|
// Licence: GPL
|
2007-05-06 16:03:28 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2009-04-24 07:36:36 +00:00
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
|
|
|
#include "pcbnew.h"
|
2009-07-30 11:04:07 +00:00
|
|
|
#include "wxPcbStruct.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
#include "dialog_netlist.h"
|
|
|
|
|
2009-04-24 07:36:36 +00:00
|
|
|
extern void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* frame,
|
|
|
|
const wxString& NetlistFullFilename,
|
|
|
|
BOARD* Pcb );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-04-24 07:36:36 +00:00
|
|
|
void WinEDA_PcbFrame::InstallNetlistFrame( wxDC* DC, const wxPoint& pos )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2010-04-23 14:46:00 +00:00
|
|
|
/* Setup the netlist file name to the last net list file read or the board file
|
|
|
|
* name if no last file read is not set.
|
|
|
|
*/
|
|
|
|
wxFileName fn = GetLastNetListRead();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2010-04-23 14:46:00 +00:00
|
|
|
if( !fn.FileExists() )
|
|
|
|
{
|
2011-01-20 16:34:57 +00:00
|
|
|
fn = GetScreen()->GetFileName();
|
2010-04-23 14:46:00 +00:00
|
|
|
fn.SetExt( NetExtBuffer );
|
|
|
|
}
|
2008-03-22 18:08:44 +00:00
|
|
|
|
2009-04-24 07:36:36 +00:00
|
|
|
DIALOG_NETLIST frame( this, DC, fn.GetFullPath() );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-04-24 07:36:36 +00:00
|
|
|
frame.ShowModal();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2008-03-22 18:08:44 +00:00
|
|
|
|
2010-04-23 14:46:00 +00:00
|
|
|
DIALOG_NETLIST::DIALOG_NETLIST( WinEDA_PcbFrame* aParent, wxDC * aDC,
|
|
|
|
const wxString & aNetlistFull_Filename )
|
|
|
|
: DIALOG_NETLIST_FBP( aParent )
|
2008-03-22 18:08:44 +00:00
|
|
|
{
|
2009-04-24 07:36:36 +00:00
|
|
|
m_Parent = aParent;
|
|
|
|
m_DC = aDC;
|
2010-04-23 14:46:00 +00:00
|
|
|
m_NetlistFilenameCtrl->SetValue( aNetlistFull_Filename );
|
2008-03-22 18:08:44 +00:00
|
|
|
|
2009-04-24 07:36:36 +00:00
|
|
|
Init();
|
2008-03-22 18:08:44 +00:00
|
|
|
|
2009-04-24 07:36:36 +00:00
|
|
|
if( GetSizer() )
|
|
|
|
GetSizer()->SetSizeHints( this );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2008-03-22 18:08:44 +00:00
|
|
|
|
2009-04-24 07:36:36 +00:00
|
|
|
void DIALOG_NETLIST::Init()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-04-24 07:36:36 +00:00
|
|
|
SetFocus();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2009-04-24 07:36:36 +00:00
|
|
|
void DIALOG_NETLIST::OnOpenNelistClick( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2010-04-23 14:46:00 +00:00
|
|
|
wxString lastPath = wxFileName::GetCwd();
|
|
|
|
wxString lastNetlistRead = m_Parent->GetLastNetListRead();
|
|
|
|
|
|
|
|
if( !lastNetlistRead.IsEmpty() && !wxFileName::FileExists( lastNetlistRead ) )
|
|
|
|
{
|
|
|
|
lastNetlistRead = wxEmptyString;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wxFileName fn = lastNetlistRead;
|
|
|
|
lastPath = fn.GetPath();
|
2010-04-24 09:03:35 +00:00
|
|
|
lastNetlistRead = fn.GetFullName();
|
2010-04-23 14:46:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
wxLogDebug( wxT( "Last net list read path <%s>, file name <%s>." ),
|
|
|
|
GetChars( lastPath ), GetChars( lastNetlistRead ) );
|
|
|
|
|
|
|
|
wxFileDialog FilesDialog( this, _( "Select Netlist" ), lastPath, lastNetlistRead,
|
|
|
|
NetlistFileWildcard, wxFD_DEFAULT_STYLE | wxFD_FILE_MUST_EXIST );
|
2008-03-22 18:08:44 +00:00
|
|
|
|
2009-04-24 07:36:36 +00:00
|
|
|
if( FilesDialog.ShowModal() != wxID_OK )
|
|
|
|
return;
|
2008-03-22 18:08:44 +00:00
|
|
|
|
2010-04-23 14:46:00 +00:00
|
|
|
m_NetlistFilenameCtrl->SetValue( FilesDialog.GetPath() );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-03-22 18:08:44 +00:00
|
|
|
|
2009-04-24 07:36:36 +00:00
|
|
|
void DIALOG_NETLIST::OnReadNetlistFileClick( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
wxFileName fn = m_NetlistFilenameCtrl->GetValue();
|
|
|
|
fn.SetExt( NetCmpExtBuffer );
|
2008-03-22 18:08:44 +00:00
|
|
|
|
2010-04-16 16:28:35 +00:00
|
|
|
m_Parent->ReadPcbNetlist( m_NetlistFilenameCtrl->GetValue(),
|
2010-04-23 14:46:00 +00:00
|
|
|
fn.GetFullPath(), m_MessageWindow,
|
|
|
|
m_ChangeExistingFootprintCtrl->GetSelection() == 1 ? TRUE : FALSE,
|
|
|
|
m_DeleteBadTracks->GetSelection() == 1 ? TRUE : FALSE,
|
|
|
|
m_RemoveExtraFootprintsCtrl->GetSelection() == 1 ? TRUE : FALSE,
|
|
|
|
m_Select_By_Timestamp->GetSelection() == 1 ? TRUE : FALSE );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-03-22 18:08:44 +00:00
|
|
|
|
2009-04-24 07:36:36 +00:00
|
|
|
void DIALOG_NETLIST::OnTestFootprintsClick( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-04-23 14:46:00 +00:00
|
|
|
TestFor_Duplicate_Missing_And_Extra_Footprints( this, m_NetlistFilenameCtrl->GetValue(),
|
|
|
|
m_Parent->GetBoard() );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-03-22 18:08:44 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*!
|
|
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_COMPILE_RATSNEST
|
|
|
|
*/
|
|
|
|
|
2009-04-24 07:36:36 +00:00
|
|
|
void DIALOG_NETLIST::OnCompileRatsnestClick( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-03-22 18:08:44 +00:00
|
|
|
m_Parent->Compile_Ratsnest( m_DC, TRUE );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-03-22 18:08:44 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*!
|
2007-11-13 09:35:39 +00:00
|
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
|
2007-06-05 12:10:51 +00:00
|
|
|
*/
|
|
|
|
|
2009-04-24 07:36:36 +00:00
|
|
|
void DIALOG_NETLIST::OnCancelClick( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-11-13 09:35:39 +00:00
|
|
|
EndModal( -1 );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|