Add user-defined severities, exclusions and colors to DRC markers.

Exclusions are currently persisted in the project file.

Fixes https://gitlab.com/kicad/code/kicad/issues/1989
This commit is contained in:
Jeff Young 2020-02-28 00:05:40 +00:00
parent 265c1663f9
commit 85c2e0d23a
109 changed files with 4057 additions and 4768 deletions

View File

@ -67,7 +67,6 @@ class FILENAME_RESOLVER;
class BOARD;
class CINFO3D_VISU;
class MODULE;
class COLORS_DESIGN_SETTINGS;
class PANEL_PREV_3D: public PANEL_PREV_3D_BASE
{

View File

@ -50,7 +50,7 @@ public:
m_hasMessage = false;
}
REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override
REPORTER& Report( const wxString& aText, SEVERITY aSeverity = SEVERITY_UNDEFINED ) override
{
if( !aText.IsEmpty() )
m_hasMessage = true;

View File

@ -1,253 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 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
*/
/**
* @file colors_design_settings.cpp
* @brief Handle colors used to draw all items or layers.
*/
#include <fctsys.h>
#include <macros.h>
#include <colors_design_settings.h>
/* Class for handle list of color settings for designs
* in Eeschema, Pcbnew and GerbView
*/
/* Initial colors values: optimized for Pcbnew up to 64 layers.
* The table is not actually used by Eeschema.
* these values are superseded by config reading
*/
static const EDA_COLOR_T default_layer_color[] = {
// Copper layers
RED, YELLOW, LIGHTMAGENTA, LIGHTRED,
CYAN, GREEN, BLUE, DARKGRAY,
MAGENTA, LIGHTGRAY, MAGENTA, RED,
BROWN, LIGHTGRAY, BLUE, GREEN,
RED, YELLOW, LIGHTMAGENTA, LIGHTRED,
CYAN, GREEN, BLUE, DARKGRAY,
MAGENTA, LIGHTGRAY, MAGENTA, RED,
BROWN, LIGHTGRAY, BLUE, GREEN,
// tech layers
BLUE, MAGENTA, // B_Adhes, F_Adhes
LIGHTCYAN, RED, // B_Paste, F_Paste
MAGENTA, CYAN, // B_SilkS, F_SilkS
BROWN, MAGENTA, // B_Mask, F_Mask
// user layers
LIGHTGRAY, BLUE, GREEN, YELLOW, // Dwgs_User, Cmts_User, Eco1_User, Eco2_User
// Special layers
YELLOW, // Edge_Cuts
LIGHTMAGENTA, // Margin
DARKGRAY, LIGHTGRAY, // B_CrtYd, F_CrtYd,
BLUE, DARKGRAY // B_Fab, F_Fab
};
// for color order, see enum GAL_LAYER_ID
static const EDA_COLOR_T default_items_color[] = {
LIGHTGRAY, // unused (LAYER_VIAS = GAL_LAYER_ID_START)
CYAN, // LAYER_VIA_MICROVIA
BROWN, // LAYER_VIA_BBLIND
LIGHTGRAY, // LAYER_VIA_THROUGH
YELLOW, // LAYER_NON_PLATED
LIGHTGRAY, // LAYER_MOD_TEXT_FR
BLUE, // LAYER_MOD_TEXT_BK
DARKGRAY, // LAYER_MOD_TEXT_INVISIBLE
BLUE, // LAYER_ANCHOR
RED, // LAYER_PAD_FR
GREEN, // LAYER_PAD_BK
LIGHTGRAY, // LAYER_RATSNEST
DARKGRAY, // LAYER_GRID
LIGHTRED, // LAYER_GRID_AXES
BLUE, // LAYER_NO_CONNECTS
LIGHTGRAY, LIGHTGRAY, // LAYER_MOD_FR, LAYER_MOD_BK
LIGHTGRAY, LIGHTGRAY, // LAYER_MOD_VALUES, LAYER_MOD_REFERENCES
LIGHTGRAY, // LAYER_TRACKS
YELLOW, LIGHTGRAY, // LAYER_PADS, LAYER_PADS_PLATEDHOLES
LIGHTGRAY, // LAYER_VIAS_HOLES
LIGHTGRAY, // LAYER_DRC
DARKRED, // LAYER_WORKSHEET
LIGHTGRAY, // LAYER_GP_OVERLAY
LIGHTGRAY, // LAYER_SELECT_OVERLAY
BLACK, // LAYER_PCB_BACKGROUND
WHITE, // LAYER_CURSOR
WHITE, // LAYER_AUX_ITEMS
LIGHTGRAY, // LAYER_DRAW_BITMAPS
LIGHTGRAY // unused (GAL_LAYER_ID_BITMASK_END)
};
COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS( FRAME_T aFrameType )
{
m_frameType = aFrameType;
for( unsigned src = 0, dst = 0; dst < arrayDim( m_LayersColors ); ++dst )
{
m_LayersColors[dst] = COLOR4D( default_layer_color[src++] );
if( src >= arrayDim( default_layer_color ) )
src = 0; // wrap the source.
}
for( unsigned src = 0, dst = LAYER_VIAS; src < arrayDim( default_items_color ); ++dst, ++src )
{
m_LayersColors[dst] = COLOR4D( default_items_color[src] );
}
setupConfigParams();
}
COLOR4D COLORS_DESIGN_SETTINGS::GetDefaultLayerColor( LAYER_NUM aLayer )
{
if( (unsigned) aLayer < arrayDim( default_layer_color ) )
return COLOR4D( default_layer_color[aLayer] );
return COLOR4D::UNSPECIFIED;
}
COLOR4D COLORS_DESIGN_SETTINGS::GetLayerColor( LAYER_NUM aLayer ) const
{
if( (unsigned) aLayer < arrayDim( m_LayersColors ) )
return m_LayersColors[aLayer];
return COLOR4D::UNSPECIFIED;
}
void COLORS_DESIGN_SETTINGS::SetLayerColor( LAYER_NUM aLayer, COLOR4D aColor )
{
if( (unsigned) aLayer < arrayDim( m_LayersColors ) )
m_LayersColors[aLayer] = aColor;
}
COLOR4D COLORS_DESIGN_SETTINGS::GetDefaultItemColor( int aItemIdx )
{
unsigned int idx = (unsigned) aItemIdx - LAYER_VIAS;
if( idx < arrayDim( default_items_color ) )
return COLOR4D( default_items_color[idx] );
return COLOR4D::UNSPECIFIED;
}
COLOR4D COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx ) const
{
if( (unsigned) aItemIdx < arrayDim( m_LayersColors ) )
return m_LayersColors[aItemIdx];
return COLOR4D::UNSPECIFIED;
}
void COLORS_DESIGN_SETTINGS::SetItemColor( int aItemIdx, COLOR4D aColor )
{
if( (unsigned) aItemIdx < arrayDim( m_LayersColors ) )
m_LayersColors[aItemIdx] = aColor;
}
void COLORS_DESIGN_SETTINGS::SetAllColorsAs( COLOR4D aColor )
{
for( unsigned ii = 0; ii < arrayDim(m_LayersColors); ii++ )
m_LayersColors[ii] = aColor;
}
#define LOC_COLOR(layer) &m_LayersColors[layer]
#define ITEM_COLOR(item_visible) &m_LayersColors[item_visible]
void COLORS_DESIGN_SETTINGS::setupConfigParams()
{
wxASSERT( arrayDim( m_LayersColors ) >= PCB_LAYER_ID_COUNT );
wxString currprefix = GetConfigPrefix();
switch( m_frameType )
{
case FRAME_GERBER:
case FRAME_PCB_EDITOR: /* no prefix */ break;
case FRAME_CVPCB_DISPLAY:
case FRAME_FOOTPRINT_VIEWER:
case FRAME_FOOTPRINT_VIEWER_MODAL:
case FRAME_FOOTPRINT_WIZARD:
case FRAME_FOOTPRINT_PREVIEW:
case FRAME_FOOTPRINT_EDITOR: SetConfigPrefix( "ModEdit" ); break;
case FRAME_PCB_DISPLAY3D: SetConfigPrefix( "fp3d_" ); break;
default: break;
}
wxString fmt( "Color4DPCBLayer_%s" );
for( int i = 0; i < PCB_LAYER_ID_COUNT; ++i )
{
wxString cfgkey = wxString::Format( fmt, LSET::Name( PCB_LAYER_ID( i ) ) );
Add( cfgkey, LOC_COLOR(i), m_LayersColors[i] );
}
Add( "Color4DTxtFrontEx", ITEM_COLOR( LAYER_MOD_TEXT_FR ), LIGHTGRAY );
Add( "Color4DTxtBackEx", ITEM_COLOR( LAYER_MOD_TEXT_BK ), BLUE );
Add( "Color4DTxtInvisEx", ITEM_COLOR( LAYER_MOD_TEXT_INVISIBLE ), DARKGRAY );
Add( "Color4DPadBackEx", ITEM_COLOR( LAYER_PAD_BK ), GREEN );
Add( "Color4DAnchorEx", ITEM_COLOR( LAYER_ANCHOR ), BLUE );
Add( "Color4DPadFrontEx", ITEM_COLOR( LAYER_PAD_FR ), RED );
Add( "Color4DPadThruHoleEx", ITEM_COLOR( LAYER_PADS_TH ), YELLOW );
Add( "Color4DNonPlatedEx", ITEM_COLOR( LAYER_NON_PLATEDHOLES ), YELLOW );
Add( "Color4DPCBBackground", ITEM_COLOR( LAYER_PCB_BACKGROUND ), BLACK );
Add( "Color4DPCBCursor", ITEM_COLOR( LAYER_CURSOR ), WHITE );
Add( "Color4DAuxItems", ITEM_COLOR( LAYER_AUX_ITEMS ), WHITE );
Add( "Color4DWorksheet", ITEM_COLOR( LAYER_WORKSHEET ), DARKRED );
Add( "Color4DGrid", ITEM_COLOR( LAYER_GRID ), DARKGRAY );
// Add prms only relevant in board editor
if( m_frameType == FRAME_PCB_EDITOR )
{
Add( "Color4DViaThruEx", ITEM_COLOR( LAYER_VIA_THROUGH ), LIGHTGRAY );
Add( "Color4DViaBBlindEx", ITEM_COLOR( LAYER_VIA_BBLIND ), BROWN );
Add( "Color4DViaMicroEx", ITEM_COLOR( LAYER_VIA_MICROVIA ), CYAN );
Add( "Color4DRatsEx", ITEM_COLOR( LAYER_RATSNEST ), WHITE );
Add( "Color4DNoNetPadMarker", ITEM_COLOR( LAYER_NO_CONNECTS ), BLUE );
}
SetConfigPrefix( currprefix );
}
void COLORS_DESIGN_SETTINGS::Load( wxConfigBase *aConfig )
{
SETTINGS::Load(aConfig);
}
void COLORS_DESIGN_SETTINGS::Save( wxConfigBase *aConfig )
{
SETTINGS::Save(aConfig);
}

View File

@ -563,9 +563,9 @@ bool EnsureFileDirectoryExists( wxFileName* aTargetFullFileName,
if( aReporter )
{
msg.Printf( _( "Cannot make path \"%s\" absolute with respect to \"%s\"." ),
GetChars( aTargetFullFileName->GetPath() ),
GetChars( baseFilePath ) );
aReporter->Report( msg, REPORTER::RPT_ERROR );
aTargetFullFileName->GetPath(),
baseFilePath );
aReporter->Report( msg, SEVERITY_ERROR );
}
return false;
@ -580,8 +580,8 @@ bool EnsureFileDirectoryExists( wxFileName* aTargetFullFileName,
{
if( aReporter )
{
msg.Printf( _( "Output directory \"%s\" created.\n" ), GetChars( outputPath ) );
aReporter->Report( msg, REPORTER::RPT_INFO );
msg.Printf( _( "Output directory \"%s\" created.\n" ), outputPath );
aReporter->Report( msg, SEVERITY_INFO );
return true;
}
}
@ -589,9 +589,8 @@ bool EnsureFileDirectoryExists( wxFileName* aTargetFullFileName,
{
if( aReporter )
{
msg.Printf( _( "Cannot create output directory \"%s\".\n" ),
GetChars( outputPath ) );
aReporter->Report( msg, REPORTER::RPT_ERROR );
msg.Printf( _( "Cannot create output directory \"%s\".\n" ), outputPath );
aReporter->Report( msg, SEVERITY_ERROR );
}
return false;

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-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
@ -33,7 +33,6 @@
#include <wx/debug.h> // for wxASSERT
#include <wx/wx.h> // for wxString, operator!=, operator==
void wxConfigLoadParams( wxConfigBase* aCfg, const std::vector<PARAM_CFG*>& aList,
const wxString& aGroup )
{
@ -446,6 +445,63 @@ void PARAM_CFG_WXSTRING::SaveParam( wxConfigBase* aConfig ) const
}
PARAM_CFG_WXSTRING_SET::PARAM_CFG_WXSTRING_SET( const wxString& ident, std::set<wxString>* ptparam,
const wxChar* group ) :
PARAM_CFG( ident, PARAM_WXSTRING_SET, group )
{
m_Pt_param = ptparam;
}
PARAM_CFG_WXSTRING_SET::PARAM_CFG_WXSTRING_SET( bool Insetup, const wxString& ident,
std::set<wxString>* ptparam, const wxChar* group ) :
PARAM_CFG( ident, PARAM_WXSTRING, group )
{
m_Pt_param = ptparam;
m_Setup = Insetup;
}
void PARAM_CFG_WXSTRING_SET::ReadParam( wxConfigBase* aConfig ) const
{
if( !m_Pt_param || !aConfig )
return;
for( int i = 1; true; ++i )
{
wxString key, data;
key = m_Ident;
key << i;
data = aConfig->Read( key, wxT( "" ) );
if( data.IsEmpty() )
break;
m_Pt_param->insert( data );
}
}
void PARAM_CFG_WXSTRING_SET::SaveParam( wxConfigBase* aConfig ) const
{
if( !m_Pt_param || !aConfig )
return;
int i = 1;
for( const wxString& str : *m_Pt_param )
{
wxString key, data;
key = m_Ident;
key << i++;
aConfig->Write( key, str );
}
}
PARAM_CFG_FILENAME::PARAM_CFG_FILENAME( const wxString& ident,
wxString* ptparam,
const wxChar* group ) :

View File

@ -263,7 +263,7 @@ void DIALOG_PAGES_SETTINGS::OnOkClick( wxCommandEvent& event )
m_screen->SetModify();
if( LocalPrjConfigChanged() )
m_parent->SaveProjectSettings( false );
m_parent->SaveProjectSettings();
// Call the post processing (if any) after changes
m_parent->OnPageSettingsChange();

View File

@ -34,7 +34,7 @@ WX_HTML_REPORT_PANEL::WX_HTML_REPORT_PANEL( wxWindow* parent,
long style ) :
WX_HTML_REPORT_PANEL_BASE( parent, id, pos, size, style ),
m_reporter( this ),
m_severities( REPORTER::RPT_ALL ),
m_severities( -1 ),
m_lazyUpdate( false )
{
syncCheckboxes();
@ -63,7 +63,7 @@ REPORTER& WX_HTML_REPORT_PANEL::Reporter()
}
void WX_HTML_REPORT_PANEL::Report( const wxString& aText, REPORTER::SEVERITY aSeverity,
void WX_HTML_REPORT_PANEL::Report( const wxString& aText, SEVERITY aSeverity,
REPORTER::LOCATION aLocation )
{
REPORT_LINE line;
@ -130,80 +130,13 @@ void WX_HTML_REPORT_PANEL::scrollToBottom()
}
#define BADGE_SIZE 20
#define BADGE_FONT_SIZE 10
static wxBitmap makeBadge( REPORTER::SEVERITY aStyle, int aCount, wxWindow* aWindow )
{
wxSize size( BADGE_SIZE, BADGE_SIZE );
wxBitmap bitmap( size );
wxBrush brush;
wxMemoryDC badgeDC;
wxColour badgeColour;
wxColour textColour;
int fontSize = BADGE_FONT_SIZE;
if( aCount > 99 )
fontSize--;
badgeDC.SelectObject( bitmap );
brush.SetStyle( wxBRUSHSTYLE_SOLID );
// We're one level deep in staticBoxes; each level is darkened by 210
brush.SetColour( aWindow->GetParent()->GetBackgroundColour().MakeDisabled( 210 ) );
badgeDC.SetBackground( brush );
badgeDC.Clear();
if( aCount == 0 )
return bitmap;
switch( aStyle )
{
case REPORTER::RPT_ERROR:
badgeColour = *wxRED;
textColour = *wxWHITE;
break;
case REPORTER::RPT_WARNING:
badgeColour = wxColour( 235, 120, 80 ); // Orange
textColour = *wxWHITE;
break;
case REPORTER::RPT_ACTION:
badgeColour = *wxGREEN;
textColour = *wxWHITE;
break;
case REPORTER::RPT_INFO:
default:
badgeColour = *wxLIGHT_GREY;
textColour = *wxBLACK;
break;
}
brush.SetStyle( wxBRUSHSTYLE_SOLID );
brush.SetColour( badgeColour );
badgeDC.SetBrush( brush );
badgeDC.SetPen( wxPen( badgeColour, 0 ) );
badgeDC.DrawCircle( size.x / 2 - 1, size.y / 2, ( std::max( size.x, size.y ) / 2 ) - 1 );
wxFont font( fontSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD );
badgeDC.SetFont( font );
wxString text = wxString::Format( wxT( "%d" ), aCount );
wxSize textExtent = badgeDC.GetTextExtent( text );
badgeDC.SetTextForeground( textColour );
badgeDC.DrawText( text, size.x / 2 - textExtent.x / 2 - 1, size.y / 2 - textExtent.y / 2 );
return bitmap;
}
void WX_HTML_REPORT_PANEL::updateBadges()
{
int count = Count( REPORTER::RPT_ERROR );
m_errorsBadge->SetBitmap( makeBadge( REPORTER::RPT_ERROR, count, m_errorsBadge ) );
int count = Count( SEVERITY_ERROR );
m_errorsBadge->SetBitmap( MakeBadge( SEVERITY_ERROR, count, m_errorsBadge, 2 ) );
count = Count( REPORTER::RPT_WARNING );
m_warningsBadge->SetBitmap( makeBadge( REPORTER::RPT_WARNING, count, m_warningsBadge ) );
count = Count( SEVERITY_WARNING );
m_warningsBadge->SetBitmap( MakeBadge( SEVERITY_WARNING, count, m_warningsBadge, 2 ) );
}
@ -240,19 +173,19 @@ wxString WX_HTML_REPORT_PANEL::generateHtml( const REPORT_LINE& aLine )
switch( aLine.severity )
{
case REPORTER::RPT_ERROR:
case SEVERITY_ERROR:
retv = "<font color=\"red\" size=2><b>" + _( "Error: " ) + "</b></font><font size=2>" +
aLine.message + "</font><br>";
break;
case REPORTER::RPT_WARNING:
case SEVERITY_WARNING:
retv = "<font color=\"orange\" size=2><b>" + _( "Warning: " ) +
"</b></font><font size=2>" + aLine.message + "</font><br>";
break;
case REPORTER::RPT_INFO:
case SEVERITY_INFO:
retv = "<font color=\"dark gray\" size=2><b>" + _( "Info: " ) + "</b>" + aLine.message +
"</font><br>";
break;
case REPORTER::RPT_ACTION:
case SEVERITY_ACTION:
retv = "<font color=\"dark green\" size=2>" + aLine.message + "</font><br>";
break;
default:
@ -267,11 +200,11 @@ wxString WX_HTML_REPORT_PANEL::generatePlainText( const REPORT_LINE& aLine )
{
switch( aLine.severity )
{
case REPORTER::RPT_ERROR:
case SEVERITY_ERROR:
return _( "Error: " ) + aLine.message + wxT( "\n" );
case REPORTER::RPT_WARNING:
case SEVERITY_WARNING:
return _( "Warning: " ) + aLine.message + wxT( "\n" );
case REPORTER::RPT_INFO:
case SEVERITY_INFO:
return _( "Info: " ) + aLine.message + wxT( "\n" );
default:
return aLine.message + wxT( "\n" );
@ -303,12 +236,16 @@ void WX_HTML_REPORT_PANEL::onMenuEvent( wxMenuEvent& event )
}
// Don't globally define this; different facilities use different definitions of "ALL"
static int SEVERITY_ALL = SEVERITY_WARNING | SEVERITY_ERROR | SEVERITY_INFO | SEVERITY_ACTION;
void WX_HTML_REPORT_PANEL::onCheckBoxShowAll( wxCommandEvent& event )
{
if( event.IsChecked() )
m_severities = REPORTER::RPT_ALL;
m_severities = SEVERITY_ALL;
else
m_severities = 0;
m_severities = SEVERITY_ERROR;
syncCheckboxes();
Flush( true );
@ -317,20 +254,20 @@ void WX_HTML_REPORT_PANEL::onCheckBoxShowAll( wxCommandEvent& event )
void WX_HTML_REPORT_PANEL::syncCheckboxes()
{
m_checkBoxShowAll->SetValue( m_severities == REPORTER::RPT_ALL );
m_checkBoxShowWarnings->SetValue( m_severities & REPORTER::RPT_WARNING );
m_checkBoxShowErrors->SetValue( m_severities & REPORTER::RPT_ERROR );
m_checkBoxShowInfos->SetValue( m_severities & REPORTER::RPT_INFO );
m_checkBoxShowActions->SetValue( m_severities & REPORTER::RPT_ACTION );
m_checkBoxShowAll->SetValue( m_severities == SEVERITY_ALL );
m_checkBoxShowWarnings->SetValue( m_severities & SEVERITY_WARNING );
m_checkBoxShowErrors->SetValue( m_severities & SEVERITY_ERROR );
m_checkBoxShowInfos->SetValue( m_severities & SEVERITY_INFO );
m_checkBoxShowActions->SetValue( m_severities & SEVERITY_ACTION );
}
void WX_HTML_REPORT_PANEL::onCheckBoxShowWarnings( wxCommandEvent& event )
{
if( event.IsChecked() )
m_severities |= REPORTER::RPT_WARNING;
m_severities |= SEVERITY_WARNING;
else
m_severities &= ~REPORTER::RPT_WARNING;
m_severities &= ~SEVERITY_WARNING;
syncCheckboxes();
Flush( true );
@ -340,9 +277,9 @@ void WX_HTML_REPORT_PANEL::onCheckBoxShowWarnings( wxCommandEvent& event )
void WX_HTML_REPORT_PANEL::onCheckBoxShowErrors( wxCommandEvent& event )
{
if( event.IsChecked() )
m_severities |= REPORTER::RPT_ERROR;
m_severities |= SEVERITY_ERROR;
else
m_severities &= ~REPORTER::RPT_ERROR;
m_severities &= ~SEVERITY_ERROR;
syncCheckboxes();
Flush( true );
@ -352,9 +289,9 @@ void WX_HTML_REPORT_PANEL::onCheckBoxShowErrors( wxCommandEvent& event )
void WX_HTML_REPORT_PANEL::onCheckBoxShowInfos( wxCommandEvent& event )
{
if( event.IsChecked() )
m_severities |= REPORTER::RPT_INFO;
m_severities |= SEVERITY_INFO;
else
m_severities &= ~REPORTER::RPT_INFO;
m_severities &= ~SEVERITY_INFO;
syncCheckboxes();
Flush( true );
@ -364,9 +301,9 @@ void WX_HTML_REPORT_PANEL::onCheckBoxShowInfos( wxCommandEvent& event )
void WX_HTML_REPORT_PANEL::onCheckBoxShowActions( wxCommandEvent& event )
{
if( event.IsChecked() )
m_severities |= REPORTER::RPT_ACTION;
m_severities |= SEVERITY_ACTION;
else
m_severities &= ~REPORTER::RPT_ACTION;
m_severities &= ~SEVERITY_ACTION;
syncCheckboxes();
Flush( true );
@ -426,7 +363,7 @@ void WX_HTML_REPORT_PANEL::SetLabel( const wxString& aLabel )
void WX_HTML_REPORT_PANEL::SetVisibleSeverities( int aSeverities )
{
if( aSeverities < 0 )
m_severities = REPORTER::RPT_ALL;
m_severities = SEVERITY_ALL;
else
m_severities = aSeverities;

View File

@ -58,7 +58,7 @@ public:
* @param aSeverity string classification level bitfield
* @param aLocation REPORTER::LOCATION enum for placement of message
*/
void Report( const wxString& aText, REPORTER::SEVERITY aSeverity,
void Report( const wxString& aText, SEVERITY aSeverity,
REPORTER::LOCATION aLocation = REPORTER::LOC_BODY );
///> clears the report panel
@ -90,7 +90,7 @@ public:
private:
struct REPORT_LINE
{
REPORTER::SEVERITY severity;
SEVERITY severity;
wxString message;
};

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -9,7 +9,7 @@
///////////////////////////////////////////////////////////////////////////
WX_HTML_REPORT_PANEL_BASE::WX_HTML_REPORT_PANEL_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
WX_HTML_REPORT_PANEL_BASE::WX_HTML_REPORT_PANEL_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
{
m_box = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Output Messages") ), wxVERTICAL );
@ -37,7 +37,7 @@ WX_HTML_REPORT_PANEL_BASE::WX_HTML_REPORT_PANEL_BASE( wxWindow* parent, wxWindow
bSizerBottom->Add( m_checkBoxShowAll, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
bSizerBottom->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 );
bSizerBottom->Add( 20, 0, 0, wxEXPAND, 5 );
m_checkBoxShowErrors = new wxCheckBox( m_box->GetStaticBox(), wxID_ANY, _("Errors"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerBottom->Add( m_checkBoxShowErrors, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,11 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __WX_HTML_REPORT_PANEL_BASE_H__
#define __WX_HTML_REPORT_PANEL_BASE_H__
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
@ -64,9 +63,8 @@ class WX_HTML_REPORT_PANEL_BASE : public wxPanel
public:
WX_HTML_REPORT_PANEL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 567,228 ), long style = wxTAB_TRAVERSAL );
WX_HTML_REPORT_PANEL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 567,228 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~WX_HTML_REPORT_PANEL_BASE();
};
#endif //__WX_HTML_REPORT_PANEL_BASE_H__

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018-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
@ -65,8 +65,8 @@ const unsigned CORNERS_COUNT = arrayDim( MarkerShapeCorners );
void MARKER_BASE::init()
{
m_MarkerType = MARKER_UNSPEC;
m_Excluded = false;
m_ErrorLevel = MARKER_SEVERITY_UNSPEC;
m_Color = RED;
const VECTOR2I* point_shape = GetShapePolygon();
wxPoint start( point_shape->x, point_shape->y );
wxPoint end = start;
@ -90,7 +90,6 @@ MARKER_BASE::MARKER_BASE( const MARKER_BASE& aMarker )
m_Pos = aMarker.m_Pos;
m_ErrorLevel = aMarker.m_ErrorLevel;
m_MarkerType = aMarker.m_MarkerType;
m_Color = aMarker.m_Color;
m_ShapeBoundingBox = aMarker.m_ShapeBoundingBox;
m_ScalingFactor = aMarker.m_ScalingFactor;
}
@ -104,8 +103,8 @@ MARKER_BASE::MARKER_BASE( int aScalingFactor )
MARKER_BASE::MARKER_BASE( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos,
EDA_ITEM* aItem, const wxPoint& aPos, EDA_ITEM* bItem, const wxPoint& bPos,
int aScalingFactor )
EDA_ITEM* aItem, const wxPoint& aPos,
EDA_ITEM* bItem, const wxPoint& bPos, int aScalingFactor )
{
m_ScalingFactor = aScalingFactor;
init();
@ -114,6 +113,17 @@ MARKER_BASE::MARKER_BASE( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMark
}
MARKER_BASE::MARKER_BASE( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos,
EDA_ITEM* aItem,
EDA_ITEM* bItem, int aScalingFactor )
{
m_ScalingFactor = aScalingFactor;
init();
SetData( aUnits, aErrorCode, aMarkerPos, aItem, bItem );
}
MARKER_BASE::MARKER_BASE( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText, const wxPoint& aPos,
const wxString& bText, const wxPoint& bPos, int aScalingFactor )
@ -126,12 +136,24 @@ MARKER_BASE::MARKER_BASE( int aErrorCode, const wxPoint& aMarkerPos,
MARKER_BASE::MARKER_BASE( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText, const wxPoint& aPos, int aScalingFactor )
const wxString& aText,
const wxString& bText, int aScalingFactor )
{
m_ScalingFactor = aScalingFactor;
init();
SetData( aErrorCode, aMarkerPos, aText, aPos );
SetData( aErrorCode, aMarkerPos, aText, bText );
}
MARKER_BASE::MARKER_BASE( int aErrorCode,
const wxString& aText,
const wxString& bText, int aScalingFactor )
{
m_ScalingFactor = aScalingFactor;
init();
SetData( aErrorCode, wxPoint(), aText, bText );
}
@ -141,7 +163,8 @@ MARKER_BASE::~MARKER_BASE()
void MARKER_BASE::SetData( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos,
EDA_ITEM* aItem, const wxPoint& aPos, EDA_ITEM* bItem, const wxPoint& bPos )
EDA_ITEM* aItem, const wxPoint& aPos,
EDA_ITEM* bItem, const wxPoint& bPos )
{
m_Pos = aMarkerPos;
m_drc.SetData( aUnits, aErrorCode, aItem, aPos, bItem, bPos );
@ -159,6 +182,36 @@ void MARKER_BASE::SetData( int aErrorCode, const wxPoint& aMarkerPos,
}
void MARKER_BASE::SetData( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos,
EDA_ITEM* aItem,
EDA_ITEM* bItem )
{
m_Pos = aMarkerPos;
m_drc.SetData( aUnits, aErrorCode, aItem, bItem );
m_drc.SetParent( this );
}
void MARKER_BASE::SetData( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText,
const wxString& bText )
{
m_Pos = aMarkerPos;
m_drc.SetData( aErrorCode, aText, bText );
m_drc.SetParent( this );
}
void MARKER_BASE::SetData( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText, const KIID& aID,
const wxString& bText, const KIID& bID )
{
m_Pos = aMarkerPos;
m_drc.SetData( aErrorCode, aText, aID, bText, bID );
m_drc.SetParent( this );
}
bool MARKER_BASE::HitTestMarker( const wxPoint& aHitPosition, int aAccuracy ) const
{
EDA_RECT bbox = GetBoundingBoxMarker();
@ -252,5 +305,5 @@ void MARKER_BASE::PrintMarker( wxDC* aDC, const wxPoint& aOffset )
for( int ii = 0; ii < ccount; ii++ )
shape[ii] += m_Pos + aOffset;
GRClosedPoly( nullptr, aDC, ccount, &shape[0], true, 0, m_Color, m_Color );
GRClosedPoly( nullptr, aDC, ccount, &shape[0], true, 0, getColor(), getColor() );
}

View File

@ -29,14 +29,14 @@
#include <reporter.h>
#include <wx_html_report_panel.h>
REPORTER& REPORTER::Report( const char* aText, REPORTER::SEVERITY aSeverity )
REPORTER& REPORTER::Report( const char* aText, SEVERITY aSeverity )
{
Report( FROM_UTF8( aText ) );
return *this;
}
REPORTER& WX_TEXT_CTRL_REPORTER::Report( const wxString& aText, REPORTER::SEVERITY aSeverity )
REPORTER& WX_TEXT_CTRL_REPORTER::Report( const wxString& aText, SEVERITY aSeverity )
{
wxCHECK_MSG( m_textCtrl != NULL, *this,
wxT( "No wxTextCtrl object defined in WX_TEXT_CTRL_REPORTER." ) );
@ -50,7 +50,7 @@ bool WX_TEXT_CTRL_REPORTER::HasMessage() const
return !m_textCtrl->IsEmpty();
}
REPORTER& WX_STRING_REPORTER::Report( const wxString& aText, REPORTER::SEVERITY aSeverity )
REPORTER& WX_STRING_REPORTER::Report( const wxString& aText, SEVERITY aSeverity )
{
wxCHECK_MSG( m_string != NULL, *this,
wxT( "No wxString object defined in WX_STRING_REPORTER." ) );
@ -93,7 +93,7 @@ REPORTER& WX_HTML_PANEL_REPORTER::ReportHead( const wxString& aText, SEVERITY aS
bool WX_HTML_PANEL_REPORTER::HasMessage() const
{
return m_panel->Count( REPORTER::RPT_ERROR | REPORTER::RPT_WARNING ) > 0;
return m_panel->Count( SEVERITY_ERROR | SEVERITY_WARNING ) > 0;
}
REPORTER& NULL_REPORTER::Report( const wxString& aText, SEVERITY aSeverity )
@ -106,9 +106,7 @@ REPORTER& NULL_REPORTER::GetInstance()
static REPORTER* s_nullReporter = NULL;
if( !s_nullReporter )
{
s_nullReporter = new NULL_REPORTER();
}
return *s_nullReporter;
}
@ -118,11 +116,11 @@ REPORTER& STDOUT_REPORTER::Report( const wxString& aText, SEVERITY aSeverity )
{
switch( aSeverity )
{
case RPT_UNDEFINED: std::cout << "RPT_UNDEFINED: "; break;
case RPT_INFO: std::cout << "RPT_INFO: "; break;
case RPT_WARNING: std::cout << "RPT_WARNING: "; break;
case RPT_ERROR: std::cout << "RPT_ERROR: "; break;
case RPT_ACTION: std::cout << "RPT_ACTION: "; break;
case SEVERITY_UNDEFINED: std::cout << "SEVERITY_UNDEFINED: "; break;
case SEVERITY_INFO: std::cout << "SEVERITY_INFO: "; break;
case SEVERITY_WARNING: std::cout << "SEVERITY_WARNING: "; break;
case SEVERITY_ERROR: std::cout << "SEVERITY_ERROR: "; break;
case SEVERITY_ACTION: std::cout << "SEVERITY_ACTION: "; break;
}
std::cout << aText << std::endl;
@ -136,9 +134,7 @@ REPORTER& STDOUT_REPORTER::GetInstance()
static REPORTER* s_stdoutReporter = nullptr;
if( !s_stdoutReporter )
{
s_stdoutReporter = new STDOUT_REPORTER();
}
return *s_stdoutReporter;
}

View File

@ -56,7 +56,7 @@ COLOR_SETTINGS::COLOR_SETTINGS( std::string aFilename ) :
// TODO(JE) in actual usage, how long does the default palette need to be?
m_params.emplace_back( new PARAM_LIST<COLOR4D>( "palette", &m_Palette, default_palette ) );
#define CLR( x, y, z ) m_params.emplace_back( new COLOR_MAP_PARAM( x, y, z, &m_colors ) );
#define CLR( x, y, z ) m_params.emplace_back( new COLOR_MAP_PARAM( x, y, z, &m_colors ) )
CLR( "schematic.background", LAYER_SCHEMATIC_BACKGROUND, COLOR4D( WHITE ) );
CLR( "schematic.brightened", LAYER_BRIGHTENED, COLOR4D( PUREMAGENTA ) );
@ -113,7 +113,8 @@ COLOR_SETTINGS::COLOR_SETTINGS( std::string aFilename ) :
CLR( "board.aux_items", LAYER_AUX_ITEMS, COLOR4D( WHITE ) );
CLR( "board.background", LAYER_PCB_BACKGROUND, COLOR4D( BLACK ) );
CLR( "board.cursor", LAYER_CURSOR, COLOR4D( WHITE ) );
CLR( "board.drc", LAYER_DRC, COLOR4D( LIGHTGRAY ) );
CLR( "board.drc_error", LAYER_DRC_ERROR, COLOR4D( PURERED ) );
CLR( "board.drc_warning", LAYER_DRC_WARNING, COLOR4D( PUREYELLOW ) );
CLR( "board.footprint_text_back", LAYER_MOD_TEXT_BK, COLOR4D( BLUE ) );
CLR( "board.footprint_text_front", LAYER_MOD_TEXT_FR, COLOR4D( LIGHTGRAY ) );
CLR( "board.footprint_text_invisible", LAYER_MOD_TEXT_INVISIBLE, COLOR4D( LIGHTGRAY ) );
@ -203,7 +204,8 @@ COLOR_SETTINGS::COLOR_SETTINGS( std::string aFilename ) :
CLR( "fpedit.aux_items", FL + LAYER_AUX_ITEMS, COLOR4D( WHITE ) );
CLR( "fpedit.background", FL + LAYER_PCB_BACKGROUND, COLOR4D( BLACK ) );
CLR( "fpedit.cursor", FL + LAYER_CURSOR, COLOR4D( WHITE ) );
CLR( "fpedit.drc", FL + LAYER_DRC, COLOR4D( LIGHTGRAY ) );
CLR( "fpedit.drc_error", FL + LAYER_DRC_ERROR, COLOR4D( PURERED ) );
CLR( "fpedit.drc_warning", FL + LAYER_DRC_WARNING, COLOR4D( PUREYELLOW ) );
CLR( "fpedit.footprint_text_back", FL + LAYER_MOD_TEXT_BK, COLOR4D( BLUE ) );
CLR( "fpedit.footprint_text_front", FL + LAYER_MOD_TEXT_FR, COLOR4D( LIGHTGRAY ) );
CLR( "fpedit.footprint_text_invisible", FL + LAYER_MOD_TEXT_INVISIBLE, COLOR4D( LIGHTGRAY ) );
@ -302,7 +304,9 @@ COLOR4D COLOR_SETTINGS::GetColor( int aLayer ) const
{
if( m_color_context == COLOR_CONTEXT::FOOTPRINT && aLayer >= PCBNEW_LAYER_ID_START
&& aLayer <= GAL_LAYER_ID_END )
{
aLayer += FPEDIT_LAYER_ID_START;
}
return m_colors.at( aLayer );
}
@ -319,7 +323,9 @@ COLOR4D COLOR_SETTINGS::GetDefaultColor( int aLayer )
{
if( m_color_context == COLOR_CONTEXT::FOOTPRINT && aLayer >= PCBNEW_LAYER_ID_START
&& aLayer <= GAL_LAYER_ID_END )
{
aLayer += FPEDIT_LAYER_ID_START;
}
COLOR_MAP_PARAM* p = nullptr;

View File

@ -17,6 +17,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <wx/wx.h>
#include <widgets/ui_common.h>
@ -25,3 +26,80 @@ int KIUI::GetStdMargin()
// This is the value used in (most) wxFB dialogs
return 5;
}
#define BADGE_SIZE 20
#define BADGE_FONT_SIZE 10
wxBitmap MakeBadge( SEVERITY aStyle, int aCount, wxWindow* aWindow, int aDepth )
{
wxSize size( BADGE_SIZE, BADGE_SIZE );
wxBitmap bitmap( size );
wxBrush brush;
wxMemoryDC badgeDC;
wxColour badgeColour;
wxColour textColour;
wxColour backColour;
int fontSize = BADGE_FONT_SIZE;
if( aCount > 99 )
fontSize--;
badgeDC.SelectObject( bitmap );
brush.SetStyle( wxBRUSHSTYLE_SOLID );
backColour = aWindow->GetParent()->GetBackgroundColour();
// Each level inside staticBoxes is darkened by 210
for( int i = 1; i < aDepth; ++i )
backColour = backColour.MakeDisabled( 210 );
brush.SetColour( backColour );
badgeDC.SetBackground( brush );
badgeDC.Clear();
if( aCount == 0 )
return bitmap;
switch( aStyle )
{
case SEVERITY_ERROR:
badgeColour = *wxRED;
textColour = *wxWHITE;
break;
case SEVERITY_WARNING:
badgeColour = *wxYELLOW;
textColour = *wxBLACK;
break;
case SEVERITY_ACTION:
badgeColour = *wxGREEN;
textColour = *wxWHITE;
break;
case SEVERITY_EXCLUSION:
case SEVERITY_INFO:
default:
badgeColour = *wxLIGHT_GREY;
textColour = *wxBLACK;
break;
}
brush.SetStyle( wxBRUSHSTYLE_SOLID );
brush.SetColour( badgeColour );
badgeDC.SetBrush( brush );
badgeDC.SetPen( wxPen( badgeColour, 0 ) );
badgeDC.DrawCircle( size.x / 2 - 1, size.y / 2, ( std::max( size.x, size.y ) / 2 ) - 1 );
wxFont font( fontSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD );
badgeDC.SetFont( font );
wxString text = wxString::Format( wxT( "%d" ), aCount );
wxSize textExtent = badgeDC.GetTextExtent( text );
badgeDC.SetTextForeground( textColour );
badgeDC.DrawText( text, size.x / 2 - textExtent.x / 2 - 1, size.y / 2 - textExtent.y / 2 );
return bitmap;
}

View File

@ -114,7 +114,7 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic,
{
wxString msg;
msg.Printf( _( "%d duplicate time stamps were found and replaced." ), count );
aReporter.ReportTail( msg, REPORTER::RPT_WARNING );
aReporter.ReportTail( msg, SEVERITY_WARNING );
}
}
@ -221,12 +221,12 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic,
newRef );
}
aReporter.Report( msg, REPORTER::RPT_ACTION );
aReporter.Report( msg, SEVERITY_ACTION );
}
// Final control (just in case ... ).
if( !CheckAnnotate( aReporter, !aAnnotateSchematic ) )
aReporter.ReportTail( _( "Annotation complete." ), REPORTER::RPT_ACTION );
aReporter.ReportTail( _( "Annotation complete." ), SEVERITY_ACTION );
// Update on screen references, that can be modified by previous calculations:
g_CurrentSheet->UpdateAllScreenReferences();

View File

@ -525,7 +525,7 @@ int SCH_REFERENCE_LIST::CheckAnnotation( REPORTER& aReporter )
tmp );
}
aReporter.Report( msg, REPORTER::RPT_WARNING );
aReporter.Report( msg, SEVERITY_WARNING );
error++;
break;
}
@ -547,7 +547,7 @@ int SCH_REFERENCE_LIST::CheckAnnotation( REPORTER& aReporter )
flatList[ii].m_Unit,
flatList[ii].GetLibPart()->GetUnitCount() );
aReporter.Report( msg, REPORTER::RPT_ERROR );
aReporter.Report( msg, SEVERITY_ERROR );
error++;
break;
}
@ -591,7 +591,7 @@ int SCH_REFERENCE_LIST::CheckAnnotation( REPORTER& aReporter )
tmp );
}
aReporter.Report( msg, REPORTER::RPT_ERROR );
aReporter.Report( msg, SEVERITY_ERROR );
error++;
continue;
}
@ -621,7 +621,7 @@ int SCH_REFERENCE_LIST::CheckAnnotation( REPORTER& aReporter )
tmp );
}
aReporter.Report( msg, REPORTER::RPT_ERROR );
aReporter.Report( msg, SEVERITY_ERROR );
error++;
}
@ -640,7 +640,7 @@ int SCH_REFERENCE_LIST::CheckAnnotation( REPORTER& aReporter )
LIB_PART::SubReference( flatList[next].m_Unit ),
flatList[next].m_Value->GetText() );
aReporter.Report( msg, REPORTER::RPT_ERROR );
aReporter.Report( msg, SEVERITY_ERROR );
error++;
}
}

