From 1ece12b907438d752eb75a2f599c3c59943683d8 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Thu, 27 Jun 2013 15:34:30 -0500 Subject: [PATCH] remove dialog_netlist.h --- eeschema/dialogs/dialog_netlist.cpp | 287 ++++++++++++++++++++-------- eeschema/dialogs/dialog_netlist.h | 205 -------------------- eeschema/invoke_sch_dialog.h | 10 + eeschema/netform.cpp | 1 - eeschema/netlist.h | 25 ++- eeschema/schframe.cpp | 12 +- 6 files changed, 245 insertions(+), 295 deletions(-) delete mode 100644 eeschema/dialogs/dialog_netlist.h diff --git a/eeschema/dialogs/dialog_netlist.cpp b/eeschema/dialogs/dialog_netlist.cpp index 8fbca46427..1e8519568b 100644 --- a/eeschema/dialogs/dialog_netlist.cpp +++ b/eeschema/dialogs/dialog_netlist.cpp @@ -49,12 +49,184 @@ #include #include #include -#include +#include #include #include +#include #include + + +#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: */ enum id_netlist { ID_CREATE_NETLIST = ID_END_EESCHEMA_ID_LIST + 1, @@ -86,14 +258,7 @@ BEGIN_EVENT_TABLE( NETLIST_DIALOG, NETLIST_DIALOG_BASE ) 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, const wxString& title, NETLIST_TYPE_ID id_NetType ) : @@ -163,6 +328,7 @@ NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent, } } + const wxString NETLIST_PAGE_DIALOG::GetPageNetFmtName() { // 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 ) { static int index; @@ -249,6 +407,7 @@ const wxString NETLIST_DIALOG::ReturnUserNetlistTypeName( bool first_item ) return name; } + void NETLIST_DIALOG::InstallPageSpice() { wxButton* Button; @@ -282,8 +441,6 @@ void NETLIST_DIALOG::InstallPageSpice() } -/* create the pages for custom netlist format selection: - */ void NETLIST_DIALOG::InstallCustomPages() { int ii; @@ -308,6 +465,7 @@ void NETLIST_DIALOG::InstallCustomPages() } } + NETLIST_PAGE_DIALOG* NETLIST_DIALOG::AddOneCustomPage( const wxString & aTitle, const wxString & aCommandString, 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 ) { int ii; @@ -366,10 +522,7 @@ void NETLIST_DIALOG::SelectDefaultNetlistType( wxCommandEvent& event ) 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 ) { NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage(); @@ -390,10 +543,7 @@ void NETLIST_DIALOG::OnNetlistTypeSelection( wxNotebookEvent& event ) m_textCtrlDefaultFileName->Clear(); } -/* Called when the check box m_AddSubPrefix - * "default format" is clicked - * ( Spice format only ) - */ + void NETLIST_DIALOG::EnableSubcircuitPrefix( wxCommandEvent& event ) { @@ -407,6 +557,7 @@ void NETLIST_DIALOG::EnableSubcircuitPrefix( wxCommandEvent& event ) m_Parent->SetAddReferencePrefix( currPage->m_AddSubPrefix->IsChecked() ); } + void NETLIST_DIALOG::NetlistUpdateOpt() { 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 ) { wxFileName fn; @@ -445,7 +590,7 @@ void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event ) unsigned netlist_opt = 0; - /* Calculate the netlist filename */ + // Calculate the netlist filename fn = g_RootSheet->GetScreen()->GetFileName(); ReturnFilenamePrms( currPage->m_IdNetType, &fileExt, &fileWildcard ); @@ -478,18 +623,20 @@ void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event ) if( fn.GetPath().IsEmpty() ) fn.SetPath( wxGetCwd() ); - wxString fullfilename = fn.GetFullPath(); + wxString fullpath = fn.GetFullPath(); if( !GetUseDefaultNetlistName() || currPage->m_IdNetType >= NET_TYPE_CUSTOM1 ) { - wxFileDialog dlg( this, title, fn.GetPath(), - fullfilename, fileWildcard, - wxFD_SAVE ); + wxString fullname = fn.GetFullName(); + wxString path = fn.GetPath(); + + // 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 ) return; - fullfilename = dlg.GetPath(); + fullpath = dlg.GetPath(); // directory + filename } m_Parent->ClearMsgPanel(); @@ -499,22 +646,14 @@ void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event ) else m_Parent->SetNetListerCommand( wxEmptyString ); - m_Parent->CreateNetlist( currPage->m_IdNetType, fullfilename, netlist_opt ); + m_Parent->CreateNetlist( currPage->m_IdNetType, fullpath, netlist_opt ); WriteCurrentNetlistSetup(); 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, wxString * aExt, wxString * aWildCard ) { @@ -555,15 +694,7 @@ bool NETLIST_DIALOG::ReturnFilenamePrms( NETLIST_TYPE_ID aNetTypeId, 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, unsigned aNetlistOptions ) { @@ -592,7 +723,7 @@ Do you want to annotate schematic?" ) ) ) return false; } - /* Cleanup the entire hierarchy */ + // Cleanup the entire hierarchy SCH_SCREENS screens; screens.SchematicCleanUp(); @@ -621,7 +752,7 @@ void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event ) ExecFile = tmp.BeforeFirst( ' ' ); CommandLine = tmp.AfterFirst( ' ' ); - /* Calculate the netlist filename */ + // Calculate the netlist filename fn = g_RootSheet->GetScreen()->GetFileName(); fn.SetExt( wxT( "cir" ) ); CommandLine += wxT( " \"" ) + fn.GetFullPath() + wxT( "\"" ); @@ -643,11 +774,7 @@ void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event ) } -/** - * Function WriteCurrentNetlistSetup - * Write the current netlist options setup in the configuration - */ -void NETLIST_DIALOG::WriteCurrentNetlistSetup( void ) +void NETLIST_DIALOG::WriteCurrentNetlistSetup() { 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 ) { NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage(); @@ -715,10 +838,7 @@ void NETLIST_DIALOG::OnDelPlugin( wxCommandEvent& event ) EndModal( NET_PLUGIN_CHANGE ); } -/** - * Function OnAddPlugin - * Add a new panel for a new netlist plugin - */ + void NETLIST_DIALOG::OnAddPlugin( wxCommandEvent& event ) { NETLIST_DIALOG_ADD_PLUGIN dlg( this ); @@ -763,10 +883,7 @@ NETLIST_DIALOG_ADD_PLUGIN::NETLIST_DIALOG_ADD_PLUGIN( NETLIST_DIALOG* parent ) : GetSizer()->SetSizeHints( this ); } -/** - * Function OnOKClick - * Validate info relative to a new netlist plugin - */ + void NETLIST_DIALOG_ADD_PLUGIN::OnOKClick( wxCommandEvent& event ) { if( m_textCtrlCommand->GetValue() == wxEmptyString ) @@ -784,14 +901,13 @@ void NETLIST_DIALOG_ADD_PLUGIN::OnOKClick( wxCommandEvent& event ) EndModal( wxID_OK ); } + void NETLIST_DIALOG_ADD_PLUGIN::OnCancelClick( wxCommandEvent& event ) { EndModal( wxID_CANCEL ); } -/* - * Browse plugin files, and set m_CommandStringCtrl field - */ + void NETLIST_DIALOG_ADD_PLUGIN::OnBrowsePlugins( wxCommandEvent& event ) { wxString FullFileName, Mask, Path; @@ -834,3 +950,12 @@ void NETLIST_DIALOG_ADD_PLUGIN::OnBrowsePlugins( wxCommandEvent& event ) if( title.IsEmpty() ) 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(); +} + diff --git a/eeschema/dialogs/dialog_netlist.h b/eeschema/dialogs/dialog_netlist.h deleted file mode 100644 index 33311e4750..0000000000 --- a/eeschema/dialogs/dialog_netlist.h +++ /dev/null @@ -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 - * 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 - -#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_ */ diff --git a/eeschema/invoke_sch_dialog.h b/eeschema/invoke_sch_dialog.h index a1f6ffcc95..4cd27be957 100644 --- a/eeschema/invoke_sch_dialog.h +++ b/eeschema/invoke_sch_dialog.h @@ -65,5 +65,15 @@ int InvokeDialogPrintUsingPrinter( SCH_EDIT_FRAME* aCaller ); /// DIALOG_BOM::ShowModal() returns. 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_ diff --git a/eeschema/netform.cpp b/eeschema/netform.cpp index 1d5e1ae7b8..fbb16a245b 100644 --- a/eeschema/netform.cpp +++ b/eeschema/netform.cpp @@ -37,7 +37,6 @@ #include #include -#include #include #include #include diff --git a/eeschema/netlist.h b/eeschema/netlist.h index 2a3c439366..2dd7f977e7 100644 --- a/eeschema/netlist.h +++ b/eeschema/netlist.h @@ -39,6 +39,29 @@ #include +/// 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_REFERENC_LIST; @@ -46,7 +69,7 @@ class SCH_REFERENC_LIST; #define NETLIST_HEAD_STRING "EESchema Netlist Version 1.1" // Max pin number per component and footprint -#define MAXPIN 5000 +#define MAXPIN 5000 /** diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index 49fa8390e5..45ed6a8d91 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -44,7 +44,6 @@ #include #include -#include #include #include #include @@ -617,16 +616,15 @@ void SCH_EDIT_FRAME::OnErc( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnCreateNetlist( wxCommandEvent& event ) { - int i; + int result; do { - NETLIST_DIALOG* dlg = new NETLIST_DIALOG( this ); - i = dlg->ShowModal(); - dlg->Destroy(); - } while( i == NET_PLUGIN_CHANGE ); + result = InvokeDialogNetList( this ); - // 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 ); }