From b0f8055377e69fd967f89874ee07ac264bea94f0 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 17 Mar 2022 16:21:37 -0700 Subject: [PATCH] Revert "Pull some fixes back from master." This reverts commit 5c63df28e4b81c920de76f116addf85b2852bd98. --- pcbnew/drc/drc_item.cpp | 4 +- pcbnew/drc/drc_rule_parser.cpp | 26 ++++--- pcbnew/drc/drc_test_provider.cpp | 10 +-- .../drc/drc_test_provider_annular_width.cpp | 14 ++-- pcbnew/drc/drc_test_provider_connectivity.cpp | 6 +- .../drc_test_provider_copper_clearance.cpp | 14 ++-- .../drc_test_provider_courtyard_clearance.cpp | 10 +-- .../drc_test_provider_diff_pair_coupling.cpp | 31 ++++----- pcbnew/drc/drc_test_provider_disallow.cpp | 6 +- .../drc/drc_test_provider_edge_clearance.cpp | 10 +-- pcbnew/drc/drc_test_provider_hole_size.cpp | 25 ++++--- pcbnew/drc/drc_test_provider_hole_to_hole.cpp | 12 ++-- pcbnew/drc/drc_test_provider_lvs.cpp | 8 +-- .../drc/drc_test_provider_matched_length.cpp | 16 ++--- pcbnew/drc/drc_test_provider_misc.cpp | 69 ++++--------------- .../drc/drc_test_provider_silk_clearance.cpp | 12 ++-- pcbnew/drc/drc_test_provider_silk_to_mask.cpp | 10 +-- pcbnew/drc/drc_test_provider_track_width.cpp | 10 +-- pcbnew/drc/drc_test_provider_via_diameter.cpp | 10 +-- 19 files changed, 132 insertions(+), 171 deletions(-) diff --git a/pcbnew/drc/drc_item.cpp b/pcbnew/drc/drc_item.cpp index 40a44c3061..8af220c15b 100644 --- a/pcbnew/drc/drc_item.cpp +++ b/pcbnew/drc/drc_item.cpp @@ -309,7 +309,7 @@ std::shared_ptr DRC_ITEM::Create( int aErrorCode ) case DRCE_FOOTPRINT_TYPE_MISMATCH: return std::make_shared( footprintTypeMismatch ); case DRCE_PAD_TH_WITH_NO_HOLE: return std::make_shared( footprintTHPadhasNoHole ); default: - wxFAIL_MSG( wxT( "Unknown DRC error code" ) ); + wxFAIL_MSG( "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" ); } diff --git a/pcbnew/drc/drc_rule_parser.cpp b/pcbnew/drc/drc_rule_parser.cpp index 355a1899ea..2dd4b07017 100644 --- a/pcbnew/drc/drc_rule_parser.cpp +++ b/pcbnew/drc/drc_rule_parser.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2020-2022 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2020-2021 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& aRules, REPORTER* aReporte default: msg.Printf( _( "Unrecognized item '%s'.| Expected %s." ), FromUTF8(), - wxT( "rule or version" ) ); + "'rule', 'version'" ); reportError( msg ); parseUnknown(); } @@ -231,7 +231,7 @@ DRC_RULE* DRC_RULES_PARSER::parseDRC_RULE() default: msg.Printf( _( "Unrecognized item '%s'.| Expected %s." ), FromUTF8(), - wxT( "constraint, condition, or disallow" ) ); + "constraint, condition or disallow" ); reportError( msg ); parseUnknown(); } @@ -255,10 +255,9 @@ void DRC_RULES_PARSER::parseConstraint( DRC_RULE* aRule ) if( (int) token == DSN_RIGHT || token == T_EOF ) { msg.Printf( _( "Missing constraint type.| Expected %s." ), - 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" ) ); + "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; } @@ -284,10 +283,9 @@ 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(), - 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" ) ); + "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 ); } @@ -323,8 +321,8 @@ void DRC_RULES_PARSER::parseConstraint( DRC_RULE* aRule ) default: msg.Printf( _( "Unrecognized item '%s'.| Expected %s." ), FromUTF8(), - wxT( "track, via, micro_via, buried_via, pad, zone, text, graphic, " - "hole, or footprint." ) ); + "track, via, micro_via, buried_via, pad, zone, text, graphic, hole " + "or footprint." ); reportError( msg ); break; } @@ -413,7 +411,7 @@ void DRC_RULES_PARSER::parseConstraint( DRC_RULE* aRule ) default: msg.Printf( _( "Unrecognized item '%s'.| Expected %s." ), FromUTF8(), - wxT( "min, max, or opt" ) ); + "min, max or opt" ); reportError( msg ); parseUnknown(); } diff --git a/pcbnew/drc/drc_test_provider.cpp b/pcbnew/drc/drc_test_provider.cpp index 741cd2ba78..83f8cd4d3b 100644 --- a/pcbnew/drc/drc_test_provider.cpp +++ b/pcbnew/drc/drc_test_provider.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2020-2021 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 wxT( "" ); } -const wxString DRC_TEST_PROVIDER::GetDescription() const { return wxEmptyString; } +const wxString DRC_TEST_PROVIDER::GetName() const { return ""; } +const wxString DRC_TEST_PROVIDER::GetDescription() const { return ""; } void DRC_TEST_PROVIDER::reportViolation( std::shared_ptr& item, @@ -122,13 +122,13 @@ void DRC_TEST_PROVIDER::reportRuleStatistics() if( !m_isRuleDriven ) return; - m_drcEngine->ReportAux( wxT( "Rule hit statistics: " ) ); + m_drcEngine->ReportAux( "Rule hit statistics: " ); for( const std::pair& stat : m_stats ) { if( stat.first ) { - m_drcEngine->ReportAux( wxString::Format( wxT( " - rule '%s': %d hits " ), + m_drcEngine->ReportAux( wxString::Format( " - rule '%s': %d hits ", stat.first->m_Name, stat.second ) ); } diff --git a/pcbnew/drc/drc_test_provider_annular_width.cpp b/pcbnew/drc/drc_test_provider_annular_width.cpp index e4abbd6d24..0bde18c48e 100644 --- a/pcbnew/drc/drc_test_provider_annular_width.cpp +++ b/pcbnew/drc/drc_test_provider_annular_width.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004-2022 KiCad Developers. + * Copyright (C) 2004-2020 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 wxT( "annular_width" ); + return "annular_width"; }; virtual const wxString GetDescription() const override { - return wxT( "Tests pad/via annular rings" ); + return "Tests pad/via annular rings"; } virtual std::set GetConstraintTypes() const override; @@ -72,7 +72,7 @@ bool DRC_TEST_PROVIDER_ANNULAR_WIDTH::Run() { if( m_drcEngine->IsErrorLimitExceeded( DRCE_ANNULAR_WIDTH ) ) { - reportAux( wxT( "Annular width violations ignored. Skipping check." ) ); + reportAux( "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( wxT( "No annular width constraints found. Tests not run." ) ); + reportAux( "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 ) ) - return false; // DRC cancelled + break; if( !checkAnnularWidth( item ) ) - break; + return false; // DRC cancelled } reportRuleStatistics(); diff --git a/pcbnew/drc/drc_test_provider_connectivity.cpp b/pcbnew/drc/drc_test_provider_connectivity.cpp index 92fdf842fc..4acf134e31 100644 --- a/pcbnew/drc/drc_test_provider_connectivity.cpp +++ b/pcbnew/drc/drc_test_provider_connectivity.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004-2022 KiCad Developers. + * Copyright (C) 2004-2020 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 wxT( "connectivity" ); + return "connectivity"; }; virtual const wxString GetDescription() const override { - return wxT( "Tests board connectivity" ); + return "Tests board connectivity"; } virtual std::set GetConstraintTypes() const override; diff --git a/pcbnew/drc/drc_test_provider_copper_clearance.cpp b/pcbnew/drc/drc_test_provider_copper_clearance.cpp index 0ebb64b2c1..977467e1ea 100644 --- a/pcbnew/drc/drc_test_provider_copper_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_copper_clearance.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004-2022 KiCad Developers. + * Copyright (C) 2004-2021 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 wxT( "clearance" ); + return "clearance"; }; virtual const wxString GetDescription() const override { - return wxT( "Tests copper item clearance" ); + return "Tests copper item clearance"; } virtual std::set GetConstraintTypes() const override; @@ -149,7 +149,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::Run() } } - reportAux( wxT( "Worst clearance : %d nm" ), m_largestClearance ); + reportAux( "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( wxT( "Testing %d copper items and %d zones..." ), count, m_zones.size() ); + reportAux( "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( wxT( "Testing %d tracks & vias..." ), m_board->Tracks().size() ); + reportAux( "Testing %d tracks & vias...", m_board->Tracks().size() ); std::map< std::pair, int> checkedPairs; @@ -776,7 +776,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadClearances( ) for( FOOTPRINT* footprint : m_board->Footprints() ) count += footprint->Pads().size(); - reportAux( wxT( "Testing %d pads..." ), count ); + reportAux( "Testing %d pads...", count ); int ii = 0; std::map< std::pair, int> checkedPairs; diff --git a/pcbnew/drc/drc_test_provider_courtyard_clearance.cpp b/pcbnew/drc/drc_test_provider_courtyard_clearance.cpp index 9914906925..39cb51f830 100644 --- a/pcbnew/drc/drc_test_provider_courtyard_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_courtyard_clearance.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004-2022 KiCad Developers. + * Copyright (C) 2004-2020 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 wxT( "courtyard_clearance" ); + return "courtyard_clearance"; } virtual const wxString GetDescription() const override { - return wxT( "Tests footprints' courtyard clearance" ); + return "Tests footprints' courtyard clearance"; } virtual std::set GetConstraintTypes() const override; @@ -96,7 +96,7 @@ bool DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testFootprintCourtyardDefinitions() } else { - reportAux( wxT( "All courtyard violations ignored. Tests not run." ) ); + reportAux( "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( wxT( "Worst courtyard clearance : %d nm" ), m_largestClearance ); + reportAux( "Worst courtyard clearance : %d nm", m_largestClearance ); if( !testFootprintCourtyardDefinitions() ) return false; diff --git a/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp b/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp index 9ec310787c..634cf7cafa 100644 --- a/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp +++ b/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004-2022 KiCad Developers. + * Copyright (C) 2004-2020 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 wxT( "diff_pair_coupling" ); + return "diff_pair_coupling"; }; virtual const wxString GetDescription() const override { - return wxT( "Tests differential pair coupling" ); + return "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, wxT( "eval dp %p\n" ), item ); + drc_dbg( 10, "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, wxT( "cns %d item %p\n" ), constraintsToCheck[i], item ); + drc_dbg( 10, "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, wxT( "dp rule matches %d\n" ), (int) dpRuleMatches.size() ); + drc_dbg( 10, "dp rule matches %d\n", (int) dpRuleMatches.size() ); DRC_RTREE copperTree; @@ -358,10 +358,8 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run() wxString nameP = niP->GetNetname(); wxString nameN = niN->GetNetname(); - reportAux( wxString::Format( wxT( "Rule '%s', DP: (+) %s - (-) %s" ), - it.first.parentRule->m_Name, - nameP, - nameN ) ); + reportAux( wxString::Format( "Rule '%s', DP: (+) %s - (-) %s", + it.first.parentRule->m_Name, nameP, nameN ) ); extractDiffPairCoupledItems( it.second, copperTree ); @@ -369,7 +367,7 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run() it.second.totalLengthN = 0; it.second.totalLengthP = 0; - drc_dbg(10, wxT( " coupled prims : %d\n" ), (int) it.second.coupled.size() ); + drc_dbg(10, " coupled prims : %d\n", (int) it.second.coupled.size() ); OPT gapConstraint = it.first.parentRule->FindConstraint( DIFF_PAIR_GAP_CONSTRAINT ); @@ -413,9 +411,7 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run() overlay->Line( cpair.coupledN ); } - drc_dbg( 10, wxT( " len %d gap %d l %d\n" ), - length, - gap, + drc_dbg( 10, " len %d gap %d l %d\n", length, gap, cpair.parentP->GetLayer() ); if( gapConstraint ) @@ -444,7 +440,8 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run() } int totalLen = std::max( it.second.totalLengthN, it.second.totalLengthP ); - reportAux( wxString::Format( wxT( " - coupled length: %s, total length: %s" ), + reportAux( wxString::Format( " - coupled length: %s, total length: %s", + MessageTextFromValue( userUnits(), it.second.totalCoupled ), MessageTextFromValue( userUnits(), totalLen ) ) ); @@ -490,8 +487,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() + wxT( " (" ) + - gapConstraint->GetParentRule()->m_Name + wxS( " " ); + m_msg = drcItem->GetErrorText() + " (" + + gapConstraint->GetParentRule()->m_Name + " "; if( val.HasMin() ) m_msg += wxString::Format( _( "minimum gap: %s; " ), diff --git a/pcbnew/drc/drc_test_provider_disallow.cpp b/pcbnew/drc/drc_test_provider_disallow.cpp index c12acfe620..52a56f7692 100644 --- a/pcbnew/drc/drc_test_provider_disallow.cpp +++ b/pcbnew/drc/drc_test_provider_disallow.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004-2022 KiCad Developers. + * Copyright (C) 2004-2020 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 wxT( "disallow" ); + return "disallow"; }; virtual const wxString GetDescription() const override { - return wxT( "Tests for disallowed items (e.g. keepouts)" ); + return "Tests for disallowed items (e.g. keepouts)"; } virtual std::set GetConstraintTypes() const override; diff --git a/pcbnew/drc/drc_test_provider_edge_clearance.cpp b/pcbnew/drc/drc_test_provider_edge_clearance.cpp index 372af7938e..040ce53d8a 100644 --- a/pcbnew/drc/drc_test_provider_edge_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_edge_clearance.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004-2022 KiCad Developers. + * Copyright (C) 2004-2021 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 wxT( "edge_clearance" ); + return "edge_clearance"; } virtual const wxString GetDescription() const override { - return wxT( "Tests items vs board edge clearance" ); + return "Tests items vs board edge clearance"; } virtual std::set GetConstraintTypes() const override; @@ -130,7 +130,7 @@ bool DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run() } else { - reportAux( wxT( "Edge clearance violations ignored. Tests not run." ) ); + reportAux( "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( wxT( "Worst clearance : %d nm" ), m_largestClearance ); + reportAux( "Worst clearance : %d nm", m_largestClearance ); std::vector> edges; // we own these DRC_RTREE edgesTree; diff --git a/pcbnew/drc/drc_test_provider_hole_size.cpp b/pcbnew/drc/drc_test_provider_hole_size.cpp index d333d77ba6..83a0e6d0d7 100644 --- a/pcbnew/drc/drc_test_provider_hole_size.cpp +++ b/pcbnew/drc/drc_test_provider_hole_size.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004-2022 KiCad Developers. + * Copyright (C) 2004-2020 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 wxT( "hole_size" ); + return "hole_size"; }; virtual const wxString GetDescription() const override { - return wxT( "Tests sizes of drilled holes (via/pad drills)" ); + return "Tests sizes of drilled holes (via/pad drills)"; } virtual std::set GetConstraintTypes() const override; @@ -106,18 +106,23 @@ bool DRC_TEST_PROVIDER_HOLE_SIZE::Run() return false; // DRC cancelled } + std::vector vias; + for( PCB_TRACK* track : m_drcEngine->GetBoard()->Tracks() ) { if( track->Type() == PCB_VIA_T ) - { - bool exceedMicro = m_drcEngine->IsErrorLimitExceeded( DRCE_MICROVIA_DRILL_OUT_OF_RANGE ); - bool exceedStd = m_drcEngine->IsErrorLimitExceeded( DRCE_DRILL_OUT_OF_RANGE ); + vias.push_back( static_cast( track ) ); + } - if( exceedMicro && exceedStd ) - break; + 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 ); - checkVia( static_cast( track ), exceedMicro, exceedStd ); - } + if( exceedMicro && exceedStd ) + break; + + checkVia( via, exceedMicro, exceedStd ); } } diff --git a/pcbnew/drc/drc_test_provider_hole_to_hole.cpp b/pcbnew/drc/drc_test_provider_hole_to_hole.cpp index a579052449..fa9800369b 100644 --- a/pcbnew/drc/drc_test_provider_hole_to_hole.cpp +++ b/pcbnew/drc/drc_test_provider_hole_to_hole.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004-2022 KiCad Developers. + * Copyright (C) 2004-2020 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 wxT( "hole_to_hole_clearance" ); + return "hole_to_hole_clearance"; }; virtual const wxString GetDescription() const override { - return wxT( "Tests hole to hole spacing" ); + return "Tests hole to hole spacing"; } virtual std::set 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( wxT( "Hole to hole violations ignored. Tests not run." ) ); + reportAux( "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( wxT( "Worst hole to hole : %d nm" ), m_largestClearance ); + reportAux( "Worst hole to hole : %d nm", m_largestClearance ); } else { - reportAux( wxT( "No hole to hole constraints found. Skipping check." ) ); + reportAux( "No hole to hole constraints found. Skipping check." ); return true; // continue with other tests } diff --git a/pcbnew/drc/drc_test_provider_lvs.cpp b/pcbnew/drc/drc_test_provider_lvs.cpp index b1beb6480d..8d85cdf7a9 100644 --- a/pcbnew/drc/drc_test_provider_lvs.cpp +++ b/pcbnew/drc/drc_test_provider_lvs.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004-2022 KiCad Developers. + * Copyright (C) 2004-2020 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 wxT( "LVS" ); + return "LVS"; }; virtual const wxString GetDescription() const override { - return wxT( "Performs layout-vs-schematics integity check" ); + return "Performs layout-vs-schematics integity check"; } virtual std::set GetConstraintTypes() const override; @@ -222,7 +222,7 @@ bool DRC_TEST_PROVIDER_LVS::Run() if( !netlist ) { - reportAux( wxT( "No netlist provided, skipping LVS." ) ); + reportAux( _("No netlist provided, skipping LVS.") ); return true; } diff --git a/pcbnew/drc/drc_test_provider_matched_length.cpp b/pcbnew/drc/drc_test_provider_matched_length.cpp index b44fbad1b8..7be3664a30 100644 --- a/pcbnew/drc/drc_test_provider_matched_length.cpp +++ b/pcbnew/drc/drc_test_provider_matched_length.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004-2022 KiCad Developers. + * Copyright (C) 2004-2020 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 wxT( "length" ); + return "length"; }; virtual const wxString GetDescription() const override { - return wxT( "Tests matched track lengths." ); + return "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( wxT( "Length-constrained traces for rule '%s':" ), + reportAux( wxString::Format( "Length-constrained traces for rule '%s':", it.first->m_Name ) ); for( auto& ent : matchedConnections ) { - 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" ), + reportAux(wxString::Format( " - 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, diff --git a/pcbnew/drc/drc_test_provider_misc.cpp b/pcbnew/drc/drc_test_provider_misc.cpp index d436729e27..79dd8f49db 100644 --- a/pcbnew/drc/drc_test_provider_misc.cpp +++ b/pcbnew/drc/drc_test_provider_misc.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004-2022 KiCad Developers. + * Copyright (C) 2004-2020 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 wxT( "miscellaneous" ); + return "miscellaneous"; }; virtual const wxString GetDescription() const override { - return wxT( "Misc checks (board outline, missing textvars)" ); + return "Misc checks (board outline, missing textvars)"; } virtual std::set GetConstraintTypes() const override; @@ -126,19 +126,6 @@ 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 @@ -147,12 +134,6 @@ 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 ) @@ -211,52 +192,32 @@ 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() { - // 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 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 + auto checkUnresolvedTextVar = + [&]( EDA_ITEM* item ) -> bool { if( m_drcEngine->IsErrorLimitExceeded( DRCE_UNRESOLVED_VARIABLE ) ) return false; - if( !reportProgress( ii++, items, delta ) ) - return false; - - BOARD_ITEM* boardItem = dynamic_cast( item ); - EDA_TEXT* text = dynamic_cast( boardItem ); + EDA_TEXT* text = dynamic_cast( item ); if( text && text->GetShownText().Matches( wxT( "*${*}*" ) ) ) { std::shared_ptrdrcItem = DRC_ITEM::Create( DRCE_UNRESOLVED_VARIABLE ); drcItem->SetItems( item ); - reportViolation( drcItem, boardItem->GetPosition() ); + reportViolation( drcItem, item->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; @@ -265,11 +226,11 @@ void DRC_TEST_PROVIDER_MISC::testTextVars() return; drawItems.SetMilsToIUfactor( IU_PER_MILS ); - drawItems.SetPageNumber( wxT( "1" ) ); + drawItems.SetPageNumber( "1" ); drawItems.SetSheetCount( 1 ); - drawItems.SetFileName( wxT( "dummyFilename" ) ); - drawItems.SetSheetName( wxT( "dummySheet" ) ); - drawItems.SetSheetLayer( wxT( "dummyLayer" ) ); + drawItems.SetFileName( "dummyFilename" ); + drawItems.SetSheetName( "dummySheet" ); + drawItems.SetSheetLayer( "dummyLayer" ); drawItems.SetProject( m_board->GetProject() ); drawItems.BuildDrawItemsList( drawingSheet->GetPageInfo(), drawingSheet->GetTitleBlock() ); diff --git a/pcbnew/drc/drc_test_provider_silk_clearance.cpp b/pcbnew/drc/drc_test_provider_silk_clearance.cpp index 169d32ce48..301a51b2a1 100644 --- a/pcbnew/drc/drc_test_provider_silk_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_silk_clearance.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004-2022 KiCad Developers. + * Copyright (C) 2004-2020 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 wxT( "silk_clearance" ); + return "silk_clearance"; }; virtual const wxString GetDescription() const override { - return wxT( "Tests for overlapping silkscreen features." ); + return "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( wxT( "Overlapping silk violations ignored. Tests not run." ) ); + reportAux( "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( wxT( "Worst clearance : %d nm" ), m_largestClearance ); + reportAux( "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( wxT( "Testing %d silkscreen features against %d board items." ), + reportAux( _("Testing %d silkscreen features against %d board items."), silkTree.size(), targetTree.size() ); diff --git a/pcbnew/drc/drc_test_provider_silk_to_mask.cpp b/pcbnew/drc/drc_test_provider_silk_to_mask.cpp index 7e05959753..5298e3da97 100644 --- a/pcbnew/drc/drc_test_provider_silk_to_mask.cpp +++ b/pcbnew/drc/drc_test_provider_silk_to_mask.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004-2022 KiCad Developers. + * Copyright (C) 2004-2020 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 wxT( "silk_to_mask" ); + return "silk_to_mask"; }; virtual const wxString GetDescription() const override { - return wxT( "Tests for silkscreen being clipped by solder mask" ); + return "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( wxT( "Silkscreen clipping violations ignored. Tests not run." ) ); + reportAux( "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( wxT( "Worst clearance : %d nm" ), m_largestClearance ); + reportAux( "Worst clearance : %d nm", m_largestClearance ); if( !reportPhase( _( "Checking silkscreen for potential soldermask clipping..." ) ) ) return false; // DRC cancelled diff --git a/pcbnew/drc/drc_test_provider_track_width.cpp b/pcbnew/drc/drc_test_provider_track_width.cpp index da4f9077b4..19c1be6c0c 100644 --- a/pcbnew/drc/drc_test_provider_track_width.cpp +++ b/pcbnew/drc/drc_test_provider_track_width.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004-2022 KiCad Developers. + * Copyright (C) 2004-2020 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 wxT( "width" ); + return "width"; }; virtual const wxString GetDescription() const override { - return wxT( "Tests track widths" ); + return "Tests track widths"; } virtual std::set GetConstraintTypes() const override; @@ -70,13 +70,13 @@ bool DRC_TEST_PROVIDER_TRACK_WIDTH::Run() if( m_drcEngine->IsErrorLimitExceeded( DRCE_TRACK_WIDTH ) ) { - reportAux( wxT( "Track width violations ignored. Tests not run." ) ); + reportAux( "Track width violations ignored. Tests not run." ); return true; // continue with other tests } if( !m_drcEngine->HasRulesForConstraintType( TRACK_WIDTH_CONSTRAINT ) ) { - reportAux( wxT( "No track width constraints found. Tests not run." ) ); + reportAux( "No track width constraints found. Tests not run." ); return true; // continue with other tests } diff --git a/pcbnew/drc/drc_test_provider_via_diameter.cpp b/pcbnew/drc/drc_test_provider_via_diameter.cpp index 0006734faf..c4a884894b 100644 --- a/pcbnew/drc/drc_test_provider_via_diameter.cpp +++ b/pcbnew/drc/drc_test_provider_via_diameter.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004-2022 KiCad Developers. + * Copyright (C) 2004-2020 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 wxT( "diameter" ); + return "diameter"; }; virtual const wxString GetDescription() const override { - return wxT( "Tests via diameters" ); + return "Tests via diameters"; } virtual std::set GetConstraintTypes() const override; @@ -69,13 +69,13 @@ bool DRC_TEST_PROVIDER_VIA_DIAMETER::Run() if( m_drcEngine->IsErrorLimitExceeded( DRCE_VIA_DIAMETER ) ) { - reportAux( wxT( "Via diameter violations ignored. Tests not run." ) ); + reportAux( "Via diameter violations ignored. Tests not run." ); return true; // continue with other tests } if( !m_drcEngine->HasRulesForConstraintType( VIA_DIAMETER_CONSTRAINT ) ) { - reportAux( wxT( "No via diameter constraints found. Tests not run." ) ); + reportAux( "No via diameter constraints found. Tests not run." ); return true; // continue with other tests }