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-2021 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 <pgm_base.h>
37 #include <kiface_base.h>
38 #include <gestfich.h>
39 #include <sch_edit_frame.h>
40 #include <general.h>
41 #include <netlist.h>
42 #include <dialogs/dialog_netlist_base.h>
44 #include <invoke_sch_dialog.h>
46 #include <eeschema_settings.h>
47 #include <schematic.h>
48 #include <paths.h>
49 
50 #include <eeschema_id.h>
51 #include <wx/checkbox.h>
52 #include <wx/filedlg.h>
53 #include <wx/msgdlg.h>
54 #include <wx/regex.h>
55 
56 
57 
58 #define CUSTOMPANEL_COUNTMAX 8 // Max number of netlist plugins
59 
60 
61 /* panel (notebook page) identifiers */
63  PANELPCBNEW = 0, /* Handle Netlist format Pcbnew */
64  PANELORCADPCB2, /* Handle Netlist format OracdPcb2 */
65  PANELCADSTAR, /* Handle Netlist format CadStar */
66  PANELSPICE, /* Handle Netlist format Pspice */
67  PANELCUSTOMBASE /* First auxiliary panel (custom netlists).
68  * others use PANELCUSTOMBASE+1, PANELCUSTOMBASE+2.. */
69 };
70 
71 
72 /* wxPanels for creating the NoteBook pages for each netlist format: */
73 class NETLIST_PAGE_DIALOG : public wxPanel
74 {
75 
76 public:
86  NETLIST_PAGE_DIALOG( wxNotebook* parent, const wxString& title,
87  NETLIST_TYPE_ID id_NetType );
89 
93  const wxString GetPageNetFmtName() { return m_pageNetFmtName; }
94 
96  // opt to reformat passive component values (e.g. 1M -> 1Meg):
97  wxCheckBox* m_AdjustPassiveValues;
98  wxTextCtrl* m_CommandStringCtrl;
99  wxTextCtrl* m_TitleStringCtrl;
100  wxBoxSizer* m_LeftBoxSizer;
101  wxBoxSizer* m_RightBoxSizer;
103  wxBoxSizer* m_LowBoxSizer;
104 
105 private:
107 };
108 
109 
110 /* Dialog frame for creating netlists */
112 {
113 public:
114  NETLIST_DIALOG( SCH_EDIT_FRAME* parent );
116 
117 private:
118  friend class NETLIST_PAGE_DIALOG;
119 
120  void InstallCustomPages();
121  NETLIST_PAGE_DIALOG* AddOneCustomPage( const wxString & aTitle,
122  const wxString & aCommandString,
123  NETLIST_TYPE_ID aNetTypeId );
124  void InstallPageSpice();
125  bool TransferDataFromWindow() override;
126  void NetlistUpdateOpt();
127 
128  // Called when changing the notebook page (and therefore the current netlist format)
129  void OnNetlistTypeSelection( wxNotebookEvent& event ) override;
130 
134  void OnAddGenerator( wxCommandEvent& event ) override;
135 
139  void OnDelGenerator( wxCommandEvent& event ) override;
140 
144  void OnRunExternSpiceCommand( wxCommandEvent& event );
145 
149  void OnRunSpiceButtUI( wxUpdateUIEvent& event );
150 
155 
165  bool FilenamePrms( NETLIST_TYPE_ID aType, wxString* aExt, wxString* aWildCard );
166 
168 
169 public:
173 };
174 
175 
177 {
178 public:
180 
181  const wxString GetGeneratorTitle() { return m_textCtrlName->GetValue(); }
182  const wxString GetGeneratorTCommandLine() { return m_textCtrlCommand->GetValue(); }
183 
184  bool TransferDataFromWindow() override;
185 
186 private:
187  /*
188  * Browse plugin files, and set m_CommandStringCtrl field
189  */
190  void OnBrowseGenerators( wxCommandEvent& event ) override;
191 
193 };
194 
195 
196 /* Event id for notebook page buttons: */
201 };
202 
203 
204 BEGIN_EVENT_TABLE( NETLIST_DIALOG, NETLIST_DIALOG_BASE )
207 END_EVENT_TABLE()
208 
209 
210 NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent, const wxString& title,
211  NETLIST_TYPE_ID id_NetType ) :
212  wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL )
213 {
214  m_IdNetType = id_NetType;
215  m_pageNetFmtName = title;
216  m_CommandStringCtrl = nullptr;
217  m_TitleStringCtrl = nullptr;
218  m_AdjustPassiveValues = nullptr;
219 
220  wxString netfmtName = static_cast<NETLIST_DIALOG*>( parent->GetParent() )->m_DefaultNetFmtName;
221 
222  bool selected = m_pageNetFmtName == netfmtName;
223 
224  parent->AddPage( this, title, selected );
225 
226  wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxVERTICAL );
227  SetSizer( MainBoxSizer );
228  wxBoxSizer* UpperBoxSizer = new wxBoxSizer( wxHORIZONTAL );
229  m_LowBoxSizer = new wxBoxSizer( wxVERTICAL );
230  MainBoxSizer->Add( UpperBoxSizer, 0, wxGROW | wxALL, 5 );
231  MainBoxSizer->Add( m_LowBoxSizer, 0, wxGROW | wxALL, 5 );
232 
233  m_LeftBoxSizer = new wxBoxSizer( wxVERTICAL );
234  m_RightBoxSizer = new wxBoxSizer( wxVERTICAL );
235  m_RightOptionsBoxSizer = new wxBoxSizer( wxVERTICAL );
236  UpperBoxSizer->Add( m_LeftBoxSizer, 0, wxGROW | wxALL, 5 );
237  UpperBoxSizer->Add( m_RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
238  UpperBoxSizer->Add( m_RightOptionsBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
239 }
240 
241 
243  NETLIST_DIALOG_BASE( parent )
244 {
245  m_Parent = parent;
246 
248 
250 
251  for( NETLIST_PAGE_DIALOG*& page : m_PanelNetType)
252  page = nullptr;
253 
254  // Add notebook pages:
256  NET_TYPE_PCBNEW );
257 
258  m_PanelNetType[PANELORCADPCB2] = new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "OrcadPCB2" ),
260 
261  m_PanelNetType[PANELCADSTAR] = new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "CadStar" ),
263 
266 
267  // We use a sdbSizer here to get the order right, which is platform-dependent
268  m_sdbSizer2OK->SetLabel( _( "Export Netlist" ) );
269  m_sdbSizer2Cancel->SetLabel( _( "Close" ) );
270  m_buttonSizer->Layout();
271 
272  m_sdbSizer2OK->SetDefault();
273 
274  // Now all widgets have the size fixed, call FinishDialogSettings
276 }
277 
278 
279 void NETLIST_DIALOG::OnRunExternSpiceCommand( wxCommandEvent& event )
280 {
281  // Run the external spice simulator command
283 
285  wxString simulatorCommand = settings.m_SpiceCommandString;
286 
287  unsigned netlist_opt = 0;
288 
289  // Calculate the netlist filename and options
290  wxFileName fn = m_Parent->Schematic().GetFileName();
291  fn.SetExt( wxT( "cir" ) );
292 
293  if( settings.m_SpiceAdjustPassiveValues )
294  netlist_opt |= NET_ADJUST_PASSIVE_VALS;
295 
296  // Build the command line
297  wxString commandLine = simulatorCommand;
298  commandLine.Replace( "%I", fn.GetFullPath(), true );
299 
300  if( m_Parent->ReadyToNetlist( _( "Simulator requires a fully annotated schematic." ) ) )
301  {
302  m_Parent->WriteNetListFile( NET_TYPE_SPICE, fn.GetFullPath(), netlist_opt, nullptr );
303  wxExecute( commandLine, wxEXEC_ASYNC );
304  }
305 }
306 
307 
308 void NETLIST_DIALOG::OnRunSpiceButtUI( wxUpdateUIEvent& aEvent )
309 {
310  bool disable = m_PanelNetType[PANELSPICE]->m_CommandStringCtrl->IsEmpty();
311  aEvent.Enable( !disable );
312 }
313 
314 
316 {
318  new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "Spice" ), NET_TYPE_SPICE );
319 
321 
322  page->m_AdjustPassiveValues = new wxCheckBox( page, ID_USE_NETCODE_AS_NETNAME,
323  _( "Reformat passive symbol values" ) );
324  page->m_AdjustPassiveValues->SetToolTip( _( "Reformat passive symbol values e.g. 1M -> 1Meg" ) );
325  page->m_AdjustPassiveValues->SetValue( settings.m_SpiceAdjustPassiveValues );
326  page->m_LeftBoxSizer->Add( page->m_AdjustPassiveValues, 0, wxGROW | wxBOTTOM | wxRIGHT, 5 );
327 
328  wxString simulatorCommand = settings.m_SpiceCommandString;
329  wxStaticText* spice_label = new wxStaticText( page, -1, _( "External simulator command:" ) );
330  spice_label->SetToolTip( _( "Enter the command line to run spice\n"
331  "Usually <path to spice binary> %I\n"
332  "%I will be replaced by the actual spice netlist name" ) );
333  page->m_LowBoxSizer->Add( spice_label, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
334 
335  page->m_CommandStringCtrl = new wxTextCtrl( page, -1, simulatorCommand,
336  wxDefaultPosition, wxDefaultSize );
337 
338  page->m_CommandStringCtrl->SetInsertionPoint( 1 );
339  page->m_LowBoxSizer->Add( page->m_CommandStringCtrl, 0,
340  wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
341 
342  // Add button to run spice command
343  wxButton* button = new wxButton( page, ID_RUN_SIMULATOR,
344  _( "Create Netlist and Run Simulator Command" ) );
345  page->m_LowBoxSizer->Add( button, 0, wxGROW | wxBOTTOM | wxLEFT | wxRIGHT, 5 );
346 }
347 
348 
350 {
351  NETLIST_PAGE_DIALOG* currPage;
352 
353  auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
354  wxASSERT( cfg );
355 
356  if( cfg )
357  {
358  for( size_t i = 0;
359  i < CUSTOMPANEL_COUNTMAX && i < cfg->m_NetlistPanel.plugins.size();
360  i++ )
361  {
362  // pairs of (title, command) are stored
363  wxString title = cfg->m_NetlistPanel.plugins[i].name;
364 
365  if( i >= cfg->m_NetlistPanel.plugins.size() )
366  break; // No more panel to install
367 
368  wxString command = cfg->m_NetlistPanel.plugins[i].command;
369 
370  currPage = AddOneCustomPage( title, command,
371  static_cast<NETLIST_TYPE_ID>( NET_TYPE_CUSTOM1 + i ) );
372 
373  m_PanelNetType[PANELCUSTOMBASE + i] = currPage;
374  }
375  }
376 }
377 
378 
380  const wxString& aCommandString,
381  NETLIST_TYPE_ID aNetTypeId )
382 {
383  NETLIST_PAGE_DIALOG* currPage = new NETLIST_PAGE_DIALOG( m_NoteBook, aTitle, aNetTypeId );
384 
385  currPage->m_LowBoxSizer->Add( new wxStaticText( currPage, -1, _( "Title:" ) ), 0,
386  wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
387 
388  currPage->m_TitleStringCtrl = new wxTextCtrl( currPage, -1, aTitle,
389  wxDefaultPosition, wxDefaultSize );
390 
391  currPage->m_TitleStringCtrl->SetInsertionPoint( 1 );
392  currPage->m_LowBoxSizer->Add( currPage->m_TitleStringCtrl, 0,
393  wxGROW | wxTOP | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
394 
395  currPage->m_LowBoxSizer->Add( new wxStaticText( currPage, -1, _( "Netlist command:" ) ), 0,
396  wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
397 
398  currPage->m_CommandStringCtrl = new wxTextCtrl( currPage, -1, aCommandString,
399  wxDefaultPosition, wxDefaultSize );
400 
401  currPage->m_CommandStringCtrl->SetInsertionPoint( 1 );
402  currPage->m_LowBoxSizer->Add( currPage->m_CommandStringCtrl, 0,
403  wxGROW | wxTOP | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
404 
405  return currPage;
406 }
407 
408 
409 void NETLIST_DIALOG::OnNetlistTypeSelection( wxNotebookEvent& event )
410 {
411  NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
412 
413  if( currPage == nullptr )
414  return;
415 
417 
418  m_buttonDelGenerator->Enable( currPage->m_IdNetType >= NET_TYPE_CUSTOM1 );
419 }
420 
421 
423 {
424  bool adjust = m_PanelNetType[ PANELSPICE ]->m_AdjustPassiveValues->IsChecked();
425  wxString spice_cmd_string = m_PanelNetType[ PANELSPICE ]->m_CommandStringCtrl->GetValue();
426 
428 
429  settings.m_SpiceAdjustPassiveValues = adjust;
430  settings.m_SpiceCommandString = spice_cmd_string;
431  settings.m_NetFormatName = wxEmptyString;
433 }
434 
435 
437 {
438  wxFileName fn;
439  wxString fileWildcard;
440  wxString fileExt;
441  wxString title = _( "Save Netlist File" );
442 
444 
445  NETLIST_PAGE_DIALOG* currPage;
446  currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
447 
448  unsigned netlist_opt = 0;
449 
450  // Calculate the netlist filename
451  fn = m_Parent->Schematic().GetFileName();
452  FilenamePrms( currPage->m_IdNetType, &fileExt, &fileWildcard );
453 
454  // Set some parameters
455  switch( currPage->m_IdNetType )
456  {
457  case NET_TYPE_SPICE:
458  // Set spice netlist options:
459  if( currPage->m_AdjustPassiveValues->GetValue() )
460  netlist_opt |= NET_ADJUST_PASSIVE_VALS;
461  break;
462 
463  case NET_TYPE_CADSTAR:
464  break;
465 
466  case NET_TYPE_PCBNEW:
467  break;
468 
469  case NET_TYPE_ORCADPCB2:
470  break;
471 
472  default: // custom, NET_TYPE_CUSTOM1 and greater
473  {
474  title.Printf( _( "%s Export" ), currPage->m_TitleStringCtrl->GetValue() );
475  break;
476  }
477  }
478 
479  fn.SetExt( fileExt );
480 
481  if( fn.GetPath().IsEmpty() )
482  fn.SetPath( wxPathOnly( Prj().GetProjectFullName() ) );
483 
484  wxString fullpath = fn.GetFullPath();
485  wxString fullname = fn.GetFullName();
486  wxString path = fn.GetPath();
487 
488  // full name does not and should not include the path, per wx docs.
489  wxFileDialog dlg( this, title, path, fullname, fileWildcard, wxFD_SAVE );
490 
491  if( dlg.ShowModal() == wxID_CANCEL )
492  return false;
493 
494  fullpath = dlg.GetPath(); // directory + filename
495 
497 
498  if( currPage->m_CommandStringCtrl )
499  m_Parent->SetNetListerCommand( currPage->m_CommandStringCtrl->GetValue() );
500  else
501  m_Parent->SetNetListerCommand( wxEmptyString );
502 
503  if( m_Parent->ReadyToNetlist( _( "Exporting netlist requires a fully annotated schematic." ) ) )
504  m_Parent->WriteNetListFile( currPage->m_IdNetType, fullpath, netlist_opt, nullptr );
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  return;
562 
563  cfg->m_NetlistPanel.plugins.clear();
564 
565  // Update existing custom pages
566  for( int ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ )
567  {
569 
570  if( currPage == nullptr )
571  break;
572 
573  wxString title = currPage->m_TitleStringCtrl->GetValue();
574  wxString command = currPage->m_CommandStringCtrl->GetValue();
575 
576  if( title.IsEmpty() || command.IsEmpty() )
577  continue;
578 
579  cfg->m_NetlistPanel.plugins.emplace_back( title, wxEmptyString );
580  cfg->m_NetlistPanel.plugins.back().command = command;
581  }
582 }
583 
584 
585 void NETLIST_DIALOG::OnDelGenerator( wxCommandEvent& event )
586 {
587  NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
588 
589  currPage->m_CommandStringCtrl->SetValue( wxEmptyString );
590  currPage->m_TitleStringCtrl->SetValue( wxEmptyString );
592 
594 
595  if( IsQuasiModal() )
597  else
598  EndDialog( NET_PLUGIN_CHANGE );
599 }
600 
601 
602 void NETLIST_DIALOG::OnAddGenerator( wxCommandEvent& event )
603 {
604  NETLIST_DIALOG_ADD_GENERATOR dlg( this );
605 
606  if( dlg.ShowModal() != wxID_OK )
607  return;
608 
609  // Creates a new custom plugin page
610  wxString title = dlg.GetGeneratorTitle();
611 
612  // Verify it does not exists
613  int netTypeId = PANELCUSTOMBASE; // the first not used type id
614  NETLIST_PAGE_DIALOG* currPage;
615 
616  for( int ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ )
617  {
618  netTypeId = PANELCUSTOMBASE + ii;
619  currPage = m_PanelNetType[ii + PANELCUSTOMBASE];
620 
621  if( currPage == nullptr )
622  break;
623 
624  if( currPage->GetPageNetFmtName() == title )
625  {
626  wxMessageBox( _("This plugin already exists.") );
627  return;
628  }
629  }
630 
631  wxString cmd = dlg.GetGeneratorTCommandLine();
632  currPage = AddOneCustomPage( title,cmd, (NETLIST_TYPE_ID)netTypeId );
633  m_PanelNetType[netTypeId] = currPage;
635 
636  if( IsQuasiModal() )
638  else
639  EndDialog( NET_PLUGIN_CHANGE );
640 }
641 
642 
645 {
646  m_Parent = parent;
647  m_sdbSizerOK->SetDefault();
648  GetSizer()->SetSizeHints( this );
649 }
650 
651 
653 {
654  if( !wxDialog::TransferDataFromWindow() )
655  return false;
656 
657  if( m_textCtrlCommand->GetValue() == wxEmptyString )
658  {
659  wxMessageBox( _( "You must provide a netlist generator command string" ) );
660  return false;
661  }
662 
663  if( m_textCtrlName->GetValue() == wxEmptyString )
664  {
665  wxMessageBox( _( "You must provide a netlist generator title" ) );
666  return false;
667  }
668 
669  return true;
670 }
671 
672 
674 {
675  wxString FullFileName, Path;
676 
677 #ifndef __WXMAC__
678  Path = Pgm().GetExecutablePath();
679 #else
680  Path = PATHS::GetOSXKicadDataDir() + wxT( "/plugins" );
681 #endif
682 
683  FullFileName = wxFileSelector( _( "Generator File" ), Path, FullFileName,
684  wxEmptyString, wxFileSelectorDefaultWildcardStr,
685  wxFD_OPEN, this );
686 
687  if( FullFileName.IsEmpty() )
688  return;
689 
690  // Creates a default command line, suitable for external tool xslproc or python, based on
691  // the plugin extension ("xsl" or "exe" or "py")
692  wxString cmdLine;
693  wxFileName fn( FullFileName );
694  wxString ext = fn.GetExt();
695 
696  if( ext == wxT( "xsl" ) )
697  cmdLine.Printf( wxT( "xsltproc -o \"%%O\" \"%s\" \"%%I\"" ), FullFileName );
698  else if( ext == wxT( "exe" ) || ext.IsEmpty() )
699  cmdLine.Printf( wxT( "\"%s\" > \"%%O\" < \"%%I\"" ), FullFileName );
700  else if( ext == wxT( "py" ) || ext.IsEmpty() )
701  cmdLine.Printf( wxT( "python \"%s\" \"%%I\" \"%%O\"" ), FullFileName );
702  else
703  cmdLine.Printf( wxT( "\"%s\"" ), FullFileName );
704 
705  m_textCtrlCommand->SetValue( cmdLine );
706 
707  // We need a title for this panel
708  // Propose a default value if empty ( i.e. the short filename of the script)
709  if( m_textCtrlName->GetValue().IsEmpty() )
710  m_textCtrlName->SetValue( fn.GetName() );
711 }
712 
713 
715 {
716  NETLIST_DIALOG dlg( aCaller );
717 
718  SCHEMATIC_SETTINGS& settings = aCaller->Schematic().Settings();
719 
720  wxString curr_default_netformat = settings.m_NetFormatName;
721 
722  int ret = dlg.ShowModal();
723 
724  // Update the default netlist and store it in prj config if it was explicitly changed.
725  settings.m_NetFormatName = dlg.m_DefaultNetFmtName; // can have temporary changed
726 
727  if( curr_default_netformat != dlg.m_DefaultNetFmtName )
728  aCaller->SaveProjectSettings();
729 
730  return ret;
731 }
const std::string NetlistFileExtension
void OnDelGenerator(wxCommandEvent &event) override
Remove a panel relative to a netlist plugin.
bool ReadyToNetlist(const wxString &aAnnotateMessage)
Check if we are ready to write a netlist file for the current schematic.
void OnRunExternSpiceCommand(wxCommandEvent &event)
Run the external spice simulator command.
void SaveProjectSettings() override
Save changes to the project settings to the project (.pro) file.
bool FilenamePrms(NETLIST_TYPE_ID aType, wxString *aExt, wxString *aWildCard)
Return the filename extension and the wildcard string for this page or a void name if there is no def...
NETLIST_PAGE_DIALOG(wxNotebook *parent, const wxString &title, NETLIST_TYPE_ID id_NetType)
Create a setup page for one netlist format.
wxString SpiceNetlistFileWildcard()
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
EVT_UPDATE_UI(ID_LOAD_FOOTPRINT_FROM_BOARD, FOOTPRINT_EDIT_FRAME::OnUpdateLoadFootprintFromBoard) EVT_UPDATE_UI(ID_ADD_FOOTPRINT_TO_BOARD
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:167
bool IsQuasiModal() const
Definition: dialog_shim.h:106
void OnAddGenerator(wxCommandEvent &event) override
Add a new panel for a new netlist plugin.
Schematic editor (Eeschema) main window.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106
wxString AllFilesWildcard()
std::vector< NETLIST_PLUGIN_SETTINGS > plugins
NETLIST_TYPE_ID
netlist types
Definition: netlist.h:35
Class NETLIST_DIALOG_ADD_GENERATOR_BASE.
void WriteCurrentNetlistSetup()
Write the current netlist options setup in the configuration.
NETLIST_DIALOG(SCH_EDIT_FRAME *parent)
#define CUSTOMPANEL_COUNTMAX
bool WriteNetListFile(int aFormat, const wxString &aFullFileName, unsigned aNetlistOptions, REPORTER *aReporter=nullptr)
Create a netlist file.
wxString NetlistFileWildcard()
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
SCHEMATIC & Schematic() const
Definition of file extensions used in Kicad.
#define _(s)
wxString GetFileName() const override
Helper to retrieve the filename from the root sheet screen.
Definition: schematic.cpp:161
void OnBrowseGenerators(wxCommandEvent &event) override
virtual void ClearMsgPanel()
Clear all messages from the message panel.
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
NETLIST_PAGE_DIALOG * m_PanelNetType[4+CUSTOMPANEL_COUNTMAX]
void EndQuasiModal(int retCode)
NETLIST_PAGE_DIALOG * AddOneCustomPage(const wxString &aTitle, const wxString &aCommandString, NETLIST_TYPE_ID aNetTypeId)
see class PGM_BASE
#define NET_PLUGIN_CHANGE
Create and shows NETLIST_DIALOG and returns whatever NETLIST_DIALOG::ShowModal() returns.
These settings were stored in SCH_BASE_FRAME previously.
void OnRunSpiceButtUI(wxUpdateUIEvent &event)
Enable (if the command line is not empty or disable the button to run spice command.
void SetNetListerCommand(const wxString &aCommand)
void OnNetlistTypeSelection(wxNotebookEvent &event) override
PANEL_NETLIST m_NetlistPanel
int InvokeDialogNetList(SCH_EDIT_FRAME *aCaller)
wxString CadstarNetlistFileWildcard()