KiCad PCB EDA Suite
dialog_bom.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) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
31 #include <fctsys.h>
32 #include <pgm_base.h>
33 #include <kiface_i.h>
34 #include <confirm.h>
35 #include <gestfich.h>
36 #include <sch_edit_frame.h>
37 #include <netlist.h>
39 #include <invoke_sch_dialog.h>
40 #include <dialog_helpers.h>
41 #include <dialog_bom_base.h>
42 #include <html_messagebox.h>
43 #include <reporter.h>
44 #include <bom_plugins.h>
45 #include <make_unique.h>
46 
47 static constexpr wxChar BOM_TRACE[] = wxT( "BOM_PLUGINS" );
48 
49 static constexpr wxChar BOM_PLUGINS_KEY[] = wxT( "bom_plugins" );
50 static constexpr wxChar BOM_PLUGIN_SELECTED_KEY[] = wxT( "bom_plugin_selected" );
51 
52 static const char* s_bomHelpInfo =
53 #include <dialog_bom_help_html.h>
54 ;
55 
56 #include <dialog_bom_cfg_lexer.h>
57 
58 using namespace T_BOMCFG_T;
59 
60 typedef std::vector<BOM_PLUGIN::PTR> BOM_PLUGIN_ARRAY;
61 
62 
66 class BOM_CFG_PARSER : public DIALOG_BOM_CFG_LEXER
67 {
69 
70 public:
71  BOM_CFG_PARSER( BOM_PLUGIN_ARRAY* aPlugins, const char* aData, const wxString& aSource );
72  void Parse();
73 
74 private:
75  void parsePlugin();
76 };
77 
78 
79 BOM_CFG_PARSER::BOM_CFG_PARSER( BOM_PLUGIN_ARRAY* aPlugins, const char* aLine,
80  const wxString& aSource ) :
81  DIALOG_BOM_CFG_LEXER( aLine, aSource )
82 {
83  m_pluginsList = aPlugins;
84 }
85 
86 
88 {
89  T token;
90 
91  while( ( token = NextTok() ) != T_RIGHT )
92  {
93  if( token == T_EOF)
94  break;
95 
96  if( token == T_LEFT )
97  token = NextTok();
98 
99  if( token == T_plugins )
100  continue;
101 
102  switch( token )
103  {
104  case T_plugin: // Defines a new plugin
105  parsePlugin();
106  break;
107 
108  default:
109 // Unexpected( CurText() );
110  break;
111  }
112  }
113 }
114 
115 
117 {
118  NeedSYMBOLorNUMBER();
119  wxString name = FromUTF8();
120  auto plugin = std::make_unique<BOM_PLUGIN>( name );
121 
122  T token;
123 
124  while( ( token = NextTok() ) != T_RIGHT )
125  {
126  if( token == T_EOF)
127  break;
128 
129  switch( token )
130  {
131  case T_LEFT:
132  break;
133 
134  case T_cmd:
135  NeedSYMBOLorNUMBER();
136 
137  if( plugin )
138  plugin->SetCommand( FromUTF8() );
139 
140  NeedRIGHT();
141  break;
142 
143  case T_opts:
144  NeedSYMBOLorNUMBER();
145 
146  if( plugin )
147  plugin->Options().Add( FromUTF8() );
148 
149  NeedRIGHT();
150  break;
151 
152  default:
153  Unexpected( CurText() );
154  break;
155  }
156  }
157 
158  if( plugin )
159  m_pluginsList->push_back( std::move( plugin ) );
160 }
161 
162 
163 // The main dialog frame to run scripts to build bom
165 {
166 private:
169  wxConfigBase* m_config; // to store the "plugins"
171 
172 public:
173  DIALOG_BOM( SCH_EDIT_FRAME* parent );
174  ~DIALOG_BOM();
175 
176 private:
177  void OnPluginSelected( wxCommandEvent& event ) override;
178  void OnRunPlugin( wxCommandEvent& event ) override;
179  void OnHelp( wxCommandEvent& event ) override;
180  void OnAddPlugin( wxCommandEvent& event ) override;
181  void OnRemovePlugin( wxCommandEvent& event ) override;
182  void OnEditPlugin( wxCommandEvent& event ) override;
183  void OnCommandLineEdited( wxCommandEvent& event ) override;
184  void OnNameEdited( wxCommandEvent& event ) override;
185  void OnShowConsoleChanged( wxCommandEvent& event ) override;
186  void OnIdle( wxIdleEvent& event ) override;
187 
188  void pluginInit();
189  void installPluginsList();
190  BOM_PLUGIN* addPlugin( const wxString& aPath, const wxString& aName = wxEmptyString );
191  bool pluginExists( const wxString& aName );
192 
194  {
195  int idx = m_lbPlugins->GetSelection();
196 
197  if( idx < 0 || idx >= (int)m_plugins.size() )
198  return nullptr;
199 
200  return m_plugins[idx].get();
201  }
202 
203  wxString choosePlugin();
204 };
205 
206 
207 // Create and show DIALOG_BOM.
209 {
210  DIALOG_BOM dlg( aCaller );
211  return dlg.ShowModal();
212 }
213 
214 
216  DIALOG_BOM_BASE( parent )
217 {
218  m_parent = parent;
220  m_initialized = false;
221 
222  m_buttonAddPlugin->SetBitmap( KiBitmap( small_plus_xpm ) );
223  m_buttonDelPlugin->SetBitmap( KiBitmap( trash_xpm ) );
224  m_buttonEdit->SetBitmap( KiBitmap( small_edit_xpm ) );
225 
227 
228 #ifndef __WINDOWS__
229  m_checkBoxShowConsole->Show( false );
230 #endif
231 
232  m_sdbSizer1OK->SetLabel( _( "Generate" ) );
233  m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
234  m_sdbSizer1->Layout();
235 
237  m_sdbSizer1OK->SetDefault();
238  wxLogDebug( "TEEEEST" );
239 
240  // Now all widgets have the size fixed, call FinishDialogSettings
242 }
243 
245 {
246  // Save the plugin descriptions in config.
247  // The config stores only one string, so we save the plugins inside a S-expr:
248  // ( plugins
249  // ( plugin "plugin name 1" (cmd "command line 1") )
250  // ( plugin "plugin name 2" (cmd "command line 2") (opts "option1") (opts "option2") )
251  // ....
252  // )
253 
254  STRING_FORMATTER writer;
255  writer.Print( 0, "(plugins" );
256 
257  for( auto& plugin : m_plugins )
258  {
259  writer.Print( 1, "(plugin %s (cmd %s)",
260  writer.Quotew( plugin->GetFile().GetFullPath() ).c_str(),
261  writer.Quotew( plugin->GetCommand() ).c_str() );
262 
263  for( unsigned jj = 0; jj < plugin->Options().GetCount(); jj++ )
264  {
265  writer.Print( 1, "(opts %s)",
266  writer.Quotew( plugin->Options().Item( jj ) ).c_str() );
267  }
268 
269  writer.Print( 0, ")" );
270  }
271 
272  writer.Print( 0, ")" );
273 
274  wxString list( FROM_UTF8( writer.GetString().c_str() ) );
275 
276  m_config->Write( BOM_PLUGINS_KEY, list );
277 
278  wxString active_plugin_name = m_lbPlugins->GetStringSelection( );
279  m_config->Write( BOM_PLUGIN_SELECTED_KEY, active_plugin_name );
280 }
281 
282 
283 // Read the initialized plugins in config and fill the list of names
285 {
286  wxString list, active_plugin_name;
287  m_config->Read( BOM_PLUGINS_KEY, &list );
288  m_config->Read( BOM_PLUGIN_SELECTED_KEY, &active_plugin_name );
289 
290  if( !list.IsEmpty() )
291  {
292  BOM_CFG_PARSER cfg_parser( &m_plugins, TO_UTF8( list ), wxT( "plugins" ) );
293 
294  try
295  {
296  cfg_parser.Parse();
297  }
298  catch( const IO_ERROR& )
299  {
300 // wxLogMessage( ioe.What() );
301  }
302  catch( std::runtime_error& e )
303  {
304  DisplayError( nullptr, e.what() );
305  }
306 
307  // Populate list box
308  for( unsigned ii = 0; ii < m_plugins.size(); ii++ )
309  {
310  m_lbPlugins->Append( m_plugins[ii]->GetName() );
311 
312  if( active_plugin_name == m_plugins[ii]->GetName() )
313  m_lbPlugins->SetSelection( ii );
314  }
315  }
316 
317  if( m_plugins.empty() ) // No plugins found?
318  {
319  // Load plugins from the default locations
320  std::vector<wxString> pluginPaths = {
321 #if defined(__WXGTK__)
322  "/usr/share/kicad/plugins",
323  "/usr/local/share/kicad/plugins",
324 #elif defined(__WXMSW__)
325  wxString::Format( "%s\\scripting\\plugins", Pgm().GetExecutablePath() ),
326 #elif defined(__WXMAC__)
327  wxString::Format( "%s/plugins", GetOSXKicadDataDir() ),
328 #endif
329  };
330 
331  wxFileName pluginPath;
332 
333  for( const auto& path : pluginPaths )
334  {
335  wxLogDebug( wxString::Format( "Searching directory %s for BOM plugins", path ) );
336  wxDir dir( path );
337 
338  if( !dir.IsOpened() )
339  continue;
340 
341  pluginPath.AssignDir( dir.GetName() );
342  wxString fileName;
343  bool cont = dir.GetFirst( &fileName, "*", wxDIR_FILES );
344 
345  while( cont )
346  {
347  try
348  {
349  wxLogTrace( BOM_TRACE, wxString::Format( "Checking if %s is a BOM plugin", fileName ) );
350 
351  if( BOM_PLUGIN::IsPlugin( fileName ) )
352  {
353  pluginPath.SetFullName( fileName );
354  addPlugin( pluginPath.GetFullPath() );
355  }
356  }
357  catch( ... ) { /* well, no big deal */ }
358 
359  cont = dir.GetNext( &fileName );
360  }
361  }
362  }
363 
364 
365  pluginInit();
366 }
367 
368 
369 BOM_PLUGIN* DIALOG_BOM::addPlugin( const wxString& aPath, const wxString& aName )
370 {
371  BOM_PLUGIN* ret = nullptr;
372  auto plugin = std::make_unique<BOM_PLUGIN>( aPath );
373 
374  if( !plugin )
375  return nullptr;
376 
377  if( !aName.IsEmpty() )
378  {
379  plugin->SetName( aName );
380  m_lbPlugins->Append( aName );
381  }
382  else
383  {
384  m_lbPlugins->Append( plugin->GetName() );
385  }
386 
387  ret = plugin.get();
388  m_plugins.push_back( std::move( plugin ) );
389  return ret;
390 }
391 
392 
393 bool DIALOG_BOM::pluginExists( const wxString& aName )
394 {
395  for( unsigned ii = 0; ii < m_plugins.size(); ii++ )
396  {
397  if( aName == m_plugins[ii]->GetName() )
398  return true;
399  }
400 
401  return false;
402 }
403 
404 
405 void DIALOG_BOM::OnPluginSelected( wxCommandEvent& event )
406 {
407  pluginInit();
408 }
409 
410 
412 {
413  auto plugin = selectedPlugin();
414 
415  if( !plugin )
416  {
417  m_textCtrlName->SetValue( wxEmptyString );
418  m_textCtrlCommand->SetValue( wxEmptyString );
419  m_Messages->SetValue( wxEmptyString );
420  return;
421  }
422 
423  m_textCtrlName->SetValue( plugin->GetName() );
424  m_textCtrlCommand->SetValue( plugin->GetCommand() );
425  m_Messages->SetValue( plugin->GetInfo() );
426  m_Messages->SetSelection( 0, 0 );
427 
428 #ifdef __WINDOWS__
429  if( plugin->Options().Index( wxT( "show_console" ) ) == wxNOT_FOUND )
430  m_checkBoxShowConsole->SetValue( false );
431  else
432  m_checkBoxShowConsole->SetValue( true );
433 #endif
434 }
435 
436 
437 void DIALOG_BOM::OnRunPlugin( wxCommandEvent& event )
438 {
439  // Calculate the xml netlist filename
440  wxFileName fn = g_RootSheet->GetScreen()->GetFileName();
441 
442  fn.SetPath( wxPathOnly( Prj().GetProjectFullName() ) );
443  fn.ClearExt();
444 
445  wxString fullfilename = fn.GetFullPath();
447 
448  wxString reportmsg;
449  WX_STRING_REPORTER reporter( &reportmsg );
451 
452 #ifdef __WINDOWS__
453  if( m_checkBoxShowConsole->IsChecked() )
454  m_parent->SetExecFlags( wxEXEC_SHOW_CONSOLE );
455 #endif
456 
457  m_parent->CreateNetlist( -1, fullfilename, 0, &reporter, false );
458 
459  m_Messages->SetValue( reportmsg );
460 }
461 
462 
463 void DIALOG_BOM::OnRemovePlugin( wxCommandEvent& event )
464 {
465  int ii = m_lbPlugins->GetSelection();
466 
467  if( ii < 0 )
468  return;
469 
470  m_lbPlugins->Delete( ii );
471  m_plugins.erase( m_plugins.begin() + ii );
472 
473  // Select the next item, if exists
474  if( m_lbPlugins->GetCount() )
475  m_lbPlugins->SetSelection( std::min( ii, (int) m_lbPlugins->GetCount() - 1 ) );
476 
477  pluginInit();
478 }
479 
480 
481 void DIALOG_BOM::OnAddPlugin( wxCommandEvent& event )
482 {
483  wxString filename = choosePlugin();
484 
485  if( filename.IsEmpty() )
486  return;
487 
488  // Creates a new plugin entry
489  wxFileName fn( filename );
490  wxString name = wxGetTextFromUser( _( "Plugin nickname:" ), _( "Add Plugin" ),
491  fn.GetName(), this );
492 
493  if( name.IsEmpty() )
494  return;
495 
496  // Verify if it does not exists
497  if( pluginExists( name ) )
498  {
499  wxMessageBox( wxString::Format( _( "Nickname \"%s\" already in use." ), name ) );
500  return;
501  }
502 
503  try
504  {
505  auto plugin = addPlugin( fn.GetFullPath(), name );
506 
507  if( plugin )
508  {
509  m_lbPlugins->SetSelection( m_lbPlugins->GetCount() - 1 );
510  m_textCtrlCommand->SetValue( plugin->GetCommand() );
511  pluginInit();
512  }
513  }
514  catch( const std::runtime_error& e )
515  {
516  DisplayError( this, e.what() );
517  }
518 }
519 
520 
522 {
523  static wxString lastPath;
524 
525  if( lastPath.IsEmpty() )
526  {
527 #ifndef __WXMAC__
528  lastPath = Pgm().GetExecutablePath();
529 #else
530  lastPath = GetOSXKicadDataDir() + "/plugins";
531 #endif
532  }
533 
534  wxString fullFileName = EDA_FILE_SELECTOR( _( "Plugin files:" ), lastPath, wxEmptyString,
535  wxEmptyString, "*", this, wxFD_OPEN, true );
536 
537  return fullFileName;
538 }
539 
540 
541 void DIALOG_BOM::OnEditPlugin( wxCommandEvent& event )
542 {
543  auto plugin = selectedPlugin();
544 
545  if( !plugin )
546  return;
547 
548  wxString pluginFile = plugin->GetFile().GetFullPath();
549 
550  if( pluginFile.Length() <= 2 ) // if name != ""
551  {
552  wxMessageBox( _( "Plugin file name not found." ) );
553  return;
554  }
555 
556  AddDelimiterString( pluginFile );
557  wxString editorname = Pgm().GetEditorName();
558 
559  if( !editorname.IsEmpty() )
560  ExecuteFile( this, editorname, pluginFile );
561  else
562  wxMessageBox( _( "No text editor selected in KiCad. Please choose one." ) );
563 }
564 
565 
566 void DIALOG_BOM::OnHelp( wxCommandEvent& event )
567 {
568  HTML_MESSAGE_BOX help_Dlg( this, _( "Bill of Material Generation Help" ) );
569  help_Dlg.SetDialogSizeInDU( 500, 350 );
570 
571  wxString msg = FROM_UTF8( s_bomHelpInfo );
572  help_Dlg.m_htmlWindow->AppendToPage( msg );
573  help_Dlg.ShowModal();
574 }
575 
576 
577 void DIALOG_BOM::OnCommandLineEdited( wxCommandEvent& event )
578 {
579  auto plugin = selectedPlugin();
580 
581  if( plugin )
582  plugin->SetCommand( m_textCtrlCommand->GetValue() );
583 }
584 
585 
586 void DIALOG_BOM::OnNameEdited( wxCommandEvent& event )
587 {
588  int ii = m_lbPlugins->GetSelection();
589 
590  if( ii < 0 )
591  return;
592 
593  m_plugins[ii]->SetName( m_textCtrlName->GetValue() );
594  m_lbPlugins->SetString( ii, m_plugins[ii]->GetName() );
595 }
596 
597 
598 void DIALOG_BOM::OnShowConsoleChanged( wxCommandEvent& event )
599 {
600 #ifdef __WINDOWS__
601  static constexpr wxChar OPT_SHOW_CONSOLE[] = wxT( "show_console" );
602 
603  auto plugin = selectedPlugin();
604 
605  if( !plugin )
606  return;
607 
608  if( m_checkBoxShowConsole->IsChecked() )
609  {
610  if( plugin->Options().Index( OPT_SHOW_CONSOLE ) == wxNOT_FOUND )
611  plugin->Options().Add( OPT_SHOW_CONSOLE );
612  }
613  else
614  {
615  plugin->Options().Remove( OPT_SHOW_CONSOLE );
616  }
617 #endif
618 }
619 
620 
621 void DIALOG_BOM::OnIdle( wxIdleEvent& event )
622 {
623  // On some platforms we initialize wxTextCtrls to all-selected, but we don't want that
624  // for the messages text box.
625  if( !m_initialized )
626  {
627  m_Messages->SetSelection( 0, 0 );
628  m_initialized = true;
629  }
630 }
void OnPluginSelected(wxCommandEvent &event) override
Definition: dialog_bom.cpp:405
wxBitmapButton * m_buttonEdit
wxBitmapButton * m_buttonAddPlugin
void OnCommandLineEdited(wxCommandEvent &event) override
Definition: dialog_bom.cpp:577
void Parse(void *yyp, int yymajor, ParseTOKENTYPE yyminorParseARG_PDECL)
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes...
Definition: macros.h:53
This file is part of the common library TODO brief description.
DIALOG_BOM(SCH_EDIT_FRAME *parent)
Definition: dialog_bom.cpp:215
This file is part of the common library.
VTBL_ENTRY const wxString & GetExecutablePath() const
Definition: pgm_base.h:215
static const char * s_bomHelpInfo
Definition: dialog_bom.cpp:52
wxStdDialogButtonSizer * m_sdbSizer1
const wxString & GetFileName() const
Definition: sch_screen.h:131
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
bool pluginExists(const wxString &aName)
Definition: dialog_bom.cpp:393
static constexpr wxChar BOM_TRACE[]
Definition: dialog_bom.cpp:47
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
static constexpr wxChar BOM_PLUGINS_KEY[]
Definition: dialog_bom.cpp:49
Schematic editor (Eeschema) main window.
int InvokeDialogCreateBOM(SCH_EDIT_FRAME *aCaller)
Create and show DIALOG_BOM and return whatever DIALOG_BOM::ShowModal() returns.
Definition: dialog_bom.cpp:208
void OnRunPlugin(wxCommandEvent &event) override
Definition: dialog_bom.cpp:437
SCH_SCREEN * GetScreen()
Definition: sch_sheet.h:279
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:115
void OnRemovePlugin(wxCommandEvent &event) override
Definition: dialog_bom.cpp:463
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
void OnIdle(wxIdleEvent &event) override
Definition: dialog_bom.cpp:621
void OnHelp(wxCommandEvent &event) override
Definition: dialog_bom.cpp:566
wxListBox * m_lbPlugins
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes...
Definition: macros.h:47
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
wxTextCtrl * m_textCtrlName
BOM_PLUGIN * addPlugin(const wxString &aPath, const wxString &aName=wxEmptyString)
Definition: dialog_bom.cpp:369
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:56
wxCheckBox * m_checkBoxShowConsole
void OnNameEdited(wxCommandEvent &event) override
Definition: dialog_bom.cpp:586
Class representing a Bill of Material output plugin.
Definition: bom_plugins.h:37
std::vector< BOM_PLUGIN::PTR > BOM_PLUGIN_ARRAY
Definition: dialog_bom.cpp:60
Subclass of DIALOG_DISPLAY_HTML_TEXT_BASE, which is generated by wxFormBuilder.
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:82
wxTextCtrl * m_textCtrlCommand
void OnEditPlugin(wxCommandEvent &event) override
Definition: dialog_bom.cpp:541
Helper dialog and control classes.
wxString choosePlugin()
Definition: dialog_bom.cpp:521
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
void AddDelimiterString(wxString &string)
Function AddDelimiterString Add un " to the start and the end of string (if not already done)...
Definition: gestfich.cpp:44
wxBitmapButton * m_buttonDelPlugin
const std::string & GetString()
Definition: richio.h:475
std::string Quotew(const wxString &aWrapee)
Definition: richio.cpp:482
Class HTML_MESSAGE_BOX.
BOM_PLUGIN_ARRAY * m_pluginsList
Definition: dialog_bom.cpp:68
Holds data and functions pertinent to parsing a S-expression file.
Definition: dialog_bom.cpp:66
wxTextCtrl * m_Messages
bool m_initialized
Definition: dialog_bom.cpp:170
wxButton * m_sdbSizer1OK
Class WX_STRING_REPORTER is a wrapper for reporting to a wxString object.
Definition: reporter.h:165
void SetDialogSizeInDU(int aWidth, int aHeight)
set the dialog size, using a "logical value.
static constexpr wxChar BOM_PLUGIN_SELECTED_KEY[]
Definition: dialog_bom.cpp:50
BOM_PLUGIN_ARRAY m_plugins
Definition: dialog_bom.cpp:168
void parsePlugin()
Definition: dialog_bom.cpp:116
void OnAddPlugin(wxCommandEvent &event) override
Definition: dialog_bom.cpp:481
see class PGM_BASE
Implementation of std::make_unique for pre C++14 compilation environments.
const char * name
Definition: DXF_plotter.cpp:61
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
wxButton * m_sdbSizer1Cancel
bool CreateNetlist(int aFormat, const wxString &aFullFileName, unsigned aNetlistOptions, REPORTER *aReporter=NULL, bool silent=false)
Create a netlist for the current schematic.
Class DIALOG_BOM_BASE.
void installPluginsList()
Definition: dialog_bom.cpp:284
static bool IsPlugin(const wxString &aFile)
Returns true if a file name matches a recognized plugin format.
Definition: bom_plugins.cpp:71
SCH_EDIT_FRAME * m_parent
Definition: dialog_bom.cpp:167
VTBL_ENTRY const wxString & GetEditorName(bool aCanShowFileChooser=true)
Return the preferred editor name.
Definition: pgm_base.cpp:203
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Function Print formats and writes text to the output stream.
Definition: richio.cpp:404
BOM_PLUGIN * selectedPlugin()
Definition: dialog_bom.cpp:193
wxConfigBase * m_config
Definition: dialog_bom.cpp:169
BOM_CFG_PARSER(BOM_PLUGIN_ARRAY *aPlugins, const char *aData, const wxString &aSource)
Definition: dialog_bom.cpp:79
void SetName(const wxString &aName)
Sets the customisable plugin name.
Definition: bom_plugins.h:82
Class STRING_FORMATTER implements OUTPUTFORMATTER to a memory buffer.
Definition: richio.h:445
int ExecuteFile(wxWindow *frame, const wxString &ExecFile, const wxString &param, wxProcess *callback)
Function ExecuteFile calls the executable file ExecFile with the command line parameters param...
Definition: gestfich.cpp:208
void SetExecFlags(const int aFlags)
Set (adds) specified flags for next execution of external generator of the netlist or bom...
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:245
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
void SetNetListerCommand(const wxString &aCommand)
void ClearMsgPanel(void)
Clear all messages from the message panel.
void pluginInit()
Definition: dialog_bom.cpp:411
void OnShowConsoleChanged(wxCommandEvent &event) override
Definition: dialog_bom.cpp:598
#define min(a, b)
Definition: auxiliary.h:85