Move pin-to-pin errors to Setup Schematic.

This commit is contained in:
Jeff Young 2020-03-11 21:43:02 +00:00
parent fbd01f2f7d
commit c699fb9e39
17 changed files with 1406 additions and 1188 deletions

View File

@ -214,6 +214,7 @@ set( COMMON_WIDGET_SRCS
widgets/widget_hotkey_list.cpp
widgets/wx_busy_indicator.cpp
widgets/wx_grid.cpp
widgets/wx_angle_text.cpp
)
set( COMMON_PAGE_LAYOUT_SRCS

View File

@ -0,0 +1,77 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2020 Kicad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <wx/wx.h>
#include <widgets/wx_angle_text.h>
#include <eda_rect.h>
WX_ANGLE_TEXT::WX_ANGLE_TEXT( wxWindow* aParent, wxWindowID aId, const wxString& aLabel,
const wxPoint& aPos, double aAngle ) :
wxPanel( aParent, aId, aPos, wxDefaultSize ),
m_label( aLabel ),
m_angle( aAngle )
{
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
font.SetPointSize( font.GetPointSize() + 2 ); // rotated text looks visually smaller
SetFont( font );
wxPoint pos = GetPosition();
wxSize size = GetTextExtent( m_label );
EDA_RECT rect( wxPoint( 0, 0 ), size );
EDA_RECT bbox = rect.GetBoundingBoxRotated( rect.GetPosition(), m_angle );
pos.y += bbox.GetTop() + ( rect.GetBottom() - bbox.GetBottom() );
size.y = bbox.GetHeight();
size.x = bbox.GetWidth();
Move( pos );
SetSize( size );
Bind( wxEVT_ERASE_BACKGROUND, &WX_ANGLE_TEXT::OnEraseBackground, this );
Bind( wxEVT_PAINT, &WX_ANGLE_TEXT::OnPaint, this );
}
void WX_ANGLE_TEXT::OnEraseBackground( wxEraseEvent& WXUNUSED( aEvent ) )
{
// NOP so that we don't erase other labels which intersect
}
void WX_ANGLE_TEXT::OnPaint( wxPaintEvent& WXUNUSED( aEvent ) )
{
wxPaintDC dc( this );
dc.SetFont( GetFont() );
dc.SetTextForeground( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
dc.SetTextBackground( wxTransparentColor );
wxSize size = GetTextExtent( m_label );
EDA_RECT rect( wxPoint( 0, 0 ), size );
EDA_RECT bbox = rect.GetBoundingBoxRotated( rect.GetPosition(), m_angle );
wxPoint pos( 0, -bbox.GetTop() );
dc.DrawRotatedText( m_label, pos, m_angle / 10 );
}

View File

@ -0,0 +1,44 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2020 Kicad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef _WX_ANGLE_TEXT_
#define _WX_ANGLE_TEXT_
#include <wx/panel.h>
class WX_ANGLE_TEXT : public wxPanel
{
public:
WX_ANGLE_TEXT( wxWindow* aParent, wxWindowID aId, const wxString& aLabel,
const wxPoint& aPos, double aAngle );
protected:
void OnEraseBackground( wxEraseEvent& WXUNUSED( aEvent ) );
void OnPaint( wxPaintEvent& WXUNUSED( aEvent ) );
wxString m_label;
double m_angle;
};
#endif /*_WX_ANGLE_TEXT_*/

View File

@ -110,6 +110,8 @@ set( EESCHEMA_DLGS
dialogs/panel_libedit_color_settings_base.cpp
dialogs/panel_setup_formatting.cpp
dialogs/panel_setup_formatting_base.cpp
dialogs/panel_setup_pinmap.cpp
dialogs/panel_setup_pinmap_base.cpp
dialogs/panel_sym_lib_table.cpp
dialogs/panel_sym_lib_table_base.cpp
)

View File

@ -37,8 +37,6 @@
#include <sch_view.h>
#include <netlist_object.h>
#include <sch_marker.h>
#include <sch_sheet.h>
#include <lib_pin.h>
#include <sch_component.h>
#include <connection_graph.h>
#include <tools/ee_actions.h>
@ -48,25 +46,8 @@
#include <id.h>
extern int DiagErc[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL];
extern int DefaultDiagErc[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL];
bool DIALOG_ERC::m_diagErcTableInit = false; // saved only for the current session
// Control identifiers for events
#define ID_MATRIX_0 1800
BEGIN_EVENT_TABLE( DIALOG_ERC, DIALOG_ERC_BASE )
EVT_COMMAND_RANGE( ID_MATRIX_0, ID_MATRIX_0 + ( ELECTRICAL_PINTYPES_TOTAL * ELECTRICAL_PINTYPES_TOTAL ) - 1,
wxEVT_COMMAND_BUTTON_CLICKED, DIALOG_ERC::ChangeErrorLevel )
END_EVENT_TABLE()
DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
DIALOG_ERC_BASE( parent, ID_DIALOG_ERC ), // parent looks for this ID explicitly
m_buttonList(),
m_initialized( false )
{
m_parent = parent;
@ -96,27 +77,10 @@ void DIALOG_ERC::Init()
{
m_initialized = false;
for( auto& buttonRow : m_buttonList )
{
for( auto& button : buttonRow )
button = NULL;
}
SCH_SCREENS screens;
updateMarkerCounts( &screens );
DisplayERC_MarkersList();
// Init Panel Matrix
ReBuildMatrixPanel();
}
void DIALOG_ERC::OnUpdateUI( wxUpdateUIEvent& event )
{
m_buttondelmarkers->Show( m_NoteBook->GetSelection() == 0 );
m_ResetOptButton->Show( m_NoteBook->GetSelection() == 1 );
m_buttonsSizer->Layout();
}
@ -168,12 +132,6 @@ void DIALOG_ERC::OnCloseErcDialog( wxCloseEvent& event )
}
void DIALOG_ERC::OnResetMatrixClick( wxCommandEvent& event )
{
ResetDefaultERCDiag( event );
}
void DIALOG_ERC::OnErcCmpClick( wxCommandEvent& event )
{
wxBusyCursor busy;
@ -271,125 +229,6 @@ void DIALOG_ERC::OnLeftDblClickMarkersList( wxMouseEvent& event )
}
void DIALOG_ERC::ReBuildMatrixPanel()
{
// Try to know the size of bitmap button used in drc matrix
wxBitmapButton * dummy = new wxBitmapButton( m_matrixPanel, wxID_ANY, KiBitmap( ercerr_xpm ) );
wxSize bitmap_size = dummy->GetSize();
delete dummy;
if( !m_diagErcTableInit )
{
memcpy( DiagErc, DefaultDiagErc, sizeof(DefaultDiagErc) );
m_diagErcTableInit = true;
}
wxPoint pos;
// Get the current text size:use a dummy text.
wxStaticText* text = new wxStaticText( m_matrixPanel, -1, wxT( "W" ), pos );
int text_height = text->GetRect().GetHeight();
bitmap_size.y = std::max( bitmap_size.y, text_height );
delete text;
// compute the Y pos interval:
pos.y = text_height;
if( !m_initialized )
{
std::vector<wxStaticText*> labels;
// Print row labels
for( int ii = 0; ii < ELECTRICAL_PINTYPES_TOTAL; ii++ )
{
int y = pos.y + (ii * bitmap_size.y);
text = new wxStaticText( m_matrixPanel, -1, CommentERC_H[ii],
wxPoint( 5, y + ( bitmap_size.y / 2) - (text_height / 2) ) );
labels.push_back( text );
int x = text->GetRect().GetRight();
pos.x = std::max( pos.x, x );
}
// Right-align
for( int ii = 0; ii < ELECTRICAL_PINTYPES_TOTAL; ii++ )
{
wxPoint labelPos = labels[ ii ]->GetPosition();
labelPos.x = pos.x - labels[ ii ]->GetRect().GetWidth();
labels[ ii ]->SetPosition( labelPos );
}
pos.x += 5;
}
else
pos = m_buttonList[0][0]->GetPosition();
for( int ii = 0; ii < ELECTRICAL_PINTYPES_TOTAL; ii++ )
{
int y = pos.y + (ii * bitmap_size.y);
for( int jj = 0; jj <= ii; jj++ )
{
// Add column labels (only once)
int diag = DiagErc[ii][jj];
int x = pos.x + (jj * bitmap_size.x);
if( (ii == jj) && !m_initialized )
{
wxPoint txtpos;
txtpos.x = x + (bitmap_size.x / 2);
txtpos.y = y - text_height;
text = new wxStaticText( m_matrixPanel, -1, CommentERC_V[ii], txtpos );
}
int event_id = ID_MATRIX_0 + ii + ( jj * ELECTRICAL_PINTYPES_TOTAL );
BITMAP_DEF bitmap_butt = erc_green_xpm;
delete m_buttonList[ii][jj];
m_buttonList[ii][jj] = new wxBitmapButton( m_matrixPanel,
event_id,
KiBitmap( bitmap_butt ),
wxPoint( x, y ) );
setDRCMatrixButtonState( m_buttonList[ii][jj], diag );
}
}
m_initialized = true;
}
void DIALOG_ERC::setDRCMatrixButtonState( wxBitmapButton *aButton, int aState )
{
BITMAP_DEF bitmap_butt = nullptr;
wxString tooltip;
switch( aState )
{
case OK:
bitmap_butt = erc_green_xpm;
tooltip = _( "No error or warning" );
break;
case WAR:
bitmap_butt = ercwarn_xpm;
tooltip = _( "Generate warning" );
break;
case ERR:
bitmap_butt = ercerr_xpm;
tooltip = _( "Generate error" );
break;
default:
break;
}
if( bitmap_butt )
{
aButton->SetBitmap( KiBitmap( bitmap_butt ) );
aButton->SetToolTip( tooltip );
}
}
void DIALOG_ERC::DisplayERC_MarkersList()
{
@ -411,29 +250,6 @@ void DIALOG_ERC::DisplayERC_MarkersList()
}
void DIALOG_ERC::ResetDefaultERCDiag( wxCommandEvent& event )
{
memcpy( DiagErc, DefaultDiagErc, sizeof( DiagErc ) );
ReBuildMatrixPanel();
}
void DIALOG_ERC::ChangeErrorLevel( wxCommandEvent& event )
{
int id = event.GetId();
int ii = id - ID_MATRIX_0;
int x = ii / ELECTRICAL_PINTYPES_TOTAL;
int y = ii % ELECTRICAL_PINTYPES_TOTAL;
wxBitmapButton* butt = (wxBitmapButton*) event.GetEventObject();
int level = ( DiagErc[y][x] + 1 ) % 3;
setDRCMatrixButtonState( butt, level );
DiagErc[y][x] = DiagErc[x][y] = level;
}
void DIALOG_ERC::TestErc( REPORTER& aReporter )
{
wxFileName fn;

View File

@ -37,14 +37,10 @@
class DIALOG_ERC : public DIALOG_ERC_BASE
{
DECLARE_EVENT_TABLE()
private:
SCH_EDIT_FRAME* m_parent;
wxBitmapButton* m_buttonList[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL];
bool m_initialized;
const SCH_MARKER* m_lastMarkerFound;
static bool m_diagErcTableInit; // go to true after DiagErc init
public:
DIALOG_ERC( SCH_EDIT_FRAME* parent );
@ -57,8 +53,6 @@ private:
void OnErcCmpClick( wxCommandEvent& event ) override;
void OnEraseDrcMarkersClick( wxCommandEvent& event ) override;
void OnButtonCloseClick( wxCommandEvent& event ) override;
void OnResetMatrixClick( wxCommandEvent& event ) override;
void OnUpdateUI( wxUpdateUIEvent& event ) override;
void RedrawDrawPanel();
@ -70,10 +64,6 @@ private:
void TestErc( REPORTER& aReporter );
void DisplayERC_MarkersList();
void ResetDefaultERCDiag( wxCommandEvent& event );
void ChangeErrorLevel( wxCommandEvent& event );
void ReBuildMatrixPanel();
void setDRCMatrixButtonState( wxBitmapButton *aButton, int aState );
void updateMarkerCounts( SCH_SCREENS *screens );
};

View File

@ -18,8 +18,6 @@ DIALOG_ERC_BASE::DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
wxBoxSizer* bSizer1;
bSizer1 = new wxBoxSizer( wxVERTICAL );
m_NoteBook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_PanelERC = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bercSizer;
bercSizer = new wxBoxSizer( wxVERTICAL );
@ -27,34 +25,36 @@ DIALOG_ERC_BASE::DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
bupperSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* sdiagSizer;
sdiagSizer = new wxStaticBoxSizer( new wxStaticBox( m_PanelERC, wxID_ANY, _("ERC Report:") ), wxVERTICAL );
sdiagSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("ERC Report:") ), wxVERTICAL );
wxGridSizer* gSizeDiag;
gSizeDiag = new wxGridSizer( 3, 2, 5, 5 );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 0, 2, 5, 5 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_ErcTotalErrorsText = new wxStaticText( sdiagSizer->GetStaticBox(), wxID_ANY, _("Total:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ErcTotalErrorsText->Wrap( -1 );
gSizeDiag->Add( m_ErcTotalErrorsText, 1, wxALIGN_CENTER_VERTICAL, 5 );
fgSizer1->Add( m_ErcTotalErrorsText, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_TotalErrCount = new wxTextCtrl( sdiagSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
gSizeDiag->Add( m_TotalErrCount, 0, wxALIGN_CENTER_VERTICAL, 5 );
fgSizer1->Add( m_TotalErrCount, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_WarnErcErrorsText = new wxStaticText( sdiagSizer->GetStaticBox(), wxID_ANY, _("Warnings:"), wxDefaultPosition, wxDefaultSize, 0 );
m_WarnErcErrorsText->Wrap( -1 );
gSizeDiag->Add( m_WarnErcErrorsText, 1, wxALIGN_CENTER_VERTICAL, 5 );
fgSizer1->Add( m_WarnErcErrorsText, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_LastWarningCount = new wxTextCtrl( sdiagSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
gSizeDiag->Add( m_LastWarningCount, 0, wxALIGN_CENTER_VERTICAL, 5 );
fgSizer1->Add( m_LastWarningCount, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_LastErrCountText = new wxStaticText( sdiagSizer->GetStaticBox(), wxID_ANY, _("Errors:"), wxDefaultPosition, wxDefaultSize, 0 );
m_LastErrCountText->Wrap( -1 );
gSizeDiag->Add( m_LastErrCountText, 1, wxALIGN_CENTER_VERTICAL, 5 );
fgSizer1->Add( m_LastErrCountText, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_LastErrCount = new wxTextCtrl( sdiagSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
gSizeDiag->Add( m_LastErrCount, 0, wxALIGN_CENTER_VERTICAL, 5 );
fgSizer1->Add( m_LastErrCount, 0, wxALIGN_CENTER_VERTICAL, 5 );
sdiagSizer->Add( gSizeDiag, 0, wxALL|wxEXPAND, 5 );
sdiagSizer->Add( fgSizer1, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 5 );
bupperSizer->Add( sdiagSizer, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 );
@ -62,13 +62,13 @@ DIALOG_ERC_BASE::DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
wxBoxSizer* bSizerMessages;
bSizerMessages = new wxBoxSizer( wxVERTICAL );
m_titleMessages = new wxStaticText( m_PanelERC, wxID_ANY, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
m_titleMessages = new wxStaticText( this, wxID_ANY, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
m_titleMessages->Wrap( -1 );
m_titleMessages->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
bSizerMessages->Add( m_titleMessages, 0, wxRIGHT|wxLEFT, 12 );
m_MessagesList = new wxTextCtrl( m_PanelERC, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
m_MessagesList = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
m_MessagesList->SetMinSize( wxSize( 180,-1 ) );
bSizerMessages->Add( m_MessagesList, 1, wxEXPAND|wxBOTTOM|wxLEFT, 5 );
@ -79,49 +79,25 @@ DIALOG_ERC_BASE::DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
bercSizer->Add( bupperSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 8 );
m_textMarkers = new wxStaticText( m_PanelERC, wxID_ANY, _("Error List:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textMarkers = new wxStaticText( this, wxID_ANY, _("Error List:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textMarkers->Wrap( -1 );
m_textMarkers->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
bercSizer->Add( m_textMarkers, 0, wxLEFT|wxRIGHT, 20 );
m_MarkersList = new ERC_HTML_LISTFRAME( m_PanelERC, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO|wxBORDER_SIMPLE );
bercSizer->Add( m_MarkersList, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 8 );
m_MarkersList = new ERC_HTML_LISTFRAME( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO|wxBORDER_SIMPLE );
m_MarkersList->SetMinSize( wxSize( 460,200 ) );
bercSizer->Add( m_MarkersList, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 );
m_PanelERC->SetSizer( bercSizer );
m_PanelERC->Layout();
bercSizer->Fit( m_PanelERC );
m_NoteBook->AddPage( m_PanelERC, _("ERC"), true );
m_PanelERCOptions = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* m_panelMatrixSizer;
m_panelMatrixSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizer3;
sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( m_PanelERCOptions, wxID_ANY, _("Pin to Pin Connections") ), wxVERTICAL );
m_matrixPanel = new wxPanel( sbSizer3->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
sbSizer3->Add( m_matrixPanel, 1, wxEXPAND | wxALL, 5 );
m_panelMatrixSizer->Add( sbSizer3, 0, wxALL|wxEXPAND, 5 );
m_PanelERCOptions->SetSizer( m_panelMatrixSizer );
m_PanelERCOptions->Layout();
m_panelMatrixSizer->Fit( m_PanelERCOptions );
m_NoteBook->AddPage( m_PanelERCOptions, _("Options"), false );
bSizer1->Add( m_NoteBook, 1, wxEXPAND | wxALL, 5 );
bSizer1->Add( bercSizer, 1, wxEXPAND, 5 );
m_buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
m_buttondelmarkers = new wxButton( this, ID_ERASE_DRC_MARKERS, _("Delete Markers"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonsSizer->Add( m_buttondelmarkers, 0, wxALL|wxEXPAND, 5 );
m_ResetOptButton = new wxButton( this, ID_RESET_MATRIX, _("Reset to Defaults"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonsSizer->Add( m_ResetOptButton, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_buttonsSizer->Add( 0, 0, 1, wxEXPAND, 5 );
@ -144,11 +120,9 @@ DIALOG_ERC_BASE::DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_ERC_BASE::OnCloseErcDialog ) );
m_NoteBook->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_ERC_BASE::OnUpdateUI ), NULL, this );
m_MarkersList->Connect( wxEVT_COMMAND_HTML_LINK_CLICKED, wxHtmlLinkEventHandler( DIALOG_ERC_BASE::OnLeftClickMarkersList ), NULL, this );
m_MarkersList->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_ERC_BASE::OnLeftDblClickMarkersList ), NULL, this );
m_buttondelmarkers->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnEraseDrcMarkersClick ), NULL, this );
m_ResetOptButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnResetMatrixClick ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnButtonCloseClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnErcCmpClick ), NULL, this );
}
@ -157,11 +131,9 @@ DIALOG_ERC_BASE::~DIALOG_ERC_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_ERC_BASE::OnCloseErcDialog ) );
m_NoteBook->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_ERC_BASE::OnUpdateUI ), NULL, this );
m_MarkersList->Disconnect( wxEVT_COMMAND_HTML_LINK_CLICKED, wxHtmlLinkEventHandler( DIALOG_ERC_BASE::OnLeftClickMarkersList ), NULL, this );
m_MarkersList->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_ERC_BASE::OnLeftDblClickMarkersList ), NULL, this );
m_buttondelmarkers->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnEraseDrcMarkersClick ), NULL, this );
m_ResetOptButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnResetMatrixClick ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnButtonCloseClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnErcCmpClick ), NULL, this );