View File

@ -100,7 +100,7 @@ DIALOG_ERC::~DIALOG_ERC()
if( m_settings != m_parent->GetErcSettings() )
{
m_parent->UpdateErcSettings( m_settings );
m_parent->SaveProjectSettings( false );
m_parent->SaveProjectSettings();
}
}
@ -489,7 +489,7 @@ void DIALOG_ERC::TestErc( REPORTER& aReporter )
if( m_parent->CheckAnnotate( aReporter, false ) )
{
if( aReporter.HasMessage() )
aReporter.ReportTail( _( "Annotation required!" ), REPORTER::RPT_ERROR );
aReporter.ReportTail( _( "Annotation required!" ), SEVERITY_ERROR );
return;
}
@ -622,7 +622,7 @@ void DIALOG_ERC::TestErc( REPORTER& aReporter )
m_parent->GetCanvas()->Refresh();
// Display message
aReporter.ReportTail( _( "Finished" ), REPORTER::RPT_INFO );
aReporter.ReportTail( _( "Finished" ), SEVERITY_INFO );
if( m_settings.write_erc_file )
{

View File

@ -711,7 +711,7 @@ int InvokeDialogNetList( SCH_EDIT_FRAME* aCaller )
aCaller->SetNetListFormatName( dlg.m_DefaultNetFmtName ); // can have temporary changed
if( curr_default_netformat != dlg.m_DefaultNetFmtName )
aCaller->SaveProjectSettings( false );
aCaller->SaveProjectSettings();
return ret;
}

View File

@ -50,7 +50,7 @@ void SCH_EDIT_FRAME::PlotSchematic()
// save project config if the prj config has changed:
if( dlg.PrjConfigChanged() )
SaveProjectSettings( false );
SaveProjectSettings();
}
@ -331,7 +331,7 @@ wxFileName DIALOG_PLOT_SCHEMATIC::createPlotFileName( wxTextCtrl* aOutputDirecto
{
wxString msg = wxString::Format( _( "Could not write plot files to folder \"%s\"." ),
outputDir.GetPath() );
aReporter->Report( msg, REPORTER::RPT_ERROR );
aReporter->Report( msg, SEVERITY_ERROR );
}
wxFileName fn( plotFileName );

View File

@ -203,7 +203,7 @@ void DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable( REPORTER& aReporter )
{
msg.Printf( _( "Adding library \"%s\", file \"%s\" to project symbol library table." ),
libName, fullFileName );
aReporter.Report( msg, REPORTER::RPT_INFO );
aReporter.Report( msg, SEVERITY_INFO );
prjLibTable.InsertRow( new SYMBOL_LIB_TABLE_ROW( libName, fullFileName,
pluginType ) );
@ -211,7 +211,7 @@ void DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable( REPORTER& aReporter )
else
{
msg.Printf( _( "Library \"%s\" not found." ), fullFileName );
aReporter.Report( msg, REPORTER::RPT_WARNING );
aReporter.Report( msg, SEVERITY_WARNING );
}
}
@ -229,10 +229,10 @@ void DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable( REPORTER& aReporter )
{
msg.Printf( _( "Failed to write project symbol library table. Error:\n %s" ),
ioe.What() );
aReporter.ReportTail( msg, REPORTER::RPT_ERROR );
aReporter.ReportTail( msg, SEVERITY_ERROR );
}
aReporter.ReportTail( _( "Created project symbol library table.\n" ), REPORTER::RPT_INFO );
aReporter.ReportTail( _( "Created project symbol library table.\n" ), SEVERITY_INFO );
}
}
}
@ -255,20 +255,20 @@ void DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable( REPORTER& aReporter )
{
msg.Printf( _( "No symbol \"%s\" found in symbol library table." ),
symbol->GetLibId().GetLibItemName().wx_str() );
aReporter.Report( msg, REPORTER::RPT_WARNING );
aReporter.Report( msg, SEVERITY_WARNING );
}
else
{
msg.Printf( _( "Symbol \"%s\" mapped to symbol library \"%s\"." ),
symbol->GetLibId().GetLibItemName().wx_str(),
symbol->GetLibId().GetLibNickname().wx_str() );
aReporter.Report( msg, REPORTER::RPT_ACTION );
aReporter.Report( msg,SEVERITY_ACTION );
screen->SetModify();
}
}
}
aReporter.Report( _( "Symbol library table mapping complete!" ), REPORTER::RPT_INFO );
aReporter.Report( _( "Symbol library table mapping complete!" ), SEVERITY_INFO );
schematic.UpdateSymbolLinks( true );
}
@ -363,7 +363,7 @@ bool DIALOG_SYMBOL_REMAP::backupProject( REPORTER& aReporter )
tmp.Printf( _( "Backing up file \"%s\" to file \"%s\"." ),
srcFileName.GetFullPath(), destFileName.GetFullPath() );
aReporter.Report( tmp, REPORTER::RPT_INFO );
aReporter.Report( tmp, SEVERITY_INFO );
if( wxFileName::Exists( srcFileName.GetFullPath() )
&& !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
@ -396,7 +396,7 @@ bool DIALOG_SYMBOL_REMAP::backupProject( REPORTER& aReporter )
tmp.Printf( _( "Backing up file \"%s\" to file \"%s\"." ),
screen->GetFileName(), destFileName.GetFullPath() );
aReporter.Report( tmp, REPORTER::RPT_INFO );
aReporter.Report( tmp, SEVERITY_INFO );
if( !destFileName.DirExists() && !destFileName.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) )
{
@ -420,7 +420,7 @@ bool DIALOG_SYMBOL_REMAP::backupProject( REPORTER& aReporter )
tmp.Printf( _( "Backing up file \"%s\" to file \"%s\"." ),
Prj().GetProjectFullName(), destFileName.GetFullPath() );
aReporter.Report( tmp, REPORTER::RPT_INFO );
aReporter.Report( tmp, SEVERITY_INFO );
if( wxFileName::Exists( Prj().GetProjectFullName() )
&& !wxCopyFile( Prj().GetProjectFullName(), destFileName.GetFullPath() ) )
@ -440,7 +440,7 @@ bool DIALOG_SYMBOL_REMAP::backupProject( REPORTER& aReporter )
tmp.Printf( _( "Backing up file \"%s\" to file \"%s\"." ),
srcFileName.GetFullPath(), destFileName.GetFullPath() );
aReporter.Report( tmp, REPORTER::RPT_INFO );
aReporter.Report( tmp, SEVERITY_INFO );
if( srcFileName.Exists()
&& !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
@ -454,8 +454,9 @@ bool DIALOG_SYMBOL_REMAP::backupProject( REPORTER& aReporter )
destFileName.SetName( srcFileName.GetName() + timeStamp );
tmp.Printf( _( "Backing up file \"%s\" to file \"%s\"." ),
srcFileName.GetFullPath(), destFileName.GetFullPath() );
aReporter.Report( tmp, REPORTER::RPT_INFO );
srcFileName.GetFullPath(),
destFileName.GetFullPath() );
aReporter.Report( tmp, SEVERITY_INFO );
if( srcFileName.Exists()
&& !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
@ -469,8 +470,9 @@ bool DIALOG_SYMBOL_REMAP::backupProject( REPORTER& aReporter )
destFileName.SetExt( srcFileName.GetExt() );
tmp.Printf( _( "Backing up file \"%s\" to file \"%s\"." ),
srcFileName.GetFullPath(), destFileName.GetFullPath() );
aReporter.Report( tmp, REPORTER::RPT_INFO );
srcFileName.GetFullPath(),
destFileName.GetFullPath() );
aReporter.Report( tmp, SEVERITY_INFO );
if( srcFileName.Exists()
&& !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )

View File

@ -115,7 +115,7 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow()
firstRefId != LIB_PART::GetSubpartFirstId() )
{
LIB_PART::SetSubpartIdNotation( refSeparator, firstRefId );
m_frame->SaveProjectSettings( false );
m_frame->SaveProjectSettings();
}
SetDefaultBusThickness( m_busWidth.GetValue() );

View File

@ -73,7 +73,7 @@ bool PANEL_EESCHEMA_SETTINGS::TransferDataFromWindow()
if( textSize != GetDefaultTextSize() )
{
SetDefaultTextSize( textSize );
m_frame->SaveProjectSettings( false );
m_frame->SaveProjectSettings();
}
m_frame->SetRepeatStep(

View File

@ -106,14 +106,14 @@ wxString DRC_ITEM::ShowHtml( EDA_UNITS aUnits ) const
wxColour hrefColour = wxSystemSettings::GetColour( wxSYS_COLOUR_HOTLIGHT );
if( m_noCoordinate )
if( !m_hasPositions )
{
// omit the coordinate, a NETCLASS has no location
return wxString::Format( "<p><b>%s</b><br>&nbsp;&nbsp; %s", errText, mainText );
}
else if( m_hasSecondItem )
{
wxString auxText = m_AuxiliaryText;
wxString auxText = m_AuxText;
auxText.Replace( wxT("<"), wxT("&lt;") );
auxText.Replace( wxT(">"), wxT("&gt;") );
@ -124,7 +124,7 @@ wxString DRC_ITEM::ShowHtml( EDA_UNITS aUnits ) const
hrefColour.GetAsString( wxC2S_HTML_SYNTAX ),
ShowCoord( aUnits, m_MainPosition ),
mainText,
ShowCoord( aUnits, m_AuxiliaryPosition ),
ShowCoord( aUnits, m_AuxPosition ),
auxText );
}
else
@ -147,8 +147,8 @@ wxString DRC_ITEM::ShowReport( EDA_UNITS aUnits ) const
GetErrorText(),
ShowCoord( aUnits, m_MainPosition ),
m_MainText,
ShowCoord( aUnits, m_AuxiliaryPosition ),
m_AuxiliaryText );
ShowCoord( aUnits, m_AuxPosition ),
m_AuxText );
}
else
{

View File

@ -264,7 +264,7 @@ bool SCH_EDIT_FRAME::LoadProjectFile()
}
void SCH_EDIT_FRAME::SaveProjectSettings( bool aAskForSave )
void SCH_EDIT_FRAME::SaveProjectSettings()
{
PROJECT& prj = Prj();
wxFileName fn = g_RootSheet->GetScreen()->GetFileName(); //ConfigFileName
@ -274,17 +274,6 @@ void SCH_EDIT_FRAME::SaveProjectSettings( bool aAskForSave )
if( !IsWritable( fn ) )
return;
if( aAskForSave )
{
wxFileDialog dlg( this, _( "Save Project File" ), fn.GetPath(), fn.GetFullName(),
ProjectFileWildcard(), wxFD_SAVE );
if( dlg.ShowModal() == wxID_CANCEL )
return;
fn = dlg.GetPath();
}
wxString path = fn.GetFullPath();
// Convert default text size from internal units temporarily.

View File

@ -661,7 +661,7 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
g_RootSheet->SetFileName( newfilename.GetFullPath() );
GetScreen()->SetFileName( newfilename.GetFullPath() );
GetScreen()->SetModify();
SaveProjectSettings( false );
SaveProjectSettings();
UpdateFileHistory( aFileName );
SCH_SCREENS schematic;

View File

@ -119,33 +119,33 @@ bool SCH_EDIT_FRAME::WriteNetListFile( NETLIST_OBJECT_LIST* aConnectedItemsList,
msg << _( "Run command:" ) << wxT( "\n" ) << commandLine << wxT( "\n\n" );
aReporter->ReportHead( msg, REPORTER::RPT_ACTION );
aReporter->ReportHead( msg, SEVERITY_ACTION );
if( diag != 0 )
aReporter->ReportTail( wxString::Format(
_("Command error. Return code %d" ), diag ),
REPORTER::RPT_ERROR );
SEVERITY_ERROR );
else
aReporter->ReportTail( _( "Success" ), REPORTER::RPT_INFO );
aReporter->ReportTail( _( "Success" ), SEVERITY_INFO );
if( output.GetCount() )
{
msg.Empty();
msg << wxT( "\n" ) << _( "Info messages:" ) << wxT( "\n" );
aReporter->Report( msg, REPORTER::RPT_INFO );
aReporter->Report( msg, SEVERITY_INFO );
for( unsigned ii = 0; ii < output.GetCount(); ii++ )
aReporter->Report( output[ii] + wxT( "\n" ), REPORTER::RPT_INFO );
aReporter->Report( output[ii] + wxT( "\n" ), SEVERITY_INFO );
}
if( errors.GetCount() )
{
msg.Empty();
msg << wxT("\n") << _( "Error messages:" ) << wxT( "\n" );
aReporter->Report( msg, REPORTER::RPT_INFO );
aReporter->Report( msg, SEVERITY_INFO );
for( unsigned ii = 0; ii < errors.GetCount(); ii++ )
aReporter->Report( errors[ii] + wxT( "\n" ), REPORTER::RPT_ERROR );
aReporter->Report( errors[ii] + wxT( "\n" ), SEVERITY_ERROR );
}
}
else

View File

@ -76,20 +76,19 @@ void DIALOG_PLOT_SCHEMATIC::CreateDXFFile( bool aPlotAll, bool aPlotFrameRef )
if( PlotOneSheetDXF( plotFileName.GetFullPath(), screen, plot_offset, 1.0,
aPlotFrameRef ) )
{
msg.Printf( _( "Plot: \"%s\" OK.\n" ), GetChars( plotFileName.GetFullPath() ) );
reporter.Report( msg, REPORTER::RPT_ACTION );
msg.Printf( _( "Plot: \"%s\" OK.\n" ), plotFileName.GetFullPath() );
reporter.Report( msg, SEVERITY_ACTION );
}
else // Error
{
msg.Printf( _( "Unable to create file \"%s\".\n" ),
GetChars( plotFileName.GetFullPath() ) );
reporter.Report( msg, REPORTER::RPT_ERROR );
msg.Printf( _( "Unable to create file \"%s\".\n" ), plotFileName.GetFullPath() );
reporter.Report( msg, SEVERITY_ERROR );
}
}
catch( IO_ERROR& e )
{
msg.Printf( wxT( "DXF Plotter exception: %s"), GetChars( e.What() ) );
reporter.Report( msg, REPORTER::RPT_ERROR );
msg.Printf( wxT( "DXF Plotter exception: %s"), e.What() );
reporter.Report( msg, SEVERITY_ERROR );
schframe->SetCurrentSheet( oldsheetpath );
schframe->GetCurrentSheet().UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount();

View File

@ -148,20 +148,19 @@ void DIALOG_PLOT_SCHEMATIC::createHPGLFile( bool aPlotAll, bool aPlotFrameRef )
if( Plot_1_Page_HPGL( plotFileName.GetFullPath(), screen, plotPage, plotOffset,
plot_scale, aPlotFrameRef ) )
{
msg.Printf( _( "Plot: \"%s\" OK.\n" ), GetChars( plotFileName.GetFullPath() ) );
reporter.Report( msg, REPORTER::RPT_ACTION );
msg.Printf( _( "Plot: \"%s\" OK.\n" ), plotFileName.GetFullPath() );
reporter.Report( msg, SEVERITY_ACTION );
}
else
{
msg.Printf( _( "Unable to create file \"%s\".\n" ),
GetChars( plotFileName.GetFullPath() ) );
reporter.Report( msg, REPORTER::RPT_ERROR );
msg.Printf( _( "Unable to create file \"%s\".\n" ), plotFileName.GetFullPath() );
reporter.Report( msg, SEVERITY_ERROR );
}
}
catch( IO_ERROR& e )
{
msg.Printf( wxT( "HPGL Plotter exception: %s"), GetChars( e.What() ) );
reporter.Report( msg, REPORTER::RPT_ERROR );
msg.Printf( wxT( "HPGL Plotter exception: %s"), e.What() );
reporter.Report( msg, SEVERITY_ERROR );
}
}

View File

@ -83,14 +83,12 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef )
{
wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
wxString ext = PDF_PLOTTER::GetDefaultFileExtension();
plotFileName = createPlotFileName( m_outputDirectoryName,
fname, ext, &reporter );
plotFileName = createPlotFileName( m_outputDirectoryName, fname, ext, &reporter );
if( !plotter->OpenFile( plotFileName.GetFullPath() ) )
{
msg.Printf( _( "Unable to create file \"%s\".\n" ),
GetChars( plotFileName.GetFullPath() ) );
reporter.Report( msg, REPORTER::RPT_ERROR );
msg.Printf( _( "Unable to create file \"%s\".\n" ), plotFileName.GetFullPath() );
reporter.Report( msg, SEVERITY_ERROR );
delete plotter;
return;
}
@ -102,8 +100,8 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef )
catch( const IO_ERROR& e )
{
// Cannot plot PDF file
msg.Printf( wxT( "PDF Plotter exception: %s" ), GetChars( e.What() ) );
reporter.Report( msg, REPORTER::RPT_ERROR );
msg.Printf( wxT( "PDF Plotter exception: %s" ), e.What() );
reporter.Report( msg, SEVERITY_ERROR );
restoreEnvironment( plotter, oldsheetpath );
return;
@ -123,8 +121,8 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef )
}
// Everything done, close the plot and restore the environment
msg.Printf( _( "Plot: \"%s\" OK.\n" ), GetChars( plotFileName.GetFullPath() ) );
reporter.Report( msg, REPORTER::RPT_ACTION );
msg.Printf( _( "Plot: \"%s\" OK.\n" ), plotFileName.GetFullPath() );
reporter.Report( msg, SEVERITY_ACTION );
restoreEnvironment( plotter, oldsheetpath );
}

View File

@ -103,22 +103,21 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef )
if( plotOneSheetPS( plotFileName.GetFullPath(), screen, plotPage, plot_offset,
scale, aPlotFrameRef ) )
{
msg.Printf( _( "Plot: \"%s\" OK.\n" ), GetChars( plotFileName.GetFullPath() ) );
reporter.Report( msg, REPORTER::RPT_ACTION );
msg.Printf( _( "Plot: \"%s\" OK.\n" ), plotFileName.GetFullPath() );
reporter.Report( msg, SEVERITY_ACTION );
}
else
{
// Error
msg.Printf( _( "Unable to create file \"%s\".\n" ),
GetChars( plotFileName.GetFullPath() ) );
reporter.Report( msg, REPORTER::RPT_ERROR );
msg.Printf( _( "Unable to create file \"%s\".\n" ), plotFileName.GetFullPath() );
reporter.Report( msg, SEVERITY_ERROR );
}
}
catch( IO_ERROR& e )
{
msg.Printf( wxT( "PS Plotter exception: %s"), GetChars( e.What() ) );
reporter.Report( msg, REPORTER::RPT_ERROR );
msg.Printf( wxT( "PS Plotter exception: %s"), e.What() );
reporter.Report( msg, SEVERITY_ERROR );
}
}

View File

@ -73,22 +73,20 @@ void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef )
if( !success )
{
msg.Printf( _( "Cannot create file \"%s\".\n" ),
GetChars( plotFileName.GetFullPath() ) );
reporter.Report( msg, REPORTER::RPT_ERROR );
msg.Printf( _( "Cannot create file \"%s\".\n" ), plotFileName.GetFullPath() );
reporter.Report( msg, SEVERITY_ERROR );
}
else
{
msg.Printf( _( "Plot: \"%s\" OK.\n" ),
GetChars( plotFileName.GetFullPath() ) );
reporter.Report( msg, REPORTER::RPT_ACTION );
msg.Printf( _( "Plot: \"%s\" OK.\n" ), plotFileName.GetFullPath() );
reporter.Report( msg, SEVERITY_ACTION );
}
}
catch( const IO_ERROR& e )
{
// Cannot plot SVG file
msg.Printf( wxT( "SVG Plotter exception: %s" ), GetChars( e.What() ) );
reporter.Report( msg, REPORTER::RPT_ERROR );
msg.Printf( wxT( "SVG Plotter exception: %s" ), e.What() );
reporter.Report( msg, SEVERITY_ERROR );
break;
}
}

View File

