remove dialog_netlist.h
This commit is contained in:
parent
cec229bf83
commit
770d72c538
|
@ -49,12 +49,184 @@
|
||||||
#include <protos.h>
|
#include <protos.h>
|
||||||
#include <sch_sheet.h>
|
#include <sch_sheet.h>
|
||||||
#include <dialog_helpers.h>
|
#include <dialog_helpers.h>
|
||||||
#include <dialog_netlist.h>
|
#include <dialogs/dialog_netlist_base.h>
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
|
#include <invoke_sch_dialog.h>
|
||||||
|
|
||||||
#include <eeschema_id.h>
|
#include <eeschema_id.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define CUSTOMPANEL_COUNTMAX 8 // Max number of netlist plugins
|
||||||
|
|
||||||
|
|
||||||
|
/* panel (notebook page) identifiers */
|
||||||
|
enum panel_netlist_index {
|
||||||
|
PANELPCBNEW = 0, /* Handle Netlist format Pcbnew */
|
||||||
|
PANELORCADPCB2, /* Handle Netlist format OracdPcb2 */
|
||||||
|
PANELCADSTAR, /* Handle Netlist format CadStar */
|
||||||
|
PANELSPICE, /* Handle Netlist format Pspice */
|
||||||
|
PANELCUSTOMBASE /* First auxiliary panel (custom netlists).
|
||||||
|
* others use PANELCUSTOMBASE+1, PANELCUSTOMBASE+2.. */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* wxPanels for creating the NoteBook pages for each netlist format: */
|
||||||
|
class NETLIST_PAGE_DIALOG : public wxPanel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NETLIST_TYPE_ID m_IdNetType;
|
||||||
|
wxCheckBox* m_IsCurrentFormat;
|
||||||
|
wxCheckBox* m_AddSubPrefix;
|
||||||
|
wxTextCtrl* m_CommandStringCtrl;
|
||||||
|
wxTextCtrl* m_TitleStringCtrl;
|
||||||
|
wxButton* m_ButtonCancel;
|
||||||
|
wxBoxSizer* m_LeftBoxSizer;
|
||||||
|
wxBoxSizer* m_RightBoxSizer;
|
||||||
|
wxBoxSizer* m_RightOptionsBoxSizer;
|
||||||
|
wxBoxSizer* m_LowBoxSizer;
|
||||||
|
wxRadioBox* m_NetOption;
|
||||||
|
private:
|
||||||
|
wxString m_pageNetFmtName;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/** Constructor to create a setup page for one netlist format.
|
||||||
|
* Used in Netlist format Dialog box creation
|
||||||
|
* @param parent = wxNotebook * parent
|
||||||
|
* @param title = title (name) of the notebook page
|
||||||
|
* @param id_NetType = netlist type id
|
||||||
|
*/
|
||||||
|
NETLIST_PAGE_DIALOG( wxNotebook* parent, const wxString& title,
|
||||||
|
NETLIST_TYPE_ID id_NetType );
|
||||||
|
~NETLIST_PAGE_DIALOG() { };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function GetPageNetFmtName
|
||||||
|
* @return the name of the netlist format for this page
|
||||||
|
* This is usually the page label.
|
||||||
|
* For the pcbnew netlist, this is "LegacyPcbnew"
|
||||||
|
* when the "old" format is selected
|
||||||
|
* and "PcbnewAdvanced" when the advanced format (S expr fmt)is selected
|
||||||
|
*/
|
||||||
|
const wxString GetPageNetFmtName();
|
||||||
|
|
||||||
|
void SetPageNetFmtName( const wxString &aName ) { m_pageNetFmtName = aName; }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Dialog frame for creating netlists */
|
||||||
|
class NETLIST_DIALOG : public NETLIST_DIALOG_BASE
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SCH_EDIT_FRAME* m_Parent;
|
||||||
|
wxString m_NetFmtName;
|
||||||
|
NETLIST_PAGE_DIALOG* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX];
|
||||||
|
|
||||||
|
private:
|
||||||
|
wxConfig* m_config;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructor and destructor
|
||||||
|
NETLIST_DIALOG( SCH_EDIT_FRAME* parent );
|
||||||
|
~NETLIST_DIALOG() { };
|
||||||
|
|
||||||
|
private:
|
||||||
|
void InstallCustomPages();
|
||||||
|
NETLIST_PAGE_DIALOG* AddOneCustomPage( const wxString & aTitle,
|
||||||
|
const wxString & aCommandString,
|
||||||
|
NETLIST_TYPE_ID aNetTypeId );
|
||||||
|
void InstallPageSpice();
|
||||||
|
void GenNetlist( wxCommandEvent& event );
|
||||||
|
void RunSimulator( wxCommandEvent& event );
|
||||||
|
void NetlistUpdateOpt();
|
||||||
|
void OnCancelClick( wxCommandEvent& event );
|
||||||
|
void OnNetlistTypeSelection( wxNotebookEvent& event );
|
||||||
|
void SelectDefaultNetlistType( wxCommandEvent& event );
|
||||||
|
void EnableSubcircuitPrefix( wxCommandEvent& event );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function OnAddPlugin
|
||||||
|
* Add a new panel for a new netlist plugin
|
||||||
|
*/
|
||||||
|
void OnAddPlugin( wxCommandEvent& event );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function OnDelPlugin
|
||||||
|
* Remove a panel relative to a netlist plugin
|
||||||
|
*/
|
||||||
|
void OnDelPlugin( wxCommandEvent& event );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function WriteCurrentNetlistSetup
|
||||||
|
* Write the current netlist options setup in the configuration
|
||||||
|
*/
|
||||||
|
void WriteCurrentNetlistSetup();
|
||||||
|
|
||||||
|
bool GetUseDefaultNetlistName()
|
||||||
|
{
|
||||||
|
return m_cbUseDefaultNetlistName->IsChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function ReturnUserNetlistTypeName
|
||||||
|
* to retrieve user netlist type names
|
||||||
|
* @param first_item = 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
|
||||||
|
*/
|
||||||
|
const wxString ReturnUserNetlistTypeName( bool first_item );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function ReturnFilenamePrms
|
||||||
|
* returns the filename extension and the wildcard string for this curr
|
||||||
|
* or a void name if there is no default name
|
||||||
|
* @param aNetTypeId = the netlist type ( NET_TYPE_PCBNEW ... )
|
||||||
|
* @param aExt = a reference to a wxString to return the default file ext.
|
||||||
|
* @param aWildCard = reference to a wxString to return the default wildcard.
|
||||||
|
* @return true for known netlist type, false for custom formats
|
||||||
|
*/
|
||||||
|
bool ReturnFilenamePrms( NETLIST_TYPE_ID aNetTypeId,
|
||||||
|
wxString * aExt, wxString * aWildCard );
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class NETLIST_DIALOG_ADD_PLUGIN : public NETLIST_DIALOG_ADD_PLUGIN_BASE
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
NETLIST_DIALOG* m_Parent;
|
||||||
|
|
||||||
|
public:
|
||||||
|
NETLIST_DIALOG_ADD_PLUGIN( NETLIST_DIALOG* parent );
|
||||||
|
const wxString GetPluginTitle()
|
||||||
|
{
|
||||||
|
return m_textCtrlName->GetValue();
|
||||||
|
}
|
||||||
|
const wxString GetPluginTCommandLine()
|
||||||
|
{
|
||||||
|
return m_textCtrlCommand->GetValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function OnOKClick
|
||||||
|
* Validate info relative to a new netlist plugin
|
||||||
|
*/
|
||||||
|
void OnOKClick( wxCommandEvent& event );
|
||||||
|
void OnCancelClick( wxCommandEvent& event );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Browse plugin files, and set m_CommandStringCtrl field
|
||||||
|
*/
|
||||||
|
void OnBrowsePlugins( wxCommandEvent& event );
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Event id for notebook page buttons: */
|
/* Event id for notebook page buttons: */
|
||||||
enum id_netlist {
|
enum id_netlist {
|
||||||
ID_CREATE_NETLIST = ID_END_EESCHEMA_ID_LIST + 1,
|
ID_CREATE_NETLIST = ID_END_EESCHEMA_ID_LIST + 1,
|
||||||
|
@ -86,14 +258,7 @@ BEGIN_EVENT_TABLE( NETLIST_DIALOG, NETLIST_DIALOG_BASE )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
/*******************************/
|
|
||||||
/* Functions for these classes */
|
|
||||||
/*******************************/
|
|
||||||
|
|
||||||
|
|
||||||
/* Contructor to create a setup page for one netlist format.
|
|
||||||
* Used in Netlist format Dialog box creation
|
|
||||||
*/
|
|
||||||
NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent,
|
NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent,
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
NETLIST_TYPE_ID id_NetType ) :
|
NETLIST_TYPE_ID id_NetType ) :
|
||||||
|
@ -163,6 +328,7 @@ NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const wxString NETLIST_PAGE_DIALOG::GetPageNetFmtName()
|
const wxString NETLIST_PAGE_DIALOG::GetPageNetFmtName()
|
||||||
{
|
{
|
||||||
// PCBNEW Format is a special type:
|
// PCBNEW Format is a special type:
|
||||||
|
@ -223,14 +389,6 @@ NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function ReturnUserNetlistTypeName
|
|
||||||
* to retrieve user netlist type names
|
|
||||||
* @param first_item = 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
|
|
||||||
*/
|
|
||||||
const wxString NETLIST_DIALOG::ReturnUserNetlistTypeName( bool first_item )
|
const wxString NETLIST_DIALOG::ReturnUserNetlistTypeName( bool first_item )
|
||||||
{
|
{
|
||||||
static int index;
|
static int index;
|
||||||
|
@ -249,6 +407,7 @@ const wxString NETLIST_DIALOG::ReturnUserNetlistTypeName( bool first_item )
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void NETLIST_DIALOG::InstallPageSpice()
|
void NETLIST_DIALOG::InstallPageSpice()
|
||||||
{
|
{
|
||||||
wxButton* Button;
|
wxButton* Button;
|
||||||
|
@ -282,8 +441,6 @@ void NETLIST_DIALOG::InstallPageSpice()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* create the pages for custom netlist format selection:
|
|
||||||
*/
|
|
||||||
void NETLIST_DIALOG::InstallCustomPages()
|
void NETLIST_DIALOG::InstallCustomPages()
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
|
@ -308,6 +465,7 @@ void NETLIST_DIALOG::InstallCustomPages()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NETLIST_PAGE_DIALOG* NETLIST_DIALOG::AddOneCustomPage( const wxString & aTitle,
|
NETLIST_PAGE_DIALOG* NETLIST_DIALOG::AddOneCustomPage( const wxString & aTitle,
|
||||||
const wxString & aCommandString,
|
const wxString & aCommandString,
|
||||||
NETLIST_TYPE_ID aNetTypeId )
|
NETLIST_TYPE_ID aNetTypeId )
|
||||||
|
@ -346,8 +504,6 @@ NETLIST_PAGE_DIALOG* NETLIST_DIALOG::AddOneCustomPage( const wxString & aTitle,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Called when the check box "default format" is clicked
|
|
||||||
*/
|
|
||||||
void NETLIST_DIALOG::SelectDefaultNetlistType( wxCommandEvent& event )
|
void NETLIST_DIALOG::SelectDefaultNetlistType( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
|
@ -366,10 +522,7 @@ void NETLIST_DIALOG::SelectDefaultNetlistType( wxCommandEvent& event )
|
||||||
currPage->m_IsCurrentFormat->SetValue( true );
|
currPage->m_IsCurrentFormat->SetValue( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called when a netlist type is selected.
|
|
||||||
* Enable/disable relevant/irrelevant widgets, and display the default
|
|
||||||
* netlist name, for known types
|
|
||||||
*/
|
|
||||||
void NETLIST_DIALOG::OnNetlistTypeSelection( wxNotebookEvent& event )
|
void NETLIST_DIALOG::OnNetlistTypeSelection( wxNotebookEvent& event )
|
||||||
{
|
{
|
||||||
NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
|
NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
|
||||||
|
@ -390,10 +543,7 @@ void NETLIST_DIALOG::OnNetlistTypeSelection( wxNotebookEvent& event )
|
||||||
m_textCtrlDefaultFileName->Clear();
|
m_textCtrlDefaultFileName->Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called when the check box m_AddSubPrefix
|
|
||||||
* "default format" is clicked
|
|
||||||
* ( Spice format only )
|
|
||||||
*/
|
|
||||||
void NETLIST_DIALOG::EnableSubcircuitPrefix( wxCommandEvent& event )
|
void NETLIST_DIALOG::EnableSubcircuitPrefix( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -407,6 +557,7 @@ void NETLIST_DIALOG::EnableSubcircuitPrefix( wxCommandEvent& event )
|
||||||
m_Parent->SetAddReferencePrefix( currPage->m_AddSubPrefix->IsChecked() );
|
m_Parent->SetAddReferencePrefix( currPage->m_AddSubPrefix->IsChecked() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void NETLIST_DIALOG::NetlistUpdateOpt()
|
void NETLIST_DIALOG::NetlistUpdateOpt()
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
|
@ -425,12 +576,6 @@ void NETLIST_DIALOG::NetlistUpdateOpt()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function GenNetlist
|
|
||||||
* Create the netlist file:
|
|
||||||
* calculate the filename with the suitable extensions
|
|
||||||
* and run the netlist creator
|
|
||||||
*/
|
|
||||||
void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event )
|
void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxFileName fn;
|
wxFileName fn;
|
||||||
|
@ -445,7 +590,7 @@ void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event )
|
||||||
|
|
||||||
unsigned netlist_opt = 0;
|
unsigned netlist_opt = 0;
|
||||||
|
|
||||||
/* Calculate the netlist filename */
|
// Calculate the netlist filename
|
||||||
fn = g_RootSheet->GetScreen()->GetFileName();
|
fn = g_RootSheet->GetScreen()->GetFileName();
|
||||||
ReturnFilenamePrms( currPage->m_IdNetType, &fileExt, &fileWildcard );
|
ReturnFilenamePrms( currPage->m_IdNetType, &fileExt, &fileWildcard );
|
||||||
|
|
||||||
|
@ -478,18 +623,20 @@ void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event )
|
||||||
if( fn.GetPath().IsEmpty() )
|
if( fn.GetPath().IsEmpty() )
|
||||||
fn.SetPath( wxGetCwd() );
|
fn.SetPath( wxGetCwd() );
|
||||||
|
|
||||||
wxString fullfilename = fn.GetFullPath();
|
wxString fullpath = fn.GetFullPath();
|
||||||
|
|
||||||
if( !GetUseDefaultNetlistName() || currPage->m_IdNetType >= NET_TYPE_CUSTOM1 )
|
if( !GetUseDefaultNetlistName() || currPage->m_IdNetType >= NET_TYPE_CUSTOM1 )
|
||||||
{
|
{
|
||||||
wxFileDialog dlg( this, title, fn.GetPath(),
|
wxString fullname = fn.GetFullName();
|
||||||
fullfilename, fileWildcard,
|
wxString path = fn.GetPath();
|
||||||
wxFD_SAVE );
|
|
||||||
|
// fullname does not and should not include the path, per wx docs.
|
||||||
|
wxFileDialog dlg( this, title, path, fullname, fileWildcard, wxFD_SAVE );
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_CANCEL )
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fullfilename = dlg.GetPath();
|
fullpath = dlg.GetPath(); // directory + filename
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Parent->ClearMsgPanel();
|
m_Parent->ClearMsgPanel();
|
||||||
|
@ -499,22 +646,14 @@ void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event )
|
||||||
else
|
else
|
||||||
m_Parent->SetNetListerCommand( wxEmptyString );
|
m_Parent->SetNetListerCommand( wxEmptyString );
|
||||||
|
|
||||||
m_Parent->CreateNetlist( currPage->m_IdNetType, fullfilename, netlist_opt );
|
m_Parent->CreateNetlist( currPage->m_IdNetType, fullpath, netlist_opt );
|
||||||
|
|
||||||
WriteCurrentNetlistSetup();
|
WriteCurrentNetlistSetup();
|
||||||
|
|
||||||
EndModal( wxID_OK );
|
EndModal( wxID_OK );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Function ReturnFilenamePrms
|
|
||||||
* returns the filename extension and the wildcard string for this curr
|
|
||||||
* or a void name if there is no default name
|
|
||||||
* @param aNetTypeId = the netlist type ( NET_TYPE_PCBNEW ... )
|
|
||||||
* @param aExt = a reference to a wxString to return the default file ext.
|
|
||||||
* @param aWildCard = reference to a wxString to return the default wildcard.
|
|
||||||
* @return true for known netlist type, false for custom formats
|
|
||||||
*/
|
|
||||||
bool NETLIST_DIALOG::ReturnFilenamePrms( NETLIST_TYPE_ID aNetTypeId,
|
bool NETLIST_DIALOG::ReturnFilenamePrms( NETLIST_TYPE_ID aNetTypeId,
|
||||||
wxString * aExt, wxString * aWildCard )
|
wxString * aExt, wxString * aWildCard )
|
||||||
{
|
{
|
||||||
|
@ -555,15 +694,7 @@ bool NETLIST_DIALOG::ReturnFilenamePrms( NETLIST_TYPE_ID aNetTypeId,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Function CreateNetlist
|
|
||||||
* > test for some issues (missing or duplicate references and sheet names)
|
|
||||||
* > build netlist info
|
|
||||||
* > create the netlist file
|
|
||||||
* param aFormat = netlist format (NET_TYPE_PCBNEW ...)
|
|
||||||
* param aFullFileName = full netlist file name
|
|
||||||
* param aNetlistOptions = netlist options using OR'ed bits (see WriteNetListFile).
|
|
||||||
* return true if success.
|
|
||||||
*/
|
|
||||||
bool SCH_EDIT_FRAME::CreateNetlist( int aFormat, const wxString& aFullFileName,
|
bool SCH_EDIT_FRAME::CreateNetlist( int aFormat, const wxString& aFullFileName,
|
||||||
unsigned aNetlistOptions )
|
unsigned aNetlistOptions )
|
||||||
{
|
{
|
||||||
|
@ -592,7 +723,7 @@ Do you want to annotate schematic?" ) ) )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cleanup the entire hierarchy */
|
// Cleanup the entire hierarchy
|
||||||
SCH_SCREENS screens;
|
SCH_SCREENS screens;
|
||||||
screens.SchematicCleanUp();
|
screens.SchematicCleanUp();
|
||||||
|
|
||||||
|
@ -621,7 +752,7 @@ void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event )
|
||||||
ExecFile = tmp.BeforeFirst( ' ' );
|
ExecFile = tmp.BeforeFirst( ' ' );
|
||||||
CommandLine = tmp.AfterFirst( ' ' );
|
CommandLine = tmp.AfterFirst( ' ' );
|
||||||
|
|
||||||
/* Calculate the netlist filename */
|
// Calculate the netlist filename
|
||||||
fn = g_RootSheet->GetScreen()->GetFileName();
|
fn = g_RootSheet->GetScreen()->GetFileName();
|
||||||
fn.SetExt( wxT( "cir" ) );
|
fn.SetExt( wxT( "cir" ) );
|
||||||
CommandLine += wxT( " \"" ) + fn.GetFullPath() + wxT( "\"" );
|
CommandLine += wxT( " \"" ) + fn.GetFullPath() + wxT( "\"" );
|
||||||
|
@ -643,11 +774,7 @@ void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
void NETLIST_DIALOG::WriteCurrentNetlistSetup()
|
||||||
* Function WriteCurrentNetlistSetup
|
|
||||||
* Write the current netlist options setup in the configuration
|
|
||||||
*/
|
|
||||||
void NETLIST_DIALOG::WriteCurrentNetlistSetup( void )
|
|
||||||
{
|
{
|
||||||
wxString msg, Command;
|
wxString msg, Command;
|
||||||
|
|
||||||
|
@ -694,10 +821,6 @@ void NETLIST_DIALOG::WriteCurrentNetlistSetup( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function OnDelPlugin
|
|
||||||
* Remove a panel relative to a netlist plugin
|
|
||||||
*/
|
|
||||||
void NETLIST_DIALOG::OnDelPlugin( wxCommandEvent& event )
|
void NETLIST_DIALOG::OnDelPlugin( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
|
NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
|
||||||
|
@ -715,10 +838,7 @@ void NETLIST_DIALOG::OnDelPlugin( wxCommandEvent& event )
|
||||||
EndModal( NET_PLUGIN_CHANGE );
|
EndModal( NET_PLUGIN_CHANGE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Function OnAddPlugin
|
|
||||||
* Add a new panel for a new netlist plugin
|
|
||||||
*/
|
|
||||||
void NETLIST_DIALOG::OnAddPlugin( wxCommandEvent& event )
|
void NETLIST_DIALOG::OnAddPlugin( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
NETLIST_DIALOG_ADD_PLUGIN dlg( this );
|
NETLIST_DIALOG_ADD_PLUGIN dlg( this );
|
||||||
|
@ -763,10 +883,7 @@ NETLIST_DIALOG_ADD_PLUGIN::NETLIST_DIALOG_ADD_PLUGIN( NETLIST_DIALOG* parent ) :
|
||||||
GetSizer()->SetSizeHints( this );
|
GetSizer()->SetSizeHints( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Function OnOKClick
|
|
||||||
* Validate info relative to a new netlist plugin
|
|
||||||
*/
|
|
||||||
void NETLIST_DIALOG_ADD_PLUGIN::OnOKClick( wxCommandEvent& event )
|
void NETLIST_DIALOG_ADD_PLUGIN::OnOKClick( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
if( m_textCtrlCommand->GetValue() == wxEmptyString )
|
if( m_textCtrlCommand->GetValue() == wxEmptyString )
|
||||||
|
@ -784,14 +901,13 @@ void NETLIST_DIALOG_ADD_PLUGIN::OnOKClick( wxCommandEvent& event )
|
||||||
EndModal( wxID_OK );
|
EndModal( wxID_OK );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void NETLIST_DIALOG_ADD_PLUGIN::OnCancelClick( wxCommandEvent& event )
|
void NETLIST_DIALOG_ADD_PLUGIN::OnCancelClick( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
EndModal( wxID_CANCEL );
|
EndModal( wxID_CANCEL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Browse plugin files, and set m_CommandStringCtrl field
|
|
||||||
*/
|
|
||||||
void NETLIST_DIALOG_ADD_PLUGIN::OnBrowsePlugins( wxCommandEvent& event )
|
void NETLIST_DIALOG_ADD_PLUGIN::OnBrowsePlugins( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxString FullFileName, Mask, Path;
|
wxString FullFileName, Mask, Path;
|
||||||
|
@ -834,3 +950,12 @@ void NETLIST_DIALOG_ADD_PLUGIN::OnBrowsePlugins( wxCommandEvent& event )
|
||||||
if( title.IsEmpty() )
|
if( title.IsEmpty() )
|
||||||
wxMessageBox( _( "Do not forget to choose a title for this netlist control page" ) );
|
wxMessageBox( _( "Do not forget to choose a title for this netlist control page" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int InvokeDialogNetList( SCH_EDIT_FRAME* aCaller )
|
||||||
|
{
|
||||||
|
NETLIST_DIALOG dlg( aCaller );
|
||||||
|
|
||||||
|
return dlg.ShowModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,205 +0,0 @@
|
||||||
/**
|
|
||||||
* @file eeschema/dialogs/dialog_netlist.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras@wanadoo.fr
|
|
||||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
|
||||||
* Copyright (C) 1992-2012 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _DIALOG_NETLIST_H_
|
|
||||||
#define _DIALOG_NETLIST_H_
|
|
||||||
|
|
||||||
#include <dialogs/dialog_netlist_base.h>
|
|
||||||
|
|
||||||
#define CUSTOMPANEL_COUNTMAX 8 // Max number of netlist plugins
|
|
||||||
|
|
||||||
// Id to select netlist type
|
|
||||||
enum NETLIST_TYPE_ID {
|
|
||||||
NET_TYPE_UNINIT = 0,
|
|
||||||
NET_TYPE_PCBNEW,
|
|
||||||
NET_TYPE_ORCADPCB2,
|
|
||||||
NET_TYPE_CADSTAR,
|
|
||||||
NET_TYPE_SPICE,
|
|
||||||
NET_TYPE_CUSTOM1, /* NET_TYPE_CUSTOM1
|
|
||||||
* is the first id for user netlist format
|
|
||||||
* NET_TYPE_CUSTOM1+CUSTOMPANEL_COUNTMAX-1
|
|
||||||
* is the last id for user netlist format
|
|
||||||
*/
|
|
||||||
NET_TYPE_CUSTOM_MAX = NET_TYPE_CUSTOM1 + CUSTOMPANEL_COUNTMAX - 1
|
|
||||||
};
|
|
||||||
|
|
||||||
/* panel (notebook page) identifiers */
|
|
||||||
enum panel_netlist_index {
|
|
||||||
PANELPCBNEW = 0, /* Handle Netlist format Pcbnew */
|
|
||||||
PANELORCADPCB2, /* Handle Netlist format OracdPcb2 */
|
|
||||||
PANELCADSTAR, /* Handle Netlist format CadStar */
|
|
||||||
PANELSPICE, /* Handle Netlist format Pspice */
|
|
||||||
PANELCUSTOMBASE /* First auxiliary panel (custom netlists).
|
|
||||||
* others use PANELCUSTOMBASE+1, PANELCUSTOMBASE+2.. */
|
|
||||||
};
|
|
||||||
|
|
||||||
// Values returned when the netlist dialog is dismissed
|
|
||||||
#define NET_PLUGIN_CHANGE 1
|
|
||||||
// other values in use are wxID_OK and wxID_CANCEL
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* wxPanels for creating the NoteBook pages for each netlist format: */
|
|
||||||
class NETLIST_PAGE_DIALOG : public wxPanel
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NETLIST_TYPE_ID m_IdNetType;
|
|
||||||
wxCheckBox* m_IsCurrentFormat;
|
|
||||||
wxCheckBox* m_AddSubPrefix;
|
|
||||||
wxTextCtrl* m_CommandStringCtrl;
|
|
||||||
wxTextCtrl* m_TitleStringCtrl;
|
|
||||||
wxButton* m_ButtonCancel;
|
|
||||||
wxBoxSizer* m_LeftBoxSizer;
|
|
||||||
wxBoxSizer* m_RightBoxSizer;
|
|
||||||
wxBoxSizer* m_RightOptionsBoxSizer;
|
|
||||||
wxBoxSizer* m_LowBoxSizer;
|
|
||||||
wxRadioBox* m_NetOption;
|
|
||||||
private:
|
|
||||||
wxString m_pageNetFmtName;
|
|
||||||
|
|
||||||
public:
|
|
||||||
/** Constructor to create a setup page for one netlist format.
|
|
||||||
* Used in Netlist format Dialog box creation
|
|
||||||
* @param parent = wxNotebook * parent
|
|
||||||
* @param title = title (name) of the notebook page
|
|
||||||
* @param id_NetType = netlist type id
|
|
||||||
*/
|
|
||||||
NETLIST_PAGE_DIALOG( wxNotebook* parent, const wxString& title,
|
|
||||||
NETLIST_TYPE_ID id_NetType );
|
|
||||||
~NETLIST_PAGE_DIALOG() { };
|
|
||||||
|
|
||||||
/**
|
|
||||||
* function GetPageNetFmtName
|
|
||||||
* @return the name of the netlist format for this page
|
|
||||||
* This is usually the page label.
|
|
||||||
* For the pcbnew netlist, this is "LegacyPcbnew"
|
|
||||||
* when the "old" format is selected
|
|
||||||
* and "PcbnewAdvanced" when the advanced format (S expr fmt)is selected
|
|
||||||
*/
|
|
||||||
const wxString GetPageNetFmtName();
|
|
||||||
|
|
||||||
void SetPageNetFmtName( const wxString &aName ) { m_pageNetFmtName = aName; }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Options for Spice netlist generation (OR'ed bits
|
|
||||||
enum netlistOptions {
|
|
||||||
NET_USE_X_PREFIX = 2, // for Spice netlist : change "U" and "IC" reference prefix to "X"
|
|
||||||
NET_PCBNEW_USE_NEW_FORMAT = 1, // For Pcbnew use the new format (S expression and SWEET)
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Dialog frame for creating netlists */
|
|
||||||
class NETLIST_DIALOG : public NETLIST_DIALOG_BASE
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
SCH_EDIT_FRAME* m_Parent;
|
|
||||||
wxString m_NetFmtName;
|
|
||||||
NETLIST_PAGE_DIALOG* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX];
|
|
||||||
|
|
||||||
private:
|
|
||||||
wxConfig* m_config;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Constructor and destructor
|
|
||||||
NETLIST_DIALOG( SCH_EDIT_FRAME* parent );
|
|
||||||
~NETLIST_DIALOG() { };
|
|
||||||
|
|
||||||
private:
|
|
||||||
void InstallCustomPages();
|
|
||||||
NETLIST_PAGE_DIALOG* AddOneCustomPage( const wxString & aTitle,
|
|
||||||
const wxString & aCommandString,
|
|
||||||
NETLIST_TYPE_ID aNetTypeId );
|
|
||||||
void InstallPageSpice();
|
|
||||||
void GenNetlist( wxCommandEvent& event );
|
|
||||||
void RunSimulator( wxCommandEvent& event );
|
|
||||||
void NetlistUpdateOpt();
|
|
||||||
void OnCancelClick( wxCommandEvent& event );
|
|
||||||
void OnNetlistTypeSelection( wxNotebookEvent& event );
|
|
||||||
void SelectDefaultNetlistType( wxCommandEvent& event );
|
|
||||||
void EnableSubcircuitPrefix( wxCommandEvent& event );
|
|
||||||
void OnAddPlugin( wxCommandEvent& event );
|
|
||||||
void OnDelPlugin( wxCommandEvent& event );
|
|
||||||
|
|
||||||
void WriteCurrentNetlistSetup( void );
|
|
||||||
|
|
||||||
bool GetUseDefaultNetlistName()
|
|
||||||
{
|
|
||||||
return m_cbUseDefaultNetlistName->IsChecked();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function ReturnUserNetlistTypeName
|
|
||||||
* to retrieve user netlist type names
|
|
||||||
* @param first_item = 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
|
|
||||||
*/
|
|
||||||
const wxString ReturnUserNetlistTypeName( bool first_item );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function ReturnFilenamePrms
|
|
||||||
* returns the filename extension and the wildcard string for this curr
|
|
||||||
* or a void name if there is no default name
|
|
||||||
* @param aNetTypeId = the netlist type ( NET_TYPE_PCBNEW ... )
|
|
||||||
* @param aExt = a reference to a wxString to return the default file ext.
|
|
||||||
* @param aWildCard = reference to a wxString to return the default wildcard.
|
|
||||||
* @return true for known netlist type, false for custom formats
|
|
||||||
*/
|
|
||||||
bool ReturnFilenamePrms( NETLIST_TYPE_ID aNetTypeId,
|
|
||||||
wxString * aExt, wxString * aWildCard );
|
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class NETLIST_DIALOG_ADD_PLUGIN : public NETLIST_DIALOG_ADD_PLUGIN_BASE
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
NETLIST_DIALOG* m_Parent;
|
|
||||||
|
|
||||||
public:
|
|
||||||
NETLIST_DIALOG_ADD_PLUGIN( NETLIST_DIALOG* parent );
|
|
||||||
const wxString GetPluginTitle()
|
|
||||||
{
|
|
||||||
return m_textCtrlName->GetValue();
|
|
||||||
}
|
|
||||||
const wxString GetPluginTCommandLine()
|
|
||||||
{
|
|
||||||
return m_textCtrlCommand->GetValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
void OnOKClick( wxCommandEvent& event );
|
|
||||||
void OnCancelClick( wxCommandEvent& event );
|
|
||||||
void OnBrowsePlugins( wxCommandEvent& event );
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* _DIALOG_NETLIST_H_ */
|
|
|
@ -65,5 +65,15 @@ int InvokeDialogPrintUsingPrinter( SCH_EDIT_FRAME* aCaller );
|
||||||
/// DIALOG_BOM::ShowModal() returns.
|
/// DIALOG_BOM::ShowModal() returns.
|
||||||
int InvokeDialogCreateBOM( SCH_EDIT_FRAME* aCaller );
|
int InvokeDialogCreateBOM( SCH_EDIT_FRAME* aCaller );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function InvokeDialogNetList
|
||||||
|
* creates and shows NETLIST_DIALOG and returns whatever
|
||||||
|
* NETLIST_DIALOG::ShowModal() returns.
|
||||||
|
* @param int - NET_PLUGIN_CHANGE means user added or deleted a plugin,
|
||||||
|
* wxID_OK, or wxID_CANCEL.
|
||||||
|
*/
|
||||||
|
#define NET_PLUGIN_CHANGE 1
|
||||||
|
int InvokeDialogNetList( SCH_EDIT_FRAME* aCaller );
|
||||||
|
|
||||||
|
|
||||||
#endif // INVOKE_SCH_DIALOG_H_
|
#endif // INVOKE_SCH_DIALOG_H_
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
|
|
||||||
#include <general.h>
|
#include <general.h>
|
||||||
#include <netlist.h>
|
#include <netlist.h>
|
||||||
#include <dialog_netlist.h>
|
|
||||||
#include <class_library.h>
|
#include <class_library.h>
|
||||||
#include <lib_pin.h>
|
#include <lib_pin.h>
|
||||||
#include <sch_component.h>
|
#include <sch_component.h>
|
||||||
|
|
|
@ -39,6 +39,29 @@
|
||||||
#include <sch_component.h>
|
#include <sch_component.h>
|
||||||
|
|
||||||
|
|
||||||
|
/// netlist types
|
||||||
|
enum NETLIST_TYPE_ID {
|
||||||
|
NET_TYPE_UNINIT = 0,
|
||||||
|
NET_TYPE_PCBNEW,
|
||||||
|
NET_TYPE_ORCADPCB2,
|
||||||
|
NET_TYPE_CADSTAR,
|
||||||
|
NET_TYPE_SPICE,
|
||||||
|
NET_TYPE_CUSTOM1, /* NET_TYPE_CUSTOM1
|
||||||
|
* is the first id for user netlist format
|
||||||
|
* NET_TYPE_CUSTOM1+CUSTOMPANEL_COUNTMAX-1
|
||||||
|
* is the last id for user netlist format
|
||||||
|
*/
|
||||||
|
//NET_TYPE_CUSTOM_MAX = NET_TYPE_CUSTOM1 + CUSTOMPANEL_COUNTMAX - 1
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/// Options for Spice netlist generation (OR'ed bits
|
||||||
|
enum netlistOptions {
|
||||||
|
NET_USE_X_PREFIX = 2, // for Spice netlist : change "U" and "IC" reference prefix to "X"
|
||||||
|
NET_PCBNEW_USE_NEW_FORMAT = 1, // For Pcbnew use the new format (S expression and SWEET)
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class SCH_COMPONENT;
|
class SCH_COMPONENT;
|
||||||
class SCH_REFERENC_LIST;
|
class SCH_REFERENC_LIST;
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,6 @@
|
||||||
#include <sch_component.h>
|
#include <sch_component.h>
|
||||||
|
|
||||||
#include <dialog_helpers.h>
|
#include <dialog_helpers.h>
|
||||||
#include <dialog_netlist.h>
|
|
||||||
#include <libeditframe.h>
|
#include <libeditframe.h>
|
||||||
#include <viewlib_frame.h>
|
#include <viewlib_frame.h>
|
||||||
#include <hotkeys.h>
|
#include <hotkeys.h>
|
||||||
|
@ -617,16 +616,15 @@ void SCH_EDIT_FRAME::OnErc( wxCommandEvent& event )
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::OnCreateNetlist( wxCommandEvent& event )
|
void SCH_EDIT_FRAME::OnCreateNetlist( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
int i;
|
int result;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
NETLIST_DIALOG* dlg = new NETLIST_DIALOG( this );
|
result = InvokeDialogNetList( this );
|
||||||
i = dlg->ShowModal();
|
|
||||||
dlg->Destroy();
|
|
||||||
} while( i == NET_PLUGIN_CHANGE );
|
|
||||||
|
|
||||||
// If a plugin is removed or added, rebuild and reopen the new dialog
|
// If a plugin is removed or added, rebuild and reopen the new dialog
|
||||||
|
|
||||||
|
} while( result == NET_PLUGIN_CHANGE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue