2007-11-05 06:14:55 +00:00
|
|
|
/**********************************/
|
|
|
|
/* Dialog box for netlist outputs */
|
|
|
|
/**********************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
/* Functions relatives to the dialog creating the netlist for pcbnew.
|
|
|
|
* The dialo is a notebook with 4 fixed netlist format:
|
|
|
|
* PCBNEW ORCADPCB2 CADSTAR and SPICE
|
|
|
|
* and up to CUSTOMPANEL_COUNTMAX (see netlist.h) user programmable format
|
|
|
|
* calling an external converter with convert an intermediate format to the
|
|
|
|
* user specific format.
|
|
|
|
* these external converters are refered there as plugins,
|
|
|
|
* but there are not really plugins, there are only external binaries
|
|
|
|
*/
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "fctsys.h"
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include "program.h"
|
|
|
|
#include "libcmp.h"
|
|
|
|
#include "general.h"
|
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
#include "netlist.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "protos.h"
|
|
|
|
|
2008-02-27 19:38:16 +00:00
|
|
|
#include "schframe.h"
|
|
|
|
#include "netlist_control.h"
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
// ID for configuration:
|
2007-11-10 14:35:04 +00:00
|
|
|
#define CUSTOM_NETLIST_TITLE wxT( "CustomNetlistTitle" )
|
|
|
|
#define CUSTOM_NETLIST_COMMAND wxT( "CustomNetlistCommand" )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
/* Loacl variable */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
/****************************************************/
|
|
|
|
wxString ReturnUserNetlistTypeName( bool first_item )
|
|
|
|
/****************************************************/
|
|
|
|
|
|
|
|
/** Function ReturnUserNetlistTypeName
|
|
|
|
* to retrieve user netlist type names
|
|
|
|
* @param first = true: return first name of the list, false = return next
|
|
|
|
* @return a wxString : name of the type netlist or empty string
|
|
|
|
* this function must be called first with "first_item" = true
|
|
|
|
* and after with "first_item" = false to get all the other existing netlist names
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
static int index;
|
|
|
|
wxString name, msg;
|
|
|
|
|
|
|
|
if( first_item )
|
|
|
|
index = 0;
|
|
|
|
else
|
|
|
|
index++;
|
|
|
|
|
|
|
|
msg = CUSTOM_NETLIST_TITLE;
|
|
|
|
msg << index + 1;
|
|
|
|
|
|
|
|
if( g_EDA_Appl->m_EDA_Config )
|
|
|
|
name = g_EDA_Appl->m_EDA_Config->Read( msg );
|
|
|
|
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE( WinEDA_NetlistFrame, wxDialog )
|
|
|
|
EVT_BUTTON( wxID_CANCEL, WinEDA_NetlistFrame::OnCancelClick )
|
|
|
|
EVT_BUTTON( ID_CREATE_NETLIST, WinEDA_NetlistFrame::GenNetlist )
|
|
|
|
EVT_BUTTON( ID_SETUP_PLUGIN, WinEDA_NetlistFrame::SetupPluginData )
|
|
|
|
EVT_BUTTON( ID_DELETE_PLUGIN, WinEDA_NetlistFrame::DeletePluginPanel )
|
|
|
|
EVT_BUTTON( ID_VALIDATE_PLUGIN, WinEDA_NetlistFrame::ValidatePluginPanel )
|
|
|
|
EVT_CHECKBOX( ID_CURRENT_FORMAT_IS_DEFAULT, WinEDA_NetlistFrame::SelectNetlistType )
|
|
|
|
EVT_BUTTON( ID_RUN_SIMULATOR, WinEDA_NetlistFrame::RunSimulator )
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************/
|
|
|
|
/* Functions for these classes */
|
|
|
|
/*******************************/
|
|
|
|
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*****************************************************************************/
|
2007-11-10 14:35:04 +00:00
|
|
|
EDA_NoteBookPage::EDA_NoteBookPage( wxNotebook* parent, const wxString& title,
|
|
|
|
int id_NetType, int idCheckBox, int idCreateFile ) :
|
|
|
|
wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxBORDER_SUNKEN )
|
2007-06-05 12:10:51 +00:00
|
|
|
/*****************************************************************************/
|
2007-11-10 14:35:04 +00:00
|
|
|
|
|
|
|
/** Contructor to create a setup page for one netlist format.
|
2007-11-05 06:14:55 +00:00
|
|
|
* Used in Netlist format Dialog box creation
|
2007-11-10 14:35:04 +00:00
|
|
|
* @param parent = wxNotebook * parent
|
|
|
|
* @param title = title (name) of the notebook page
|
|
|
|
* @param id_NetType = netlist type id
|
|
|
|
* @param idCheckBox = event ID attached to the "format is default" check box
|
|
|
|
* @param idCreateFile = event ID attached to the "create netlist" button
|
2007-11-05 06:14:55 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-11-10 14:35:04 +00:00
|
|
|
SetFont( *g_DialogFont );
|
2007-11-05 06:14:55 +00:00
|
|
|
m_IdNetType = id_NetType;
|
|
|
|
m_CommandStringCtrl = NULL;
|
2007-11-10 14:35:04 +00:00
|
|
|
m_TitleStringCtrl = NULL;
|
|
|
|
m_IsCurrentFormat = NULL;
|
2007-11-05 06:14:55 +00:00
|
|
|
m_ButtonCancel = NULL;
|
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
parent->AddPage( this, title, g_NetFormat == m_IdNetType );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxVERTICAL );
|
|
|
|
SetSizer( MainBoxSizer );
|
|
|
|
wxBoxSizer* UpperBoxSizer = new wxBoxSizer( wxHORIZONTAL );
|
|
|
|
m_LowBoxSizer = new wxBoxSizer( wxVERTICAL );
|
|
|
|
MainBoxSizer->Add( UpperBoxSizer, 0, wxGROW | wxALL, 5 );
|
|
|
|
MainBoxSizer->Add( m_LowBoxSizer, 0, wxGROW | wxALL, 5 );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
m_LeftBoxSizer = new wxBoxSizer( wxVERTICAL );
|
|
|
|
m_RightBoxSizer = new wxBoxSizer( wxVERTICAL );
|
|
|
|
m_RightOptionsBoxSizer = new wxBoxSizer( wxVERTICAL );
|
|
|
|
UpperBoxSizer->Add( m_LeftBoxSizer, 0, wxGROW | wxALL, 5 );
|
|
|
|
UpperBoxSizer->Add( m_RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
|
|
|
UpperBoxSizer->Add( m_RightOptionsBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
|
|
|
if( idCheckBox )
|
|
|
|
{
|
2007-11-10 14:35:04 +00:00
|
|
|
wxStaticText* text = new wxStaticText( this, -1, _( "Options:" ) );
|
|
|
|
m_LeftBoxSizer->Add( text, 0, wxGROW | wxALL, 5 );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
m_IsCurrentFormat = new wxCheckBox( this, idCheckBox, _( "Default format" ) );
|
|
|
|
m_LeftBoxSizer->Add( m_IsCurrentFormat, 0, wxGROW | wxALL, 5 );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
|
|
|
if( g_NetFormat == m_IdNetType )
|
2007-11-10 14:35:04 +00:00
|
|
|
m_IsCurrentFormat->SetValue( TRUE );
|
2007-11-05 06:14:55 +00:00
|
|
|
}
|
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
/* Create the buttons: Create Neltist or browse Plugin and Cancel
|
|
|
|
* and a third button for plugins : Remove or Ok button */
|
|
|
|
if( idCreateFile )
|
2007-11-05 06:14:55 +00:00
|
|
|
{
|
2007-11-10 14:35:04 +00:00
|
|
|
wxButton* Button;
|
|
|
|
if( idCreateFile == ID_SETUP_PLUGIN ) /* This is the "add plugin" panel */
|
|
|
|
Button = new wxButton( this, idCreateFile, _( "&Browse Plugin" ) );
|
2007-11-05 06:14:55 +00:00
|
|
|
else
|
2007-11-10 14:35:04 +00:00
|
|
|
Button = new wxButton( this, idCreateFile, _( "&Netlist" ) );
|
|
|
|
Button->SetForegroundColour( *wxRED );
|
|
|
|
m_RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
|
|
|
m_ButtonCancel =
|
2007-11-10 14:35:04 +00:00
|
|
|
Button = new wxButton( this, wxID_CANCEL, _( "&Cancel" ) );
|
|
|
|
Button->SetForegroundColour( *wxBLUE );
|
|
|
|
m_RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
|
|
|
|
|
|
|
|
/* Add special buttons to plugin panels:
|
|
|
|
* for panel plugins: added the "delete" button
|
|
|
|
* for the last panel (add plugin) a Ok button is added
|
|
|
|
*/
|
|
|
|
if( idCreateFile == ID_SETUP_PLUGIN ) /* This is the "add plugin" panel: add Ok button */
|
|
|
|
{
|
|
|
|
Button = new wxButton( this, ID_VALIDATE_PLUGIN, _( "&Ok" ) );
|
|
|
|
m_RightOptionsBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
|
|
|
|
}
|
|
|
|
else if( id_NetType >= PANELCUSTOMBASE ) /* This is a plugin panel: add delete button */
|
|
|
|
{
|
|
|
|
Button = new wxButton( this, ID_DELETE_PLUGIN, _( "&Delete" ) );
|
|
|
|
m_RightOptionsBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
|
|
|
|
}
|
2007-11-05 06:14:55 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*************************************************************************************/
|
2008-02-27 19:38:16 +00:00
|
|
|
WinEDA_NetlistFrame::WinEDA_NetlistFrame( WinEDA_SchematicFrame* parent ) :
|
|
|
|
wxDialog( parent, -1, _( "Netlist" ), wxDefaultPosition,
|
2007-11-10 14:35:04 +00:00
|
|
|
wxDefaultSize, DIALOG_STYLE | MAYBE_RESIZE_BORDER )
|
2007-06-05 12:10:51 +00:00
|
|
|
/*************************************************************************************/
|
2007-11-10 14:35:04 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* Constructor for the netlist generation dialog box
|
2007-11-05 06:14:55 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-11-10 14:35:04 +00:00
|
|
|
int ii;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
m_Parent = parent;
|
2007-11-10 14:35:04 +00:00
|
|
|
SetFont( *g_DialogFont );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
for( ii = 0; ii < PANELCUSTOMBASE + CUSTOMPANEL_COUNTMAX; ii++ )
|
2007-11-05 06:14:55 +00:00
|
|
|
{
|
|
|
|
m_PanelNetType[ii] = NULL;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-02-27 19:38:16 +00:00
|
|
|
Centre();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
wxBoxSizer* GeneralBoxSizer = new wxBoxSizer( wxVERTICAL );
|
|
|
|
SetSizer( GeneralBoxSizer );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
m_NoteBook = new wxNotebook( this, ID_NETLIST_NOTEBOOK,
|
2007-11-10 14:35:04 +00:00
|
|
|
wxDefaultPosition, wxDefaultSize );
|
|
|
|
m_NoteBook->SetFont( *g_DialogFont );
|
|
|
|
GeneralBoxSizer->Add( m_NoteBook, 0, wxGROW | wxALL, 5 );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
// Add notebook pages:
|
2007-11-05 06:14:55 +00:00
|
|
|
|
|
|
|
// Add Panel FORMAT PCBNEW
|
2007-11-10 14:35:04 +00:00
|
|
|
m_PanelNetType[PANELPCBNEW] = new EDA_NoteBookPage( m_NoteBook, wxT(
|
|
|
|
"Pcbnew" ), NET_TYPE_PCBNEW,
|
|
|
|
ID_CURRENT_FORMAT_IS_DEFAULT,
|
|
|
|
ID_CREATE_NETLIST );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
|
|
|
// Add Panel FORMAT ORCADPCB2
|
2007-11-10 14:35:04 +00:00
|
|
|
m_PanelNetType[PANELORCADPCB2] = new EDA_NoteBookPage( m_NoteBook, wxT(
|
|
|
|
"OrcadPCB2" ), NET_TYPE_ORCADPCB2,
|
|
|
|
ID_CURRENT_FORMAT_IS_DEFAULT,
|
|
|
|
ID_CREATE_NETLIST );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
|
|
|
// Add Panel FORMAT CADSTAR
|
2007-11-10 14:35:04 +00:00
|
|
|
m_PanelNetType[PANELCADSTAR] = new EDA_NoteBookPage( m_NoteBook, wxT(
|
|
|
|
"CadStar" ), NET_TYPE_CADSTAR,
|
|
|
|
ID_CURRENT_FORMAT_IS_DEFAULT,
|
|
|
|
ID_CREATE_NETLIST );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
// Add Panel spice
|
|
|
|
InstallPageSpice();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
// Add custom panels:
|
|
|
|
InstallCustomPages();
|
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
GetSizer()->Fit( this );
|
|
|
|
GetSizer()->SetSizeHints( this );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************/
|
2007-09-13 11:55:46 +00:00
|
|
|
void WinEDA_NetlistFrame::InstallPageSpice()
|
2007-06-05 12:10:51 +00:00
|
|
|
/*************************************************/
|
2007-11-10 14:35:04 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* Create the spice page
|
2007-11-05 06:14:55 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-11-10 14:35:04 +00:00
|
|
|
wxButton* Button;
|
|
|
|
EDA_NoteBookPage* page;
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
page = m_PanelNetType[PANELSPICE] = new EDA_NoteBookPage( m_NoteBook, wxT(
|
|
|
|
"Spice" ), NET_TYPE_SPICE, 0, 0 );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
page->m_IsCurrentFormat = new wxCheckBox( page, ID_CURRENT_FORMAT_IS_DEFAULT,
|
|
|
|
_( "Default format" ) );
|
2007-11-05 06:14:55 +00:00
|
|
|
page->m_IsCurrentFormat->SetValue( g_NetFormat == NET_TYPE_SPICE );
|
2007-11-10 14:35:04 +00:00
|
|
|
page->m_LeftBoxSizer->Add( page->m_IsCurrentFormat, 0, wxGROW | wxALL, 5 );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
wxString netlist_opt[2] = { _( "Use Net Names" ), _( "Use Net Numbers" ) };
|
|
|
|
m_UseNetNamesInNetlist = new wxRadioBox( page, -1, _( "Netlist Options:" ),
|
|
|
|
wxDefaultPosition, wxDefaultSize,
|
|
|
|
2, netlist_opt, 1, wxRA_SPECIFY_COLS );
|
|
|
|
if( !g_OptNetListUseNames )
|
|
|
|
m_UseNetNamesInNetlist->SetSelection( 1 );
|
|
|
|
page->m_LeftBoxSizer->Add( m_UseNetNamesInNetlist, 0, wxGROW | wxALL, 5 );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
|
|
|
page->m_CommandStringCtrl = new WinEDA_EnterText( page,
|
2007-11-10 14:35:04 +00:00
|
|
|
_(
|
|
|
|
"Simulator command:" ),
|
|
|
|
g_SimulatorCommandLine,
|
|
|
|
page->m_LowBoxSizer, wxDefaultSize );
|
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
// Add buttons
|
2007-11-10 14:35:04 +00:00
|
|
|
Button = new wxButton( page, ID_CREATE_NETLIST, _( "Netlist" ) );
|
|
|
|
Button->SetForegroundColour( *wxRED );
|
|
|
|
page->m_RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
Button = new wxButton( page, ID_RUN_SIMULATOR, _( "&Run Simulator" ) );
|
|
|
|
Button->SetForegroundColour( wxColour( 0, 100, 0 ) );
|
|
|
|
page->m_RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
Button = new wxButton( page, wxID_CANCEL, _( "&Cancel" ) );
|
|
|
|
Button->SetForegroundColour( *wxBLUE );
|
|
|
|
page->m_RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*************************************************/
|
2007-09-13 11:55:46 +00:00
|
|
|
void WinEDA_NetlistFrame::InstallCustomPages()
|
2007-06-05 12:10:51 +00:00
|
|
|
/*************************************************/
|
2007-11-10 14:35:04 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* create the pages for custom netlist format selection:
|
2007-11-05 06:14:55 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-11-10 14:35:04 +00:00
|
|
|
int ii, CustomCount;
|
|
|
|
wxString title, previoustitle, msg;
|
|
|
|
EDA_NoteBookPage* CurrPage;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
CustomCount = CUSTOMPANEL_COUNTMAX;
|
|
|
|
previoustitle = wxT( "dummy_title" );
|
2007-11-05 06:14:55 +00:00
|
|
|
for( ii = 0; ii < CustomCount; ii++ )
|
|
|
|
{
|
2007-11-10 14:35:04 +00:00
|
|
|
title = ReturnUserNetlistTypeName( ii == 0 ? true : false );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
|
|
|
if( title.IsEmpty() && previoustitle.IsEmpty() )
|
2007-11-10 14:35:04 +00:00
|
|
|
break; // No more panel to install
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
/* Install the panel "Add Plugin" after
|
|
|
|
* the last initialised panel */
|
2007-11-05 06:14:55 +00:00
|
|
|
previoustitle = title;
|
|
|
|
if( title.IsEmpty() )
|
2007-11-10 14:35:04 +00:00
|
|
|
CurrPage =
|
|
|
|
m_PanelNetType[PANELCUSTOMBASE + ii] =
|
|
|
|
new EDA_NoteBookPage( m_NoteBook, _( "Add Plugin" ),
|
|
|
|
NET_TYPE_CUSTOM1 + ii,
|
|
|
|
ID_CURRENT_FORMAT_IS_DEFAULT, ID_SETUP_PLUGIN );
|
|
|
|
else /* Install a plugin panel */
|
|
|
|
CurrPage =
|
|
|
|
m_PanelNetType[PANELCUSTOMBASE + ii] =
|
|
|
|
new EDA_NoteBookPage( m_NoteBook, title,
|
|
|
|
NET_TYPE_CUSTOM1 + ii,
|
|
|
|
ID_CURRENT_FORMAT_IS_DEFAULT, ID_CREATE_NETLIST );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
|
|
|
msg = CUSTOM_NETLIST_COMMAND;
|
|
|
|
msg << ii + 1;
|
2007-11-10 14:35:04 +00:00
|
|
|
wxString Command = m_Parent->m_Parent->m_EDA_Config->Read( msg );
|
|
|
|
CurrPage->m_CommandStringCtrl =
|
|
|
|
new WinEDA_EnterText( CurrPage,
|
|
|
|
_( "Netlist command:" ), Command,
|
|
|
|
CurrPage->m_LowBoxSizer,
|
|
|
|
wxDefaultSize );
|
|
|
|
|
|
|
|
CurrPage->m_TitleStringCtrl =
|
|
|
|
new WinEDA_EnterText( CurrPage,
|
|
|
|
_( "Title:" ), title,
|
|
|
|
CurrPage->m_LowBoxSizer,
|
|
|
|
wxDefaultSize );
|
2007-11-05 06:14:55 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************/
|
2007-11-10 14:35:04 +00:00
|
|
|
void WinEDA_NetlistFrame::SetupPluginData( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
/***********************************************************/
|
2007-11-10 14:35:04 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* Browse the plugin files and set the m_CommandStringCtrl field
|
2007-11-05 06:14:55 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-11-10 14:35:04 +00:00
|
|
|
wxString FullFileName, Mask, Path;
|
|
|
|
|
|
|
|
Mask = wxT( "*" );
|
|
|
|
Path = g_EDA_Appl->m_BinDir;
|
|
|
|
FullFileName = EDA_FileSelector( _( "Plugin files:" ),
|
|
|
|
Path, /* Chemin par defaut */
|
|
|
|
FullFileName, /* nom fichier par defaut */
|
|
|
|
wxEmptyString, /* extension par defaut */
|
|
|
|
Mask, /* Masque d'affichage */
|
|
|
|
this,
|
|
|
|
wxFD_OPEN,
|
|
|
|
TRUE
|
|
|
|
);
|
2007-11-05 06:14:55 +00:00
|
|
|
if( FullFileName.IsEmpty() )
|
|
|
|
return;
|
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
EDA_NoteBookPage* CurrPage;
|
|
|
|
CurrPage = (EDA_NoteBookPage*) m_NoteBook->GetCurrentPage();
|
2007-11-05 06:14:55 +00:00
|
|
|
if( CurrPage == NULL )
|
|
|
|
return;
|
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
CurrPage->m_CommandStringCtrl->SetValue( FullFileName );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
|
|
|
/* Get a title for this page */
|
|
|
|
wxString title = CurrPage->m_TitleStringCtrl->GetValue();
|
|
|
|
if( title.IsEmpty() )
|
2007-11-10 14:35:04 +00:00
|
|
|
DisplayInfo( this,
|
|
|
|
_(
|
2007-11-10 15:02:33 +00:00
|
|
|
"Do not forget to choose a title for this netlist control page" ) );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************/
|
2007-11-10 14:35:04 +00:00
|
|
|
void WinEDA_NetlistFrame::SelectNetlistType( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
/*****************************************************************/
|
2007-11-10 15:02:33 +00:00
|
|
|
/* Called when the check box "default format" is clicked
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-11-10 14:35:04 +00:00
|
|
|
int ii;
|
|
|
|
EDA_NoteBookPage* CurrPage;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
for( ii = 0; ii < PANELCUSTOMBASE + CUSTOMPANEL_COUNTMAX; ii++ )
|
|
|
|
if( m_PanelNetType[ii] )
|
2007-11-10 14:35:04 +00:00
|
|
|
m_PanelNetType[ii]->m_IsCurrentFormat->SetValue( FALSE );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
CurrPage = (EDA_NoteBookPage*) m_NoteBook->GetCurrentPage();
|
2007-11-05 06:14:55 +00:00
|
|
|
if( CurrPage == NULL )
|
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
g_NetFormat = CurrPage->m_IdNetType;
|
2007-11-10 14:35:04 +00:00
|
|
|
CurrPage->m_IsCurrentFormat->SetValue( TRUE );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/***********************************************/
|
2007-09-13 11:55:46 +00:00
|
|
|
void WinEDA_NetlistFrame::NetlistUpdateOpt()
|
2007-06-05 12:10:51 +00:00
|
|
|
/***********************************************/
|
|
|
|
{
|
2007-11-10 14:35:04 +00:00
|
|
|
int ii;
|
2007-11-05 06:14:55 +00:00
|
|
|
|
|
|
|
g_SimulatorCommandLine =
|
|
|
|
m_PanelNetType[PANELSPICE]->m_CommandStringCtrl->GetValue();
|
|
|
|
g_NetFormat = NET_TYPE_PCBNEW;
|
|
|
|
|
|
|
|
for( ii = 0; ii < PANELCUSTOMBASE + CUSTOMPANEL_COUNTMAX; ii++ )
|
|
|
|
{
|
|
|
|
if( m_PanelNetType[ii] == NULL )
|
|
|
|
break;
|
|
|
|
if( m_PanelNetType[ii]->m_IsCurrentFormat->GetValue() == TRUE )
|
|
|
|
g_NetFormat = m_PanelNetType[ii]->m_IdNetType;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_OptNetListUseNames = TRUE; // Used for pspice, gnucap
|
|
|
|
if( m_UseNetNamesInNetlist->GetSelection() == 1 )
|
|
|
|
g_OptNetListUseNames = FALSE;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/**********************************************************/
|
2007-11-10 14:35:04 +00:00
|
|
|
void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
/**********************************************************/
|
2007-11-10 14:35:04 +00:00
|
|
|
|
|
|
|
/** Function GenNetlist
|
|
|
|
* Create the netlist file:
|
|
|
|
* calcualte the filename with the suitable extentions
|
|
|
|
* and run the netlist creator
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-11-10 14:35:04 +00:00
|
|
|
wxString FullFileName, FileExt, Mask;
|
|
|
|
wxString msg, Command;
|
|
|
|
int netformat_tmp = g_NetFormat;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
NetlistUpdateOpt();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
EDA_NoteBookPage* CurrPage;
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
CurrPage = (EDA_NoteBookPage*) m_NoteBook->GetCurrentPage();
|
2007-11-05 06:14:55 +00:00
|
|
|
g_NetFormat = CurrPage->m_IdNetType;
|
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
/* Calculate the netlist filename */
|
2008-02-26 19:19:54 +00:00
|
|
|
FullFileName = g_RootSheet->m_AssociatedScreen->m_FileName;
|
2007-11-05 06:14:55 +00:00
|
|
|
|
|
|
|
switch( g_NetFormat )
|
|
|
|
{
|
|
|
|
case NET_TYPE_SPICE:
|
2007-11-10 14:35:04 +00:00
|
|
|
FileExt = wxT( ".cir" );
|
2007-11-05 06:14:55 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NET_TYPE_CADSTAR:
|
2007-11-10 14:35:04 +00:00
|
|
|
FileExt = wxT( ".frp" );
|
2007-11-05 06:14:55 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
FileExt = g_NetExtBuffer;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
Mask = wxT( "*" ) + FileExt + wxT( "*" );
|
|
|
|
ChangeFileNameExt( FullFileName, FileExt );
|
2008-02-12 21:12:46 +00:00
|
|
|
FullFileName = FullFileName.AfterLast('/');
|
2007-11-10 14:35:04 +00:00
|
|
|
FullFileName = EDA_FileSelector( _( "Netlist files:" ),
|
|
|
|
wxEmptyString, /* Defaut path */
|
|
|
|
FullFileName, /* Defaut filename */
|
|
|
|
FileExt, /* Defaut extension */
|
|
|
|
Mask, /* Mask for filename selection */
|
|
|
|
this,
|
|
|
|
wxFD_SAVE,
|
|
|
|
TRUE
|
|
|
|
);
|
2007-11-05 06:14:55 +00:00
|
|
|
if( FullFileName.IsEmpty() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
m_Parent->MsgPanel->EraseMsgBox();
|
|
|
|
|
|
|
|
ReAnnotatePowerSymbolsOnly();
|
2007-11-10 14:35:04 +00:00
|
|
|
if( CheckAnnotate( m_Parent, 0 ) )
|
2007-11-05 06:14:55 +00:00
|
|
|
{
|
2007-11-10 14:35:04 +00:00
|
|
|
if( !IsOK( this, _( "Must be Annotated, Continue ?" ) ) )
|
2007-11-05 06:14:55 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Cleanup the entire hierarchy */
|
2008-02-12 21:12:46 +00:00
|
|
|
EDA_ScreenList ScreenList;
|
2007-11-10 14:35:04 +00:00
|
|
|
for( SCH_SCREEN* screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
|
2007-11-05 06:14:55 +00:00
|
|
|
{
|
|
|
|
bool ModifyWires;
|
2007-11-10 14:35:04 +00:00
|
|
|
ModifyWires = screen->SchematicCleanUp( NULL );
|
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
// if wire list has changed, delete the Undo Redo list to avoid
|
|
|
|
// pointer problems with deleted data
|
|
|
|
if( ModifyWires )
|
|
|
|
screen->ClearUndoRedoList();
|
|
|
|
}
|
|
|
|
|
|
|
|
m_Parent->BuildNetListBase();
|
|
|
|
if( CurrPage->m_CommandStringCtrl )
|
|
|
|
g_NetListerCommandLine = CurrPage->m_CommandStringCtrl->GetValue();
|
|
|
|
else
|
|
|
|
g_NetListerCommandLine.Empty();
|
|
|
|
|
|
|
|
switch( g_NetFormat )
|
|
|
|
{
|
|
|
|
default:
|
2007-11-10 14:35:04 +00:00
|
|
|
WriteNetList( m_Parent, FullFileName, TRUE );
|
2007-11-05 06:14:55 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NET_TYPE_CADSTAR:
|
|
|
|
case NET_TYPE_ORCADPCB2:
|
2007-11-10 14:35:04 +00:00
|
|
|
WriteNetList( m_Parent, FullFileName, FALSE );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
|
|
|
case NET_TYPE_SPICE:
|
|
|
|
g_OptNetListUseNames = TRUE; // Used for pspice, gnucap
|
|
|
|
if( m_UseNetNamesInNetlist->GetSelection() == 1 )
|
|
|
|
g_OptNetListUseNames = FALSE;
|
2007-11-10 14:35:04 +00:00
|
|
|
WriteNetList( m_Parent, FullFileName, g_OptNetListUseNames );
|
2007-11-05 06:14:55 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-11-10 14:35:04 +00:00
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
FreeTabNetList( g_TabObjNet, g_NbrObjNet );
|
|
|
|
g_NetFormat = netformat_tmp;
|
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
WriteCurrentNetlistSetup();
|
|
|
|
|
|
|
|
EndModal( NET_OK );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************/
|
|
|
|
void WinEDA_NetlistFrame::OnCancelClick( wxCommandEvent& event )
|
|
|
|
/***********************************************************/
|
|
|
|
{
|
|
|
|
EndModal( NET_ABORT );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************/
|
|
|
|
void WinEDA_NetlistFrame::RunSimulator( wxCommandEvent& event )
|
|
|
|
/***********************************************************/
|
|
|
|
{
|
|
|
|
wxString NetlistFullFileName, ExecFile, CommandLine;
|
|
|
|
|
|
|
|
g_SimulatorCommandLine =
|
|
|
|
m_PanelNetType[PANELSPICE]->m_CommandStringCtrl->GetValue();
|
|
|
|
g_SimulatorCommandLine.Trim( FALSE );
|
|
|
|
g_SimulatorCommandLine.Trim( TRUE );
|
|
|
|
ExecFile = g_SimulatorCommandLine.BeforeFirst( ' ' );
|
|
|
|
|
|
|
|
CommandLine = g_SimulatorCommandLine.AfterFirst( ' ' );
|
|
|
|
|
|
|
|
/* Calculate the netlist filename */
|
2008-02-26 19:19:54 +00:00
|
|
|
NetlistFullFileName = g_RootSheet->m_AssociatedScreen->m_FileName;
|
2007-11-10 14:35:04 +00:00
|
|
|
ChangeFileNameExt( NetlistFullFileName, wxT( ".cir" ) );
|
|
|
|
AddDelimiterString( NetlistFullFileName );
|
|
|
|
CommandLine += wxT( " " ) + NetlistFullFileName;
|
|
|
|
|
|
|
|
ExecuteFile( this, ExecFile, CommandLine );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************/
|
|
|
|
void WinEDA_NetlistFrame::WriteCurrentNetlistSetup( void )
|
|
|
|
/*********************************************************/
|
|
|
|
|
|
|
|
/** Function WriteCurrentNetlistSetup
|
|
|
|
* Write the current netlist options setup in the configuration
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
wxString msg, Command;
|
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
NetlistUpdateOpt();
|
2007-11-10 14:35:04 +00:00
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
// Update the new titles
|
|
|
|
for( int ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ )
|
|
|
|
{
|
2007-11-10 14:35:04 +00:00
|
|
|
EDA_NoteBookPage* CurrPage = m_PanelNetType[ii + PANELCUSTOMBASE];
|
2007-11-05 06:14:55 +00:00
|
|
|
if( CurrPage == NULL )
|
|
|
|
break;
|
2007-11-10 14:35:04 +00:00
|
|
|
msg = wxT( "Custom" );
|
2007-11-05 06:14:55 +00:00
|
|
|
msg << ii + 1;
|
|
|
|
if( CurrPage->m_TitleStringCtrl )
|
|
|
|
{
|
|
|
|
wxString title = CurrPage->m_TitleStringCtrl->GetValue();
|
|
|
|
if( msg != title ) // Title has changed, Update config
|
|
|
|
{
|
|
|
|
msg = CUSTOM_NETLIST_TITLE;
|
|
|
|
msg << ii + 1;
|
2007-11-10 14:35:04 +00:00
|
|
|
m_Parent->m_Parent->m_EDA_Config->Write( msg, title );
|
2007-11-05 06:14:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( CurrPage->m_CommandStringCtrl )
|
|
|
|
{
|
|
|
|
Command = CurrPage->m_CommandStringCtrl->GetValue();
|
|
|
|
msg = CUSTOM_NETLIST_COMMAND;
|
|
|
|
msg << ii + 1;
|
2007-11-10 14:35:04 +00:00
|
|
|
m_Parent->m_Parent->m_EDA_Config->Write( msg, Command );
|
2007-11-05 06:14:55 +00:00
|
|
|
}
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
/******************************************************************/
|
|
|
|
void WinEDA_NetlistFrame::DeletePluginPanel( wxCommandEvent& event )
|
|
|
|
/******************************************************************/
|
|
|
|
|
|
|
|
/** Function DeletePluginPanel
|
|
|
|
* Remove a panel relative to a netlist plugin
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-11-10 14:35:04 +00:00
|
|
|
EDA_NoteBookPage* CurrPage = (EDA_NoteBookPage*) m_NoteBook->GetCurrentPage();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
CurrPage->m_CommandStringCtrl->SetValue( wxEmptyString );
|
|
|
|
CurrPage->m_TitleStringCtrl->SetValue( wxEmptyString );
|
|
|
|
if( CurrPage->m_IsCurrentFormat->IsChecked() )
|
|
|
|
{
|
|
|
|
CurrPage->m_IsCurrentFormat->SetValue( FALSE );
|
|
|
|
m_PanelNetType[PANELPCBNEW]->m_IsCurrentFormat->SetValue( TRUE );
|
|
|
|
}
|
|
|
|
WriteCurrentNetlistSetup();
|
|
|
|
EndModal( NET_PLUGIN_CHANGE );
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
/******************************************************************/
|
|
|
|
void WinEDA_NetlistFrame::ValidatePluginPanel( wxCommandEvent& event )
|
|
|
|
/******************************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
/** Function ValidatePluginPanel
|
|
|
|
* Validate the panel info relative to a new netlist plugin
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
EDA_NoteBookPage* CurrPage = (EDA_NoteBookPage*) m_NoteBook->GetCurrentPage();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
if( CurrPage->m_CommandStringCtrl->GetValue() == wxEmptyString )
|
|
|
|
{
|
|
|
|
DisplayError( this, _( "Error. You must provide a command String" ) );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if( CurrPage->m_TitleStringCtrl->GetValue() == wxEmptyString )
|
|
|
|
{
|
|
|
|
DisplayError( this, _( "Error. You must provide a Title" ) );
|
|
|
|
return;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
WriteCurrentNetlistSetup();
|
|
|
|
EndModal( NET_PLUGIN_CHANGE );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|