@ -257,10 +257,8 @@ public:
/**
* Save changes to the project settings to the project (.pro) file.
*
* @param aAskForSave = true to open a dialog before saving the settings
*/
void SaveProjectSettings( bool aAskForSave ) override;
void SaveProjectSettings() override;
/**
* Loads the KiCad project file (*.pro) settings specific to Eeschema.

View File

@ -35,14 +35,16 @@
#define SCALING_FACTOR Millimeter2iu( 0.1 )
// JEY TODO: retire this; there's no reason not to use the next one...
SCH_MARKER::SCH_MARKER() : SCH_ITEM( NULL, SCH_MARKER_T ), MARKER_BASE( SCALING_FACTOR )
{
}
// JEY TODO: pass in ERCE code so we can get severity from it...
SCH_MARKER::SCH_MARKER( const wxPoint& pos, const wxString& text ) :
SCH_ITEM( NULL, SCH_MARKER_T ),
MARKER_BASE( 0, pos, text, pos, SCALING_FACTOR )
MARKER_BASE( 0, pos, text, pos, wxEmptyString, wxPoint(), SCALING_FACTOR )
{
}
@ -70,18 +72,20 @@ void SCH_MARKER::Show( int nestLevel, std::ostream& os ) const
#endif
void SCH_MARKER::Print( wxDC* aDC, const wxPoint& aOffset )
KIGFX::COLOR4D SCH_MARKER::getColor() const
{
COLOR4D tmp = m_Color;
if( GetMarkerType() == MARKER_BASE::MARKER_ERC )
{
m_Color = ( GetErrorLevel() == MARKER_BASE::MARKER_SEVERITY_ERROR ) ?
GetLayerColor( LAYER_ERC_ERR ) : GetLayerColor( LAYER_ERC_WARN );
if( IsExcluded() )
return GetLayerColor( LAYER_HIDDEN );
else if( GetErrorLevel() == MARKER_BASE::MARKER_SEVERITY_ERROR )
return GetLayerColor( LAYER_ERC_ERR );
else
return GetLayerColor( LAYER_ERC_WARN );
}
void SCH_MARKER::Print( wxDC* aDC, const wxPoint& aOffset )
{
PrintMarker( aDC, aOffset );
m_Color = tmp;
}

View File

@ -105,6 +105,9 @@ public:
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const override;
#endif
protected:
KIGFX::COLOR4D getColor() const override;
};
#endif // TYPE_SCH_MARKER_H_

View File

@ -38,8 +38,6 @@ namespace KIGFX {
};
};
class COLORS_DESIGN_SETTINGS;
class SCH_PREVIEW_PANEL : public EDA_DRAW_PANEL_GAL
{

View File

@ -61,7 +61,7 @@ public:
{
}
REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override
REPORTER& Report( const wxString& aText, SEVERITY aSeverity = SEVERITY_UNDEFINED ) override
{
wxCommandEvent* event = new wxCommandEvent( EVT_SIM_REPORT );
event->SetString( aText );

View File

@ -61,7 +61,7 @@ bool BACK_ANNOTATE::BackAnnotateSymbols( const std::string& aNetlist )
&& !m_settings.processReferences )
{
m_settings.reporter.ReportTail(
_( "Select at least one property to back annotate" ), REPORTER::RPT_ERROR );
_( "Select at least one property to back annotate" ), SEVERITY_ERROR );
return false;
}
@ -85,16 +85,16 @@ bool BACK_ANNOTATE::BackAnnotateSymbols( const std::string& aNetlist )
if( !m_settings.dryRun )
{
msg.Printf( _( "Schematic is back-annotated. %d changes applied." ), m_changesCount );
m_settings.reporter.ReportTail( msg, REPORTER::RPT_ACTION );
m_settings.reporter.ReportTail( msg, SEVERITY_ACTION );
}
else
m_settings.reporter.ReportTail(
_( "No errors during dry run. Ready to go." ), REPORTER::RPT_ACTION );
_( "No errors during dry run. Ready to go." ), SEVERITY_ACTION );
}
else
{
msg.Printf( _( "Found %d errors. Fix them and run back annotation." ), errors );
m_settings.reporter.ReportTail( msg, REPORTER::RPT_ERROR );
m_settings.reporter.ReportTail( msg, SEVERITY_ERROR );
}
return !errors;
@ -149,7 +149,7 @@ int BACK_ANNOTATE::getPcbModulesFromString( const std::string& aPayload )
if( path == "" )
{
msg.Printf( _( "Footprint \"%s\" has no symbol associated." ), ref );
m_settings.reporter.ReportHead( msg, REPORTER::RPT_WARNING );
m_settings.reporter.ReportHead( msg, SEVERITY_WARNING );
continue;
}
footprint = UTF8( item.second.get_child( "fpid" ).front().first );
@ -168,7 +168,7 @@ int BACK_ANNOTATE::getPcbModulesFromString( const std::string& aPayload )
// Module with this path already exists - generate error
msg.Printf( _( "Pcb footprints \"%s\" and \"%s\" linked to same symbol" ),
nearestItem->second->ref, ref );
m_settings.reporter.ReportHead( msg, REPORTER::RPT_ERROR );
m_settings.reporter.ReportHead( msg, SEVERITY_ERROR );
++errors;
}
else
@ -223,7 +223,7 @@ int BACK_ANNOTATE::getChangeList()
wxString msg;
msg.Printf( _( "Cannot find symbol for \"%s\" footprint" ), pcbData->ref );
++errors;
m_settings.reporter.ReportTail( msg, REPORTER::RPT_ERROR );
m_settings.reporter.ReportTail( msg, SEVERITY_ERROR );
}
}
return errors;
@ -248,7 +248,7 @@ int BACK_ANNOTATE::checkForUnusedSymbols()
++errors;
wxString msg;
msg.Printf( _( "Cannot find footprint for \"%s\" symbol" ), m_refs[i++].GetFullRef() );
m_settings.reporter.ReportTail( msg, REPORTER::RPT_ERROR );
m_settings.reporter.ReportTail( msg, SEVERITY_ERROR );
}
++i;
@ -310,7 +310,7 @@ int BACK_ANNOTATE::checkSharedSchematicErrors()
msg.Printf( _( "\"%s\" and \"%s\" use the same schematic symbol.\n"
"They cannot have different footprints or values." ),
( it + 1 )->second->ref, it->second->ref );
m_settings.reporter.ReportTail( msg, REPORTER::RPT_ERROR );
m_settings.reporter.ReportTail( msg, SEVERITY_ERROR );
}
}
else
@ -328,7 +328,7 @@ int BACK_ANNOTATE::checkSharedSchematicErrors()
msg.Printf( _( "Unable to change \"%s\" footprint or value because associated"
" symbol is reused in the another project" ),
it->second->ref );
m_settings.reporter.ReportTail( msg, REPORTER::RPT_ERROR );
m_settings.reporter.ReportTail( msg, SEVERITY_ERROR );
++errors;
}
}
@ -359,7 +359,7 @@ void BACK_ANNOTATE::applyChangelist()
msg.Printf( _( "Change \"%s\" reference to \"%s\"." ), ref.GetFullRef(), module.ref );
if( !m_settings.dryRun )
ref.GetComp()->SetRef( &ref.GetSheetPath(), module.ref );
m_settings.reporter.ReportHead( msg, REPORTER::RPT_ACTION );
m_settings.reporter.ReportHead( msg, SEVERITY_ACTION );
}
if( m_settings.processFootprints && oldFootprint != module.footprint )
@ -370,7 +370,7 @@ void BACK_ANNOTATE::applyChangelist()
if( !m_settings.dryRun )
ref.GetComp()->GetField( FOOTPRINT )->SetText( module.footprint );
m_settings.reporter.ReportHead( msg, REPORTER::RPT_ACTION );
m_settings.reporter.ReportHead( msg, SEVERITY_ACTION );
}
if( m_settings.processValues && oldValue != module.value )
@ -380,12 +380,12 @@ void BACK_ANNOTATE::applyChangelist()
getTextFromField( ref, VALUE ), module.value );
if( !m_settings.dryRun )
item.first.GetComp()->GetField( VALUE )->SetText( module.value );
m_settings.reporter.ReportHead( msg, REPORTER::RPT_ACTION );
m_settings.reporter.ReportHead( msg, SEVERITY_ACTION );
}
if( changesCountBefore == m_changesCount )
++leftUnchanged;
}
msg.Printf( _( "%d symbols left unchanged" ), leftUnchanged );
m_settings.reporter.ReportHead( msg, REPORTER::RPT_INFO );
m_settings.reporter.ReportHead( msg, SEVERITY_INFO );
}

View File

@ -94,12 +94,12 @@ static COLORBUTTON miscColorButtons[] = {
{ _( "ERC warning" ), LAYER_ERC_WARN },
{ _( "ERC error" ), LAYER_ERC_ERR },
{ _( "Brightened" ), LAYER_BRIGHTENED },
{ _( "Hidden items" ), LAYER_HIDDEN },
{ _( "Hidden item" ), LAYER_HIDDEN },
{ _( "Worksheet" ), LAYER_SCHEMATIC_WORKSHEET },
{ _( "Cursor" ), LAYER_SCHEMATIC_CURSOR },
{ _( "Grid" ), LAYER_SCHEMATIC_GRID },
{ _( "Background" ), LAYER_SCHEMATIC_BACKGROUND },
{ _( "Selection Highlight" ), LAYER_SELECTION_SHADOWS },
{ _( "Selection highlight" ), LAYER_SELECTION_SHADOWS },
{ wxT( "" ), -1 } // Sentinel marking end of list.
};

View File

@ -308,7 +308,7 @@ bool GERBVIEW_FRAME::loadListOfGerberAndDrillFiles( const wxString& aPath,
wxString warning;
warning << "<b>" << _( "File not found:" ) << "</b><br>"
<< filename.GetFullPath() << "<br>";
reporter.Report( warning, REPORTER::RPT_WARNING );
reporter.Report( warning, SEVERITY_WARNING );
success = false;
continue;
}
@ -350,7 +350,7 @@ bool GERBVIEW_FRAME::loadListOfGerberAndDrillFiles( const wxString& aPath,
if( layer == NO_AVAILABLE_LAYERS && ii < aFilenameList.GetCount()-1 )
{
success = false;
reporter.Report( MSG_NO_MORE_LAYER, REPORTER::RPT_ERROR );
reporter.Report( MSG_NO_MORE_LAYER, SEVERITY_ERROR );
// Report the name of not loaded files:
ii += 1;
@ -358,7 +358,7 @@ bool GERBVIEW_FRAME::loadListOfGerberAndDrillFiles( const wxString& aPath,
{
filename = aFilenameList[ii++];
wxString txt = wxString::Format( MSG_NOT_LOADED, filename.GetFullName() );
reporter.Report( txt, REPORTER::RPT_ERROR );
reporter.Report( txt, SEVERITY_ERROR );
}
break;
}
@ -471,7 +471,7 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName )
if( layer == NO_AVAILABLE_LAYERS && ii < filenamesList.GetCount()-1 )
{
success = false;
reporter.Report( MSG_NO_MORE_LAYER, REPORTER::RPT_ERROR );
reporter.Report( MSG_NO_MORE_LAYER, SEVERITY_ERROR );
// Report the name of not loaded files:
ii += 1;
@ -479,7 +479,7 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName )
{
filename = filenamesList[ii++];
wxString txt = wxString::Format( MSG_NOT_LOADED, filename.GetFullName() );
reporter.Report( txt, REPORTER::RPT_ERROR );
reporter.Report( txt, SEVERITY_ERROR );
}
break;
}
@ -521,8 +521,8 @@ bool GERBVIEW_FRAME::unarchiveFiles( const wxString& aFullFileName, REPORTER* aR
{
if( aReporter )
{
msg.Printf( _( "Zip file \"%s\" cannot be opened" ), GetChars( aFullFileName ) );
aReporter->Report( msg, REPORTER::RPT_ERROR );
msg.Printf( _( "Zip file \"%s\" cannot be opened" ), aFullFileName );
aReporter->Report( msg, SEVERITY_ERROR );
}
return false;
@ -563,9 +563,8 @@ bool GERBVIEW_FRAME::unarchiveFiles( const wxString& aFullFileName, REPORTER* aR
{
if( aReporter )
{
msg.Printf( _( "Info: skip file <i>\"%s\"</i> (unknown type)\n" ),
GetChars( entry->GetName() ) );
aReporter->Report( msg, REPORTER::RPT_WARNING );
msg.Printf( _( "Info: skip file \"%s\" (unknown type)\n" ), entry->GetName() );
aReporter->Report( msg, SEVERITY_WARNING );
}
continue;
@ -580,13 +579,13 @@ bool GERBVIEW_FRAME::unarchiveFiles( const wxString& aFullFileName, REPORTER* aR
if( aReporter )
{
if( !reported_no_more_layer )
aReporter->Report( MSG_NO_MORE_LAYER, REPORTER::RPT_ERROR );
aReporter->Report( MSG_NO_MORE_LAYER, SEVERITY_ERROR );
reported_no_more_layer = true;
// Report the name of not loaded files:
msg.Printf( MSG_NOT_LOADED, GetChars( entry->GetName() ) );
aReporter->Report( msg, REPORTER::RPT_ERROR );
aReporter->Report( msg, SEVERITY_ERROR );
}
delete entry;
@ -606,8 +605,8 @@ bool GERBVIEW_FRAME::unarchiveFiles( const wxString& aFullFileName, REPORTER* aR
if( aReporter )
{
msg.Printf( _( "<b>Unable to create temporary file \"%s\"</b>\n"),
GetChars( unzipped_tempfile ) );
aReporter->Report( msg, REPORTER::RPT_ERROR );
unzipped_tempfile );
aReporter->Report( msg, SEVERITY_ERROR );
}
}
}
@ -635,9 +634,8 @@ bool GERBVIEW_FRAME::unarchiveFiles( const wxString& aFullFileName, REPORTER* aR
if( aReporter )
{
msg.Printf( _("<b>unzipped file %s read error</b>\n"),
GetChars( unzipped_tempfile ) );
aReporter->Report( msg, REPORTER::RPT_ERROR );
msg.Printf( _("<b>unzipped file %s read error</b>\n"), unzipped_tempfile );
aReporter->Report( msg, SEVERITY_ERROR );
}
}
else

View File

@ -28,8 +28,6 @@ namespace KIGFX
class WS_PROXY_VIEW_ITEM;
}
class COLORS_DESIGN_SETTINGS;
class GERBVIEW_DRAW_PANEL_GAL : public EDA_DRAW_PANEL_GAL
{

View File

@ -32,8 +32,6 @@
class EDA_ITEM;
class COLORS_DESIGN_SETTINGS;
class GERBER_DRAW_ITEM;
class GERBER_FILE_IMAGE;

View File

@ -151,8 +151,8 @@ bool GERBER_JOBFILE_READER::ReadGerberJobFile()
else
{
if( m_reporter )
m_reporter->ReportTail( _( "This job file uses an outdated format. Please, recreate it." ),
REPORTER::RPT_WARNING );
m_reporter->ReportTail( _( "This job file uses an outdated format. Please recreate it." ),
SEVERITY_WARNING );
return false;
}

View File

@ -188,17 +188,17 @@ public:
bool m_BlindBuriedViaAllowed; ///< true to allow blind/buried vias
VIATYPE m_CurrentViaType; ///< (VIA_BLIND_BURIED, VIA_THROUGH, VIA_MICROVIA)
bool m_RequireCourtyards; ///< require courtyard definitions in footprints
bool m_ProhibitOverlappingCourtyards; ///< check for overlapping courtyards in DRC
// if true, when creating a new track starting on an existing track, use this track width
bool m_UseConnectedTrackWidth;
int m_TrackMinWidth; ///< track min value for width ((min copper size value
int m_ViasMinSize; ///< vias (not micro vias) min diameter
int m_ViasMinDrill; ///< vias (not micro vias) min drill diameter
int m_MicroViasMinSize; ///< micro vias (not vias) min diameter
int m_MicroViasMinDrill; ///< micro vias (not vias) min drill diameter
bool m_UseConnectedTrackWidth; // use width of existing track when creating a new,
// connected track
int m_TrackMinWidth; // track min value for width ((min copper size value
int m_ViasMinSize; // vias (not micro vias) min diameter
int m_ViasMinDrill; // vias (not micro vias) min drill diameter
int m_MicroViasMinSize; // micro vias min diameter
int m_MicroViasMinDrill; // micro vias min drill diameter
int m_CopperEdgeClearance;
int m_HoleToHoleMin; // Min width of peninsula between two drilled holes
std::map< int, int > m_DRCSeverities; // Map from DRCErrorCode to SEVERITY
/** Option to handle filled polygons in zones:
* the "legacy" option is using thick outlines around filled polygons: give the best shape
@ -220,8 +220,6 @@ public:
double m_SolderPasteMarginRatio; ///< Solder pask margin ratio value of pad size
///< The final margin is the sum of these 2 values
int m_HoleToHoleMin; ///< Min width of peninsula between two drilled holes
// Arrays of default values for the various layer classes.
int m_LineThickness[ LAYER_CLASS_COUNT ];
wxSize m_TextSize[ LAYER_CLASS_COUNT ];
@ -303,6 +301,13 @@ public:
BOARD_STACKUP& GetStackupDescriptor() { return m_stackup; }
int GetSeverity( int aDRCErrorCode );
/**
* returns true if the DRC error code's severity is SEVERITY_IGNORE
*/
bool Ignore( int aDRCErrorCode );
/**
* Function GetDefault
* @return the default netclass.
@ -678,18 +683,6 @@ public:
*/
void SetCopperEdgeClearance( int aDistance );
/**
* Function SetRequireCourtyardDefinitions
* @param aRequire Set to true to generate DRC violations from missing courtyards.
*/
void SetRequireCourtyardDefinitions( bool aRequire );
/**
* Function SetProhibitOverlappingCourtyards
* @param aProhibit Set to true to generate DRC violations from overlapping courtyards.
*/
void SetProhibitOverlappingCourtyards( bool aProhibit );
/**
* Function GetVisibleLayers
* returns a bit-mask of all the layers that are visible

View File

@ -1,118 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2016 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
*/
/**
* @file colors_design_settings.h
* @brief Handle colors used to draw all items or layers.
*/
#ifndef COLORS_DESIGN_SETTING_H
#define COLORS_DESIGN_SETTING_H
#include <gal/color4d.h>
#include <layers_id_colors_and_visibility.h>
#include <core/settings.h>
using KIGFX::COLOR4D;
class wxConfigBase;
class wxString;
#include <frame_type.h>
class PARAM_CFG;
/**
* COLORS_DESIGN_SETTINGS
* is a list of color settings for designs in Pcbnew
*/
class COLORS_DESIGN_SETTINGS : public SETTINGS
{
public:
// Color options for screen display of the Printed Board or schematic:
COLOR4D m_LayersColors[LAYER_ID_COUNT]; ///< Layer colors (tracks and graphic items)
public:
COLORS_DESIGN_SETTINGS( FRAME_T aFrameType );
~COLORS_DESIGN_SETTINGS() override
{}
virtual void Load( wxConfigBase *aConfig ) override;
virtual void Save( wxConfigBase *aConfig ) override;
/**
* Function GetDefaultLayerColor
* @return the default color for aLayer which is one of the item indices given in
* enum PCB_LAYER_ID
*/
static COLOR4D GetDefaultLayerColor( LAYER_NUM aLayer );
/**
* Function GetLayerColor
* @return the color for aLayer which is one of the item indices given in
* enum PCB_LAYER_ID
*/
COLOR4D GetLayerColor( LAYER_NUM aLayer ) const;
/**
* Function SetLayerColor
* sets the color for aLayer which is one of the item indices given in
* enum PCB_LAYER_ID
*/
void SetLayerColor( LAYER_NUM aLayer, COLOR4D aColor );
/**
* Function GetDefaultItemColor
* @return the default color for the an item which is one of the item
* indices given in enum GAL_LAYER_ID
*/
static COLOR4D GetDefaultItemColor( int aItemIdx );
/**
* Function GetItemColor
* @return the color for an item which is one of the item indices given
* in enum GAL_LAYER_ID
*/
COLOR4D GetItemColor( int aItemIdx ) const;
/**
* Function SetItemColor
* sets the color for an item which is one of the item indices given
* in enum GAL_LAYER_ID
*/
void SetItemColor( int aItemIdx, COLOR4D aColor );
/**
* Function SetAllColorsAs
* sets alls colors to aColor
* Usefull to create a monochrome color selection for printing purpose
*/
void SetAllColorsAs( COLOR4D aColor );
private:
FRAME_T m_frameType;
void setupConfigParams();
};
#endif // COLORS_DESIGN_SETTING_H

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-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
@ -26,16 +26,13 @@
#ifndef CONFIG_PARAMS_H_
#define CONFIG_PARAMS_H_
/**
* The common library
* @file config_params.h
*/
#include <set>
#include <limits>
#include <wx/confbase.h>
#include <wx/fileconf.h>
#include <boost/ptr_container/ptr_vector.hpp>
#include <gal/color4d.h>
#include <limits>
using KIGFX::COLOR4D;
@ -77,14 +74,15 @@ enum paramcfg_id {
PARAM_BOOL,
PARAM_LIBNAME_LIST,
PARAM_WXSTRING,
PARAM_WXSTRING_SET,
PARAM_FILENAME,
PARAM_COMMAND_ERASE,
PARAM_FIELDNAME_LIST,
PARAM_LAYERS,
PARAM_TRACKWIDTHS,
PARAM_VIADIMENSIONS,
PARAM_DIFFPAIRDIMENSIONS,
PARAM_NETCLASSES
PARAM_NETCLASSES,
PARAM_SEVERITIES
};
@ -279,6 +277,28 @@ public:
};
/**
* Configuration parameter - std::set<wxString>
*
*/
class PARAM_CFG_WXSTRING_SET : public PARAM_CFG
{
public:
std::set<wxString>* m_Pt_param; ///< Pointer to the parameter value
public:
PARAM_CFG_WXSTRING_SET( const wxString& ident, std::set<wxString>* ptparam, const wxChar* group = NULL );
PARAM_CFG_WXSTRING_SET( bool Insetup,
const wxString& ident,
std::set<wxString>* ptparam,
const wxChar* group = NULL );
virtual void ReadParam( wxConfigBase* aConfig ) const override;
virtual void SaveParam( wxConfigBase* aConfig ) const override;
};
/**
* Configuration parameter - PARAM_CFG_FILENAME Class
* Same as PARAM_CFG_WXSTRING, but stores "\" as "/".

View File

@ -44,11 +44,11 @@ class DRC_ITEM
protected:
int m_ErrorCode; // the error code's numeric value
wxString m_MainText; // text for the first EDA_ITEM
wxString m_AuxiliaryText; // text for the second EDA_ITEM
wxString m_AuxText; // text for the second EDA_ITEM
wxPoint m_MainPosition; // the location of the first EDA_ITEM
wxPoint m_AuxiliaryPosition; // the location of the second EDA_ITEM
wxPoint m_AuxPosition; // the location of the second EDA_ITEM
bool m_hasPositions;
bool m_hasSecondItem; // true when 2 items create a DRC/ERC error
bool m_noCoordinate;
MARKER_BASE* m_parent; // The marker this item belongs to, if any
KIID m_mainItemUuid;
KIID m_auxItemUuid;
@ -58,28 +58,31 @@ public:
DRC_ITEM()
{
m_ErrorCode = 0;
m_hasPositions = false;
m_hasSecondItem = false;
m_noCoordinate = false;
m_parent = nullptr;
m_mainItemUuid = niluuid;
m_auxItemUuid = niluuid;
}
DRC_ITEM( EDA_UNITS aUnits, int aErrorCode, EDA_ITEM* aMainItem, const wxPoint& aMainPos,
EDA_ITEM* bAuxiliaryItem, const wxPoint& bAuxiliaryPos )
DRC_ITEM( EDA_UNITS aUnits, int aErrorCode,
EDA_ITEM* aMainItem,
EDA_ITEM* bAuxItem = nullptr )
{
SetData( aUnits, aErrorCode, aMainItem, aMainPos, bAuxiliaryItem, bAuxiliaryPos );
SetData( aUnits, aErrorCode, aMainItem, bAuxItem );
}
DRC_ITEM( EDA_UNITS aUnits, int aErrorCode, EDA_ITEM* aMainItem, const wxPoint& aMainPos )
DRC_ITEM( EDA_UNITS aUnits, int aErrorCode,
EDA_ITEM* aMainItem, const wxPoint& aMainPos,
EDA_ITEM* bAuxItem = nullptr, const wxPoint& bAuxPos = wxPoint() )
{
SetData( aUnits, aErrorCode, aMainItem, aMainPos );
SetData( aUnits, aErrorCode, aMainItem, aMainPos, bAuxItem, bAuxPos );
}
DRC_ITEM( int aErrorCode, const wxString& aMainText )
{
SetData( aErrorCode, aMainText, wxPoint() );
SetShowNoCoordinate();
m_hasPositions = false;
}
/**
@ -87,27 +90,24 @@ public:
* initialize all data in item
* @param aErrorCode = error code
* @param aMainItem = the first (main) schematic or board item
* @param bAuxiliaryItem = the second schematic or board item
* @param aMainPos = position the first item and therefore of this issue
* @param bAuxiliaryPos = position the second item
* @param bAuxItem = the second schematic or board item
*/
void SetData( EDA_UNITS aUnits, int aErrorCode, EDA_ITEM* aMainItem, const wxPoint& aMainPos,
EDA_ITEM* bAuxiliaryItem = nullptr, const wxPoint& bAuxiliaryPos = wxPoint() )
void SetData( EDA_UNITS aUnits, int aErrorCode,
EDA_ITEM* aMainItem,
EDA_ITEM* bAuxItem = nullptr )
{
m_ErrorCode = aErrorCode;
m_MainText = aMainItem->GetSelectMenuText( aUnits );
m_AuxiliaryText = wxEmptyString;
m_MainPosition = aMainPos;
m_AuxiliaryPosition = bAuxiliaryPos;
m_hasSecondItem = bAuxiliaryItem != nullptr;
m_noCoordinate = false;
m_AuxText = wxEmptyString;
m_hasPositions = false;
m_hasSecondItem = bAuxItem != nullptr;
m_parent = nullptr;
m_mainItemUuid = aMainItem->m_Uuid;
if( m_hasSecondItem )
{
m_AuxiliaryText = bAuxiliaryItem->GetSelectMenuText( aUnits );
m_auxItemUuid = bAuxiliaryItem->m_Uuid;
m_AuxText = bAuxItem->GetSelectMenuText( aUnits );
m_auxItemUuid = bAuxItem->m_Uuid;
}
}
@ -116,26 +116,100 @@ public:
* initialize all data in item
* @param aErrorCode = error code
* @param aMainItem = the first (main) schematic or board item
* @param bAuxiliaryItem = the second schematic or board item
* @param bAuxItem = the second schematic or board item
* @param aMainPos = position the first item and therefore of this issue
* @param bAuxiliaryPos = position the second item
* @param bAuxPos = position the second item
*/
void SetData( int aErrorCode, const wxString& aMainText, const wxPoint& aMainPos,
const wxString& bAuxiliaryText = wxEmptyString,
const wxPoint& bAuxiliaryPos = wxPoint() )
void SetData( EDA_UNITS aUnits, int aErrorCode,
EDA_ITEM* aMainItem, const wxPoint& aMainPos,
EDA_ITEM* bAuxItem = nullptr, const wxPoint& bAuxPos = wxPoint() )
{
m_ErrorCode = aErrorCode;
m_MainText = aMainItem->GetSelectMenuText( aUnits );
m_AuxText = wxEmptyString;
m_MainPosition = aMainPos;
m_AuxPosition = bAuxPos;
m_hasPositions = true;
m_hasSecondItem = bAuxItem != nullptr;
m_parent = nullptr;
m_mainItemUuid = aMainItem->m_Uuid;
if( m_hasSecondItem )
{
m_AuxText = bAuxItem->GetSelectMenuText( aUnits );
m_auxItemUuid = bAuxItem->m_Uuid;
}
}
/**
* Function SetData
* initialize all data in item
* @param aErrorCode = error code
* @param aMainText = a description of the first (main) item
* @param bAuxText = a description of the second item
*/
void SetData( int aErrorCode,
const wxString& aMainText,
const wxString& bAuxText = wxEmptyString )
{
m_ErrorCode = aErrorCode;
m_MainText = aMainText;
m_AuxiliaryText = bAuxiliaryText;
m_MainPosition = aMainPos;
m_AuxiliaryPosition = bAuxiliaryPos;
m_hasSecondItem = bAuxiliaryText.Length();
m_noCoordinate = false;
m_AuxText = bAuxText;
m_hasPositions = false;
m_hasSecondItem = !bAuxText.IsEmpty();
m_parent = nullptr;
m_mainItemUuid = niluuid;
m_auxItemUuid = niluuid;
}
/**
* Function SetData
* initialize all data in item
* @param aErrorCode = error code
* @param aMainText = a description of the first (main) item
* @param aMainPos = position the first item and therefore of this issue
* @param bAuxText = a description of the second item
* @param bAuxPos = position the second item
*/
void SetData( int aErrorCode,
const wxString& aMainText, const wxPoint& aMainPos,
const wxString& bAuxText = wxEmptyString, const wxPoint& bAuxPos = wxPoint() )
{
m_ErrorCode = aErrorCode;
m_MainText = aMainText;
m_AuxText = bAuxText;
m_MainPosition = aMainPos;
m_AuxPosition = bAuxPos;
m_hasPositions = true;
m_hasSecondItem = !bAuxText.IsEmpty();
m_parent = nullptr;
m_mainItemUuid = niluuid;
m_auxItemUuid = niluuid;
}
/**
* Function SetData
* initialize all data in item
* @param aErrorCode = error code
* @param aMainText = a description of the first (main) item
* @param aMainID = UUID of the main item
* @param bAuxText = a description of the second item
* @param bAuxID = UUID of the second item
*/
void SetData( int aErrorCode,
const wxString& aMainText, const KIID& aMainID,
const wxString& bAuxText, const KIID& bAuxID )
{
m_ErrorCode = aErrorCode;
m_MainText = aMainText;
m_AuxText = bAuxText;
m_hasPositions = false;
m_hasSecondItem = !bAuxText.IsEmpty() || bAuxID != niluuid;
m_parent = nullptr;
m_mainItemUuid = aMainID;
m_auxItemUuid = bAuxID;
}
/**
* Function SetAuxiliaryData
* initialize data for the second (auxiliary) item
@ -144,8 +218,8 @@ public:
*/
void SetAuxiliaryData( const wxString& aAuxiliaryText, const wxPoint& aAuxiliaryPos )
{
m_AuxiliaryText = aAuxiliaryText;
m_AuxiliaryPosition = aAuxiliaryPos;
m_AuxText = aAuxiliaryText;
m_AuxPosition = aAuxiliaryPos;
m_hasSecondItem = true;
m_auxItemUuid = niluuid;
}
@ -155,13 +229,13 @@ public:
bool HasSecondItem() const { return m_hasSecondItem; }
void SetShowNoCoordinate() { m_noCoordinate = true; }
bool HasPositions() { return m_hasPositions; }
/**
* Access to A and B texts
*/
wxString GetMainText() const { return m_MainText; }
wxString GetAuxiliaryText() const { return m_AuxiliaryText; }
wxString GetAuxiliaryText() const { return m_AuxText; }
/**
* Access to A and B items for BOARDs
@ -169,6 +243,9 @@ public:
BOARD_ITEM* GetMainItem( BOARD* aBoard ) const;
BOARD_ITEM* GetAuxiliaryItem( BOARD* aBoard ) const;
KIID GetMainItemID() const { return m_mainItemUuid; }
KIID GetAuxItemID() const { return m_auxItemUuid; }
/**
* Function ShowHtml
* translates this object into a fragment of HTML suitable for the wxHtmlListBox class.
@ -183,10 +260,7 @@ public:
*/
wxString ShowReport( EDA_UNITS aUnits ) const;
int GetErrorCode() const
{
return m_ErrorCode;
}
int GetErrorCode() const { return m_ErrorCode; }
/**
* Function GetErrorText
@ -195,10 +269,10 @@ public:
wxString GetErrorText() const;
const wxString& GetTextA() const { return m_MainText; }
const wxString& GetTextB() const { return m_AuxiliaryText; }
const wxString& GetTextB() const { return m_AuxText; }
const wxPoint& GetPointA() const { return m_MainPosition; }
const wxPoint& GetPointB() const { return m_AuxiliaryPosition; }
const wxPoint& GetPointB() const { return m_AuxPosition; }
/**
* Function ShowCoord

View File

@ -386,7 +386,7 @@ public:
* The base method do nothing
* @param aAskForSave = true to open a dialog before saving the settings
*/
virtual void SaveProjectSettings( bool aAskForSave ) {};
virtual void SaveProjectSettings() {};
// Read/Save and Import/export hotkeys config

View File

@ -193,7 +193,8 @@ enum GAL_LAYER_ID: int
LAYER_PADS_TH, ///< multilayer pads, usually with holes
LAYER_PADS_PLATEDHOLES, ///< to draw pad holes (plated)
LAYER_VIAS_HOLES, ///< to draw via holes (pad holes do not use this layer)
LAYER_DRC, ///< drc markers
LAYER_DRC_ERROR, ///< layer for drc markers with SEVERITY_ERROR
LAYER_DRC_WARNING, ///< layer for drc markers with SEVERITY_WARNING
LAYER_WORKSHEET, ///< worksheet frame
LAYER_GP_OVERLAY, ///< general purpose overlay
LAYER_SELECT_OVERLAY, ///< currently selected items overlay
@ -350,7 +351,6 @@ enum LAYER_3D_ID : int
// after loading a board for instance
#define MIN_VISIBILITY_MASK int( ( 1 << GAL_LAYER_INDEX( LAYER_PADS_PLATEDHOLES ) ) +\
( 1 << GAL_LAYER_INDEX( LAYER_VIAS_HOLES ) ) +\
( 1 << GAL_LAYER_INDEX( LAYER_DRC ) ) +\
( 1 << GAL_LAYER_INDEX( LAYER_SELECT_OVERLAY ) ) +\
( 1 << GAL_LAYER_INDEX( LAYER_GP_OVERLAY ) ) +\
( 1 << GAL_LAYER_INDEX( LAYER_RATSNEST ) ) )

View File

@ -38,13 +38,14 @@ class SHAPE_LINE_CHAIN;
class MARKER_BASE
{
public:
enum TYPEMARKER { // Marker type: can be used to identify the purpose of the marker
enum TYPEMARKER {
MARKER_UNSPEC,
MARKER_ERC,
MARKER_PCB,
MARKER_SIMUL
};
enum MARKER_SEVERITY { // Severity of the marker: this is the level of error
enum MARKER_SEVERITY {
MARKER_SEVERITY_UNSPEC,
MARKER_SEVERITY_INFO,
MARKER_SEVERITY_WARNING,
@ -54,13 +55,17 @@ public:
wxPoint m_Pos; ///< position of the marker
protected:
int m_ScalingFactor; ///< Scaling factor to convert corners coordinates
///< to internat units coordinates
TYPEMARKER m_MarkerType; ///< The type of marker (useful to filter markers)
MARKER_SEVERITY m_ErrorLevel; ///< Specify the severity of the error
COLOR4D m_Color; ///< color
EDA_RECT m_ShapeBoundingBox; ///< Bounding box of the graphic symbol, relative
///< to the position of the shape, in marker shape units
int m_ScalingFactor; // Scaling factor to convert corners coordinates
// to internat units coordinates
TYPEMARKER m_MarkerType; // The type of marker (useful to filter markers)
// JEY TODO: retire this; error levels come from DRC_ITEM
MARKER_SEVERITY m_ErrorLevel; // Specify the severity of the error (Eeschema only)
bool m_Excluded; // User has excluded this specific error
EDA_RECT m_ShapeBoundingBox; // Bounding box of the graphic symbol, relative
// to the position of the shape, in marker shape
// units
DRC_ITEM m_drc;
void init();
@ -79,8 +84,21 @@ public:
* @param bPos The position of the second of two objects
* @param aScalingFactor the scaling factor to convert the shape coordinates to IU coordinates
*/
MARKER_BASE( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos, EDA_ITEM* aItem,
const wxPoint& aPos, EDA_ITEM* bItem, const wxPoint& bPos, int aScalingFactor );
MARKER_BASE( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos,
EDA_ITEM* aItem, const wxPoint& aPos,
EDA_ITEM* bItem, const wxPoint& bPos, int aScalingFactor );
/**
* Constructor
* @param aErrorCode The categorizing identifier for an error
* @param aMarkerPos The position of the MARKER on the BOARD
* @param aItem The first of two objects
* @param bItem The second of the two conflicting objects
* @param aScalingFactor the scaling factor to convert the shape coordinates to IU coordinates
*/
MARKER_BASE( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos,
EDA_ITEM* aItem,
EDA_ITEM* bItem, int aScalingFactor );
/**
* Constructor
@ -100,12 +118,24 @@ public:
* Constructor
* @param aErrorCode The categorizing identifier for an error
* @param aMarkerPos The position of the MARKER on the BOARD
* @param aText Text describing the object
* @param aPos The position of the object
* @param aText Text describing the first of two objects
* @param bText Text describing the second of the two conflicting objects
* @param aScalingFactor the scaling factor to convert the shape coordinates to IU coordinates
*/
MARKER_BASE( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText, const wxPoint& aPos, int aScalingFactor );
const wxString& aText,
const wxString& bText, int aScalingFactor );
/**
* Constructor
* @param aErrorCode The categorizing identifier for an error
* @param aText Text describing the object
* @param bText Text describing the second of the two conflicting objects
* @param aScalingFactor the scaling factor to convert the shape coordinates to IU coordinates
*/
MARKER_BASE( int aErrorCode,
const wxString& aText,
const wxString& bText, int aScalingFactor );
/**
* Contructor
@ -115,7 +145,7 @@ public:
*/
MARKER_BASE( const MARKER_BASE& aMarker );
~MARKER_BASE();
virtual ~MARKER_BASE();
/** The scaling factor to convert polygonal shape coordinates to internal units
*/
@ -154,39 +184,17 @@ public:
return m_Pos;
}
/**
* Function SetColor
* Set the color of this marker
*/
void SetColor( COLOR4D aColor )
{
m_Color = aColor;
}
/**
* accessors to set/get error levels (warning, error, fatal error..)
*/
void SetErrorLevel( MARKER_SEVERITY aErrorLevel )
{
m_ErrorLevel = aErrorLevel;
}
void SetErrorLevel( MARKER_SEVERITY aErrorLevel ) { m_ErrorLevel = aErrorLevel; }
MARKER_SEVERITY GetErrorLevel() const { return m_ErrorLevel; }
MARKER_SEVERITY GetErrorLevel() const
{
return m_ErrorLevel;
}
/** accessors to set/get marker type (DRC, ERC, or other)
/**
* accessors to set/get marker type (DRC, ERC, or other)
*/
void SetMarkerType( enum TYPEMARKER aMarkerType )
{
m_MarkerType = aMarkerType;
}
enum TYPEMARKER GetMarkerType() const
{
return m_MarkerType;
}
void SetMarkerType( enum TYPEMARKER aMarkerType ) { m_MarkerType = aMarkerType; }
enum TYPEMARKER GetMarkerType() const { return m_MarkerType; }
/**
* Function SetData
@ -198,8 +206,9 @@ public:
* @param bItem The second of the two conflicting objects
* @param bPos The position of the second of two objects
*/
void SetData( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos, EDA_ITEM* aItem,
const wxPoint& aPos, EDA_ITEM* bItem = nullptr, const wxPoint& bPos = wxPoint() );
void SetData( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos,
EDA_ITEM* aItem, const wxPoint& aPos,
EDA_ITEM* bItem = nullptr, const wxPoint& bPos = wxPoint() );
/**
* Function SetData
@ -215,6 +224,38 @@ public:
const wxString& aText, const wxPoint& aPos,
const wxString& bText = wxEmptyString, const wxPoint& bPos = wxPoint() );
/**
* Function SetData
* fills in all the reportable data associated with a MARKER.
* @param aErrorCode The categorizing identifier for an error
* @param aMarkerPos The position of the MARKER on the BOARD
* @param aItem The first of two objects
* @param aPos The position of the first of two objects
* @param bItem The second of the two conflicting objects
* @param bPos The position of the second of two objects
*/
void SetData( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos,
EDA_ITEM* aItem,
EDA_ITEM* bItem = nullptr );
/**
* Function SetData
* fills in all the reportable data associated with a MARKER.
* @param aErrorCode The categorizing identifier for an error
* @param aMarkerPos The position of the MARKER on the BOARD
* @param aText Text describing the first of two objects
* @param aPos The position of the first of two objects
* @param bText Text describing the second of the two conflicting objects
* @param bPos The position of the second of two objects
*/
void SetData( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText,
const wxString& bText = wxEmptyString );
void SetData( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText, const KIID& aID,
const wxString& bText, const KIID& bID );
/**
* Function SetAuxiliaryData
* initialize data for the second (auxiliary) item
@ -227,10 +268,8 @@ public:
m_drc.SetAuxiliaryData( aAuxiliaryText, aAuxiliaryPos );
}
void SetShowNoCoordinate()
{
m_drc.SetShowNoCoordinate();
}
bool IsExcluded() const { return m_Excluded; }
void SetExcluded( bool aExcluded ) { m_Excluded = aExcluded; }
/**
* Function GetReporter
@ -238,10 +277,8 @@ public:
* interface may be used.
* @return const& DRC_ITEM
*/
const DRC_ITEM& GetReporter() const
{
return m_drc;
}
DRC_ITEM& GetReporter() { return m_drc; }
const DRC_ITEM& GetReporter() const { return m_drc; }
/**
* Function DisplayMarkerInfo
@ -264,6 +301,9 @@ public:
* It is OK to overestimate the size by a few counts.
*/
EDA_RECT GetBoundingBoxMarker() const;
protected:
virtual KIGFX::COLOR4D getColor() const = 0;
};

View File

@ -26,6 +26,7 @@
#define _REPORTER_H_
#include <wx/string.h>
#include <widgets/ui_common.h>
/**
* @file reporter.h
@ -61,26 +62,6 @@ class WX_HTML_REPORT_PANEL;
class REPORTER {
public:
/**
* Severity of the reported messages.
* Undefined are default status messages
* Info are processing messages for which no action is taken
* Action messages are items that modify the file(s) as expected
* Warning messages are items that might be problematic but don't prevent
* the process from completing
* Error messages are items that prevent the process from completing
*/
//
enum SEVERITY {
RPT_UNDEFINED = 0x0,
RPT_INFO = 0x1,
RPT_ACTION = 0x2,
RPT_WARNING = 0x4,
RPT_ERROR = 0x8
};
static constexpr int RPT_ALL = RPT_INFO | RPT_ACTION | RPT_WARNING | RPT_ERROR;
/**
* Location where the message is to be reported.
* LOC_HEAD messages are printed before all others (typically intro messages)
@ -102,13 +83,13 @@ public:
* RPT_ERROR, RPT_ACTION ) used to filter and format messages
*/
virtual REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) = 0;
virtual REPORTER& Report( const wxString& aText, SEVERITY aSeverity = SEVERITY_UNDEFINED ) = 0;
/**
* Function ReportTail
* Places the report at the end of the list, for objects that support report ordering
*/
virtual REPORTER& ReportTail( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED )
virtual REPORTER& ReportTail( const wxString& aText, SEVERITY aSeverity = SEVERITY_UNDEFINED )
{
return Report( aText, aSeverity );
}
@ -117,12 +98,12 @@ public:
* Function ReportHead
* Places the report at the beginning of the list for objects that support ordering
*/
virtual REPORTER& ReportHead( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED )
virtual REPORTER& ReportHead( const wxString& aText, SEVERITY aSeverity = SEVERITY_UNDEFINED )
{
return Report( aText, aSeverity );
}
REPORTER& Report( const char* aText, SEVERITY aSeverity = RPT_UNDEFINED );
REPORTER& Report( const char* aText, SEVERITY aSeverity = SEVERITY_UNDEFINED );
REPORTER& operator <<( const wxString& aText ) { return Report( aText ); }
REPORTER& operator <<( const wxChar* aText ) { return Report( wxString( aText ) ); }
@ -160,7 +141,7 @@ public:
{
}
REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override;
REPORTER& Report( const wxString& aText, SEVERITY aSeverity = SEVERITY_UNDEFINED ) override;
bool HasMessage() const override;
};
@ -185,7 +166,7 @@ public:
{
}
REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override;
REPORTER& Report( const wxString& aText, SEVERITY aSeverity = SEVERITY_UNDEFINED ) override;
bool HasMessage() const override;
};
@ -210,11 +191,11 @@ public:
{
}
REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override;
REPORTER& Report( const wxString& aText, SEVERITY aSeverity = SEVERITY_UNDEFINED ) override;
REPORTER& ReportTail( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override;
REPORTER& ReportTail( const wxString& aText, SEVERITY aSeverity = SEVERITY_UNDEFINED ) override;
REPORTER& ReportHead( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override;
REPORTER& ReportHead( const wxString& aText, SEVERITY aSeverity = SEVERITY_UNDEFINED ) override;
bool HasMessage() const override;
};
@ -238,7 +219,7 @@ public:
static REPORTER& GetInstance();
REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override;
REPORTER& Report( const wxString& aText, SEVERITY aSeverity = SEVERITY_UNDEFINED ) override;
bool HasMessage() const override { return false; }
};
@ -261,7 +242,7 @@ public:
static REPORTER& GetInstance();
REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override;
REPORTER& Report( const wxString& aText, SEVERITY aSeverity = SEVERITY_UNDEFINED ) override;
bool HasMessage() const override { return false; }
};