File diff suppressed because it is too large Load Diff

View File

@ -23,18 +23,15 @@ class ERC_HTML_LISTFRAME;
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/html/htmlwin.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/notebook.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
#define ID_ERASE_DRC_MARKERS 1000
#define ID_RESET_MATRIX 1001
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_ERC_BASE
@ -44,8 +41,6 @@ class DIALOG_ERC_BASE : public DIALOG_SHIM
private:
protected:
wxNotebook* m_NoteBook;
wxPanel* m_PanelERC;
wxStaticText* m_ErcTotalErrorsText;
wxTextCtrl* m_TotalErrCount;
wxStaticText* m_WarnErcErrorsText;
@ -56,22 +51,17 @@ class DIALOG_ERC_BASE : public DIALOG_SHIM
wxTextCtrl* m_MessagesList;
wxStaticText* m_textMarkers;
ERC_HTML_LISTFRAME* m_MarkersList;
wxPanel* m_PanelERCOptions;
wxPanel* m_matrixPanel;
wxBoxSizer* m_buttonsSizer;
wxButton* m_buttondelmarkers;
wxButton* m_ResetOptButton;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
virtual void OnCloseErcDialog( wxCloseEvent& event ) { event.Skip(); }
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnLeftClickMarkersList( wxHtmlLinkEvent& event ) { event.Skip(); }
virtual void OnLeftDblClickMarkersList( wxMouseEvent& event ) { event.Skip(); }
virtual void OnEraseDrcMarkersClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnResetMatrixClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonCloseClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnErcCmpClick( wxCommandEvent& event ) { event.Skip(); }

