diff --git a/common/common.cpp b/common/common.cpp index c8ac359ce3..ba6d346cd5 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -43,7 +43,7 @@ /** * Global variables definitions. * - * TODO: All if these variables should be moved into the class were they + * TODO: All of these variables should be moved into the class were they * are defined and used. Most of them probably belong in the * application class. */ @@ -115,7 +115,7 @@ StructColors ColorRefs[NBCOLOR] = * And other problem is a bug when cross compiling under linux: * a printf print 1,5 and the read functions expects 1.5 * (depending on version print = 1.5 and read = 1,5 - * Very annoying and we detect this and use a stupid but necessary workarount + * Very annoying and we detect this and use a stupid but necessary workaround */ bool g_DisableFloatingPointLocalNotation = false; diff --git a/common/dialogs/dialog_list_selector_base.cpp b/common/dialogs/dialog_list_selector_base.cpp index c115a1d7ec..a4574c9bcf 100644 --- a/common/dialogs/dialog_list_selector_base.cpp +++ b/common/dialogs/dialog_list_selector_base.cpp @@ -1,80 +1,80 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 8 2012) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#include "dialog_list_selector_base.h" - -/////////////////////////////////////////////////////////////////////////// - -EDA_LIST_DIALOG_BASE::EDA_LIST_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 ) -{ - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bSizerMain; - bSizerMain = new wxBoxSizer( wxVERTICAL ); - - m_filterLabel = new wxStaticText( this, wxID_ANY, _("Filter:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_filterLabel->Wrap( -1 ); - m_filterLabel->SetToolTip( _("Enter a string to filter items.\nOnly names containing this string will be listed") ); - - bSizerMain->Add( m_filterLabel, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_filterBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizerMain->Add( m_filterBox, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - m_staticText2 = new wxStaticText( this, wxID_ANY, _("Items:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText2->Wrap( -1 ); - bSizerMain->Add( m_staticText2, 0, wxRIGHT|wxLEFT, 5 ); - - m_listBox = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - m_listBox->SetMinSize( wxSize( 300,200 ) ); - - bSizerMain->Add( m_listBox, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - - m_staticTextMsg = new wxStaticText( this, wxID_ANY, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextMsg->Wrap( -1 ); - bSizerMain->Add( m_staticTextMsg, 0, wxRIGHT|wxLEFT, 5 ); - - m_messages = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY ); - m_messages->SetMinSize( wxSize( -1,80 ) ); - - bSizerMain->Add( m_messages, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 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(); - - bSizerMain->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 ); - - - this->SetSizer( bSizerMain ); - this->Layout(); - - this->Centre( wxBOTH ); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( EDA_LIST_DIALOG_BASE::onClose ) ); - m_filterBox->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( EDA_LIST_DIALOG_BASE::textChangeInFilterBox ), NULL, this ); - m_listBox->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( EDA_LIST_DIALOG_BASE::onClickOnList ), NULL, this ); - m_listBox->Connect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler( EDA_LIST_DIALOG_BASE::onDClickOnList ), NULL, this ); - m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EDA_LIST_DIALOG_BASE::onCancelClick ), NULL, this ); - m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EDA_LIST_DIALOG_BASE::onOkClick ), NULL, this ); -} - -EDA_LIST_DIALOG_BASE::~EDA_LIST_DIALOG_BASE() -{ - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( EDA_LIST_DIALOG_BASE::onClose ) ); - m_filterBox->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( EDA_LIST_DIALOG_BASE::textChangeInFilterBox ), NULL, this ); - m_listBox->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( EDA_LIST_DIALOG_BASE::onClickOnList ), NULL, this ); - m_listBox->Disconnect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler( EDA_LIST_DIALOG_BASE::onDClickOnList ), NULL, this ); - m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EDA_LIST_DIALOG_BASE::onCancelClick ), NULL, this ); - m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EDA_LIST_DIALOG_BASE::onOkClick ), NULL, this ); - -} +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Oct 8 2012) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_list_selector_base.h" + +/////////////////////////////////////////////////////////////////////////// + +EDA_LIST_DIALOG_BASE::EDA_LIST_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 ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizerMain; + bSizerMain = new wxBoxSizer( wxVERTICAL ); + + m_filterLabel = new wxStaticText( this, wxID_ANY, _("Filter:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_filterLabel->Wrap( -1 ); + m_filterLabel->SetToolTip( _("Enter a string to filter items.\nOnly names containing this string will be listed") ); + + bSizerMain->Add( m_filterLabel, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_filterBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bSizerMain->Add( m_filterBox, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_staticText2 = new wxStaticText( this, wxID_ANY, _("Items:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText2->Wrap( -1 ); + bSizerMain->Add( m_staticText2, 0, wxRIGHT|wxLEFT, 5 ); + + m_listBox = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxVSCROLL ); + m_listBox->SetMinSize( wxSize( 300,200 ) ); + + bSizerMain->Add( m_listBox, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + m_staticTextMsg = new wxStaticText( this, wxID_ANY, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextMsg->Wrap( -1 ); + bSizerMain->Add( m_staticTextMsg, 0, wxRIGHT|wxLEFT, 5 ); + + m_messages = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY ); + m_messages->SetMinSize( wxSize( -1,80 ) ); + + bSizerMain->Add( m_messages, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 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(); + + bSizerMain->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 ); + + + this->SetSizer( bSizerMain ); + this->Layout(); + + this->Centre( wxBOTH ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( EDA_LIST_DIALOG_BASE::onClose ) ); + m_filterBox->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( EDA_LIST_DIALOG_BASE::textChangeInFilterBox ), NULL, this ); + m_listBox->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( EDA_LIST_DIALOG_BASE::onListItemActivated ), NULL, this ); + m_listBox->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( EDA_LIST_DIALOG_BASE::onListItemSelected ), NULL, this ); + m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EDA_LIST_DIALOG_BASE::onCancelClick ), NULL, this ); + m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EDA_LIST_DIALOG_BASE::onOkClick ), NULL, this ); +} + +EDA_LIST_DIALOG_BASE::~EDA_LIST_DIALOG_BASE() +{ + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( EDA_LIST_DIALOG_BASE::onClose ) ); + m_filterBox->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( EDA_LIST_DIALOG_BASE::textChangeInFilterBox ), NULL, this ); + m_listBox->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( EDA_LIST_DIALOG_BASE::onListItemActivated ), NULL, this ); + m_listBox->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( EDA_LIST_DIALOG_BASE::onListItemSelected ), NULL, this ); + m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EDA_LIST_DIALOG_BASE::onCancelClick ), NULL, this ); + m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EDA_LIST_DIALOG_BASE::onOkClick ), NULL, this ); + +} diff --git a/common/dialogs/dialog_list_selector_base.fbp b/common/dialogs/dialog_list_selector_base.fbp index 4b93523c05..74591b43d2 100644 --- a/common/dialogs/dialog_list_selector_base.fbp +++ b/common/dialogs/dialog_list_selector_base.fbp @@ -1,642 +1,659 @@ - - - - - - C++ - 1 - source_name - 0 - 0 - res - UTF-8 - connect - dialog_list_selector_base - 1000 - none - 1 - dialog_list_selector_base - - . - - 1 - 1 - 1 - 0 - 0 - - 0 - wxAUI_MGR_DEFAULT - - wxBOTH - - 1 - 1 - impl_virtual - - - - 0 - wxID_ANY - - - EDA_LIST_DIALOG_BASE - - 329,398 - wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - DIALOG_SHIM; dialog_shim.h - - - - - - - - - - - - - - - onClose - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bSizerMain - wxVERTICAL - none - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Filter: - - 0 - - - 0 - - 1 - m_filterLabel - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Enter a string to filter items. Only names containing this string will be listed - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - - 1 - m_filterBox - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - textChangeInFilterBox - - - - - - - - 5 - wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Items: - - 0 - - - 0 - - 1 - m_staticText2 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - 300,200 - 1 - m_listBox - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - onClickOnList - onDClickOnList - - - - - - - - - - - - - - - - - 5 - wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Messages: - - 0 - - - 0 - - 1 - m_staticTextMsg - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - -1,80 - 1 - m_messages - 1 - - - protected - 1 - - Resizable - 1 - - wxTE_MULTILINE|wxTE_READONLY - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 0 - 1 - 0 - 0 - 0 - 1 - 0 - 0 - - m_sdbSizer - protected - - onCancelClick - - - - onOkClick - - - - - - - - + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_list_selector_base + 1000 + none + 1 + dialog_list_selector_base + + . + + 1 + 1 + 1 + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + EDA_LIST_DIALOG_BASE + + 329,398 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h + + + + + + + + + + + + + + + onClose + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizerMain + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Filter: + + 0 + + + 0 + + 1 + m_filterLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Enter a string to filter items. Only names containing this string will be listed + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_filterBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + textChangeInFilterBox + + + + + + + + 5 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Items: + + 0 + + + 0 + + 1 + m_staticText2 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + 300,200 + 1 + m_listBox + 1 + + + protected + 1 + + Resizable + 1 + + wxLC_REPORT + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + wxVSCROLL + + + + + + + + + + + + + + + + + + + + + + + + onListItemActivated + + + + + onListItemSelected + + + + + + + + + + + + + + + + + + 5 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Messages: + + 0 + + + 0 + + 1 + m_staticTextMsg + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + -1,80 + 1 + m_messages + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_MULTILINE|wxTE_READONLY + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer + protected + + onCancelClick + + + + onOkClick + + + + + + + + diff --git a/common/dialogs/dialog_list_selector_base.h b/common/dialogs/dialog_list_selector_base.h index 9753ad02a0..7f6c6239f7 100644 --- a/common/dialogs/dialog_list_selector_base.h +++ b/common/dialogs/dialog_list_selector_base.h @@ -1,66 +1,66 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 8 2012) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#ifndef __DIALOG_LIST_SELECTOR_BASE_H__ -#define __DIALOG_LIST_SELECTOR_BASE_H__ - -#include -#include -#include -class DIALOG_SHIM; - -#include "dialog_shim.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -/// Class EDA_LIST_DIALOG_BASE -/////////////////////////////////////////////////////////////////////////////// -class EDA_LIST_DIALOG_BASE : public DIALOG_SHIM -{ - private: - - protected: - wxStaticText* m_filterLabel; - wxTextCtrl* m_filterBox; - wxStaticText* m_staticText2; - wxListBox* m_listBox; - wxStaticText* m_staticTextMsg; - wxTextCtrl* m_messages; - wxStdDialogButtonSizer* m_sdbSizer; - wxButton* m_sdbSizerOK; - wxButton* m_sdbSizerCancel; - - // Virtual event handlers, overide them in your derived class - virtual void onClose( wxCloseEvent& event ) { event.Skip(); } - virtual void textChangeInFilterBox( wxCommandEvent& event ) { event.Skip(); } - virtual void onClickOnList( wxCommandEvent& event ) { event.Skip(); } - virtual void onDClickOnList( wxCommandEvent& event ) { event.Skip(); } - virtual void onCancelClick( wxCommandEvent& event ) { event.Skip(); } - virtual void onOkClick( wxCommandEvent& event ) { event.Skip(); } - - - public: - - EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 329,398 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); - ~EDA_LIST_DIALOG_BASE(); - -}; - -#endif //__DIALOG_LIST_SELECTOR_BASE_H__ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Oct 8 2012) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_LIST_SELECTOR_BASE_H__ +#define __DIALOG_LIST_SELECTOR_BASE_H__ + +#include +#include +#include +class DIALOG_SHIM; + +#include "dialog_shim.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class EDA_LIST_DIALOG_BASE +/////////////////////////////////////////////////////////////////////////////// +class EDA_LIST_DIALOG_BASE : public DIALOG_SHIM +{ + private: + + protected: + wxStaticText* m_filterLabel; + wxTextCtrl* m_filterBox; + wxStaticText* m_staticText2; + wxListCtrl* m_listBox; + wxStaticText* m_staticTextMsg; + wxTextCtrl* m_messages; + wxStdDialogButtonSizer* m_sdbSizer; + wxButton* m_sdbSizerOK; + wxButton* m_sdbSizerCancel; + + // Virtual event handlers, overide them in your derived class + virtual void onClose( wxCloseEvent& event ) { event.Skip(); } + virtual void textChangeInFilterBox( wxCommandEvent& event ) { event.Skip(); } + virtual void onListItemActivated( wxListEvent& event ) { event.Skip(); } + virtual void onListItemSelected( wxListEvent& event ) { event.Skip(); } + virtual void onCancelClick( wxCommandEvent& event ) { event.Skip(); } + virtual void onOkClick( wxCommandEvent& event ) { event.Skip(); } + + + public: + + EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 329,398 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~EDA_LIST_DIALOG_BASE(); + +}; + +#endif //__DIALOG_LIST_SELECTOR_BASE_H__ diff --git a/common/displlst.cpp b/common/displlst.cpp index 7df8f9dc00..c026bc3e28 100644 --- a/common/displlst.cpp +++ b/common/displlst.cpp @@ -7,35 +7,46 @@ #include #include - EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitle, - const wxArrayString& aItemList, const wxString& aRefText, - void(* aCallBackFunction)(wxString& Text), + const wxArrayString& aItemHeaders, + const std::vector& aItemList, + const wxString& aRefText, + void(*aCallBackFunction)(wxString& Text), bool aSortList ) : EDA_LIST_DIALOG_BASE( aParent, wxID_ANY, aTitle ) { - m_sortList = aSortList; + m_sortList = aSortList; m_callBackFct = aCallBackFunction; m_itemsListCp = &aItemList; + for( unsigned i = 0; i < aItemHeaders.Count(); i++ ) + { + wxListItem column; + column.SetId( i ); + column.SetText( aItemHeaders.Item( i ) ); + column.SetWidth( 300 / aItemHeaders.Count() ); + EDA_LIST_DIALOG_BASE::m_listBox->InsertColumn( i, column ); + } + InsertItems( aItemList, 0 ); + if( m_sortList ) sortList(); if( !aRefText.IsEmpty() ) // try to select the item matching aRefText { - for( unsigned ii = 0; ii < aItemList.GetCount(); ii++ ) - if( aItemList[ii] == aRefText ) + for( unsigned ii = 0; ii < aItemList.size(); ii++ ) + if( aItemList[ii][0] == aRefText ) { - m_listBox->SetSelection( ii ); + m_listBox->SetItemState( ii, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); break; } } if( m_callBackFct == NULL ) { - m_messages->Show(false); - m_staticTextMsg->Show(false); + m_messages->Show( false ); + m_staticTextMsg->Show( false ); } m_filterBox->SetFocus(); @@ -56,17 +67,17 @@ void EDA_LIST_DIALOG::textChangeInFilterBox( wxCommandEvent& event ) wxString filter; wxString itemName; - filter = wxT("*") + m_filterBox->GetLineText(0).MakeLower() + wxT("*"); + filter = wxT( "*" ) + m_filterBox->GetLineText( 0 ).MakeLower() + wxT( "*" ); - m_listBox->Clear(); + m_listBox->DeleteAllItems(); - for(unsigned i = 0; i < m_itemsListCp->GetCount(); i++) + for( unsigned i = 0; i < m_itemsListCp->size(); i++ ) { - itemName = m_itemsListCp->Item(i); + itemName = (*m_itemsListCp)[i].Item( 0 ); - if( itemName.MakeLower().Matches(filter) ) + if( itemName.MakeLower().Matches( filter ) ) { - m_listBox->Insert(m_itemsListCp->Item(i),m_listBox->GetCount()); + Append( (*m_itemsListCp)[i] ); } } @@ -76,20 +87,40 @@ void EDA_LIST_DIALOG::textChangeInFilterBox( wxCommandEvent& event ) wxString EDA_LIST_DIALOG::GetTextSelection() { - wxString text = m_listBox->GetStringSelection(); + long item = -1; + item = m_listBox->GetNextItem( item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); + wxString text = m_listBox->GetItemText( item ); return text; } -void EDA_LIST_DIALOG::Append( const wxString& item ) +void EDA_LIST_DIALOG::Append( const wxArrayString& itemList ) { - m_listBox->Append( item ); + long itemIndex = m_listBox->InsertItem( m_listBox->GetItemCount(), itemList[0] ); + + m_listBox->SetItemData( itemIndex, (long) &(itemList[0]) ); + + // Adding the next columns content + for( unsigned i = 1; i < itemList.size(); i++ ) + { + m_listBox->SetItem( itemIndex, i, itemList[i] ); + } } - -void EDA_LIST_DIALOG::InsertItems( const wxArrayString& itemlist, int position ) +void EDA_LIST_DIALOG::InsertItems( const std::vector& itemList, + int position ) { - m_listBox->InsertItems( itemlist, position ); + for( unsigned i = 0; i < itemList.size(); i++ ) + { + long itemIndex = m_listBox->InsertItem( position+i, itemList[i].Item( 0 ) ); + m_listBox->SetItemData( itemIndex, (long) &( itemList[i].Item( 0 ) ) ); + + // Adding the next columns content + for( unsigned j = 1; j < itemList[i].GetCount(); j++ ) + { + m_listBox->SetItem( itemIndex, j, itemList[i].Item( j ) ); + } + } if( m_sortList ) sortList(); @@ -102,21 +133,20 @@ void EDA_LIST_DIALOG::onCancelClick( wxCommandEvent& event ) } -void EDA_LIST_DIALOG::onClickOnList( wxCommandEvent& event ) +void EDA_LIST_DIALOG::onListItemSelected( wxListEvent& event ) { - wxString text; - + if( m_callBackFct ) { m_messages->Clear(); - text = m_listBox->GetStringSelection(); + wxString text = GetTextSelection(); m_callBackFct( text ); m_messages->WriteText( text ); } } -void EDA_LIST_DIALOG::onDClickOnList( wxCommandEvent& event ) +void EDA_LIST_DIALOG::onListItemActivated( wxListEvent& event ) { EndModal( wxID_OK ); } @@ -136,20 +166,15 @@ void EDA_LIST_DIALOG::onClose( wxCloseEvent& event ) /* Sort alphabetically, case insensitive. */ -static int sortItems( const wxString& item1, const wxString& item2 ) -{ - return StrNumCmp( item1, item2, INT_MAX, true ); +static int wxCALLBACK MyCompareFunction( long aItem1, long aItem2, long aSortData ) +{ + wxString* component1Name = (wxString*) aItem1; + wxString* component2Name = (wxString*) aItem2; + + return StrNumCmp( *component1Name, *component2Name, INT_MAX, true ); } - void EDA_LIST_DIALOG::sortList() { - wxArrayString list = m_listBox->GetStrings(); - - if( list.IsEmpty() ) - return; - - list.Sort( sortItems ); - m_listBox->Clear(); - m_listBox->Append( list ); + m_listBox->SortItems( MyCompareFunction, 0 ); } diff --git a/eeschema/class_library.cpp b/eeschema/class_library.cpp index 3989682c9d..d5ef45001a 100644 --- a/eeschema/class_library.cpp +++ b/eeschema/class_library.cpp @@ -143,25 +143,50 @@ void CMP_LIBRARY::GetEntryNames( wxArrayString& aNames, bool aSort, bool aMakeUp } -void CMP_LIBRARY::SearchEntryNames( wxArrayString& aNames, +/** + * Function sortFunction + * simple function used as comparator to sort a std::vector&. + * + * @param aItem1 is the first comparison parameter. + * @param aItem1 is the second. + * @return bool - which item should be put first in the sorted list. + */ +bool sortFunction( wxArrayString aItem1, wxArrayString aItem2 ) +{ + return( aItem1.Item( 0 ) < aItem2.Item( 0 ) ); +} + + +void CMP_LIBRARY::SearchEntryNames( std::vector& aNames, const wxString& aNameSearch, const wxString& aKeySearch, bool aSort ) { LIB_ALIAS_MAP::iterator it; - for( it=aliases.begin(); it!=aliases.end(); it++ ) + for( it = aliases.begin(); it!=aliases.end(); it++ ) { + if( !aKeySearch.IsEmpty() && KeyWordOk( aKeySearch, (*it).second->GetKeyWords() ) ) - aNames.Add( (*it).first ); + { + wxArrayString item; + item.Add( (*it).first ); + item.Add( GetLogicalName() ); + aNames.push_back( item ); + } if( !aNameSearch.IsEmpty() && WildCompareString( aNameSearch, (*it).second->GetName(), false ) ) - aNames.Add( (*it).first ); + { + wxArrayString item; + item.Add( (*it).first ); + item.Add( GetLogicalName() ); + aNames.push_back( item ); + } } if( aSort ) - aNames.Sort(); + std::sort( aNames.begin(), aNames.end(), sortFunction ); } @@ -172,7 +197,7 @@ void CMP_LIBRARY::SearchEntryNames( wxArrayString& aNames, const wxRegEx& aRe, b LIB_ALIAS_MAP::iterator it; - for( it=aliases.begin(); it!=aliases.end(); it++ ) + for( it = aliases.begin(); it!=aliases.end(); it++ ) { if( aRe.Matches( (*it).second->GetKeyWords() ) ) aNames.Add( (*it).first ); @@ -824,7 +849,7 @@ void CMP_LIBRARY::RemoveLibrary( const wxString& aName ) CMP_LIBRARY_LIST::iterator i; - for ( i = libraryList.begin(); i < libraryList.end(); i++ ) + for( i = libraryList.begin(); i < libraryList.end(); i++ ) { if( i->GetName().CmpNoCase( aName ) == 0 ) { @@ -846,6 +871,7 @@ bool CMP_LIBRARY::LibraryExists( const CMP_LIBRARY* aLibptr ) return false; } + CMP_LIBRARY* CMP_LIBRARY::FindLibrary( const wxString& aName ) { BOOST_FOREACH( CMP_LIBRARY& lib, libraryList ) @@ -925,7 +951,7 @@ void CMP_LIBRARY::RemoveCacheLibrary() { CMP_LIBRARY_LIST::iterator i; - for ( i = libraryList.begin(); i < libraryList.end(); i++ ) + for( i = libraryList.begin(); i < libraryList.end(); i++ ) { if( i->isCache ) libraryList.erase( i-- ); diff --git a/eeschema/class_library.h b/eeschema/class_library.h index 423d024f64..64610c326f 100644 --- a/eeschema/class_library.h +++ b/eeschema/class_library.h @@ -212,7 +212,7 @@ public: * @param aKeySearch - Key word search criteria. * @param aSort - Sort names if true. */ - void SearchEntryNames( wxArrayString& aNames, + void SearchEntryNames( std::vector& aNames, const wxString& aNameSearch = wxEmptyString, const wxString& aKeySearch = wxEmptyString, bool aSort = true ); diff --git a/eeschema/database.cpp b/eeschema/database.cpp index 355e4d0ddb..8058f17431 100644 --- a/eeschema/database.cpp +++ b/eeschema/database.cpp @@ -32,15 +32,15 @@ void DisplayCmpDocAndKeywords( wxString& Name ) } /* - * Displays a list of filterd components found in libraries for selection, + * Displays a list of filtered components found in libraries for selection, * Keys is a list of keywords to filter components which do not match these keywords * If Keys is empty, list components that match BufName mask (with * and?) * - * Returns the name of the selected component, or an ampty string + * Returns the name of the selected component, or an empty string */ wxString DataBaseGetName( EDA_DRAW_FRAME* frame, wxString& Keys, wxString& BufName ) { - wxArrayString nameList; + std::vector nameList; wxString msg; #ifndef KICAD_KEEPCASE @@ -54,7 +54,7 @@ wxString DataBaseGetName( EDA_DRAW_FRAME* frame, wxString& Keys, wxString& BufNa lib.SearchEntryNames( nameList, BufName, Keys ); } - if( nameList.IsEmpty() ) + if( nameList.empty() ) { msg = _( "No components found matching " ); @@ -74,10 +74,14 @@ wxString DataBaseGetName( EDA_DRAW_FRAME* frame, wxString& Keys, wxString& BufNa return wxEmptyString; } + wxArrayString headers; + headers.Add( wxT("Component") ); + headers.Add( wxT("Library") ); + // Show candidate list: wxString cmpname; - EDA_LIST_DIALOG dlg( frame, _( "Select Component" ), nameList, cmpname, - DisplayCmpDocAndKeywords ); + EDA_LIST_DIALOG dlg( frame, _( "Select Component" ), headers, nameList, cmpname, + DisplayCmpDocAndKeywords, true ); if( dlg.ShowModal() != wxID_OK ) return wxEmptyString; diff --git a/eeschema/selpart.cpp b/eeschema/selpart.cpp index a3a89cae33..73775c266a 100644 --- a/eeschema/selpart.cpp +++ b/eeschema/selpart.cpp @@ -26,9 +26,20 @@ CMP_LIBRARY* SelectLibraryFromList( EDA_DRAW_FRAME* frame ) return NULL; } + wxArrayString headers; + headers.Add( wxT("Library") ); + libNamesList = CMP_LIBRARY::GetLibraryNames(); - - EDA_LIST_DIALOG dlg( frame, _( "Select Library" ), libNamesList, OldLibName ); + std::vector itemsToDisplay; + + // Conversion from wxArrayString to vector of ArrayString + for( unsigned i = 0; i < libNamesList.GetCount(); i++ ) + { + wxArrayString item; + item.Add( libNamesList[i] ); + itemsToDisplay.push_back( item ); + } + EDA_LIST_DIALOG dlg( frame, _( "Select Library" ), headers, itemsToDisplay, OldLibName ); if( dlg.ShowModal() != wxID_OK ) return NULL; @@ -62,7 +73,21 @@ int DisplayComponentsNamesInLib( EDA_DRAW_FRAME* frame, Library->GetEntryNames( nameList ); - EDA_LIST_DIALOG dlg( frame, _( "Select Component" ), nameList, OldName, DisplayCmpDocAndKeywords ); + wxArrayString headers; + headers.Add( wxT("Component") ); + headers.Add( wxT("Library") ); + std::vector itemsToDisplay; + + // Conversion from wxArrayString to vector of ArrayString + for( unsigned i = 0; i < nameList.GetCount(); i++ ) + { + wxArrayString item; + item.Add( nameList[i] ); + item.Add( Library->GetLogicalName() ); + itemsToDisplay.push_back( item ); + } + EDA_LIST_DIALOG dlg( frame, _( "Select Component" ), headers, itemsToDisplay, + OldName, DisplayCmpDocAndKeywords ); if( dlg.ShowModal() != wxID_OK ) return 0; @@ -79,6 +104,7 @@ int GetNameOfPartToLoad( EDA_DRAW_FRAME* frame, CMP_LIBRARY* Library, wxString& static wxString OldCmpName; ii = DisplayComponentsNamesInLib( frame, Library, BufName, OldCmpName ); + if( ii <= 0 || BufName.IsEmpty() ) return 0; diff --git a/include/dialog_helpers.h b/include/dialog_helpers.h index 86ad4fed10..9f5bb90cd1 100644 --- a/include/dialog_helpers.h +++ b/include/dialog_helpers.h @@ -31,7 +31,7 @@ class EDA_LIST_DIALOG : public EDA_LIST_DIALOG_BASE private: bool m_sortList; void (*m_callBackFct)( wxString& Text ); - const wxArrayString* m_itemsListCp; + const std::vector* m_itemsListCp; public: /** @@ -44,23 +44,24 @@ public: * @param aSortList = true to sort list items by alphabetic order. */ EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitle, - const wxArrayString& aItemList, const wxString& aRefText, - void(* aCallBackFunction)(wxString& Text) = NULL, + const wxArrayString& aItemHeaders, + const std::vector& aItemList, + const wxString& aRefText, + void(*aCallBackFunction)(wxString& Text) = NULL, bool aSortList = false ); ~EDA_LIST_DIALOG(); - void Append( const wxString& aItemStr ); - void InsertItems( const wxArrayString& aItemList, int aPosition = 0 ); + void Append( const wxArrayString& aItemStr ); + void InsertItems( const std::vector& aItemList, int aPosition = 0 ); wxString GetTextSelection(); private: void onClose( wxCloseEvent& event ); void onCancelClick( wxCommandEvent& event ); void onOkClick( wxCommandEvent& event ); - void onClickOnList( wxCommandEvent& event ); - void onDClickOnList( wxCommandEvent& event ); + void onListItemSelected( wxListEvent& event ); + void onListItemActivated( wxListEvent& event ); void textChangeInFilterBox(wxCommandEvent& event); - void sortList(); }; diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index 7601c26442..b560b1f4ee 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -751,7 +751,19 @@ void FOOTPRINT_EDIT_FRAME::Select_Active_Library() if( g_LibraryNames.GetCount() == 0 ) return; - EDA_LIST_DIALOG dlg( this, FMT_SELECT_LIB, g_LibraryNames, getLibNickName() ); + wxArrayString headers; + headers.Add( wxT("Library") ); + + std::vector itemsToDisplay; + + // Conversion from wxArrayString to vector of ArrayString + for( unsigned i = 0; i < g_LibraryNames.GetCount(); i++ ) + { + wxArrayString item; + item.Add( g_LibraryNames[i] ); + itemsToDisplay.push_back( item ); + } + EDA_LIST_DIALOG dlg( this, FMT_SELECT_LIB, headers, itemsToDisplay, getLibNickName() ); if( dlg.ShowModal() != wxID_OK ) return; diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp index 83de622860..67689c9f5b 100644 --- a/pcbnew/loadcmp.cpp +++ b/pcbnew/loadcmp.cpp @@ -438,8 +438,20 @@ wxString PCB_BASE_FRAME::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow, if( footprint_names_list.GetCount() ) { + wxArrayString headers; + headers.Add( wxT("Module") ); + std::vector itemsToDisplay; + + // Conversion from wxArrayString to vector of ArrayString + for( unsigned i = 0; i < footprint_names_list.GetCount(); i++ ) + { + wxArrayString item; + item.Add( footprint_names_list[i] ); + itemsToDisplay.push_back( item ); + } + msg.Printf( _( "Modules [%d items]" ), (int) footprint_names_list.GetCount() ); - EDA_LIST_DIALOG dlg( aWindow, msg, footprint_names_list, OldName, + EDA_LIST_DIALOG dlg( aWindow, msg, headers, itemsToDisplay, OldName, DisplayCmpDoc ); if( dlg.ShowModal() == wxID_OK ) @@ -497,7 +509,18 @@ MODULE* FOOTPRINT_EDIT_FRAME::Select_1_Module_From_BOARD( BOARD* aPcb ) msg.Printf( _( "Modules [%d items]" ), listnames.GetCount() ); - EDA_LIST_DIALOG dlg( this, msg, listnames, wxEmptyString, NULL, SORT_LIST ); + wxArrayString headers; + headers.Add( wxT("Module") ); + std::vector itemsToDisplay; + + // Conversion from wxArrayString to vector of ArrayString + for( unsigned i = 0; i < listnames.GetCount(); i++ ) + { + wxArrayString item; + item.Add( listnames[i] ); + itemsToDisplay.push_back( item ); + } + EDA_LIST_DIALOG dlg( this, msg, headers, itemsToDisplay, wxEmptyString, NULL, SORT_LIST ); if( dlg.ShowModal() == wxID_OK ) CmpName = dlg.GetTextSelection(); diff --git a/pcbnew/modview.cpp b/pcbnew/modview.cpp index d2c3498da0..1f3548c02b 100644 --- a/pcbnew/modview.cpp +++ b/pcbnew/modview.cpp @@ -84,8 +84,19 @@ void FOOTPRINT_VIEWER_FRAME::SelectCurrentLibrary( wxCommandEvent& event ) if( g_LibraryNames.GetCount() == 0 ) return; + wxArrayString headers; + headers.Add( wxT("Library") ); + std::vector itemsToDisplay; + + // Conversion from wxArrayString to vector of ArrayString + for( unsigned i = 0; i < g_LibraryNames.GetCount(); i++ ) + { + wxArrayString item; + item.Add( g_LibraryNames[i] ); + itemsToDisplay.push_back( item ); + } EDA_LIST_DIALOG dlg( this, _( "Select Current Library:" ), - g_LibraryNames, m_libraryName ); + headers, itemsToDisplay, m_libraryName ); if( dlg.ShowModal() != wxID_OK ) return; diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index 80ba1954b4..ec92189f30 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -142,7 +142,7 @@ bool PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFullFilename, GetChars( aCmpFullFileName ) ); aMessageWindow->AppendText( msg + wxT( "\n" ) ); } - } + } // Clear undo and redo lists to avoid inconsistencies between lists GetScreen()->ClearUndoRedoList(); @@ -165,6 +165,7 @@ bool PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFullFilename, netList_Reader.ReadLibpartSectionSetOpt( false ); bool success = netList_Reader.ReadNetList( netfile ); + if( !success ) { wxMessageBox( _("Netlist read error") ); @@ -217,7 +218,18 @@ MODULE* PCB_EDIT_FRAME::ListAndSelectModuleName( void ) for( ; Module != NULL; Module = (MODULE*) Module->Next() ) listnames.Add( Module->GetReference() ); - EDA_LIST_DIALOG dlg( this, _( "Components" ), listnames, wxEmptyString ); + wxArrayString headers; + headers.Add( wxT("Module") ); + std::vector itemsToDisplay; + + // Conversion from wxArrayString to vector of ArrayString + for( unsigned i = 0; i < listnames.GetCount(); i++ ) + { + wxArrayString item; + item.Add( listnames[i] ); + itemsToDisplay.push_back( item ); + } + EDA_LIST_DIALOG dlg( this, _( "Components" ), headers, itemsToDisplay, wxEmptyString ); if( dlg.ShowModal() != wxID_OK ) return NULL;