View File

@ -26,6 +26,9 @@
#ifndef UI_COMMON_H
#define UI_COMMON_H
#include <wx/wx.h>
namespace KIUI
{
@ -38,4 +41,19 @@ int GetStdMargin();
}
enum SEVERITY {
SEVERITY_UNDEFINED = 0x00,
SEVERITY_INFO = 0x01,
SEVERITY_EXCLUSION = 0x02,
SEVERITY_ACTION = 0x04,
SEVERITY_WARNING = 0x08,
SEVERITY_ERROR = 0x10,
SEVERITY_IGNORE = 0x20
};
wxBitmap MakeBadge( SEVERITY aStyle, int aCount, wxWindow* aWindow, int aDepth = 1 );
#endif // UI_COMMON_H

View File

@ -168,6 +168,7 @@ set( PCBNEW_DIALOGS
dialogs/panel_setup_text_and_graphics_base.cpp
dialogs/panel_setup_tracks_and_vias.cpp
dialogs/panel_setup_tracks_and_vias_base.cpp
dialogs/panel_setup_drc_severities.cpp
footprint_wizard.cpp
footprint_wizard_frame.cpp
footprint_wizard_frame_functions.cpp
@ -228,8 +229,6 @@ set( PCBNEW_DRC_SRCS
drc/courtyard_overlap.cpp
drc/drc.cpp
drc/drc_clearance_test_functions.cpp
drc/drc_marker_factory.cpp
drc/drc_provider.cpp
drc/drc_tree_model.cpp
)

View File

@ -34,7 +34,8 @@
#include <kiface_i.h>
#include <pcbnew.h>
#include <board_design_settings.h>
#include <drc/drc.h>
#include <widgets/ui_common.h>
#define CopperLayerCountKey wxT( "CopperLayerCount" )
#define BoardThicknessKey wxT( "BoardThickness" )
@ -56,6 +57,74 @@
#define dPairViaGapKey wxT( "dPairViaGap" )
class PARAM_CFG_SEVERITIES : public PARAM_CFG
{
protected:
BOARD* m_Pt_param; ///< Pointer to the parameter value
public:
PARAM_CFG_SEVERITIES( BOARD* ptparam, const wxChar* group = nullptr ) :
PARAM_CFG( wxEmptyString, PARAM_SEVERITIES, group )
{
m_Pt_param = ptparam;
}
void ReadParam( wxConfigBase* aConfig ) const override
{
if( !m_Pt_param || !aConfig )
return;
BOARD* board = m_Pt_param;
BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
wxString oldPath = aConfig->GetPath();
// Read legacy settings first so that modern settings will overwrite them
bool flag;
if( aConfig->Read( wxT( "RequireCourtyardDefinitions" ), &flag, false ) )
{
if( flag )
bds.m_DRCSeverities[ DRCE_MISSING_COURTYARD_IN_FOOTPRINT ] = SEVERITY_ERROR;
else
bds.m_DRCSeverities[ DRCE_MISSING_COURTYARD_IN_FOOTPRINT ] = SEVERITY_IGNORE;
}
if( aConfig->Read( wxT( "ProhibitOverlappingCourtyards" ), &flag, false ) )
{
if( flag )
bds.m_DRCSeverities[ DRCE_OVERLAPPING_FOOTPRINTS ] = SEVERITY_ERROR;
else
bds.m_DRCSeverities[ DRCE_OVERLAPPING_FOOTPRINTS ] = SEVERITY_IGNORE;
}
// TO DO: figure out what we're going to use as keys here so we can read/write these....
aConfig->SetPath( oldPath );
}
void SaveParam( wxConfigBase* aConfig ) const override
{
if( !m_Pt_param || !aConfig )
return;
BOARD* board = m_Pt_param;
BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
wxString oldPath = aConfig->GetPath();
// TO DO: figure out what we're going to use as keys here so we can read/write these....
// TO DO: for now just write out the legacy ones so we don't lose them
// TO DO: remove this once the new scheme is in place
aConfig->Write( wxT( "RequireCourtyardDefinitions" ),
bds.m_DRCSeverities[ DRCE_MISSING_COURTYARD_IN_FOOTPRINT ] != SEVERITY_IGNORE );
aConfig->Write( wxT( "ProhibitOverlappingCourtyards" ),
bds.m_DRCSeverities[ DRCE_OVERLAPPING_FOOTPRINTS ] != SEVERITY_IGNORE );
aConfig->SetPath( oldPath );
}
};
//
// NOTE: layer configuration info is stored in both the BOARD and BOARD_DESIGN_SETTINGS so one
// of the two needs to read/write the config so we don't end up with order dependency issues.
@ -501,6 +570,11 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
m_CopperEdgeClearance = Millimeter2iu( DEFAULT_COPPEREDGECLEARANCE );
m_HoleToHoleMin = Millimeter2iu( DEFAULT_HOLETOHOLEMIN );
for( int errorCode = DRCE_FIRST; errorCode <= DRCE_LAST; ++errorCode )
m_DRCSeverities[ errorCode ] = SEVERITY_ERROR;
m_DRCSeverities[ DRCE_MISSING_COURTYARD_IN_FOOTPRINT ] = SEVERITY_IGNORE;
m_MaxError = ARC_HIGH_DEF;
m_ZoneUseNoOutlineInFill = false; // Use compatibility mode by default
@ -518,10 +592,6 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
m_trackWidthIndex = 0;
m_diffPairIndex = 0;
// Courtyard defaults
m_RequireCourtyards = false;
m_ProhibitOverlappingCourtyards = true;
// Default ref text on fp creation. If empty, use footprint name as default
m_RefDefaultText = "REF**";
m_RefDefaultVisibility = true;
@ -544,12 +614,6 @@ void BOARD_DESIGN_SETTINGS::AppendConfigs( BOARD* aBoard, std::vector<PARAM_CFG*
aResult->push_back( new PARAM_CFG_BOOL( wxT( "AllowBlindVias" ),
&m_BlindBuriedViaAllowed, false ) );
aResult->push_back( new PARAM_CFG_BOOL( wxT( "RequireCourtyardDefinitions" ),
&m_RequireCourtyards, false ) );
aResult->push_back( new PARAM_CFG_BOOL( wxT( "ProhibitOverlappingCourtyards" ),
&m_ProhibitOverlappingCourtyards, true ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinTrackWidth" ),
&m_TrackMinWidth,
Millimeter2iu( DEFAULT_TRACKMINWIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ),
@ -580,6 +644,8 @@ void BOARD_DESIGN_SETTINGS::AppendConfigs( BOARD* aBoard, std::vector<PARAM_CFG*
Millimeter2iu( DEFAULT_HOLETOHOLEMIN ), Millimeter2iu( 0.0 ), Millimeter2iu( 10.0 ),
nullptr, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_SEVERITIES( aBoard ) );
// Note: a clearance of -0.01 is a flag indicating we should use the legacy (pre-6.0) method
// based on the edge cut thicknesses.
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "CopperEdgeClearance" ),
@ -707,6 +773,18 @@ void BOARD_DESIGN_SETTINGS::AppendConfigs( BOARD* aBoard, std::vector<PARAM_CFG*
}
int BOARD_DESIGN_SETTINGS::GetSeverity( int aDRCErrorCode )
{
return m_DRCSeverities[ aDRCErrorCode ];
}
bool BOARD_DESIGN_SETTINGS::Ignore( int aDRCErrorCode )
{
return m_DRCSeverities[ aDRCErrorCode ] == SEVERITY_IGNORE;
}
bool BOARD_DESIGN_SETTINGS::SetCurrentNetClass( const wxString& aNetClassName )
{
NETCLASSPTR netClass = m_NetClasses.Find( aNetClassName );
@ -881,18 +959,6 @@ void BOARD_DESIGN_SETTINGS::SetCopperEdgeClearance( int aDistance )
}
void BOARD_DESIGN_SETTINGS::SetRequireCourtyardDefinitions( bool aRequire )
{
m_RequireCourtyards = aRequire;
}
void BOARD_DESIGN_SETTINGS::SetProhibitOverlappingCourtyards( bool aProhibit )
{
m_ProhibitOverlappingCourtyards = aProhibit;
}
void BOARD_DESIGN_SETTINGS::SetVisibleAlls()
{
SetVisibleLayers( LSET().set() );

View File

@ -645,24 +645,31 @@ void BOARD::Remove( BOARD_ITEM* aBoardItem )
case PCB_MODULE_T:
m_modules.erase( std::remove_if( m_modules.begin(), m_modules.end(),
[aBoardItem]( BOARD_ITEM* aItem ) { return aItem == aBoardItem; } ) );
[aBoardItem]( BOARD_ITEM* aItem )
{
return aItem == aBoardItem;
} ) );
break;
case PCB_TRACE_T:
case PCB_ARC_T:
case PCB_VIA_T:
m_tracks.erase( std::remove_if( m_tracks.begin(), m_tracks.end(),
[aBoardItem]( BOARD_ITEM* aItem ) { return aItem == aBoardItem; } ) );
[aBoardItem]( BOARD_ITEM* aItem )
{
return aItem == aBoardItem;
} ) );
break;
case PCB_DIMENSION_T:
case PCB_LINE_T:
case PCB_TEXT_T:
case PCB_TARGET_T:
m_drawings.erase(
std::remove_if( m_drawings.begin(), m_drawings.end(),
m_drawings.erase( std::remove_if( m_drawings.begin(), m_drawings.end(),
[aBoardItem](BOARD_ITEM* aItem)
{ return aItem == aBoardItem;} ) );
{
return aItem == aBoardItem;
} ) );
break;
// other types may use linked list

View File

@ -245,6 +245,11 @@ public:
return m_ZoneDescriptorList;
}
MARKERS& Markers()
{
return m_markers;
}
const std::vector<BOARD_CONNECTED_ITEM*> AllConnectedItems();
/// zone contour currently in progress
@ -310,7 +315,6 @@ public:
*/
void BuildConnectivity();
/**
* Function DeleteMARKERs
* deletes ALL MARKERS from the board.
@ -323,29 +327,6 @@ public:
*/
void DeleteZONEOutlines();
/**
* Function GetMARKER
* returns the MARKER at a given index.
* @param index The array type index into a collection of MARKER_PCBS.
* @return MARKER_PCB* - a pointer to the MARKER_PCB or NULL if index out of range.
*/
MARKER_PCB* GetMARKER( int index ) const
{
if( (unsigned) index < m_markers.size() )
return m_markers[index];
return NULL;
}
/**
* Function GetMARKERCount
* @return int - The number of MARKER_PCBS.
*/
int GetMARKERCount() const
{
return (int) m_markers.size();
}
/**
* Function SetAuxOrigin
* sets the origin point used for plotting.

View File

@ -1,8 +1,3 @@
/**
* @file class_marker_pcb.cpp
* @brief Functions to handle markers used to show something (usually a drc problem)
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
@ -35,8 +30,15 @@
#include <bitmaps.h>
#include <base_units.h>
#include <pcbnew.h>
#include <class_board.h>
#include <class_board_item.h>
#include <class_marker_pcb.h>
#include <board_design_settings.h>
#include <layers_id_colors_and_visibility.h>
#include <settings/color_settings.h>
#include <settings/settings_manager.h>
#include <widgets/ui_common.h>
#include <pgm_base.h>
/// Factor to convert the maker unit shape to internal units:
@ -46,17 +48,26 @@ MARKER_PCB::MARKER_PCB( BOARD_ITEM* aParent ) :
BOARD_ITEM( aParent, PCB_MARKER_T ),
MARKER_BASE( SCALING_FACTOR ), m_item( nullptr )
{
m_Color = WHITE;
}
MARKER_PCB::MARKER_PCB( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos,
BOARD_ITEM* aItem, const wxPoint& aPos, BOARD_ITEM* bItem, const wxPoint& bPos )
: BOARD_ITEM( nullptr, PCB_MARKER_T ), // parent set during BOARD::Add()
BOARD_ITEM* aItem,
BOARD_ITEM* bItem ) :
BOARD_ITEM( nullptr, PCB_MARKER_T ), // parent set during BOARD::Add()
MARKER_BASE( aUnits, aErrorCode, aMarkerPos, aItem, bItem, SCALING_FACTOR ),
m_item( nullptr )
{
}
MARKER_PCB::MARKER_PCB( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos,
BOARD_ITEM* aItem, const wxPoint& aPos,
BOARD_ITEM* bItem, const wxPoint& bPos ) :
BOARD_ITEM( nullptr, PCB_MARKER_T ), // parent set during BOARD::Add()
MARKER_BASE( aUnits, aErrorCode, aMarkerPos, aItem, aPos, bItem, bPos, SCALING_FACTOR ),
m_item( nullptr )
{
m_Color = WHITE;
}
@ -66,7 +77,15 @@ MARKER_PCB::MARKER_PCB( int aErrorCode, const wxPoint& aMarkerPos,
BOARD_ITEM( nullptr, PCB_MARKER_T ), // parent set during BOARD::Add()
MARKER_BASE( aErrorCode, aMarkerPos, aText, aPos, bText, bPos, SCALING_FACTOR ), m_item( nullptr )
{
m_Color = WHITE;
}
MARKER_PCB::MARKER_PCB( int aErrorCode,
const wxString& aText,
const wxString& bText) :
BOARD_ITEM( nullptr, PCB_MARKER_T ), // parent set during BOARD::Add()
MARKER_BASE( aErrorCode, aText, bText, SCALING_FACTOR ), m_item( nullptr )
{
}
@ -75,6 +94,34 @@ MARKER_PCB::~MARKER_PCB()
{
}
wxString MARKER_PCB::Serialize() const
{
return wxString::Format( wxT( "%d|%d|%d|%s|%s|%s|%s" ),
m_drc.GetErrorCode(),
m_Pos.x,
m_Pos.y,
m_drc.GetMainText(),
m_drc.GetMainItemID().AsString(),
m_drc.GetAuxiliaryText(),
m_drc.GetAuxItemID().AsString() );
}
MARKER_PCB* MARKER_PCB::Deserialize( const wxString& data )
{
wxArrayString props = wxSplit( data, '|' );
int errorCode = (int) strtol( props[0].c_str(), nullptr, 10 );
MARKER_PCB* marker = new MARKER_PCB( nullptr ); // parent set during BOARD::Add()
marker->m_Pos.x = (int) strtol( props[1].c_str(), nullptr, 10 );
marker->m_Pos.y = (int) strtol( props[2].c_str(), nullptr, 10 );
marker->m_drc.SetData( errorCode, props[3], KIID( props[4] ), props[5], KIID( props[6] ) );
marker->m_drc.SetParent( marker );
return marker;
}
/* tests to see if this object is on the given layer.
* DRC markers are not really on a copper layer, but
* MARKER_PCB::IsOnCopperLayer return true if aLayer is a cooper layer,
@ -87,22 +134,14 @@ bool MARKER_PCB::IsOnLayer( PCB_LAYER_ID aLayer ) const
return IsCopperLayer( aLayer );
}
void MARKER_PCB::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList )
{
wxString errorTxt, txtA, txtB;
aList.emplace_back( MSG_PANEL_ITEM( _( "Type" ), _( "Marker" ), DARKCYAN ) );
errorTxt.Printf( _( "ErrType (%d)- %s:" ), m_drc.GetErrorCode(), m_drc.GetErrorText() );
aList.emplace_back( MSG_PANEL_ITEM( _( "Violation" ), m_drc.GetErrorText(), RED ) );
aList.emplace_back( MSG_PANEL_ITEM( errorTxt, wxEmptyString, RED ) );
txtA.Printf( wxT( "%s: %s" ), DRC_ITEM::ShowCoord( aUnits, m_drc.GetPointA() ), m_drc.GetTextA() );
if( m_drc.HasSecondItem() )
txtB.Printf( wxT( "%s: %s" ), DRC_ITEM::ShowCoord( aUnits, m_drc.GetPointB() ), m_drc.GetTextB() );
aList.emplace_back( MSG_PANEL_ITEM( txtA, txtB, DARKBROWN ) );
aList.emplace_back( MSG_PANEL_ITEM( m_drc.GetTextA(), m_drc.GetTextB(), DARKBROWN ) );
}
@ -123,9 +162,7 @@ void MARKER_PCB::Flip(const wxPoint& aCentre, bool aFlipLeftRight )
wxString MARKER_PCB::GetSelectMenuText( EDA_UNITS aUnits ) const
{
return wxString::Format( _( "Marker @(%s, %s)" ),
MessageTextFromValue( aUnits, m_Pos.x ),
MessageTextFromValue( aUnits, m_Pos.y ) );
return wxString::Format( _( "Marker (%s)" ), GetReporter().GetErrorText() );
}
@ -138,8 +175,50 @@ BITMAP_DEF MARKER_PCB::GetMenuImage() const
void MARKER_PCB::ViewGetLayers( int aLayers[], int& aCount ) const
{
aCount = 1;
aLayers[0] = LAYER_DRC;
BOARD_ITEM_CONTAINER* ancestor = GetParent();
while( ancestor->GetParent() )
ancestor = ancestor->GetParent();
BOARD* board = static_cast<BOARD*>( ancestor );
switch( board->GetDesignSettings().GetSeverity( m_drc.GetErrorCode() ) )
{
default:
case SEVERITY::SEVERITY_ERROR: aLayers[0] = LAYER_DRC_ERROR; break;
case SEVERITY::SEVERITY_WARNING: aLayers[0] = LAYER_DRC_WARNING; break;
}
}
GAL_LAYER_ID MARKER_PCB::GetColorLayer() const
{
if( IsExcluded() )
return LAYER_AUX_ITEMS;
BOARD_ITEM_CONTAINER* ancestor = GetParent();
while( ancestor->GetParent() )
ancestor = ancestor->GetParent();
BOARD* board = static_cast<BOARD*>( ancestor );
switch( board->GetDesignSettings().GetSeverity( m_drc.GetErrorCode() ) )
{
default:
case SEVERITY::SEVERITY_ERROR: return LAYER_DRC_ERROR;
case SEVERITY::SEVERITY_WARNING: return LAYER_DRC_WARNING;
}
}
KIGFX::COLOR4D MARKER_PCB::getColor() const
{
COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
return colors->GetColor( GetColorLayer() );
}
const EDA_RECT MARKER_PCB::GetBoundingBox() const
{

View File

@ -46,6 +46,17 @@ public:
MARKER_PCB( BOARD_ITEM* aParent );
/**
* Constructor
* @param aErrorCode The categorizing identifier for an error
* @param aMarkerPos The position of the MARKER_PCB on the BOARD
* @param aItem The first of two objects
* @param bItem The second of the two conflicting objects
*/
MARKER_PCB( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos,
BOARD_ITEM* aItem,
BOARD_ITEM* bItem = nullptr );
/**
* Constructor
* @param aErrorCode The categorizing identifier for an error
@ -55,8 +66,9 @@ public:
* @param bItem The second of the two conflicting objects
* @param bPos The position of the second of two objects
*/
MARKER_PCB( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos, BOARD_ITEM* aItem,
const wxPoint& aPos, BOARD_ITEM* bItem = nullptr, const wxPoint& bPos = wxPoint() );
MARKER_PCB( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos,
BOARD_ITEM* aItem, const wxPoint& aPos,
BOARD_ITEM* bItem = nullptr, const wxPoint& bPos = wxPoint() );
/**
* Constructor
@ -71,6 +83,17 @@ public:
const wxString& aText, const wxPoint& aPos,
const wxString& bText = wxEmptyString, const wxPoint& bPos = wxPoint() );
/**
* Constructor
* @param aErrorCode The categorizing identifier for an error
* @param aMarkerPos The position of the MARKER_PCB on the BOARD
* @param aText Text describing the first of two objects
* @param bText Text describing the second of the two conflicting objects
*/
MARKER_PCB( int aErrorCode,
const wxString& aText,
const wxString& bText = wxEmptyString );
~MARKER_PCB();
static inline bool ClassOf( const EDA_ITEM* aItem )
@ -78,6 +101,10 @@ public:
return aItem && PCB_MARKER_T == aItem->Type();
}
wxString Serialize() const;
static MARKER_PCB* Deserialize( const wxString& data );
void Move(const wxPoint& aMoveVector) override
{
m_Pos += aMoveVector;
@ -102,6 +129,8 @@ public:
bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
GAL_LAYER_ID GetColorLayer() const;
void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override
@ -131,6 +160,9 @@ public:
return wxT( "MARKER_PCB" );
}
protected:
KIGFX::COLOR4D getColor() const override;
protected:
///> Pointer to BOARD_ITEM that causes DRC error.
const BOARD_ITEM* m_item;

View File

