2020-03-16 11:05:01 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2020-07-16 09:31:39 +00:00
|
|
|
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
2020-03-16 11:05:01 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "wx/html/m_templ.h"
|
|
|
|
#include "wx/html/styleparams.h"
|
|
|
|
#include <erc.h>
|
|
|
|
#include <erc_item.h>
|
2020-05-07 13:35:50 +00:00
|
|
|
#include <i18n_utility.h>
|
2020-03-16 11:05:01 +00:00
|
|
|
|
2020-05-07 13:35:50 +00:00
|
|
|
|
2020-06-08 02:19:46 +00:00
|
|
|
// These, being statically-defined, require specialized I18N handling. We continue to
|
|
|
|
// use the _() macro so that string harvesting by the I18N framework doesn't have to be
|
|
|
|
// specialized, but we don't translate on initialization and instead do it in the getters.
|
|
|
|
|
|
|
|
#undef _
|
|
|
|
#define _(s) s
|
|
|
|
|
|
|
|
ERC_ITEM ERC_ITEM::duplicateSheetName( ERCE_DUPLICATE_SHEET_NAME,
|
|
|
|
_( "Duplicate sheet names within a given sheet" ),
|
|
|
|
wxT( "duplicate_sheet_names" ) );
|
|
|
|
|
|
|
|
ERC_ITEM ERC_ITEM::pinNotConnected( ERCE_PIN_NOT_CONNECTED,
|
|
|
|
_( "Pin not connected" ),
|
|
|
|
wxT( "pin_not_connected" ) );
|
|
|
|
|
|
|
|
ERC_ITEM ERC_ITEM::pinNotDriven( ERCE_PIN_NOT_DRIVEN,
|
|
|
|
_( "Pin connected to other pins, but not driven by any pin" ),
|
|
|
|
wxT( "pin_not_driven" ) );
|
|
|
|
|
2020-07-03 21:08:17 +00:00
|
|
|
ERC_ITEM ERC_ITEM::pinTableWarning( ERCE_PIN_TO_PIN_WARNING,
|
|
|
|
_( "Conflict problem between pins" ),
|
|
|
|
wxT( "pin_to_pin" ) );
|
|
|
|
|
|
|
|
ERC_ITEM ERC_ITEM::pinTableError( ERCE_PIN_TO_PIN_ERROR,
|
2020-06-08 02:19:46 +00:00
|
|
|
_( "Conflict problem between pins" ),
|
|
|
|
wxT( "pin_to_pin" ) );
|
|
|
|
|
|
|
|
ERC_ITEM ERC_ITEM::hierLabelMismatch( ERCE_HIERACHICAL_LABEL,
|
|
|
|
_( "Mismatch between hierarchical labels and pins sheets" ),
|
|
|
|
wxT( "hier_label_mismatch" ) );
|
|
|
|
|
|
|
|
ERC_ITEM ERC_ITEM::noConnectConnected( ERCE_NOCONNECT_CONNECTED,
|
|
|
|
_( "A pin with a \"no connection\" flag is connected" ),
|
|
|
|
wxT( "no_connect_connected" ) );
|
|
|
|
|
|
|
|
ERC_ITEM ERC_ITEM::noConnectDangling( ERCE_NOCONNECT_NOT_CONNECTED,
|
|
|
|
_( "Unconnected \"no connection\" flag" ),
|
|
|
|
wxT( "no_connect_dangling" ) );
|
|
|
|
|
|
|
|
ERC_ITEM ERC_ITEM::labelDangling( ERCE_LABEL_NOT_CONNECTED,
|
2020-10-04 21:13:42 +00:00
|
|
|
_( "Label not connected to anything" ),
|
2020-06-08 02:19:46 +00:00
|
|
|
wxT( "label_dangling" ) );
|
|
|
|
|
|
|
|
ERC_ITEM ERC_ITEM::globalLabelDangling( ERCE_GLOBLABEL,
|
|
|
|
_( "Global label not connected anywhere else in the schematic" ),
|
|
|
|
wxT( "global_label_dangling" ) );
|
|
|
|
|
|
|
|
ERC_ITEM ERC_ITEM::similarLabels( ERCE_SIMILAR_LABELS,
|
2020-07-16 09:31:39 +00:00
|
|
|
_( "Labels are similar (lower/upper case difference only)"),
|
2020-06-08 02:19:46 +00:00
|
|
|
wxT( "similar_labels" ) );
|
|
|
|
|
|
|
|
ERC_ITEM ERC_ITEM::differentUnitFootprint( ERCE_DIFFERENT_UNIT_FP,
|
|
|
|
_( "Different footprint assigned in another unit of the same component" ),
|
|
|
|
wxT( "different_unit_footprint" ) );
|
|
|
|
|
|
|
|
ERC_ITEM ERC_ITEM::differentUnitNet( ERCE_DIFFERENT_UNIT_NET,
|
|
|
|
_( "Different net assigned to a shared pin in another unit of the same component" ),
|
|
|
|
wxT( "different_unit_net" ) );
|
|
|
|
|
|
|
|
ERC_ITEM ERC_ITEM::busDefinitionConflict( ERCE_BUS_ALIAS_CONFLICT,
|
|
|
|
_( "Conflict between bus alias definitions across schematic sheets" ),
|
|
|
|
wxT( "bus_definition_conflict" ) );
|
|
|
|
|
|
|
|
ERC_ITEM ERC_ITEM::multipleNetNames( ERCE_DRIVER_CONFLICT,
|
|
|
|
_( "More than one name given to this bus or net" ),
|
|
|
|
wxT( "multiple_net_names" ) );
|
|
|
|
|
|
|
|
ERC_ITEM ERC_ITEM::netNotBusMember( ERCE_BUS_ENTRY_CONFLICT,
|
|
|
|
_( "Net is graphically connected to a bus but not a bus member" ),
|
|
|
|
wxT( "net_not_bus_member" ) );
|
|
|
|
|
|
|
|
ERC_ITEM ERC_ITEM::busLabelSyntax( ERCE_BUS_LABEL_ERROR,
|
|
|
|
_( "Label attached to bus item does not describe a bus" ),
|
|
|
|
wxT( "bus_label_syntax" ) );
|
|
|
|
|
|
|
|
ERC_ITEM ERC_ITEM::busToBusConflict( ERCE_BUS_TO_BUS_CONFLICT,
|
|
|
|
_( "Buses are graphically connected but share no bus members" ),
|
|
|
|
wxT( "bus_to_bus_conflict" ) );
|
|
|
|
|
|
|
|
ERC_ITEM ERC_ITEM::busToNetConflict( ERCE_BUS_TO_NET_CONFLICT,
|
|
|
|
_( "Invalid connection between bus and net items" ),
|
|
|
|
wxT( "bus_to_net_conflict" ) );
|
|
|
|
|
|
|
|
ERC_ITEM ERC_ITEM::unresolvedVariable( ERCE_UNRESOLVED_VARIABLE,
|
|
|
|
_( "Unresolved text variable" ),
|
|
|
|
wxT( "unresolved_variable" ) );
|
|
|
|
|
2020-08-25 22:00:07 +00:00
|
|
|
ERC_ITEM ERC_ITEM::wireDangling( ERCE_WIRE_DANGLING,
|
|
|
|
_( "Wires not connected to anything" ),
|
|
|
|
wxT( "wire_dangling" ) );
|
|
|
|
|
2020-10-07 13:15:31 +00:00
|
|
|
ERC_ITEM ERC_ITEM::libSymbolIssues( ERCE_LIB_SYMBOL_ISSUES,
|
|
|
|
_( "Library symbol issue" ),
|
|
|
|
wxT( "lib_symbol_issues" ) );
|
|
|
|
|
2020-06-08 02:19:46 +00:00
|
|
|
std::vector<std::reference_wrapper<RC_ITEM>> ERC_ITEM::allItemTypes( {
|
|
|
|
ERC_ITEM::duplicateSheetName,
|
|
|
|
ERC_ITEM::pinNotConnected,
|
|
|
|
ERC_ITEM::pinNotDriven,
|
2020-07-03 21:08:17 +00:00
|
|
|
ERC_ITEM::pinTableWarning,
|
2020-06-08 02:19:46 +00:00
|
|
|
ERC_ITEM::hierLabelMismatch,
|
|
|
|
ERC_ITEM::noConnectConnected,
|
|
|
|
ERC_ITEM::noConnectDangling,
|
|
|
|
ERC_ITEM::labelDangling,
|
|
|
|
ERC_ITEM::globalLabelDangling,
|
2020-08-25 22:00:07 +00:00
|
|
|
ERC_ITEM::wireDangling,
|
2020-06-08 02:19:46 +00:00
|
|
|
ERC_ITEM::similarLabels,
|
|
|
|
ERC_ITEM::differentUnitFootprint,
|
|
|
|
ERC_ITEM::differentUnitNet,
|
|
|
|
ERC_ITEM::busDefinitionConflict,
|
|
|
|
ERC_ITEM::multipleNetNames,
|
|
|
|
ERC_ITEM::netNotBusMember,
|
|
|
|
ERC_ITEM::busLabelSyntax,
|
|
|
|
ERC_ITEM::busToBusConflict,
|
|
|
|
ERC_ITEM::busToNetConflict,
|
2020-10-07 13:15:31 +00:00
|
|
|
ERC_ITEM::unresolvedVariable,
|
|
|
|
ERC_ITEM::libSymbolIssues,
|
2020-06-08 02:19:46 +00:00
|
|
|
} );
|
|
|
|
|
|
|
|
|
2020-04-24 18:56:44 +00:00
|
|
|
|
2020-08-11 13:33:16 +00:00
|
|
|
std::shared_ptr<ERC_ITEM> ERC_ITEM::Create( int aErrorCode )
|
2020-06-08 02:19:46 +00:00
|
|
|
{
|
2020-04-29 13:30:31 +00:00
|
|
|
switch( aErrorCode )
|
2020-03-16 11:05:01 +00:00
|
|
|
{
|
2020-08-15 00:37:23 +00:00
|
|
|
case ERCE_DUPLICATE_SHEET_NAME: return std::make_shared<ERC_ITEM>( duplicateSheetName );
|
|
|
|
case ERCE_PIN_NOT_CONNECTED: return std::make_shared<ERC_ITEM>( pinNotConnected );
|
|
|
|
case ERCE_PIN_NOT_DRIVEN: return std::make_shared<ERC_ITEM>( pinNotDriven );
|
|
|
|
case ERCE_PIN_TO_PIN_WARNING: return std::make_shared<ERC_ITEM>( pinTableWarning );
|
|
|
|
case ERCE_PIN_TO_PIN_ERROR: return std::make_shared<ERC_ITEM>( pinTableError );
|
|
|
|
case ERCE_HIERACHICAL_LABEL: return std::make_shared<ERC_ITEM>( hierLabelMismatch );
|
|
|
|
case ERCE_NOCONNECT_CONNECTED: return std::make_shared<ERC_ITEM>( noConnectConnected );
|
|
|
|
case ERCE_NOCONNECT_NOT_CONNECTED: return std::make_shared<ERC_ITEM>( noConnectDangling );
|
|
|
|
case ERCE_LABEL_NOT_CONNECTED: return std::make_shared<ERC_ITEM>( labelDangling );
|
|
|
|
case ERCE_SIMILAR_LABELS: return std::make_shared<ERC_ITEM>( similarLabels );
|
|
|
|
case ERCE_DIFFERENT_UNIT_FP: return std::make_shared<ERC_ITEM>( differentUnitFootprint );
|
|
|
|
case ERCE_DIFFERENT_UNIT_NET: return std::make_shared<ERC_ITEM>( differentUnitNet );
|
|
|
|
case ERCE_BUS_ALIAS_CONFLICT: return std::make_shared<ERC_ITEM>( busDefinitionConflict );
|
|
|
|
case ERCE_DRIVER_CONFLICT: return std::make_shared<ERC_ITEM>( multipleNetNames );
|
|
|
|
case ERCE_BUS_ENTRY_CONFLICT: return std::make_shared<ERC_ITEM>( netNotBusMember );
|
|
|
|
case ERCE_BUS_LABEL_ERROR: return std::make_shared<ERC_ITEM>( busLabelSyntax );
|
|
|
|
case ERCE_BUS_TO_BUS_CONFLICT: return std::make_shared<ERC_ITEM>( busToBusConflict );
|
|
|
|
case ERCE_BUS_TO_NET_CONFLICT: return std::make_shared<ERC_ITEM>( busToNetConflict );
|
|
|
|
case ERCE_GLOBLABEL: return std::make_shared<ERC_ITEM>( globalLabelDangling );
|
|
|
|
case ERCE_UNRESOLVED_VARIABLE: return std::make_shared<ERC_ITEM>( unresolvedVariable );
|
2020-08-25 22:00:07 +00:00
|
|
|
case ERCE_WIRE_DANGLING: return std::make_shared<ERC_ITEM>( wireDangling );
|
2020-10-07 13:15:31 +00:00
|
|
|
case ERCE_LIB_SYMBOL_ISSUES: return std::make_shared<ERC_ITEM>( libSymbolIssues );
|
2020-06-08 02:19:46 +00:00
|
|
|
case ERCE_UNSPECIFIED:
|
2020-03-16 11:05:01 +00:00
|
|
|
default:
|
2020-06-08 02:19:46 +00:00
|
|
|
wxFAIL_MSG( "Unknown ERC error code" );
|
|
|
|
return nullptr;
|
2020-03-16 11:05:01 +00:00
|
|
|
}
|
2020-08-15 00:37:23 +00:00
|
|
|
|
|
|
|
return nullptr;
|
2020-03-16 11:05:01 +00:00
|
|
|
}
|