diff --git a/bitmaps_png/CMakeLists.txt b/bitmaps_png/CMakeLists.txt index 2aa170f655..1d6fcae2f1 100644 --- a/bitmaps_png/CMakeLists.txt +++ b/bitmaps_png/CMakeLists.txt @@ -101,6 +101,7 @@ set( BMAPS_SMALL pintype_noconnect refresh small_down + small_edit small_plus small_up trash diff --git a/bitmaps_png/cpp_16/small_edit.cpp b/bitmaps_png/cpp_16/small_edit.cpp new file mode 100644 index 0000000000..946ffcfb62 --- /dev/null +++ b/bitmaps_png/cpp_16/small_edit.cpp @@ -0,0 +1,27 @@ + +/* Do not modify this file, it was automatically generated by the + * PNG2cpp CMake script, using a *.png file as input. + */ + +#include + +static const unsigned char png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0e, 0xc4, 0x00, 0x00, 0x0e, + 0xc4, 0x01, 0x95, 0x2b, 0x0e, 0x1b, 0x00, 0x00, 0x00, 0x19, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, + 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x6e, 0x6b, 0x73, 0x63, + 0x61, 0x70, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x9b, 0xee, 0x3c, 0x1a, 0x00, 0x00, 0x00, 0x5d, 0x49, + 0x44, 0x41, 0x54, 0x38, 0x8d, 0x63, 0x60, 0xa0, 0x23, 0x48, 0x66, 0x60, 0x60, 0x48, 0x21, 0x57, + 0x73, 0x03, 0x03, 0x03, 0xc3, 0x7f, 0x28, 0xee, 0x44, 0x96, 0x60, 0x22, 0xc3, 0xb0, 0x32, 0x64, + 0x97, 0xb0, 0x10, 0x61, 0x33, 0x32, 0x5d, 0x0f, 0xa5, 0xff, 0x11, 0x63, 0x40, 0x03, 0x92, 0x06, + 0x64, 0x43, 0x18, 0x18, 0x18, 0x18, 0xe6, 0x11, 0xb0, 0x18, 0xc5, 0xcf, 0x30, 0xdc, 0x41, 0x48, + 0x13, 0x3e, 0xcd, 0xff, 0xd1, 0x5c, 0x33, 0xaa, 0x19, 0x0d, 0xfc, 0x47, 0xa2, 0x49, 0xd6, 0x8c, + 0x6c, 0x00, 0x8c, 0x4d, 0x92, 0x66, 0x8a, 0x6c, 0xa6, 0x0a, 0x00, 0x00, 0x9f, 0xd9, 0x36, 0xa7, + 0x22, 0x24, 0x83, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, +}; + +const BITMAP_OPAQUE small_edit_xpm[1] = {{ png, sizeof( png ), "small_edit_xpm" }}; + +//EOF diff --git a/bitmaps_png/sources/small_edit.svg b/bitmaps_png/sources/small_edit.svg new file mode 100644 index 0000000000..f1ef148970 --- /dev/null +++ b/bitmaps_png/sources/small_edit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/eeschema/dialogs/dialog_bom.cpp b/eeschema/dialogs/dialog_bom.cpp index 106f4751b0..d095681f77 100644 --- a/eeschema/dialogs/dialog_bom.cpp +++ b/eeschema/dialogs/dialog_bom.cpp @@ -34,11 +34,9 @@ #include #include #include -#include - +#include #include #include -#include #include #include #include @@ -77,33 +75,29 @@ WX_DEFINE_OBJARRAY( BOM_PLUGIN_ARRAY ) /** * Class BOM_CFG_READER_PARSER * holds data and functions pertinent to parsing a S-expression file - * for a WORKSHEET_LAYOUT. */ -class BOM_CFG_READER_PARSER : public DIALOG_BOM_CFG_LEXER +class BOM_CFG_PARSER : public DIALOG_BOM_CFG_LEXER { BOM_PLUGIN_ARRAY* m_pluginsList; public: - BOM_CFG_READER_PARSER( BOM_PLUGIN_ARRAY* aPlugins, - const char* aData, const wxString& aSource ); + BOM_CFG_PARSER( BOM_PLUGIN_ARRAY* aPlugins, const char* aData, const wxString& aSource ); void Parse(); private: void parsePlugin(); }; -// PCB_PLOT_PARAMS_PARSER -BOM_CFG_READER_PARSER::BOM_CFG_READER_PARSER( BOM_PLUGIN_ARRAY* aPlugins, - const char* aLine, - const wxString& aSource ) : +BOM_CFG_PARSER::BOM_CFG_PARSER( BOM_PLUGIN_ARRAY* aPlugins, const char* aLine, + const wxString& aSource ) : DIALOG_BOM_CFG_LEXER( aLine, aSource ) { m_pluginsList = aPlugins; } -void BOM_CFG_READER_PARSER::Parse() +void BOM_CFG_PARSER::Parse() { T token; @@ -131,7 +125,7 @@ void BOM_CFG_READER_PARSER::Parse() } } -void BOM_CFG_READER_PARSER::parsePlugin() +void BOM_CFG_PARSER::parsePlugin() { BOM_PLUGIN plugin; @@ -171,6 +165,7 @@ void BOM_CFG_READER_PARSER::parsePlugin() m_pluginsList->Add( plugin ); } + // The main dialog frame to run scripts to build bom class DIALOG_BOM : public DIALOG_BOM_BASE { @@ -178,16 +173,15 @@ private: SCH_EDIT_FRAME* m_parent; BOM_PLUGIN_ARRAY m_plugins; wxConfigBase* m_config; // to store the "plugins" + bool m_initialized; public: - // Constructor and destructor DIALOG_BOM( SCH_EDIT_FRAME* parent ); ~DIALOG_BOM(); private: void OnPluginSelected( wxCommandEvent& event ) override; void OnRunPlugin( wxCommandEvent& event ) override; - void OnCancelClick( wxCommandEvent& event ) override; void OnHelp( wxCommandEvent& event ) override; void OnAddPlugin( wxCommandEvent& event ) override; void OnRemovePlugin( wxCommandEvent& event ) override; @@ -195,30 +189,23 @@ private: void OnCommandLineEdited( wxCommandEvent& event ) override; void OnNameEdited( wxCommandEvent& event ) override; void OnShowConsoleChanged( wxCommandEvent& event ) override; + void OnIdle( wxIdleEvent& event ) override; void pluginInit(); void installPluginsList(); - /** - * @return the Plugin filename from a command line - * @param aCommand = the command line - */ wxString getPluginFileName( const wxString& aCommand ); - /** - * display (when exists) the text found between the keyword "@package" - * (compatible with doxygen comments) - * and the end of comment block (""" in python", --> in xml) + /* + * Display the text found between the keyword @package (compatible with doxygen comments) + * and the end of comment block (""" in python, --> in xml) */ void displayPluginInfo( FILE * aFile, const wxString& aFilename ); - /** - * Browse plugin files, and set m_CommandStringCtrl field - * @return a command line ro run the plugin - */ wxString choosePlugin(); }; + // Create and show DIALOG_BOM. int InvokeDialogCreateBOM( SCH_EDIT_FRAME* aCaller ) { @@ -226,17 +213,31 @@ int InvokeDialogCreateBOM( SCH_EDIT_FRAME* aCaller ) return dlg.ShowModal(); } + DIALOG_BOM::DIALOG_BOM( SCH_EDIT_FRAME* parent ) : DIALOG_BOM_BASE( parent ) { m_parent = parent; m_config = Kiface().KifaceSettings(); + m_initialized = false; + + m_buttonAddPlugin->SetBitmap( KiBitmap( small_plus_xpm ) ); + m_buttonDelPlugin->SetBitmap( KiBitmap( trash_xpm ) ); + m_buttonEdit->SetBitmap( KiBitmap( small_edit_xpm ) ); + installPluginsList(); #ifndef __WINDOWS__ m_checkBoxShowConsole->Show( false ); #endif + m_sdbSizer1OK->SetLabel( _( "Generate" ) ); + m_sdbSizer1Cancel->SetLabel( _( "Close" ) ); + m_sdbSizer1->Layout(); + + SetInitialFocus( m_lbPlugins ); + m_sdbSizer1OK->SetDefault(); + // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); } @@ -244,8 +245,7 @@ DIALOG_BOM::DIALOG_BOM( SCH_EDIT_FRAME* parent ) : DIALOG_BOM::~DIALOG_BOM() { // Save the plugin descriptions in config. - // the config stores only one string. - // plugins are saved inside a S expr: + // The config stores only one string, so we save the plugins inside a S-expr: // ( plugins // ( plugin "plugin name 1" (cmd "command line 1") ) // ( plugin "plugin name 2" (cmd "command line 2") (opts "option1") (opts "option2") ) @@ -281,9 +281,7 @@ DIALOG_BOM::~DIALOG_BOM() } -/* Read the initialized plugins in config and fill the list - * of names - */ +// Read the initialized plugins in config and fill the list of names void DIALOG_BOM::installPluginsList() { wxString list, active_plugin_name; @@ -292,8 +290,7 @@ void DIALOG_BOM::installPluginsList() if( !list.IsEmpty() ) { - BOM_CFG_READER_PARSER cfg_parser( &m_plugins, TO_UTF8( list ), - wxT( "plugins" ) ); + BOM_CFG_PARSER cfg_parser( &m_plugins, TO_UTF8( list ), wxT( "plugins" ) ); try { cfg_parser.Parse(); @@ -316,12 +313,13 @@ void DIALOG_BOM::installPluginsList() pluginInit(); } + void DIALOG_BOM::OnPluginSelected( wxCommandEvent& event ) { pluginInit(); } -#include + void DIALOG_BOM::pluginInit() { int ii = m_lbPlugins->GetSelection(); @@ -350,11 +348,9 @@ void DIALOG_BOM::pluginInit() FILE* pluginFile = wxFopen( pluginName, "rt" ); - if( pluginFile == NULL ) + if( !pluginFile ) { - wxString msg; - msg.Printf( _( "Failed to open file \"%s\"" ), GetChars( pluginName ) ); - DisplayError( this, msg ); + DisplayError( this, wxString::Format( _( "Failed to open file \"%s\"." ), pluginName ) ); return; } @@ -366,9 +362,8 @@ void DIALOG_BOM::displayPluginInfo( FILE * aFile, const wxString& aFilename ) { m_Messages->Clear(); - // display (when exists) the text found between the keyword "@package" - // (compatible with doxygen comments) - // and the end of comment block (""" in python", --> in xml) + // Display the text found between the keyword @package (compatible with doxygen comments) + // and the end of comment block (""" in python, --> in xml) wxString data; wxFFile fdata( aFile ); // dtor will close the file @@ -377,18 +372,19 @@ void DIALOG_BOM::displayPluginInfo( FILE * aFile, const wxString& aFilename ) return; wxString header( wxT( "@package" ) ); - wxString endsection( wxT( "-->" ) ); // For xml + wxString endsection; wxFileName fn( aFilename ); - if( fn.GetExt().IsSameAs( wxT("py"), false ) ) + if( fn.GetExt().IsSameAs( wxT( "py" ), false ) ) endsection = wxT( "\"\"\"" ); - else if( !fn.GetExt().IsSameAs( wxT("xsl"), false ) ) - // If this is not a python file, we know nothing about file - // and the info cannot be found + else if( fn.GetExt().IsSameAs( wxT( "xsl" ), false ) ) + endsection = wxT( "-->" ); + else + // If this is not a python or xsl file, then we don't know how to find the info return; - // Extract substring between @package and """ + // Extract substring between @package and endsection int strstart = data.Find( header ); if( strstart == wxNOT_FOUND ) @@ -405,22 +401,19 @@ void DIALOG_BOM::displayPluginInfo( FILE * aFile, const wxString& aFilename ) strstart++; m_Messages->SetValue( data.SubString( strstart, strend-1 ) ); + m_Messages->SetSelection( 0, 0 ); } -/** - * Function RunPlugin - * run the plugin command line - */ + +// run the plugin command line void DIALOG_BOM::OnRunPlugin( wxCommandEvent& event ) { - wxFileName fn; - // Calculate the xml netlist filename - fn = g_RootSheet->GetScreen()->GetFileName(); + wxFileName fn = g_RootSheet->GetScreen()->GetFileName(); fn.SetPath( wxPathOnly( Prj().GetProjectFullName() ) ); - fn.ClearExt(); + wxString fullfilename = fn.GetFullPath(); m_parent->ClearMsgPanel(); @@ -439,16 +432,6 @@ void DIALOG_BOM::OnRunPlugin( wxCommandEvent& event ) } -void DIALOG_BOM::OnCancelClick( wxCommandEvent& event ) -{ - EndModal( wxID_CANCEL ); -} - - -/** - * Function OnRemovePlugin - * Remove a plugin from the list - */ void DIALOG_BOM::OnRemovePlugin( wxCommandEvent& event ) { int ii = m_lbPlugins->GetSelection(); @@ -461,19 +444,13 @@ void DIALOG_BOM::OnRemovePlugin( wxCommandEvent& event ) m_plugins.RemoveAt( ii ); // Select the next item, if exists - if( (int)m_lbPlugins->GetCount() >= ii ) - ii = m_lbPlugins->GetCount() - 1; - - if( ii >= 0 ) - m_lbPlugins->SetSelection( ii ); + if( m_lbPlugins->GetCount() ) + m_lbPlugins->SetSelection( std::min( ii, (int) m_lbPlugins->GetCount() - 1 ) ); pluginInit(); } -/** - * Function OnAddPlugin - * Add a new panel for a new netlist plugin - */ + void DIALOG_BOM::OnAddPlugin( wxCommandEvent& event ) { wxString cmdLine = choosePlugin(); @@ -484,10 +461,7 @@ void DIALOG_BOM::OnAddPlugin( wxCommandEvent& event ) // Creates a new plugin entry wxFileName fn( getPluginFileName( cmdLine ) ); - - wxString defaultName = fn.GetName(); - wxString name = wxGetTextFromUser( _("Plugin name in plugin list") , - _("Plugin name"), defaultName ); + wxString name = wxGetTextFromUser( _("Plugin nickname:" ), _("Add Plugin"), fn.GetName(), this ); if( name.IsEmpty() ) return; @@ -497,7 +471,7 @@ void DIALOG_BOM::OnAddPlugin( wxCommandEvent& event ) { if( name == m_plugins.Item( ii ).Name ) { - wxMessageBox( _("This name already exists. Abort") ); + wxMessageBox( wxString::Format( _("Nickname \"%s\" already in use."), name ) ); return; } } @@ -506,7 +480,6 @@ void DIALOG_BOM::OnAddPlugin( wxCommandEvent& event ) newPlugin.Name = name; newPlugin.Command = wxEmptyString; m_plugins.Add( newPlugin ); - m_lbPlugins->SetSelection( m_lbPlugins->GetCount() - 1 ); m_lbPlugins->Append( name ); m_lbPlugins->SetSelection( m_lbPlugins->GetCount() - 1 ); m_textCtrlCommand->SetValue( cmdLine ); @@ -639,23 +612,24 @@ wxString DIALOG_BOM::getPluginFileName( const wxString& aCommand ) void DIALOG_BOM::OnEditPlugin( wxCommandEvent& event ) { - wxString pluginName = getPluginFileName( m_textCtrlCommand->GetValue() ); + wxString pluginName = getPluginFileName( m_textCtrlCommand->GetValue() ); if( pluginName.Length() <= 2 ) // if name != "" { - wxMessageBox( _("Plugin file name not found. Cannot edit plugin file") ); + wxMessageBox( _("Plugin file name not found.") ); return; } AddDelimiterString( pluginName ); - wxString editorname = Pgm().GetEditorName(); + wxString editorname = Pgm().GetEditorName(); if( !editorname.IsEmpty() ) ExecuteFile( this, editorname, pluginName ); else - wxMessageBox( _("No text editor selected in KiCad. Please choose it") ); + wxMessageBox( _( "No text editor selected in KiCad. Please choose one." ) ); } + void DIALOG_BOM::OnHelp( wxCommandEvent& event ) { HTML_MESSAGE_BOX help_Dlg( this, _("Bom Generation Help") ); @@ -666,6 +640,7 @@ void DIALOG_BOM::OnHelp( wxCommandEvent& event ) help_Dlg.ShowModal(); } + void DIALOG_BOM::OnCommandLineEdited( wxCommandEvent& event ) { int ii = m_lbPlugins->GetSelection(); @@ -676,6 +651,7 @@ void DIALOG_BOM::OnCommandLineEdited( wxCommandEvent& event ) m_plugins.Item( ii ).Command = m_textCtrlCommand->GetValue(); } + void DIALOG_BOM::OnNameEdited( wxCommandEvent& event ) { int ii = m_lbPlugins->GetSelection(); @@ -706,3 +682,15 @@ void DIALOG_BOM::OnShowConsoleChanged( wxCommandEvent& event ) } #endif } + + +void DIALOG_BOM::OnIdle( wxIdleEvent& event ) +{ + // On some platforms we initialize wxTextCtrls to all-selected, but we don't want that + // for the messages text box. + if( !m_initialized ) + { + m_Messages->SetSelection( 0, 0 ); + m_initialized = true; + } +} diff --git a/eeschema/dialogs/dialog_bom_base.cpp b/eeschema/dialogs/dialog_bom_base.cpp index 10f889dc8c..f6d8ec4c5d 100644 --- a/eeschema/dialogs/dialog_bom_base.cpp +++ b/eeschema/dialogs/dialog_bom_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 19 2018) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -9,19 +9,6 @@ /////////////////////////////////////////////////////////////////////////// -BEGIN_EVENT_TABLE( DIALOG_BOM_BASE, DIALOG_SHIM ) - EVT_LISTBOX( wxID_ANY, DIALOG_BOM_BASE::_wxFB_OnPluginSelected ) - EVT_TEXT( IN_NAMELINE, DIALOG_BOM_BASE::_wxFB_OnNameEdited ) - EVT_BUTTON( ID_CREATE_BOM, DIALOG_BOM_BASE::_wxFB_OnRunPlugin ) - EVT_BUTTON( wxID_CANCEL, DIALOG_BOM_BASE::_wxFB_OnCancelClick ) - EVT_BUTTON( ID_HELP, DIALOG_BOM_BASE::_wxFB_OnHelp ) - EVT_BUTTON( ID_ADD_PLUGIN, DIALOG_BOM_BASE::_wxFB_OnAddPlugin ) - EVT_BUTTON( ID_REMOVEL_PLUGIN, DIALOG_BOM_BASE::_wxFB_OnRemovePlugin ) - EVT_BUTTON( wxID_ANY, DIALOG_BOM_BASE::_wxFB_OnEditPlugin ) - EVT_TEXT( ID_CMDLINE, DIALOG_BOM_BASE::_wxFB_OnCommandLineEdited ) - EVT_CHECKBOX( wxID_ANY, DIALOG_BOM_BASE::_wxFB_OnShowConsoleChanged ) -END_EVENT_TABLE() - DIALOG_BOM_BASE::DIALOG_BOM_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( wxSize( -1,-1 ), wxDefaultSize ); @@ -35,53 +22,59 @@ 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, _("Plugins:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextPluginTitle = new wxStaticText( this, wxID_ANY, _("BOM plugins:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextPluginTitle->Wrap( -1 ); - bLeftSizer->Add( m_staticTextPluginTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + bLeftSizer->Add( m_staticTextPluginTitle, 0, wxTOP, 5 ); m_lbPlugins = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - bLeftSizer->Add( m_lbPlugins, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + m_lbPlugins->SetMinSize( wxSize( 250,-1 ) ); - m_staticTextName = new wxStaticText( this, wxID_ANY, _("Name:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextName->Wrap( -1 ); - bLeftSizer->Add( m_staticTextName, 0, wxRIGHT|wxLEFT, 5 ); - - m_textCtrlName = new wxTextCtrl( this, IN_NAMELINE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bLeftSizer->Add( m_textCtrlName, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bLeftSizer->Add( m_lbPlugins, 1, wxEXPAND, 5 ); - bUpperSizer->Add( bLeftSizer, 1, wxEXPAND, 5 ); + bUpperSizer->Add( bLeftSizer, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 ); wxBoxSizer* bRightSizer; bRightSizer = new wxBoxSizer( wxVERTICAL ); - m_buttonNetlist = new wxButton( this, ID_CREATE_BOM, _("Generate"), wxDefaultPosition, wxDefaultSize, 0 ); - m_buttonNetlist->SetDefault(); - bRightSizer->Add( m_buttonNetlist, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + wxBoxSizer* bNameSizer; + bNameSizer = new wxBoxSizer( wxHORIZONTAL ); - m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); - bRightSizer->Add( m_buttonCancel, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + m_staticTextName = new wxStaticText( this, wxID_ANY, _("Plugin nickname:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextName->Wrap( -1 ); + bNameSizer->Add( m_staticTextName, 0, wxALIGN_CENTER_VERTICAL, 5 ); - m_buttonHelp = new wxButton( this, ID_HELP, _("Help"), wxDefaultPosition, wxDefaultSize, 0 ); - bRightSizer->Add( m_buttonHelp, 0, wxALL|wxEXPAND, 5 ); - - m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bRightSizer->Add( m_staticline2, 0, wxEXPAND|wxALL, 5 ); - - m_buttonAddPlugin = new wxButton( this, ID_ADD_PLUGIN, _("Add Plugin"), wxDefaultPosition, wxDefaultSize, 0 ); - bRightSizer->Add( m_buttonAddPlugin, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_buttonDelPlugin = new wxButton( this, ID_REMOVEL_PLUGIN, _("Remove Plugin"), wxDefaultPosition, wxDefaultSize, 0 ); - bRightSizer->Add( m_buttonDelPlugin, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_buttonEdit = new wxButton( this, wxID_ANY, _("Edit Plugin File"), wxDefaultPosition, wxDefaultSize, 0 ); - bRightSizer->Add( m_buttonEdit, 0, wxALL|wxEXPAND, 5 ); + m_textCtrlName = new wxTextCtrl( this, IN_NAMELINE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bNameSizer->Add( m_textCtrlName, 1, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 ); - bUpperSizer->Add( bRightSizer, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bRightSizer->Add( bNameSizer, 0, wxEXPAND|wxTOP|wxLEFT, 6 ); + + m_Messages = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY ); + m_Messages->SetMinSize( wxSize( 300,200 ) ); + + bRightSizer->Add( m_Messages, 1, wxEXPAND|wxLEFT, 5 ); - bMainSizer->Add( bUpperSizer, 2, wxEXPAND, 5 ); + bUpperSizer->Add( bRightSizer, 2, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT, 10 ); + + + bMainSizer->Add( bUpperSizer, 2, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bPluginButtons; + bPluginButtons = new wxBoxSizer( wxHORIZONTAL ); + + m_buttonAddPlugin = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), wxBU_AUTODRAW ); + bPluginButtons->Add( m_buttonAddPlugin, 0, wxLEFT, 5 ); + + m_buttonDelPlugin = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), wxBU_AUTODRAW ); + bPluginButtons->Add( m_buttonDelPlugin, 0, wxRIGHT, 5 ); + + m_buttonEdit = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), wxBU_AUTODRAW ); + bPluginButtons->Add( m_buttonEdit, 0, wxRIGHT|wxLEFT, 5 ); + + + bMainSizer->Add( bPluginButtons, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 ); wxBoxSizer* bbottomSizer; bbottomSizer = new wxBoxSizer( wxVERTICAL ); @@ -99,17 +92,24 @@ DIALOG_BOM_BASE::DIALOG_BOM_BASE( wxWindow* parent, wxWindowID id, const wxStrin 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.") ); - bbottomSizer->Add( m_checkBoxShowConsole, 0, wxALL, 5 ); + bbottomSizer->Add( m_checkBoxShowConsole, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - bMainSizer->Add( bbottomSizer, 0, wxEXPAND, 5 ); + bMainSizer->Add( bbottomSizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 ); - m_staticTextInfo = new wxStaticText( this, wxID_ANY, _("Plugin Information:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextInfo->Wrap( -1 ); - bMainSizer->Add( m_staticTextInfo, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bMainSizer->Add( m_staticline2, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - m_Messages = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY ); - bMainSizer->Add( m_Messages, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + m_sdbSizer1 = new wxStdDialogButtonSizer(); + m_sdbSizer1OK = new wxButton( this, wxID_OK ); + m_sdbSizer1->AddButton( m_sdbSizer1OK ); + m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); + m_sdbSizer1Help = new wxButton( this, wxID_HELP ); + m_sdbSizer1->AddButton( m_sdbSizer1Help ); + m_sdbSizer1->Realize(); + + bMainSizer->Add( m_sdbSizer1, 0, wxEXPAND|wxALL, 5 ); this->SetSizer( bMainSizer ); @@ -117,6 +117,18 @@ DIALOG_BOM_BASE::DIALOG_BOM_BASE( wxWindow* parent, wxWindowID id, const wxStrin bMainSizer->Fit( this ); this->Centre( wxBOTH ); + + // 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_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_buttonDelPlugin->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BOM_BASE::OnRemovePlugin ), NULL, this ); + m_buttonEdit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BOM_BASE::OnEditPlugin ), 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_sdbSizer1Help->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BOM_BASE::OnHelp ), NULL, this ); + m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BOM_BASE::OnRunPlugin ), NULL, this ); } DIALOG_BOM_BASE::~DIALOG_BOM_BASE() diff --git a/eeschema/dialogs/dialog_bom_base.fbp b/eeschema/dialogs/dialog_bom_base.fbp index 15405c52f6..2b9254ebb1 100644 --- a/eeschema/dialogs/dialog_bom_base.fbp +++ b/eeschema/dialogs/dialog_bom_base.fbp @@ -10,11 +10,10 @@ 0 res UTF-8 - table + connect dialog_bom_base 1000 none - 1 dialog_bom_base @@ -67,7 +66,7 @@ - + OnIdle @@ -96,7 +95,7 @@ none 5 - wxEXPAND + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 2 @@ -104,8 +103,8 @@ wxHORIZONTAL none - 5 - wxEXPAND + 10 + wxEXPAND|wxRIGHT|wxLEFT 1 @@ -114,7 +113,7 @@ none 5 - wxTOP|wxRIGHT|wxLEFT + wxTOP 0 1 @@ -144,7 +143,7 @@ 0 0 wxID_ANY - Plugins: + BOM plugins: 0 @@ -197,7 +196,7 @@ 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + wxEXPAND 1 1 @@ -233,7 +232,7 @@ 0 - + 250,-1 1 m_lbPlugins 1 @@ -246,7 +245,7 @@ 1 - + ; forward_declare 0 @@ -283,93 +282,206 @@ + + + + 10 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT + 2 + + + bRightSizer + wxVERTICAL + none - 5 - wxRIGHT|wxLEFT + 6 + wxEXPAND|wxTOP|wxLEFT 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Name: - - 0 - - - 0 + - 1 - m_staticTextName - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - + bNameSizer + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Plugin nickname: + + 0 + + + 0 + + 1 + m_staticTextName + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP|wxBOTTOM|wxLEFT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + IN_NAMELINE + + 0 + + 0 + + 0 + + 1 + m_textCtrlName + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnNameEdited + + + + + + 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 + wxEXPAND|wxLEFT + 1 1 1 @@ -397,16 +509,16 @@ 0 0 - IN_NAMELINE + wxID_ANY 0 0 0 - + 300,200 1 - m_textCtrlName + m_Messages 1 @@ -416,7 +528,7 @@ Resizable 1 - + wxTE_MULTILINE|wxTE_READONLY 0 @@ -450,7 +562,7 @@ - OnNameEdited + @@ -459,631 +571,301 @@ + + + + 10 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + + bPluginButtons + wxHORIZONTAL + none 5 - wxALIGN_CENTER_VERTICAL + wxLEFT 0 - + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + MyButton + + 0 + + + 0 - bRightSizer - wxVERTICAL - none - - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_CREATE_BOM - Generate - - 0 - - - 0 - - 1 - m_buttonNetlist - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnRunPlugin - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_CANCEL - Close - - 0 - - - 0 - - 1 - m_buttonCancel - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnCancelClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_HELP - Help - - 0 - - - 0 - - 1 - m_buttonHelp - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnHelp - - - - - - - - - - - - - - - - - - - - - - - - - - - 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_staticline2 - 1 - - - protected - 1 - - Resizable - 1 - - wxLI_HORIZONTAL - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_ADD_PLUGIN - Add Plugin - - 0 - - - 0 - - 1 - m_buttonAddPlugin - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnAddPlugin - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_REMOVEL_PLUGIN - Remove Plugin - - 0 - - - 0 - - 1 - m_buttonDelPlugin - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnRemovePlugin - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Edit Plugin File - - 0 - - - 0 - - 1 - m_buttonEdit - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnEditPlugin - - - - - - - - - - - - - - - - - - - - - - - - - + 1 + m_buttonAddPlugin + 1 + + + protected + 1 + + Resizable + + 1 + 30,30 + wxBU_AUTODRAW + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnAddPlugin + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + MyButton + + 0 + + + 0 + + 1 + m_buttonDelPlugin + 1 + + + protected + 1 + + Resizable + + 1 + 30,30 + wxBU_AUTODRAW + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnRemovePlugin + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + MyButton + + 0 + + + 0 + + 1 + m_buttonEdit + 1 + + + protected + 1 + + Resizable + + 1 + 30,30 + wxBU_AUTODRAW + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnEditPlugin + + + + + + + + + + + + + + + + + + + + + + + - 5 - wxEXPAND + 10 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 0 @@ -1266,7 +1048,7 @@ 5 - wxALL + wxBOTTOM|wxRIGHT|wxLEFT 0 1 @@ -1356,9 +1138,9 @@ 5 - wxTOP|wxRIGHT|wxLEFT + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -1386,7 +1168,6 @@ 0 0 wxID_ANY - Plugin Information: 0 @@ -1394,7 +1175,7 @@ 0 1 - m_staticTextInfo + m_staticline2 1 @@ -1404,14 +1185,13 @@ Resizable 1 - - + wxLI_HORIZONTAL + ; forward_declare 0 - -1 @@ -1439,93 +1219,28 @@ 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 + wxEXPAND|wxALL + 0 + + 0 + 1 + 0 + 1 + 0 + 1 + 0 + 0 - 1 - m_Messages - 1 - - + m_sdbSizer1 protected - 1 - - Resizable - 1 - - wxTE_MULTILINE|wxTE_READONLY - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + OnHelp + + OnRunPlugin + + diff --git a/eeschema/dialogs/dialog_bom_base.h b/eeschema/dialogs/dialog_bom_base.h index 7c3112c613..3f79af155e 100644 --- a/eeschema/dialogs/dialog_bom_base.h +++ b/eeschema/dialogs/dialog_bom_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 19 2018) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -19,11 +19,15 @@ #include #include #include -#include #include +#include +#include +#include +#include +#include #include -#include #include +#include #include /////////////////////////////////////////////////////////////////////////// @@ -33,30 +37,12 @@ /////////////////////////////////////////////////////////////////////////////// class DIALOG_BOM_BASE : public DIALOG_SHIM { - DECLARE_EVENT_TABLE() private: - - // Private event handlers - void _wxFB_OnPluginSelected( wxCommandEvent& event ){ OnPluginSelected( event ); } - void _wxFB_OnNameEdited( wxCommandEvent& event ){ OnNameEdited( event ); } - void _wxFB_OnRunPlugin( wxCommandEvent& event ){ OnRunPlugin( event ); } - void _wxFB_OnCancelClick( wxCommandEvent& event ){ OnCancelClick( event ); } - void _wxFB_OnHelp( wxCommandEvent& event ){ OnHelp( event ); } - void _wxFB_OnAddPlugin( wxCommandEvent& event ){ OnAddPlugin( event ); } - void _wxFB_OnRemovePlugin( wxCommandEvent& event ){ OnRemovePlugin( event ); } - void _wxFB_OnEditPlugin( wxCommandEvent& event ){ OnEditPlugin( event ); } - void _wxFB_OnCommandLineEdited( wxCommandEvent& event ){ OnCommandLineEdited( event ); } - void _wxFB_OnShowConsoleChanged( wxCommandEvent& event ){ OnShowConsoleChanged( event ); } - protected: enum { IN_NAMELINE = 1000, - ID_CREATE_BOM, - ID_HELP, - ID_ADD_PLUGIN, - ID_REMOVEL_PLUGIN, ID_CMDLINE }; @@ -64,30 +50,30 @@ class DIALOG_BOM_BASE : public DIALOG_SHIM wxListBox* m_lbPlugins; wxStaticText* m_staticTextName; wxTextCtrl* m_textCtrlName; - wxButton* m_buttonNetlist; - wxButton* m_buttonCancel; - wxButton* m_buttonHelp; - wxStaticLine* m_staticline2; - wxButton* m_buttonAddPlugin; - wxButton* m_buttonDelPlugin; - wxButton* m_buttonEdit; + wxTextCtrl* m_Messages; + wxBitmapButton* m_buttonAddPlugin; + wxBitmapButton* m_buttonDelPlugin; + wxBitmapButton* m_buttonEdit; wxStaticText* m_staticTextCmd; wxTextCtrl* m_textCtrlCommand; wxCheckBox* m_checkBoxShowConsole; - wxStaticText* m_staticTextInfo; - wxTextCtrl* m_Messages; + wxStaticLine* m_staticline2; + wxStdDialogButtonSizer* m_sdbSizer1; + wxButton* m_sdbSizer1OK; + wxButton* m_sdbSizer1Cancel; + wxButton* m_sdbSizer1Help; // 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 OnNameEdited( wxCommandEvent& event ) { event.Skip(); } - virtual void OnRunPlugin( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } - virtual void OnHelp( wxCommandEvent& event ) { event.Skip(); } virtual void OnAddPlugin( wxCommandEvent& event ) { event.Skip(); } virtual void OnRemovePlugin( wxCommandEvent& event ) { event.Skip(); } virtual void OnEditPlugin( 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(); } public: diff --git a/include/bitmaps.h b/include/bitmaps.h index 6a33252d11..f0eeecddf6 100644 --- a/include/bitmaps.h +++ b/include/bitmaps.h @@ -500,6 +500,7 @@ EXTERN_BITMAP( show_zone_xpm ) EXTERN_BITMAP( show_zone_disable_xpm ) EXTERN_BITMAP( show_zone_outline_only_xpm ) EXTERN_BITMAP( small_down_xpm ) +EXTERN_BITMAP( small_edit_xpm ) EXTERN_BITMAP( small_plus_xpm ) EXTERN_BITMAP( small_up_xpm ) EXTERN_BITMAP( spreadsheet_xpm )