View File

@ -22,7 +22,7 @@
#include <dialog_sch_import_settings.h>
#include <panel_setup_severities.h>
#include <panel_setup_formatting.h>
#include <panel_setup_pinmap.h>
#include "dialog_schematic_setup.h"
#include "panel_eeschema_template_fieldnames.h"
@ -38,6 +38,7 @@ DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP( SCH_EDIT_FRAME* aFrame ) :
{
m_formatting = new PANEL_SETUP_FORMATTING( this, aFrame );
m_fieldNameTemplates = new PANEL_EESCHEMA_TEMPLATE_FIELDNAMES( aFrame, this, false );
m_pinMap = new PANEL_SETUP_PINMAP( this, aFrame );
m_severities = new PANEL_SETUP_SEVERITIES( this, aFrame->GetErcSettings().m_Severities,
ERCE_FIRST, ERCE_LAST );
/*
@ -49,6 +50,7 @@ DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP( SCH_EDIT_FRAME* aFrame ) :
m_treebook->AddSubPage( m_fieldNameTemplates, _( "Field Name Templates" ) );
m_treebook->AddPage( new wxPanel( this ), _( "Electrical Rules" ) );
m_treebook->AddSubPage( m_pinMap, _( "Pin Map" ) );
m_treebook->AddSubPage( m_severities, _( "Violation Severity" ) );
// Connect Events

View File

@ -27,6 +27,7 @@ class SCH_EDIT_FRAME;
class PANEL_SETUP_SEVERITIES;
class PANEL_EESCHEMA_TEMPLATE_FIELDNAMES;
class PANEL_SETUP_FORMATTING;
class PANEL_SETUP_PINMAP;
class DIALOG_SCHEMATIC_SETUP : public PAGED_DIALOG
@ -42,6 +43,7 @@ protected:
PANEL_SETUP_FORMATTING* m_formatting;
PANEL_EESCHEMA_TEMPLATE_FIELDNAMES* m_fieldNameTemplates;
PANEL_SETUP_PINMAP* m_pinMap;
PANEL_SETUP_SEVERITIES* m_severities;
// event handlers

View File

@ -0,0 +1,241 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#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 <connection_graph.h>
#include <tools/ee_actions.h>
#include <tool/tool_manager.h>
#include <panel_setup_pinmap.h>
#include <erc.h>
#include <id.h>
#include <widgets/wx_angle_text.h>
extern int PinMap[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL];
extern int DefaultPinMap[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL];
bool PANEL_SETUP_PINMAP::m_diagErcTableInit = false; // saved only for the current session
// Control identifiers for events
#define ID_MATRIX_0 1800
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 )
END_EVENT_TABLE()
PANEL_SETUP_PINMAP::PANEL_SETUP_PINMAP( wxWindow* aWindow, SCH_EDIT_FRAME* parent ) :
PANEL_SETUP_PINMAP_BASE( aWindow ),
m_buttonList(),
m_initialized( false )
{
m_parent = parent;
wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
infoFont.SetSymbolicSize( wxFONTSIZE_SMALL );
ReBuildMatrixPanel();
}
void PANEL_SETUP_PINMAP::OnResetMatrixClick( wxCommandEvent& aEvent )
{
memcpy( PinMap, DefaultPinMap, sizeof( 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 ) );
wxSize bitmap_size = dummy->GetSize();
delete dummy;
if( !m_diagErcTableInit )
{
memcpy( PinMap, DefaultPinMap, sizeof(DefaultPinMap) );
m_diagErcTableInit = true;
}
wxPoint pos;
// Get the current text size using a dummy text.
wxStaticText* text = new wxStaticText( m_matrixPanel, -1, CommentERC_V[0], pos );
int text_width = text->GetRect().GetWidth();
int text_height = text->GetRect().GetHeight();
bitmap_size.y = std::max( bitmap_size.y, text_height );
delete text;
// compute the Y pos interval:
pos.y = text_height + ( text_width / 2 );
if( !m_initialized )
{
std::vector<wxStaticText*> labels;
// Print row labels
for( int ii = 0; ii < ELECTRICAL_PINTYPES_TOTAL; ii++ )
{
int y = pos.y + (ii * bitmap_size.y);
text = new wxStaticText( m_matrixPanel, -1, CommentERC_H[ii],
wxPoint( 5, y + ( bitmap_size.y / 2) - (text_height / 2) ) );
labels.push_back( text );
int x = text->GetRect().GetRight();
pos.x = std::max( pos.x, x );
}
// Right-align
for( int ii = 0; ii < ELECTRICAL_PINTYPES_TOTAL; ii++ )
{
wxPoint labelPos = labels[ ii ]->GetPosition();
labelPos.x = pos.x - labels[ ii ]->GetRect().GetWidth();
labels[ ii ]->SetPosition( labelPos );
}
pos.x += 5;
}
else
pos = m_buttonList[0][0]->GetPosition();
for( int ii = 0; ii < ELECTRICAL_PINTYPES_TOTAL; ii++ )
{
int y = pos.y + (ii * bitmap_size.y);
for( int jj = 0; jj <= ii; jj++ )
{
// Add column labels (only once)
int diag = PinMap[ii][jj];
int x = pos.x + ( jj * ( bitmap_size.x + 4 ) );
if( (ii == jj) && !m_initialized )
{
wxPoint txtpos;
txtpos.x = x + (bitmap_size.x / 2);
txtpos.y = y - text_height;
WX_ANGLE_TEXT* txt = new WX_ANGLE_TEXT( m_matrixPanel, wxID_ANY, CommentERC_V[ii],
txtpos, 450 );
}
int event_id = ID_MATRIX_0 + ii + ( jj * ELECTRICAL_PINTYPES_TOTAL );
BITMAP_DEF bitmap_butt = erc_green_xpm;
delete m_buttonList[ii][jj];
wxBitmapButton* btn = new wxBitmapButton( m_matrixPanel, event_id,
KiBitmap( bitmap_butt ), wxPoint( x, y ) );
btn->SetSize( btn->GetSize().x + 4, btn->GetSize().y );
m_buttonList[ii][jj] = btn;
setDRCMatrixButtonState( m_buttonList[ii][jj], diag );
}
}
m_initialized = true;
}
bool PANEL_SETUP_PINMAP::Show( bool show )
{
wxPanel::Show( show );
// For some reason the angle text doesn't get drawn if the paint events are fired while
// it's not the active tab.
if( show )
{
for( wxWindow* win : m_matrixPanel->GetChildren() )
{
WX_ANGLE_TEXT* angleText = dynamic_cast<WX_ANGLE_TEXT*>( win );
if( angleText )
angleText->Refresh();
}
}
return true;
}
void PANEL_SETUP_PINMAP::setDRCMatrixButtonState( wxBitmapButton *aButton, int aState )
{
BITMAP_DEF bitmap_butt = nullptr;
wxString tooltip;
switch( aState )
{
case OK:
bitmap_butt = erc_green_xpm;
tooltip = _( "No error or warning" );
break;
case WAR:
bitmap_butt = ercwarn_xpm;
tooltip = _( "Generate warning" );
break;
case ERR:
bitmap_butt = ercerr_xpm;
tooltip = _( "Generate error" );
break;
default:
break;
}
if( bitmap_butt )
{
aButton->SetBitmap( KiBitmap( bitmap_butt ) );
aButton->SetToolTip( tooltip );
}
}
void PANEL_SETUP_PINMAP::ChangeErrorLevel( wxCommandEvent& event )
{
int id = event.GetId();
int ii = id - ID_MATRIX_0;
int x = ii / ELECTRICAL_PINTYPES_TOTAL;
int y = ii % ELECTRICAL_PINTYPES_TOTAL;
wxBitmapButton* butt = (wxBitmapButton*) event.GetEventObject();
int level = ( PinMap[y][x] + 1 ) % 3;
setDRCMatrixButtonState( butt, level );
PinMap[y][x] = PinMap[x][y] = level;
}

View File

@ -0,0 +1,63 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef _PANEL_SETUP_PINMAP_H_
#define _PANEL_SETUP_PINMAP_H_
#include <vector>
#include <lib_pin.h> // For PINTYPE_COUNT definition
#include <erc_settings.h>
#include "panel_setup_pinmap_base.h"
class SCH_EDIT_FRAME;
class PANEL_SETUP_PINMAP : public PANEL_SETUP_PINMAP_BASE
{
DECLARE_EVENT_TABLE()
private:
SCH_EDIT_FRAME* m_parent;
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;
private:
void OnResetMatrixClick( wxCommandEvent& aEvent ) override;
void ChangeErrorLevel( wxCommandEvent& event );
void ReBuildMatrixPanel();
void setDRCMatrixButtonState( wxBitmapButton *aButton, int aState );
};
#endif
// _PANEL_SETUP_PINMAP_H_

View File

@ -0,0 +1,54 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "panel_setup_pinmap_base.h"
///////////////////////////////////////////////////////////////////////////
PANEL_SETUP_PINMAP_BASE::PANEL_SETUP_PINMAP_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
{
wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* m_panelMatrixSizer;
m_panelMatrixSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizer3;
sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pin to Pin Connections") ), wxVERTICAL );
m_matrixPanel = new wxPanel( sbSizer3->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_matrixPanel->SetMinSize( wxSize( 500,420 ) );
sbSizer3->Add( m_matrixPanel, 1, wxEXPAND | wxALL, 5 );
m_panelMatrixSizer->Add( sbSizer3, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
m_panelMatrixSizer->Add( 0, 0, 0, wxEXPAND|wxTOP, 5 );
m_ResetOptButton = new wxButton( this, ID_RESET_MATRIX, _("Reset to Defaults"), wxDefaultPosition, wxDefaultSize, 0 );
m_panelMatrixSizer->Add( m_ResetOptButton, 0, wxRIGHT|wxLEFT, 10 );
bSizer2->Add( m_panelMatrixSizer, 1, wxEXPAND|wxLEFT, 10 );
this->SetSizer( bSizer2 );
this->Layout();
bSizer2->Fit( this );
// Connect Events
m_ResetOptButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_PINMAP_BASE::OnResetMatrixClick ), NULL, this );
}
PANEL_SETUP_PINMAP_BASE::~PANEL_SETUP_PINMAP_BASE()
{
// Disconnect Events
m_ResetOptButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_PINMAP_BASE::OnResetMatrixClick ), NULL, this );
}

View File

@ -0,0 +1,225 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="15" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">panel_setup_pinmap_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">PanelSetupPinMap</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Panel" expanded="1">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">PANEL_SETUP_PINMAP_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="subclass">; forward_declare</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer2</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="flag">wxEXPAND|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">m_panelMatrixSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Pin to Pin Connections</property>
<property name="minimum_size"></property>
<property name="name">sbSizer3</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">1</property>
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">500,420</property>
<property name="moveable">1</property>
<property name="name">m_matrixPanel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">ID_RESET_MATRIX</property>
<property name="label">Reset to Defaults</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_ResetOptButton</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnResetMatrixClick</event>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

View File

@ -0,0 +1,54 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/panel.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/button.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class PANEL_SETUP_PINMAP_BASE
///////////////////////////////////////////////////////////////////////////////
class PANEL_SETUP_PINMAP_BASE : public wxPanel
{
private:
protected:
enum
{
ID_RESET_MATRIX = 1000
};
wxPanel* m_matrixPanel;
wxButton* m_ResetOptButton;
// Virtual event handlers, overide them in your derived class
virtual void OnResetMatrixClick( wxCommandEvent& event ) { event.Skip(); }
public:
PANEL_SETUP_PINMAP_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_SETUP_PINMAP_BASE();
};

View File

@ -101,7 +101,7 @@ const wxString CommentERC_V[] =
* at start up: must be loaded by DefaultDiagErc
* Can be modified in dialog ERC
*/
int DiagErc[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL];
int PinMap[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL];
/**
* Default Look up table which gives the ERC error level for a pair of connected pins
@ -110,7 +110,7 @@ int DiagErc[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL];
* note also, to avoid inconsistancy:
* DefaultDiagErc[i][j] = DefaultDiagErc[j][i]
*/
int DefaultDiagErc[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL] =
int DefaultPinMap[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL] =
{
/* I, O, Bi, 3S, Pas, UnS, PwrI, PwrO, OC, OE, NC */
/* I */ { OK, OK, OK, OK, OK, WAR, OK, OK, OK, OK, ERR },
@ -508,7 +508,7 @@ void TestOthersItems( NETLIST_OBJECT_LIST* aList, unsigned aNetItemRef, unsigned
if( erc == OK )
{
erc = DiagErc[static_cast<int>( ref_elect_type )][static_cast<int>( jj )];
erc = PinMap[static_cast<int>( ref_elect_type )][static_cast<int>( jj )];
if( erc != OK )
{