@ -28,6 +28,7 @@
#include "dialog_import_settings.h"
#include "dialog_board_setup.h"
#include "panel_setup_drc_severities.h"
DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) :
PAGED_DIALOG( aFrame, _( "Board Setup" ), _( "Import Settings from Another Project..." ) ),
@ -40,6 +41,7 @@ DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) :
m_tracksAndVias = new PANEL_SETUP_TRACKS_AND_VIAS( this, aFrame, m_constraints );
m_maskAndPaste = new PANEL_SETUP_MASK_AND_PASTE( this, aFrame );
m_physicalStackup = new PANEL_SETUP_BOARD_STACKUP( this, aFrame, m_layers );
m_drcSeverities = new PANEL_SETUP_DRC_SEVERITIES( this, aFrame );
/*
* WARNING: If you change page names you MUST update calls to DoShowBoardSetupDialog().
@ -59,6 +61,7 @@ DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) :
m_treebook->AddPage( new wxPanel( this ), _( "Design Rules" ) );
m_treebook->AddSubPage( m_constraints, _( "Constraints" ) );
m_treebook->AddSubPage( m_netclasses, _( "Net Classes" ) );
m_treebook->AddSubPage( m_drcSeverities, _( "Violation Severity" ) );
// Connect Events
m_treebook->Connect( wxEVT_TREEBOOK_PAGE_CHANGED,

View File

@ -22,6 +22,7 @@
#define KICAD_DIALOG_BOARD_SETUP_H
#include <widgets/paged_dialog.h>
#include "panel_setup_drc_severities.h"
class PCB_EDIT_FRAME;
class PANEL_SETUP_FEATURE_CONSTRAINTS;
@ -51,6 +52,7 @@ protected:
PANEL_SETUP_TRACKS_AND_VIAS* m_tracksAndVias;
PANEL_SETUP_MASK_AND_PASTE* m_maskAndPaste;
PANEL_SETUP_BOARD_STACKUP* m_physicalStackup;
PANEL_SETUP_DRC_SEVERITIES* m_drcSeverities;
// event handlers
void OnPageChange( wxBookCtrlEvent& event );

View File

@ -46,7 +46,7 @@ DIALOG_CLEANUP_TRACKS_AND_VIAS::DIALOG_CLEANUP_TRACKS_AND_VIAS( PCB_EDIT_FRAME*
m_cleanShortCircuitOpt->SetValue( cfg->m_Cleanup.cleanup_short_circuits );
m_deleteTracksInPadsOpt->SetValue( cfg->m_Cleanup.cleanup_tracks_in_pad );
m_changesTreeModel = new DRC_TREE_MODEL( m_changesDataView );
m_changesTreeModel = new DRC_TREE_MODEL( m_parentFrame, m_changesDataView );
m_changesDataView->AssociateModel( m_changesTreeModel );
// We use a sdbSizer to get platform-dependent ordering of the action buttons, but
@ -124,7 +124,8 @@ void DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup( bool aDryRun )
if( aDryRun )
{
m_changesTreeModel->SetProvider( new VECTOR_DRC_ITEMS_PROVIDER( &m_items ) );
DRC_ITEMS_PROVIDER* provider = new VECTOR_DRC_ITEMS_PROVIDER( m_parentFrame, &m_items );
m_changesTreeModel->SetProvider( provider );
}
else if( modified )
{

View File

@ -38,14 +38,21 @@
#include <wildcards_and_files_ext.h>
#include <drc/drc_tree_model.h>
#include <wx/wupdlock.h>
#include <widgets/ui_common.h>
DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* aEditorFrame,
wxWindow* aParent ) :
DIALOG_DRC_CONTROL_BASE( aParent ),
m_trackMinWidth( aEditorFrame, m_MinWidthLabel, m_MinWidthCtrl, m_MinWidthUnits, true ),
m_viaMinSize( aEditorFrame, m_ViaMinLabel, m_ViaMinCtrl, m_ViaMinUnits, true ),
m_uviaMinSize( aEditorFrame, m_uViaMinLabel, m_uViaMinCtrl, m_uViaMinUnits, true )
m_uviaMinSize( aEditorFrame, m_uViaMinLabel, m_uViaMinCtrl, m_uViaMinUnits, true ),
m_markersProvider( nullptr ),
m_markerTreeModel( nullptr ),
m_unconnectedItemsProvider( nullptr ),
m_unconnectedTreeModel( nullptr ),
m_footprintWarningsProvider( nullptr ),
m_footprintWarningsTreeModel( nullptr ),
m_severities( SEVERITY_ERROR | SEVERITY_WARNING )
{
SetName( DIALOG_DRC_WINDOW_NAME ); // Set a window name to be able to find it
@ -54,14 +61,14 @@ DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* aEditorFra
m_currentBoard = m_brdEditor->GetBoard();
m_BrdSettings = m_brdEditor->GetBoard()->GetDesignSettings();
m_markerTreeModel = new DRC_TREE_MODEL( m_markerDataView );
m_markerTreeModel = new DRC_TREE_MODEL( m_brdEditor, m_markerDataView );
m_markerDataView->AssociateModel( m_markerTreeModel );
m_unconnectedTreeModel = new DRC_TREE_MODEL( m_unconnectedDataView );
m_unconnectedTreeModel = new DRC_TREE_MODEL( m_brdEditor, m_unconnectedDataView );
m_unconnectedDataView->AssociateModel( m_unconnectedTreeModel );
m_footprintsTreeModel = new DRC_TREE_MODEL( m_footprintsDataView );
m_footprintsDataView->AssociateModel( m_footprintsTreeModel );
m_footprintWarningsTreeModel = new DRC_TREE_MODEL( m_brdEditor, m_footprintsDataView );
m_footprintsDataView->AssociateModel( m_footprintWarningsTreeModel );
m_Notebook->SetSelection( 0 );
@ -73,6 +80,7 @@ DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* aEditorFra
m_sdbSizer1OK->SetDefault();
initValues();
syncCheckboxes();
FinishDialogSettings();
}
@ -94,6 +102,10 @@ DIALOG_DRC_CONTROL::~DIALOG_DRC_CONTROL()
void DIALOG_DRC_CONTROL::SetSettings( int aSeverities )
{
m_severities = aSeverities;
m_markerTreeModel->SetSeverities( m_severities );
m_unconnectedTreeModel->SetSeverities( m_severities );
m_footprintWarningsTreeModel->SetSeverities( m_severities );
}
@ -103,7 +115,7 @@ void DIALOG_DRC_CONTROL::GetSettings( int* aSeverities )
}
void DIALOG_DRC_CONTROL::OnActivateDlg( wxActivateEvent& event )
void DIALOG_DRC_CONTROL::OnActivateDlg( wxActivateEvent& aEvent )
{
if( m_currentBoard != m_brdEditor->GetBoard() )
{
@ -121,6 +133,11 @@ void DIALOG_DRC_CONTROL::OnActivateDlg( wxActivateEvent& event )
// because the dialog is not modal
m_BrdSettings = m_brdEditor->GetBoard()->GetDesignSettings();
displayDRCValues();
m_markerTreeModel->SetProvider( m_markersProvider );
m_unconnectedTreeModel->SetProvider( m_unconnectedItemsProvider );
m_footprintWarningsTreeModel->SetProvider( m_footprintWarningsProvider );
updateDisplayedCounts();
}
@ -162,16 +179,20 @@ void DIALOG_DRC_CONTROL::setDRCParameters()
}
// Don't globally define this; different facilities use different definitions of "ALL"
static int SEVERITY_ALL = SEVERITY_WARNING | SEVERITY_ERROR | SEVERITY_EXCLUSION;
void DIALOG_DRC_CONTROL::syncCheckboxes()
{
m_showAll->SetValue( m_severities == ( DRC_SHOW_ERRORS | DRC_SHOW_WARNINGS | DRC_SHOW_INFOS ) );
m_showErrors->SetValue( m_severities & DRC_SHOW_ERRORS );
m_showWarnings->SetValue( m_severities & DRC_SHOW_WARNINGS );
m_showInfos->SetValue( m_severities & DRC_SHOW_INFOS );
m_showAll->SetValue( m_severities == SEVERITY_ALL );
m_showErrors->SetValue( m_severities & SEVERITY_ERROR );
m_showWarnings->SetValue( m_severities & SEVERITY_WARNING );
m_showExclusions->SetValue( m_severities & SEVERITY_EXCLUSION );
}
void DIALOG_DRC_CONTROL::OnRunDRCClick( wxCommandEvent& event )
void DIALOG_DRC_CONTROL::OnRunDRCClick( wxCommandEvent& aEvent )
{
setDRCParameters();
m_tester->m_doZonesTest = m_cbReportTracksToZonesErrors->GetValue();
@ -179,7 +200,8 @@ void DIALOG_DRC_CONTROL::OnRunDRCClick( wxCommandEvent& event )
m_tester->m_reportAllTrackErrors = m_cbReportAllTrackErrors->GetValue();
m_tester->m_testFootprints = m_cbTestFootprints->GetValue();
DelDRCMarkers();
m_brdEditor->RecordDRCExclusions();
deleteAllMarkers();
wxBeginBusyCursor();
wxWindowDisabler disabler;
@ -188,48 +210,56 @@ void DIALOG_DRC_CONTROL::OnRunDRCClick( wxCommandEvent& event )
m_Messages->Clear();
wxSafeYield(); // Allows time slice to refresh the Messages
m_tester->RunTests( m_Messages );
m_Notebook->ChangeSelection( 0 ); // display the "Problems/Markers" tab
wxEndBusyCursor();
RefreshBoardEditor();
refreshBoardEditor();
SetFocus();
m_Notebook->GetPage( m_Notebook->GetSelection() )->SetFocus();
}
void DIALOG_DRC_CONTROL::SetMarkersProvider( DRC_ITEMS_PROVIDER* aProvider )
{
m_markerTreeModel->SetProvider( aProvider );
m_markersProvider = aProvider;
m_markerTreeModel->SetProvider( m_markersProvider );
updateDisplayedCounts();
}
void DIALOG_DRC_CONTROL::SetUnconnectedProvider(class DRC_ITEMS_PROVIDER * aProvider )
{
m_unconnectedTreeModel->SetProvider( aProvider );
m_unconnectedItemsProvider = aProvider;
m_unconnectedTreeModel->SetProvider( m_unconnectedItemsProvider );
updateDisplayedCounts();
}
void DIALOG_DRC_CONTROL::SetFootprintsProvider( DRC_ITEMS_PROVIDER* aProvider )
{
m_footprintsTreeModel->SetProvider( aProvider );
m_footprintWarningsProvider = aProvider;
m_footprintWarningsTreeModel->SetProvider( m_footprintWarningsProvider );
updateDisplayedCounts();
}
void DIALOG_DRC_CONTROL::OnDRCItemSelected( wxDataViewEvent& event )
void DIALOG_DRC_CONTROL::OnDRCItemSelected( wxDataViewEvent& aEvent )
{
BOARD_ITEM* item = DRC_TREE_MODEL::ToBoardItem( m_brdEditor->GetBoard(), event.GetItem() );
BOARD_ITEM* item = DRC_TREE_MODEL::ToBoardItem( m_brdEditor->GetBoard(), aEvent.GetItem() );
WINDOW_THAWER thawer( m_brdEditor );
m_brdEditor->FocusOnItem( item );
m_brdEditor->GetCanvas()->Refresh();
event.Skip();
aEvent.Skip();
}
void DIALOG_DRC_CONTROL::OnDRCItemDClick( wxDataViewEvent& event )
void DIALOG_DRC_CONTROL::OnDRCItemDClick( wxDataViewEvent& aEvent )
{
if( event.GetItem().IsOk() )
if( aEvent.GetItem().IsOk() )
{
// turn control over to m_brdEditor, hide this DIALOG_DRC_CONTROL window,
// no destruction so we can preserve listbox cursor
@ -237,43 +267,153 @@ void DIALOG_DRC_CONTROL::OnDRCItemDClick( wxDataViewEvent& event )
Show( false );
}
event.Skip();
aEvent.Skip();
}
void DIALOG_DRC_CONTROL::OnSeverity( wxCommandEvent& event )
void DIALOG_DRC_CONTROL::OnDRCItemRClick( wxDataViewEvent& aEvent )
{
DRC_TREE_NODE* node = DRC_TREE_MODEL::ToNode( aEvent.GetItem() );
if( !node )
return;
DRC_ITEM* drcItem = node->m_DrcItem;
wxString listName;
wxMenu menu;
switch( m_BrdSettings.m_DRCSeverities[ drcItem->GetErrorCode() ] )
{
case SEVERITY_ERROR: listName = _( "errors" ); break;
case SEVERITY_WARNING: listName = _( "warnings" ); break;
default: listName = _( "appropriate" ); break;
}
if( drcItem->GetParent()->IsExcluded() )
{
menu.Append( 1, _( "Remove exclusion for this violation" ),
wxString::Format( _( "It will be placed back in the %s list" ), listName ) );
}
else
{
menu.Append( 2, _( "Exclude this violation" ),
wxString::Format( _( "It will be excluded from the %s list" ), listName ) );
}
menu.AppendSeparator();
if( m_BrdSettings.m_DRCSeverities[ drcItem->GetErrorCode() ] == SEVERITY_WARNING )
{
menu.Append( 3, wxString::Format( _( "Change severity to Error for all '%s' violations" ),
drcItem->GetErrorText(),
_( "Violation severities can also be edited in the Board Setup... dialog" ) ) );
}
else
{
menu.Append( 4, wxString::Format( _( "Change severity to Warning for all '%s' violations" ),
drcItem->GetErrorText(),
_( "Violation severities can also be edited in the Board Setup... dialog" ) ) );
}
menu.Append( 5, wxString::Format( _( "Ignore all '%s' violations" ),
drcItem->GetErrorText() ),
_( "Violations will not be checked or reported" ) );
switch( GetPopupMenuSelectionFromUser( menu ) )
{
case 1:
node->m_DrcItem->GetParent()->SetExcluded( false );
// Update view
static_cast<DRC_TREE_MODEL*>( aEvent.GetModel() )->ValueChanged( node );
updateDisplayedCounts();
break;
case 2:
node->m_DrcItem->GetParent()->SetExcluded( true );
// Update view
if( m_severities & SEVERITY_EXCLUSION )
static_cast<DRC_TREE_MODEL*>( aEvent.GetModel() )->ValueChanged( node );
else
static_cast<DRC_TREE_MODEL*>( aEvent.GetModel() )->DeleteCurrentItem( false );
updateDisplayedCounts();
break;
case 3:
m_BrdSettings.m_DRCSeverities[ drcItem->GetErrorCode() ] = SEVERITY_ERROR;
m_brdEditor->GetBoard()->SetDesignSettings( m_BrdSettings );
// Rebuild model and view
static_cast<DRC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider );
updateDisplayedCounts();
break;
case 4:
m_BrdSettings.m_DRCSeverities[ drcItem->GetErrorCode() ] = SEVERITY_WARNING;
m_brdEditor->GetBoard()->SetDesignSettings( m_BrdSettings );
// Rebuild model and view
static_cast<DRC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider );
updateDisplayedCounts();
break;
case 5:
m_BrdSettings.m_DRCSeverities[ drcItem->GetErrorCode() ] = SEVERITY_IGNORE;
m_brdEditor->GetBoard()->SetDesignSettings( m_BrdSettings );
for( MARKER_PCB* marker : m_brdEditor->GetBoard()->Markers() )
{
if( marker->GetReporter().GetErrorCode() == drcItem->GetErrorCode() )
m_brdEditor->GetBoard()->Delete( marker );
}
// Rebuild model and view
static_cast<DRC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider );
updateDisplayedCounts();
break;
}
}
void DIALOG_DRC_CONTROL::OnSeverity( wxCommandEvent& aEvent )
{
int flag = 0;
if( event.GetEventObject() == m_showAll )
flag = DRC_SHOW_ERRORS | DRC_SHOW_WARNINGS | DRC_SHOW_INFOS;
else if( event.GetEventObject() == m_showErrors )
flag = DRC_SHOW_ERRORS;
else if( event.GetEventObject() == m_showWarnings )
flag = DRC_SHOW_WARNINGS;
else if( event.GetEventObject() == m_showInfos )
flag = DRC_SHOW_INFOS;
if( aEvent.GetEventObject() == m_showAll )
flag = SEVERITY_ALL;
else if( aEvent.GetEventObject() == m_showErrors )
flag = SEVERITY_ERROR;
else if( aEvent.GetEventObject() == m_showWarnings )
flag = SEVERITY_WARNING;
else if( aEvent.GetEventObject() == m_showExclusions )
flag = SEVERITY_EXCLUSION;
if( event.IsChecked() )
if( aEvent.IsChecked() )
m_severities |= flag;
else if( aEvent.GetEventObject() == m_showAll )
m_severities = SEVERITY_ERROR;
else
m_severities &= ~flag;
syncCheckboxes();
// JEY TODO:
/*
* pass the severity level to the providers...
* or create new providers with the level...
* and then
m_markerTreeModel->SetProvider( ... );
m_unconnectedTreeModel->SetProvider( ... );
m_footprintsTreeModel->SetProvider( ... );
*/
// Set the provider's severity levels through the TreeModel so that the old tree
// can be torn down before the severity changes.
//
// It's not clear this is required, but we've had a lot of issues with wxDataView
// being cranky on various platforms.
m_markerTreeModel->SetSeverities( m_severities );
m_unconnectedTreeModel->SetSeverities( m_severities );
m_footprintWarningsTreeModel->SetSeverities( m_severities );
updateDisplayedCounts();
}
void DIALOG_DRC_CONTROL::OnSaveReport( wxCommandEvent& event )
void DIALOG_DRC_CONTROL::OnSaveReport( wxCommandEvent& aEvent )
{
wxFileName fn( "./DRC." + ReportFileExtension );
@ -307,7 +447,7 @@ void DIALOG_DRC_CONTROL::OnSaveReport( wxCommandEvent& event )
}
void DIALOG_DRC_CONTROL::OnCancelClick( wxCommandEvent& event )
void DIALOG_DRC_CONTROL::OnCancelClick( wxCommandEvent& aEvent )
{
m_brdEditor->FocusOnItem( nullptr );
@ -320,11 +460,11 @@ void DIALOG_DRC_CONTROL::OnCancelClick( wxCommandEvent& event )
}
void DIALOG_DRC_CONTROL::OnChangingNotebookPage( wxNotebookEvent& event )
void DIALOG_DRC_CONTROL::OnChangingNotebookPage( wxNotebookEvent& aEvent )
{
// Shouldn't be necessary, but is on at least OSX
if( event.GetSelection() >= 0 )
m_Notebook->ChangeSelection( (unsigned) event.GetSelection() );
if( aEvent.GetSelection() >= 0 )
m_Notebook->ChangeSelection( (unsigned) aEvent.GetSelection() );
m_markerDataView->UnselectAll();
m_unconnectedDataView->UnselectAll();
@ -332,7 +472,7 @@ void DIALOG_DRC_CONTROL::OnChangingNotebookPage( wxNotebookEvent& event )
}
void DIALOG_DRC_CONTROL::RefreshBoardEditor()
void DIALOG_DRC_CONTROL::refreshBoardEditor()
{
WINDOW_THAWER thawer( m_brdEditor );
@ -340,7 +480,7 @@ void DIALOG_DRC_CONTROL::RefreshBoardEditor()
}
void DIALOG_DRC_CONTROL::DelDRCMarkers()
void DIALOG_DRC_CONTROL::deleteAllMarkers()
{
// Clear current selection list to avoid selection of deleted items
m_brdEditor->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
@ -366,26 +506,26 @@ bool DIALOG_DRC_CONTROL::writeReport( const wxString& aFullFileName )
fprintf( fp, "** Created on %s **\n", TO_UTF8( now.Format( wxT( "%F %T" ) ) ) );
count = m_markerTreeModel->GetDRCItemCount();
count = m_markersProvider->GetCount();
fprintf( fp, "\n** Found %d DRC errors **\n", count );
fprintf( fp, "\n** Found %d DRC violations **\n", count );
for( int i = 0; i < count; ++i )
fprintf( fp, "%s", TO_UTF8( m_markerTreeModel->GetDRCItem( i )->ShowReport( units ) ) );
fprintf( fp, "%s", TO_UTF8( m_markersProvider->GetItem( i )->ShowReport( units ) ) );
count = m_unconnectedTreeModel->GetDRCItemCount();
count = m_unconnectedItemsProvider->GetCount();
fprintf( fp, "\n** Found %d unconnected pads **\n", count );
for( int i = 0; i < count; ++i )
fprintf( fp, "%s", TO_UTF8( m_unconnectedTreeModel->GetDRCItem( i )->ShowReport( units ) ) );
fprintf( fp, "%s", TO_UTF8( m_unconnectedItemsProvider->GetItem( i )->ShowReport( units ) ) );
count = m_footprintsTreeModel->GetDRCItemCount();
count = m_footprintWarningsProvider->GetCount();
fprintf( fp, "\n** Found %d Footprint errors **\n", count );
for( int i = 0; i < count; ++i )
fprintf( fp, "%s", TO_UTF8( m_footprintsTreeModel->GetDRCItem( i )->ShowReport( units ) ) );
fprintf( fp, "%s", TO_UTF8( m_footprintWarningsProvider->GetItem( i )->ShowReport( units ) ) );
fprintf( fp, "\n** End of Report **\n" );
@ -396,49 +536,57 @@ bool DIALOG_DRC_CONTROL::writeReport( const wxString& aFullFileName )
}
void DIALOG_DRC_CONTROL::OnDeleteOneClick( wxCommandEvent& event )
void DIALOG_DRC_CONTROL::OnDeleteOneClick( wxCommandEvent& aEvent )
{
if( m_Notebook->GetSelection() == 0 )
{
// Clear the selection. It may be the selected DRC marker.
m_brdEditor->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
m_markerTreeModel->DeleteCurrentItem();
m_markerTreeModel->DeleteCurrentItem( true );
// redraw the pcb
RefreshBoardEditor();
refreshBoardEditor();
}
else if( m_Notebook->GetSelection() == 1 )
{
m_unconnectedTreeModel->DeleteCurrentItem();
m_unconnectedTreeModel->DeleteCurrentItem( true );
}
UpdateDisplayedCounts();
}
void DIALOG_DRC_CONTROL::OnDeleteAllClick( wxCommandEvent& event )
else if( m_Notebook->GetSelection() == 2 )
{
DelDRCMarkers();
RefreshBoardEditor();
UpdateDisplayedCounts();
m_footprintWarningsTreeModel->DeleteCurrentItem( true );
}
updateDisplayedCounts();
}
void DIALOG_DRC_CONTROL::UpdateDisplayedCounts()
void DIALOG_DRC_CONTROL::OnDeleteAllClick( wxCommandEvent& aEvent )
{
deleteAllMarkers();
refreshBoardEditor();
updateDisplayedCounts();
}
void DIALOG_DRC_CONTROL::updateDisplayedCounts()
{
wxString msg;
// First the tab headers:
//
if( m_tester->m_drcRun )
{
msg.sprintf( m_markersTitleTemplate, m_markerTreeModel->GetDRCItemCount() );
m_Notebook->SetPageText( 0, msg );
msg.sprintf( m_unconnectedTitleTemplate, (int) m_unconnectedTreeModel->GetDRCItemCount() );
msg.sprintf( m_unconnectedTitleTemplate, m_unconnectedTreeModel->GetDRCItemCount() );
m_Notebook->SetPageText( 1, msg );
if( m_tester->m_footprintsTested )
msg.sprintf( m_footprintsTitleTemplate, (int) m_footprintsTreeModel->GetDRCItemCount() );
msg.sprintf( m_footprintsTitleTemplate, m_footprintWarningsTreeModel->GetDRCItemCount() );
else
{
msg = m_footprintsTitleTemplate;
@ -460,4 +608,36 @@ void DIALOG_DRC_CONTROL::UpdateDisplayedCounts()
msg.Replace( wxT( "(%d)" ), wxEmptyString );
m_Notebook->SetPageText( 2, msg );
}
// And now the badges:
//
int numErrors = 0;
int numWarnings = 0;
int numExcluded = 0;
if( m_markersProvider )
{
numErrors += m_markersProvider->GetCount( SEVERITY_ERROR );
numWarnings += m_markersProvider->GetCount( SEVERITY_WARNING );
numExcluded += m_markersProvider->GetCount( SEVERITY_EXCLUSION );
}
if( m_unconnectedItemsProvider )
{
numErrors += m_unconnectedItemsProvider->GetCount( SEVERITY_ERROR );
numWarnings += m_unconnectedItemsProvider->GetCount( SEVERITY_WARNING );
numExcluded += m_unconnectedItemsProvider->GetCount( SEVERITY_EXCLUSION );
}
if( m_footprintWarningsProvider )
{
numErrors += m_footprintWarningsProvider->GetCount( SEVERITY_ERROR );
numWarnings += m_footprintWarningsProvider->GetCount( SEVERITY_WARNING );
numExcluded += m_footprintWarningsProvider->GetCount( SEVERITY_EXCLUSION );
}
m_errorsBadge->SetBitmap( MakeBadge( SEVERITY_ERROR, numErrors, m_errorsBadge ) );
m_warningsBadge->SetBitmap( MakeBadge( SEVERITY_WARNING, numWarnings, m_warningsBadge ) );
m_exclusionsBadge->SetBitmap( MakeBadge( SEVERITY_EXCLUSION, numExcluded, m_exclusionsBadge ) );
}

View File

@ -42,10 +42,6 @@ class BOARD_DESIGN_SETTINGS;
class DRC_TREE_MODEL;
#define DRC_SHOW_ERRORS 0x0001
#define DRC_SHOW_WARNINGS 0x0002
#define DRC_SHOW_INFOS 0x0004
#define DIALOG_DRC_WINDOW_NAME "DialogDrcWindowName"
class
@ -65,8 +61,6 @@ public:
void SetUnconnectedProvider( DRC_ITEMS_PROVIDER* aProvider );
void SetFootprintsProvider( DRC_ITEMS_PROVIDER* aProvider );
void UpdateDisplayedCounts();
private:
/**
* Function writeReport
@ -81,26 +75,28 @@ private:
void displayDRCValues();
void setDRCParameters();
void syncCheckboxes();
void updateDisplayedCounts();
void OnDRCItemSelected( wxDataViewEvent& event ) override;
void OnDRCItemDClick( wxDataViewEvent& event ) override;
void OnDRCItemSelected( wxDataViewEvent& aEvent ) override;
void OnDRCItemDClick( wxDataViewEvent& aEvent ) override;
void OnDRCItemRClick( wxDataViewEvent& aEvent ) override;
void OnSeverity( wxCommandEvent& event ) override;
void OnSaveReport( wxCommandEvent& event ) override;
void OnSeverity( wxCommandEvent& aEvent ) override;
void OnSaveReport( wxCommandEvent& aEvent ) override;
void OnDeleteOneClick( wxCommandEvent& event ) override;
void OnDeleteAllClick( wxCommandEvent& event ) override;
void OnRunDRCClick( wxCommandEvent& event ) override;
void OnCancelClick( wxCommandEvent& event ) override;
void OnDeleteOneClick( wxCommandEvent& aEvent ) override;
void OnDeleteAllClick( wxCommandEvent& aEvent ) override;
void OnRunDRCClick( wxCommandEvent& aEvent ) override;
void OnCancelClick( wxCommandEvent& aEvent ) override;
/// handler for activate event, updating data which can be modified outside the dialog
/// (DRC parameters)
void OnActivateDlg( wxActivateEvent& event ) override;
void OnActivateDlg( wxActivateEvent& aEvent ) override;
void OnChangingNotebookPage( wxNotebookEvent& event ) override;
void OnChangingNotebookPage( wxNotebookEvent& aEvent ) override;
void DelDRCMarkers();
void RefreshBoardEditor();
void deleteAllMarkers();
void refreshBoardEditor();
BOARD* m_currentBoard; // the board currently on test
DRC* m_tester;
@ -114,9 +110,14 @@ private:
UNIT_BINDER m_viaMinSize;
UNIT_BINDER m_uviaMinSize;
DRC_ITEMS_PROVIDER* m_markersProvider;
DRC_TREE_MODEL* m_markerTreeModel;
DRC_ITEMS_PROVIDER* m_unconnectedItemsProvider;
DRC_TREE_MODEL* m_unconnectedTreeModel;
DRC_TREE_MODEL* m_footprintsTreeModel;
DRC_ITEMS_PROVIDER* m_footprintWarningsProvider;
DRC_TREE_MODEL* m_footprintWarningsTreeModel;
int m_severities;
};

View File

@ -106,7 +106,7 @@ DIALOG_DRC_CONTROL_BASE::DIALOG_DRC_CONTROL_BASE( wxWindow* parent, wxWindowID i
m_Messages = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxTE_MULTILINE|wxTE_READONLY );
m_Messages->SetMinSize( wxSize( 280,-1 ) );
gbSizer1->Add( m_Messages, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxTOP|wxLEFT, 5 );
gbSizer1->Add( m_Messages, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
gbSizer1->AddGrowableCol( 0 );
@ -158,33 +158,55 @@ DIALOG_DRC_CONTROL_BASE::DIALOG_DRC_CONTROL_BASE( wxWindow* parent, wxWindowID i
m_MainSizer->Add( m_Notebook, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizer9;
bSizer9 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSeveritySizer;
bSeveritySizer = new wxBoxSizer( wxHORIZONTAL );
m_showLabel = new wxStaticText( this, wxID_ANY, _("Show:"), wxDefaultPosition, wxDefaultSize, 0 );
m_showLabel->Wrap( -1 );
bSeveritySizer->Add( m_showLabel, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
bSeveritySizer->Add( m_showLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_showAll = new wxCheckBox( this, wxID_ANY, _("All"), wxDefaultPosition, wxDefaultSize, 0 );
bSeveritySizer->Add( m_showAll, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSeveritySizer->Add( m_showAll, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
bSeveritySizer->Add( 35, 0, 0, wxEXPAND, 5 );
m_showErrors = new wxCheckBox( this, wxID_ANY, _("Errors"), wxDefaultPosition, wxDefaultSize, 0 );
bSeveritySizer->Add( m_showErrors, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSeveritySizer->Add( m_showErrors, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_errorsBadge = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
m_errorsBadge->SetMinSize( wxSize( 20,20 ) );
bSeveritySizer->Add( m_errorsBadge, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 25 );
m_showWarnings = new wxCheckBox( this, wxID_ANY, _("Warnings"), wxDefaultPosition, wxDefaultSize, 0 );
bSeveritySizer->Add( m_showWarnings, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSeveritySizer->Add( m_showWarnings, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_showInfos = new wxCheckBox( this, wxID_ANY, _("Infos"), wxDefaultPosition, wxDefaultSize, 0 );
bSeveritySizer->Add( m_showInfos, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_warningsBadge = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
m_warningsBadge->SetMinSize( wxSize( 20,20 ) );
bSeveritySizer->Add( m_warningsBadge, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 25 );
m_showExclusions = new wxCheckBox( this, wxID_ANY, _("Exclusions"), wxDefaultPosition, wxDefaultSize, 0 );
bSeveritySizer->Add( m_showExclusions, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_exclusionsBadge = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
bSeveritySizer->Add( m_exclusionsBadge, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 25 );
bSeveritySizer->Add( 0, 0, 1, wxEXPAND, 5 );
m_saveReport = new wxButton( this, wxID_ANY, _("Save..."), wxDefaultPosition, wxDefaultSize, 0 );
bSeveritySizer->Add( m_saveReport, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSeveritySizer->Add( m_saveReport, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_MainSizer->Add( bSeveritySizer, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 );
bSizer9->Add( bSeveritySizer, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_MainSizer->Add( bSizer9, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
m_MainSizer->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
@ -218,6 +240,7 @@ DIALOG_DRC_CONTROL_BASE::DIALOG_DRC_CONTROL_BASE( wxWindow* parent, wxWindowID i
this->Connect( wxEVT_ACTIVATE, wxActivateEventHandler( DIALOG_DRC_CONTROL_BASE::OnActivateDlg ) );
m_Notebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_DRC_CONTROL_BASE::OnChangingNotebookPage ), NULL, this );
m_markerDataView->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_DRC_CONTROL_BASE::OnDRCItemDClick ), NULL, this );
m_markerDataView->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, wxDataViewEventHandler( DIALOG_DRC_CONTROL_BASE::OnDRCItemRClick ), NULL, this );
m_markerDataView->Connect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_DRC_CONTROL_BASE::OnDRCItemSelected ), NULL, this );
m_unconnectedDataView->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_DRC_CONTROL_BASE::OnDRCItemDClick ), NULL, this );
m_unconnectedDataView->Connect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_DRC_CONTROL_BASE::OnDRCItemSelected ), NULL, this );
@ -226,7 +249,7 @@ DIALOG_DRC_CONTROL_BASE::DIALOG_DRC_CONTROL_BASE( wxWindow* parent, wxWindowID i
m_showAll->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnSeverity ), NULL, this );
m_showErrors->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnSeverity ), NULL, this );
m_showWarnings->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnSeverity ), NULL, this );
m_showInfos->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnSeverity ), NULL, this );
m_showExclusions->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnSeverity ), NULL, this );
m_saveReport->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnSaveReport ), NULL, this );
m_DeleteCurrentMarkerButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnDeleteOneClick ), NULL, this );
m_DeleteAllMarkersButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnDeleteAllClick ), NULL, this );
@ -240,6 +263,7 @@ DIALOG_DRC_CONTROL_BASE::~DIALOG_DRC_CONTROL_BASE()
this->Disconnect( wxEVT_ACTIVATE, wxActivateEventHandler( DIALOG_DRC_CONTROL_BASE::OnActivateDlg ) );
m_Notebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_DRC_CONTROL_BASE::OnChangingNotebookPage ), NULL, this );
m_markerDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_DRC_CONTROL_BASE::OnDRCItemDClick ), NULL, this );
m_markerDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, wxDataViewEventHandler( DIALOG_DRC_CONTROL_BASE::OnDRCItemRClick ), NULL, this );
m_markerDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_DRC_CONTROL_BASE::OnDRCItemSelected ), NULL, this );
m_unconnectedDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_DRC_CONTROL_BASE::OnDRCItemDClick ), NULL, this );
m_unconnectedDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_DRC_CONTROL_BASE::OnDRCItemSelected ), NULL, this );
@ -248,7 +272,7 @@ DIALOG_DRC_CONTROL_BASE::~DIALOG_DRC_CONTROL_BASE()
m_showAll->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnSeverity ), NULL, this );
m_showErrors->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnSeverity ), NULL, this );
m_showWarnings->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnSeverity ), NULL, this );
m_showInfos->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnSeverity ), NULL, this );
m_showExclusions->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnSeverity ), NULL, this );
m_saveReport->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnSaveReport ), NULL, this );
m_DeleteCurrentMarkerButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnDeleteOneClick ), NULL, this );
m_DeleteAllMarkersButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnDeleteAllClick ), NULL, this );

View File

@ -935,7 +935,7 @@
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxEXPAND|wxTOP|wxLEFT</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="row">0</property>
<property name="rowspan">1</property>
<object class="wxTextCtrl" expanded="0">
@ -1144,6 +1144,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnDataViewCtrlItemActivated">OnDRCItemDClick</event>
<event name="OnDataViewCtrlItemContextMenu">OnDRCItemRClick</event>
<event name="OnDataViewCtrlSelectionChanged">OnDRCItemSelected</event>
</object>
</object>
@ -1337,7 +1338,16 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer9</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
@ -1347,7 +1357,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@ -1408,7 +1418,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
@ -1473,7 +1483,17 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">35</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
@ -1536,9 +1556,67 @@
<event name="OnCheckBox">OnSeverity</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">25</property>
<property name="flag">wxRIGHT|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticBitmap" 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="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">20,20</property>
<property name="moveable">1</property>
<property name="name">m_errorsBadge</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">; ; forward_declare</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"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
@ -1601,9 +1679,67 @@
<event name="OnCheckBox">OnSeverity</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">25</property>
<property name="flag">wxRIGHT|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticBitmap" 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="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">20,20</property>
<property name="moveable">1</property>
<property name="name">m_warningsBadge</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">; ; forward_declare</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"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
@ -1634,7 +1770,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Infos</property>
<property name="label">Exclusions</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -1642,7 +1778,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_showInfos</property>
<property name="name">m_showExclusions</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -1666,6 +1802,64 @@
<event name="OnCheckBox">OnSeverity</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">25</property>
<property name="flag">wxRIGHT|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticBitmap" 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="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"></property>
<property name="moveable">1</property>
<property name="name">m_exclusionsBadge</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">; ; forward_declare</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"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
@ -1678,7 +1872,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
@ -1751,6 +1945,8 @@
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>

View File

@ -27,6 +27,7 @@
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/notebook.h>
#include <wx/statbmp.h>
#include <wx/button.h>
#include <wx/statline.h>
#include <wx/dialog.h>
@ -64,8 +65,11 @@ class DIALOG_DRC_CONTROL_BASE : public DIALOG_SHIM
wxStaticText* m_showLabel;
wxCheckBox* m_showAll;
wxCheckBox* m_showErrors;
wxStaticBitmap* m_errorsBadge;
wxCheckBox* m_showWarnings;
wxCheckBox* m_showInfos;
wxStaticBitmap* m_warningsBadge;
wxCheckBox* m_showExclusions;
wxStaticBitmap* m_exclusionsBadge;
wxButton* m_saveReport;
wxStaticLine* m_staticline1;
wxBoxSizer* m_sizerButtons;
@ -79,6 +83,7 @@ class DIALOG_DRC_CONTROL_BASE : public DIALOG_SHIM
virtual void OnActivateDlg( wxActivateEvent& event ) { event.Skip(); }
virtual void OnChangingNotebookPage( wxNotebookEvent& event ) { event.Skip(); }
virtual void OnDRCItemDClick( wxDataViewEvent& event ) { event.Skip(); }
virtual void OnDRCItemRClick( wxDataViewEvent& event ) { event.Skip(); }
virtual void OnDRCItemSelected( wxDataViewEvent& event ) { event.Skip(); }
virtual void OnSeverity( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSaveReport( wxCommandEvent& event ) { event.Skip(); }

View File

@ -366,7 +366,7 @@ bool DIALOG_EXCHANGE_FOOTPRINTS::processModule( MODULE* aModule, const LIB_ID& a
if( !newModule )
{
msg << ": " << _( "*** footprint not found ***" );
m_MessageWindow->Report( msg, REPORTER::RPT_ERROR );
m_MessageWindow->Report( msg, SEVERITY_ERROR );
return false;
}
@ -380,7 +380,7 @@ bool DIALOG_EXCHANGE_FOOTPRINTS::processModule( MODULE* aModule, const LIB_ID& a
m_currentModule = newModule;
msg += ": OK";
m_MessageWindow->Report( msg, REPORTER::RPT_ACTION );
m_MessageWindow->Report( msg, SEVERITY_ACTION );
return true;
}

View File

@ -337,7 +337,7 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
bool success = false;
wxArrayString output, errors;
REPORTER& reporter = m_messagesPanel->Reporter();
reporter.ReportHead( wxString::Format( _( "Executing '%s'" ), cmdK2S ), REPORTER::RPT_ACTION );
reporter.ReportHead( wxString::Format( _( "Executing '%s'" ), cmdK2S ), SEVERITY_ACTION );
{
wxBusyCursor dummy;
@ -356,23 +356,23 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
}
for( auto& err : errors )
reporter.Report( err, REPORTER::RPT_WARNING );
reporter.Report( err, SEVERITY_WARNING );
if( result ) // Any troubles?
{
if( !success )
{
reporter.ReportTail( _( "Unable to create STEP file. Check that the board has a "
"valid outline and models." ), REPORTER::RPT_ERROR );
"valid outline and models." ), SEVERITY_ERROR );
}
else
{
reporter.ReportTail( _( "STEP file has been created, but there are warnings." ),
REPORTER::RPT_INFO );
SEVERITY_INFO );
}
}
else
{
reporter.ReportTail( _( "STEP file has been created successfully." ), REPORTER::RPT_INFO );
reporter.ReportTail( _( "STEP file has been created successfully." ), SEVERITY_INFO );
}
}

View File

@ -262,13 +262,12 @@ void DIALOG_EXPORT_SVG::ExportSVGFile( bool aOnlyOneFile )
if( CreateSVGFile( path ) )
{
reporter.Report( wxString::Format( _( "Exported \"%s\"." ), path ),
REPORTER::RPT_ACTION );
reporter.Report( wxString::Format( _( "Exported \"%s\"." ), path ), SEVERITY_ACTION );
}
else // Error
{
reporter.Report( wxString::Format( _( "Unable to create file \"%s\"." ), path ),
REPORTER::RPT_ERROR );
SEVERITY_ERROR );
}
if( aOnlyOneFile )

View File

@ -264,10 +264,8 @@ void DIALOG_FIND::search( bool aDirection )
if( FindIncludeMarkers )
{
for( int i = 0; i < m_frame->GetBoard()->GetMARKERCount(); ++i )
for( MARKER_PCB* marker : m_frame->GetBoard()->Markers() )
{
MARKER_PCB* marker = m_frame->GetBoard()->GetMARKER( i );
if( marker->Matches( m_frame->GetFindReplaceData(), nullptr ) )
m_hitList.push_back( marker );
}

View File

@ -222,7 +222,7 @@ void DIALOG_NETLIST::onFilenameChanged()
{
m_MessageWindow->Clear();
REPORTER& reporter = m_MessageWindow->Reporter();
reporter.Report( _( "The netlist file does not exist." ), REPORTER::RPT_ERROR );
reporter.Report( _( "The netlist file does not exist." ), SEVERITY_ERROR );
}
}
}
@ -272,14 +272,14 @@ void DIALOG_NETLIST::loadNetlist( bool aDryRun )
wxString msg;
msg.Printf( _( "Reading netlist file \"%s\".\n" ), GetChars( netlistFileName ) );
reporter.ReportHead( msg, REPORTER::RPT_INFO );
reporter.ReportHead( msg, SEVERITY_INFO );
if( m_matchByTimestamp->GetSelection() == 1 )
msg = _( "Using references to match components and footprints.\n" );
else
msg = _( "Using time stamp fields (UUID) to match components and footprints.\n" );
reporter.ReportHead( msg, REPORTER::RPT_INFO );
reporter.ReportHead( msg, SEVERITY_INFO );
m_MessageWindow->SetLazyUpdate( true ); // Use lazy update to speed the creation of the report
// (the window is not updated for each message)
m_matchByUUID = m_matchByTimestamp->GetSelection() == 0;

View File

@ -613,7 +613,7 @@ void DIALOG_PLOT::applyPlotSettings()
{
m_defaultPenSize.SetValue( tempOptions.GetHPGLPenDiameter() * IU_PER_MILS );
msg.Printf( _( "HPGL pen size constrained." ) );
reporter.Report( msg, REPORTER::RPT_INFO );
reporter.Report( msg, SEVERITY_INFO );
}
}
else // keep the last value (initial value if no HPGL plot made)
@ -624,7 +624,7 @@ void DIALOG_PLOT::applyPlotSettings()
{
m_defaultLineWidth.SetValue( tempOptions.GetLineWidth() );
msg.Printf( _( "Default line width constrained." ) );
reporter.Report( msg, REPORTER::RPT_INFO );
reporter.Report( msg, SEVERITY_INFO );
}
// X scale
@ -637,7 +637,7 @@ void DIALOG_PLOT::applyPlotSettings()
msg.Printf( wxT( "%f" ), m_XScaleAdjust );
m_fineAdjustXCtrl->SetValue( msg );
msg.Printf( _( "X scale constrained." ) );
reporter.Report( msg, REPORTER::RPT_INFO );
reporter.Report( msg, SEVERITY_INFO );
}
// Y scale
@ -649,7 +649,7 @@ void DIALOG_PLOT::applyPlotSettings()
msg.Printf( wxT( "%f" ), m_YScaleAdjust );
m_fineAdjustYCtrl->SetValue( msg );
msg.Printf( _( "Y scale constrained." ) );
reporter.Report( msg, REPORTER::RPT_INFO );
reporter.Report( msg, SEVERITY_INFO );
}
auto cfg = m_parent->GetSettings();
@ -670,7 +670,7 @@ void DIALOG_PLOT::applyPlotSettings()
StringFromValue( GetUserUnits(), m_widthAdjustMinValue, false, true ),
StringFromValue( GetUserUnits(), m_widthAdjustMaxValue, false, true ),
GetAbbreviatedUnitsLabel( GetUserUnits(), true ) );
reporter.Report( msg, REPORTER::RPT_WARNING );
reporter.Report( msg, SEVERITY_WARNING );
}
// Store m_PSWidthAdjust in mm in user config
@ -856,12 +856,12 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
delete plotter;
msg.Printf( _( "Plot file \"%s\" created." ), fn.GetFullPath() );
reporter.Report( msg, REPORTER::RPT_ACTION );
reporter.Report( msg, SEVERITY_ACTION );
}
else
{
msg.Printf( _( "Unable to create file \"%s\"." ), fn.GetFullPath() );
reporter.Report( msg, REPORTER::RPT_ERROR );
reporter.Report( msg, SEVERITY_ERROR );
}
wxSafeYield(); // displays report message.

View File

@ -0,0 +1,143 @@
/*
* 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 <drc/drc.h>
#include <widgets/paged_dialog.h>
#include <widgets/ui_common.h>
#include "panel_setup_drc_severities.h"
PANEL_SETUP_DRC_SEVERITIES::PANEL_SETUP_DRC_SEVERITIES( PAGED_DIALOG* aParent,
PCB_EDIT_FRAME* aFrame ) :
wxPanel( aParent->GetTreebook() ),
m_brdSettings( aFrame->GetBoard()->GetDesignSettings() )
{
wxString severities[] = { _( "Error" ), _( "Warning" ), _( "Ignore" ) };
int baseID = 1000;
wxBoxSizer* panelSizer = new wxBoxSizer( wxVERTICAL );
wxScrolledWindow* scrollWin = new wxScrolledWindow( this, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
wxTAB_TRAVERSAL | wxVSCROLL );
scrollWin->SetScrollRate( 0, 5 );
wxFlexGridSizer* gridSizer = new wxFlexGridSizer( 0, 2, 0, 5 );
gridSizer->SetFlexibleDirection( wxBOTH );
for( int errorCode = DRCE_FIRST; errorCode <= DRCE_LAST; ++errorCode )
{
DRC_ITEM drcItem( errorCode, wxEmptyString );
wxString msg = drcItem.GetErrorText();
if( !msg.IsEmpty() )
{
wxStaticText* errorLabel = new wxStaticText( scrollWin, wxID_ANY, msg + wxT( ":" ) );
gridSizer->Add( errorLabel, 0, wxALIGN_CENTER_VERTICAL | wxALL | wxEXPAND, 4 );
// OSX can't handle more than 100 radio buttons in a single window (yes, seriously),
// so we have to create a window for each set
wxPanel* radioPanel = new wxPanel( scrollWin );
wxBoxSizer* radioSizer = new wxBoxSizer( wxHORIZONTAL );
for( int i = 0; i < sizeof( severities ) / sizeof( wxString ); ++i )
{
m_buttonMap[errorCode][i] = new wxRadioButton( radioPanel,
baseID + errorCode * 10 + i,
severities[i],
wxDefaultPosition,
wxDefaultSize,
i == 0 ? wxRB_GROUP : 0 );
radioSizer->Add( m_buttonMap[errorCode][i], 1,
wxALIGN_CENTER_VERTICAL | wxRIGHT | wxEXPAND, 25 );
}
radioPanel->SetSizer( radioSizer );
radioPanel->Layout();
gridSizer->Add( radioPanel, 0, wxALIGN_CENTER_VERTICAL | wxALL | wxEXPAND, 4 );
}
}
scrollWin->SetSizer( gridSizer );
scrollWin->Layout();
gridSizer->Fit( scrollWin );
panelSizer->Add( scrollWin, 1, wxEXPAND | wxALL, 5 );
this->SetSizer( panelSizer );
this->Layout();
panelSizer->Fit( this );
}
void PANEL_SETUP_DRC_SEVERITIES::ImportSettingsFrom( BOARD* aBoard )
{
for( auto const& entry : aBoard->GetDesignSettings().m_DRCSeverities )
{
if( m_buttonMap.count( entry.first ) )
{
switch( entry.second )
{
case SEVERITY_ERROR: m_buttonMap[entry.first][0]->SetValue( true ); break;
case SEVERITY_WARNING: m_buttonMap[entry.first][1]->SetValue( true ); break;
case SEVERITY_IGNORE: m_buttonMap[entry.first][2]->SetValue( true ); break;
}
}
}
}
bool PANEL_SETUP_DRC_SEVERITIES::TransferDataToWindow()
{
for( auto const& entry : m_brdSettings.m_DRCSeverities )
{
if( m_buttonMap.count( entry.first ) )
{
switch( entry.second )
{
case SEVERITY_ERROR: m_buttonMap[entry.first][0]->SetValue( true ); break;
case SEVERITY_WARNING: m_buttonMap[entry.first][1]->SetValue( true ); break;
case SEVERITY_IGNORE: m_buttonMap[entry.first][2]->SetValue( true ); break;
}
}
}
return true;
}
bool PANEL_SETUP_DRC_SEVERITIES::TransferDataFromWindow()
{
for( auto const& entry : m_buttonMap )
{
int severity = SEVERITY_UNDEFINED;
if( entry.second[0]->GetValue() )
severity = SEVERITY_ERROR;
else if( entry.second[1]->GetValue() )
severity = SEVERITY_WARNING;
else if( entry.second[2]->GetValue() )
severity = SEVERITY_IGNORE;
m_brdSettings.m_DRCSeverities[ entry.first ] = severity;
}
return true;
}

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
* 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
@ -21,24 +21,36 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <drc/drc_provider.h>
#ifndef KICAD_PANEL_SETUP_DRC_SEVERITIES_H
#define KICAD_PANEL_SETUP_DRC_SEVERITIES_H
#include <map>
#include <wx/generic/panelg.h>
DRC_PROVIDER::DRC_PROVIDER( const DRC_MARKER_FACTORY& aMarkerMaker, MARKER_HANDLER aMarkerHandler )
: m_marker_factory( aMarkerMaker ), m_marker_handler( aMarkerHandler )
class BOARD;
class BOARD_DESIGN_SETTINGS;
class PAGED_DIALOG;
class PCB_EDIT_FRAME;
class wxRadioBox;
class PANEL_SETUP_DRC_SEVERITIES : public wxPanel
{
}
private:
BOARD_DESIGN_SETTINGS& m_brdSettings;
std::map<int, wxRadioButton*[4]> m_buttonMap; // map from DRC error code to button group
public:
PANEL_SETUP_DRC_SEVERITIES( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame );
~PANEL_SETUP_DRC_SEVERITIES( ) { };
const DRC_MARKER_FACTORY& DRC_PROVIDER::GetMarkerFactory() const
{
return m_marker_factory;
}
void ImportSettingsFrom( BOARD* aBoard );
private:
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
};
void DRC_PROVIDER::HandleMarker( std::unique_ptr<MARKER_PCB> aMarker ) const
{
// The marker hander currently takes a raw pointer,
// but it also assumes ownership
m_marker_handler( aMarker.release() );
}
#endif //KICAD_PANEL_SETUP_DRC_SEVERITIES_H

View File

@ -68,9 +68,6 @@ bool PANEL_SETUP_FEATURE_CONSTRAINTS::TransferDataToWindow()
m_edgeClearance.SetValue( m_BrdSettings->m_CopperEdgeClearance );
m_OptRequireCourtyards->SetValue( m_BrdSettings->m_RequireCourtyards );
m_OptOverlappingCourtyards->SetValue( m_BrdSettings->m_ProhibitOverlappingCourtyards );
m_maxError.SetValue( m_BrdSettings->m_MaxError );
m_cbOutlinePolygonFastest->SetValue( m_BrdSettings->m_ZoneUseNoOutlineInFill );
@ -100,9 +97,6 @@ bool PANEL_SETUP_FEATURE_CONSTRAINTS::TransferDataFromWindow()
m_BrdSettings->SetCopperEdgeClearance( m_edgeClearance.GetValue() );
m_BrdSettings->SetRequireCourtyardDefinitions( m_OptRequireCourtyards->GetValue() );
m_BrdSettings->SetProhibitOverlappingCourtyards( m_OptOverlappingCourtyards->GetValue() );
m_BrdSettings->m_MaxError = Clamp<int>( IU_PER_MM * MINIMUM_ERROR_SIZE_MM,
m_maxError.GetValue(), IU_PER_MM * MAXIMUM_ERROR_SIZE_MM );

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -9,7 +9,7 @@
///////////////////////////////////////////////////////////////////////////
PANEL_SETUP_FEATURE_CONSTRAINTS_BASE::PANEL_SETUP_FEATURE_CONSTRAINTS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
PANEL_SETUP_FEATURE_CONSTRAINTS_BASE::PANEL_SETUP_FEATURE_CONSTRAINTS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
{
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxHORIZONTAL );
@ -24,16 +24,7 @@ PANEL_SETUP_FEATURE_CONSTRAINTS_BASE::PANEL_SETUP_FEATURE_CONSTRAINTS_BASE( wxWi
sbFeatureRules->Add( m_OptAllowMicroVias, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
sbFeatureRules->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_OptRequireCourtyards = new wxCheckBox( this, wxID_ANY, _("Require courtyard definitions in footprints"), wxDefaultPosition, wxDefaultSize, 0 );
sbFeatureRules->Add( m_OptRequireCourtyards, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_OptOverlappingCourtyards = new wxCheckBox( this, wxID_ANY, _("Prohibit overlapping courtyards"), wxDefaultPosition, wxDefaultSize, 0 );
sbFeatureRules->Add( m_OptOverlappingCourtyards, 0, wxALL, 5 );
sbFeatureRules->Add( 0, 0, 0, wxEXPAND|wxBOTTOM, 5 );
sbFeatureRules->Add( 0, 5, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
wxBoxSizer* bSizerArcToPoly;
bSizerArcToPoly = new wxBoxSizer( wxVERTICAL );

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,11 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __PANEL_SETUP_FEATURE_CONSTRAINTS_BASE_H__
#define __PANEL_SETUP_FEATURE_CONSTRAINTS_BASE_H__
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
@ -36,8 +35,6 @@ class PANEL_SETUP_FEATURE_CONSTRAINTS_BASE : public wxPanel
protected:
wxCheckBox* m_OptAllowBlindBuriedVias;
wxCheckBox* m_OptAllowMicroVias;
wxCheckBox* m_OptRequireCourtyards;
wxCheckBox* m_OptOverlappingCourtyards;
wxStaticLine* m_staticline2;
wxStaticText* m_stCircleToPolyOpt;
wxStaticText* m_maxErrorTitle;
@ -76,9 +73,8 @@ class PANEL_SETUP_FEATURE_CONSTRAINTS_BASE : public wxPanel
public:
PANEL_SETUP_FEATURE_CONSTRAINTS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
PANEL_SETUP_FEATURE_CONSTRAINTS_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_FEATURE_CONSTRAINTS_BASE();
};
#endif //__PANEL_SETUP_FEATURE_CONSTRAINTS_BASE_H__

View File

@ -33,8 +33,9 @@
#include <class_module.h>
#include <drc/drc.h>
#include <drc/drc_marker_factory.h>
#include <widgets/ui_common.h>
#include <memory>
/**
* Flag to enable courtyard DRC debug tracing.
@ -46,14 +47,13 @@
static const wxChar* DRC_COURTYARD_TRACE = wxT( "KICAD_DRC_COURTYARD" );
DRC_COURTYARD_OVERLAP::DRC_COURTYARD_OVERLAP(
const DRC_MARKER_FACTORY& aMarkerFactory, MARKER_HANDLER aMarkerHandler )
: DRC_PROVIDER( aMarkerFactory, aMarkerHandler )
DRC_COURTYARD_OVERLAP::DRC_COURTYARD_OVERLAP( MARKER_HANDLER aMarkerHandler ) :
DRC_PROVIDER( aMarkerHandler )
{
}
bool DRC_COURTYARD_OVERLAP::RunDRC( BOARD& aBoard ) const
bool DRC_COURTYARD_OVERLAP::RunDRC( EDA_UNITS aUnits, BOARD& aBoard ) const
{
wxLogTrace( DRC_COURTYARD_TRACE, "Running DRC: Courtyard" );
@ -62,40 +62,34 @@ bool DRC_COURTYARD_OVERLAP::RunDRC( BOARD& aBoard ) const
wxString msg;
bool success = true;
const DRC_MARKER_FACTORY& marker_factory = GetMarkerFactory();
// Update courtyard polygons, and test for missing courtyard definition:
for( auto footprint : aBoard.Modules() )
for( MODULE* footprint : aBoard.Modules() )
{
wxPoint pos = footprint->GetPosition();
bool is_ok = footprint->BuildPolyCourtyard();
if( !is_ok && aBoard.GetDesignSettings().m_ProhibitOverlappingCourtyards )
if( !is_ok && !aBoard.GetDesignSettings().Ignore( DRCE_OVERLAPPING_FOOTPRINTS ) )
{
auto marker = std::unique_ptr<MARKER_PCB>( marker_factory.NewMarker(
pos,
footprint,
DRCE_MALFORMED_COURTYARD_IN_FOOTPRINT ) );
HandleMarker( std::move( marker ) );
auto m = std::make_unique<MARKER_PCB>( aUnits, DRCE_MALFORMED_COURTYARD_IN_FOOTPRINT,
pos, footprint );
HandleMarker( std::move( m ) );
success = false;
}
if( !aBoard.GetDesignSettings().m_RequireCourtyards )
if( aBoard.GetDesignSettings().Ignore( DRCE_MISSING_COURTYARD_IN_FOOTPRINT ) )
continue;
if( footprint->GetPolyCourtyardFront().OutlineCount() == 0
&& footprint->GetPolyCourtyardBack().OutlineCount() == 0 && is_ok )
{
auto marker = std::unique_ptr<MARKER_PCB>( marker_factory.NewMarker(
pos,
footprint,
DRCE_MISSING_COURTYARD_IN_FOOTPRINT ) );
HandleMarker( std::move( marker ) );
auto m = std::make_unique<MARKER_PCB>( aUnits, DRCE_MISSING_COURTYARD_IN_FOOTPRINT,
pos, footprint );
HandleMarker( std::move( m ) );
success = false;
}
}
if( !aBoard.GetDesignSettings().m_ProhibitOverlappingCourtyards )
if( aBoard.GetDesignSettings().Ignore( DRCE_OVERLAPPING_FOOTPRINTS ) )
return success;
wxLogTrace( DRC_COURTYARD_TRACE, "Checking for courtyard overlap" );
@ -129,13 +123,10 @@ bool DRC_COURTYARD_OVERLAP::RunDRC( BOARD& aBoard ) const
if( courtyard.OutlineCount() )
{
//Overlap between footprint and candidate
auto& pos = courtyard.CVertex( 0, 0, -1 );
auto marker = std::unique_ptr<MARKER_PCB>( marker_factory.NewMarker(
(wxPoint) pos,
footprint,
candidate,
DRCE_OVERLAPPING_FOOTPRINTS ) );
HandleMarker( std::move( marker ) );
auto m = std::make_unique<MARKER_PCB>( aUnits, DRCE_OVERLAPPING_FOOTPRINTS,
(wxPoint) courtyard.CVertex( 0, 0, -1 ),
footprint, candidate );
HandleMarker( std::move( m ) );
success = false;
}
}
@ -168,13 +159,10 @@ bool DRC_COURTYARD_OVERLAP::RunDRC( BOARD& aBoard ) const
if( courtyard.OutlineCount() )
{
//Overlap between footprint and candidate
auto& pos = courtyard.CVertex( 0, 0, -1 );
auto marker = std::unique_ptr<MARKER_PCB>( marker_factory.NewMarker(
(wxPoint) pos,
footprint,
candidate,
DRCE_OVERLAPPING_FOOTPRINTS ) );
HandleMarker( std::move( marker ) );
auto m = std::make_unique<MARKER_PCB>( aUnits, DRCE_OVERLAPPING_FOOTPRINTS,
(wxPoint) courtyard.CVertex( 0, 0, -1 ),
footprint, candidate );
HandleMarker( std::move( m ) );
success = false;
}
}

View File

@ -35,10 +35,9 @@
class DRC_COURTYARD_OVERLAP : public DRC_PROVIDER
{
public:
DRC_COURTYARD_OVERLAP(
const DRC_MARKER_FACTORY& aMarkerFactory, MARKER_HANDLER aMarkerHandler );
DRC_COURTYARD_OVERLAP( MARKER_HANDLER aMarkerHandler );
bool RunDRC( BOARD& aBoard ) const override;
bool RunDRC( EDA_UNITS aUnits, BOARD& aBoard ) const override;
};
#endif // DRC_COURTYARD_OVERLAP__H

View File

@ -58,7 +58,6 @@
DRC::DRC() :
PCB_TOOL_BASE( "pcbnew.DRCTool" ),
m_currentMarker( nullptr ),
m_pcbEditorFrame( nullptr ),
m_pcb( nullptr ),
m_drcDialog( nullptr )
@ -75,7 +74,7 @@ DRC::DRC() :
m_drcRun = false;
m_footprintsTested = false;
m_severities = DRC_SHOW_ERRORS | DRC_SHOW_WARNINGS | DRC_SHOW_INFOS;
m_severities = SEVERITY_ERROR | SEVERITY_WARNING;
m_segmAngle = 0;
m_segmLength = 0;
@ -107,8 +106,6 @@ void DRC::Reset( RESET_REASON aReason )
DestroyDRCDialog( wxID_OK );
m_pcb = m_pcbEditorFrame->GetBoard();
m_markerFactory.SetUnitsProvider( [=]() { return m_pcbEditorFrame->GetUserUnits(); } );
}
}
@ -177,10 +174,9 @@ void DRC::DestroyDRCDialog( int aReason )
}
int DRC::TestZoneToZoneOutline( ZONE_CONTAINER* aZone, bool aCreateMarkers )
int DRC::TestZoneToZoneOutlines()
{
BOARD* board = m_pcbEditorFrame->GetBoard();
BOARD_COMMIT commit( m_pcbEditorFrame );
int nerrors = 0;
std::vector<SHAPE_POLY_SET> smoothed_polys;
@ -203,13 +199,9 @@ int DRC::TestZoneToZoneOutline( ZONE_CONTAINER* aZone, bool aCreateMarkers )
if( !zoneRef->IsOnCopperLayer() )
continue;
// When testing only a single area, skip all others
if( aZone && ( aZone != zoneRef) )
continue;
// If we are testing a single zone, then iterate through all other zones
// Otherwise, we have already tested the zone combination
for( int ia2 = ( aZone ? 0 : ia + 1 ); ia2 < board->GetAreaCount(); ia2++ )
for( int ia2 = ia + 1; ia2 < board->GetAreaCount(); ia2++ )
{
ZONE_CONTAINER* zoneToTest = board->GetArea( ia2 );
@ -252,10 +244,8 @@ int DRC::TestZoneToZoneOutline( ZONE_CONTAINER* aZone, bool aCreateMarkers )
if( smoothed_polys[ia2].Contains( currentVertex ) )
{
if( aCreateMarkers )
commit.Add( m_markerFactory.NewMarker( pt, zoneRef, zoneToTest,
DRCE_ZONES_INTERSECT ) );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_ZONES_INTERSECT, pt,
zoneRef, zoneToTest ) );
nerrors++;
}
}
@ -268,10 +258,8 @@ int DRC::TestZoneToZoneOutline( ZONE_CONTAINER* aZone, bool aCreateMarkers )
if( smoothed_polys[ia].Contains( currentVertex ) )
{
if( aCreateMarkers )
commit.Add( m_markerFactory.NewMarker( pt, zoneToTest, zoneRef,
DRCE_ZONES_INTERSECT ) );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_ZONES_INTERSECT, pt,
zoneToTest, zoneRef ) );
nerrors++;
}
}
@ -317,18 +305,13 @@ int DRC::TestZoneToZoneOutline( ZONE_CONTAINER* aZone, bool aCreateMarkers )
for( wxPoint pt : conflictPoints )
{
if( aCreateMarkers )
commit.Add( m_markerFactory.NewMarker( pt, zoneRef, zoneToTest,
DRCE_ZONES_TOO_CLOSE ) );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_ZONES_TOO_CLOSE, pt,
zoneRef, zoneToTest ) );
nerrors++;
}
}
}
if( aCreateMarkers )
commit.Push( wxEmptyString, false, false );
return nerrors;
}
@ -454,8 +437,8 @@ void DRC::RunTests( wxTextCtrl* aMessages )
testCopperTextAndGraphics();
// find overlapping courtyard ares.
if( m_pcb->GetDesignSettings().m_ProhibitOverlappingCourtyards
|| m_pcb->GetDesignSettings().m_RequireCourtyards )
if( !m_pcb->GetDesignSettings().Ignore( DRCE_OVERLAPPING_FOOTPRINTS )
&& !m_pcb->GetDesignSettings().Ignore( DRCE_MISSING_COURTYARD_IN_FOOTPRINT ) )
{
if( aMessages )
{
@ -518,13 +501,15 @@ void DRC::updatePointers()
// update my pointers, m_pcbEditorFrame is the only unchangeable one
m_pcb = m_pcbEditorFrame->GetBoard();
m_pcbEditorFrame->ResolveDRCExclusions();
if( m_drcDialog ) // Use diag list boxes only in DRC dialog
{
m_drcDialog->SetMarkersProvider( new BOARD_DRC_ITEMS_PROVIDER( m_pcb ) );
m_drcDialog->SetUnconnectedProvider( new VECTOR_DRC_ITEMS_PROVIDER( &m_unconnected ) );
m_drcDialog->SetFootprintsProvider( new VECTOR_DRC_ITEMS_PROVIDER( &m_footprints ) );
m_drcDialog->UpdateDisplayedCounts();
m_drcDialog->SetUnconnectedProvider( new RATSNEST_DRC_ITEMS_PROVIDER( m_pcbEditorFrame,
&m_unconnected ) );
m_drcDialog->SetFootprintsProvider( new VECTOR_DRC_ITEMS_PROVIDER( m_pcbEditorFrame,
&m_footprints ) );
}
}
@ -546,8 +531,7 @@ bool DRC::doNetClass( const NETCLASSPTR& nc, wxString& msg )
FmtVal( g.m_TrackClearance )
);
addMarkerToPcb( fillMarker( DRCE_NETCLASS_CLEARANCE, msg, m_currentMarker ) );
m_currentMarker = nullptr;
addMarkerToPcb( new MARKER_PCB( DRCE_NETCLASS_CLEARANCE, msg ) );
ret = false;
}
#endif
@ -560,7 +544,7 @@ bool DRC::doNetClass( const NETCLASSPTR& nc, wxString& msg )
FmtVal( g.m_TrackMinWidth )
);
addMarkerToPcb( m_markerFactory.NewMarker( DRCE_NETCLASS_TRACKWIDTH, msg ) );
addMarkerToPcb( new MARKER_PCB( DRCE_NETCLASS_TRACKWIDTH, msg ) );
ret = false;
}
@ -572,7 +556,7 @@ bool DRC::doNetClass( const NETCLASSPTR& nc, wxString& msg )
FmtVal( g.m_ViasMinSize )
);
addMarkerToPcb( m_markerFactory.NewMarker( DRCE_NETCLASS_VIASIZE, msg ) );
addMarkerToPcb( new MARKER_PCB( DRCE_NETCLASS_VIASIZE, msg ) );
ret = false;
}
@ -584,7 +568,7 @@ bool DRC::doNetClass( const NETCLASSPTR& nc, wxString& msg )
FmtVal( g.m_ViasMinDrill )
);
addMarkerToPcb( m_markerFactory.NewMarker( DRCE_NETCLASS_VIADRILLSIZE, msg ) );
addMarkerToPcb( new MARKER_PCB( DRCE_NETCLASS_VIADRILLSIZE, msg ) );
ret = false;
}
@ -595,7 +579,7 @@ bool DRC::doNetClass( const NETCLASSPTR& nc, wxString& msg )
FmtVal( nc->GetuViaDiameter() ),
FmtVal( g.m_MicroViasMinSize ) );
addMarkerToPcb( m_markerFactory.NewMarker( DRCE_NETCLASS_uVIASIZE, msg ) );
addMarkerToPcb( new MARKER_PCB( DRCE_NETCLASS_uVIASIZE, msg ) );
ret = false;
}
@ -606,7 +590,7 @@ bool DRC::doNetClass( const NETCLASSPTR& nc, wxString& msg )
FmtVal( nc->GetuViaDrill() ),
FmtVal( g.m_MicroViasMinDrill ) );
addMarkerToPcb( m_markerFactory.NewMarker( DRCE_NETCLASS_uVIADRILLSIZE, msg ) );
addMarkerToPcb( new MARKER_PCB( DRCE_NETCLASS_uVIADRILLSIZE, msg ) );
ret = false;
}
@ -666,12 +650,7 @@ void DRC::testPad2Pad()
{
int x_limit = pad->GetClearance() + pad->GetBoundingRadius() + pad->GetPosition().x;
if( !doPadToPadsDrc( pad, &pad, listEnd, max_size + x_limit ) )
{
wxASSERT( m_currentMarker );
addMarkerToPcb ( m_currentMarker );
m_currentMarker = nullptr;
}
doPadToPadsDrc( pad, &pad, listEnd, max_size + x_limit );
}
}
@ -791,14 +770,7 @@ void DRC::testTracks( wxWindow *aActiveWindow, bool aShowProgressBar )
}
// Test new segment against tracks and pads, optionally against copper zones
if( !doTrackDrc( *seg_it, seg_it + 1, m_pcb->Tracks().end(), m_doZonesTest ) )
{
if( m_currentMarker )
{
addMarkerToPcb ( m_currentMarker );
m_currentMarker = nullptr;
}
}
doTrackDrc( *seg_it, seg_it + 1, m_pcb->Tracks().end(), m_doZonesTest );
}
if( progressDialog )
@ -863,13 +835,13 @@ void DRC::testZones()
if( ( netcode < 0 ) || pads_in_net == 0 )
{
wxPoint markerPos = zone->GetPosition();
addMarkerToPcb( m_markerFactory.NewMarker( markerPos, zone,
DRCE_SUSPICIOUS_NET_FOR_ZONE_OUTLINE ) );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_SUSPICIOUS_NET_FOR_ZONE_OUTLINE,
markerPos, zone ) );
}
}
// Test copper areas outlines, and create markers when needed
TestZoneToZoneOutline( NULL, true );
TestZoneToZoneOutlines();
}
@ -899,8 +871,10 @@ void DRC::testKeepoutAreas()
SEG trackSeg( segm->GetStart(), segm->GetEnd() );
if( area->Outline()->Distance( trackSeg, segm->GetWidth() ) == 0 )
addMarkerToPcb(
m_markerFactory.NewMarker( segm, area, DRCE_TRACK_INSIDE_KEEPOUT ) );
{
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_TRACK_INSIDE_KEEPOUT,
getLocation( segm, area ), segm, area ) );
}
}
else if( segm->Type() == PCB_VIA_T )
{
@ -913,8 +887,10 @@ void DRC::testKeepoutAreas()
continue;
if( area->Outline()->Distance( segm->GetPosition() ) < segm->GetWidth()/2 )
addMarkerToPcb(
m_markerFactory.NewMarker( segm, area, DRCE_VIA_INSIDE_KEEPOUT ) );
{
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_VIA_INSIDE_KEEPOUT,
getLocation( segm, area ), segm, area ) );
}
}
}
// Test pads: TODO
@ -1034,11 +1010,17 @@ void DRC::testCopperDrawItem( DRAWSEGMENT* aItem )
if( trackAsSeg.Distance( itemSeg ) < minDist )
{
if( track->Type() == PCB_VIA_T )
addMarkerToPcb( m_markerFactory.NewMarker(
track, aItem, itemSeg, DRCE_VIA_NEAR_COPPER ) );
{
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_VIA_NEAR_COPPER,
getLocation( track, aItem, itemSeg ),
track, aItem ) );
}
else
addMarkerToPcb( m_markerFactory.NewMarker(
track, aItem, itemSeg, DRCE_TRACK_NEAR_COPPER ) );
{
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_TRACK_NEAR_COPPER,
getLocation( track, aItem, itemSeg ),
track, aItem ) );
}
break;
}
}
@ -1061,7 +1043,8 @@ void DRC::testCopperDrawItem( DRAWSEGMENT* aItem )
{
if( padOutline.Distance( itemSeg, itemWidth ) == 0 )
{
addMarkerToPcb( m_markerFactory.NewMarker( pad, aItem, DRCE_PAD_NEAR_COPPER ) );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_PAD_NEAR_COPPER,
pad->GetPosition(), pad, aItem ) );
break;
}
}
@ -1108,11 +1091,17 @@ void DRC::testCopperTextItem( BOARD_ITEM* aTextItem )
if( trackAsSeg.Distance( textSeg ) < minDist )
{
if( track->Type() == PCB_VIA_T )
addMarkerToPcb( m_markerFactory.NewMarker(
track, aTextItem, textSeg, DRCE_VIA_NEAR_COPPER ) );
{
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_VIA_NEAR_COPPER,
getLocation( track, aTextItem, textSeg ),
track, aTextItem ) );
}
else
addMarkerToPcb( m_markerFactory.NewMarker(
track, aTextItem, textSeg, DRCE_TRACK_NEAR_COPPER ) );
{
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_TRACK_NEAR_COPPER,
getLocation( track, aTextItem, textSeg ),
track, aTextItem ) );
}
break;
}
}
@ -1143,7 +1132,8 @@ void DRC::testCopperTextItem( BOARD_ITEM* aTextItem )
if( padOutline.Distance( textSeg, 0 ) <= minDist )
{
addMarkerToPcb( m_markerFactory.NewMarker( pad, aTextItem, DRCE_PAD_NEAR_COPPER ) );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_PAD_NEAR_COPPER,
pad->GetPosition(), pad, aTextItem ) );
break;
}
}
@ -1159,7 +1149,7 @@ void DRC::testOutline()
if( !m_pcb->GetBoardPolygonOutlines( m_board_outlines, nullptr, &error_loc ) )
{
addMarkerToPcb( m_markerFactory.NewMarker( error_loc, m_pcb, DRCE_INVALID_OUTLINE ) );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_INVALID_OUTLINE, error_loc, m_pcb ) );
return;
}
}
@ -1175,8 +1165,8 @@ void DRC::testDisabledLayers()
disabledLayers &= LSET::AllCuMask();
auto createMarker = [&]( BOARD_ITEM* aItem ) {
addMarkerToPcb( m_markerFactory.NewMarker(
aItem->GetPosition(), aItem, DRCE_DISABLED_LAYER_ITEM ) );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_DISABLED_LAYER_ITEM,
aItem->GetPosition(), aItem ) );
};
for( auto track : board->Tracks() )
@ -1187,7 +1177,8 @@ void DRC::testDisabledLayers()
for( auto module : board->Modules() )
{
module->RunOnChildren( [&]( BOARD_ITEM* aItem )
module->RunOnChildren(
[&]( BOARD_ITEM* aItem )
{
if( disabledLayers.test( aItem->GetLayer() ) )
createMarker( aItem );
@ -1274,7 +1265,8 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li
if( !checkClearancePadToPad( aRefPad, &dummypad ) )
{
// here we have a drc error on pad!
m_currentMarker = m_markerFactory.NewMarker( pad, aRefPad, DRCE_HOLE_NEAR_PAD );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_HOLE_NEAR_PAD,
pad->GetPosition(), pad, aRefPad ) );
return false;
}
}
@ -1290,7 +1282,8 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li
if( !checkClearancePadToPad( pad, &dummypad ) )
{
// here we have a drc error on aRefPad!
m_currentMarker = m_markerFactory.NewMarker( aRefPad, pad, DRCE_HOLE_NEAR_PAD );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_HOLE_NEAR_PAD,
aRefPad->GetPosition(), aRefPad, pad ) );
return false;
}
}
@ -1325,7 +1318,8 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li
if( !checkClearancePadToPad( aRefPad, pad ) )
{
// here we have a drc error!
m_currentMarker = m_markerFactory.NewMarker( aRefPad, pad, DRCE_PAD_NEAR_PAD1 );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_PAD_NEAR_PAD1,
aRefPad->GetPosition(), aRefPad, pad ) );
return false;
}
}
@ -1336,10 +1330,9 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li
void DRC::doOverlappingCourtyardsDrc()
{
DRC_COURTYARD_OVERLAP drc_overlap(
m_markerFactory, [&]( MARKER_PCB* aMarker ) { addMarkerToPcb( aMarker ); } );
DRC_COURTYARD_OVERLAP drc_overlap( [&]( MARKER_PCB* aMarker ) { addMarkerToPcb( aMarker ); } );
drc_overlap.RunDRC( *m_pcb );
drc_overlap.RunDRC( userUnits(), *m_pcb );
}
@ -1400,4 +1393,58 @@ void DRC::setTransitions()
}
const int EPSILON = Mils2iu( 5 );
wxPoint DRC::getLocation( TRACK* aTrack, ZONE_CONTAINER* aConflictZone ) const
{
SHAPE_POLY_SET* conflictOutline;
if( aConflictZone->IsFilled() )
conflictOutline = const_cast<SHAPE_POLY_SET*>( &aConflictZone->GetFilledPolysList() );
else
conflictOutline = aConflictZone->Outline();
wxPoint pt1 = aTrack->GetPosition();
wxPoint pt2 = aTrack->GetEnd();
// If the mid-point is in the zone, then that's a fine place for the marker
if( conflictOutline->Distance( ( pt1 + pt2 ) / 2 ) == 0 )
return ( pt1 + pt2 ) / 2;
// Otherwise do a binary search for a "good enough" marker location
else
{
while( GetLineLength( pt1, pt2 ) > EPSILON )
{
if( conflictOutline->Distance( pt1 ) < conflictOutline->Distance( pt2 ) )
pt2 = ( pt1 + pt2 ) / 2;
else
pt1 = ( pt1 + pt2 ) / 2;
}
// Once we're within EPSILON pt1 and pt2 are "equivalent"
return pt1;
}
}
wxPoint DRC::getLocation( TRACK* aTrack, BOARD_ITEM* aConflitItem, const SEG& aConflictSeg ) const
{
wxPoint pt1 = aTrack->GetPosition();
wxPoint pt2 = aTrack->GetEnd();
// Do a binary search along the track for a "good enough" marker location
while( GetLineLength( pt1, pt2 ) > EPSILON )
{
if( aConflictSeg.Distance( pt1 ) < aConflictSeg.Distance( pt2 ) )
pt2 = ( pt1 + pt2 ) / 2;
else
pt1 = ( pt1 + pt2 ) / 2;
}
// Once we're within EPSILON pt1 and pt2 are "equivalent"
return pt1;
}

View File

@ -27,12 +27,12 @@
#include <class_board.h>
#include <class_track.h>
#include <class_marker_pcb.h>
#include <geometry/seg.h>
#include <geometry/shape_poly_set.h>
#include <memory>
#include <vector>
#include <tools/pcb_tool_base.h>
#include <drc/drc_marker_factory.h>
#define OK_DRC 0
#define BAD_DRC 1
@ -43,24 +43,16 @@
// and using #define that shows each numerical value helps for debug.
/// DRC error codes:
#define DRCE_ 1 // not used yet
#define DRCE_FIRST 2
#define DRCE_UNCONNECTED_ITEMS 2 ///< items are unconnected
#define DRCE_TRACK_NEAR_THROUGH_HOLE 3 ///< thru hole is too close to track
#define DRCE_TRACK_NEAR_PAD 4 ///< pad too close to track
#define DRCE_TRACK_NEAR_VIA 5 ///< track too close to via
#define DRCE_VIA_NEAR_VIA 6 ///< via too close to via
#define DRCE_VIA_NEAR_TRACK 7 ///< via too close to track
#define DRCE_TRACK_ENDS1 8 ///< 2 parallel track segments too close: fine start point test
#define DRCE_TRACK_ENDS2 9 ///< 2 parallel track segments too close: fine start point test
#define DRCE_TRACK_ENDS3 10 ///< 2 parallel track segments too close: fine end point test
#define DRCE_TRACK_ENDS4 11 ///< 2 parallel track segments too close: fine end point test
#define DRCE_TRACK_ENDS 8 ///< track ends are too close
#define DRCE_TRACK_SEGMENTS_TOO_CLOSE 12 ///< 2 parallel track segments too close: segm ends between segref ends
#define DRCE_TRACKS_CROSSING 13 ///< tracks are crossing
#define DRCE_ENDS_PROBLEM1 14 ///< track ends are too close
#define DRCE_ENDS_PROBLEM2 15 ///< track ends are too close
#define DRCE_ENDS_PROBLEM3 16 ///< track ends are too close
#define DRCE_ENDS_PROBLEM4 17 ///< track ends are too close
#define DRCE_ENDS_PROBLEM5 18 ///< track ends are too close
#define DRCE_PAD_NEAR_PAD1 19 ///< pad too close to pad
#define DRCE_VIA_HOLE_BIGGER 20 ///< via's hole is bigger than its diameter
#define DRCE_MICRO_VIA_INCORRECT_LAYER_PAIR 21 ///< micro via's layer pair incorrect (layers must be adjacent)
@ -110,6 +102,8 @@
#define DRCE_ZERO_LENGTH_TRACK 64
#define DRCE_TRACK_IN_PAD 65
#define DRCE_LAST 65
class PCB_EDIT_FRAME;
class DIALOG_DRC_CONTROL;
@ -163,8 +157,6 @@ private:
bool m_testFootprints; // Test footprints against schematic
int m_severities; // Severities of DRC violations to display
MARKER_PCB* m_currentMarker;
/* In DRC functions, many calculations are using coordinates relative
* to the position of the segment under test (segm to segm DRC, segm to pad DRC
* Next variables store coordinates relative to the start point of this segment
@ -192,7 +184,6 @@ private:
BOARD* m_pcb;
SHAPE_POLY_SET m_board_outlines; ///< The board outline including cutouts
DIALOG_DRC_CONTROL* m_drcDialog;
DRC_MARKER_FACTORY m_markerFactory; ///< Class that generates markers
DRC_LIST m_unconnected; ///< list of unconnected pads, as DRC_ITEMs
DRC_LIST m_footprints; ///< list of footprint warnings, as DRC_ITEMs
@ -208,11 +199,19 @@ private:
*/
void updatePointers();
EDA_UNITS userUnits() const { return m_pcbEditorFrame->GetUserUnits(); }
/**
* Adds a DRC marker to the PCB through the COMMIT mechanism.
*/
void addMarkerToPcb( MARKER_PCB* aMarker );
/**
* Fetches a reasonable point for marking a violoation between two non-point objects.
*/
wxPoint getLocation( TRACK* aTrack, ZONE_CONTAINER* aConflictZone ) const;
wxPoint getLocation( TRACK* aTrack, BOARD_ITEM* aConflitItem, const SEG& aConflictSeg ) const;
//-----<categorical group tests>-----------------------------------------
/**
@ -289,7 +288,7 @@ private:
* @return bool - true if no problems, else false and m_currentMarker is
* filled in with the problem information.
*/
bool doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterator aEndIt,
void doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterator aEndIt,
bool aTestZones );
/**
@ -355,13 +354,9 @@ public:
/**
* Tests whether distance between zones complies with the DRC rules.
*
* @param aZone: zone to compare with other zones, or if NULL then
* all zones are compared to all others.
* @param aCreateMarkers: if true create DRC markers.
* False: do not create markers. only fing drc errors
* @return Errors count
*/
int TestZoneToZoneOutline( ZONE_CONTAINER* aZone, bool aCreateMarkers );
int TestZoneToZoneOutlines();
/**
* Test the board footprints against a netlist. Will report DRCE_MISSING_FOOTPRINT,

View File

@ -107,50 +107,19 @@ bool poly2segmentDRC( wxPoint* aTref, int aTrefCount, wxPoint aSegStart, wxPoint
}
#define PUSH_NEW_MARKER_3( a, b, c ) push_back( m_markerFactory.NewMarker( a, b, c ) )
#define PUSH_NEW_MARKER_4( a, b, c, d ) push_back( m_markerFactory.NewMarker( a, b, c, d ) )
bool DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterator aEndIt,
void DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterator aEndIt,
bool aTestZones )
{
TRACK* track;
wxPoint delta; // length on X and Y axis of segments
wxPoint shape_pos;
std::vector<MARKER_PCB*> markers;
auto commitMarkers = [&]()
{
BOARD_COMMIT commit( m_pcbEditorFrame );
for( MARKER_PCB* marker : markers )
commit.Add( marker );
commit.Push( wxEmptyString, false, false );
};
// Returns false if we should return false from call site, or true to continue
auto handleNewMarker = [&]() -> bool
{
if( !m_reportAllTrackErrors )
{
if( markers.size() > 0 )
commitMarkers();
return false;
}
else
return true;
};
NETCLASSPTR netclass = aRefSeg->GetNetClass();
BOARD_DESIGN_SETTINGS& dsnSettings = m_pcb->GetDesignSettings();
/* In order to make some calculations more easier or faster,
* pads and tracks coordinates will be made relative to the reference segment origin
*/
wxPoint origin = aRefSeg->GetStart(); // origin will be the origin of other coordinates
// In order to make some calculations more easier or faster, pads and tracks
// coordinates will be made relative to the reference segment origin
wxPoint origin = aRefSeg->GetStart();
m_segmEnd = delta = aRefSeg->GetEnd() - origin;
m_segmAngle = 0;
@ -168,43 +137,34 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
if( aRefSeg->Type() == PCB_VIA_T )
{
VIA *refvia = static_cast<VIA*>( aRefSeg );
wxPoint refviaPos = refvia->GetPosition();
// test if the via size is smaller than minimum
if( refvia->GetViaType() == VIATYPE::MICROVIA )
{
if( refvia->GetWidth() < dsnSettings.m_MicroViasMinSize )
{
markers.PUSH_NEW_MARKER_3( refviaPos, refvia, DRCE_TOO_SMALL_MICROVIA );
if( !handleNewMarker() )
return false;
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_TOO_SMALL_MICROVIA,
refvia->GetPosition(), refvia ) );
}
if( refvia->GetDrillValue() < dsnSettings.m_MicroViasMinDrill )
{
markers.PUSH_NEW_MARKER_3( refviaPos, refvia, DRCE_TOO_SMALL_MICROVIA_DRILL );
if( !handleNewMarker() )
return false;
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_TOO_SMALL_MICROVIA_DRILL,
refvia->GetPosition(), refvia ) );
}
}
else
{
if( refvia->GetWidth() < dsnSettings.m_ViasMinSize )
{
markers.PUSH_NEW_MARKER_3( refviaPos, refvia, DRCE_TOO_SMALL_VIA );
if( !handleNewMarker() )
return false;
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_TOO_SMALL_VIA,
refvia->GetPosition(), refvia ) );
}
if( refvia->GetDrillValue() < dsnSettings.m_ViasMinDrill )
{
markers.PUSH_NEW_MARKER_3( refviaPos, refvia, DRCE_TOO_SMALL_VIA_DRILL );
if( !handleNewMarker() )
return false;
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_TOO_SMALL_VIA_DRILL,
refvia->GetPosition(), refvia ) );
}
}
@ -213,28 +173,22 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
// and a default via hole can be bigger than some vias sizes
if( refvia->GetDrillValue() > refvia->GetWidth() )
{
markers.PUSH_NEW_MARKER_3( refviaPos, refvia, DRCE_VIA_HOLE_BIGGER );
if( !handleNewMarker() )
return false;
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_VIA_HOLE_BIGGER,
refvia->GetPosition(), refvia ) );
}
// test if the type of via is allowed due to design rules
if( refvia->GetViaType() == VIATYPE::MICROVIA && !dsnSettings.m_MicroViasAllowed )
{
markers.PUSH_NEW_MARKER_3( refviaPos, refvia, DRCE_MICRO_VIA_NOT_ALLOWED );
if( !handleNewMarker() )
return false;
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_MICRO_VIA_NOT_ALLOWED,
refvia->GetPosition(), refvia ) );
}
// test if the type of via is allowed due to design rules
if( refvia->GetViaType() == VIATYPE::BLIND_BURIED && !dsnSettings.m_BlindBuriedViaAllowed )
{
markers.PUSH_NEW_MARKER_3( refviaPos, refvia, DRCE_BURIED_VIA_NOT_ALLOWED );
if( !handleNewMarker() )
return false;
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_BURIED_VIA_NOT_ALLOWED,
refvia->GetPosition(), refvia ) );
}
// For microvias: test if they are blind vias and only between 2 layers
@ -257,10 +211,8 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
if( err )
{
markers.PUSH_NEW_MARKER_3( refviaPos, refvia, DRCE_MICRO_VIA_INCORRECT_LAYER_PAIR );
if( !handleNewMarker() )
return false;
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_MICRO_VIA_INCORRECT_LAYER_PAIR,
refvia->GetPosition(), refvia ) );
}
}
@ -271,10 +223,8 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
{
wxPoint refsegMiddle = ( aRefSeg->GetStart() + aRefSeg->GetEnd() ) / 2;
markers.PUSH_NEW_MARKER_3( refsegMiddle, aRefSeg, DRCE_TOO_SMALL_TRACK_WIDTH );
if( !handleNewMarker() )
return false;
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_TOO_SMALL_TRACK_WIDTH,
refsegMiddle, aRefSeg ) );
}
}
@ -328,17 +278,20 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
dummypad.SetSize( pad->GetDrillSize() );
dummypad.SetPosition( pad->GetPosition() );
dummypad.SetShape( pad->GetDrillShape() == PAD_DRILL_SHAPE_OBLONG ?
PAD_SHAPE_OVAL : PAD_SHAPE_CIRCLE );
PAD_SHAPE_OVAL :
PAD_SHAPE_CIRCLE );
dummypad.SetOrientation( pad->GetOrientation() );
m_padToTestPos = dummypad.GetPosition() - origin;
if( !checkClearanceSegmToPad( &dummypad, ref_seg_width, ref_seg_clearance ) )
{
markers.PUSH_NEW_MARKER_4( aRefSeg, pad, padSeg, DRCE_TRACK_NEAR_THROUGH_HOLE );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_TRACK_NEAR_THROUGH_HOLE,
getLocation( aRefSeg, pad, padSeg ),
aRefSeg, pad ) );
if( !handleNewMarker() )
return false;
if( !m_reportAllTrackErrors )
return;
}
continue;
@ -357,10 +310,12 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
if( !checkClearanceSegmToPad( pad, ref_seg_width, segToPadClearance ) )
{
markers.PUSH_NEW_MARKER_4( aRefSeg, pad, padSeg, DRCE_TRACK_NEAR_PAD );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_TRACK_NEAR_PAD,
getLocation( aRefSeg, pad, padSeg ),
aRefSeg, pad ) );
if( !handleNewMarker() )
return false;
if( !m_reportAllTrackErrors )
return;
}
}
}
@ -403,17 +358,17 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
{
delta = track->GetEnd() - track->GetStart();
segStartPoint = aRefSeg->GetStart() - track->GetStart();
wxPoint pos = aRefSeg->GetPosition();
if( track->Type() == PCB_VIA_T )
{
// Test distance between two vias, i.e. two circles, trivial case
if( EuclideanNorm( segStartPoint ) < w_dist )
{
markers.PUSH_NEW_MARKER_4( pos, aRefSeg, track, DRCE_VIA_NEAR_VIA );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_VIA_NEAR_VIA,
aRefSeg->GetPosition(), aRefSeg, track ) );
if( !handleNewMarker() )
return false;
if( !m_reportAllTrackErrors )
return;
}
}
else // test via to segment
@ -427,10 +382,11 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
if( !checkMarginToCircle( segStartPoint, w_dist, delta.x ) )
{
markers.PUSH_NEW_MARKER_4( pos, aRefSeg, track, DRCE_VIA_NEAR_TRACK );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_VIA_NEAR_TRACK,
aRefSeg->GetPosition(), aRefSeg, track ) );
if( !handleNewMarker() )
return false;
if( !m_reportAllTrackErrors )
return;
}
}
@ -453,10 +409,11 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
if( checkMarginToCircle( segStartPoint, w_dist, m_segmLength ) )
continue;
markers.PUSH_NEW_MARKER_4( aRefSeg, track, seg, DRCE_TRACK_NEAR_VIA );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_TRACK_NEAR_VIA,
getLocation( aRefSeg, track, seg ), aRefSeg, track ) );
if( !handleNewMarker() )
return false;
if( !m_reportAllTrackErrors )
return;
}
/* We have changed axis:
@ -481,18 +438,22 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
// Fine test : we consider the rounded shape of each end of the track segment:
if( segStartPoint.x >= 0 && segStartPoint.x <= m_segmLength )
{
markers.PUSH_NEW_MARKER_4( aRefSeg, track, seg, DRCE_TRACK_ENDS1 );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_TRACK_ENDS,
getLocation( aRefSeg, track, seg ),
aRefSeg, track ) );
if( !handleNewMarker() )
return false;
if( !m_reportAllTrackErrors )
return;
}
if( !checkMarginToCircle( segStartPoint, w_dist, m_segmLength ) )
{
markers.PUSH_NEW_MARKER_4( aRefSeg, track, seg, DRCE_TRACK_ENDS2 );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_TRACK_ENDS,
getLocation( aRefSeg, track, seg ),
aRefSeg, track ) );
if( !handleNewMarker() )
return false;
if( !m_reportAllTrackErrors )
return;
}
}
@ -504,18 +465,22 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
// Fine test : we consider the rounded shape of the ends
if( segEndPoint.x >= 0 && segEndPoint.x <= m_segmLength )
{
markers.PUSH_NEW_MARKER_4( aRefSeg, track, seg, DRCE_TRACK_ENDS3 );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_TRACK_ENDS,
getLocation( aRefSeg, track, seg ),
aRefSeg, track ) );
if( !handleNewMarker() )
return false;
if( !m_reportAllTrackErrors )
return;
}
if( !checkMarginToCircle( segEndPoint, w_dist, m_segmLength ) )
{
markers.PUSH_NEW_MARKER_4( aRefSeg, track, seg, DRCE_TRACK_ENDS4 );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_TRACK_ENDS,
getLocation( aRefSeg, track, seg ),
aRefSeg, track ) );
if( !handleNewMarker() )
return false;
if( !m_reportAllTrackErrors )
return;
}
}
@ -526,10 +491,12 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
// handled)
// X.............X
// O--REF--+
markers.PUSH_NEW_MARKER_4( aRefSeg, track, seg, DRCE_TRACK_SEGMENTS_TOO_CLOSE );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_TRACK_SEGMENTS_TOO_CLOSE,
getLocation( aRefSeg, track, seg ),
aRefSeg, track ) );
if( !handleNewMarker() )
return false;
if( !m_reportAllTrackErrors )
return;
}
}
else if( segStartPoint.x == segEndPoint.x ) // perpendicular segments
@ -543,29 +510,32 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
if( ( segStartPoint.y < 0 ) && ( segEndPoint.y > 0 ) )
{
MARKER_PCB* m = m_markerFactory.NewMarker( aRefSeg, track, seg,
DRCE_TRACKS_CROSSING );
m->SetPosition( wxPoint( track->GetStart().x, aRefSeg->GetStart().y ) );
markers.push_back( m );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_TRACKS_CROSSING,
wxPoint( track->GetStart().x, aRefSeg->GetStart().y ),
aRefSeg, track ) );
if( !handleNewMarker() )
return false;
if( !m_reportAllTrackErrors )
return;
}
// At this point the drc error is due to an end near a reference segm end
if( !checkMarginToCircle( segStartPoint, w_dist, m_segmLength ) )
{
markers.PUSH_NEW_MARKER_4( aRefSeg, track, seg, DRCE_ENDS_PROBLEM1 );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_TRACK_ENDS,
getLocation( aRefSeg, track, seg ),
aRefSeg, track ) );
if( !handleNewMarker() )
return false;
if( !m_reportAllTrackErrors )
return;
}
if( !checkMarginToCircle( segEndPoint, w_dist, m_segmLength ) )
{
markers.PUSH_NEW_MARKER_4( aRefSeg, track, seg, DRCE_ENDS_PROBLEM2 );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_TRACK_ENDS,
getLocation( aRefSeg, track, seg ),
aRefSeg, track ) );
if( !handleNewMarker() )
return false;
if( !m_reportAllTrackErrors )
return;
}
}
else // segments quelconques entre eux
@ -592,24 +562,23 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
if( !checkLine( segStartPoint, segEndPoint ) )
{
wxPoint failurePoint;
MARKER_PCB* m;
if( SegmentIntersectsSegment( aRefSeg->GetStart(), aRefSeg->GetEnd(),
track->GetStart(), track->GetEnd(),
&failurePoint ) )
{
m = m_markerFactory.NewMarker( aRefSeg, track, seg, DRCE_TRACKS_CROSSING );
m->SetPosition( failurePoint );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_TRACKS_CROSSING,
failurePoint, aRefSeg, track ) );
}
else
{
m = m_markerFactory.NewMarker( aRefSeg, track, seg, DRCE_ENDS_PROBLEM3 );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_TRACK_ENDS,
getLocation( aRefSeg, track, seg ),
aRefSeg, track ) );
}
markers.push_back( m );
if( !handleNewMarker() )
return false;
if( !m_reportAllTrackErrors )
return;
}
else // The drc error is due to the starting or the ending point of the reference segment
{
@ -635,18 +604,22 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
if( !checkMarginToCircle( relStartPos, w_dist, delta.x ) )
{
markers.PUSH_NEW_MARKER_4( aRefSeg, track, seg, DRCE_ENDS_PROBLEM4 );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_TRACK_ENDS,
getLocation( aRefSeg, track, seg ),
aRefSeg, track ) );
if( !handleNewMarker() )
return false;
if( !m_reportAllTrackErrors )
return;
}
if( !checkMarginToCircle( relEndPos, w_dist, delta.x ) )
{
markers.PUSH_NEW_MARKER_4( aRefSeg, track, seg, DRCE_ENDS_PROBLEM5 );
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_TRACK_ENDS,
getLocation( aRefSeg, track, seg ),
aRefSeg, track ) );
if( !handleNewMarker() )
return false;
if( !m_reportAllTrackErrors )
return;
}
}
}
@ -682,7 +655,10 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
// (1 micron)
#define THRESHOLD_DIST Millimeter2iu( 0.001 )
if( error > THRESHOLD_DIST )
addMarkerToPcb( m_markerFactory.NewMarker( aRefSeg, zone, DRCE_TRACK_NEAR_ZONE ) );
{
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_TRACK_NEAR_ZONE,
getLocation( aRefSeg, zone ), aRefSeg, zone ) );
}
}
}
@ -725,25 +701,11 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
// Best-efforts search for edge segment
BOARD::IterateForward<BOARD_ITEM*>( m_pcb->Drawings(), inspector, nullptr, types );
if( edge )
markers.PUSH_NEW_MARKER_4( (wxPoint) pt, aRefSeg, edge, DRCE_TRACK_NEAR_EDGE );
else
markers.PUSH_NEW_MARKER_3( (wxPoint) pt, aRefSeg, DRCE_TRACK_NEAR_EDGE );
if( !handleNewMarker() )
return false;
addMarkerToPcb( new MARKER_PCB( userUnits(), DRCE_TRACK_NEAR_EDGE, (wxPoint) pt,
aRefSeg, edge ) );
}
}
}
if( markers.size() > 0 )
{
commitMarkers();
return false;
}
else
return true;
}

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2015-2018 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2015-2020 KiCad Developers, see change_log.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
@ -49,15 +49,7 @@ wxString DRC_ITEM::GetErrorText() const
return wxString( _( "Via too close to via" ) );
case DRCE_VIA_NEAR_TRACK:
return wxString( _( "Via too close to track" ) );
case DRCE_TRACK_ENDS1:
case DRCE_TRACK_ENDS2:
case DRCE_TRACK_ENDS3:
case DRCE_TRACK_ENDS4:
case DRCE_ENDS_PROBLEM1:
case DRCE_ENDS_PROBLEM2:
case DRCE_ENDS_PROBLEM3:
case DRCE_ENDS_PROBLEM4:
case DRCE_ENDS_PROBLEM5:
case DRCE_TRACK_ENDS:
return wxString( _( "Two track ends too close" ) );
case DRCE_TRACK_SEGMENTS_TOO_CLOSE:
return wxString( _( "Two parallel track segments too close" ) );
@ -108,17 +100,17 @@ wxString DRC_ITEM::GetErrorText() const
// use &lt; since this is text ultimately embedded in HTML
case DRCE_NETCLASS_TRACKWIDTH:
return wxString( _( "NetClass Track Width &lt; global limit" ) );
return wxString( _( "NetClass Track Width < global limit" ) );
case DRCE_NETCLASS_CLEARANCE:
return wxString( _( "NetClass Clearance &lt; global limit" ) );
return wxString( _( "NetClass Clearance < global limit" ) );
case DRCE_NETCLASS_VIASIZE:
return wxString( _( "NetClass Via Dia &lt; global limit" ) );
return wxString( _( "NetClass Via Dia < global limit" ) );
case DRCE_NETCLASS_VIADRILLSIZE:
return wxString( _( "NetClass Via Drill &lt; global limit" ) );
return wxString( _( "NetClass Via Drill < global limit" ) );
case DRCE_NETCLASS_uVIASIZE:
return wxString( _( "NetClass uVia Dia &lt; global limit" ) );
return wxString( _( "NetClass uVia Dia < global limit" ) );
case DRCE_NETCLASS_uVIADRILLSIZE:
return wxString( _( "NetClass uVia Drill &lt; global limit" ) );
return wxString( _( "NetClass uVia Drill < global limit" ) );
case DRCE_VIA_INSIDE_KEEPOUT:
return wxString( _( "Via inside keepout area" ) );
@ -168,7 +160,7 @@ wxString DRC_ITEM::GetErrorText() const
return wxString( _( "Remove track inside pad" ) );
default:
return wxString::Format( _( "Unknown DRC error code %d" ), m_ErrorCode );
return wxEmptyString;
}
}
@ -194,39 +186,23 @@ wxString DRC_ITEM::ShowHtml( EDA_UNITS aUnits ) const
errText.Replace( wxT(">"), wxT("&gt;") );
if( m_noCoordinate )
if( m_hasSecondItem )
{
// omit the coordinate, a NETCLASS has no location
return wxString::Format( wxT( "<b>%s</b><br>&nbsp;&nbsp; %s" ),
errText,
mainText );
}
else if( m_hasSecondItem )
{
wxString auxText = m_AuxiliaryText;
wxString auxText = m_AuxText;
auxText.Replace( wxT("<"), wxT("&lt;") );
auxText.Replace( wxT(">"), wxT("&gt;") );
// an html fragment for the entire message in the listbox. feel free
// to add color if you want:
return wxString::Format( wxT( "<b>%s</b><br>"
"<kidiv id='%s'>&nbsp;&nbsp; %s: %s</kidiv><br>"
"<kidiv id='%s'>&nbsp;&nbsp; %s: %s</kidiv>" ),
return wxString::Format( wxT( "<b>%s</b><br>&nbsp;&nbsp; %s<br>&nbsp;&nbsp; %s" ),
errText,
m_mainItemUuid.AsString(),
ShowCoord( aUnits, m_MainPosition ),
mainText,
m_auxItemUuid.AsString(),
ShowCoord( aUnits, m_AuxiliaryPosition ),
auxText );
}
else
{
return wxString::Format( wxT( "<b>%s</b><br>"
"<kidiv id='%s'>&nbsp;&nbsp; %s: %s</kidiv>" ),
return wxString::Format( wxT( "<b>%s</b><br>&nbsp;&nbsp; %s" ),
errText,
m_mainItemUuid.AsString(),
ShowCoord( aUnits, m_MainPosition ),
mainText );
}
}
@ -241,8 +217,8 @@ wxString DRC_ITEM::ShowReport( EDA_UNITS aUnits ) const
GetErrorText(),
ShowCoord( aUnits, m_MainPosition ),
m_MainText,
ShowCoord( aUnits, m_AuxiliaryPosition ),
m_AuxiliaryText );
ShowCoord( aUnits, m_AuxPosition ),
m_AuxText );
}
else
{

View File

@ -1,159 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2004-2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2018-2019 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 "drc_marker_factory.h"
#include <board_design_settings.h>
#include <class_board_item.h>
#include <class_edge_mod.h>
#include <class_marker_pcb.h>
#include <class_pad.h>
#include <class_pcb_text.h>
#include <class_text_mod.h>
#include <class_track.h>
#include <class_zone.h>
#include <common.h>
#include <drc/drc.h>
#include <fctsys.h>
#include <geometry/geometry_utils.h>
#include <pcb_edit_frame.h>
#include <pcbnew.h>
const int EPSILON = Mils2iu( 5 );
DRC_MARKER_FACTORY::DRC_MARKER_FACTORY()
{
SetUnits( EDA_UNITS::MILLIMETRES );
}
void DRC_MARKER_FACTORY::SetUnitsProvider( UNITS_PROVIDER aUnitsProvider )
{
m_units_provider = aUnitsProvider;
}
void DRC_MARKER_FACTORY::SetUnits( EDA_UNITS aUnits )
{
m_units_provider = [=]() { return aUnits; };
}
MARKER_PCB* DRC_MARKER_FACTORY::NewMarker(
TRACK* aTrack, ZONE_CONTAINER* aConflictZone, int aErrorCode ) const
{
SHAPE_POLY_SET* conflictOutline;
if( aConflictZone->IsFilled() )
conflictOutline = const_cast<SHAPE_POLY_SET*>( &aConflictZone->GetFilledPolysList() );
else
conflictOutline = aConflictZone->Outline();
wxPoint markerPos;
wxPoint pt1 = aTrack->GetPosition();
wxPoint pt2 = aTrack->GetEnd();
// If the mid-point is in the zone, then that's a fine place for the marker
if( conflictOutline->Distance( ( pt1 + pt2 ) / 2 ) == 0 )
markerPos = ( pt1 + pt2 ) / 2;
// Otherwise do a binary search for a "good enough" marker location
else
{
while( GetLineLength( pt1, pt2 ) > EPSILON )
{
if( conflictOutline->Distance( pt1 ) < conflictOutline->Distance( pt2 ) )
pt2 = ( pt1 + pt2 ) / 2;
else
pt1 = ( pt1 + pt2 ) / 2;
}
// Once we're within EPSILON pt1 and pt2 are "equivalent"
markerPos = pt1;
}
return new MARKER_PCB( getCurrentUnits(), aErrorCode, markerPos, aTrack, aTrack->GetPosition(),
aConflictZone, aConflictZone->GetPosition() );
}
MARKER_PCB* DRC_MARKER_FACTORY::NewMarker(
TRACK* aTrack, BOARD_ITEM* aConflitItem, const SEG& aConflictSeg, int aErrorCode ) const
{
wxPoint markerPos;
wxPoint pt1 = aTrack->GetPosition();
wxPoint pt2 = aTrack->GetEnd();
// Do a binary search along the track for a "good enough" marker location
while( GetLineLength( pt1, pt2 ) > EPSILON )
{
if( aConflictSeg.Distance( pt1 ) < aConflictSeg.Distance( pt2 ) )
pt2 = ( pt1 + pt2 ) / 2;
else
pt1 = ( pt1 + pt2 ) / 2;
}
// Once we're within EPSILON pt1 and pt2 are "equivalent"
markerPos = pt1;
return new MARKER_PCB( getCurrentUnits(), aErrorCode, markerPos, aTrack, aTrack->GetPosition(),
aConflitItem, aConflitItem->GetPosition() );
}
MARKER_PCB* DRC_MARKER_FACTORY::NewMarker(
D_PAD* aPad, BOARD_ITEM* aConflictItem, int aErrorCode ) const
{
return new MARKER_PCB( getCurrentUnits(), aErrorCode, aPad->GetPosition(), aPad,
aPad->GetPosition(), aConflictItem, aConflictItem->GetPosition() );
}
MARKER_PCB* DRC_MARKER_FACTORY::NewMarker(
const wxPoint& aPos, BOARD_ITEM* aItem, int aErrorCode ) const
{
return new MARKER_PCB(
getCurrentUnits(), aErrorCode, aPos, aItem, aPos, nullptr, wxPoint() );
}
MARKER_PCB* DRC_MARKER_FACTORY::NewMarker(
const wxPoint& aPos, BOARD_ITEM* aItem, BOARD_ITEM* bItem, int aErrorCode ) const
{
return new MARKER_PCB( getCurrentUnits(), aErrorCode, aPos, aItem, aItem->GetPosition(), bItem,
bItem->GetPosition() );
}
MARKER_PCB* DRC_MARKER_FACTORY::NewMarker( int aErrorCode, const wxString& aMessage ) const
{
MARKER_PCB* marker = new MARKER_PCB( aErrorCode, wxPoint(), aMessage, wxPoint() );
marker->SetShowNoCoordinate();
return marker;
}

View File

@ -1,104 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 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 DRC_DRC_MARKER_FACTORY__H
#define DRC_DRC_MARKER_FACTORY__H
#include <class_marker_pcb.h>
#include <common.h> // for EDA_UNITS
class ZONE_CONTAINER;
class TRACK;
class D_PAD;
class SEG;
/**
* Class that constructs DRC markers of various kinds
* with messages according to items and error code
*/
class DRC_MARKER_FACTORY
{
public:
using UNITS_PROVIDER = std::function<EDA_UNITS()>;
DRC_MARKER_FACTORY();
/**
* Set the provider for the units (this will be called for each new
* marker constructed)
* @param aUnitsProvider a callable that returns the current units to use
*/
void SetUnitsProvider( UNITS_PROVIDER aUnitsProvider );
/**
* Set the units provider to a function returning a constant value.
* This is a shorthand for #SetUnitProvider.
*/
void SetUnits( EDA_UNITS aUnits );
/**
* Creates a marker on a track, via or pad.
*
* @param aTrack/aPad The reference item.
* @param aConflitItem Another item on the board which is in conflict with the
* reference item.
* @param aErrorCode An ID for the particular type of error that is being reported.
*/
MARKER_PCB* NewMarker( TRACK* aTrack, BOARD_ITEM* aConflitItem, const SEG& aConflictSeg,
int aErrorCode ) const;
MARKER_PCB* NewMarker( TRACK* aTrack, ZONE_CONTAINER* aConflictZone, int aErrorCode ) const;
MARKER_PCB* NewMarker( D_PAD* aPad, BOARD_ITEM* aConflictItem, int aErrorCode ) const;
/**
* Creates a marker at a given location.
*
* @param aItem The reference item.
* @param aPos Usually the position of the item, but could be more specific for a zone.
* @param aErrorCode An ID for the particular type of error that is being reported.
*/
MARKER_PCB* NewMarker( const wxPoint& aPos, BOARD_ITEM* aItem, int aErrorCode ) const;
MARKER_PCB* NewMarker( const wxPoint& aPos, BOARD_ITEM* aItem, BOARD_ITEM* bItem,
int aErrorCode ) const;
/**
* Create a MARKER which will report on a generic problem with the board which is
* not geographically locatable.
*/
MARKER_PCB* NewMarker( int aErrorCode, const wxString& aMessage ) const;
private:
EDA_UNITS getCurrentUnits() const
{
return m_units_provider();
}
UNITS_PROVIDER m_units_provider;
};
#endif // DRC_DRC_MARKER_FACTORY__H

