Eeschema: Display pin count and duplicate pin list in pin table dialog
This commit is contained in:
parent
5ce559176d
commit
08ca19f95d
|
@ -816,5 +816,11 @@ void DIALOG_LIB_EDIT_PIN_TABLE::updateSummary()
|
|||
pinNumbers.insert( pin->GetNumber() );
|
||||
}
|
||||
|
||||
m_summary->SetLabel( pinNumbers.GetSummary() );
|
||||
m_pin_numbers_summary->SetLabel( pinNumbers.GetSummary() );
|
||||
|
||||
wxString count;
|
||||
count << m_pins.size();
|
||||
m_pin_count->SetLabel( count );
|
||||
|
||||
m_duplicate_pins->SetLabel( pinNumbers.GetDuplicates() );
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Dec 21 2020)
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -92,13 +92,53 @@ DIALOG_LIB_EDIT_PIN_TABLE_BASE::DIALOG_LIB_EDIT_PIN_TABLE_BASE( wxWindow* parent
|
|||
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
|
||||
bSizer2->Add( m_staticline2, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 10 );
|
||||
|
||||
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Pin numbers:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText1->Wrap( -1 );
|
||||
bSizer2->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 10 );
|
||||
wxBoxSizer* bSizer3;
|
||||
bSizer3 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_summary = new wxStaticText( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_summary->Wrap( -1 );
|
||||
bSizer2->Add( m_summary, 1, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
wxBoxSizer* bPinNumbersSizer;
|
||||
bPinNumbersSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_staticTextPinNumbers = new wxStaticText( this, wxID_ANY, _("Pin numbers:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextPinNumbers->Wrap( -1 );
|
||||
bPinNumbersSizer->Add( m_staticTextPinNumbers, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 10 );
|
||||
|
||||
m_pin_numbers_summary = new wxStaticText( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_pin_numbers_summary->Wrap( -1 );
|
||||
bPinNumbersSizer->Add( m_pin_numbers_summary, 1, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
bSizer3->Add( bPinNumbersSizer, 1, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bPinCountSizer;
|
||||
bPinCountSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_staticTextPinCount = new wxStaticText( this, wxID_ANY, _("Pin count:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextPinCount->Wrap( -1 );
|
||||
bPinCountSizer->Add( m_staticTextPinCount, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 10 );
|
||||
|
||||
m_pin_count = new wxStaticText( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_pin_count->Wrap( -1 );
|
||||
bPinCountSizer->Add( m_pin_count, 1, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
bSizer3->Add( bPinCountSizer, 1, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bDuplicatePinSizer;
|
||||
bDuplicatePinSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_staticTextDuplicatePins = new wxStaticText( this, wxID_ANY, _("Duplicate pins:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextDuplicatePins->Wrap( -1 );
|
||||
bDuplicatePinSizer->Add( m_staticTextDuplicatePins, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 10 );
|
||||
|
||||
m_duplicate_pins = new wxStaticText( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_duplicate_pins->Wrap( -1 );
|
||||
bDuplicatePinSizer->Add( m_duplicate_pins, 1, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
bSizer3->Add( bDuplicatePinSizer, 1, wxBOTTOM|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizer2->Add( bSizer3, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizer2->Add( 10, 0, 0, wxEXPAND, 5 );
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Dec 21 2020)
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -48,8 +48,12 @@ class DIALOG_LIB_EDIT_PIN_TABLE_BASE : public DIALOG_SHIM
|
|||
wxCheckBox* m_cbGroup;
|
||||
wxBitmapButton* m_refreshButton;
|
||||
wxStaticLine* m_staticline2;
|
||||
wxStaticText* m_staticText1;
|
||||
wxStaticText* m_summary;
|
||||
wxStaticText* m_staticTextPinNumbers;
|
||||
wxStaticText* m_pin_numbers_summary;
|
||||
wxStaticText* m_staticTextPinCount;
|
||||
wxStaticText* m_pin_count;
|
||||
wxStaticText* m_staticTextDuplicatePins;
|
||||
wxStaticText* m_duplicate_pins;
|
||||
wxStdDialogButtonSizer* m_Buttons;
|
||||
wxButton* m_ButtonsOK;
|
||||
wxButton* m_ButtonsCancel;
|
||||
|
|
|
@ -108,6 +108,23 @@ wxString PIN_NUMBERS::GetSummary() const
|
|||
}
|
||||
|
||||
|
||||
wxString PIN_NUMBERS::GetDuplicates() const
|
||||
{
|
||||
wxString ret;
|
||||
|
||||
for( const wxString& pinNumber : duplicate_pins )
|
||||
{
|
||||
ret += pinNumber;
|
||||
ret += ',';
|
||||
}
|
||||
|
||||
// Remove the trailing comma
|
||||
ret.RemoveLast();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int PIN_NUMBERS::Compare( const wxString& lhs, const wxString& rhs )
|
||||
{
|
||||
wxString::size_type cursor1 = 0;
|
||||
|
|
|
@ -34,6 +34,12 @@ class PIN_NUMBERS
|
|||
public:
|
||||
wxString GetSummary() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a formatted string of all the pins that have duplicate numbers.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
wxString GetDuplicates() const;
|
||||
|
||||
static int Compare( const wxString& lhs, const wxString& rhs );
|
||||
|
||||
private:
|
||||
|
@ -52,7 +58,18 @@ public:
|
|||
typedef container_type::iterator iterator;
|
||||
typedef container_type::const_iterator const_iterator;
|
||||
|
||||
void insert( value_type const &v ) { pins.insert( v ); }
|
||||
void insert( value_type const& v )
|
||||
{
|
||||
// Check if the insertion occurred. If no insertion was performed then
|
||||
// the pin number is a duplicate so add it to the duplicate set.
|
||||
bool not_duplicate = pins.insert( v ).second;
|
||||
|
||||
if( not_duplicate == false )
|
||||
{
|
||||
duplicate_pins.insert( v );
|
||||
}
|
||||
}
|
||||
|
||||
container_type::size_type size() const { return pins.size(); }
|
||||
|
||||
iterator begin() { return pins.begin(); }
|
||||
|
@ -62,6 +79,7 @@ public:
|
|||
|
||||
private:
|
||||
container_type pins;
|
||||
std::set<wxString> duplicate_pins;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue