diff --git a/pcbnew/drc/drc_item.cpp b/pcbnew/drc/drc_item.cpp index 8af220c15b..40a44c3061 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( "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" ); } diff --git a/pcbnew/drc/drc_rule_parser.cpp b/pcbnew/drc/drc_rule_parser.cpp index 2dd4b07017..355a1899ea 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-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& 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(); } diff --git a/pcbnew/drc/drc_test_provider.cpp b/pcbnew/drc/drc_test_provider.cpp index 83f8cd4d3b..741cd2ba78 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-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 ""; } -const wxString DRC_TEST_PROVIDER::GetDescription() const { return ""; } +const wxString DRC_TEST_PROVIDER::GetName() const { return wxT( "" ); } +const wxString DRC_TEST_PROVIDER::GetDescription() const { return wxEmptyString; } 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( "Rule hit statistics: " ); + m_drcEngine->ReportAux( wxT( "Rule hit statistics: " ) ); for( const std::pair& 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 ) ); } diff --git a/pcbnew/drc/drc_test_provider_annular_width.cpp b/pcbnew/drc/drc_test_provider_annular_width.cpp index 0bde18c48e..e4abbd6d24 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-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 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(); diff --git a/pcbnew/drc/drc_test_provider_connectivity.cpp b/pcbnew/drc/drc_test_provider_connectivity.cpp index 4acf134e31..92fdf842fc 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-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 GetConstraintTypes() const override; diff --git a/pcbnew/drc/drc_test_provider_copper_clearance.cpp b/pcbnew/drc/drc_test_provider_copper_clearance.cpp index 977467e1ea..0ebb64b2c1 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-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 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, 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, int> checkedPairs; diff --git a/pcbnew/drc/drc_test_provider_courtyard_clearance.cpp b/pcbnew/drc/drc_test_provider_courtyard_clearance.cpp index 39cb51f830..9914906925 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-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 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; diff --git a/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp b/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp index 634cf7cafa..9ec310787c 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-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 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; " ), diff --git a/pcbnew/drc/drc_test_provider_disallow.cpp b/pcbnew/drc/drc_test_provider_disallow.cpp index 52a56f7692..c12acfe620 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-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 GetConstraintTypes() const override; diff --git a/pcbnew/drc/drc_test_provider_edge_clearance.cpp b/pcbnew/drc/drc_test_provider_edge_clearance.cpp index 040ce53d8a..372af7938e 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-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 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> 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 83a0e6d0d7..d333d77ba6 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-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 GetConstraintTypes() const override; @@ -106,23 +106,18 @@ 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 ) - vias.push_back( static_cast( 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( track ), 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 fa9800369b..a579052449 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-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 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 } diff --git a/pcbnew/drc/drc_test_provider_lvs.cpp b/pcbnew/drc/drc_test_provider_lvs.cpp index 8d85cdf7a9..b1beb6480d 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-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 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; } diff --git a/pcbnew/drc/drc_test_provider_matched_length.cpp b/pcbnew/drc/drc_test_provider_matched_length.cpp index 7be3664a30..b44fbad1b8 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-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, diff --git a/pcbnew/drc/drc_test_provider_misc.cpp b/pcbnew/drc/drc_test_provider_misc.cpp index 79dd8f49db..d436729e27 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-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 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 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( item ); + if( !reportProgress( ii++, items, delta ) ) + return false; + + BOARD_ITEM* boardItem = dynamic_cast( item ); + EDA_TEXT* text = dynamic_cast( boardItem ); if( text && text->GetShownText().Matches( wxT( "*${*}*" ) ) ) { std::shared_ptrdrcItem = 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() ); diff --git a/pcbnew/drc/drc_test_provider_silk_clearance.cpp b/pcbnew/drc/drc_test_provider_silk_clearance.cpp index 301a51b2a1..169d32ce48 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-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() ); diff --git a/pcbnew/drc/drc_test_provider_silk_to_mask.cpp b/pcbnew/drc/drc_test_provider_silk_to_mask.cpp index 5298e3da97..7e05959753 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-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 diff --git a/pcbnew/drc/drc_test_provider_track_width.cpp b/pcbnew/drc/drc_test_provider_track_width.cpp index 19c1be6c0c..da4f9077b4 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-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 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 } diff --git a/pcbnew/drc/drc_test_provider_via_diameter.cpp b/pcbnew/drc/drc_test_provider_via_diameter.cpp index c4a884894b..0006734faf 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-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 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 }