View File

@ -28,8 +28,6 @@
#include <class_board.h>
#include <class_marker_pcb.h>
#include <drc/drc_marker_factory.h>
#include <functional>
@ -57,26 +55,26 @@ public:
* Note: Board is non-const, as some DRC functions modify the board
* (e.g. zone fill or polygon coalescing)
*/
virtual bool RunDRC( BOARD& aBoard ) const = 0;
virtual bool RunDRC( EDA_UNITS aUnits, BOARD& aBoard ) const = 0;
protected:
DRC_PROVIDER( const DRC_MARKER_FACTORY& aMarkerMaker, MARKER_HANDLER aMarkerHandler );
/**
* Access to the stored reference to a marker constructor
*/
const DRC_MARKER_FACTORY& GetMarkerFactory() const;
DRC_PROVIDER( MARKER_HANDLER aMarkerHandler ) :
m_marker_handler( std::move( aMarkerHandler ) )
{
}
/**
* Pass a given marker to the marker handler
*/
void HandleMarker( std::unique_ptr<MARKER_PCB> aMarker ) const;
void HandleMarker( std::unique_ptr<MARKER_PCB> aMarker ) const
{
// The marker hander currently takes a raw pointer,
// but it also assumes ownership
m_marker_handler( aMarker.release() );
}
private:
/// A marker generator to make markers in the right context
const DRC_MARKER_FACTORY& m_marker_factory;
/// The handler for any generated markers
MARKER_HANDLER m_marker_handler;
};

