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, [email protected]
5  * Copyright (C) 2013 Wayne Stambaugh <[email protected]>
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:
172 };
173 
174 
176 {
177 public:
179 
180  const wxString GetGeneratorTitle() { return m_textCtrlName->GetValue(); }
181  const wxString GetGeneratorTCommandLine() { return m_textCtrlCommand->GetValue(); }
182 
183  bool TransferDataFromWindow() override;
184 
185 private:
186  /*
187  * Browse plugin files, and set m_CommandStringCtrl field
188  */
189  void OnBrowseGenerators( wxCommandEvent& event ) override;
190 
192 };
193 
194 
195 /* Event id for notebook page buttons: */
200 };
201 
202 
203 BEGIN_EVENT_TABLE( NETLIST_DIALOG, NETLIST_DIALOG_BASE )
206 END_EVENT_TABLE()
207 
208 
209 NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent, const wxString& title,
210  NETLIST_TYPE_ID id_NetType ) :
211  wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL )
212 {
213  m_IdNetType = id_NetType;
214  m_pageNetFmtName = title;
215  m_CommandStringCtrl = nullptr;
216  m_TitleStringCtrl = nullptr;
217  m_AdjustPassiveValues = nullptr;
218 
219  parent->AddPage( this, title, false );
220 
221  wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxVERTICAL );
222  SetSizer( MainBoxSizer );
223  wxBoxSizer* UpperBoxSizer = new wxBoxSizer( wxHORIZONTAL );
224  m_LowBoxSizer = new wxBoxSizer( wxVERTICAL );
225  MainBoxSizer->Add( UpperBoxSizer, 0, wxGROW | wxALL, 5 );
226  MainBoxSizer->Add( m_LowBoxSizer, 0, wxGROW | wxALL, 5 );
227 
228  m_LeftBoxSizer = new wxBoxSizer( wxVERTICAL );
229  m_RightBoxSizer = new wxBoxSizer( wxVERTICAL );
230  m_RightOptionsBoxSizer = new wxBoxSizer( wxVERTICAL );
231  UpperBoxSizer->Add( m_LeftBoxSizer, 0, wxGROW | wxALL, 5 );
232  UpperBoxSizer->Add( m_RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
233  UpperBoxSizer->Add( m_RightOptionsBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
234 }
235 
236 
238  NETLIST_DIALOG_BASE( parent )
239 {
240  m_Parent = parent;
241 
243 
244  for( NETLIST_PAGE_DIALOG*& page : m_PanelNetType)
245  page = nullptr;
246 
247  // Add notebook pages:
249  NET_TYPE_PCBNEW );
250 
251  m_PanelNetType[PANELORCADPCB2] = new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "OrcadPCB2" ),
253 
254  m_PanelNetType[PANELCADSTAR] = new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "CadStar" ),
256 
259 
260  // We use a sdbSizer here to get the order right, which is platform-dependent
261  m_sdbSizer2OK->SetLabel( _( "Export Netlist" ) );
262  m_sdbSizer2Cancel->SetLabel( _( "Close" ) );
263  m_buttonSizer->Layout();
264 
265  m_sdbSizer2OK->SetDefault();
266 
267  for( int ii = 0; m_PanelNetType[ii] && ii < 4 + CUSTOMPANEL_COUNTMAX; ++ii )
268  {
269  if( m_PanelNetType[ii]->GetPageNetFmtName() == settings.m_NetFormatName )
270  {
271  m_NoteBook->ChangeSelection( ii );
272  break;
273  }
274  }
275 
276  // Now all widgets have the size fixed, call FinishDialogSettings
278 }
279 
280 
281 void NETLIST_DIALOG::OnRunExternSpiceCommand( wxCommandEvent& event )
282 {
283  // Run the external spice simulator command
285 
287  wxString simulatorCommand = settings.m_SpiceCommandString;
288 
289  unsigned netlist_opt = 0;
290 
291  // Calculate the netlist filename and options
292  wxFileName fn = m_Parent->Schematic().GetFileName();
293  fn.SetExt( wxT( "cir" ) );
294 
295  if( settings.m_SpiceAdjustPassiveValues )
296  netlist_opt |= NET_ADJUST_PASSIVE_VALS;
297 
298  // Build the command line
299  wxString commandLine = simulatorCommand;
300  commandLine.Replace( wxT( "%I" ), fn.GetFullPath(), true );
301 
302  if( m_Parent->ReadyToNetlist( _( "Simulator requires a fully annotated schematic." ) ) )
303  {
304  m_Parent->WriteNetListFile( NET_TYPE_SPICE, fn.GetFullPath(), netlist_opt, nullptr );
305  commandLine.Trim( true ).Trim( false );
306 
307  if( !commandLine.IsEmpty() )
308  wxExecute( commandLine, wxEXEC_ASYNC );
309  }
310 }
311 
312 
313 void NETLIST_DIALOG::OnRunSpiceButtUI( wxUpdateUIEvent& aEvent )
314 {
315  bool disable = m_PanelNetType[PANELSPICE]->m_CommandStringCtrl->IsEmpty();
316  aEvent.Enable( !disable );
317 }
318 
319 
321 {
323  new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "Spice" ), NET_TYPE_SPICE );
324 
326 
327  page->m_AdjustPassiveValues = new wxCheckBox( page, ID_USE_NETCODE_AS_NETNAME,
328  _( "Reformat passive symbol values" ) );
329  page->m_AdjustPassiveValues->SetToolTip( _( "Reformat passive symbol values e.g. 1M -> 1Meg" ) );
330  page->m_AdjustPassiveValues->SetValue( settings.m_SpiceAdjustPassiveValues );
331  page->m_LeftBoxSizer->Add( page->m_AdjustPassiveValues, 0, wxGROW | wxBOTTOM | wxRIGHT, 5 );
332 
333  wxString simulatorCommand = settings.m_SpiceCommandString;
334  wxStaticText* spice_label = new wxStaticText( page, -1, _( "External simulator command:" ) );
335  spice_label->SetToolTip( _( "Enter the command line to run spice\n"
336  "Usually <path to spice binary> %I\n"
337  "%I will be replaced by the actual spice netlist name" ) );
338  page->m_LowBoxSizer->Add( spice_label, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
339 
340  page->m_CommandStringCtrl = new wxTextCtrl( page, -1, simulatorCommand,
341  wxDefaultPosition, wxDefaultSize );
342 
343  page->m_CommandStringCtrl->SetInsertionPoint( 1 );
344  page->m_LowBoxSizer->Add( page->m_CommandStringCtrl, 0,
345  wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
346 
347  // Add button to run spice command
348  wxButton* button = new wxButton( page, ID_RUN_SIMULATOR,
349  _( "Create Netlist and Run Simulator Command" ) );
350  page->m_LowBoxSizer->Add( button, 0, wxGROW | wxBOTTOM | wxLEFT | wxRIGHT, 5 );
351 }
352 
353 
355 {
356  NETLIST_PAGE_DIALOG* currPage;
357 
358  auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
359  wxASSERT( cfg );
360 
361  if( cfg )
362  {
363  for( size_t i = 0;
364  i < CUSTOMPANEL_COUNTMAX && i < cfg->m_NetlistPanel.plugins.size();
365  i++ )
366  {
367  // pairs of (title, command) are stored
368  wxString title = cfg->m_NetlistPanel.plugins[i].name;
369 
370  if( i >= cfg->m_NetlistPanel.plugins.size() )
371  break; // No more panel to install
372 
373  wxString command = cfg->m_NetlistPanel.plugins[i].command;
374 
375  currPage = AddOneCustomPage( title, command,
376  static_cast<NETLIST_TYPE_ID>( NET_TYPE_CUSTOM1 + i ) );
377 
378  m_PanelNetType[PANELCUSTOMBASE + i] = currPage;
379  }
380  }
381 }
382 
383 
385  const wxString& aCommandString,
386  NETLIST_TYPE_ID aNetTypeId )
387 {
388  NETLIST_PAGE_DIALOG* currPage = new NETLIST_PAGE_DIALOG( m_NoteBook, aTitle, aNetTypeId );
389 
390  currPage->m_LowBoxSizer->Add( new wxStaticText( currPage, -1, _( "Title:" ) ), 0,
391  wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
392 
393  currPage->m_TitleStringCtrl = new wxTextCtrl( currPage, -1, aTitle,
394  wxDefaultPosition, wxDefaultSize );
395 
396  currPage->m_TitleStringCtrl->SetInsertionPoint( 1 );
397  currPage->m_LowBoxSizer->Add( currPage->m_TitleStringCtrl, 0,
398  wxGROW | wxTOP | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
399 
400  currPage->m_LowBoxSizer->Add( new wxStaticText( currPage, -1, _( "Netlist command:" ) ), 0,
401  wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
402 
403  currPage->m_CommandStringCtrl = new wxTextCtrl( currPage, -1, aCommandString,
404  wxDefaultPosition, wxDefaultSize );
405 
406  currPage->m_CommandStringCtrl->SetInsertionPoint( 1 );
407  currPage->m_LowBoxSizer->Add( currPage->m_CommandStringCtrl, 0,
408  wxGROW | wxTOP | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
409 
410  return currPage;
411 }
412 
413 
414 void NETLIST_DIALOG::OnNetlistTypeSelection( wxNotebookEvent& event )
415 {
416  NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
417 
418  if( currPage == nullptr )
419  return;
420 
421  m_buttonDelGenerator->Enable( currPage->m_IdNetType >= NET_TYPE_CUSTOM1 );
422 }
423 
424 
426 {
427  bool adjust = m_PanelNetType[ PANELSPICE ]->m_AdjustPassiveValues->IsChecked();
428  wxString spice_cmd_string = m_PanelNetType[ PANELSPICE ]->m_CommandStringCtrl->GetValue();
429 
431 
432  settings.m_SpiceAdjustPassiveValues = adjust;
433  settings.m_SpiceCommandString = spice_cmd_string;
434  settings.m_NetFormatName = m_PanelNetType[m_NoteBook->GetSelection()]->GetPageNetFmtName();
435 }
436 
437 
439 {
440  wxFileName fn;
441  wxString fileWildcard;
442  wxString fileExt;
443  wxString title = _( "Save Netlist File" );
444 
446 
447  NETLIST_PAGE_DIALOG* currPage;
448  currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
449 
450  unsigned netlist_opt = 0;
451 
452  // Calculate the netlist filename
453  fn = m_Parent->Schematic().GetFileName();
454  FilenamePrms( currPage->m_IdNetType, &fileExt, &fileWildcard );
455 
456  // Set some parameters
457  switch( currPage->m_IdNetType )
458  {
459  case NET_TYPE_SPICE:
460  // Set spice netlist options:
461  if( currPage->m_AdjustPassiveValues->GetValue() )
462  netlist_opt |= NET_ADJUST_PASSIVE_VALS;
463  break;
464 
465  case NET_TYPE_CADSTAR:
466  break;
467 
468  case NET_TYPE_PCBNEW:
469  break;
470 
471  case NET_TYPE_ORCADPCB2:
472  break;
473 
474  default: // custom, NET_TYPE_CUSTOM1 and greater
475  {
476  title.Printf( _( "%s Export" ), currPage->m_TitleStringCtrl->GetValue() );
477  break;
478  }
479  }
480 
481  fn.SetExt( fileExt );
482 
483  if( fn.GetPath().IsEmpty() )
484  fn.SetPath( wxPathOnly( Prj().GetProjectFullName() ) );
485 
486  wxString fullpath = fn.GetFullPath();
487  wxString fullname = fn.GetFullName();
488  wxString path = fn.GetPath();
489 
490  // full name does not and should not include the path, per wx docs.
491  wxFileDialog dlg( this, title, path, fullname, fileWildcard, wxFD_SAVE );
492 
493  if( dlg.ShowModal() == wxID_CANCEL )
494  return false;
495 
496  fullpath = dlg.GetPath(); // directory + filename
497 
499 
500  if( currPage->m_CommandStringCtrl )
501  m_Parent->SetNetListerCommand( currPage->m_CommandStringCtrl->GetValue() );
502  else
503  m_Parent->SetNetListerCommand( wxEmptyString );
504 
505  if( m_Parent->ReadyToNetlist( _( "Exporting netlist requires a fully annotated schematic." ) ) )
506  m_Parent->WriteNetListFile( currPage->m_IdNetType, fullpath, netlist_opt, nullptr );
507 
509 
510  return true;
511 }
512 
513 
514 bool NETLIST_DIALOG::FilenamePrms( NETLIST_TYPE_ID aType, wxString * aExt, wxString * aWildCard )
515 {
516  wxString fileExt;
517  wxString fileWildcard;
518  bool ret = true;
519 
520  switch( aType )
521  {
522  case NET_TYPE_SPICE:
523  fileExt = wxT( "cir" );
524  fileWildcard = SpiceNetlistFileWildcard();
525  break;
526 
527  case NET_TYPE_CADSTAR:
528  fileExt = wxT( "frp" );
529  fileWildcard = CadstarNetlistFileWildcard();
530  break;
531 
532  case NET_TYPE_PCBNEW:
533  case NET_TYPE_ORCADPCB2:
534  fileExt = NetlistFileExtension;
535  fileWildcard = NetlistFileWildcard();
536  break;
537 
538  default: // custom, NET_TYPE_CUSTOM1 and greater
539  fileWildcard = AllFilesWildcard();
540  ret = false;
541  }
542 
543  if( aExt )
544  *aExt = fileExt;
545 
546  if( aWildCard )
547  *aWildCard = fileWildcard;
548 
549  return ret;
550 }
551 
552 
554 {
555  wxString msg;
556 
558 
559  EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
560  wxASSERT( cfg );
561 
562  if( !cfg )
563  return;
564 
565  cfg->m_NetlistPanel.plugins.clear();
566 
567  // Update existing custom pages
568  for( int ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ )
569  {
571 
572  if( currPage == nullptr )
573  break;
574 
575  wxString title = currPage->m_TitleStringCtrl->GetValue();
576  wxString command = currPage->m_CommandStringCtrl->GetValue();
577 
578  if( title.IsEmpty() || command.IsEmpty() )
579  continue;
580 
581  cfg->m_NetlistPanel.plugins.emplace_back( title, wxEmptyString );
582  cfg->m_NetlistPanel.plugins.back().command = command;
583  }
584 }
585 
586 
587 void NETLIST_DIALOG::OnDelGenerator( wxCommandEvent& event )
588 {
589  NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
590 
591  currPage->m_CommandStringCtrl->SetValue( wxEmptyString );
592  currPage->m_TitleStringCtrl->SetValue( wxEmptyString );
593 
595 
596  if( IsQuasiModal() )
598  else
599  EndDialog( NET_PLUGIN_CHANGE );
600 }
601 
602 
603 void NETLIST_DIALOG::OnAddGenerator( wxCommandEvent& event )
604 {
605  NETLIST_DIALOG_ADD_GENERATOR dlg( this );
606 
607  if( dlg.ShowModal() != wxID_OK )
608  return;
609 
610  // Creates a new custom plugin page
611  wxString title = dlg.GetGeneratorTitle();
612 
613  // Verify it does not exists
614  int netTypeId = PANELCUSTOMBASE; // the first not used type id
615  NETLIST_PAGE_DIALOG* currPage;
616 
617  for( int ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ )
618  {
619  netTypeId = PANELCUSTOMBASE + ii;
620  currPage = m_PanelNetType[ii + PANELCUSTOMBASE];
621 
622  if( currPage == nullptr )
623  break;
624 
625  if( currPage->GetPageNetFmtName() == title )
626  {
627  wxMessageBox( _("This plugin already exists.") );
628  return;
629  }
630  }
631 
632  wxString cmd = dlg.GetGeneratorTCommandLine();
633  currPage = AddOneCustomPage( title,cmd, (NETLIST_TYPE_ID)netTypeId );
634  m_PanelNetType[netTypeId] = currPage;
636 
637  if( IsQuasiModal() )
639  else
640  EndDialog( NET_PLUGIN_CHANGE );
641 }
642 
643 
646 {
647  m_Parent = parent;
648  m_sdbSizerOK->SetDefault();
649  GetSizer()->SetSizeHints( this );
650 }
651 
652 
654 {
655  if( !wxDialog::TransferDataFromWindow() )
656  return false;
657 
658  if( m_textCtrlCommand->GetValue() == wxEmptyString )
659  {
660  wxMessageBox( _( "You must provide a netlist generator command string" ) );
661  return false;
662  }
663 
664  if( m_textCtrlName->GetValue() == wxEmptyString )
665  {
666  wxMessageBox( _( "You must provide a netlist generator title" ) );
667  return false;
668  }
669 
670  return true;
671 }
672 
673 
675 {
676  wxString FullFileName, Path;
677 
678 #ifndef __WXMAC__
679  Path = Pgm().GetExecutablePath();
680 #else
681  Path = PATHS::GetOSXKicadDataDir() + wxT( "/plugins" );
682 #endif
683 
684  FullFileName = wxFileSelector( _( "Generator File" ), Path, FullFileName,
685  wxEmptyString, wxFileSelectorDefaultWildcardStr,
686  wxFD_OPEN, this );
687 
688  if( FullFileName.IsEmpty() )
689  return;
690 
691  // Creates a default command line, suitable for external tool xslproc or python, based on
692  // the plugin extension ("xsl" or "exe" or "py")
693  wxString cmdLine;
694  wxFileName fn( FullFileName );
695  wxString ext = fn.GetExt();
696 
697  if( ext == wxT( "xsl" ) )
698  cmdLine.Printf( wxT( "xsltproc -o \"%%O\" \"%s\" \"%%I\"" ), FullFileName );
699  else if( ext == wxT( "exe" ) || ext.IsEmpty() )
700  cmdLine.Printf( wxT( "\"%s\" > \"%%O\" < \"%%I\"" ), FullFileName );
701  else if( ext == wxT( "py" ) || ext.IsEmpty() )
702  cmdLine.Printf( wxT( "python \"%s\" \"%%I\" \"%%O\"" ), FullFileName );
703  else
704  cmdLine.Printf( wxT( "\"%s\"" ), FullFileName );
705 
706  m_textCtrlCommand->SetValue( cmdLine );
707 
708  // We need a title for this panel
709  // Propose a default value if empty ( i.e. the short filename of the script)
710  if( m_textCtrlName->GetValue().IsEmpty() )
711  m_textCtrlName->SetValue( fn.GetName() );
712 }
713 
714 
716 {
717  NETLIST_DIALOG dlg( aCaller );
718 
719  int ret = dlg.ShowModal();
720  aCaller->SaveProjectSettings();
721 
722  return ret;
723 }
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()