From b917e9aa72c4347d047d373520343496a982f2af Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 4 Jul 2020 09:57:05 +0100 Subject: [PATCH] Implement import from... for pin conflicts map. --- eeschema/dialogs/dialog_schematic_setup.cpp | 8 +++---- eeschema/dialogs/panel_setup_pinmap.cpp | 23 ++++++++++++++------- eeschema/dialogs/panel_setup_pinmap.h | 6 +++--- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/eeschema/dialogs/dialog_schematic_setup.cpp b/eeschema/dialogs/dialog_schematic_setup.cpp index 5cbf04aec4..9f00ff1dc5 100644 --- a/eeschema/dialogs/dialog_schematic_setup.cpp +++ b/eeschema/dialogs/dialog_schematic_setup.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -48,7 +47,8 @@ DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP( SCH_EDIT_FRAME* aFrame ) : m_pinToPinError = ERC_ITEM::Create( ERCE_PIN_TO_PIN_WARNING ); m_severities = new PANEL_SETUP_SEVERITIES( this, ERC_ITEM::GetItemsWithSeverities(), - m_frame->Schematic().ErcSettings().m_Severities, m_pinToPinError ); + m_frame->Schematic().ErcSettings().m_Severities, + m_pinToPinError ); m_textVars = new PANEL_TEXT_VARIABLES( m_treebook, &Prj() ); @@ -150,9 +150,7 @@ void DIALOG_SCHEMATIC_SETUP::OnAuxiliaryAction( wxCommandEvent& event ) m_fieldNameTemplates->ImportSettingsFrom( file.m_SchematicSettings->m_TemplateFieldNames ); if( importDlg.m_pinMapOpt->GetValue() ) - { - // JEY TODO - } + m_pinMap->ImportSettingsFrom( file.m_ErcSettings->m_PinMap ); if( importDlg.m_SeveritiesOpt->GetValue() ) m_severities->ImportSettingsFrom( file.m_ErcSettings->m_Severities ); diff --git a/eeschema/dialogs/panel_setup_pinmap.cpp b/eeschema/dialogs/panel_setup_pinmap.cpp index 5cb755b098..c385f641d5 100644 --- a/eeschema/dialogs/panel_setup_pinmap.cpp +++ b/eeschema/dialogs/panel_setup_pinmap.cpp @@ -25,14 +25,11 @@ #include #include #include -#include #include #include #include #include #include -#include -#include #include #include #include @@ -50,7 +47,7 @@ BEGIN_EVENT_TABLE( PANEL_SETUP_PINMAP, PANEL_SETUP_PINMAP_BASE ) EVT_COMMAND_RANGE( ID_MATRIX_0, ID_MATRIX_0 + ( ELECTRICAL_PINTYPES_TOTAL * ELECTRICAL_PINTYPES_TOTAL ) - 1, - wxEVT_COMMAND_BUTTON_CLICKED, PANEL_SETUP_PINMAP::ChangeErrorLevel ) + wxEVT_COMMAND_BUTTON_CLICKED, PANEL_SETUP_PINMAP::changeErrorLevel ) END_EVENT_TABLE() @@ -65,18 +62,18 @@ PANEL_SETUP_PINMAP::PANEL_SETUP_PINMAP( wxWindow* aWindow, SCH_EDIT_FRAME* paren wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); infoFont.SetSymbolicSize( wxFONTSIZE_SMALL ); - ReBuildMatrixPanel(); + reBuildMatrixPanel(); } void PANEL_SETUP_PINMAP::OnResetMatrixClick( wxCommandEvent& aEvent ) { m_schematic->ErcSettings().ResetPinMap(); - ReBuildMatrixPanel(); + reBuildMatrixPanel(); } -void PANEL_SETUP_PINMAP::ReBuildMatrixPanel() +void PANEL_SETUP_PINMAP::reBuildMatrixPanel() { // Try to know the size of bitmap button used in drc matrix wxBitmapButton * dummy = new wxBitmapButton( m_matrixPanel, wxID_ANY, KiBitmap( ercerr_xpm ) ); @@ -214,7 +211,7 @@ void PANEL_SETUP_PINMAP::setDRCMatrixButtonState( wxBitmapButton *aButton, PIN_E } -void PANEL_SETUP_PINMAP::ChangeErrorLevel( wxCommandEvent& event ) +void PANEL_SETUP_PINMAP::changeErrorLevel( wxCommandEvent& event ) { int id = event.GetId(); int ii = id - ID_MATRIX_0; @@ -232,3 +229,13 @@ void PANEL_SETUP_PINMAP::ChangeErrorLevel( wxCommandEvent& event ) } +void PANEL_SETUP_PINMAP::ImportSettingsFrom( PIN_ERROR aPinMap[][ELECTRICAL_PINTYPES_TOTAL] ) +{ + for( int ii = 0; ii < ELECTRICAL_PINTYPES_TOTAL; ii++ ) + { + for( int jj = 0; jj <= ii; jj++ ) + setDRCMatrixButtonState( m_buttonList[ii][jj], aPinMap[ii][jj] ); + } +} + + diff --git a/eeschema/dialogs/panel_setup_pinmap.h b/eeschema/dialogs/panel_setup_pinmap.h index 5fa828ca74..0d67d67150 100644 --- a/eeschema/dialogs/panel_setup_pinmap.h +++ b/eeschema/dialogs/panel_setup_pinmap.h @@ -44,18 +44,18 @@ private: SCHEMATIC* m_schematic; wxBitmapButton* m_buttonList[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL]; bool m_initialized; - static bool m_diagErcTableInit; // go to true after DiagErc init public: PANEL_SETUP_PINMAP( wxWindow* aWindow, SCH_EDIT_FRAME* aParent ); bool Show( bool show ) override; + void ImportSettingsFrom( PIN_ERROR aPinMap[][ELECTRICAL_PINTYPES_TOTAL] ); private: void OnResetMatrixClick( wxCommandEvent& aEvent ) override; - void ChangeErrorLevel( wxCommandEvent& event ); - void ReBuildMatrixPanel(); + void changeErrorLevel( wxCommandEvent& event ); + void reBuildMatrixPanel(); void setDRCMatrixButtonState( wxBitmapButton *aButton, PIN_ERROR aState ); };