View File

@ -24,7 +24,7 @@
#include <drc/drc_tree_model.h>
#include <wx/wupdlock.h>
#include <widgets/ui_common.h>
#define WX_DATAVIEW_WINDOW_PADDING 6
@ -56,7 +56,8 @@ BOARD_ITEM* DRC_TREE_MODEL::ToBoardItem( BOARD* aBoard, wxDataViewItem aItem )
}
DRC_TREE_MODEL::DRC_TREE_MODEL( wxDataViewCtrl* aView ) :
DRC_TREE_MODEL::DRC_TREE_MODEL( PCB_BASE_FRAME* aParentFrame, wxDataViewCtrl* aView ) :
m_parentFrame( aParentFrame ),
m_view( aView ),
m_drcItemsProvider( nullptr )
{
@ -69,10 +70,12 @@ DRC_TREE_MODEL::DRC_TREE_MODEL( wxDataViewCtrl* aView ) :
DRC_TREE_MODEL::~DRC_TREE_MODEL()
{
delete m_drcItemsProvider;
// m_tree is all std::unique_ptr based, so it will look after itself
}
void DRC_TREE_MODEL::SetProvider( DRC_ITEMS_PROVIDER* aProvider )
void DRC_TREE_MODEL::rebuildModel( DRC_ITEMS_PROVIDER* aProvider, int aSeverities )
{
wxWindowUpdateLocker updateLock( m_view );
@ -83,22 +86,33 @@ void DRC_TREE_MODEL::SetProvider( DRC_ITEMS_PROVIDER* aProvider )
Cleared();
if( aProvider != m_drcItemsProvider )
{
delete m_drcItemsProvider;
m_drcItemsProvider = aProvider;
}
wxASSERT( m_drcItemsProvider );
if( aSeverities != m_severities )
m_severities = aSeverities;
m_drcItemsProvider->SetSeverities( m_severities );
m_tree.clear();
#define PUSH_NODE( p, item, type ) push_back( std::make_unique<DRC_TREE_NODE>( p, item, type ) )
for( int i = 0; m_drcItemsProvider && i < m_drcItemsProvider->GetCount(); ++i )
{
const DRC_ITEM* drcItem = m_drcItemsProvider->GetItem( i );
DRC_ITEM* drcItem = m_drcItemsProvider->GetItem( i );
m_tree.PUSH_NODE( nullptr, drcItem, DRC_TREE_NODE::MARKER );
DRC_TREE_NODE* node = m_tree.back().get();
node->m_Children.PUSH_NODE( node, drcItem, DRC_TREE_NODE::MAIN_ITEM );
if( drcItem->HasSecondItem() )
if( drcItem->GetAuxItemID() != niluuid )
node->m_Children.PUSH_NODE( node, drcItem, DRC_TREE_NODE::AUX_ITEM );
}
@ -119,6 +133,18 @@ void DRC_TREE_MODEL::SetProvider( DRC_ITEMS_PROVIDER* aProvider )
}
void DRC_TREE_MODEL::SetProvider( DRC_ITEMS_PROVIDER* aProvider )
{
rebuildModel( aProvider, m_severities );
}
void DRC_TREE_MODEL::SetSeverities( int aSeverities )
{
rebuildModel( m_drcItemsProvider, aSeverities );
}
void DRC_TREE_MODEL::ExpandAll()
{
for( std::unique_ptr<DRC_TREE_NODE>& markerNode : m_tree )
@ -162,13 +188,30 @@ void DRC_TREE_MODEL::GetValue( wxVariant& aVariant,
unsigned int aCol ) const
{
const DRC_TREE_NODE* node = ToNode( aItem );
wxASSERT( node );
const DRC_ITEM* drcItem = node->m_DrcItem;
switch( node->m_Type )
{
case DRC_TREE_NODE::MARKER: aVariant = node->m_DrcItem->GetErrorText(); break;
case DRC_TREE_NODE::MAIN_ITEM: aVariant = node->m_DrcItem->GetMainText(); break;
case DRC_TREE_NODE::AUX_ITEM: aVariant = node->m_DrcItem->GetAuxiliaryText(); break;
case DRC_TREE_NODE::MARKER:
{
auto& bds = m_parentFrame->GetBoard()->GetDesignSettings();
bool excluded = drcItem->GetParent() && drcItem->GetParent()->IsExcluded();
bool error = bds.m_DRCSeverities[ drcItem->GetErrorCode() ] == SEVERITY_ERROR;
wxString prefix = wxString::Format( wxT( "%s%s" ),
excluded ? _( "Excluded " ) : wxEmptyString,
error ? _( "Error: " ) : _( "Warning: " ) );
aVariant = prefix + drcItem->GetErrorText();
}
break;
case DRC_TREE_NODE::MAIN_ITEM:
aVariant = drcItem->GetMainText();
break;
case DRC_TREE_NODE::AUX_ITEM:
aVariant = drcItem->GetAuxiliaryText();
break;
}
}
@ -184,18 +227,50 @@ bool DRC_TREE_MODEL::GetAttr( wxDataViewItem const& aItem,
const DRC_TREE_NODE* node = ToNode( aItem );
wxASSERT( node );
switch( node->m_Type )
bool ret = false;
bool heading = node->m_Type == DRC_TREE_NODE::MARKER;
if( heading )
{
case DRC_TREE_NODE::MARKER: aAttr.SetBold( true ); return true;
case DRC_TREE_NODE::MAIN_ITEM: return false;
case DRC_TREE_NODE::AUX_ITEM: return false;
aAttr.SetBold( true );
ret = true;
}
return false;
if( node->m_DrcItem->GetParent() && node->m_DrcItem->GetParent()->IsExcluded() )
{
wxColour textColour = wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOXTEXT );
if( KIGFX::COLOR4D( textColour ).GetBrightness() > 0.5 )
aAttr.SetColour( textColour.ChangeLightness( heading ? 30 : 35 ) );
else
aAttr.SetColour( textColour.ChangeLightness( heading ? 170 : 165 ) );
aAttr.SetItalic( true ); // Strikethrough would be better, if wxWidgets supported it
ret = true;
}
return ret;
}
void DRC_TREE_MODEL::DeleteCurrentItem()
void DRC_TREE_MODEL::ValueChanged( DRC_TREE_NODE* aNode )
{
if( aNode->m_Type == DRC_TREE_NODE::MAIN_ITEM || aNode->m_Type == DRC_TREE_NODE::AUX_ITEM )
{
ValueChanged( aNode->m_Parent );
}
if( aNode->m_Type == DRC_TREE_NODE::MARKER )
{
wxDataViewModel::ValueChanged( ToItem( aNode ), 0 );
for( auto & child : aNode->m_Children )
wxDataViewModel::ValueChanged( ToItem( child.get() ), 0 );
}
}
void DRC_TREE_MODEL::DeleteCurrentItem( bool aDeep )
{
wxDataViewItem dataViewItem = m_view->GetCurrentItem();
DRC_TREE_NODE* tree_node = ToNode( dataViewItem );
@ -211,10 +286,10 @@ void DRC_TREE_MODEL::DeleteCurrentItem()
{
if( m_drcItemsProvider->GetItem( i ) == drc_item )
{
m_drcItemsProvider->DeleteItem( i );
m_drcItemsProvider->DeleteItem( i, aDeep );
m_tree.erase( m_tree.begin() + i );
ItemDeleted( ToItem( nullptr ), dataViewItem );
ItemDeleted( ToItem( tree_node->m_Parent ), dataViewItem );
break;
}
}

View File

@ -26,7 +26,7 @@
#define KICAD_DRC_TREE_MODEL_H
#include <drc/drc.h>
#include <wx/wupdlock.h>
#include <widgets/ui_common.h>
#define WX_DATAVIEW_WINDOW_PADDING 6
@ -41,7 +41,9 @@
class DRC_ITEMS_PROVIDER
{
public:
virtual int GetCount() = 0;
virtual void SetSeverities( int aSeverities ) = 0;
virtual int GetCount( int aSeverity = -1 ) = 0;
/**
* Function GetItem
@ -50,15 +52,15 @@ public:
* @param aIndex The 0 based index into the list of the desired item.
* @return const DRC_ITEM* - the desired item or NULL if aIndex is out of range.
*/
virtual const DRC_ITEM* GetItem( int aIndex ) = 0;
virtual DRC_ITEM* GetItem( int aIndex ) = 0;
/**
* Function DeleteItems
* removes and deletes desired item from the list.
* @param aIndex The 0 based index into the list of the desired item which
* is to be deleted.
* @param aIndex The 0 based index into the list of the desired item which is to be deleted.
* @param aDeep If true, the source item should be deleted as well as the filtered item.
*/
virtual void DeleteItem( int aIndex ) = 0;
virtual void DeleteItem( int aIndex, bool aDeep ) = 0;
/**
* Function DeleteAllItems
@ -76,31 +78,78 @@ public:
*/
class BOARD_DRC_ITEMS_PROVIDER : public DRC_ITEMS_PROVIDER
{
private:
BOARD* m_board;
int m_severities;
std::vector<MARKER_PCB*> m_filteredMarkers;
public:
BOARD_DRC_ITEMS_PROVIDER( BOARD* aBoard ) :
m_board( aBoard )
m_board( aBoard ),
m_severities( 0 )
{
}
int GetCount() override
void SetSeverities( int aSeverities ) override
{
return m_board->GetMARKERCount();
m_severities = aSeverities;
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
m_filteredMarkers.clear();
for( MARKER_PCB* marker : m_board->Markers() )
{
int markerSeverity;
if( marker->IsExcluded() )
markerSeverity = SEVERITY_EXCLUSION;
else
markerSeverity = bds.GetSeverity( marker->GetReporter().GetErrorCode() );
if( markerSeverity & m_severities )
m_filteredMarkers.push_back( marker );
}
}
const DRC_ITEM* GetItem( int aIndex ) override
int GetCount( int aSeverity = -1 ) override
{
const MARKER_PCB* marker = m_board->GetMARKER( aIndex );
if( aSeverity < 0 )
return m_filteredMarkers.size();
int count = 0;
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
for( MARKER_PCB* marker : m_board->Markers() )
{
int markerSeverity;
if( marker->IsExcluded() )
markerSeverity = SEVERITY_EXCLUSION;
else
markerSeverity = bds.GetSeverity( marker->GetReporter().GetErrorCode() );
if( markerSeverity == aSeverity )
count++;
}
return count;
}
DRC_ITEM* GetItem( int aIndex ) override
{
MARKER_PCB* marker = m_filteredMarkers[ aIndex ];
return marker ? &marker->GetReporter() : nullptr;
}
void DeleteItem( int aIndex ) override
void DeleteItem( int aIndex, bool aDeep ) override
{
MARKER_PCB* marker = m_board->GetMARKER( aIndex );
MARKER_PCB* marker = m_filteredMarkers[ aIndex ];
m_filteredMarkers.erase( m_filteredMarkers.begin() + aIndex );
if( marker )
if( aDeep )
m_board->Delete( marker );
}
@ -119,50 +168,119 @@ public:
*/
class VECTOR_DRC_ITEMS_PROVIDER : public DRC_ITEMS_PROVIDER
{
std::vector<DRC_ITEM*>* m_vector;
PCB_BASE_FRAME* m_frame;
std::vector<DRC_ITEM*>* m_sourceVector; // owns its DRC_ITEMs
int m_severities;
std::vector<DRC_ITEM*> m_filteredVector; // does not own its DRC_ITEMs
public:
VECTOR_DRC_ITEMS_PROVIDER( std::vector<DRC_ITEM*>* aList ) :
m_vector( aList )
VECTOR_DRC_ITEMS_PROVIDER( PCB_BASE_FRAME* aFrame, std::vector<DRC_ITEM*>* aList ) :
m_frame( aFrame ),
m_sourceVector( aList ),
m_severities( 0 )
{
}
int GetCount() override
void SetSeverities( int aSeverities ) override
{
return m_vector ? (int) m_vector->size() : 0;
m_severities = aSeverities;
BOARD_DESIGN_SETTINGS& bds = m_frame->GetBoard()->GetDesignSettings();
m_filteredVector.clear();
if( m_sourceVector )
{
for( DRC_ITEM* item : *m_sourceVector )
{
if( bds.GetSeverity( item->GetErrorCode() ) & aSeverities )
m_filteredVector.push_back( item );
}
}
}
const DRC_ITEM* GetItem( int aIndex ) override
int GetCount( int aSeverity = -1 ) override
{
return (*m_vector)[aIndex];
if( aSeverity < 0 )
return m_filteredVector.size();
int count = 0;
BOARD_DESIGN_SETTINGS& bds = m_frame->GetBoard()->GetDesignSettings();
if( m_sourceVector )
{
for( DRC_ITEM* item : *m_sourceVector )
{
if( bds.GetSeverity( item->GetErrorCode() ) == aSeverity )
count++;
}
}
void DeleteItem( int aIndex ) override
return count;
}
DRC_ITEM* GetItem( int aIndex ) override
{
delete (*m_vector)[aIndex];
m_vector->erase( m_vector->begin() + aIndex );
return (m_filteredVector)[aIndex];
}
void DeleteItem( int aIndex, bool aDeep ) override
{
DRC_ITEM* item = m_filteredVector[aIndex];
m_filteredVector.erase( m_filteredVector.begin() + aIndex );
if( aDeep )
{
for( int i = 0; i < m_sourceVector->size(); ++i )
{
if( m_sourceVector->at( i ) == item )
{
delete item;
m_sourceVector->erase( m_sourceVector->begin() + i );
break;
}
}
}
}
void DeleteAllItems() override
{
if( m_vector )
if( m_sourceVector )
{
for( DRC_ITEM* item : *m_vector )
for( DRC_ITEM* item : *m_sourceVector )
delete item;
m_vector->clear();
m_sourceVector->clear();
}
m_filteredVector.clear(); // no ownership of DRC_ITEM pointers
}
};
/**
* RATSNEST_DRC_ITEMS_PROVIDER
*/
class RATSNEST_DRC_ITEMS_PROVIDER : public VECTOR_DRC_ITEMS_PROVIDER
{
// TODO: for now this is just a vector, but we need to map it to some board-level
// data-structure so that deleting/excluding things can do a deep delete/exclusion
// which will be reflected in the ratsnest....
public:
RATSNEST_DRC_ITEMS_PROVIDER( PCB_BASE_FRAME* aFrame, std::vector<DRC_ITEM*>* aList ) :
VECTOR_DRC_ITEMS_PROVIDER( aFrame, aList )
{ }
};
class DRC_TREE_NODE
{
public:
enum NODE_TYPE { MARKER, MAIN_ITEM, AUX_ITEM };
DRC_TREE_NODE( DRC_TREE_NODE* aParent, const DRC_ITEM* aDrcItem, NODE_TYPE aType ) :
DRC_TREE_NODE( DRC_TREE_NODE* aParent, DRC_ITEM* aDrcItem, NODE_TYPE aType ) :
m_Type( aType ),
m_Parent( aParent ),
m_DrcItem( aDrcItem )
@ -171,7 +289,7 @@ public:
NODE_TYPE m_Type;
DRC_TREE_NODE* m_Parent;
const DRC_ITEM* m_DrcItem;
DRC_ITEM* m_DrcItem;
std::vector<std::unique_ptr<DRC_TREE_NODE>> m_Children;
};
@ -193,16 +311,15 @@ public:
static BOARD_ITEM* ToBoardItem( BOARD* aBoard, wxDataViewItem aItem );
public:
DRC_TREE_MODEL( wxDataViewCtrl* aView );
DRC_TREE_MODEL( PCB_BASE_FRAME* aParentFrame, wxDataViewCtrl* aView );
~DRC_TREE_MODEL();
void SetProvider( DRC_ITEMS_PROVIDER* aProvider );
void SetSeverities( int aSeverities );
int GetDRCItemCount() const { return m_tree.size(); }
const DRC_ITEM* GetDRCItem( int i ) const { return m_tree.at( i )->m_DrcItem; }
void ExpandAll();
bool IsContainer( wxDataViewItem const& aItem ) const override;
@ -243,16 +360,23 @@ public:
unsigned int aCol,
wxDataViewItemAttr& aAttr ) const override;
void DeleteCurrentItem();
void ValueChanged( DRC_TREE_NODE* aNode );
void DeleteCurrentItem( bool aDeep );
void DeleteAllItems();
private:
void rebuildModel( DRC_ITEMS_PROVIDER* aProvider, int aSeverities );
void onSizeView( wxSizeEvent& aEvent );
private:
PCB_BASE_FRAME* m_parentFrame;
wxDataViewCtrl* m_view;
int m_severities;
DRC_ITEMS_PROVIDER* m_drcItemsProvider; // I own this, but not its contents
std::vector<std::unique_ptr<DRC_TREE_NODE>> m_tree; // I own this
};
#endif //KICAD_DRC_TREE_MODEL_H

View File

@ -191,7 +191,7 @@ private:
_( "File contains pad shapes that are not supported by the Hyperlynx exporter\n"
"(Supported shapes are oval, rectangle, circle.)\n"
"They have been exported as oval pads." ),
REPORTER::RPT_WARNING );
SEVERITY_WARNING );
}
break;
}

