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 
49 #include <eeschema_id.h>
50 #include <wx/regex.h>
51 
52 
53 #define CUSTOMPANEL_COUNTMAX 8 // Max number of netlist plugins
54 
55 
56 /* panel (notebook page) identifiers */
58  PANELPCBNEW = 0, /* Handle Netlist format Pcbnew */
59  PANELORCADPCB2, /* Handle Netlist format OracdPcb2 */
60  PANELCADSTAR, /* Handle Netlist format CadStar */
61  PANELSPICE, /* Handle Netlist format Pspice */
62  PANELCUSTOMBASE /* First auxiliary panel (custom netlists).
63  * others use PANELCUSTOMBASE+1, PANELCUSTOMBASE+2.. */
64 };
65 
66 
67 /* wxPanels for creating the NoteBook pages for each netlist format: */
68 class NETLIST_PAGE_DIALOG : public wxPanel
69 {
70 public:
72  wxCheckBox* m_IsCurrentFormat;
73  // opt to reformat passive component values (e.g. 1M -> 1Meg):
74  wxCheckBox* m_AdjustPassiveValues;
75  wxTextCtrl* m_CommandStringCtrl;
76  wxTextCtrl* m_TitleStringCtrl;
77  wxBoxSizer* m_LeftBoxSizer;
78  wxBoxSizer* m_RightBoxSizer;
80  wxBoxSizer* m_LowBoxSizer;
81 
82 private:
83  wxString m_pageNetFmtName;
84 
85 public:
92  NETLIST_PAGE_DIALOG( wxNotebook* parent, const wxString& title,
93  NETLIST_TYPE_ID id_NetType );
95 
101  const wxString GetPageNetFmtName() { return m_pageNetFmtName; }
102 };
103 
104 
105 /* Dialog frame for creating netlists */
107 {
108  friend class NETLIST_PAGE_DIALOG;
109 
110 public:
114 
115 protected:
117 
118 public:
119  // Constructor and destructor
120  NETLIST_DIALOG( SCH_EDIT_FRAME* parent );
122 
123 private:
124  void InstallCustomPages();
125  NETLIST_PAGE_DIALOG* AddOneCustomPage( const wxString & aTitle,
126  const wxString & aCommandString,
127  NETLIST_TYPE_ID aNetTypeId );
128  void InstallPageSpice();
129  bool TransferDataFromWindow() override;
130  void NetlistUpdateOpt();
131 
132  // Called when changing the notebook page (and therefore the current netlist format)
133  void OnNetlistTypeSelection( wxNotebookEvent& event ) override;
134 
135  // called when checking the "Default format" wxCheckBox in the current page of the notbook
136  void SelectDefaultNetlistType( wxCommandEvent& event );
137 
142  void OnAddGenerator( wxCommandEvent& event ) override;
143 
148  void OnDelGenerator( wxCommandEvent& event ) override;
149 
155 
165  bool FilenamePrms( NETLIST_TYPE_ID aType,
166  wxString * aExt, wxString * aWildCard );
167 
168  DECLARE_EVENT_TABLE()
169 };
170 
171 
173 {
174 private:
176 
177 public:
179 
180  const wxString GetGeneratorTitle() { return m_textCtrlName->GetValue(); }
181  const wxString GetGeneratorTCommandLine() { return m_textCtrlCommand->GetValue(); }
182 
183 private:
188  void OnOKClick( wxCommandEvent& event ) override;
189 
190  /*
191  * Browse plugin files, and set m_CommandStringCtrl field
192  */
193  void OnBrowseGenerators( wxCommandEvent& event ) override;
194 };
195 
196 
197 /* Event id for notebook page buttons: */
203 };
204 
205 
206 BEGIN_EVENT_TABLE( NETLIST_DIALOG, NETLIST_DIALOG_BASE )
208 END_EVENT_TABLE()
209 
210 
211 
213  const wxString& title,
214  NETLIST_TYPE_ID id_NetType ) :
215  wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL )
216 {
217  m_IdNetType = id_NetType;
218  m_pageNetFmtName = title;
219  m_CommandStringCtrl = NULL;
220  m_TitleStringCtrl = NULL;
221  m_IsCurrentFormat = NULL;
222  m_AdjustPassiveValues = NULL;
223 
224  wxString netfmtName = ((NETLIST_DIALOG*)parent->GetParent())->m_DefaultNetFmtName;
225 
226  bool selected = m_pageNetFmtName == netfmtName;
227 
228  parent->AddPage( this, title, selected );
229 
230  wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxVERTICAL );
231  SetSizer( MainBoxSizer );
232  wxBoxSizer* UpperBoxSizer = new wxBoxSizer( wxHORIZONTAL );
233  m_LowBoxSizer = new wxBoxSizer( wxVERTICAL );
234  MainBoxSizer->Add( UpperBoxSizer, 0, wxGROW | wxALL, 5 );
235  MainBoxSizer->Add( m_LowBoxSizer, 0, wxGROW | wxALL, 5 );
236 
237  m_LeftBoxSizer = new wxBoxSizer( wxVERTICAL );
238  m_RightBoxSizer = new wxBoxSizer( wxVERTICAL );
239  m_RightOptionsBoxSizer = new wxBoxSizer( wxVERTICAL );
240  UpperBoxSizer->Add( m_LeftBoxSizer, 0, wxGROW | wxALL, 5 );
241  UpperBoxSizer->Add( m_RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
242  UpperBoxSizer->Add( m_RightOptionsBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
243 
244  wxStaticText* text = new wxStaticText( this, -1, _( "Options:" ) );
245  m_LeftBoxSizer->Add( text, 0, wxGROW | wxBOTTOM | wxRIGHT, 5 );
246 
247  m_IsCurrentFormat = new wxCheckBox( this, ID_CURRENT_FORMAT_IS_DEFAULT, _( "Default format" ) );
248  m_LeftBoxSizer->Add( m_IsCurrentFormat, 0, wxGROW | wxBOTTOM | wxRIGHT, 5 );
249  m_IsCurrentFormat->SetValue( selected );
250 
251  if( selected )
252  ((NETLIST_DIALOG*)parent->GetParent())->m_asFormatSelected = true;
253 }
254 
255 
256 
258  NETLIST_DIALOG_BASE( parent )
259 {
260  m_Parent = parent;
261 
263 
264  for( NETLIST_PAGE_DIALOG*& page : m_PanelNetType)
265  page = NULL;
266 
267  // Add notebook pages:
268  m_asFormatSelected = false; // Will be set to true, if a format is selected
269 
270  m_PanelNetType[PANELPCBNEW] = new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "Pcbnew" ),
271  NET_TYPE_PCBNEW );
272 
273  m_PanelNetType[PANELORCADPCB2] = new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "OrcadPCB2" ),
275 
276  m_PanelNetType[PANELCADSTAR] = new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "CadStar" ),
278 
281 
282  // Ensure a netlist format is selected:
283  if( !m_asFormatSelected )
284  {
285  m_PanelNetType[PANELPCBNEW]->m_IsCurrentFormat->SetValue( true );
286  m_NoteBook->SetSelection( PANELPCBNEW );
288  // call OnNetlistTypeSelection to update some widgets.
289  // SetSelection() do nothing if the current page is already PANELPCBNEW
290  wxNotebookEvent event;
291  OnNetlistTypeSelection( event );
292  }
293 
294  // We use a sdbSizer here to get the order right, which is platform-dependent
295  m_sdbSizer2OK->SetLabel( _( "Export Netlist" ) );
296  m_sdbSizer2Cancel->SetLabel( _( "Close" ) );
297  m_buttonSizer->Layout();
298 
299  m_sdbSizer2OK->SetDefault();
300 
301  // Now all widgets have the size fixed, call FinishDialogSettings
303 }
304 
305 
307 {
309  new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "Spice" ), NET_TYPE_SPICE );
310 
311  page->m_AdjustPassiveValues = new wxCheckBox( page, ID_USE_NETCODE_AS_NETNAME,
312  _( "Reformat passive symbol values" ) );
313  page->m_AdjustPassiveValues->SetToolTip( _( "Reformat passive symbol values e.g. 1M -> 1Meg" ) );
315  page->m_LeftBoxSizer->Add( page->m_AdjustPassiveValues, 0, wxGROW | wxBOTTOM | wxRIGHT, 5 );
316 }
317 
318 
320 {
321  NETLIST_PAGE_DIALOG* currPage;
322 
323  auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
324 
325  for( size_t i = 0;
326  i < CUSTOMPANEL_COUNTMAX && i < cfg->m_NetlistPanel.custom_command_titles.size(); i++ )
327  {
328  // pairs of (title, command) are stored
329  wxString title = cfg->m_NetlistPanel.custom_command_titles[i];
330 
331  if( i >= cfg->m_NetlistPanel.custom_command_paths.size() )
332  break; // No more panel to install
333 
334  wxString command = cfg->m_NetlistPanel.custom_command_paths[i];
335 
336  currPage = AddOneCustomPage( title, command,
337  static_cast<NETLIST_TYPE_ID>( NET_TYPE_CUSTOM1 + i ) );
338 
339  m_PanelNetType[PANELCUSTOMBASE + i] = currPage;
340  }
341 }
342 
343 
345  const wxString & aCommandString,
346  NETLIST_TYPE_ID aNetTypeId )
347 {
348  NETLIST_PAGE_DIALOG* currPage = new NETLIST_PAGE_DIALOG( m_NoteBook, aTitle, aNetTypeId );
349 
350  currPage->m_LowBoxSizer->Add( new wxStaticText( currPage, -1, _( "Title:" ) ), 0,
351  wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
352 
353  currPage->m_TitleStringCtrl = new wxTextCtrl( currPage, -1, aTitle,
354  wxDefaultPosition, wxDefaultSize );
355 
356  currPage->m_TitleStringCtrl->SetInsertionPoint( 1 );
357  currPage->m_LowBoxSizer->Add( currPage->m_TitleStringCtrl, 0,
358  wxGROW | wxTOP | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
359 
360  currPage->m_LowBoxSizer->Add( new wxStaticText( currPage, -1, _( "Netlist command:" ) ), 0,
361  wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
362 
363  currPage->m_CommandStringCtrl = new wxTextCtrl( currPage, -1, aCommandString,
364  wxDefaultPosition, wxDefaultSize );
365 
366  currPage->m_CommandStringCtrl->SetInsertionPoint( 1 );
367  currPage->m_LowBoxSizer->Add( currPage->m_CommandStringCtrl, 0,
368  wxGROW | wxTOP | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
369 
370  return currPage;
371 }
372 
373 
374 void NETLIST_DIALOG::SelectDefaultNetlistType( wxCommandEvent& event )
375 {
376  for( NETLIST_PAGE_DIALOG*& page : m_PanelNetType)
377  {
378  if( page )
379  page->m_IsCurrentFormat->SetValue( false );
380  }
381 
382  NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
383 
384  if( currPage == NULL )
385  return;
386 
389  currPage->m_IsCurrentFormat->SetValue( true );
390 }
391 
392 
393 void NETLIST_DIALOG::OnNetlistTypeSelection( wxNotebookEvent& event )
394 {
395  NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
396 
397  if( currPage == NULL )
398  return;
399 
400  m_buttonDelGenerator->Enable( currPage->m_IdNetType >= NET_TYPE_CUSTOM1 );
401 }
402 
403 
405 {
406  bool adjust = m_PanelNetType[ PANELSPICE ]->m_AdjustPassiveValues->IsChecked();
407 
409  m_Parent->SetNetListFormatName( wxEmptyString );
410 
411  for( NETLIST_PAGE_DIALOG*& page : m_PanelNetType)
412  {
413  if( page == NULL )
414  break;
415 
416  if( page->m_IsCurrentFormat->GetValue() == true )
417  m_Parent->SetNetListFormatName( page->GetPageNetFmtName() );
418  }
419 }
420 
421 
423 {
424  wxFileName fn;
425  wxString fileWildcard;
426  wxString fileExt;
427  wxString title = _( "Save Netlist File" );
428 
430 
431  NETLIST_PAGE_DIALOG* currPage;
432  currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
433 
434  unsigned netlist_opt = 0;
435 
436  // Calculate the netlist filename
437  fn = g_RootSheet->GetScreen()->GetFileName();
438  FilenamePrms( currPage->m_IdNetType, &fileExt, &fileWildcard );
439 
440  // Set some parameters
441  switch( currPage->m_IdNetType )
442  {
443  case NET_TYPE_SPICE:
444  // Set spice netlist options:
445  if( currPage->m_AdjustPassiveValues->GetValue() )
446  netlist_opt |= NET_ADJUST_PASSIVE_VALS;
447  break;
448 
449  case NET_TYPE_CADSTAR:
450  break;
451 
452  case NET_TYPE_PCBNEW:
453  break;
454 
455  case NET_TYPE_ORCADPCB2:
456  break;
457 
458  default: // custom, NET_TYPE_CUSTOM1 and greater
459  {
460  wxString command = currPage->m_CommandStringCtrl->GetValue();
461  wxRegEx extRE( wxT( ".*\\.([[:alnum:]][[:alnum:]][[:alnum:]][[:alnum:]]?)\\.xslt?\".*" ) );
462 
463  if( extRE.Matches( command ) )
464  fileExt = extRE.GetMatch( command, 1 );
465 
466  title.Printf( _( "%s Export" ), currPage->m_TitleStringCtrl->GetValue().GetData() );
467  }
468  break;
469  }
470 
471  fn.SetExt( fileExt );
472 
473  if( fn.GetPath().IsEmpty() )
474  fn.SetPath( wxPathOnly( Prj().GetProjectFullName() ) );
475 
476  wxString fullpath = fn.GetFullPath();
477  wxString fullname = fn.GetFullName();
478  wxString path = fn.GetPath();
479 
480  // fullname does not and should not include the path, per wx docs.
481  wxFileDialog dlg( this, title, path, fullname, fileWildcard, wxFD_SAVE );
482 
483  if( dlg.ShowModal() == wxID_CANCEL )
484  return false;
485 
486  fullpath = dlg.GetPath(); // directory + filename
487 
489 
490  if( currPage->m_CommandStringCtrl )
491  m_Parent->SetNetListerCommand( currPage->m_CommandStringCtrl->GetValue() );
492  else
493  m_Parent->SetNetListerCommand( wxEmptyString );
494 
495  auto netlist = m_Parent->CreateNetlist( false, false );
496 
497  if( netlist == nullptr )
498  wxMessageBox( _( "Schematic netlist not available" ) );
499  else
500  m_Parent->WriteNetListFile( netlist, currPage->m_IdNetType, fullpath, netlist_opt, NULL );
501 
503 
504  return true;
505 }
506 
507 
508 bool NETLIST_DIALOG::FilenamePrms( NETLIST_TYPE_ID aType, wxString * aExt, wxString * aWildCard )
509 {
510  wxString fileExt;
511  wxString fileWildcard;
512  bool ret = true;
513 
514  switch( aType )
515  {
516  case NET_TYPE_SPICE:
517  fileExt = wxT( "cir" );
518  fileWildcard = SpiceNetlistFileWildcard();
519  break;
520 
521  case NET_TYPE_CADSTAR:
522  fileExt = wxT( "frp" );
523  fileWildcard = CadstarNetlistFileWildcard();
524  break;
525 
526  case NET_TYPE_PCBNEW:
527  case NET_TYPE_ORCADPCB2:
528  fileExt = NetlistFileExtension;
529  fileWildcard = NetlistFileWildcard();
530  break;
531 
532  default: // custom, NET_TYPE_CUSTOM1 and greater
533  fileWildcard = AllFilesWildcard();
534  ret = false;
535  }
536 
537  if( aExt )
538  *aExt = fileExt;
539 
540  if( aWildCard )
541  *aWildCard = fileWildcard;
542 
543  return ret;
544 }
545 
546 
548 {
549  wxString msg;
550 
552 
553  auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
554 
555  cfg->m_NetlistPanel.custom_command_titles.clear();
556  cfg->m_NetlistPanel.custom_command_paths.clear();
557 
558  // Update existing custom pages
559  for( int ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ )
560  {
562 
563  if( currPage == NULL )
564  break;
565 
566  wxString title = currPage->m_TitleStringCtrl->GetValue();
567 
568  if( title.IsEmpty() )
569  continue;
570 
571  cfg->m_NetlistPanel.custom_command_titles.push_back( title.ToStdString() );
572  cfg->m_NetlistPanel.custom_command_paths.push_back(
573  currPage->m_CommandStringCtrl->GetValue().ToStdString() );
574  }
575 }
576 
577 
578 void NETLIST_DIALOG::OnDelGenerator( wxCommandEvent& event )
579 {
580  NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
581 
582  currPage->m_CommandStringCtrl->SetValue( wxEmptyString );
583  currPage->m_TitleStringCtrl->SetValue( wxEmptyString );
584 
585  if( currPage->m_IsCurrentFormat->IsChecked() )
586  {
587  currPage->m_IsCurrentFormat->SetValue( false );
588  m_PanelNetType[PANELPCBNEW]->m_IsCurrentFormat->SetValue( true );
589  }
590 
592  EndModal( NET_PLUGIN_CHANGE );
593 }
594 
595 
596 void NETLIST_DIALOG::OnAddGenerator( wxCommandEvent& event )
597 {
598  NETLIST_DIALOG_ADD_GENERATOR dlg( this );
599 
600  if( dlg.ShowModal() != wxID_OK )
601  return;
602 
603  // Creates a new custom plugin page
604  wxString title = dlg.GetGeneratorTitle();
605 
606  // Verify it does not exists
607  int netTypeId = PANELCUSTOMBASE; // the first not used type id
608  NETLIST_PAGE_DIALOG* currPage;
609 
610  for( int ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ )
611  {
612  netTypeId = PANELCUSTOMBASE + ii;
613  currPage = m_PanelNetType[ii + PANELCUSTOMBASE];
614 
615  if( currPage == NULL )
616  break;
617 
618  if( currPage->GetPageNetFmtName() == title )
619  {
620  wxMessageBox( _("This plugin already exists.") );
621  return;
622  }
623  }
624 
625  wxString cmd = dlg.GetGeneratorTCommandLine();
626  currPage = AddOneCustomPage( title,cmd, (NETLIST_TYPE_ID)netTypeId );
627  m_PanelNetType[netTypeId] = currPage;
629 
630  // Close and reopen dialog to rebuild the dialog after changes
631  EndModal( NET_PLUGIN_CHANGE );
632 }
633 
634 
637 {
638  m_Parent = parent;
639  m_sdbSizerOK->SetDefault();
640  GetSizer()->SetSizeHints( this );
641 }
642 
643 
644 void NETLIST_DIALOG_ADD_GENERATOR::OnOKClick( wxCommandEvent& event )
645 {
646  if( m_textCtrlCommand->GetValue() == wxEmptyString )
647  {
648  wxMessageBox( _( "Error. You must provide a command String" ) );
649  return;
650  }
651 
652  if( m_textCtrlName->GetValue() == wxEmptyString )
653  {
654  wxMessageBox( _( "Error. You must provide a Title" ) );
655  return;
656  }
657 
658  EndModal( wxID_OK );
659 }
660 
661 
663 {
664  wxString FullFileName, Path;
665 
666 #ifndef __WXMAC__
667  Path = Pgm().GetExecutablePath();
668 #else
669  Path = GetOSXKicadDataDir() + wxT( "/plugins" );
670 #endif
671  FullFileName = EDA_FILE_SELECTOR( _( "Generator files:" ), Path, FullFileName,
672  wxEmptyString, wxFileSelectorDefaultWildcardStr,
673  this, wxFD_OPEN, true );
674  if( FullFileName.IsEmpty() )
675  return;
676 
677  // Creates a default command line, suitable for external tool xslproc or python, based on
678  // the plugin extension ("xsl" or "exe" or "py")
679  wxString cmdLine;
680  wxFileName fn( FullFileName );
681  wxString ext = fn.GetExt();
682 
683  if( ext == wxT("xsl" ) )
684  cmdLine.Printf(wxT("xsltproc -o \"%%O\" \"%s\" \"%%I\""), GetChars(FullFileName) );
685  else if( ext == wxT("exe" ) || ext.IsEmpty() )
686  cmdLine.Printf(wxT("\"%s\" > \"%%O\" < \"%%I\""), GetChars(FullFileName) );
687  else if( ext == wxT("py" ) || ext.IsEmpty() )
688  cmdLine.Printf(wxT("python \"%s\" \"%%I\" \"%%O\""), GetChars(FullFileName) );
689  else
690  cmdLine.Printf(wxT("\"%s\""), GetChars(FullFileName) );
691 
692  m_textCtrlCommand->SetValue( cmdLine );
693 
694  /* Get a title for this page */
695  wxString title = m_textCtrlName->GetValue();
696 
697  if( title.IsEmpty() )
698  wxMessageBox( _( "Do not forget to choose a title for this netlist control page" ) );
699 }
700 
701 
703 {
704  NETLIST_DIALOG dlg( aCaller );
705 
706  wxString curr_default_netformat = aCaller->GetNetListFormatName();
707 
708  int ret = dlg.ShowModal();
709 
710  // Update the default netlist and store it in prj config if it was explicitely changed.
711  aCaller->SetNetListFormatName( dlg.m_DefaultNetFmtName ); // can have temporary changed
712 
713  if( curr_default_netformat != dlg.m_DefaultNetFmtName )
714  aCaller->SaveProjectSettings();
715 
716  return ret;
717 }
const std::string NetlistFileExtension
void OnDelGenerator(wxCommandEvent &event) override
Function OnDelGenerator Remove a panel relative to a netlist plugin.
const wxString & GetFileName() const
Definition: sch_screen.h:157
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:103
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.
SCH_SCREEN * GetScreen()
Definition: sch_sheet.h:282
void SetSpiceAdjustPassiveValues(bool aEnable)
wxString AllFilesWildcard()
NETLIST_TYPE_ID
netlist types
Definition: netlist.h:35
Class NETLIST_DIALOG_ADD_GENERATOR_BASE.
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
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:101
see class PGM_BASE
NETLIST_OBJECT_LIST * CreateNetlist(bool aSilent=false, bool aSilentAnnotate=false)
Create a netlist for the current schematic.
#define _(s)
Definition: 3d_actions.cpp:33
#define NET_PLUGIN_CHANGE
Create and shows NETLIST_DIALOG and returns whatever NETLIST_DIALOG::ShowModal() returns.
SCH_SHEET * g_RootSheet
bool GetSpiceAjustPassiveValues() const
bool WriteNetListFile(NETLIST_OBJECT_LIST *aConnectedItemsList, int aFormat, const wxString &aFullFileName, unsigned aNetlistOptions, REPORTER *aReporter=NULL)
Create a netlist file.
void SetNetListerCommand(const wxString &aCommand)
void OnNetlistTypeSelection(wxNotebookEvent &event) override
const wxString GetPageNetFmtName()
function GetPageNetFmtName
int InvokeDialogNetList(SCH_EDIT_FRAME *aCaller)
void SelectDefaultNetlistType(wxCommandEvent &event)
wxString CadstarNetlistFileWildcard()