Implement import from... for pin conflicts map.

This commit is contained in:
Jeff Young 2020-07-04 09:57:05 +01:00
parent b0ca7d5140
commit b917e9aa72
3 changed files with 21 additions and 16 deletions

View File

@ -26,7 +26,6 @@
#include <panel_setup_severities.h>
#include <panel_setup_formatting.h>
#include <panel_setup_pinmap.h>
#include <eeschema_config.h>
#include <erc_item.h>
#include <panel_text_variables.h>
#include <project/project_file.h>
@ -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 );

View File

@ -25,14 +25,11 @@
#include <gestfich.h>
#include <pgm_base.h>
#include <sch_edit_frame.h>
#include <project.h>
#include <kiface_i.h>
#include <bitmaps.h>
#include <reporter.h>
#include <wildcards_and_files_ext.h>
#include <netlist_object.h>
#include <lib_pin.h>
#include <sch_component.h>
#include <schematic.h>
#include <connection_graph.h>
#include <tools/ee_actions.h>
@ -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] );
}
}

View File

@ -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 );
};