Pull some fixes back from master.

Mostly wxT(), but also some performance, and some for better response
to Cancel button.

(cherry picked from commit 5c63df28e4)
This commit is contained in:
Jeff Young 2022-03-13 12:27:43 +00:00 committed by Seth Hillbrand
parent 8ccc5bd8f2
commit ff604cc6a3
19 changed files with 171 additions and 132 deletions

View File

@ -309,7 +309,7 @@ std::shared_ptr<DRC_ITEM> DRC_ITEM::Create( int aErrorCode )
case DRCE_FOOTPRINT_TYPE_MISMATCH: return std::make_shared<DRC_ITEM>( footprintTypeMismatch );
case DRCE_PAD_TH_WITH_NO_HOLE: return std::make_shared<DRC_ITEM>( footprintTHPadhasNoHole );
default:
wxFAIL_MSG( "Unknown DRC error code" );
wxFAIL_MSG( wxT( "Unknown DRC error code" ) );
return nullptr;
}
}
@ -333,6 +333,6 @@ wxString DRC_ITEM::GetViolatingRuleDesc() const
if( m_violatingRule )
return wxString::Format( _( "Rule: %s" ), m_violatingRule->m_Name );
else
return _("Local override" );
return _( "Local override" );
}

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020-2021 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2020-2022 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
@ -154,7 +154,7 @@ void DRC_RULES_PARSER::Parse( std::vector<DRC_RULE*>& aRules, REPORTER* aReporte
default:
msg.Printf( _( "Unrecognized item '%s'.| Expected %s." ), FromUTF8(),
"'rule', 'version'" );
wxT( "rule or version" ) );
reportError( msg );
parseUnknown();
}
@ -231,7 +231,7 @@ DRC_RULE* DRC_RULES_PARSER::parseDRC_RULE()
default:
msg.Printf( _( "Unrecognized item '%s'.| Expected %s." ), FromUTF8(),
"constraint, condition or disallow" );
wxT( "constraint, condition, or disallow" ) );
reportError( msg );
parseUnknown();
}
@ -255,9 +255,10 @@ void DRC_RULES_PARSER::parseConstraint( DRC_RULE* aRule )
if( (int) token == DSN_RIGHT || token == T_EOF )
{
msg.Printf( _( "Missing constraint type.| Expected %s." ),
"clearance, hole_clearance, edge_clearance, hole, hole_to_hole, "
"courtyard_clearance, silk_clearance, track_width, annular_width, via_diameter, "
"disallow, length, skew, via_count, diff_pair_gap or diff_pair_uncoupled" );
wxT( "clearance, hole_clearance, edge_clearance, hole, hole_to_hole, "
"courtyard_clearance, silk_clearance, track_width, annular_width, "
"via_diameter, disallow, length, skew, via_count, diff_pair_gap, or "
"diff_pair_uncoupled" ) );
reportError( msg );
return;
}
@ -283,9 +284,10 @@ void DRC_RULES_PARSER::parseConstraint( DRC_RULE* aRule )
case T_diff_pair_uncoupled: c.m_Type = DIFF_PAIR_MAX_UNCOUPLED_CONSTRAINT; break;
default:
msg.Printf( _( "Unrecognized item '%s'.| Expected %s." ), FromUTF8(),
"clearance, hole_clearance, edge_clearance, hole_size, hole_to_hole, "
"courtyard_clearance, silk_clearance, track_width, annular_width, via_diameter, "
"disallow, length, skew, diff_pair_gap or diff_pair_uncoupled." );
wxT( "clearance, hole_clearance, edge_clearance, hole_size, hole_to_hole, "
"courtyard_clearance, silk_clearance, track_width, annular_width, "
"via_diameter, disallow, length, skew, diff_pair_gap, or "
"diff_pair_uncoupled" ) );
reportError( msg );
}
@ -321,8 +323,8 @@ void DRC_RULES_PARSER::parseConstraint( DRC_RULE* aRule )
default:
msg.Printf( _( "Unrecognized item '%s'.| Expected %s." ), FromUTF8(),
"track, via, micro_via, buried_via, pad, zone, text, graphic, hole "
"or footprint." );
wxT( "track, via, micro_via, buried_via, pad, zone, text, graphic, "
"hole, or footprint." ) );
reportError( msg );
break;
}
@ -411,7 +413,7 @@ void DRC_RULES_PARSER::parseConstraint( DRC_RULE* aRule )
default:
msg.Printf( _( "Unrecognized item '%s'.| Expected %s." ),
FromUTF8(),
"min, max or opt" );
wxT( "min, max, or opt" ) );
reportError( msg );
parseUnknown();
}

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2022 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
@ -49,8 +49,8 @@ DRC_TEST_PROVIDER::DRC_TEST_PROVIDER() :
}
const wxString DRC_TEST_PROVIDER::GetName() const { return "<no name test>"; }
const wxString DRC_TEST_PROVIDER::GetDescription() const { return ""; }
const wxString DRC_TEST_PROVIDER::GetName() const { return wxT( "<no name test>" ); }
const wxString DRC_TEST_PROVIDER::GetDescription() const { return wxEmptyString; }
void DRC_TEST_PROVIDER::reportViolation( std::shared_ptr<DRC_ITEM>& item,
@ -122,13 +122,13 @@ void DRC_TEST_PROVIDER::reportRuleStatistics()
if( !m_isRuleDriven )
return;
m_drcEngine->ReportAux( "Rule hit statistics: " );
m_drcEngine->ReportAux( wxT( "Rule hit statistics: " ) );
for( const std::pair<const DRC_RULE* const, int>& stat : m_stats )
{
if( stat.first )
{
m_drcEngine->ReportAux( wxString::Format( " - rule '%s': %d hits ",
m_drcEngine->ReportAux( wxString::Format( wxT( " - rule '%s': %d hits " ),
stat.first->m_Name,
stat.second ) );
}

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2020 KiCad Developers.
* Copyright (C) 2004-2022 KiCad Developers.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -54,12 +54,12 @@ public:
virtual const wxString GetName() const override
{
return "annular_width";
return wxT( "annular_width" );
};
virtual const wxString GetDescription() const override
{
return "Tests pad/via annular rings";
return wxT( "Tests pad/via annular rings" );
}
virtual std::set<DRC_CONSTRAINT_T> GetConstraintTypes() const override;
@ -72,7 +72,7 @@ bool DRC_TEST_PROVIDER_ANNULAR_WIDTH::Run()
{
if( m_drcEngine->IsErrorLimitExceeded( DRCE_ANNULAR_WIDTH ) )
{
reportAux( "Annular width violations ignored. Skipping check." );
reportAux( wxT( "Annular width violations ignored. Skipping check." ) );
return true; // continue with other tests
}
@ -80,7 +80,7 @@ bool DRC_TEST_PROVIDER_ANNULAR_WIDTH::Run()
if( !m_drcEngine->HasRulesForConstraintType( ANNULAR_WIDTH_CONSTRAINT ) )
{
reportAux( "No annular width constraints found. Tests not run." );
reportAux( wxT( "No annular width constraints found. Tests not run." ) );
return true; // continue with other tests
}
@ -152,10 +152,10 @@ bool DRC_TEST_PROVIDER_ANNULAR_WIDTH::Run()
for( PCB_TRACK* item : board->Tracks() )
{
if( !reportProgress( ii++, board->Tracks().size(), delta ) )
break;
return false; // DRC cancelled
if( !checkAnnularWidth( item ) )
return false; // DRC cancelled
break;
}
reportRuleStatistics();

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2020 KiCad Developers.
* Copyright (C) 2004-2022 KiCad Developers.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -56,12 +56,12 @@ public:
virtual const wxString GetName() const override
{
return "connectivity";
return wxT( "connectivity" );
};
virtual const wxString GetDescription() const override
{
return "Tests board connectivity";
return wxT( "Tests board connectivity" );
}
virtual std::set<DRC_CONSTRAINT_T> GetConstraintTypes() const override;

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2021 KiCad Developers.
* Copyright (C) 2004-2022 KiCad Developers.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -70,12 +70,12 @@ public:
virtual const wxString GetName() const override
{
return "clearance";
return wxT( "clearance" );
};
virtual const wxString GetDescription() const override
{
return "Tests copper item clearance";
return wxT( "Tests copper item clearance" );
}
virtual std::set<DRC_CONSTRAINT_T> GetConstraintTypes() const override;
@ -149,7 +149,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::Run()
}
}
reportAux( "Worst clearance : %d nm", m_largestClearance );
reportAux( wxT( "Worst clearance : %d nm" ), m_largestClearance );
// This is the number of tests between 2 calls to the progress bar
size_t delta = 50;
@ -203,7 +203,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::Run()
forEachGeometryItem( itemTypes, LSET::AllCuMask(), countItems );
forEachGeometryItem( itemTypes, LSET::AllCuMask(), addToCopperTree );
reportAux( "Testing %d copper items and %d zones...", count, m_zones.size() );
reportAux( wxT( "Testing %d copper items and %d zones..." ), count, m_zones.size() );
if( !m_drcEngine->IsErrorLimitExceeded( DRCE_CLEARANCE ) )
{
@ -511,7 +511,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackClearances()
const int delta = 100;
int ii = 0;
reportAux( "Testing %d tracks & vias...", m_board->Tracks().size() );
reportAux( wxT( "Testing %d tracks & vias..." ), m_board->Tracks().size() );
std::map< std::pair<BOARD_ITEM*, BOARD_ITEM*>, int> checkedPairs;
@ -776,7 +776,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadClearances( )
for( FOOTPRINT* footprint : m_board->Footprints() )
count += footprint->Pads().size();
reportAux( "Testing %d pads...", count );
reportAux( wxT( "Testing %d pads..." ), count );
int ii = 0;
std::map< std::pair<BOARD_ITEM*, BOARD_ITEM*>, int> checkedPairs;

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2020 KiCad Developers.
* Copyright (C) 2004-2022 KiCad Developers.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -59,12 +59,12 @@ public:
virtual const wxString GetName() const override
{
return "courtyard_clearance";
return wxT( "courtyard_clearance" );
}
virtual const wxString GetDescription() const override
{
return "Tests footprints' courtyard clearance";
return wxT( "Tests footprints' courtyard clearance" );
}
virtual std::set<DRC_CONSTRAINT_T> GetConstraintTypes() const override;
@ -96,7 +96,7 @@ bool DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testFootprintCourtyardDefinitions()
}
else
{
reportAux( "All courtyard violations ignored. Tests not run." );
reportAux( wxT( "All courtyard violations ignored. Tests not run." ) );
return true; // continue with other tests
}
@ -307,7 +307,7 @@ bool DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::Run()
if( m_drcEngine->QueryWorstConstraint( COURTYARD_CLEARANCE_CONSTRAINT, constraint ) )
m_largestClearance = constraint.GetValue().Min();
reportAux( "Worst courtyard clearance : %d nm", m_largestClearance );
reportAux( wxT( "Worst courtyard clearance : %d nm" ), m_largestClearance );
if( !testFootprintCourtyardDefinitions() )
return false;

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2020 KiCad Developers.
* Copyright (C) 2004-2022 KiCad Developers.
*
* 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
@ -66,12 +66,12 @@ public:
virtual const wxString GetName() const override
{
return "diff_pair_coupling";
return wxT( "diff_pair_coupling" );
};
virtual const wxString GetDescription() const override
{
return "Tests differential pair coupling";
return wxT( "Tests differential pair coupling" );
}
virtual int GetNumPhases() const override
@ -290,7 +290,7 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run()
if( refNet && DRC_ENGINE::IsNetADiffPair( m_board, refNet, key.netP, key.netN ) )
{
drc_dbg( 10, "eval dp %p\n", item );
drc_dbg( 10, wxT( "eval dp %p\n" ), item );
const DRC_CONSTRAINT_T constraintsToCheck[] = {
DIFF_PAIR_GAP_CONSTRAINT,
@ -305,7 +305,7 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run()
if( constraint.IsNull() )
continue;
drc_dbg( 10, "cns %d item %p\n", constraintsToCheck[i], item );
drc_dbg( 10, wxT( "cns %d item %p\n" ), constraintsToCheck[i], item );
key.parentRule = constraint.GetParentRule();
@ -324,7 +324,7 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run()
forEachGeometryItem( { PCB_TRACE_T, PCB_VIA_T, PCB_ARC_T },
LSET::AllCuMask(), evaluateDpConstraints );
drc_dbg( 10, "dp rule matches %d\n", (int) dpRuleMatches.size() );
drc_dbg( 10, wxT( "dp rule matches %d\n" ), (int) dpRuleMatches.size() );
DRC_RTREE copperTree;
@ -358,8 +358,10 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run()
wxString nameP = niP->GetNetname();
wxString nameN = niN->GetNetname();
reportAux( wxString::Format( "Rule '%s', DP: (+) %s - (-) %s",
it.first.parentRule->m_Name, nameP, nameN ) );
reportAux( wxString::Format( wxT( "Rule '%s', DP: (+) %s - (-) %s" ),
it.first.parentRule->m_Name,
nameP,
nameN ) );
extractDiffPairCoupledItems( it.second, copperTree );
@ -367,7 +369,7 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run()
it.second.totalLengthN = 0;
it.second.totalLengthP = 0;
drc_dbg(10, " coupled prims : %d\n", (int) it.second.coupled.size() );
drc_dbg(10, wxT( " coupled prims : %d\n" ), (int) it.second.coupled.size() );
OPT<DRC_CONSTRAINT> gapConstraint =
it.first.parentRule->FindConstraint( DIFF_PAIR_GAP_CONSTRAINT );
@ -411,7 +413,9 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run()
overlay->Line( cpair.coupledN );
}
drc_dbg( 10, " len %d gap %d l %d\n", length, gap,
drc_dbg( 10, wxT( " len %d gap %d l %d\n" ),
length,
gap,
cpair.parentP->GetLayer() );
if( gapConstraint )
@ -440,8 +444,7 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run()
}
int totalLen = std::max( it.second.totalLengthN, it.second.totalLengthP );
reportAux( wxString::Format( " - coupled length: %s, total length: %s",
reportAux( wxString::Format( wxT( " - coupled length: %s, total length: %s" ),
MessageTextFromValue( userUnits(), it.second.totalCoupled ),
MessageTextFromValue( userUnits(), totalLen ) ) );
@ -487,8 +490,8 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run()
auto val = gapConstraint->GetValue();
auto drcItem = DRC_ITEM::Create( DRCE_DIFF_PAIR_GAP_OUT_OF_RANGE );
m_msg = drcItem->GetErrorText() + " (" +
gapConstraint->GetParentRule()->m_Name + " ";
m_msg = drcItem->GetErrorText() + wxT( " (" ) +
gapConstraint->GetParentRule()->m_Name + wxS( " " );
if( val.HasMin() )
m_msg += wxString::Format( _( "minimum gap: %s; " ),

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2020 KiCad Developers.
* Copyright (C) 2004-2022 KiCad Developers.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -51,12 +51,12 @@ public:
virtual const wxString GetName() const override
{
return "disallow";
return wxT( "disallow" );
};
virtual const wxString GetDescription() const override
{
return "Tests for disallowed items (e.g. keepouts)";
return wxT( "Tests for disallowed items (e.g. keepouts)" );
}
virtual std::set<DRC_CONSTRAINT_T> GetConstraintTypes() const override;

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2021 KiCad Developers.
* Copyright (C) 2004-2022 KiCad Developers.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -60,12 +60,12 @@ public:
virtual const wxString GetName() const override
{
return "edge_clearance";
return wxT( "edge_clearance" );
}
virtual const wxString GetDescription() const override
{
return "Tests items vs board edge clearance";
return wxT( "Tests items vs board edge clearance" );
}
virtual std::set<DRC_CONSTRAINT_T> GetConstraintTypes() const override;
@ -130,7 +130,7 @@ bool DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run()
}
else
{
reportAux( "Edge clearance violations ignored. Tests not run." );
reportAux( wxT( "Edge clearance violations ignored. Tests not run." ) );
return true; // continue with other tests
}
@ -141,7 +141,7 @@ bool DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run()
if( m_drcEngine->QueryWorstConstraint( EDGE_CLEARANCE_CONSTRAINT, worstClearanceConstraint ) )
m_largestClearance = worstClearanceConstraint.GetValue().Min();
reportAux( "Worst clearance : %d nm", m_largestClearance );
reportAux( wxT( "Worst clearance : %d nm" ), m_largestClearance );
std::vector<std::unique_ptr<PCB_SHAPE>> edges; // we own these
DRC_RTREE edgesTree;

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2020 KiCad Developers.
* Copyright (C) 2004-2022 KiCad Developers.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -52,12 +52,12 @@ public:
virtual const wxString GetName() const override
{
return "hole_size";
return wxT( "hole_size" );
};
virtual const wxString GetDescription() const override
{
return "Tests sizes of drilled holes (via/pad drills)";
return wxT( "Tests sizes of drilled holes (via/pad drills)" );
}
virtual std::set<DRC_CONSTRAINT_T> GetConstraintTypes() const override;
@ -106,23 +106,18 @@ bool DRC_TEST_PROVIDER_HOLE_SIZE::Run()
return false; // DRC cancelled
}
std::vector<PCB_VIA*> vias;
for( PCB_TRACK* track : m_drcEngine->GetBoard()->Tracks() )
{
if( track->Type() == PCB_VIA_T )
vias.push_back( static_cast<PCB_VIA*>( track ) );
}
{
bool exceedMicro = m_drcEngine->IsErrorLimitExceeded( DRCE_MICROVIA_DRILL_OUT_OF_RANGE );
bool exceedStd = m_drcEngine->IsErrorLimitExceeded( DRCE_DRILL_OUT_OF_RANGE );
for( PCB_VIA* via : vias )
{
bool exceedMicro = m_drcEngine->IsErrorLimitExceeded( DRCE_MICROVIA_DRILL_OUT_OF_RANGE );
bool exceedStd = m_drcEngine->IsErrorLimitExceeded( DRCE_DRILL_OUT_OF_RANGE );
if( exceedMicro && exceedStd )
break;
if( exceedMicro && exceedStd )
break;
checkVia( via, exceedMicro, exceedStd );
checkVia( static_cast<PCB_VIA*>( track ), exceedMicro, exceedStd );
}
}
}

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2020 KiCad Developers.
* Copyright (C) 2004-2022 KiCad Developers.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -60,12 +60,12 @@ public:
virtual const wxString GetName() const override
{
return "hole_to_hole_clearance";
return wxT( "hole_to_hole_clearance" );
};
virtual const wxString GetDescription() const override
{
return "Tests hole to hole spacing";
return wxT( "Tests hole to hole spacing" );
}
virtual std::set<DRC_CONSTRAINT_T> GetConstraintTypes() const override;
@ -102,7 +102,7 @@ bool DRC_TEST_PROVIDER_HOLE_TO_HOLE::Run()
if( m_drcEngine->IsErrorLimitExceeded( DRCE_DRILLED_HOLES_TOO_CLOSE )
&& m_drcEngine->IsErrorLimitExceeded( DRCE_DRILLED_HOLES_COLOCATED ) )
{
reportAux( "Hole to hole violations ignored. Tests not run." );
reportAux( wxT( "Hole to hole violations ignored. Tests not run." ) );
return true; // continue with other tests
}
@ -113,11 +113,11 @@ bool DRC_TEST_PROVIDER_HOLE_TO_HOLE::Run()
if( m_drcEngine->QueryWorstConstraint( HOLE_TO_HOLE_CONSTRAINT, worstClearanceConstraint ) )
{
m_largestClearance = worstClearanceConstraint.GetValue().Min();
reportAux( "Worst hole to hole : %d nm", m_largestClearance );
reportAux( wxT( "Worst hole to hole : %d nm" ), m_largestClearance );
}
else
{
reportAux( "No hole to hole constraints found. Skipping check." );
reportAux( wxT( "No hole to hole constraints found. Skipping check." ) );
return true; // continue with other tests
}

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2020 KiCad Developers.
* Copyright (C) 2004-2022 KiCad Developers.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -60,12 +60,12 @@ public:
virtual const wxString GetName() const override
{
return "LVS";
return wxT( "LVS" );
};
virtual const wxString GetDescription() const override
{
return "Performs layout-vs-schematics integity check";
return wxT( "Performs layout-vs-schematics integity check" );
}
virtual std::set<DRC_CONSTRAINT_T> GetConstraintTypes() const override;
@ -222,7 +222,7 @@ bool DRC_TEST_PROVIDER_LVS::Run()
if( !netlist )
{
reportAux( _("No netlist provided, skipping LVS.") );
reportAux( wxT( "No netlist provided, skipping LVS." ) );
return true;
}

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2020 KiCad Developers.
* Copyright (C) 2004-2022 KiCad Developers.
*
* 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
@ -59,12 +59,12 @@ public:
virtual const wxString GetName() const override
{
return "length";
return wxT( "length" );
};
virtual const wxString GetDescription() const override
{
return "Tests matched track lengths.";
return wxT( "Tests matched track lengths." );
}
virtual int GetNumPhases() const override
@ -345,15 +345,15 @@ bool DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal( bool aDelayReportMode )
return a.netname < b.netname;
} );
reportAux( wxString::Format( "Length-constrained traces for rule '%s':",
reportAux( wxString::Format( wxT( "Length-constrained traces for rule '%s':" ),
it.first->m_Name ) );
for( auto& ent : matchedConnections )
{
reportAux(wxString::Format( " - net: %s, from: %s, to: %s, "
"%d matching items, "
"total: %s (tracks: %s, vias: %s, pad-to-die: %s), "
"vias: %d",
reportAux(wxString::Format( wxT( " - net: %s, from: %s, to: %s, "
"%d matching items, "
"total: %s (tracks: %s, vias: %s, pad-to-die: %s), "
"vias: %d" ),
ent.netname,
ent.from,
ent.to,

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2020 KiCad Developers.
* Copyright (C) 2004-2022 KiCad Developers.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -60,12 +60,12 @@ public:
virtual const wxString GetName() const override
{
return "miscellaneous";
return wxT( "miscellaneous" );
};
virtual const wxString GetDescription() const override
{
return "Misc checks (board outline, missing textvars)";
return wxT( "Misc checks (board outline, missing textvars)" );
}
virtual std::set<DRC_CONSTRAINT_T> GetConstraintTypes() const override;
@ -126,6 +126,19 @@ void DRC_TEST_PROVIDER_MISC::testOutline()
void DRC_TEST_PROVIDER_MISC::testDisabledLayers()
{
// This is the number of tests between 2 calls to the progress bar
const int delta = 2000;
int ii = 0;
int items = 0;
auto countItems =
[&]( BOARD_ITEM* item ) -> bool
{
++items;
return true;
};
LSET disabledLayers = m_board->GetEnabledLayers().flip();
// Perform the test only for copper layers
@ -134,6 +147,12 @@ void DRC_TEST_PROVIDER_MISC::testDisabledLayers()
auto checkDisabledLayers =
[&]( BOARD_ITEM* item ) -> bool
{
if( m_drcEngine->IsErrorLimitExceeded( DRCE_DISABLED_LAYER_ITEM ) )
return false;
if( !reportProgress( ii++, items, delta ) )
return false;
PCB_LAYER_ID badLayer = UNDEFINED_LAYER;
if( item->Type() == PCB_PAD_T )
@ -192,32 +211,52 @@ void DRC_TEST_PROVIDER_MISC::testDisabledLayers()
return true;
};
forEachGeometryItem( s_allBasicItems, LSET::AllLayersMask(), countItems );
forEachGeometryItem( s_allBasicItems, LSET::AllLayersMask(), checkDisabledLayers );
}
void DRC_TEST_PROVIDER_MISC::testTextVars()
{
auto checkUnresolvedTextVar =
[&]( EDA_ITEM* item ) -> bool
// This is the number of tests between 2 calls to the progress bar
const int delta = 2000;
int ii = 0;
int items = 0;
static const std::vector<KICAD_T> itemTypes = {
PCB_TEXT_T, PCB_FP_TEXT_T,
PCB_DIMENSION_T
};
forEachGeometryItem( itemTypes, LSET::AllLayersMask(),
[&]( BOARD_ITEM* item ) -> bool
{
++items;
return true;
} );
forEachGeometryItem( itemTypes, LSET::AllLayersMask(),
[&]( BOARD_ITEM* item ) -> bool
{
if( m_drcEngine->IsErrorLimitExceeded( DRCE_UNRESOLVED_VARIABLE ) )
return false;
EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( item );
if( !reportProgress( ii++, items, delta ) )
return false;
BOARD_ITEM* boardItem = dynamic_cast<BOARD_ITEM*>( item );
EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( boardItem );
if( text && text->GetShownText().Matches( wxT( "*${*}*" ) ) )
{
std::shared_ptr<DRC_ITEM>drcItem = DRC_ITEM::Create( DRCE_UNRESOLVED_VARIABLE );
drcItem->SetItems( item );
reportViolation( drcItem, item->GetPosition() );
reportViolation( drcItem, boardItem->GetPosition() );
}
return true;
};
forEachGeometryItem( { PCB_FP_TEXT_T, PCB_TEXT_T }, LSET::AllLayersMask(),
checkUnresolvedTextVar );
} );
DS_PROXY_VIEW_ITEM* drawingSheet = m_drcEngine->GetDrawingSheet();
DS_DRAW_ITEM_LIST drawItems;
@ -226,11 +265,11 @@ void DRC_TEST_PROVIDER_MISC::testTextVars()
return;
drawItems.SetMilsToIUfactor( IU_PER_MILS );
drawItems.SetPageNumber( "1" );
drawItems.SetPageNumber( wxT( "1" ) );
drawItems.SetSheetCount( 1 );
drawItems.SetFileName( "dummyFilename" );
drawItems.SetSheetName( "dummySheet" );
drawItems.SetSheetLayer( "dummyLayer" );
drawItems.SetFileName( wxT( "dummyFilename" ) );
drawItems.SetSheetName( wxT( "dummySheet" ) );
drawItems.SetSheetLayer( wxT( "dummyLayer" ) );
drawItems.SetProject( m_board->GetProject() );
drawItems.BuildDrawItemsList( drawingSheet->GetPageInfo(), drawingSheet->GetTitleBlock() );

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2020 KiCad Developers.
* Copyright (C) 2004-2022 KiCad Developers.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -60,12 +60,12 @@ public:
virtual const wxString GetName() const override
{
return "silk_clearance";
return wxT( "silk_clearance" );
};
virtual const wxString GetDescription() const override
{
return "Tests for overlapping silkscreen features.";
return wxT( "Tests for overlapping silkscreen features." );
}
virtual int GetNumPhases() const override
@ -89,7 +89,7 @@ bool DRC_TEST_PROVIDER_SILK_CLEARANCE::Run()
if( m_drcEngine->IsErrorLimitExceeded( DRCE_OVERLAPPING_SILK ) )
{
reportAux( "Overlapping silk violations ignored. Tests not run." );
reportAux( wxT( "Overlapping silk violations ignored. Tests not run." ) );
return true; // continue with other tests
}
@ -101,7 +101,7 @@ bool DRC_TEST_PROVIDER_SILK_CLEARANCE::Run()
if( m_drcEngine->QueryWorstConstraint( SILK_CLEARANCE_CONSTRAINT, worstClearanceConstraint ) )
m_largestClearance = worstClearanceConstraint.m_Value.Min();
reportAux( "Worst clearance : %d nm", m_largestClearance );
reportAux( wxT( "Worst clearance : %d nm" ), m_largestClearance );
if( !reportPhase( _( "Checking silkscreen for overlapping items..." ) ) )
return false; // DRC cancelled
@ -157,7 +157,7 @@ bool DRC_TEST_PROVIDER_SILK_CLEARANCE::Run()
LSET::FrontMask() | LSET::BackMask() | LSET( 2, Edge_Cuts, Margin ),
addToTargetTree );
reportAux( _("Testing %d silkscreen features against %d board items."),
reportAux( wxT( "Testing %d silkscreen features against %d board items." ),
silkTree.size(),
targetTree.size() );

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2020 KiCad Developers.
* Copyright (C) 2004-2022 KiCad Developers.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -57,12 +57,12 @@ public:
virtual const wxString GetName() const override
{
return "silk_to_mask";
return wxT( "silk_to_mask" );
};
virtual const wxString GetDescription() const override
{
return "Tests for silkscreen being clipped by solder mask";
return wxT( "Tests for silkscreen being clipped by solder mask" );
}
virtual int GetNumPhases() const override
@ -85,7 +85,7 @@ bool DRC_TEST_PROVIDER_SILK_TO_MASK::Run()
if( m_drcEngine->IsErrorLimitExceeded( DRCE_SILK_MASK_CLEARANCE ) )
{
reportAux( "Silkscreen clipping violations ignored. Tests not run." );
reportAux( wxT( "Silkscreen clipping violations ignored. Tests not run." ) );
return true; // continue with other tests
}
@ -95,7 +95,7 @@ bool DRC_TEST_PROVIDER_SILK_TO_MASK::Run()
if( m_drcEngine->QueryWorstConstraint( SILK_CLEARANCE_CONSTRAINT, worstClearanceConstraint ) )
m_largestClearance = worstClearanceConstraint.m_Value.Min();
reportAux( "Worst clearance : %d nm", m_largestClearance );
reportAux( wxT( "Worst clearance : %d nm" ), m_largestClearance );
if( !reportPhase( _( "Checking silkscreen for potential soldermask clipping..." ) ) )
return false; // DRC cancelled

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2020 KiCad Developers.
* Copyright (C) 2004-2022 KiCad Developers.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -50,12 +50,12 @@ public:
virtual const wxString GetName() const override
{
return "width";
return wxT( "width" );
};
virtual const wxString GetDescription() const override
{
return "Tests track widths";
return wxT( "Tests track widths" );
}
virtual std::set<DRC_CONSTRAINT_T> GetConstraintTypes() const override;
@ -70,13 +70,13 @@ bool DRC_TEST_PROVIDER_TRACK_WIDTH::Run()
if( m_drcEngine->IsErrorLimitExceeded( DRCE_TRACK_WIDTH ) )
{
reportAux( "Track width violations ignored. Tests not run." );
reportAux( wxT( "Track width violations ignored. Tests not run." ) );
return true; // continue with other tests
}
if( !m_drcEngine->HasRulesForConstraintType( TRACK_WIDTH_CONSTRAINT ) )
{
reportAux( "No track width constraints found. Tests not run." );
reportAux( wxT( "No track width constraints found. Tests not run." ) );
return true; // continue with other tests
}

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2020 KiCad Developers.
* Copyright (C) 2004-2022 KiCad Developers.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -49,12 +49,12 @@ public:
virtual const wxString GetName() const override
{
return "diameter";
return wxT( "diameter" );
};
virtual const wxString GetDescription() const override
{
return "Tests via diameters";
return wxT( "Tests via diameters" );
}
virtual std::set<DRC_CONSTRAINT_T> GetConstraintTypes() const override;
@ -69,13 +69,13 @@ bool DRC_TEST_PROVIDER_VIA_DIAMETER::Run()
if( m_drcEngine->IsErrorLimitExceeded( DRCE_VIA_DIAMETER ) )
{
reportAux( "Via diameter violations ignored. Tests not run." );
reportAux( wxT( "Via diameter violations ignored. Tests not run." ) );
return true; // continue with other tests
}
if( !m_drcEngine->HasRulesForConstraintType( VIA_DIAMETER_CONSTRAINT ) )
{
reportAux( "No via diameter constraints found. Tests not run." );
reportAux( wxT( "No via diameter constraints found. Tests not run." ) );
return true; // continue with other tests
}