KiCad PCB EDA Suite
eeschema/dialogs/dialog_netlist.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2013-2017 Jean-Pierre Charras, jp.charras@wanadoo.fr
5  * Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
6  * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 /* Functions relative to the dialog creating the netlist for Pcbnew. The dialog is a notebook
27  * with 4 fixed netlist formats:
28  * Pcbnew
29  * ORCADPCB2
30  * CADSTAR
31  * SPICE
32  * and up to CUSTOMPANEL_COUNTMAX user programmable formats. These external converters are
33  * referred to as plugins, but they are really just external binaries.
34  */
35 
36 #include <fctsys.h>
37 #include <pgm_base.h>
38 #include <kiface_i.h>
39 #include <gestfich.h>
40 #include <sch_edit_frame.h>
41 #include <general.h>
42 #include <netlist.h>
43 #include <dialogs/dialog_netlist_base.h>
45 #include <invoke_sch_dialog.h>
47 #include <eeschema_settings.h>
48 #include <schematic.h>
49 
50 #include <eeschema_id.h>
51 #include <wx/regex.h>
52 
53 
54 #define CUSTOMPANEL_COUNTMAX 8 // Max number of netlist plugins
55 
56 
57 /* panel (notebook page) identifiers */
59  PANELPCBNEW = 0, /* Handle Netlist format Pcbnew */
60  PANELORCADPCB2, /* Handle Netlist format OracdPcb2 */
61  PANELCADSTAR, /* Handle Netlist format CadStar */
62  PANELSPICE, /* Handle Netlist format Pspice */
63  PANELCUSTOMBASE /* First auxiliary panel (custom netlists).
64  * others use PANELCUSTOMBASE+1, PANELCUSTOMBASE+2.. */
65 };
66 
67 
68 /* wxPanels for creating the NoteBook pages for each netlist format: */
69 class NETLIST_PAGE_DIALOG : public wxPanel
70 {
71 public:
73  wxCheckBox* m_IsCurrentFormat;
74  // opt to reformat passive component values (e.g. 1M -> 1Meg):
75  wxCheckBox* m_AdjustPassiveValues;
76  wxTextCtrl* m_CommandStringCtrl;
77  wxTextCtrl* m_TitleStringCtrl;
78  wxBoxSizer* m_LeftBoxSizer;
79  wxBoxSizer* m_RightBoxSizer;
81  wxBoxSizer* m_LowBoxSizer;
82 
83 private:
84  wxString m_pageNetFmtName;
85 
86 public:
93  NETLIST_PAGE_DIALOG( wxNotebook* parent, const wxString& title,
94  NETLIST_TYPE_ID id_NetType );
96 
102  const wxString GetPageNetFmtName() { return m_pageNetFmtName; }
103 };
104 
105 
106 /* Dialog frame for creating netlists */
108 {
109  friend class NETLIST_PAGE_DIALOG;
110 
111 public:
115 
116 protected:
118 
119 public:
120  // Constructor and destructor
121  NETLIST_DIALOG( SCH_EDIT_FRAME* parent );
123 
124 private:
125  void InstallCustomPages();
126  NETLIST_PAGE_DIALOG* AddOneCustomPage( const wxString & aTitle,
127  const wxString & aCommandString,
128  NETLIST_TYPE_ID aNetTypeId );
129  void InstallPageSpice();
130  bool TransferDataFromWindow() override;
131  void NetlistUpdateOpt();
132 
133  // Called when changing the notebook page (and therefore the current netlist format)
134  void OnNetlistTypeSelection( wxNotebookEvent& event ) override;
135 
136  // called when checking the "Default format" wxCheckBox in the current page of the notbook
137  void SelectDefaultNetlistType( wxCommandEvent& event );
138 
143  void OnAddGenerator( wxCommandEvent& event ) override;
144 
149  void OnDelGenerator( wxCommandEvent& event ) override;
150 
156 
166  bool FilenamePrms( NETLIST_TYPE_ID aType,
167  wxString * aExt, wxString * aWildCard );
168 
169  DECLARE_EVENT_TABLE()
170 };
171 
172 
174 {
175 private:
177 
178 public:
180 
181  const wxString GetGeneratorTitle() { return m_textCtrlName->GetValue(); }
182  const wxString GetGeneratorTCommandLine() { return m_textCtrlCommand->GetValue(); }
183 
184 private:
189  void OnOKClick( wxCommandEvent& event ) override;
190 
191  /*
192  * Browse plugin files, and set m_CommandStringCtrl field
193  */
194  void OnBrowseGenerators( wxCommandEvent& event ) override;
195 };
196 
197 
198 /* Event id for notebook page buttons: */
204 };
205 
206 
207 BEGIN_EVENT_TABLE( NETLIST_DIALOG, NETLIST_DIALOG_BASE )
209 END_EVENT_TABLE()
210 
211 
212 
214  const wxString& title,
215  NETLIST_TYPE_ID id_NetType ) :
216  wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL )
217 {
218  m_IdNetType = id_NetType;
219  m_pageNetFmtName = title;
220  m_CommandStringCtrl = NULL;
221  m_TitleStringCtrl = NULL;
222  m_IsCurrentFormat = NULL;
223  m_AdjustPassiveValues = NULL;
224 
225  wxString netfmtName = ((NETLIST_DIALOG*)parent->GetParent())->m_DefaultNetFmtName;
226 
227  bool selected = m_pageNetFmtName == netfmtName;
228 
229  parent->AddPage( this, title, selected );
230 
231  wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxVERTICAL );
232  SetSizer( MainBoxSizer );
233  wxBoxSizer* UpperBoxSizer = new wxBoxSizer( wxHORIZONTAL );
234  m_LowBoxSizer = new wxBoxSizer( wxVERTICAL );
235  MainBoxSizer->Add( UpperBoxSizer, 0, wxGROW | wxALL, 5 );
236  MainBoxSizer->Add( m_LowBoxSizer, 0, wxGROW | wxALL, 5 );
237 
238  m_LeftBoxSizer = new wxBoxSizer( wxVERTICAL );
239  m_RightBoxSizer = new wxBoxSizer( wxVERTICAL );
240  m_RightOptionsBoxSizer = new wxBoxSizer( wxVERTICAL );
241  UpperBoxSizer->Add( m_LeftBoxSizer, 0, wxGROW | wxALL, 5 );
242  UpperBoxSizer->Add( m_RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
243  UpperBoxSizer->Add( m_RightOptionsBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
244 
245  wxStaticText* text = new wxStaticText( this, -1, _( "Options:" ) );
246  m_LeftBoxSizer->Add( text, 0, wxGROW | wxBOTTOM | wxRIGHT, 5 );
247 
248  m_IsCurrentFormat = new wxCheckBox( this, ID_CURRENT_FORMAT_IS_DEFAULT, _( "Default format" ) );
249  m_LeftBoxSizer->Add( m_IsCurrentFormat, 0, wxGROW | wxBOTTOM | wxRIGHT, 5 );
250  m_IsCurrentFormat->SetValue( selected );
251 
252  if( selected )
253  ((NETLIST_DIALOG*)parent->GetParent())->m_asFormatSelected = true;
254 }
255 
256 
257 
259  NETLIST_DIALOG_BASE( parent )
260 {
261  m_Parent = parent;
262 
264 
265  for( NETLIST_PAGE_DIALOG*& page : m_PanelNetType)
266  page = NULL;
267 
268  // Add notebook pages:
269  m_asFormatSelected = false; // Will be set to true, if a format is selected
270 
271  m_PanelNetType[PANELPCBNEW] = new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "Pcbnew" ),
272  NET_TYPE_PCBNEW );
273 
274  m_PanelNetType[PANELORCADPCB2] = new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "OrcadPCB2" ),
276 
277  m_PanelNetType[PANELCADSTAR] = new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "CadStar" ),
279 
282 
283  // Ensure a netlist format is selected:
284  if( !m_asFormatSelected )
285  {
286  m_PanelNetType[PANELPCBNEW]->m_IsCurrentFormat->SetValue( true );
287  m_NoteBook->SetSelection( PANELPCBNEW );
289  // call OnNetlistTypeSelection to update some widgets.
290  // SetSelection() do nothing if the current page is already PANELPCBNEW
291  wxNotebookEvent event;
292  OnNetlistTypeSelection( event );
293  }
294 
295  // We use a sdbSizer here to get the order right, which is platform-dependent
296  m_sdbSizer2OK->SetLabel( _( "Export Netlist" ) );
297  m_sdbSizer2Cancel->SetLabel( _( "Close" ) );
298  m_buttonSizer->Layout();
299 
300  m_sdbSizer2OK->SetDefault();
301 
302  // Now all widgets have the size fixed, call FinishDialogSettings
304 }
305 
306 
308 {
310  new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "Spice" ), NET_TYPE_SPICE );
311 
312  page->m_AdjustPassiveValues = new wxCheckBox( page, ID_USE_NETCODE_AS_NETNAME,
313  _( "Reformat passive symbol values" ) );
314  page->m_AdjustPassiveValues->SetToolTip( _( "Reformat passive symbol values e.g. 1M -> 1Meg" ) );
316  page->m_LeftBoxSizer->Add( page->m_AdjustPassiveValues, 0, wxGROW | wxBOTTOM | wxRIGHT, 5 );
317 }
318 
319 
321 {
322  NETLIST_PAGE_DIALOG* currPage;
323 
324  auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
325  wxASSERT( cfg );
326 
327  if( cfg )
328  {
329  for( size_t i = 0;
330  i < CUSTOMPANEL_COUNTMAX && i < cfg->m_NetlistPanel.custom_command_titles.size();
331  i++ )
332  {
333  // pairs of (title, command) are stored
334  wxString title = cfg->m_NetlistPanel.custom_command_titles[i];
335 
336  if( i >= cfg->m_NetlistPanel.custom_command_paths.size() )
337  break; // No more panel to install
338 
339  wxString command = cfg->m_NetlistPanel.custom_command_paths[i];
340 
341  currPage = AddOneCustomPage( title, command,
342  static_cast<NETLIST_TYPE_ID>( NET_TYPE_CUSTOM1 + i ) );
343 
344  m_PanelNetType[PANELCUSTOMBASE + i] = currPage;
345  }
346  }
347 }
348 
349 
351  const wxString & aCommandString,
352  NETLIST_TYPE_ID aNetTypeId )
353 {
354  NETLIST_PAGE_DIALOG* currPage = new NETLIST_PAGE_DIALOG( m_NoteBook, aTitle, aNetTypeId );
355 
356  currPage->m_LowBoxSizer->Add( new wxStaticText( currPage, -1, _( "Title:" ) ), 0,
357  wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
358 
359  currPage->m_TitleStringCtrl = new wxTextCtrl( currPage, -1, aTitle,
360  wxDefaultPosition, wxDefaultSize );
361 
362  currPage->m_TitleStringCtrl->SetInsertionPoint( 1 );
363  currPage->m_LowBoxSizer->Add( currPage->m_TitleStringCtrl, 0,
364  wxGROW | wxTOP | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
365 
366  currPage->m_LowBoxSizer->Add( new wxStaticText( currPage, -1, _( "Netlist command:" ) ), 0,
367  wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
368 
369  currPage->m_CommandStringCtrl = new wxTextCtrl( currPage, -1, aCommandString,
370  wxDefaultPosition, wxDefaultSize );
371 
372  currPage->m_CommandStringCtrl->SetInsertionPoint( 1 );
373  currPage->m_LowBoxSizer->Add( currPage->m_CommandStringCtrl, 0,
374  wxGROW | wxTOP | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
375 
376  return currPage;
377 }
378 
379 
380 void NETLIST_DIALOG::SelectDefaultNetlistType( wxCommandEvent& event )
381 {
382  for( NETLIST_PAGE_DIALOG*& page : m_PanelNetType)
383  {
384  if( page )
385  page->m_IsCurrentFormat->SetValue( false );
386  }
387 
388  NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
389 
390  if( currPage == NULL )
391  return;
392 
395  currPage->m_IsCurrentFormat->SetValue( true );
396 }
397 
398 
399 void NETLIST_DIALOG::OnNetlistTypeSelection( wxNotebookEvent& event )
400 {
401  NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
402 
403  if( currPage == NULL )
404  return;
405 
406  m_buttonDelGenerator->Enable( currPage->m_IdNetType >= NET_TYPE_CUSTOM1 );
407 }
408 
409 
411 {
412  bool adjust = m_PanelNetType[ PANELSPICE ]->m_AdjustPassiveValues->IsChecked();
413 
415  m_Parent->SetNetListFormatName( wxEmptyString );
416 
417  for( NETLIST_PAGE_DIALOG*& page : m_PanelNetType)
418  {
419  if( page == NULL )
420  break;
421 
422  if( page->m_IsCurrentFormat->GetValue() == true )
423  m_Parent->SetNetListFormatName( page->GetPageNetFmtName() );
424  }
425 }
426 
427 
429 {
430  wxFileName fn;
431  wxString fileWildcard;
432  wxString fileExt;
433  wxString title = _( "Save Netlist File" );
434 
436 
437  NETLIST_PAGE_DIALOG* currPage;
438  currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
439 
440  unsigned netlist_opt = 0;
441 
442  // Calculate the netlist filename
443  fn = m_Parent->Schematic().GetFileName();
444  FilenamePrms( currPage->m_IdNetType, &fileExt, &fileWildcard );
445 
446  // Set some parameters
447  switch( currPage->m_IdNetType )
448  {
449  case NET_TYPE_SPICE:
450  // Set spice netlist options:
451  if( currPage->m_AdjustPassiveValues->GetValue() )
452  netlist_opt |= NET_ADJUST_PASSIVE_VALS;
453  break;
454 
455  case NET_TYPE_CADSTAR:
456  break;
457 
458  case NET_TYPE_PCBNEW:
459  break;
460 
461  case NET_TYPE_ORCADPCB2:
462  break;
463 
464  default: // custom, NET_TYPE_CUSTOM1 and greater
465  {
466  wxString command = currPage->m_CommandStringCtrl->GetValue();
467  wxRegEx extRE( wxT( ".*\\.([[:alnum:]][[:alnum:]][[:alnum:]][[:alnum:]]?)\\.xslt?\".*" ) );
468 
469  if( extRE.Matches( command ) )
470  fileExt = extRE.GetMatch( command, 1 );
471 
472  title.Printf( _( "%s Export" ), currPage->m_TitleStringCtrl->GetValue().GetData() );
473  }
474  break;
475  }
476 
477  fn.SetExt( fileExt );
478 
479  if( fn.GetPath().IsEmpty() )
480  fn.SetPath( wxPathOnly( Prj().GetProjectFullName() ) );
481 
482  wxString fullpath = fn.GetFullPath();
483  wxString fullname = fn.GetFullName();
484  wxString path = fn.GetPath();
485 
486  // fullname does not and should not include the path, per wx docs.
487  wxFileDialog dlg( this, title, path, fullname, fileWildcard, wxFD_SAVE );
488 
489  if( dlg.ShowModal() == wxID_CANCEL )
490  return false;
491 
492  fullpath = dlg.GetPath(); // directory + filename
493 
495 
496  if( currPage->m_CommandStringCtrl )
497  m_Parent->SetNetListerCommand( currPage->m_CommandStringCtrl->GetValue() );
498  else
499  m_Parent->SetNetListerCommand( wxEmptyString );
500 
501  if( m_Parent->ReadyToNetlist( false, false ) )
502  m_Parent->WriteNetListFile( currPage->m_IdNetType, fullpath, netlist_opt, nullptr );
503  else
504  wxMessageBox( _( "Schematic netlist not available" ) );
505 
507 
508  return true;
509 }
510 
511 
512 bool NETLIST_DIALOG::FilenamePrms( NETLIST_TYPE_ID aType, wxString * aExt, wxString * aWildCard )
513 {
514  wxString fileExt;
515  wxString fileWildcard;
516  bool ret = true;
517 
518  switch( aType )
519  {
520  case NET_TYPE_SPICE:
521  fileExt = wxT( "cir" );
522  fileWildcard = SpiceNetlistFileWildcard();
523  break;
524 
525  case NET_TYPE_CADSTAR:
526  fileExt = wxT( "frp" );
527  fileWildcard = CadstarNetlistFileWildcard();
528  break;
529 
530  case NET_TYPE_PCBNEW:
531  case NET_TYPE_ORCADPCB2:
532  fileExt = NetlistFileExtension;
533  fileWildcard = NetlistFileWildcard();
534  break;
535 
536  default: // custom, NET_TYPE_CUSTOM1 and greater
537  fileWildcard = AllFilesWildcard();
538  ret = false;
539  }
540 
541  if( aExt )
542  *aExt = fileExt;
543 
544  if( aWildCard )
545  *aWildCard = fileWildcard;
546 
547  return ret;
548 }
549 
550 
552 {
553  wxString msg;
554 
556 
557  EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
558  wxASSERT( cfg );
559 
560  if( cfg )
561  {
564 
565  // Update existing custom pages
566  for( int ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ )
567  {
569 
570  if( currPage == NULL )
571  break;
572 
573  wxString title = currPage->m_TitleStringCtrl->GetValue();
574 
575  if( title.IsEmpty() )
576  continue;
577 
578  cfg->m_NetlistPanel.custom_command_titles.emplace_back( title.ToStdString() );
579  cfg->m_NetlistPanel.custom_command_paths.emplace_back(
580  currPage->m_CommandStringCtrl->GetValue().ToStdString() );
581  }
582  }
583 }
584 
585 
586 void NETLIST_DIALOG::OnDelGenerator( wxCommandEvent& event )
587 {
588  NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
589 
590  currPage->m_CommandStringCtrl->SetValue( wxEmptyString );
591  currPage->m_TitleStringCtrl->SetValue( wxEmptyString );
592 
593  if( currPage->m_IsCurrentFormat->IsChecked() )
594  {
595  currPage->m_IsCurrentFormat->SetValue( false );
596  m_PanelNetType[PANELPCBNEW]->m_IsCurrentFormat->SetValue( true );
597  }
598 
600  EndModal( NET_PLUGIN_CHANGE );
601 }
602 
603 
604 void NETLIST_DIALOG::OnAddGenerator( wxCommandEvent& event )
605 {
606  NETLIST_DIALOG_ADD_GENERATOR dlg( this );
607 
608  if( dlg.ShowModal() != wxID_OK )
609  return;
610 
611  // Creates a new custom plugin page
612  wxString title = dlg.GetGeneratorTitle();
613 
614  // Verify it does not exists
615  int netTypeId = PANELCUSTOMBASE; // the first not used type id
616  NETLIST_PAGE_DIALOG* currPage;
617 
618  for( int ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ )
619  {
620  netTypeId = PANELCUSTOMBASE + ii;
621  currPage = m_PanelNetType[ii + PANELCUSTOMBASE];
622 
623  if( currPage == NULL )
624  break;
625 
626  if( currPage->GetPageNetFmtName() == title )
627  {
628  wxMessageBox( _("This plugin already exists.") );
629  return;
630  }
631  }
632 
633  wxString cmd = dlg.GetGeneratorTCommandLine();
634  currPage = AddOneCustomPage( title,cmd, (NETLIST_TYPE_ID)netTypeId );
635  m_PanelNetType[netTypeId] = currPage;
637 
638  // Close and reopen dialog to rebuild the dialog after changes
639  EndModal( NET_PLUGIN_CHANGE );
640 }
641 
642 
645 {
646  m_Parent = parent;
647  m_sdbSizerOK->SetDefault();
648  GetSizer()->SetSizeHints( this );
649 }
650 
651 
652 void NETLIST_DIALOG_ADD_GENERATOR::OnOKClick( wxCommandEvent& event )
653 {
654  if( m_textCtrlCommand->GetValue() == wxEmptyString )
655  {
656  wxMessageBox( _( "Error. You must provide a command String" ) );
657  return;
658  }
659 
660  if( m_textCtrlName->GetValue() == wxEmptyString )
661  {
662  wxMessageBox( _( "Error. You must provide a Title" ) );
663  return;
664  }
665 
666  EndModal( wxID_OK );
667 }
668 
669 
671 {
672  wxString FullFileName, Path;
673 
674 #ifndef __WXMAC__
675  Path = Pgm().GetExecutablePath();
676 #else
677  Path = GetOSXKicadDataDir() + wxT( "/plugins" );
678 #endif
679  FullFileName = EDA_FILE_SELECTOR( _( "Generator files:" ), Path, FullFileName,
680  wxEmptyString, wxFileSelectorDefaultWildcardStr,
681  this, wxFD_OPEN, true );
682  if( FullFileName.IsEmpty() )
683  return;
684 
685  // Creates a default command line, suitable for external tool xslproc or python, based on
686  // the plugin extension ("xsl" or "exe" or "py")
687  wxString cmdLine;
688  wxFileName fn( FullFileName );
689  wxString ext = fn.GetExt();
690 
691  if( ext == wxT("xsl" ) )
692  cmdLine.Printf(wxT("xsltproc -o \"%%O\" \"%s\" \"%%I\""), GetChars(FullFileName) );
693  else if( ext == wxT("exe" ) || ext.IsEmpty() )
694  cmdLine.Printf(wxT("\"%s\" > \"%%O\" < \"%%I\""), GetChars(FullFileName) );
695  else if( ext == wxT("py" ) || ext.IsEmpty() )
696  cmdLine.Printf(wxT("python \"%s\" \"%%I\" \"%%O\""), GetChars(FullFileName) );
697  else
698  cmdLine.Printf(wxT("\"%s\""), GetChars(FullFileName) );
699 
700  m_textCtrlCommand->SetValue( cmdLine );
701 
702  /* Get a title for this page */
703  wxString title = m_textCtrlName->GetValue();
704 
705  if( title.IsEmpty() )
706  wxMessageBox( _( "Do not forget to choose a title for this netlist control page" ) );
707 }
708 
709 
711 {
712  NETLIST_DIALOG dlg( aCaller );
713 
714  wxString curr_default_netformat = aCaller->GetNetListFormatName();
715 
716  int ret = dlg.ShowModal();
717 
718  // Update the default netlist and store it in prj config if it was explicitely changed.
719  aCaller->SetNetListFormatName( dlg.m_DefaultNetFmtName ); // can have temporary changed
720 
721  if( curr_default_netformat != dlg.m_DefaultNetFmtName )
722  aCaller->SaveProjectSettings();
723 
724  return ret;
725 }
const std::string NetlistFileExtension
void OnDelGenerator(wxCommandEvent &event) override
Function OnDelGenerator Remove a panel relative to a netlist plugin.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:104
bool WriteNetListFile(int aFormat, const wxString &aFullFileName, unsigned aNetlistOptions, REPORTER *aReporter=NULL)
Create a netlist file.
This file is part of the common library TODO brief description.
void SaveProjectSettings() override
Save changes to the project settings to the project (.pro) file.
bool FilenamePrms(NETLIST_TYPE_ID aType, wxString *aExt, wxString *aWildCard)
Function FilenamePrms returns the filename extension and the wildcard string for this curr or a void ...
NETLIST_PAGE_DIALOG(wxNotebook *parent, const wxString &title, NETLIST_TYPE_ID id_NetType)
Constructor to create a setup page for one netlist format.
wxString SpiceNetlistFileWildcard()
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
const wxString & GetNetListFormatName() const
void OnOKClick(wxCommandEvent &event) override
Function OnOKClick Validate info relative to a new netlist plugin.
void OnAddGenerator(wxCommandEvent &event) override
Function OnAddGenerator Add a new panel for a new netlist plugin.
Schematic editor (Eeschema) main window.
bool ReadyToNetlist(bool aSilent=false, bool aSilentAnnotate=false)
Checks if we are ready to write a netlist file for the current schematic.
wxString GetFileName() const
Helper to retrieve the filename from the root sheet screen.
Definition: schematic.cpp:128
void SetSpiceAdjustPassiveValues(bool aEnable)
wxString AllFilesWildcard()
NETLIST_TYPE_ID
netlist types
Definition: netlist.h:35
Class NETLIST_DIALOG_ADD_GENERATOR_BASE.
std::vector< wxString > custom_command_titles
void WriteCurrentNetlistSetup()
Function WriteCurrentNetlistSetup Write the current netlist options setup in the configuration.
#define NULL
NETLIST_DIALOG(SCH_EDIT_FRAME *parent)
#define CUSTOMPANEL_COUNTMAX
wxString NetlistFileWildcard()
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
wxString EDA_FILE_SELECTOR(const wxString &aTitle, const wxString &aPath, const wxString &aFileName, const wxString &aExtension, const wxString &aWildcard, wxWindow *aParent, int aStyle, const bool aKeepWorkingDirectory, const wxPoint &aPosition, wxString *aMruPath)
Function EDA_FILE_SELECTOR.
Definition: gestfich.cpp:52
SCHEMATIC & Schematic() const
Definition of file extensions used in Kicad.
void OnBrowseGenerators(wxCommandEvent &event) override
virtual void ClearMsgPanel()
Clear all messages from the message panel.
NETLIST_PAGE_DIALOG * m_PanelNetType[4+CUSTOMPANEL_COUNTMAX]
NETLIST_PAGE_DIALOG * AddOneCustomPage(const wxString &aTitle, const wxString &aCommandString, NETLIST_TYPE_ID aNetTypeId)
void SetNetListFormatName(const wxString &aFormat)
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:153
see class PGM_BASE
#define _(s)
Definition: 3d_actions.cpp:33
#define NET_PLUGIN_CHANGE
Create and shows NETLIST_DIALOG and returns whatever NETLIST_DIALOG::ShowModal() returns.
std::vector< wxString > custom_command_paths
bool GetSpiceAjustPassiveValues() const
void SetNetListerCommand(const wxString &aCommand)
void OnNetlistTypeSelection(wxNotebookEvent &event) override
PANEL_NETLIST m_NetlistPanel
const wxString GetPageNetFmtName()
function GetPageNetFmtName
int InvokeDialogNetList(SCH_EDIT_FRAME *aCaller)
void SelectDefaultNetlistType(wxCommandEvent &event)
wxString CadstarNetlistFileWildcard()