View File

@ -270,15 +270,15 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateGerberFiles()
{
msg.Printf( _( "Unable to create \"%s\"." ), fn.GetFullPath() );
wxMessageBox( msg );
m_reporter->Report( msg, REPORTER::RPT_ERROR );
m_reporter->Report( msg, SEVERITY_ERROR );
return false;
}
msg.Printf( _( "Front side (top side) place file: \"%s\"." ), filename );
m_reporter->Report( msg, REPORTER::RPT_INFO );
m_reporter->Report( msg, SEVERITY_INFO );
msg.Printf( _( "Component count: %d." ), fpcount );
m_reporter->Report( msg, REPORTER::RPT_INFO );
m_reporter->Report( msg, SEVERITY_INFO );
// Create the Back or Bottom side placement file
fullcount = fpcount;
@ -290,24 +290,24 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateGerberFiles()
if( fpcount < 0 )
{
msg.Printf( _( "Unable to create file \"%s\"." ), filename );
m_reporter->Report( msg, REPORTER::RPT_ERROR );
m_reporter->Report( msg, SEVERITY_ERROR );
wxMessageBox( msg );
return false;
}
// Display results
msg.Printf( _( "Back side (bottom side) place file: \"%s\"." ), filename );
m_reporter->Report( msg, REPORTER::RPT_INFO );
m_reporter->Report( msg, SEVERITY_INFO );
msg.Printf( _( "Component count: %d." ), fpcount );
m_reporter->Report( msg, REPORTER::RPT_INFO );
m_reporter->Report( msg, SEVERITY_INFO );
fullcount += fpcount;
msg.Printf( _( "Full component count: %d\n" ), fullcount );
m_reporter->Report( msg, REPORTER::RPT_INFO );
m_reporter->Report( msg, SEVERITY_INFO );
m_reporter->Report( _( "Component Placement File generation OK." ), REPORTER::RPT_ACTION );
m_reporter->Report( _( "Component Placement File generation OK." ), SEVERITY_ACTION );
return true;
}
@ -343,7 +343,7 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles()
for( MODULE* item : fp_no_smd_list )
{
msg.Printf( _( "footprint %s (not set as SMD) forced in list" ), item->GetReference() );
m_reporter->Report( msg, REPORTER::RPT_INFO );
m_reporter->Report( msg, SEVERITY_INFO );
}
}
}
@ -395,7 +395,7 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles()
{
msg.Printf( _( "Unable to create \"%s\"." ), fn.GetFullPath() );
wxMessageBox( msg );
m_reporter->Report( msg, REPORTER::RPT_ERROR );
m_reporter->Report( msg, SEVERITY_ERROR );
return false;
}
@ -404,14 +404,14 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles()
else
msg.Printf( _( "Front side (top side) place file: \"%s\"." ),
fn.GetFullPath() );
m_reporter->Report( msg, REPORTER::RPT_INFO );
m_reporter->Report( msg, SEVERITY_INFO );
msg.Printf( _( "Component count: %d." ), fpcount );
m_reporter->Report( msg, REPORTER::RPT_INFO );
m_reporter->Report( msg, SEVERITY_INFO );
if( singleFile )
{
m_reporter->Report( _( "Component Placement File generation OK." ), REPORTER::RPT_ACTION );
m_reporter->Report( _( "Component Placement File generation OK." ), SEVERITY_ACTION );
return true;
}
@ -437,7 +437,7 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles()
if( fpcount < 0 )
{
msg.Printf( _( "Unable to create file \"%s\"." ), fn.GetFullPath() );
m_reporter->Report( msg, REPORTER::RPT_ERROR );
m_reporter->Report( msg, SEVERITY_ERROR );
wxMessageBox( msg );
return false;
}
@ -446,21 +446,21 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles()
if( !singleFile )
{
msg.Printf( _( "Back side (bottom side) place file: \"%s\"." ), fn.GetFullPath() );
m_reporter->Report( msg, REPORTER::RPT_INFO );
m_reporter->Report( msg, SEVERITY_INFO );
msg.Printf( _( "Component count: %d." ), fpcount );
m_reporter->Report( msg, REPORTER::RPT_INFO );
m_reporter->Report( msg, SEVERITY_INFO );
}
if( !singleFile )
{
fullcount += fpcount;
msg.Printf( _( "Full component count: %d\n" ), fullcount );
m_reporter->Report( msg, REPORTER::RPT_INFO );
m_reporter->Report( msg, SEVERITY_INFO );
}
m_reporter->Report( _( "Component Placement File generation OK." ), REPORTER::RPT_ACTION );
m_reporter->Report( _( "Component Placement File generation OK." ), SEVERITY_ACTION );
return true;
}

View File

@ -150,13 +150,13 @@ bool GERBER_JOBFILE_WRITER::CreateJobFile( const wxString& aFullFilename )
if( m_reporter )
{
msg.Printf( _( "Unable to create job file \"%s\"" ), aFullFilename );
m_reporter->Report( msg, REPORTER::RPT_ERROR );
m_reporter->Report( msg, SEVERITY_ERROR );
}
}
else if( m_reporter )
{
msg.Printf( _( "Create Gerber job file \"%s\"" ), aFullFilename );
m_reporter->Report( msg, REPORTER::RPT_ACTION );
m_reporter->Report( msg, SEVERITY_ACTION );
}
return success;
@ -404,7 +404,7 @@ void GERBER_JOBFILE_WRITER::addJSONFilesAttributes()
default:
skip_file = true;
m_reporter->Report( "Unexpected layer id in job file", REPORTER::RPT_ERROR );
m_reporter->Report( "Unexpected layer id in job file", SEVERITY_ERROR );
break;
}
}
@ -555,7 +555,7 @@ void GERBER_JOBFILE_WRITER::addJSONMaterialStackup()
if( !uptodate && m_pcb->GetDesignSettings().m_HasStackup )
m_reporter->Report( _( "Board stackup settings not up to date\n"
"Please fix the stackup" ),
REPORTER::RPT_ERROR );
SEVERITY_ERROR );
PCB_LAYER_ID last_copper_layer = F_Cu;

View File

@ -552,8 +552,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
// from there.
BOARD_DESIGN_SETTINGS& configBds = GetBoard()->GetDesignSettings();
bds.m_RequireCourtyards = configBds.m_RequireCourtyards;
bds.m_ProhibitOverlappingCourtyards = configBds.m_ProhibitOverlappingCourtyards;
bds.m_DRCSeverities = configBds.m_DRCSeverities;
bds.m_HoleToHoleMin = configBds.m_HoleToHoleMin;
bds.m_LineThickness[LAYER_CLASS_OTHERS] = configBds.m_LineThickness[LAYER_CLASS_OTHERS];
bds.m_TextSize[LAYER_CLASS_OTHERS] = configBds.m_TextSize[LAYER_CLASS_OTHERS];
@ -573,8 +572,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
// 6.0 TODO: some of the 5.1 settings still haven't moved because they're waiting on
// the new DRC architecture
BOARD_DESIGN_SETTINGS& configBds = GetBoard()->GetDesignSettings();
bds.m_RequireCourtyards = configBds.m_RequireCourtyards;
bds.m_ProhibitOverlappingCourtyards = configBds.m_ProhibitOverlappingCourtyards;
bds.m_DRCSeverities = configBds.m_DRCSeverities;
bds.m_HoleToHoleMin = configBds.m_HoleToHoleMin;
SetBoard( loadedBoard );
@ -582,6 +580,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
// we should not ask PLUGINs to do these items:
loadedBoard->BuildListOfNets();
loadedBoard->SynchronizeNetsAndNetClasses();
ResolveDRCExclusions();
if( loadedBoard->IsModified() )
OnModify();

View File

@ -1577,6 +1577,8 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const
m_out->Print( aNestLevel+1, ")" ); // end of (basic_shapes
}
m_out->Print( 0, " (tstamp %s)", TO_UTF8( aPad->m_Uuid.AsString() ) );
m_out->Print( 0, ")\n" );
}
@ -1615,7 +1617,8 @@ void PCB_IO::format( TEXTE_MODULE* aText, int aNestLevel ) const
case TEXTE_MODULE::TEXT_is_DIVERS: type = "user";
}
m_out->Print( aNestLevel, "(fp_text %s %s (at %s", type.c_str(),
m_out->Print( aNestLevel, "(fp_text %s %s (at %s",
type.c_str(),
m_out->Quotew( aText->GetText() ).c_str(),
FormatInternalUnits( aText->GetPos0() ).c_str() );

View File

@ -145,7 +145,7 @@ MODULE* BOARD_NETLIST_UPDATER::addNewComponent( COMPONENT* aComponent )
msg.Printf( _( "Cannot add %s (no footprint assigned)." ),
aComponent->GetReference(),
aComponent->GetFPID().Format().wx_str() );
m_reporter->Report( msg, REPORTER::RPT_ERROR );
m_reporter->Report( msg, SEVERITY_ERROR );
++m_errorCount;
return nullptr;
}
@ -157,7 +157,7 @@ MODULE* BOARD_NETLIST_UPDATER::addNewComponent( COMPONENT* aComponent )
msg.Printf( _( "Cannot add %s (footprint \"%s\" not found)." ),
aComponent->GetReference(),
aComponent->GetFPID().Format().wx_str() );
m_reporter->Report( msg, REPORTER::RPT_ERROR );
m_reporter->Report( msg, SEVERITY_ERROR );
++m_errorCount;
return nullptr;
}
@ -165,7 +165,7 @@ MODULE* BOARD_NETLIST_UPDATER::addNewComponent( COMPONENT* aComponent )
msg.Printf( _( "Add %s (footprint \"%s\")." ),
aComponent->GetReference(),
aComponent->GetFPID().Format().wx_str() );
m_reporter->Report( msg, REPORTER::RPT_ACTION );
m_reporter->Report( msg, SEVERITY_ACTION );
// Set the pads ratsnest settings to the global settings
bool set_ratsnest = m_frame->GetDisplayOptions().m_ShowGlobalRatsnest;
@ -201,7 +201,7 @@ MODULE* BOARD_NETLIST_UPDATER::replaceComponent( NETLIST& aNetlist, MODULE* aPcb
msg.Printf( _( "Cannot update %s (no footprint assigned)." ),
aNewComponent->GetReference(),
aNewComponent->GetFPID().Format().wx_str() );
m_reporter->Report( msg, REPORTER::RPT_ERROR );
m_reporter->Report( msg, SEVERITY_ERROR );
++m_errorCount;
return nullptr;
}
@ -213,7 +213,7 @@ MODULE* BOARD_NETLIST_UPDATER::replaceComponent( NETLIST& aNetlist, MODULE* aPcb
msg.Printf( _( "Cannot update %s (footprint \"%s\" not found)." ),
aNewComponent->GetReference(),
aNewComponent->GetFPID().Format().wx_str() );
m_reporter->Report( msg, REPORTER::RPT_ERROR );
m_reporter->Report( msg, SEVERITY_ERROR );
++m_errorCount;
return nullptr;
}
@ -222,7 +222,7 @@ MODULE* BOARD_NETLIST_UPDATER::replaceComponent( NETLIST& aNetlist, MODULE* aPcb
aPcbComponent->GetReference(),
aPcbComponent->GetFPID().Format().wx_str(),
aNewComponent->GetFPID().Format().wx_str() );
m_reporter->Report( msg, REPORTER::RPT_ACTION );
m_reporter->Report( msg, SEVERITY_ACTION );
m_newFootprintsCount++;
@ -253,7 +253,7 @@ bool BOARD_NETLIST_UPDATER::updateComponentParameters( MODULE* aPcbComponent,
msg.Printf( _( "Change %s reference to %s." ),
aPcbComponent->GetReference(),
aNewComponent->GetReference() );
m_reporter->Report( msg, REPORTER::RPT_ACTION );
m_reporter->Report( msg, SEVERITY_ACTION );
if ( !m_isDryRun )
{
@ -269,7 +269,7 @@ bool BOARD_NETLIST_UPDATER::updateComponentParameters( MODULE* aPcbComponent,
aPcbComponent->GetReference(),
aPcbComponent->GetValue(),
aNewComponent->GetValue() );
m_reporter->Report( msg, REPORTER::RPT_ACTION );
m_reporter->Report( msg, SEVERITY_ACTION );
if( !m_isDryRun )
{
@ -285,7 +285,7 @@ bool BOARD_NETLIST_UPDATER::updateComponentParameters( MODULE* aPcbComponent,
aPcbComponent->GetReference(),
aPcbComponent->GetPath().AsString(),
aNewComponent->GetPath().AsString() );
m_reporter->Report( msg, REPORTER::RPT_INFO );
m_reporter->Report( msg, SEVERITY_INFO );
if( !m_isDryRun )
{
@ -341,7 +341,7 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( MODULE* aPcbComponent
msg.Printf( _( "Disconnect %s pin %s." ),
aPcbComponent->GetReference(),
pad->GetName() );
m_reporter->Report( msg, REPORTER::RPT_ACTION );
m_reporter->Report( msg, SEVERITY_ACTION );
}
else if( m_warnForNoNetPads && pad->IsOnCopperLayer() && !pad->GetName().IsEmpty() )
{
@ -349,7 +349,7 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( MODULE* aPcbComponent
msg.Printf( _( "No net for component %s pin %s." ),
aPcbComponent->GetReference(),
pad->GetName() );
m_reporter->Report( msg, REPORTER::RPT_WARNING);
m_reporter->Report( msg, SEVERITY_WARNING);
}
if( !m_isDryRun )
@ -397,7 +397,7 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( MODULE* aPcbComponent
m_addedNets[netName] = netinfo;
msg.Printf( _( "Add net %s." ), UnescapeString( netName ) );
m_reporter->Report( msg, REPORTER::RPT_ACTION );
m_reporter->Report( msg, SEVERITY_ACTION );
}
if( !pad->GetNetname().IsEmpty() )
@ -417,7 +417,7 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( MODULE* aPcbComponent
pad->GetName(),
UnescapeString( netName ) );
}
m_reporter->Report( msg, REPORTER::RPT_ACTION );
m_reporter->Report( msg, SEVERITY_ACTION );
if( !m_isDryRun )
{
@ -488,7 +488,7 @@ bool BOARD_NETLIST_UPDATER::updateCopperZoneNets( NETLIST& aNetlist )
{
msg.Printf( _( "Reconnect via from %s to %s." ),
UnescapeString( via->GetNetname() ), UnescapeString( updatedNetname ) );
m_reporter->Report( msg, REPORTER::RPT_ACTION );
m_reporter->Report( msg, SEVERITY_ACTION );
if( !m_isDryRun )
{
@ -508,7 +508,7 @@ bool BOARD_NETLIST_UPDATER::updateCopperZoneNets( NETLIST& aNetlist )
{
msg.Printf( _( "Via connected to unknown net (%s)." ),
UnescapeString( via->GetNetname() ) );
m_reporter->Report( msg, REPORTER::RPT_WARNING );
m_reporter->Report( msg, SEVERITY_WARNING );
++m_warningCount;
}
}
@ -550,7 +550,7 @@ bool BOARD_NETLIST_UPDATER::updateCopperZoneNets( NETLIST& aNetlist )
msg.Printf( _( "Reconnect copper zone from %s to %s." ),
UnescapeString( zone->GetNetname() ),
UnescapeString( updatedNetname ) );
m_reporter->Report( msg, REPORTER::RPT_ACTION );
m_reporter->Report( msg, SEVERITY_ACTION );
if( !m_isDryRun )
{
@ -570,7 +570,7 @@ bool BOARD_NETLIST_UPDATER::updateCopperZoneNets( NETLIST& aNetlist )
{
msg.Printf( _( "Copper zone (%s) has no pads connected." ),
UnescapeString( zone->GetNetname() ) );
m_reporter->Report( msg, REPORTER::RPT_WARNING );
m_reporter->Report( msg, SEVERITY_WARNING );
++m_warningCount;
}
}
@ -598,12 +598,12 @@ bool BOARD_NETLIST_UPDATER::deleteUnusedComponents( NETLIST& aNetlist )
if( module->IsLocked() )
{
msg.Printf( _( "Cannot remove unused footprint %s (locked)." ), module->GetReference() );
m_reporter->Report( msg, REPORTER::RPT_WARNING );
m_reporter->Report( msg, SEVERITY_WARNING );
continue;
}
msg.Printf( _( "Remove unused footprint %s." ), module->GetReference() );
m_reporter->Report( msg, REPORTER::RPT_ACTION );
m_reporter->Report( msg, SEVERITY_ACTION );
if( !m_isDryRun )
m_commit.Remove( module );
@ -662,7 +662,7 @@ bool BOARD_NETLIST_UPDATER::deleteSinglePadNets()
{
msg.Printf( _( "Remove single pad net %s." ),
UnescapeString( getNetname( previouspad ) ) );
m_reporter->Report( msg, REPORTER::RPT_ACTION );
m_reporter->Report( msg, SEVERITY_ACTION );
if( !m_isDryRun )
previouspad->SetNetCode( NETINFO_LIST::UNCONNECTED );
@ -727,7 +727,7 @@ bool BOARD_NETLIST_UPDATER::testConnectivity( NETLIST& aNetlist )
component->GetReference(),
padname,
footprint->GetFPID().Format().wx_str() );
m_reporter->Report( msg, REPORTER::RPT_ERROR );
m_reporter->Report( msg, SEVERITY_ERROR );
++m_errorCount;
}
}
@ -765,7 +765,7 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist )
msg.Printf( _( "Processing component \"%s:%s\"." ),
component->GetReference(),
component->GetFPID().Format().wx_str() );
m_reporter->Report( msg, REPORTER::RPT_INFO );
m_reporter->Report( msg, SEVERITY_INFO );
for( auto footprint : m_board->Modules() )
{
@ -816,7 +816,7 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist )
{
msg.Printf( _( "Multiple footprints found for \"%s\"." ),
component->GetReference() );
m_reporter->Report( msg, REPORTER::RPT_ERROR );
m_reporter->Report( msg, SEVERITY_ERROR );
}
}
@ -850,20 +850,20 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist )
}
// Update the ratsnest
m_reporter->ReportTail( wxT( "" ), REPORTER::RPT_ACTION );
m_reporter->ReportTail( wxT( "" ), REPORTER::RPT_ACTION );
m_reporter->ReportTail( wxT( "" ), SEVERITY_ACTION );
m_reporter->ReportTail( wxT( "" ), SEVERITY_ACTION );
msg.Printf( _( "Total warnings: %d, errors: %d." ), m_warningCount, m_errorCount );
m_reporter->ReportTail( msg, REPORTER::RPT_ACTION );
m_reporter->ReportTail( msg, SEVERITY_ACTION );
if( m_errorCount )
{
m_reporter->ReportTail( _( "Errors occurred during the netlist update. Unless you fix them "
"your board will not be consistent with the schematics." ),
REPORTER::RPT_ERROR );
SEVERITY_ERROR );
return false;
}
m_reporter->ReportTail( _( "Netlist update successful!" ), REPORTER::RPT_ACTION );
m_reporter->ReportTail( _( "Netlist update successful!" ), SEVERITY_ACTION );
return true;
}

View File

@ -32,14 +32,11 @@ using namespace std::placeholders;
#include <fctsys.h>
#include <pgm_base.h>
#include <class_draw_panel_gal.h>
#include <confirm.h>
#include <dialog_helpers.h>
#include <pcb_edit_frame.h>
#include "pcb_netlist.h"
#include "netlist_reader.h"
#include <reporter.h>
#include <wildcards_and_files_ext.h>
#include <lib_id.h>
#include <fp_lib_table.h>
#include <class_board.h>
@ -161,7 +158,7 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter )
{
msg.Printf( _( "No footprint defined for symbol \"%s\".\n" ),
component->GetReference() );
aReporter.Report( msg, REPORTER::RPT_ERROR );
aReporter.Report( msg, SEVERITY_ERROR );
continue;
}
@ -181,7 +178,7 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter )
component->GetReference(),
GetChars( fpOnBoard->GetFPID().Format() ),
GetChars( component->GetFPID().Format() ) );
aReporter.Report( msg, REPORTER::RPT_WARNING );
aReporter.Report( msg, SEVERITY_WARNING );
continue;
}
@ -207,7 +204,7 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter )
msg.Printf( _( "%s footprint ID \"%s\" is not valid." ),
component->GetReference(),
GetChars( component->GetFPID().Format() ) );
aReporter.Report( msg, REPORTER::RPT_ERROR );
aReporter.Report( msg, SEVERITY_ERROR );
continue;
}
@ -224,7 +221,7 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter )
msg.Printf( _( "%s footprint \"%s\" not found in any libraries in the footprint library table.\n" ),
component->GetReference(),
GetChars( component->GetFPID().GetLibItemName() ) );
aReporter.Report( msg, REPORTER::RPT_ERROR );
aReporter.Report( msg, SEVERITY_ERROR );
continue;
}

View File

@ -51,7 +51,7 @@ const LAYER_NUM GAL_LAYER_ORDER[] =
{
LAYER_GP_OVERLAY,
LAYER_SELECT_OVERLAY,
LAYER_DRC,
LAYER_DRC_ERROR, LAYER_DRC_WARNING,
LAYER_PADS_NETNAMES, LAYER_VIAS_NETNAMES,
Dwgs_User, Cmts_User, Eco1_User, Eco2_User, Edge_Cuts,
@ -178,10 +178,8 @@ void PCB_DRAW_PANEL_GAL::DisplayBoard( BOARD* aBoard )
m_view->Add( module );
// DRC markers
for( int marker_idx = 0; marker_idx < aBoard->GetMARKERCount(); ++marker_idx )
{
m_view->Add( aBoard->GetMARKER( marker_idx ) );
}
for( auto marker : aBoard->Markers() )
m_view->Add( marker );
// Finalize the triangulation threads
while( count_done < parallelThreadCount )
@ -278,7 +276,7 @@ void PCB_DRAW_PANEL_GAL::SetTopLayer( PCB_LAYER_ID aLayer )
LAYER_VIA_THROUGH, LAYER_VIAS_HOLES, LAYER_VIAS_NETNAMES,
LAYER_PADS_TH, LAYER_PADS_PLATEDHOLES, LAYER_PADS_NETNAMES,
LAYER_NON_PLATEDHOLES, LAYER_SELECT_OVERLAY, LAYER_GP_OVERLAY,
LAYER_RATSNEST, LAYER_DRC
LAYER_RATSNEST, LAYER_DRC_ERROR, LAYER_DRC_WARNING
};
for( auto layer : layers )
@ -496,7 +494,6 @@ void PCB_DRAW_PANEL_GAL::setDefaultLayerDeps()
m_view->SetLayerTarget( LAYER_WORKSHEET, KIGFX::TARGET_NONCACHED );
m_view->SetLayerDisplayOnly( LAYER_WORKSHEET ) ;
m_view->SetLayerDisplayOnly( LAYER_GRID );
m_view->SetLayerDisplayOnly( LAYER_DRC );
}

View File

@ -463,6 +463,46 @@ void PCB_EDIT_FRAME::OnQuit( wxCommandEvent& event )
}
void PCB_EDIT_FRAME::RecordDRCExclusions()
{
m_drcExclusions.clear();
for( MARKER_PCB* marker : GetBoard()->Markers() )
{
if( marker->IsExcluded() )
m_drcExclusions.insert( marker->Serialize() );
}
}
void PCB_EDIT_FRAME::ResolveDRCExclusions()
{
for( MARKER_PCB* marker : GetBoard()->Markers() )
{
auto i = m_drcExclusions.find( marker->Serialize() );
if( i != m_drcExclusions.end() )
{
marker->SetExcluded( true );
m_drcExclusions.erase( i );
}
}
BOARD_COMMIT commit( this );
for( const wxString& exclusionData : m_drcExclusions )
{
MARKER_PCB* marker = MARKER_PCB::Deserialize( exclusionData );
marker->SetExcluded( true );
commit.Add( marker );
}
m_drcExclusions.clear();
commit.Push( wxEmptyString, false, false );
}
void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
{
// Shutdown blocks must be determined and vetoed as early as possible
@ -473,15 +513,18 @@ void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
return;
}
// First close the DRC dialog.
// For some reason, if the board editor frame is destroyed when the DRC
// dialog currently open, Pcbnew crashes, At least on Windows.
// First close the DRC dialog. For some reason, if the board editor frame is destroyed
// when the DRC dialog currently open, Pcbnew crashes, at least on Windows.
DIALOG_DRC_CONTROL* open_dlg = static_cast<DIALOG_DRC_CONTROL*>(
wxWindow::FindWindowByName( DIALOG_DRC_WINDOW_NAME ) );
if( open_dlg )
open_dlg->Close( true );
// Save various DRC parameters, such as violation severities (which may have been
// edited via the DRC dialog as well as the Board Setup dialog), DRC exclusions, etc.
SaveProjectSettings();
if( IsContentModified() )
{
wxFileName fileName = GetBoard()->GetFileName();
@ -564,7 +607,7 @@ void PCB_EDIT_FRAME::DoShowBoardSetupDialog( const wxString& aInitialPage,
if( dlg.ShowModal() == wxID_OK )
{
SaveProjectSettings( false );
SaveProjectSettings();
UpdateUserInterface();
ReCreateAuxiliaryToolbar();
@ -789,7 +832,7 @@ void PCB_EDIT_FRAME::SetLastPath( LAST_PATH_TYPE aType, const wxString& aLastPat
if( relativeFileName.GetFullPath() != m_lastPath[ aType ] )
{
m_lastPath[ aType ] = relativeFileName.GetFullPath();
SaveProjectSettings( false );
SaveProjectSettings();
}
}

View File

@ -106,6 +106,7 @@ protected:
wxString m_lastPath[ LAST_PATH_SIZE ];
std::set<wxString> m_drcExclusions;
/**
* Store the previous layer toolbar icon state information
@ -401,9 +402,8 @@ public:
/**
* Function SaveProjectSettings
* saves changes to the project settings to the project (.pro) file.
* @param aAskForSave = true to open a dialog before saving the settings
*/
void SaveProjectSettings( bool aAskForSave ) override;
void SaveProjectSettings() override;
/**
* Load the current project's file configuration settings which are pertinent
@ -436,6 +436,16 @@ public:
*/
void SetLastPath( LAST_PATH_TYPE aType, const wxString& aLastPath );
/**
* Scan existing markers and record data from any that are Excluded.
*/
void RecordDRCExclusions();
/**
* Update markers to match recorded exclusions.
*/
void ResolveDRCExclusions();
void OnCloseWindow( wxCloseEvent& Event ) override;
void Process_Special_Functions( wxCommandEvent& event );
void Tracks_and_Vias_Size_Event( wxCommandEvent& event );

View File

@ -76,10 +76,12 @@ const LAYER_WIDGET::ROW PCB_LAYER_WIDGET::s_render_rows[] = {
RR(),
RR( _( "Ratsnest" ), LAYER_RATSNEST, WHITE, _( "Show unconnected nets as a ratsnest") ),
RR( _( "No-Connects" ), LAYER_NO_CONNECTS, BLUE, _( "Show a marker on pads which have no net connected" ) ),
RR( _( "DRC Warnings" ), LAYER_DRC_WARNING, YELLOW, _( "DRC violations with a Warning severity" ) ),
RR( _( "DRC Errors" ), LAYER_DRC_ERROR, PURERED, _( "DRC violations with an Error severity" ) ),
RR( _( "Anchors" ), LAYER_ANCHOR, WHITE, _( "Show footprint and text origins as a cross" ) ),
RR( _( "Worksheet" ), LAYER_WORKSHEET, DARKRED, _( "Show worksheet") ),
RR( _( "Cursor" ), LAYER_CURSOR, WHITE, _( "PCB Cursor" ), true, false ),
RR( _( "Aux items" ), LAYER_AUX_ITEMS, WHITE, _( "Auxiliary items (rulers, assistants, axes, etc.)" ), true, false ),
RR( _( "Aux Items" ), LAYER_AUX_ITEMS, WHITE, _( "Auxiliary items (rulers, assistants, axes, etc.)" ), true, false ),
RR( _( "Grid" ), LAYER_GRID, WHITE, _( "Show the (x,y) grid dots" ) ),
RR( _( "Background" ), LAYER_PCB_BACKGROUND, BLACK, _( "PCB Background" ), true, false )
};

Some files were not shown because too many files have changed in this diff Show More