diff --git a/eeschema/bom_plugins.cpp b/eeschema/bom_plugins.cpp index 581ef9e864..4d992946ec 100644 --- a/eeschema/bom_plugins.cpp +++ b/eeschema/bom_plugins.cpp @@ -24,14 +24,14 @@ #include "bom_plugins.h" -BOM_PLUGIN::BOM_PLUGIN( const wxString& aFile ) +BOM_GENERATOR_HANDLER::BOM_GENERATOR_HANDLER( const wxString& aFile ) : m_file( aFile ) { m_isOk = false; if( !wxFile::Exists( aFile ) ) { - m_info.Printf( _("Plugin file:\n%s\nnot found. Plugin not available."), aFile ); + m_info.Printf( _("Script file:\n%s\nnot found. Script not available."), aFile ); return; } @@ -75,7 +75,7 @@ BOM_PLUGIN::BOM_PLUGIN( const wxString& aFile ) } -bool BOM_PLUGIN::IsPlugin( const wxString& aFile ) +bool BOM_GENERATOR_HANDLER::IsValidGenerator( const wxString& aFile ) { wxFileName fn( aFile ); wxString ext = fn.GetExt().Lower(); @@ -90,7 +90,7 @@ bool BOM_PLUGIN::IsPlugin( const wxString& aFile ) } -wxString BOM_PLUGIN::readHeader( const wxString& aEndSection ) +wxString BOM_GENERATOR_HANDLER::readHeader( const wxString& aEndSection ) { if( aEndSection.IsEmpty() ) return wxEmptyString; diff --git a/eeschema/bom_plugins.h b/eeschema/bom_plugins.h index 18efefe575..d1ad536336 100644 --- a/eeschema/bom_plugins.h +++ b/eeschema/bom_plugins.h @@ -22,8 +22,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef BOM_PLUGINS_H -#define BOM_PLUGINS_H +#ifndef BOM_GENERATOR_HANDLERS_H +#define BOM_GENERATOR_HANDLERS_H #include #include @@ -32,18 +32,22 @@ #include /** - * Class representing a Bill of Material output plugin. + * Class handling a Bill of Material output generator. + * A Material output generator is an external application called by Eeschema to create + * a BOM from our intermediate xml netlist. + * A generator can be a script or an executable that can read the intermediate xml netlist + * file and generates a output (the BOM file) */ -class BOM_PLUGIN +class BOM_GENERATOR_HANDLER { public: - typedef std::unique_ptr PTR; + typedef std::unique_ptr PTR; /** * Constructor. * @param aFile is path to the plugin file. */ - BOM_PLUGIN( const wxString& aFile ); + BOM_GENERATOR_HANDLER( const wxString& aFile ); /** * Returns true if the plugin is ready to work, i.e. if the plugin file @@ -55,7 +59,7 @@ public: * Returns true if a file name matches a recognized plugin format. * @param aFile is path to the plugin file. */ - static bool IsPlugin( const wxString& aFile ); + static bool IsValidGenerator( const wxString& aFile ); /** * Returns plugin description stored in the plugin header file (if available). @@ -140,4 +144,4 @@ protected: wxArrayString m_options; }; -#endif /* BOM_PLUGINS_H */ +#endif /* BOM_GENERATOR_HANDLERS_H */ diff --git a/eeschema/dialogs/dialog_bom.cpp b/eeschema/dialogs/dialog_bom.cpp index e99cf69ddd..9be92b4137 100644 --- a/eeschema/dialogs/dialog_bom.cpp +++ b/eeschema/dialogs/dialog_bom.cpp @@ -1,8 +1,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -44,20 +44,22 @@ #include #include -static constexpr wxChar BOM_TRACE[] = wxT( "BOM_PLUGINS" ); +#include -static constexpr wxChar BOM_PLUGINS_KEY[] = wxT( "bom_plugins" ); -static constexpr wxChar BOM_PLUGIN_SELECTED_KEY[] = wxT( "bom_plugin_selected" ); +static constexpr wxChar BOM_TRACE[] = wxT( "BOM_GENERATORS" ); + +static constexpr wxChar BOM_GENERATORS_KEY[] = wxT( "bom_plugins" ); +static constexpr wxChar BOM_GENERATOR_SELECTED_KEY[] = wxT( "bom_plugin_selected" ); static const char* s_bomHelpInfo = #include ; -#include +using namespace T_BOMCFG_T; // for the BOM_CFG_PARSER parser and its keywords -using namespace T_BOMCFG_T; - -typedef std::vector BOM_PLUGIN_ARRAY; +// BOM "plugins" are not actually plugins. They are external tools +// (scripts or executables) called by this dialog. +typedef std::vector BOM_GENERATOR_ARRAY; /** @@ -65,22 +67,22 @@ typedef std::vector BOM_PLUGIN_ARRAY; */ class BOM_CFG_PARSER : public DIALOG_BOM_CFG_LEXER { - BOM_PLUGIN_ARRAY* m_pluginsList; + BOM_GENERATOR_ARRAY* m_generatorsList; public: - BOM_CFG_PARSER( BOM_PLUGIN_ARRAY* aPlugins, const char* aData, const wxString& aSource ); + BOM_CFG_PARSER( BOM_GENERATOR_ARRAY* aGenerators, const char* aData, const wxString& aSource ); void Parse(); private: - void parsePlugin(); + void parseGenerator(); }; -BOM_CFG_PARSER::BOM_CFG_PARSER( BOM_PLUGIN_ARRAY* aPlugins, const char* aLine, +BOM_CFG_PARSER::BOM_CFG_PARSER( BOM_GENERATOR_ARRAY* aGenerators, const char* aLine, const wxString& aSource ) : DIALOG_BOM_CFG_LEXER( aLine, aSource ) { - m_pluginsList = aPlugins; + m_generatorsList = aGenerators; } @@ -102,7 +104,7 @@ void BOM_CFG_PARSER::Parse() switch( token ) { case T_plugin: // Defines a new plugin - parsePlugin(); + parseGenerator(); break; default: @@ -113,11 +115,11 @@ void BOM_CFG_PARSER::Parse() } -void BOM_CFG_PARSER::parsePlugin() +void BOM_CFG_PARSER::parseGenerator() { NeedSYMBOLorNUMBER(); wxString name = FromUTF8(); - auto plugin = std::make_unique( name ); + auto plugin = std::make_unique( name ); T token; @@ -163,7 +165,7 @@ void BOM_CFG_PARSER::parsePlugin() } if( plugin ) - m_pluginsList->push_back( std::move( plugin ) ); + m_generatorsList->push_back( std::move( plugin ) ); } @@ -172,7 +174,7 @@ class DIALOG_BOM : public DIALOG_BOM_BASE { private: SCH_EDIT_FRAME* m_parent; - BOM_PLUGIN_ARRAY m_plugins; + BOM_GENERATOR_ARRAY m_generators; wxConfigBase* m_config; // to store the "plugins" bool m_initialized; @@ -181,33 +183,33 @@ public: ~DIALOG_BOM(); private: - void OnPluginSelected( wxCommandEvent& event ) override; - void OnRunPlugin( wxCommandEvent& event ) override; + void OnGeneratorSelected( wxCommandEvent& event ) override; + void OnRunGenerator( wxCommandEvent& event ) override; void OnHelp( wxCommandEvent& event ) override; - void OnAddPlugin( wxCommandEvent& event ) override; - void OnRemovePlugin( wxCommandEvent& event ) override; - void OnEditPlugin( wxCommandEvent& event ) override; + void OnAddGenerator( wxCommandEvent& event ) override; + void OnRemoveGenerator( wxCommandEvent& event ) override; + void OnEditGenerator( wxCommandEvent& event ) override; void OnCommandLineEdited( wxCommandEvent& event ) override; void OnNameEdited( wxCommandEvent& event ) override; void OnShowConsoleChanged( wxCommandEvent& event ) override; void OnIdle( wxIdleEvent& event ) override; void pluginInit(); - void installPluginsList(); - BOM_PLUGIN* addPlugin( const wxString& aPath, const wxString& aName = wxEmptyString ); + void installGeneratorsList(); + BOM_GENERATOR_HANDLER* addGenerator( const wxString& aPath, const wxString& aName = wxEmptyString ); bool pluginExists( const wxString& aName ); - BOM_PLUGIN* selectedPlugin() + BOM_GENERATOR_HANDLER* selectedGenerator() { - int idx = m_lbPlugins->GetSelection(); + int idx = m_lbGenerators->GetSelection(); - if( idx < 0 || idx >= (int)m_plugins.size() ) + if( idx < 0 || idx >= (int)m_generators.size() ) return nullptr; - return m_plugins[idx].get(); + return m_generators[idx].get(); } - wxString choosePlugin(); + wxString chooseGenerator(); }; @@ -226,11 +228,11 @@ DIALOG_BOM::DIALOG_BOM( SCH_EDIT_FRAME* parent ) : m_config = Kiface().KifaceSettings(); m_initialized = false; - m_buttonAddPlugin->SetBitmap( KiBitmap( small_plus_xpm ) ); - m_buttonDelPlugin->SetBitmap( KiBitmap( trash_xpm ) ); + m_buttonAddGenerator->SetBitmap( KiBitmap( small_plus_xpm ) ); + m_buttonDelGenerator->SetBitmap( KiBitmap( trash_xpm ) ); m_buttonEdit->SetBitmap( KiBitmap( small_edit_xpm ) ); - installPluginsList(); + installGeneratorsList(); #ifndef __WINDOWS__ m_checkBoxShowConsole->Show( false ); @@ -240,7 +242,7 @@ DIALOG_BOM::DIALOG_BOM( SCH_EDIT_FRAME* parent ) : m_sdbSizerCancel->SetLabel( _( "Close" ) ); m_sdbSizer->Layout(); - SetInitialFocus( m_lbPlugins ); + SetInitialFocus( m_lbGenerators ); m_sdbSizerOK->SetDefault(); // Now all widgets have the size fixed, call FinishDialogSettings @@ -260,7 +262,7 @@ DIALOG_BOM::~DIALOG_BOM() STRING_FORMATTER writer; writer.Print( 0, "(plugins" ); - for( auto& plugin : m_plugins ) + for( auto& plugin : m_generators ) { writer.Print( 1, "(plugin %s (cmd %s)", writer.Quotew( plugin->GetFile().GetFullPath() ).c_str(), @@ -287,23 +289,23 @@ DIALOG_BOM::~DIALOG_BOM() wxString list( FROM_UTF8( writer.GetString().c_str() ) ); - m_config->Write( BOM_PLUGINS_KEY, list ); + m_config->Write( BOM_GENERATORS_KEY, list ); - wxString active_plugin_name = m_lbPlugins->GetStringSelection( ); - m_config->Write( BOM_PLUGIN_SELECTED_KEY, active_plugin_name ); + wxString active_plugin_name = m_lbGenerators->GetStringSelection( ); + m_config->Write( BOM_GENERATOR_SELECTED_KEY, active_plugin_name ); } // Read the initialized plugins in config and fill the list of names -void DIALOG_BOM::installPluginsList() +void DIALOG_BOM::installGeneratorsList() { wxString list, active_plugin_name; - m_config->Read( BOM_PLUGINS_KEY, &list ); - m_config->Read( BOM_PLUGIN_SELECTED_KEY, &active_plugin_name ); + m_config->Read( BOM_GENERATORS_KEY, &list ); + m_config->Read( BOM_GENERATOR_SELECTED_KEY, &active_plugin_name ); if( !list.IsEmpty() ) { - BOM_CFG_PARSER cfg_parser( &m_plugins, TO_UTF8( list ), wxT( "plugins" ) ); + BOM_CFG_PARSER cfg_parser( &m_generators, TO_UTF8( list ), wxT( "plugins" ) ); try { @@ -319,16 +321,16 @@ void DIALOG_BOM::installPluginsList() } // Populate list box - for( unsigned ii = 0; ii < m_plugins.size(); ii++ ) + for( unsigned ii = 0; ii < m_generators.size(); ii++ ) { - m_lbPlugins->Append( m_plugins[ii]->GetName() ); + m_lbGenerators->Append( m_generators[ii]->GetName() ); - if( active_plugin_name == m_plugins[ii]->GetName() ) - m_lbPlugins->SetSelection( ii ); + if( active_plugin_name == m_generators[ii]->GetName() ) + m_lbGenerators->SetSelection( ii ); } } - if( m_plugins.empty() ) // No plugins found? + if( m_generators.empty() ) // No plugins found? { // Load plugins from the default locations std::vector pluginPaths = { @@ -346,7 +348,7 @@ void DIALOG_BOM::installPluginsList() for( const auto& path : pluginPaths ) { - wxLogDebug( wxString::Format( "Searching directory %s for BOM plugins", path ) ); + wxLogDebug( wxString::Format( "Searching directory %s for BOM generators", path ) ); wxDir dir( path ); if( !dir.IsOpened() ) @@ -360,12 +362,12 @@ void DIALOG_BOM::installPluginsList() { try { - wxLogTrace( BOM_TRACE, wxString::Format( "Checking if %s is a BOM plugin", fileName ) ); + wxLogTrace( BOM_TRACE, wxString::Format( "Checking if %s is a BOM generator", fileName ) ); - if( BOM_PLUGIN::IsPlugin( fileName ) ) + if( BOM_GENERATOR_HANDLER::IsValidGenerator( fileName ) ) { pluginPath.SetFullName( fileName ); - addPlugin( pluginPath.GetFullPath() ); + addGenerator( pluginPath.GetFullPath() ); } } catch( ... ) { /* well, no big deal */ } @@ -380,10 +382,10 @@ void DIALOG_BOM::installPluginsList() } -BOM_PLUGIN* DIALOG_BOM::addPlugin( const wxString& aPath, const wxString& aName ) +BOM_GENERATOR_HANDLER* DIALOG_BOM::addGenerator( const wxString& aPath, const wxString& aName ) { - BOM_PLUGIN* ret = nullptr; - auto plugin = std::make_unique( aPath ); + BOM_GENERATOR_HANDLER* ret = nullptr; + auto plugin = std::make_unique( aPath ); if( !plugin ) return nullptr; @@ -391,24 +393,24 @@ BOM_PLUGIN* DIALOG_BOM::addPlugin( const wxString& aPath, const wxString& aName if( !aName.IsEmpty() ) { plugin->SetName( aName ); - m_lbPlugins->Append( aName ); + m_lbGenerators->Append( aName ); } else { - m_lbPlugins->Append( plugin->GetName() ); + m_lbGenerators->Append( plugin->GetName() ); } ret = plugin.get(); - m_plugins.push_back( std::move( plugin ) ); + m_generators.push_back( std::move( plugin ) ); return ret; } bool DIALOG_BOM::pluginExists( const wxString& aName ) { - for( unsigned ii = 0; ii < m_plugins.size(); ii++ ) + for( unsigned ii = 0; ii < m_generators.size(); ii++ ) { - if( aName == m_plugins[ii]->GetName() ) + if( aName == m_generators[ii]->GetName() ) return true; } @@ -416,7 +418,7 @@ bool DIALOG_BOM::pluginExists( const wxString& aName ) } -void DIALOG_BOM::OnPluginSelected( wxCommandEvent& event ) +void DIALOG_BOM::OnGeneratorSelected( wxCommandEvent& event ) { pluginInit(); } @@ -424,7 +426,7 @@ void DIALOG_BOM::OnPluginSelected( wxCommandEvent& event ) void DIALOG_BOM::pluginInit() { - auto plugin = selectedPlugin(); + auto plugin = selectedGenerator(); if( !plugin ) { @@ -452,7 +454,7 @@ void DIALOG_BOM::pluginInit() } -void DIALOG_BOM::OnRunPlugin( wxCommandEvent& event ) +void DIALOG_BOM::OnRunGenerator( wxCommandEvent& event ) { // Calculate the xml netlist filename wxFileName fn = g_RootSheet->GetScreen()->GetFileName(); @@ -481,34 +483,34 @@ void DIALOG_BOM::OnRunPlugin( wxCommandEvent& event ) } -void DIALOG_BOM::OnRemovePlugin( wxCommandEvent& event ) +void DIALOG_BOM::OnRemoveGenerator( wxCommandEvent& event ) { - int ii = m_lbPlugins->GetSelection(); + int ii = m_lbGenerators->GetSelection(); if( ii < 0 ) return; - m_lbPlugins->Delete( ii ); - m_plugins.erase( m_plugins.begin() + ii ); + m_lbGenerators->Delete( ii ); + m_generators.erase( m_generators.begin() + ii ); // Select the next item, if exists - if( m_lbPlugins->GetCount() ) - m_lbPlugins->SetSelection( std::min( ii, (int) m_lbPlugins->GetCount() - 1 ) ); + if( m_lbGenerators->GetCount() ) + m_lbGenerators->SetSelection( std::min( ii, (int) m_lbGenerators->GetCount() - 1 ) ); pluginInit(); } -void DIALOG_BOM::OnAddPlugin( wxCommandEvent& event ) +void DIALOG_BOM::OnAddGenerator( wxCommandEvent& event ) { - wxString filename = choosePlugin(); + wxString filename = chooseGenerator(); if( filename.IsEmpty() ) return; // Creates a new plugin entry wxFileName fn( filename ); - wxString name = wxGetTextFromUser( _( "Plugin nickname:" ), _( "Add Plugin" ), + wxString name = wxGetTextFromUser( _( "Generator nickname:" ), _( "Add Generator" ), fn.GetName(), this ); if( name.IsEmpty() ) @@ -523,11 +525,11 @@ void DIALOG_BOM::OnAddPlugin( wxCommandEvent& event ) try { - auto plugin = addPlugin( fn.GetFullPath(), name ); + auto plugin = addGenerator( fn.GetFullPath(), name ); if( plugin ) { - m_lbPlugins->SetSelection( m_lbPlugins->GetCount() - 1 ); + m_lbGenerators->SetSelection( m_lbGenerators->GetCount() - 1 ); m_textCtrlCommand->SetValue( plugin->GetCommand() ); pluginInit(); } @@ -539,7 +541,7 @@ void DIALOG_BOM::OnAddPlugin( wxCommandEvent& event ) } -wxString DIALOG_BOM::choosePlugin() +wxString DIALOG_BOM::chooseGenerator() { static wxString lastPath; @@ -552,7 +554,7 @@ wxString DIALOG_BOM::choosePlugin() #endif } - wxString fullFileName = EDA_FILE_SELECTOR( _( "Plugin files:" ), lastPath, wxEmptyString, + wxString fullFileName = EDA_FILE_SELECTOR( _( "Generator files:" ), lastPath, wxEmptyString, wxEmptyString, wxFileSelectorDefaultWildcardStr, this, wxFD_OPEN, true ); @@ -560,9 +562,9 @@ wxString DIALOG_BOM::choosePlugin() } -void DIALOG_BOM::OnEditPlugin( wxCommandEvent& event ) +void DIALOG_BOM::OnEditGenerator( wxCommandEvent& event ) { - auto plugin = selectedPlugin(); + auto plugin = selectedGenerator(); if( !plugin ) return; @@ -571,7 +573,7 @@ void DIALOG_BOM::OnEditPlugin( wxCommandEvent& event ) if( pluginFile.Length() <= 2 ) // if name != "" { - wxMessageBox( _( "Plugin file name not found." ) ); + wxMessageBox( _( "Generator file name not found." ) ); return; } @@ -598,22 +600,22 @@ void DIALOG_BOM::OnHelp( wxCommandEvent& event ) void DIALOG_BOM::OnCommandLineEdited( wxCommandEvent& event ) { - auto plugin = selectedPlugin(); + auto generator = selectedGenerator(); - if( plugin ) - plugin->SetCommand( m_textCtrlCommand->GetValue() ); + if( generator ) + generator->SetCommand( m_textCtrlCommand->GetValue() ); } void DIALOG_BOM::OnNameEdited( wxCommandEvent& event ) { - int ii = m_lbPlugins->GetSelection(); + int ii = m_lbGenerators->GetSelection(); if( ii < 0 ) return; - m_plugins[ii]->SetName( m_textCtrlName->GetValue() ); - m_lbPlugins->SetString( ii, m_plugins[ii]->GetName() ); + m_generators[ii]->SetName( m_textCtrlName->GetValue() ); + m_lbGenerators->SetString( ii, m_generators[ii]->GetName() ); } @@ -622,7 +624,7 @@ void DIALOG_BOM::OnShowConsoleChanged( wxCommandEvent& event ) #ifdef __WINDOWS__ static constexpr wxChar OPT_SHOW_CONSOLE[] = wxT( "show_console" ); - auto plugin = selectedPlugin(); + auto plugin = selectedGenerator(); if( !plugin ) return; diff --git a/eeschema/dialogs/dialog_bom_base.cpp b/eeschema/dialogs/dialog_bom_base.cpp index 536c2fdcc4..39b9a3c17a 100644 --- a/eeschema/dialogs/dialog_bom_base.cpp +++ b/eeschema/dialogs/dialog_bom_base.cpp @@ -22,14 +22,14 @@ DIALOG_BOM_BASE::DIALOG_BOM_BASE( wxWindow* parent, wxWindowID id, const wxStrin wxBoxSizer* bLeftSizer; bLeftSizer = new wxBoxSizer( wxVERTICAL ); - m_staticTextPluginTitle = new wxStaticText( this, wxID_ANY, _("BOM plugins:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextPluginTitle->Wrap( -1 ); - bLeftSizer->Add( m_staticTextPluginTitle, 0, wxTOP, 5 ); + m_staticTextGeneratorTitle = new wxStaticText( this, wxID_ANY, _("BOM generator scripts:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextGeneratorTitle->Wrap( -1 ); + bLeftSizer->Add( m_staticTextGeneratorTitle, 0, wxTOP, 5 ); - m_lbPlugins = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - m_lbPlugins->SetMinSize( wxSize( 250,-1 ) ); + m_lbGenerators = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + m_lbGenerators->SetMinSize( wxSize( 250,-1 ) ); - bLeftSizer->Add( m_lbPlugins, 1, wxEXPAND, 5 ); + bLeftSizer->Add( m_lbGenerators, 1, wxEXPAND, 5 ); bUpperSizer->Add( bLeftSizer, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 ); @@ -40,7 +40,7 @@ DIALOG_BOM_BASE::DIALOG_BOM_BASE( wxWindow* parent, wxWindowID id, const wxStrin wxBoxSizer* bNameSizer; bNameSizer = new wxBoxSizer( wxHORIZONTAL ); - m_staticTextName = new wxStaticText( this, wxID_ANY, _("Plugin nickname:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextName = new wxStaticText( this, wxID_ANY, _("Generator nickname:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextName->Wrap( -1 ); bNameSizer->Add( m_staticTextName, 0, wxALIGN_CENTER_VERTICAL, 5 ); @@ -61,35 +61,35 @@ DIALOG_BOM_BASE::DIALOG_BOM_BASE( wxWindow* parent, wxWindowID id, const wxStrin bMainSizer->Add( bUpperSizer, 2, wxEXPAND|wxALL, 5 ); - wxBoxSizer* bPluginButtons; - bPluginButtons = new wxBoxSizer( wxHORIZONTAL ); + wxBoxSizer* bGeneratorButtons; + bGeneratorButtons = new wxBoxSizer( wxHORIZONTAL ); - m_buttonAddPlugin = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), wxBU_AUTODRAW|0 ); - m_buttonAddPlugin->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) ); - m_buttonAddPlugin->SetToolTip( _("Add a new plugin and its command line to the list") ); + m_buttonAddGenerator = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), wxBU_AUTODRAW|0 ); + m_buttonAddGenerator->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) ); + m_buttonAddGenerator->SetToolTip( _("Add a new BOM generator and its command line to the list") ); - bPluginButtons->Add( m_buttonAddPlugin, 0, wxRIGHT|wxLEFT, 5 ); + bGeneratorButtons->Add( m_buttonAddGenerator, 0, wxRIGHT|wxLEFT, 5 ); m_buttonEdit = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), wxBU_AUTODRAW|0 ); - m_buttonEdit->SetToolTip( _("Edit the plugin file in the text editor") ); + m_buttonEdit->SetToolTip( _("Edit the script file in the text editor") ); - bPluginButtons->Add( m_buttonEdit, 0, wxRIGHT, 5 ); + bGeneratorButtons->Add( m_buttonEdit, 0, wxRIGHT, 5 ); - bPluginButtons->Add( 0, 0, 0, wxRIGHT|wxLEFT, 5 ); + bGeneratorButtons->Add( 0, 0, 0, wxRIGHT|wxLEFT, 5 ); - m_buttonDelPlugin = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), wxBU_AUTODRAW|0 ); - m_buttonDelPlugin->SetToolTip( _("Remove the current plugin from list") ); + m_buttonDelGenerator = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), wxBU_AUTODRAW|0 ); + m_buttonDelGenerator->SetToolTip( _("Remove the current generator script from list") ); - bPluginButtons->Add( m_buttonDelPlugin, 0, wxRIGHT, 5 ); + bGeneratorButtons->Add( m_buttonDelGenerator, 0, wxRIGHT, 5 ); - bMainSizer->Add( bPluginButtons, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 ); + bMainSizer->Add( bGeneratorButtons, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 ); wxBoxSizer* bbottomSizer; bbottomSizer = new wxBoxSizer( wxVERTICAL ); - m_staticTextCmd = new wxStaticText( this, wxID_ANY, _("Command line:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextCmd = new wxStaticText( this, wxID_ANY, _("Command line running the generator:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextCmd->Wrap( -1 ); bbottomSizer->Add( m_staticTextCmd, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); @@ -99,16 +99,15 @@ DIALOG_BOM_BASE::DIALOG_BOM_BASE( wxWindow* parent, wxWindowID id, const wxStrin bbottomSizer->Add( m_textCtrlCommand, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_checkBoxShowConsole = new wxCheckBox( this, wxID_ANY, _("Show console window"), wxDefaultPosition, wxDefaultSize, 0 ); - m_checkBoxShowConsole->SetValue(true); - m_checkBoxShowConsole->SetToolTip( _("By default, command line runs with hidden console window and output is redirected to \"Plugin info\" field.\nSet this option to show the window of the running command.") ); + m_checkBoxShowConsole->SetToolTip( _("By default, command line runs with hidden console window and output is redirected to the info display.\nSet this option to show the window of the running command.") ); bbottomSizer->Add( m_checkBoxShowConsole, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); bMainSizer->Add( bbottomSizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 ); - m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bMainSizer->Add( m_staticline2, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bMainSizer->Add( m_staticline, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizerOK = new wxButton( this, wxID_OK ); @@ -129,29 +128,29 @@ DIALOG_BOM_BASE::DIALOG_BOM_BASE( wxWindow* parent, wxWindowID id, const wxStrin // Connect Events this->Connect( wxEVT_IDLE, wxIdleEventHandler( DIALOG_BOM_BASE::OnIdle ) ); - m_lbPlugins->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_BOM_BASE::OnPluginSelected ), NULL, this ); + m_lbGenerators->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_BOM_BASE::OnGeneratorSelected ), NULL, this ); m_textCtrlName->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_BOM_BASE::OnNameEdited ), NULL, this ); - m_buttonAddPlugin->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BOM_BASE::OnAddPlugin ), NULL, this ); - m_buttonEdit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BOM_BASE::OnEditPlugin ), NULL, this ); - m_buttonDelPlugin->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BOM_BASE::OnRemovePlugin ), NULL, this ); + m_buttonAddGenerator->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BOM_BASE::OnAddGenerator ), NULL, this ); + m_buttonEdit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BOM_BASE::OnEditGenerator ), NULL, this ); + m_buttonDelGenerator->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BOM_BASE::OnRemoveGenerator ), NULL, this ); m_textCtrlCommand->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_BOM_BASE::OnCommandLineEdited ), NULL, this ); m_checkBoxShowConsole->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BOM_BASE::OnShowConsoleChanged ), NULL, this ); m_sdbSizerHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BOM_BASE::OnHelp ), NULL, this ); - m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BOM_BASE::OnRunPlugin ), NULL, this ); + m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BOM_BASE::OnRunGenerator ), NULL, this ); } DIALOG_BOM_BASE::~DIALOG_BOM_BASE() { // Disconnect Events this->Disconnect( wxEVT_IDLE, wxIdleEventHandler( DIALOG_BOM_BASE::OnIdle ) ); - m_lbPlugins->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_BOM_BASE::OnPluginSelected ), NULL, this ); + m_lbGenerators->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_BOM_BASE::OnGeneratorSelected ), NULL, this ); m_textCtrlName->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_BOM_BASE::OnNameEdited ), NULL, this ); - m_buttonAddPlugin->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BOM_BASE::OnAddPlugin ), NULL, this ); - m_buttonEdit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BOM_BASE::OnEditPlugin ), NULL, this ); - m_buttonDelPlugin->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BOM_BASE::OnRemovePlugin ), NULL, this ); + m_buttonAddGenerator->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BOM_BASE::OnAddGenerator ), NULL, this ); + m_buttonEdit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BOM_BASE::OnEditGenerator ), NULL, this ); + m_buttonDelGenerator->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BOM_BASE::OnRemoveGenerator ), NULL, this ); m_textCtrlCommand->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_BOM_BASE::OnCommandLineEdited ), NULL, this ); m_checkBoxShowConsole->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BOM_BASE::OnShowConsoleChanged ), NULL, this ); m_sdbSizerHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BOM_BASE::OnHelp ), NULL, this ); - m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BOM_BASE::OnRunPlugin ), NULL, this ); + m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BOM_BASE::OnRunGenerator ), NULL, this ); } diff --git a/eeschema/dialogs/dialog_bom_base.fbp b/eeschema/dialogs/dialog_bom_base.fbp index ee384d46c3..d37dbc9262 100644 --- a/eeschema/dialogs/dialog_bom_base.fbp +++ b/eeschema/dialogs/dialog_bom_base.fbp @@ -109,7 +109,7 @@ 0 0 wxID_ANY - BOM plugins: + BOM generator scripts: 0 0 @@ -118,7 +118,7 @@ 0 1 - m_staticTextPluginTitle + m_staticTextGeneratorTitle 1 @@ -178,7 +178,7 @@ 0 250,-1 1 - m_lbPlugins + m_lbGenerators 1 @@ -199,7 +199,7 @@ - OnPluginSelected + OnGeneratorSelected @@ -254,7 +254,7 @@ 0 0 wxID_ANY - Plugin nickname: + Generator nickname: 0 0 @@ -424,7 +424,7 @@ 0 - bPluginButtons + bGeneratorButtons wxHORIZONTAL none @@ -474,7 +474,7 @@ 0 1 - m_buttonAddPlugin + m_buttonAddGenerator 1 @@ -489,7 +489,7 @@ ; forward_declare 0 - Add a new plugin and its command line to the list + Add a new BOM generator and its command line to the list wxFILTER_NONE wxDefaultValidator @@ -497,7 +497,7 @@ - OnAddPlugin + OnAddGenerator @@ -562,7 +562,7 @@ ; forward_declare 0 - Edit the plugin file in the text editor + Edit the script file in the text editor wxFILTER_NONE wxDefaultValidator @@ -570,7 +570,7 @@ - OnEditPlugin + OnEditGenerator @@ -630,7 +630,7 @@ 0 1 - m_buttonDelPlugin + m_buttonDelGenerator 1 @@ -645,7 +645,7 @@ ; forward_declare 0 - Remove the current plugin from list + Remove the current generator script from list wxFILTER_NONE wxDefaultValidator @@ -653,7 +653,7 @@ - OnRemovePlugin + OnRemoveGenerator @@ -699,7 +699,7 @@ 0 0 wxID_ANY - Command line: + Command line running the generator: 0 0 @@ -811,7 +811,7 @@ 1 0 - 1 + 0 1 1 @@ -847,7 +847,7 @@ 0 - By default, command line runs with hidden console window and output is redirected to "Plugin info" field. Set this option to show the window of the running command. + By default, command line runs with hidden console window and output is redirected to the info display. Set this option to show the window of the running command. wxFILTER_NONE wxDefaultValidator @@ -899,7 +899,7 @@ 0 1 - m_staticline2 + m_staticline 1 @@ -935,7 +935,7 @@ m_sdbSizer protected OnHelp - OnRunPlugin + OnRunGenerator diff --git a/eeschema/dialogs/dialog_bom_base.h b/eeschema/dialogs/dialog_bom_base.h index fdb3e3df27..31aa605cb6 100644 --- a/eeschema/dialogs/dialog_bom_base.h +++ b/eeschema/dialogs/dialog_bom_base.h @@ -45,18 +45,18 @@ class DIALOG_BOM_BASE : public DIALOG_SHIM ID_CMDLINE }; - wxStaticText* m_staticTextPluginTitle; - wxListBox* m_lbPlugins; + wxStaticText* m_staticTextGeneratorTitle; + wxListBox* m_lbGenerators; wxStaticText* m_staticTextName; wxTextCtrl* m_textCtrlName; wxTextCtrl* m_Messages; - wxBitmapButton* m_buttonAddPlugin; + wxBitmapButton* m_buttonAddGenerator; wxBitmapButton* m_buttonEdit; - wxBitmapButton* m_buttonDelPlugin; + wxBitmapButton* m_buttonDelGenerator; wxStaticText* m_staticTextCmd; wxTextCtrl* m_textCtrlCommand; wxCheckBox* m_checkBoxShowConsole; - wxStaticLine* m_staticline2; + wxStaticLine* m_staticline; wxStdDialogButtonSizer* m_sdbSizer; wxButton* m_sdbSizerOK; wxButton* m_sdbSizerCancel; @@ -64,15 +64,15 @@ class DIALOG_BOM_BASE : public DIALOG_SHIM // Virtual event handlers, overide them in your derived class virtual void OnIdle( wxIdleEvent& event ) { event.Skip(); } - virtual void OnPluginSelected( wxCommandEvent& event ) { event.Skip(); } + virtual void OnGeneratorSelected( wxCommandEvent& event ) { event.Skip(); } virtual void OnNameEdited( wxCommandEvent& event ) { event.Skip(); } - virtual void OnAddPlugin( wxCommandEvent& event ) { event.Skip(); } - virtual void OnEditPlugin( wxCommandEvent& event ) { event.Skip(); } - virtual void OnRemovePlugin( wxCommandEvent& event ) { event.Skip(); } + virtual void OnAddGenerator( wxCommandEvent& event ) { event.Skip(); } + virtual void OnEditGenerator( wxCommandEvent& event ) { event.Skip(); } + virtual void OnRemoveGenerator( wxCommandEvent& event ) { event.Skip(); } virtual void OnCommandLineEdited( wxCommandEvent& event ) { event.Skip(); } virtual void OnShowConsoleChanged( wxCommandEvent& event ) { event.Skip(); } virtual void OnHelp( wxCommandEvent& event ) { event.Skip(); } - virtual void OnRunPlugin( wxCommandEvent& event ) { event.Skip(); } + virtual void OnRunGenerator( wxCommandEvent& event ) { event.Skip(); } public: diff --git a/eeschema/dialogs/dialog_netlist.cpp b/eeschema/dialogs/dialog_netlist.cpp index 61a4cf3333..688489c582 100644 --- a/eeschema/dialogs/dialog_netlist.cpp +++ b/eeschema/dialogs/dialog_netlist.cpp @@ -155,16 +155,16 @@ private: void SelectDefaultNetlistType( wxCommandEvent& event ); /** - * Function OnAddPlugin + * Function OnAddGenerator * Add a new panel for a new netlist plugin */ - void OnAddPlugin( wxCommandEvent& event ) override; + void OnAddGenerator( wxCommandEvent& event ) override; /** - * Function OnDelPlugin + * Function OnDelGenerator * Remove a panel relative to a netlist plugin */ - void OnDelPlugin( wxCommandEvent& event ) override; + void OnDelGenerator( wxCommandEvent& event ) override; /** * Function WriteCurrentNetlistSetup @@ -198,18 +198,18 @@ private: }; -class NETLIST_DIALOG_ADD_PLUGIN : public NETLIST_DIALOG_ADD_PLUGIN_BASE +class NETLIST_DIALOG_ADD_GENERATOR : public NETLIST_DIALOG_ADD_GENERATOR_BASE { private: NETLIST_DIALOG* m_Parent; public: - NETLIST_DIALOG_ADD_PLUGIN( NETLIST_DIALOG* parent ); - const wxString GetPluginTitle() + NETLIST_DIALOG_ADD_GENERATOR( NETLIST_DIALOG* parent ); + const wxString GetGeneratorTitle() { return m_textCtrlName->GetValue(); } - const wxString GetPluginTCommandLine() + const wxString GetGeneratorTCommandLine() { return m_textCtrlCommand->GetValue(); } @@ -225,7 +225,7 @@ private: /* * Browse plugin files, and set m_CommandStringCtrl field */ - void OnBrowsePlugins( wxCommandEvent& event ) override; + void OnBrowseGenerators( wxCommandEvent& event ) override; }; @@ -501,7 +501,7 @@ void NETLIST_DIALOG::OnNetlistTypeSelection( wxNotebookEvent& event ) if( currPage == NULL ) return; - m_buttonDelPlugin->Enable( currPage->m_IdNetType >= NET_TYPE_CUSTOM1 ); + m_buttonDelGenerator->Enable( currPage->m_IdNetType >= NET_TYPE_CUSTOM1 ); } @@ -735,7 +735,7 @@ void NETLIST_DIALOG::WriteCurrentNetlistSetup() } -void NETLIST_DIALOG::OnDelPlugin( wxCommandEvent& event ) +void NETLIST_DIALOG::OnDelGenerator( wxCommandEvent& event ) { NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage(); @@ -753,14 +753,14 @@ void NETLIST_DIALOG::OnDelPlugin( wxCommandEvent& event ) } -void NETLIST_DIALOG::OnAddPlugin( wxCommandEvent& event ) +void NETLIST_DIALOG::OnAddGenerator( wxCommandEvent& event ) { - NETLIST_DIALOG_ADD_PLUGIN dlg( this ); + NETLIST_DIALOG_ADD_GENERATOR dlg( this ); if( dlg.ShowModal() != wxID_OK ) return; // Creates a new custom plugin page - wxString title = dlg.GetPluginTitle(); + wxString title = dlg.GetGeneratorTitle(); // Verify it does not exists int netTypeId = PANELCUSTOMBASE; // the first not used type id @@ -780,7 +780,7 @@ void NETLIST_DIALOG::OnAddPlugin( wxCommandEvent& event ) } } - wxString cmd = dlg.GetPluginTCommandLine(); + wxString cmd = dlg.GetGeneratorTCommandLine(); currPage = AddOneCustomPage( title,cmd, (NETLIST_TYPE_ID)netTypeId ); m_PanelNetType[netTypeId] = currPage; WriteCurrentNetlistSetup(); @@ -790,15 +790,15 @@ void NETLIST_DIALOG::OnAddPlugin( wxCommandEvent& event ) } -NETLIST_DIALOG_ADD_PLUGIN::NETLIST_DIALOG_ADD_PLUGIN( NETLIST_DIALOG* parent ) : - NETLIST_DIALOG_ADD_PLUGIN_BASE( parent ) +NETLIST_DIALOG_ADD_GENERATOR::NETLIST_DIALOG_ADD_GENERATOR( NETLIST_DIALOG* parent ) : + NETLIST_DIALOG_ADD_GENERATOR_BASE( parent ) { m_Parent = parent; GetSizer()->SetSizeHints( this ); } -void NETLIST_DIALOG_ADD_PLUGIN::OnOKClick( wxCommandEvent& event ) +void NETLIST_DIALOG_ADD_GENERATOR::OnOKClick( wxCommandEvent& event ) { if( m_textCtrlCommand->GetValue() == wxEmptyString ) { @@ -816,7 +816,7 @@ void NETLIST_DIALOG_ADD_PLUGIN::OnOKClick( wxCommandEvent& event ) } -void NETLIST_DIALOG_ADD_PLUGIN::OnBrowsePlugins( wxCommandEvent& event ) +void NETLIST_DIALOG_ADD_GENERATOR::OnBrowseGenerators( wxCommandEvent& event ) { wxString FullFileName, Path; @@ -825,7 +825,7 @@ void NETLIST_DIALOG_ADD_PLUGIN::OnBrowsePlugins( wxCommandEvent& event ) #else Path = GetOSXKicadDataDir() + wxT( "/plugins" ); #endif - FullFileName = EDA_FILE_SELECTOR( _( "Plugin files:" ), + FullFileName = EDA_FILE_SELECTOR( _( "Generator files:" ), Path, FullFileName, wxEmptyString, diff --git a/eeschema/dialogs/dialog_netlist_base.cpp b/eeschema/dialogs/dialog_netlist_base.cpp index d1f451f936..643ad3fc3f 100644 --- a/eeschema/dialogs/dialog_netlist_base.cpp +++ b/eeschema/dialogs/dialog_netlist_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 23 2018) +// C++ code generated with wxFormBuilder (version Dec 1 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -13,8 +13,8 @@ BEGIN_EVENT_TABLE( NETLIST_DIALOG_BASE, DIALOG_SHIM ) EVT_NOTEBOOK_PAGE_CHANGED( ID_CHANGE_NOTEBOOK_PAGE, NETLIST_DIALOG_BASE::_wxFB_OnNetlistTypeSelection ) EVT_BUTTON( ID_CREATE_NETLIST, NETLIST_DIALOG_BASE::_wxFB_GenNetlist ) EVT_BUTTON( wxID_CANCEL, NETLIST_DIALOG_BASE::_wxFB_OnCancelClick ) - EVT_BUTTON( ID_ADD_PLUGIN, NETLIST_DIALOG_BASE::_wxFB_OnAddPlugin ) - EVT_BUTTON( ID_DEL_PLUGIN, NETLIST_DIALOG_BASE::_wxFB_OnDelPlugin ) + EVT_BUTTON( ID_ADD_PLUGIN, NETLIST_DIALOG_BASE::_wxFB_OnAddGenerator ) + EVT_BUTTON( ID_DEL_PLUGIN, NETLIST_DIALOG_BASE::_wxFB_OnDelGenerator ) END_EVENT_TABLE() NETLIST_DIALOG_BASE::NETLIST_DIALOG_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) @@ -49,11 +49,11 @@ NETLIST_DIALOG_BASE::NETLIST_DIALOG_BASE( wxWindow* parent, wxWindowID id, const m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); bLeftSizer->Add( m_buttonCancel, 0, wxALL|wxEXPAND, 5 ); - m_buttonAddPlugin = new wxButton( this, ID_ADD_PLUGIN, _("Add Plugin..."), wxDefaultPosition, wxDefaultSize, 0 ); - bLeftSizer->Add( m_buttonAddPlugin, 0, wxALL|wxEXPAND, 5 ); + m_buttonAddGenerator = new wxButton( this, ID_ADD_PLUGIN, _("Add Generator..."), wxDefaultPosition, wxDefaultSize, 0 ); + bLeftSizer->Add( m_buttonAddGenerator, 0, wxALL|wxEXPAND, 5 ); - m_buttonDelPlugin = new wxButton( this, ID_DEL_PLUGIN, _("Remove Plugin..."), wxDefaultPosition, wxDefaultSize, 0 ); - bLeftSizer->Add( m_buttonDelPlugin, 0, wxALL|wxEXPAND, 5 ); + m_buttonDelGenerator = new wxButton( this, ID_DEL_PLUGIN, _("Remove Generator..."), wxDefaultPosition, wxDefaultSize, 0 ); + bLeftSizer->Add( m_buttonDelGenerator, 0, wxALL|wxEXPAND, 5 ); bLeftSizer->Add( 0, 0, 1, wxBOTTOM, 10 ); @@ -76,66 +76,69 @@ NETLIST_DIALOG_BASE::~NETLIST_DIALOG_BASE() { } -BEGIN_EVENT_TABLE( NETLIST_DIALOG_ADD_PLUGIN_BASE, DIALOG_SHIM ) - EVT_BUTTON( wxID_OK, NETLIST_DIALOG_ADD_PLUGIN_BASE::_wxFB_OnOKClick ) - EVT_BUTTON( wxID_CANCEL, NETLIST_DIALOG_ADD_PLUGIN_BASE::_wxFB_OnCancelClick ) - EVT_BUTTON( wxID_BROWSE_PLUGINS, NETLIST_DIALOG_ADD_PLUGIN_BASE::_wxFB_OnBrowsePlugins ) +BEGIN_EVENT_TABLE( NETLIST_DIALOG_ADD_GENERATOR_BASE, DIALOG_SHIM ) + EVT_BUTTON( wxID_BROWSE_PLUGINS, NETLIST_DIALOG_ADD_GENERATOR_BASE::_wxFB_OnBrowseGenerators ) + EVT_BUTTON( wxID_CANCEL, NETLIST_DIALOG_ADD_GENERATOR_BASE::_wxFB_OnCancelClick ) + EVT_BUTTON( wxID_OK, NETLIST_DIALOG_ADD_GENERATOR_BASE::_wxFB_OnOKClick ) END_EVENT_TABLE() -NETLIST_DIALOG_ADD_PLUGIN_BASE::NETLIST_DIALOG_ADD_PLUGIN_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) +NETLIST_DIALOG_ADD_GENERATOR_BASE::NETLIST_DIALOG_ADD_GENERATOR_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) { this->SetSizeHints( wxDefaultSize, wxDefaultSize ); wxBoxSizer* bSizerMain; - bSizerMain = new wxBoxSizer( wxHORIZONTAL ); + bSizerMain = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* bSizerLeft; - bSizerLeft = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bSizerTop; + bSizerTop = new wxBoxSizer( wxVERTICAL ); - m_staticTextCmd = new wxStaticText( this, wxID_ANY, _("Netlist command:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextCmd = new wxStaticText( this, wxID_ANY, _("Command line to run the generator:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextCmd->Wrap( -1 ); - bSizerLeft->Add( m_staticTextCmd, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + bSizerTop->Add( m_staticTextCmd, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_textCtrlCommand = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_textCtrlCommand->SetMinSize( wxSize( 300,-1 ) ); - bSizerLeft->Add( m_textCtrlCommand, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bSizerTop->Add( m_textCtrlCommand, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_staticTextName = new wxStaticText( this, wxID_ANY, _("Name:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextName->Wrap( -1 ); - bSizerLeft->Add( m_staticTextName, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + bSizerTop->Add( m_staticTextName, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_textCtrlName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizerLeft->Add( m_textCtrlName, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bSizerTop->Add( m_textCtrlName, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizerTop->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); - bSizerMain->Add( bSizerLeft, 1, wxEXPAND, 5 ); + bSizerMain->Add( bSizerTop, 1, wxEXPAND, 5 ); - wxBoxSizer* bSizerRight; - bSizerRight = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bSizerBottom; + bSizerBottom = new wxBoxSizer( wxHORIZONTAL ); - m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonGenerator = new wxButton( this, wxID_BROWSE_PLUGINS, _("Browse Generators"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerBottom->Add( m_buttonGenerator, 0, wxALL|wxEXPAND, 5 ); - m_buttonOK->SetDefault(); - bSizerRight->Add( m_buttonOK, 0, wxALL|wxEXPAND, 5 ); + m_sdbSizer = new wxStdDialogButtonSizer(); + m_sdbSizerOK = new wxButton( this, wxID_OK ); + m_sdbSizer->AddButton( m_sdbSizerOK ); + m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer->AddButton( m_sdbSizerCancel ); + m_sdbSizer->Realize(); - m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerRight->Add( m_buttonCancel, 0, wxALL|wxEXPAND, 5 ); - - m_buttonPlugin = new wxButton( this, wxID_BROWSE_PLUGINS, _("Browse Plugins"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerRight->Add( m_buttonPlugin, 0, wxALL|wxEXPAND, 5 ); + bSizerBottom->Add( m_sdbSizer, 1, wxEXPAND, 5 ); - bSizerMain->Add( bSizerRight, 0, wxEXPAND, 5 ); + bSizerMain->Add( bSizerBottom, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); this->SetSizer( bSizerMain ); this->Layout(); - bSizerMain->Fit( this ); this->Centre( wxBOTH ); } -NETLIST_DIALOG_ADD_PLUGIN_BASE::~NETLIST_DIALOG_ADD_PLUGIN_BASE() +NETLIST_DIALOG_ADD_GENERATOR_BASE::~NETLIST_DIALOG_ADD_GENERATOR_BASE() { } diff --git a/eeschema/dialogs/dialog_netlist_base.fbp b/eeschema/dialogs/dialog_netlist_base.fbp index 7cde7159be..701e3e52bd 100644 --- a/eeschema/dialogs/dialog_netlist_base.fbp +++ b/eeschema/dialogs/dialog_netlist_base.fbp @@ -340,7 +340,7 @@ 0 0 ID_ADD_PLUGIN - Add Plugin... + Add Generator... 0 @@ -350,7 +350,7 @@ 0 1 - m_buttonAddPlugin + m_buttonAddGenerator 1 @@ -373,7 +373,7 @@ - OnAddPlugin + OnAddGenerator @@ -413,7 +413,7 @@ 0 0 ID_DEL_PLUGIN - Remove Plugin... + Remove Generator... 0 @@ -423,7 +423,7 @@ 0 1 - m_buttonDelPlugin + m_buttonDelGenerator 1 @@ -446,7 +446,7 @@ - OnDelPlugin + OnDelGenerator @@ -481,12 +481,12 @@ wxID_ANY - NETLIST_DIALOG_ADD_PLUGIN_BASE + NETLIST_DIALOG_ADD_GENERATOR_BASE - -1,-1 + 359,170 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h - Plugin Properties + Script Generator Properties @@ -494,7 +494,7 @@ bSizerMain - wxHORIZONTAL + wxVERTICAL none 5 @@ -502,7 +502,7 @@ 1 - bSizerLeft + bSizerTop wxVERTICAL none @@ -537,7 +537,7 @@ 0 0 wxID_ANY - Netlist command: + Command line to run the generator: 0 0 @@ -755,163 +755,75 @@ + + 5 + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + ; ; forward_declare + 0 + + + + + + - + 5 - wxEXPAND + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 0 - + - bSizerRight - wxVERTICAL + bSizerBottom + wxHORIZONTAL none - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 1 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_OK - OK - - 0 - - 0 - - - 0 - - 1 - m_buttonOK - 1 - - - protected - 1 - - - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnOKClick - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_CANCEL - Cancel - - 0 - - 0 - - - 0 - - 1 - m_buttonCancel - 1 - - - protected - 1 - - - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnCancelClick - - 5 wxALL|wxEXPAND @@ -949,7 +861,7 @@ 0 0 wxID_BROWSE_PLUGINS - Browse Plugins + Browse Generators 0 @@ -959,7 +871,7 @@ 0 1 - m_buttonPlugin + m_buttonGenerator 1 @@ -982,7 +894,27 @@ - OnBrowsePlugins + OnBrowseGenerators + + + + 5 + wxEXPAND + 1 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer + protected + OnCancelClick + OnOKClick diff --git a/eeschema/dialogs/dialog_netlist_base.h b/eeschema/dialogs/dialog_netlist_base.h index 8b5c034c13..dc439aafd3 100644 --- a/eeschema/dialogs/dialog_netlist_base.h +++ b/eeschema/dialogs/dialog_netlist_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 23 2018) +// C++ code generated with wxFormBuilder (version Dec 1 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -25,6 +25,7 @@ #include #include #include +#include /////////////////////////////////////////////////////////////////////////// @@ -40,8 +41,8 @@ class NETLIST_DIALOG_BASE : public DIALOG_SHIM void _wxFB_OnNetlistTypeSelection( wxNotebookEvent& event ){ OnNetlistTypeSelection( event ); } void _wxFB_GenNetlist( wxCommandEvent& event ){ GenNetlist( event ); } void _wxFB_OnCancelClick( wxCommandEvent& event ){ OnCancelClick( event ); } - void _wxFB_OnAddPlugin( wxCommandEvent& event ){ OnAddPlugin( event ); } - void _wxFB_OnDelPlugin( wxCommandEvent& event ){ OnDelPlugin( event ); } + void _wxFB_OnAddGenerator( wxCommandEvent& event ){ OnAddGenerator( event ); } + void _wxFB_OnDelGenerator( wxCommandEvent& event ){ OnDelGenerator( event ); } protected: @@ -56,15 +57,15 @@ class NETLIST_DIALOG_BASE : public DIALOG_SHIM wxNotebook* m_NoteBook; wxButton* m_buttonNetlist; wxButton* m_buttonCancel; - wxButton* m_buttonAddPlugin; - wxButton* m_buttonDelPlugin; + wxButton* m_buttonAddGenerator; + wxButton* m_buttonDelGenerator; // Virtual event handlers, overide them in your derived class virtual void OnNetlistTypeSelection( wxNotebookEvent& event ) { event.Skip(); } virtual void GenNetlist( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } - virtual void OnAddPlugin( wxCommandEvent& event ) { event.Skip(); } - virtual void OnDelPlugin( wxCommandEvent& event ) { event.Skip(); } + virtual void OnAddGenerator( wxCommandEvent& event ) { event.Skip(); } + virtual void OnDelGenerator( wxCommandEvent& event ) { event.Skip(); } public: @@ -75,17 +76,17 @@ class NETLIST_DIALOG_BASE : public DIALOG_SHIM }; /////////////////////////////////////////////////////////////////////////////// -/// Class NETLIST_DIALOG_ADD_PLUGIN_BASE +/// Class NETLIST_DIALOG_ADD_GENERATOR_BASE /////////////////////////////////////////////////////////////////////////////// -class NETLIST_DIALOG_ADD_PLUGIN_BASE : public DIALOG_SHIM +class NETLIST_DIALOG_ADD_GENERATOR_BASE : public DIALOG_SHIM { DECLARE_EVENT_TABLE() private: // Private event handlers - void _wxFB_OnOKClick( wxCommandEvent& event ){ OnOKClick( event ); } + void _wxFB_OnBrowseGenerators( wxCommandEvent& event ){ OnBrowseGenerators( event ); } void _wxFB_OnCancelClick( wxCommandEvent& event ){ OnCancelClick( event ); } - void _wxFB_OnBrowsePlugins( wxCommandEvent& event ){ OnBrowsePlugins( event ); } + void _wxFB_OnOKClick( wxCommandEvent& event ){ OnOKClick( event ); } protected: @@ -98,20 +99,22 @@ class NETLIST_DIALOG_ADD_PLUGIN_BASE : public DIALOG_SHIM wxTextCtrl* m_textCtrlCommand; wxStaticText* m_staticTextName; wxTextCtrl* m_textCtrlName; - wxButton* m_buttonOK; - wxButton* m_buttonCancel; - wxButton* m_buttonPlugin; + wxStaticLine* m_staticline1; + wxButton* m_buttonGenerator; + wxStdDialogButtonSizer* m_sdbSizer; + wxButton* m_sdbSizerOK; + wxButton* m_sdbSizerCancel; // Virtual event handlers, overide them in your derived class - virtual void OnOKClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnBrowseGenerators( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } - virtual void OnBrowsePlugins( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOKClick( wxCommandEvent& event ) { event.Skip(); } public: - NETLIST_DIALOG_ADD_PLUGIN_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plugin Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); - ~NETLIST_DIALOG_ADD_PLUGIN_BASE(); + NETLIST_DIALOG_ADD_GENERATOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Script Generator Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 359,170 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~NETLIST_DIALOG_ADD_GENERATOR_BASE(); };