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 <wx/dynarray.h>
38 
39 #include <netlist.h>
41 #include <sch_sheet.h>
42 #include <invoke_sch_dialog.h>
43 #include <dialog_helpers.h>
44 #include <dialog_bom_base.h>
45 #include <html_messagebox.h>
46 #include <reporter.h>
47 
48 #define BOM_PLUGINS_KEY wxT("bom_plugins")
49 #define BOM_PLUGIN_SELECTED_KEY wxT("bom_plugin_selected")
50 
51 const char * s_bomHelpInfo =
52 #include <dialog_bom_help_html.h>
53 ;
54 
55 #include <dialog_bom_cfg_lexer.h>
56 
57 using namespace T_BOMCFG_T;
58 
63 struct BOM_PLUGIN
64 {
65  wxString Name;
66  wxString Command;
67  wxArrayString Options;
68 };
69 
73 WX_DECLARE_OBJARRAY( BOM_PLUGIN, BOM_PLUGIN_ARRAY );
74 #include <wx/arrimpl.cpp>
75 WX_DEFINE_OBJARRAY( BOM_PLUGIN_ARRAY )
76 
77 
82 class BOM_CFG_READER_PARSER : public DIALOG_BOM_CFG_LEXER
83 {
84  BOM_PLUGIN_ARRAY* m_pluginsList;
85 
86 public:
87  BOM_CFG_READER_PARSER( BOM_PLUGIN_ARRAY* aPlugins,
88  const char* aData, const wxString& aSource );
89  void Parse();
90 
91 private:
92  void parsePlugin();
93 };
94 
95 // PCB_PLOT_PARAMS_PARSER
96 
98  const char* aLine,
99  const wxString& aSource ) :
100  DIALOG_BOM_CFG_LEXER( aLine, aSource )
101 {
102  m_pluginsList = aPlugins;
103 }
104 
105 
107 {
108  T token;
109 
110  while( ( token = NextTok() ) != T_RIGHT )
111  {
112  if( token == T_EOF)
113  break;
114 
115  if( token == T_LEFT )
116  token = NextTok();
117 
118  if( token == T_plugins )
119  continue;
120 
121  switch( token )
122  {
123  case T_plugin: // Defines a new plugin
124  parsePlugin();
125  break;
126 
127  default:
128 // Unexpected( CurText() );
129  break;
130  }
131  }
132 }
133 
135 {
136  BOM_PLUGIN plugin;
137 
138  NeedSYMBOLorNUMBER();
139  plugin.Name = FromUTF8();
140 
141  T token;
142  while( ( token = NextTok() ) != T_RIGHT )
143  {
144  if( token == T_EOF)
145  break;
146 
147  switch( token )
148  {
149  case T_LEFT:
150  break;
151 
152  case T_cmd:
153  NeedSYMBOLorNUMBER();
154  plugin.Command = FromUTF8();
155  NeedRIGHT();
156  break;
157 
158  case T_opts:
159  NeedSYMBOLorNUMBER();
160  plugin.Options.Add( FromUTF8() );
161  NeedRIGHT();
162  break;
163 
164  default:
165  Unexpected( CurText() );
166  break;
167  }
168  }
169 
170  if( ! plugin.Name.IsEmpty() )
171  m_pluginsList->Add( plugin );
172 }
173 
174 // The main dialog frame to run scripts to build bom
176 {
177 private:
179  BOM_PLUGIN_ARRAY m_plugins;
180  wxConfigBase* m_config; // to store the "plugins"
181 
182 public:
183  // Constructor and destructor
184  DIALOG_BOM( SCH_EDIT_FRAME* parent );
185  ~DIALOG_BOM();
186 
187 private:
188  void OnPluginSelected( wxCommandEvent& event ) override;
189  void OnRunPlugin( wxCommandEvent& event ) override;
190  void OnCancelClick( wxCommandEvent& event ) override;
191  void OnHelp( wxCommandEvent& event ) override;
192  void OnAddPlugin( wxCommandEvent& event ) override;
193  void OnRemovePlugin( wxCommandEvent& event ) override;
194  void OnEditPlugin( wxCommandEvent& event ) override;
195  void OnCommandLineEdited( wxCommandEvent& event ) override;
196  void OnNameEdited( wxCommandEvent& event ) override;
197  void OnShowConsoleChanged( wxCommandEvent& event ) override;
198 
199  void pluginInit();
200  void installPluginsList();
201 
206  wxString getPluginFileName( const wxString& aCommand );
207 
213  void displayPluginInfo( FILE * aFile, const wxString& aFilename );
214 
219  wxString choosePlugin();
220 };
221 
222 // Create and show DIALOG_BOM.
224 {
225  DIALOG_BOM dlg( aCaller );
226  return dlg.ShowModal();
227 }
228 
230  DIALOG_BOM_BASE( parent )
231 {
232  m_parent = parent;
235 
236 #ifndef __WINDOWS__
237  m_checkBoxShowConsole->Show( false );
238 #endif
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.
248  // plugins are saved inside a S expr:
249  // ( plugins
250  // ( plugin "plugin name 1" (cmd "command line 1") )
251  // ( plugin "plugin name 2" (cmd "command line 2") (opts "option1") (opts "option2") )
252  // ....
253  // )
254 
255  STRING_FORMATTER writer;
256  writer.Print( 0, "(plugins" );
257 
258  for( unsigned ii = 0; ii < m_plugins.GetCount(); ii++ )
259  {
260  writer.Print( 1, "(plugin %s (cmd %s)",
261  writer.Quotew( m_plugins.Item( ii ).Name ).c_str(),
262  writer.Quotew( m_plugins.Item( ii ).Command ).c_str() );
263 
264  for( unsigned jj = 0; jj < m_plugins.Item( ii ).Options.GetCount(); jj++ )
265  {
266  writer.Print( 1, "(opts %s)",
267  writer.Quotew( m_plugins.Item( ii ).Options.Item( jj ) ).c_str() );
268  }
269 
270  writer.Print( 0, ")" );
271  }
272 
273  writer.Print( 0, ")" );
274 
275  wxString list( FROM_UTF8( writer.GetString().c_str() ) );
276 
277  m_config->Write( BOM_PLUGINS_KEY, list );
278 
279  wxString active_plugin_name = m_lbPlugins->GetStringSelection( );
280  m_config->Write( BOM_PLUGIN_SELECTED_KEY, active_plugin_name );
281 
282 }
283 
284 /* Read the initialized plugins in config and fill the list
285  * of names
286  */
288 {
289  wxString list, active_plugin_name;
290  m_config->Read( BOM_PLUGINS_KEY, &list );
291  m_config->Read( BOM_PLUGIN_SELECTED_KEY, &active_plugin_name );
292 
293  if( !list.IsEmpty() )
294  {
295  BOM_CFG_READER_PARSER cfg_parser( &m_plugins, TO_UTF8( list ),
296  wxT( "plugins" ) );
297  try
298  {
299  cfg_parser.Parse();
300  }
301  catch( const IO_ERROR& )
302  {
303 // wxLogMessage( ioe.What() );
304  }
305  }
306 
307  // Populate list box
308  for( unsigned ii = 0; ii < m_plugins.GetCount(); ii++ )
309  {
310  m_lbPlugins->Append( m_plugins.Item( ii ).Name );
311 
312  if( active_plugin_name == m_plugins.Item( ii ).Name )
313  m_lbPlugins->SetSelection( ii );
314  }
315 
316  pluginInit();
317 }
318 
319 void DIALOG_BOM::OnPluginSelected( wxCommandEvent& event )
320 {
321  pluginInit();
322 }
323 
324 #include <wx/ffile.h>
326 {
327  int ii = m_lbPlugins->GetSelection();
328 
329  if( ii < 0 )
330  {
331  m_textCtrlName->SetValue( wxEmptyString );
332  m_textCtrlCommand->SetValue( wxEmptyString );
333  return;
334  }
335 
336  m_textCtrlName->SetValue( m_plugins.Item( ii ).Name );
337  m_textCtrlCommand->SetValue( m_plugins.Item( ii ).Command );
338 
339 #ifdef __WINDOWS__
340  if( m_plugins.Item( ii ).Options.Index( wxT( "show_console" ) ) == wxNOT_FOUND )
341  m_checkBoxShowConsole->SetValue( false );
342  else
343  m_checkBoxShowConsole->SetValue( true );
344 #endif
345 
346  wxString pluginName = getPluginFileName( m_textCtrlCommand->GetValue() );
347 
348  if( pluginName.IsEmpty() )
349  return;
350 
351  FILE* pluginFile = wxFopen( pluginName, "rt" );
352 
353  if( pluginFile == NULL )
354  {
355  wxString msg;
356  msg.Printf( _( "Failed to open file \"%s\"" ), GetChars( pluginName ) );
357  DisplayError( this, msg );
358  return;
359  }
360 
361  displayPluginInfo( pluginFile, pluginName );
362 }
363 
364 
365 void DIALOG_BOM::displayPluginInfo( FILE * aFile, const wxString& aFilename )
366 {
367  m_Messages->Clear();
368 
369  // display (when exists) the text found between the keyword "@package"
370  // (compatible with doxygen comments)
371  // and the end of comment block (""" in python", --> in xml)
372 
373  wxString data;
374  wxFFile fdata( aFile ); // dtor will close the file
375 
376  if( !fdata.ReadAll( &data ) )
377  return;
378 
379  wxString header( wxT( "@package" ) );
380  wxString endsection( wxT( "-->" ) ); // For xml
381 
382  wxFileName fn( aFilename );
383 
384  if( fn.GetExt().IsSameAs( wxT("py"), false ) )
385  endsection = wxT( "\"\"\"" );
386  else if( !fn.GetExt().IsSameAs( wxT("xsl"), false ) )
387  // If this is not a python file, we know nothing about file
388  // and the info cannot be found
389  return;
390 
391  // Extract substring between @package and """
392  int strstart = data.Find( header );
393 
394  if( strstart == wxNOT_FOUND )
395  return;
396 
397  strstart += header.Length();
398  int strend = data.find( endsection, strstart );
399 
400  if( strend == wxNOT_FOUND)
401  return;
402 
403  // Remove empty line if any
404  while( data[strstart] < ' ' )
405  strstart++;
406 
407  m_Messages->SetValue( data.SubString( strstart, strend-1 ) );
408 }
409 
414 void DIALOG_BOM::OnRunPlugin( wxCommandEvent& event )
415 {
416  wxFileName fn;
417 
418  // Calculate the xml netlist filename
419  fn = g_RootSheet->GetScreen()->GetFileName();
420 
421  fn.SetPath( wxPathOnly( Prj().GetProjectFullName() ) );
422 
423  fn.ClearExt();
424  wxString fullfilename = fn.GetFullPath();
426 
427  wxString reportmsg;
428  WX_STRING_REPORTER reporter( &reportmsg );
430 
431 #ifdef __WINDOWS__
432  if( m_checkBoxShowConsole->IsChecked() )
433  m_parent->SetExecFlags( wxEXEC_SHOW_CONSOLE );
434 #endif
435 
436  m_parent->CreateNetlist( -1, fullfilename, 0, &reporter, false );
437 
438  m_Messages->SetValue( reportmsg );
439 }
440 
441 
442 void DIALOG_BOM::OnCancelClick( wxCommandEvent& event )
443 {
444  EndModal( wxID_CANCEL );
445 }
446 
447 
452 void DIALOG_BOM::OnRemovePlugin( wxCommandEvent& event )
453 {
454  int ii = m_lbPlugins->GetSelection();
455 
456  if( ii < 0 )
457  return;
458 
459  m_lbPlugins->Delete( ii );
460 
461  m_plugins.RemoveAt( ii );
462 
463  // Select the next item, if exists
464  if( (int)m_lbPlugins->GetCount() >= ii )
465  ii = m_lbPlugins->GetCount() - 1;
466 
467  if( ii >= 0 )
468  m_lbPlugins->SetSelection( ii );
469 
470  pluginInit();
471 }
472 
477 void DIALOG_BOM::OnAddPlugin( wxCommandEvent& event )
478 {
479  wxString cmdLine = choosePlugin();
480  BOM_PLUGIN newPlugin;
481 
482  if( cmdLine.IsEmpty() )
483  return;
484 
485  // Creates a new plugin entry
486  wxFileName fn( getPluginFileName( cmdLine ) );
487 
488  wxString defaultName = fn.GetName();
489  wxString name = wxGetTextFromUser( _("Plugin name in plugin list") ,
490  _("Plugin name"), defaultName );
491 
492  if( name.IsEmpty() )
493  return;
494 
495  // Verify if it does not exists
496  for( unsigned ii = 0; ii < m_plugins.GetCount(); ii++ )
497  {
498  if( name == m_plugins.Item( ii ).Name )
499  {
500  wxMessageBox( _("This name already exists. Abort") );
501  return;
502  }
503  }
504 
505  // Append the new plugin
506  newPlugin.Name = name;
507  newPlugin.Command = wxEmptyString;
508  m_plugins.Add( newPlugin );
509  m_lbPlugins->SetSelection( m_lbPlugins->GetCount() - 1 );
510  m_lbPlugins->Append( name );
511  m_lbPlugins->SetSelection( m_lbPlugins->GetCount() - 1 );
512  m_textCtrlCommand->SetValue( cmdLine );
513 
514  pluginInit();
515 }
516 
517 /*
518  * Browse plugin files, and set m_CommandStringCtrl field
519  */
521 {
522  wxString mask = wxT( "*" );
523 #ifndef __WXMAC__
524  wxString path = Pgm().GetExecutablePath();
525 #else
526  wxString path = GetOSXKicadDataDir() + wxT( "/plugins" );
527 #endif
528 
529  wxString fullFileName = EDA_FILE_SELECTOR( _( "Plugin files:" ),
530  path,
531  wxEmptyString,
532  wxEmptyString,
533  mask,
534  this,
535  wxFD_OPEN,
536  true );
537  if( fullFileName.IsEmpty() )
538  return wxEmptyString;
539 
540  // Creates a default command line,
541  // suitable to run the external tool xslproc or python
542  // The default command line depending on plugin extension, currently
543  // "xsl" or "exe" or "py" or "pyw"
544  wxString cmdLine;
545  wxFileName fn( fullFileName );
546  wxString ext = fn.GetExt();
547 
548  // Python requires on Windows the path of the script ends by '/' instead of '\'
549  // otherwise import does not find modules in the same folder as the python script
550  // We cannot change all '\' to '/' in command line because it causes issues with files
551  // that are stored on network resources and pointed to using the Windows
552  // Universal Naming Convention format. (full filename starting by \\server\)
553  //
554  // I hope changing the last separator only to '/' will work.
555 #ifdef __WINDOWS__
556  if( ext == wxT("py" ) || ext == wxT("pyw" ) )
557  {
558  wxString sc_path = fn.GetPathWithSep();
559  sc_path.RemoveLast();
560  fullFileName = sc_path +'/' + fn.GetFullName();;
561  }
562 #endif
563 
564  if( ext == "xsl" )
565  cmdLine.Printf( "xsltproc -o \"%%O\" \"%s\" \"%%I\"", GetChars( fullFileName ) );
566  else if( ext == "exe" )
567  cmdLine.Printf( "\"%s\" < \"%%I\" > \"%%O\"", GetChars( fullFileName ) );
568  else if( ext == "py" )
569  cmdLine.Printf( "python \"%s\" \"%%I\" \"%%O\"", GetChars( fullFileName ) );
570  else if( ext == "pyw" )
571 #ifdef __WINDOWS__
572  cmdLine.Printf( "pythonw \"%s\" \"%%I\" \"%%O\"", GetChars( fullFileName ) );
573 #else
574  cmdLine.Printf( "python \"%s\" \"%%I\" \"%%O\"", GetChars( fullFileName ) );
575 #endif
576  else
577  cmdLine.Printf( "\"%s\"", GetChars( fullFileName ) );
578 
579  return cmdLine;
580 }
581 
582 
583 wxString DIALOG_BOM::getPluginFileName( const wxString& aCommand )
584 {
585  wxString pluginName;
586 
587  // Try to find the plugin name.
588  // This is possible if the name ends by .py or .pyw or .xsl or .exe
589  int pos = -1;
590 
591  if( (pos = aCommand.Find( wxT(".pyw") )) != wxNOT_FOUND )
592  pos += 3;
593  else if( (pos = aCommand.Find( wxT(".py") )) != wxNOT_FOUND )
594  pos += 2;
595  else if( (pos = aCommand.Find( wxT(".xsl") )) != wxNOT_FOUND )
596  pos += 3;
597  else if( (pos = aCommand.Find( wxT(".exe") )) != wxNOT_FOUND )
598  pos += 3;
599 
600  // the end of plugin name is at position pos.
601  if( pos > 0 )
602  {
603  // Be sure this is the end of the name: the next char is " or space
604  int eos = aCommand[pos+1];
605 
606  if( eos == ' '|| eos == '\"' )
607  {
608  // search for the starting point of the name
609  int jj = pos-1;
610  while( jj >= 0 )
611  if( aCommand[jj] != eos )
612  jj--;
613  else
614  break;
615 
616  // extract the name
617  if( jj >= 0 )
618  {
619  eos = aCommand[jj];
620 
621  if( eos == ' '|| eos == '\"' ) // do not include delimiters
622  jj++;
623 
624  pluginName = aCommand.SubString( jj, pos );
625  }
626  }
627  }
628 
629  // Using a format like %P is possible in plugin name, so expand it
630  wxString prj_dir = Prj().GetProjectPath();
631 
632  if( prj_dir.EndsWith( '/' ) || prj_dir.EndsWith( '\\' ) )
633  prj_dir.RemoveLast();
634 
635  pluginName.Replace( wxT( "%P" ), prj_dir.GetData(), true );
636 
637  return pluginName;
638 }
639 
640 void DIALOG_BOM::OnEditPlugin( wxCommandEvent& event )
641 {
642  wxString pluginName = getPluginFileName( m_textCtrlCommand->GetValue() );
643 
644  if( pluginName.Length() <= 2 ) // if name != ""
645  {
646  wxMessageBox( _("Plugin file name not found. Cannot edit plugin file") );
647  return;
648  }
649 
650  AddDelimiterString( pluginName );
651  wxString editorname = Pgm().GetEditorName();
652 
653  if( !editorname.IsEmpty() )
654  ExecuteFile( this, editorname, pluginName );
655  else
656  wxMessageBox( _("No text editor selected in KiCad. Please choose it") );
657 }
658 
659 void DIALOG_BOM::OnHelp( wxCommandEvent& event )
660 {
661  HTML_MESSAGE_BOX help_Dlg( this, _("Bom Generation Help") );
662  help_Dlg.SetDialogSizeInDU( 500, 350 );
663 
664  wxString msg = FROM_UTF8(s_bomHelpInfo);
665  help_Dlg.m_htmlWindow->AppendToPage( msg );
666  help_Dlg.ShowModal();
667 }
668 
669 void DIALOG_BOM::OnCommandLineEdited( wxCommandEvent& event )
670 {
671  int ii = m_lbPlugins->GetSelection();
672 
673  if( ii < 0 )
674  return;
675 
676  m_plugins.Item( ii ).Command = m_textCtrlCommand->GetValue();
677 }
678 
679 void DIALOG_BOM::OnNameEdited( wxCommandEvent& event )
680 {
681  int ii = m_lbPlugins->GetSelection();
682 
683  if( ii < 0 )
684  return;
685 
686  m_plugins.Item( ii ).Name = m_textCtrlName->GetValue();
687  m_lbPlugins->SetString( ii, m_plugins.Item( ii ).Name );
688 }
689 
690 void DIALOG_BOM::OnShowConsoleChanged( wxCommandEvent& event )
691 {
692 #ifdef __WINDOWS__
693  int ii = m_lbPlugins->GetSelection();
694 
695  if( ii < 0 )
696  return;
697 
698  if( m_checkBoxShowConsole->IsChecked() )
699  {
700  if( m_plugins.Item( ii ).Options.Index( wxT( "show_console" ) ) == wxNOT_FOUND )
701  m_plugins.Item( ii ).Options.Add( wxT( "show_console" ) );
702  }
703  else
704  {
705  m_plugins.Item( ii ).Options.Remove( wxT( "show_console" ) );
706  }
707 #endif
708 }
Definition of the SCH_SHEET class for Eeschema.
void OnPluginSelected(wxCommandEvent &event) override
Definition: dialog_bom.cpp:319
void OnCommandLineEdited(wxCommandEvent &event) override
Definition: dialog_bom.cpp:669
wxArrayString Options
Definition: dialog_bom.cpp:67
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:229
Structure BOM_PLUGIN holds data of the BOM plugin.
Definition: dialog_bom.cpp:63
This file is part of the common library.
VTBL_ENTRY const wxString & GetExecutablePath() const
Definition: pgm_base.h:173
const char * s_bomHelpInfo
Definition: dialog_bom.cpp:51
#define BOM_PLUGIN_SELECTED_KEY
Definition: dialog_bom.cpp:49
wxString getPluginFileName(const wxString &aCommand)
Definition: dialog_bom.cpp:583
const wxString & GetFileName() const
Definition: sch_screen.h:120
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
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:223
void OnRunPlugin(wxCommandEvent &event) override
Function RunPlugin run the plugin command line.
Definition: dialog_bom.cpp:414
SCH_SCREEN * GetScreen()
Definition: sch_sheet.h:279
WX_DECLARE_OBJARRAY(BOM_PLUGIN, BOM_PLUGIN_ARRAY)
Define wxArray of BOM_PLUGIN.
void OnRemovePlugin(wxCommandEvent &event) override
Function OnRemovePlugin Remove a plugin from the list.
Definition: dialog_bom.cpp:452
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
void OnHelp(wxCommandEvent &event) override
Definition: dialog_bom.cpp:659
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.
void OnCancelClick(wxCommandEvent &event) override
Definition: dialog_bom.cpp:442
wxString Name
Definition: dialog_bom.cpp:65
BOM_PLUGIN_ARRAY * m_pluginsList
Definition: dialog_bom.cpp:84
wxTextCtrl * m_textCtrlName
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:55
wxCheckBox * m_checkBoxShowConsole
void OnNameEdited(wxCommandEvent &event) override
Definition: dialog_bom.cpp:679
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:640
Helper dialog and control classes.
wxString choosePlugin()
Browse plugin files, and set m_CommandStringCtrl field.
Definition: dialog_bom.cpp:520
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
#define BOM_PLUGINS_KEY
Definition: dialog_bom.cpp:48
const std::string & GetString()
Definition: richio.h:475
std::string Quotew(const wxString &aWrapee)
Definition: richio.cpp:482
Class HTML_MESSAGE_BOX.
wxTextCtrl * m_Messages
BOM_CFG_READER_PARSER(BOM_PLUGIN_ARRAY *aPlugins, const char *aData, const wxString &aSource)
Definition: dialog_bom.cpp:97
Class WX_STRING_REPORTER is a wrapper for reporting to a wxString object.
Definition: reporter.h:124
void SetDialogSizeInDU(int aWidth, int aHeight)
set the dialog size, using a "logical value.
Class BOM_CFG_READER_PARSER holds data and functions pertinent to parsing a S-expression file for a W...
Definition: dialog_bom.cpp:82
BOM_PLUGIN_ARRAY m_plugins
Definition: dialog_bom.cpp:179
void OnAddPlugin(wxCommandEvent &event) override
Function OnAddPlugin Add a new panel for a new netlist plugin.
Definition: dialog_bom.cpp:477
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:92
see class PGM_BASE
const char * name
Definition: DXF_plotter.cpp:61
void displayPluginInfo(FILE *aFile, const wxString &aFilename)
display (when exists) the text found between the keyword "@package" (compatible with doxygen comments...
Definition: dialog_bom.cpp:365
bool CreateNetlist(int aFormat, const wxString &aFullFileName, unsigned aNetlistOptions, REPORTER *aReporter=NULL, bool silent=false)
Create a netlist for the current schematic.
wxString Command
Definition: dialog_bom.cpp:66
Class DIALOG_BOM_BASE.
VTBL_ENTRY const wxString GetProjectPath() const
Function GetProjectPath returns the full path of the project.
Definition: project.cpp:100
void installPluginsList()
Definition: dialog_bom.cpp:287
SCH_EDIT_FRAME * m_parent
Definition: dialog_bom.cpp:178
VTBL_ENTRY const wxString & GetEditorName(bool aCanShowFileChooser=true)
Return the preferred editor name.
Definition: pgm_base.cpp:338
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Function Print formats and writes text to the output stream.
Definition: richio.cpp:404
wxConfigBase * m_config
Definition: dialog_bom.cpp:180
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:185
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
void SetNetListerCommand(const wxString &aCommand)
void ClearMsgPanel(void)
Clear all messages from the message panel.
Definition: draw_frame.cpp:823
void pluginInit()
Definition: dialog_bom.cpp:325
void OnShowConsoleChanged(wxCommandEvent &event) override
Definition: dialog_bom.cpp:690