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  {
148  wxString option = FromUTF8();
149 
150  if( option.StartsWith( "nickname=", &name ) )
151  plugin->SetName( name );
152  else
153  plugin->Options().Add( option );
154  }
155 
156  NeedRIGHT();
157  break;
158 
159  default:
160  Unexpected( CurText() );
161  break;
162  }
163  }
164 
165  if( plugin )
166  m_pluginsList->push_back( std::move( plugin ) );
167 }
168 
169 
170 // The main dialog frame to run scripts to build bom
172 {
173 private:
176  wxConfigBase* m_config; // to store the "plugins"
178 
179 public:
180  DIALOG_BOM( SCH_EDIT_FRAME* parent );
181  ~DIALOG_BOM();
182 
183 private:
184  void OnPluginSelected( wxCommandEvent& event ) override;
185  void OnRunPlugin( wxCommandEvent& event ) override;
186  void OnHelp( wxCommandEvent& event ) override;
187  void OnAddPlugin( wxCommandEvent& event ) override;
188  void OnRemovePlugin( wxCommandEvent& event ) override;
189  void OnEditPlugin( wxCommandEvent& event ) override;
190  void OnCommandLineEdited( wxCommandEvent& event ) override;
191  void OnNameEdited( wxCommandEvent& event ) override;
192  void OnShowConsoleChanged( wxCommandEvent& event ) override;
193  void OnIdle( wxIdleEvent& event ) override;
194 
195  void pluginInit();
196  void installPluginsList();
197  BOM_PLUGIN* addPlugin( const wxString& aPath, const wxString& aName = wxEmptyString );
198  bool pluginExists( const wxString& aName );
199 
201  {
202  int idx = m_lbPlugins->GetSelection();
203 
204  if( idx < 0 || idx >= (int)m_plugins.size() )
205  return nullptr;
206 
207  return m_plugins[idx].get();
208  }
209 
210  wxString choosePlugin();
211 };
212 
213 
214 // Create and show DIALOG_BOM.
216 {
217  DIALOG_BOM dlg( aCaller );
218  return dlg.ShowModal();
219 }
220 
221 
223  DIALOG_BOM_BASE( parent )
224 {
225  m_parent = parent;
227  m_initialized = false;
228 
229  m_buttonAddPlugin->SetBitmap( KiBitmap( small_plus_xpm ) );
230  m_buttonDelPlugin->SetBitmap( KiBitmap( trash_xpm ) );
231  m_buttonEdit->SetBitmap( KiBitmap( small_edit_xpm ) );
232 
234 
235 #ifndef __WINDOWS__
236  m_checkBoxShowConsole->Show( false );
237 #endif
238 
239  m_sdbSizerOK->SetLabel( _( "Generate" ) );
240  m_sdbSizerCancel->SetLabel( _( "Close" ) );
241  m_sdbSizer->Layout();
242 
244  m_sdbSizerOK->SetDefault();
245 
246  // Now all widgets have the size fixed, call FinishDialogSettings
248 }
249 
251 {
252  // Save the plugin descriptions in config.
253  // The config stores only one string, so we save the plugins inside a S-expr:
254  // ( plugins
255  // ( plugin "plugin name 1" (cmd "command line 1") )
256  // ( plugin "plugin name 2" (cmd "command line 2") (opts "option1") (opts "option2") )
257  // ....
258  // )
259 
260  STRING_FORMATTER writer;
261  writer.Print( 0, "(plugins" );
262 
263  for( auto& plugin : m_plugins )
264  {
265  writer.Print( 1, "(plugin %s (cmd %s)",
266  writer.Quotew( plugin->GetFile().GetFullPath() ).c_str(),
267  writer.Quotew( plugin->GetCommand() ).c_str() );
268 
269  for( unsigned jj = 0; jj < plugin->Options().GetCount(); jj++ )
270  {
271  writer.Print( 1, "(opts %s)",
272  writer.Quotew( plugin->Options().Item( jj ) ).c_str() );
273  }
274 
275  if( !plugin->GetName().IsEmpty() )
276  {
277  wxString option = wxString::Format( "nickname=%s", plugin->GetName() );
278 
279  writer.Print( 1, "(opts %s)",
280  writer.Quotew( option ).c_str() );
281  }
282 
283  writer.Print( 0, ")" );
284  }
285 
286  writer.Print( 0, ")" );
287 
288  wxString list( FROM_UTF8( writer.GetString().c_str() ) );
289 
290  m_config->Write( BOM_PLUGINS_KEY, list );
291 
292  wxString active_plugin_name = m_lbPlugins->GetStringSelection( );
293  m_config->Write( BOM_PLUGIN_SELECTED_KEY, active_plugin_name );
294 }
295 
296 
297 // Read the initialized plugins in config and fill the list of names
299 {
300  wxString list, active_plugin_name;
301  m_config->Read( BOM_PLUGINS_KEY, &list );
302  m_config->Read( BOM_PLUGIN_SELECTED_KEY, &active_plugin_name );
303 
304  if( !list.IsEmpty() )
305  {
306  BOM_CFG_PARSER cfg_parser( &m_plugins, TO_UTF8( list ), wxT( "plugins" ) );
307 
308  try
309  {
310  cfg_parser.Parse();
311  }
312  catch( const IO_ERROR& )
313  {
314 // wxLogMessage( ioe.What() );
315  }
316  catch( std::runtime_error& e )
317  {
318  DisplayError( nullptr, e.what() );
319  }
320 
321  // Populate list box
322  for( unsigned ii = 0; ii < m_plugins.size(); ii++ )
323  {
324  m_lbPlugins->Append( m_plugins[ii]->GetName() );
325 
326  if( active_plugin_name == m_plugins[ii]->GetName() )
327  m_lbPlugins->SetSelection( ii );
328  }
329  }
330 
331  if( m_plugins.empty() ) // No plugins found?
332  {
333  // Load plugins from the default locations
334  std::vector<wxString> pluginPaths = {
335 #if defined(__WXGTK__)
336  "/usr/share/kicad/plugins",
337  "/usr/local/share/kicad/plugins",
338 #elif defined(__WXMSW__)
339  wxString::Format( "%s\\scripting\\plugins", Pgm().GetExecutablePath() ),
340 #elif defined(__WXMAC__)
341  wxString::Format( "%s/plugins", GetOSXKicadDataDir() ),
342 #endif
343  };
344 
345  wxFileName pluginPath;
346 
347  for( const auto& path : pluginPaths )
348  {
349  wxLogDebug( wxString::Format( "Searching directory %s for BOM plugins", path ) );
350  wxDir dir( path );
351 
352  if( !dir.IsOpened() )
353  continue;
354 
355  pluginPath.AssignDir( dir.GetName() );
356  wxString fileName;
357  bool cont = dir.GetFirst( &fileName, wxFileSelectorDefaultWildcardStr, wxDIR_FILES );
358 
359  while( cont )
360  {
361  try
362  {
363  wxLogTrace( BOM_TRACE, wxString::Format( "Checking if %s is a BOM plugin", fileName ) );
364 
365  if( BOM_PLUGIN::IsPlugin( fileName ) )
366  {
367  pluginPath.SetFullName( fileName );
368  addPlugin( pluginPath.GetFullPath() );
369  }
370  }
371  catch( ... ) { /* well, no big deal */ }
372 
373  cont = dir.GetNext( &fileName );
374  }
375  }
376  }
377 
378 
379  pluginInit();
380 }
381 
382 
383 BOM_PLUGIN* DIALOG_BOM::addPlugin( const wxString& aPath, const wxString& aName )
384 {
385  BOM_PLUGIN* ret = nullptr;
386  auto plugin = std::make_unique<BOM_PLUGIN>( aPath );
387 
388  if( !plugin )
389  return nullptr;
390 
391  if( !aName.IsEmpty() )
392  {
393  plugin->SetName( aName );
394  m_lbPlugins->Append( aName );
395  }
396  else
397  {
398  m_lbPlugins->Append( plugin->GetName() );
399  }
400 
401  ret = plugin.get();
402  m_plugins.push_back( std::move( plugin ) );
403  return ret;
404 }
405 
406 
407 bool DIALOG_BOM::pluginExists( const wxString& aName )
408 {
409  for( unsigned ii = 0; ii < m_plugins.size(); ii++ )
410  {
411  if( aName == m_plugins[ii]->GetName() )
412  return true;
413  }
414 
415  return false;
416 }
417 
418 
419 void DIALOG_BOM::OnPluginSelected( wxCommandEvent& event )
420 {
421  pluginInit();
422 }
423 
424 
426 {
427  auto plugin = selectedPlugin();
428 
429  if( !plugin )
430  {
431  m_textCtrlName->SetValue( wxEmptyString );
432  m_textCtrlCommand->SetValue( wxEmptyString );
433  m_Messages->SetValue( wxEmptyString );
434  return;
435  }
436 
437  m_textCtrlName->SetValue( plugin->GetName() );
438  m_textCtrlCommand->SetValue( plugin->GetCommand() );
439  m_Messages->SetValue( plugin->GetInfo() );
440  m_Messages->SetSelection( 0, 0 );
441 
442 #ifdef __WINDOWS__
443  if( plugin->Options().Index( wxT( "show_console" ) ) == wxNOT_FOUND )
444  m_checkBoxShowConsole->SetValue( false );
445  else
446  m_checkBoxShowConsole->SetValue( true );
447 #endif
448 
449  // A plugin can be not working, so do not left the OK button enabled if
450  // the plugin is not ready to use
451  m_sdbSizerOK->Enable( plugin->IsOk() );
452 }
453 
454 
455 void DIALOG_BOM::OnRunPlugin( wxCommandEvent& event )
456 {
457  // Calculate the xml netlist filename
458  wxFileName fn = g_RootSheet->GetScreen()->GetFileName();
459 
460  fn.SetPath( wxPathOnly( Prj().GetProjectFullName() ) );
461  fn.ClearExt();
462 
463  wxString fullfilename = fn.GetFullPath();
465 
466  wxString reportmsg;
467  WX_STRING_REPORTER reporter( &reportmsg );
469 
470 #ifdef __WINDOWS__
471  if( m_checkBoxShowConsole->IsChecked() )
472  m_parent->SetExecFlags( wxEXEC_SHOW_CONSOLE );
473 #endif
474 
475  m_parent->CreateNetlist( -1, fullfilename, 0, &reporter, false );
476 
477  m_Messages->SetValue( reportmsg );
478 }
479 
480 
481 void DIALOG_BOM::OnRemovePlugin( wxCommandEvent& event )
482 {
483  int ii = m_lbPlugins->GetSelection();
484 
485  if( ii < 0 )
486  return;
487 
488  m_lbPlugins->Delete( ii );
489  m_plugins.erase( m_plugins.begin() + ii );
490 
491  // Select the next item, if exists
492  if( m_lbPlugins->GetCount() )
493  m_lbPlugins->SetSelection( std::min( ii, (int) m_lbPlugins->GetCount() - 1 ) );
494 
495  pluginInit();
496 }
497 
498 
499 void DIALOG_BOM::OnAddPlugin( wxCommandEvent& event )
500 {
501  wxString filename = choosePlugin();
502 
503  if( filename.IsEmpty() )
504  return;
505 
506  // Creates a new plugin entry
507  wxFileName fn( filename );
508  wxString name = wxGetTextFromUser( _( "Plugin nickname:" ), _( "Add Plugin" ),
509  fn.GetName(), this );
510 
511  if( name.IsEmpty() )
512  return;
513 
514  // Verify if it does not exists
515  if( pluginExists( name ) )
516  {
517  wxMessageBox( wxString::Format( _( "Nickname \"%s\" already in use." ), name ) );
518  return;
519  }
520 
521  try
522  {
523  auto plugin = addPlugin( fn.GetFullPath(), name );
524 
525  if( plugin )
526  {
527  m_lbPlugins->SetSelection( m_lbPlugins->GetCount() - 1 );
528  m_textCtrlCommand->SetValue( plugin->GetCommand() );
529  pluginInit();
530  }
531  }
532  catch( const std::runtime_error& e )
533  {
534  DisplayError( this, e.what() );
535  }
536 }
537 
538 
540 {
541  static wxString lastPath;
542 
543  if( lastPath.IsEmpty() )
544  {
545 #ifndef __WXMAC__
546  lastPath = Pgm().GetExecutablePath();
547 #else
548  lastPath = GetOSXKicadDataDir() + "/plugins";
549 #endif
550  }
551 
552  wxString fullFileName = EDA_FILE_SELECTOR( _( "Plugin files:" ), lastPath, wxEmptyString,
553  wxEmptyString, wxFileSelectorDefaultWildcardStr,
554  this, wxFD_OPEN, true );
555 
556  return fullFileName;
557 }
558 
559 
560 void DIALOG_BOM::OnEditPlugin( wxCommandEvent& event )
561 {
562  auto plugin = selectedPlugin();
563 
564  if( !plugin )
565  return;
566 
567  wxString pluginFile = plugin->GetFile().GetFullPath();
568 
569  if( pluginFile.Length() <= 2 ) // if name != ""
570  {
571  wxMessageBox( _( "Plugin file name not found." ) );
572  return;
573  }
574 
575  AddDelimiterString( pluginFile );
576  wxString editorname = Pgm().GetEditorName();
577 
578  if( !editorname.IsEmpty() )
579  ExecuteFile( this, editorname, pluginFile );
580  else
581  wxMessageBox( _( "No text editor selected in KiCad. Please choose one." ) );
582 }
583 
584 
585 void DIALOG_BOM::OnHelp( wxCommandEvent& event )
586 {
587  HTML_MESSAGE_BOX help_Dlg( this, _( "Bill of Material Generation Help" ) );
588  help_Dlg.SetDialogSizeInDU( 500, 350 );
589 
590  wxString msg = FROM_UTF8( s_bomHelpInfo );
591  help_Dlg.m_htmlWindow->AppendToPage( msg );
592  help_Dlg.ShowModal();
593 }
594 
595 
596 void DIALOG_BOM::OnCommandLineEdited( wxCommandEvent& event )
597 {
598  auto plugin = selectedPlugin();
599 
600  if( plugin )
601  plugin->SetCommand( m_textCtrlCommand->GetValue() );
602 }
603 
604 
605 void DIALOG_BOM::OnNameEdited( wxCommandEvent& event )
606 {
607  int ii = m_lbPlugins->GetSelection();
608 
609  if( ii < 0 )
610  return;
611 
612  m_plugins[ii]->SetName( m_textCtrlName->GetValue() );
613  m_lbPlugins->SetString( ii, m_plugins[ii]->GetName() );
614 }
615 
616 
617 void DIALOG_BOM::OnShowConsoleChanged( wxCommandEvent& event )
618 {
619 #ifdef __WINDOWS__
620  static constexpr wxChar OPT_SHOW_CONSOLE[] = wxT( "show_console" );
621 
622  auto plugin = selectedPlugin();
623 
624  if( !plugin )
625  return;
626 
627  if( m_checkBoxShowConsole->IsChecked() )
628  {
629  if( plugin->Options().Index( OPT_SHOW_CONSOLE ) == wxNOT_FOUND )
630  plugin->Options().Add( OPT_SHOW_CONSOLE );
631  }
632  else
633  {
634  plugin->Options().Remove( OPT_SHOW_CONSOLE );
635  }
636 #endif
637 }
638 
639 
640 void DIALOG_BOM::OnIdle( wxIdleEvent& event )
641 {
642  // On some platforms we initialize wxTextCtrls to all-selected, but we don't want that
643  // for the messages text box.
644  if( !m_initialized )
645  {
646  m_Messages->SetSelection( 0, 0 );
647  m_initialized = true;
648  }
649 }
void OnPluginSelected(wxCommandEvent &event) override
Definition: dialog_bom.cpp:419
wxBitmapButton * m_buttonEdit
wxBitmapButton * m_buttonAddPlugin
const wxString & GetFileName() const
Definition: sch_screen.h:131
void OnCommandLineEdited(wxCommandEvent &event) override
Definition: dialog_bom.cpp:596
wxStdDialogButtonSizer * m_sdbSizer
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:222
This file is part of the common library.
void Parse(void *yyp, int yymajor, ParseTOKENTYPE yyminor ParseARG_PDECL)
static const char * s_bomHelpInfo
Definition: dialog_bom.cpp:52
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
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:407
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:215
void OnRunPlugin(wxCommandEvent &event) override
Definition: dialog_bom.cpp:455
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:116
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
void OnRemovePlugin(wxCommandEvent &event) override
Definition: dialog_bom.cpp:481
void OnIdle(wxIdleEvent &event) override
Definition: dialog_bom.cpp:640
void OnHelp(wxCommandEvent &event) override
Definition: dialog_bom.cpp:585
wxListBox * m_lbPlugins
wxButton * m_sdbSizerOK
#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
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:383
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:56
wxCheckBox * m_checkBoxShowConsole
void OnNameEdited(wxCommandEvent &event) override
Definition: dialog_bom.cpp:605
Class representing a Bill of Material output plugin.
Definition: bom_plugins.h:37
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
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:560
Helper dialog and control classes.
wxString choosePlugin()
Definition: dialog_bom.cpp:539
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:177
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:175
void parsePlugin()
Definition: dialog_bom.cpp:116
void OnAddPlugin(wxCommandEvent &event) override
Definition: dialog_bom.cpp:499
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
bool CreateNetlist(int aFormat, const wxString &aFullFileName, unsigned aNetlistOptions, REPORTER *aReporter=NULL, bool silent=false)
Create a netlist for the current schematic.
VTBL_ENTRY const wxString & GetExecutablePath() const
Definition: pgm_base.h:217
Class DIALOG_BOM_BASE.
wxButton * m_sdbSizerCancel
void installPluginsList()
Definition: dialog_bom.cpp:298
static bool IsPlugin(const wxString &aFile)
Returns true if a file name matches a recognized plugin format.
Definition: bom_plugins.cpp:78
SCH_EDIT_FRAME * m_parent
Definition: dialog_bom.cpp:174
VTBL_ENTRY const wxString & GetEditorName(bool aCanShowFileChooser=true)
Return the preferred editor name.
Definition: pgm_base.cpp:200
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:200
wxConfigBase * m_config
Definition: dialog_bom.cpp:176
BOM_CFG_PARSER(BOM_PLUGIN_ARRAY *aPlugins, const char *aData, const wxString &aSource)
Definition: dialog_bom.cpp:79
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:243
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:425
void OnShowConsoleChanged(wxCommandEvent &event) override
Definition: dialog_bom.cpp:617
#define min(a, b)
Definition: auxiliary.h:85