diff --git a/common/layer_id.cpp b/common/layer_id.cpp index da7a960bba..6623497c77 100644 --- a/common/layer_id.cpp +++ b/common/layer_id.cpp @@ -130,6 +130,7 @@ wxString LayerName( int aLayer ) case LAYER_NOCONNECT: return _( "No-connect symbols" ); case LAYER_ERC_WARN: return _( "ERC warnings" ); case LAYER_ERC_ERR: return _( "ERC errors" ); + case LAYER_ERC_EXCLUSION: return _( "ERC exclusions" ); case LAYER_SCHEMATIC_ANCHOR: return _( "Anchors" ); case LAYER_SCHEMATIC_AUX_ITEMS: return _( "Helper items" ); case LAYER_SCHEMATIC_GRID: return _( "Grid" ); diff --git a/common/settings/builtin_color_themes.h b/common/settings/builtin_color_themes.h index cb63efdc2b..8fcd864d58 100644 --- a/common/settings/builtin_color_themes.h +++ b/common/settings/builtin_color_themes.h @@ -38,6 +38,7 @@ static const std::map s_defaultTheme = { LAYER_SCHEMATIC_CURSOR, CSS_COLOR( 15, 15, 15, 1 ) }, { LAYER_ERC_ERR, CSS_COLOR( 230, 9, 13, 0.8 ) }, { LAYER_ERC_WARN, CSS_COLOR( 209, 146, 0, 0.8 ) }, + { LAYER_ERC_EXCLUSION, CSS_COLOR( 94, 194, 194, 0.8 ) }, { LAYER_FIELDS, CSS_COLOR( 132, 0, 132, 1 ) }, { LAYER_SCHEMATIC_GRID, CSS_COLOR( 181, 181, 181, 1 ) }, { LAYER_SCHEMATIC_GRID_AXES, CSS_COLOR( 0, 0, 132, 1 ) }, @@ -185,6 +186,7 @@ static const std::map s_classicTheme = { LAYER_SCHEMATIC_CURSOR, COLOR4D( BLACK ) }, { LAYER_ERC_ERR, COLOR4D( PURERED ).WithAlpha( 0.8 ) }, { LAYER_ERC_WARN, COLOR4D( PUREGREEN ).WithAlpha( 0.8 ) }, + { LAYER_DRC_EXCLUSION, COLOR4D( LIGHTGRAY ) }, { LAYER_FIELDS, COLOR4D( MAGENTA ) }, { LAYER_SCHEMATIC_GRID, COLOR4D( DARKGRAY ) }, { LAYER_SCHEMATIC_GRID_AXES, COLOR4D( BLUE ) }, diff --git a/eeschema/dialogs/panel_eeschema_display_options.cpp b/eeschema/dialogs/panel_eeschema_display_options.cpp index 8ecd2f710b..5249f007b7 100644 --- a/eeschema/dialogs/panel_eeschema_display_options.cpp +++ b/eeschema/dialogs/panel_eeschema_display_options.cpp @@ -45,6 +45,9 @@ void PANEL_EESCHEMA_DISPLAY_OPTIONS::loadEEschemaSettings( EESCHEMA_SETTINGS* cf { m_checkShowHiddenPins->SetValue( cfg->m_Appearance.show_hidden_pins ); m_checkShowHiddenFields->SetValue( cfg->m_Appearance.show_hidden_fields ); + m_checkShowERCErrors->SetValue( cfg->m_Appearance.show_erc_errors ); + m_checkShowERCWarnings->SetValue( cfg->m_Appearance.show_erc_warnings ); + m_checkShowERCExclusions->SetValue( cfg->m_Appearance.show_erc_exclusions ); m_checkPageLimits->SetValue( cfg->m_Appearance.show_page_limits ); m_checkSelTextBox->SetValue( cfg->m_Selection.text_as_box ); @@ -79,6 +82,9 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow() cfg->m_Appearance.show_hidden_pins = m_checkShowHiddenPins->GetValue(); cfg->m_Appearance.show_hidden_fields = m_checkShowHiddenFields->GetValue(); + cfg->m_Appearance.show_erc_warnings = m_checkShowERCWarnings->GetValue(); + cfg->m_Appearance.show_erc_errors = m_checkShowERCErrors->GetValue(); + cfg->m_Appearance.show_erc_exclusions = m_checkShowERCExclusions->GetValue(); cfg->m_Appearance.show_page_limits = m_checkPageLimits->GetValue(); cfg->m_Selection.text_as_box = m_checkSelTextBox->GetValue(); diff --git a/eeschema/dialogs/panel_eeschema_display_options_base.cpp b/eeschema/dialogs/panel_eeschema_display_options_base.cpp index 268f63c7b2..7768b3fb87 100644 --- a/eeschema/dialogs/panel_eeschema_display_options_base.cpp +++ b/eeschema/dialogs/panel_eeschema_display_options_base.cpp @@ -31,6 +31,15 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind m_checkShowHiddenFields = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Show hidden fields"), wxDefaultPosition, wxDefaultSize, 0 ); sbSizer1->Add( m_checkShowHiddenFields, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + m_checkShowERCErrors = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Show ERC errors"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizer1->Add( m_checkShowERCErrors, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_checkShowERCWarnings = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Show ERC warnings"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizer1->Add( m_checkShowERCWarnings, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_checkShowERCExclusions = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Show ERC exclusions"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizer1->Add( m_checkShowERCExclusions, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + m_checkPageLimits = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Show page limi&ts"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkPageLimits->SetValue(true); sbSizer1->Add( m_checkPageLimits, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); diff --git a/eeschema/dialogs/panel_eeschema_display_options_base.fbp b/eeschema/dialogs/panel_eeschema_display_options_base.fbp index 6053d69da7..be6523044d 100644 --- a/eeschema/dialogs/panel_eeschema_display_options_base.fbp +++ b/eeschema/dialogs/panel_eeschema_display_options_base.fbp @@ -214,6 +214,198 @@ + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Show ERC errors + + 0 + + + 0 + + 1 + m_checkShowERCErrors + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Show ERC warnings + + 0 + + + 0 + + 1 + m_checkShowERCWarnings + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Show ERC exclusions + + 0 + + + 0 + + 1 + m_checkShowERCExclusions + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + 5 wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT diff --git a/eeschema/dialogs/panel_eeschema_display_options_base.h b/eeschema/dialogs/panel_eeschema_display_options_base.h index b68bb99f63..586fd8daff 100644 --- a/eeschema/dialogs/panel_eeschema_display_options_base.h +++ b/eeschema/dialogs/panel_eeschema_display_options_base.h @@ -37,6 +37,9 @@ class PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE : public RESETTABLE_PANEL wxBoxSizer* m_galOptionsSizer; wxCheckBox* m_checkShowHiddenPins; wxCheckBox* m_checkShowHiddenFields; + wxCheckBox* m_checkShowERCErrors; + wxCheckBox* m_checkShowERCWarnings; + wxCheckBox* m_checkShowERCExclusions; wxCheckBox* m_checkPageLimits; wxCheckBox* m_checkSelTextBox; wxCheckBox* m_checkSelDrawChildItems; diff --git a/eeschema/eeschema_settings.cpp b/eeschema/eeschema_settings.cpp index be303edc1c..22a811efc0 100644 --- a/eeschema/eeschema_settings.cpp +++ b/eeschema/eeschema_settings.cpp @@ -100,6 +100,15 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() : m_params.emplace_back( new PARAM( "appearance.show_hidden_fields", &m_Appearance.show_hidden_fields, false ) ); + m_params.emplace_back( new PARAM( "appearance.show_erc_warnings", + &m_Appearance.show_erc_warnings, true ) ); + + m_params.emplace_back( new PARAM( "appearance.show_erc_errors", + &m_Appearance.show_erc_errors, true ) ); + + m_params.emplace_back( new PARAM( "appearance.show_erc_exclusions", + &m_Appearance.show_erc_exclusions, false ) ); + m_params.emplace_back( new PARAM( "appearance.show_illegal_symbol_lib_dialog", &m_Appearance.show_illegal_symbol_lib_dialog, true ) ); diff --git a/eeschema/eeschema_settings.h b/eeschema/eeschema_settings.h index f53136bced..ad78c17fde 100644 --- a/eeschema/eeschema_settings.h +++ b/eeschema/eeschema_settings.h @@ -44,6 +44,9 @@ public: bool print_sheet_reference; bool show_hidden_pins; bool show_hidden_fields; + bool show_erc_warnings; + bool show_erc_errors; + bool show_erc_exclusions; bool show_illegal_symbol_lib_dialog; bool show_page_limits; bool show_sexpr_file_convert_warning; diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index ba4f406e6a..9cbc30febb 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -174,22 +174,26 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() viewMenu->Add( ACTIONS::zoomRedraw ); viewMenu->AppendSeparator(); - viewMenu->Add( ACTIONS::toggleGrid, ACTION_MENU::CHECK ); + viewMenu->Add( ACTIONS::toggleGrid, ACTION_MENU::CHECK ); viewMenu->Add( ACTIONS::gridProperties ); // Units submenu ACTION_MENU* unitsSubMenu = new ACTION_MENU( false, selTool ); unitsSubMenu->SetTitle( _( "&Units" ) ); unitsSubMenu->SetIcon( BITMAPS::unit_mm ); - unitsSubMenu->Add( ACTIONS::inchesUnits, ACTION_MENU::CHECK ); - unitsSubMenu->Add( ACTIONS::milsUnits, ACTION_MENU::CHECK ); - unitsSubMenu->Add( ACTIONS::millimetersUnits, ACTION_MENU::CHECK ); + unitsSubMenu->Add( ACTIONS::inchesUnits, ACTION_MENU::CHECK ); + unitsSubMenu->Add( ACTIONS::milsUnits, ACTION_MENU::CHECK ); + unitsSubMenu->Add( ACTIONS::millimetersUnits, ACTION_MENU::CHECK ); viewMenu->Add( unitsSubMenu ); - viewMenu->Add( ACTIONS::toggleCursorStyle, ACTION_MENU::CHECK ); + viewMenu->Add( ACTIONS::toggleCursorStyle, ACTION_MENU::CHECK ); viewMenu->AppendSeparator(); - viewMenu->Add( EE_ACTIONS::toggleHiddenPins, ACTION_MENU::CHECK ); + viewMenu->Add( EE_ACTIONS::toggleHiddenPins, ACTION_MENU::CHECK ); + viewMenu->Add( EE_ACTIONS::toggleHiddenFields, ACTION_MENU::CHECK ); + viewMenu->Add( EE_ACTIONS::toggleERCErrors, ACTION_MENU::CHECK ); + viewMenu->Add( EE_ACTIONS::toggleERCWarnings, ACTION_MENU::CHECK ); + viewMenu->Add( EE_ACTIONS::toggleERCExclusions, ACTION_MENU::CHECK ); #ifdef __APPLE__ viewMenu->AppendSeparator(); diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index e6f8ef27b5..b63f5a5cd4 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -430,41 +430,75 @@ void SCH_EDIT_FRAME::setupUIConditions() CHECK( cond.CurrentTool( ACTIONS::selectionTool ) ) ); if( SCRIPTING::IsWxAvailable() ) + { mgr->SetConditions( EE_ACTIONS::showPythonConsole, CHECK( cond.ScriptingConsoleVisible() ) ); + } auto showHiddenPinsCond = - [this] ( const SELECTION& ) - { - return GetShowAllPins(); - }; + [this]( const SELECTION& ) + { + return GetShowAllPins(); + }; + + auto showHiddenFieldsCond = + [this]( const SELECTION& ) + { + EESCHEMA_SETTINGS* cfg = eeconfig(); + return cfg && cfg->m_Appearance.show_hidden_fields; + }; + + auto showERCErrorsCond = + [this]( const SELECTION& ) + { + EESCHEMA_SETTINGS* cfg = eeconfig(); + return cfg && cfg->m_Appearance.show_erc_errors; + }; + + auto showERCWarningsCond = + [this]( const SELECTION& ) + { + EESCHEMA_SETTINGS* cfg = eeconfig(); + return cfg && cfg->m_Appearance.show_erc_warnings; + }; + + auto showERCExclusionsCond = + [this]( const SELECTION& ) + { + EESCHEMA_SETTINGS* cfg = eeconfig(); + return cfg && cfg->m_Appearance.show_erc_exclusions; + }; auto forceHVCond = - [this] ( const SELECTION& ) - { - EESCHEMA_SETTINGS* cfg = eeconfig(); - return cfg && cfg->m_Drawing.hv_lines_only; - }; + [this]( const SELECTION& ) + { + EESCHEMA_SETTINGS* cfg = eeconfig(); + return cfg && cfg->m_Drawing.hv_lines_only; + }; auto remapSymbolsCondition = - [&]( const SELECTION& aSel ) - { - SCH_SCREENS schematic( Schematic().Root() ); + [&]( const SELECTION& aSel ) + { + SCH_SCREENS schematic( Schematic().Root() ); - // The remapping can only be performed on legacy projects. - return schematic.HasNoFullyDefinedLibIds(); - }; + // The remapping can only be performed on legacy projects. + return schematic.HasNoFullyDefinedLibIds(); + }; auto belowRootSheetCondition = - [this]( const SELECTION& aSel ) - { - return GetCurrentSheet().Last() != &Schematic().Root(); - }; + [this]( const SELECTION& aSel ) + { + return GetCurrentSheet().Last() != &Schematic().Root(); + }; - mgr->SetConditions( EE_ACTIONS::leaveSheet, ENABLE( belowRootSheetCondition ) ); - mgr->SetConditions( EE_ACTIONS::remapSymbols, ENABLE( remapSymbolsCondition ) ); - mgr->SetConditions( EE_ACTIONS::toggleHiddenPins, CHECK( showHiddenPinsCond ) ); - mgr->SetConditions( EE_ACTIONS::toggleForceHV, CHECK( forceHVCond ) ); + mgr->SetConditions( EE_ACTIONS::leaveSheet, ENABLE( belowRootSheetCondition ) ); + mgr->SetConditions( EE_ACTIONS::remapSymbols, ENABLE( remapSymbolsCondition ) ); + mgr->SetConditions( EE_ACTIONS::toggleHiddenPins, CHECK( showHiddenPinsCond ) ); + mgr->SetConditions( EE_ACTIONS::toggleHiddenFields, CHECK( showHiddenFieldsCond ) ); + mgr->SetConditions( EE_ACTIONS::toggleERCErrors, CHECK( showERCErrorsCond ) ); + mgr->SetConditions( EE_ACTIONS::toggleERCWarnings, CHECK( showERCWarningsCond ) ); + mgr->SetConditions( EE_ACTIONS::toggleERCExclusions, CHECK( showERCExclusionsCond ) ); + mgr->SetConditions( EE_ACTIONS::toggleForceHV, CHECK( forceHVCond ) ); #define CURRENT_TOOL( action ) mgr->SetConditions( action, CHECK( cond.CurrentTool( action ) ) ) @@ -1467,9 +1501,14 @@ void SCH_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVars ShowAllIntersheetRefs( settings.m_IntersheetRefsShow ); - auto cfg = Pgm().GetSettingsManager().GetAppSettings(); + EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings(); GetGalDisplayOptions().ReadWindowSettings( cfg->m_Window ); + KIGFX::VIEW* view = GetCanvas()->GetView(); + view->SetLayerVisible( LAYER_ERC_ERR, cfg->m_Appearance.show_erc_errors ); + view->SetLayerVisible( LAYER_ERC_WARN, cfg->m_Appearance.show_erc_warnings ); + view->SetLayerVisible( LAYER_ERC_EXCLUSION, cfg->m_Appearance.show_erc_exclusions ); + GetCanvas()->ForceRefresh(); RecreateToolbars(); diff --git a/eeschema/sch_marker.cpp b/eeschema/sch_marker.cpp index 603454358f..c28f3bbc59 100644 --- a/eeschema/sch_marker.cpp +++ b/eeschema/sch_marker.cpp @@ -108,11 +108,18 @@ void SCH_MARKER::ViewGetLayers( int aLayers[], int& aCount ) const wxCHECK_RET( Schematic(), "No SCHEMATIC set for SCH_MARKER!" ); - switch( Schematic()->ErcSettings().GetSeverity( m_rcItem->GetErrorCode() ) ) + if( IsExcluded() ) { - default: - case SEVERITY::RPT_SEVERITY_ERROR: aLayers[0] = LAYER_ERC_ERR; break; - case SEVERITY::RPT_SEVERITY_WARNING: aLayers[0] = LAYER_ERC_WARN; break; + aLayers[0] = LAYER_ERC_EXCLUSION; + } + else + { + switch( Schematic()->ErcSettings().GetSeverity( m_rcItem->GetErrorCode() ) ) + { + default: + case SEVERITY::RPT_SEVERITY_ERROR: aLayers[0] = LAYER_ERC_ERR; break; + case SEVERITY::RPT_SEVERITY_WARNING: aLayers[0] = LAYER_ERC_WARN; break; + } } aLayers[1] = LAYER_SELECTION_SHADOWS; @@ -122,7 +129,7 @@ void SCH_MARKER::ViewGetLayers( int aLayers[], int& aCount ) const SCH_LAYER_ID SCH_MARKER::GetColorLayer() const { if( IsExcluded() ) - return LAYER_HIDDEN; + return LAYER_ERC_EXCLUSION; wxCHECK_MSG( Schematic(), LAYER_ERC_ERR, "No SCHEMATIC set for SCH_MARKER!" ); diff --git a/eeschema/sch_view.h b/eeschema/sch_view.h index 8e6bcf322d..9cb7b986f8 100644 --- a/eeschema/sch_view.h +++ b/eeschema/sch_view.h @@ -45,7 +45,7 @@ constexpr double SCH_WORLD_UNIT ( 1e-7 / 0.0254 ); static const int SCH_LAYER_ORDER[] = { LAYER_GP_OVERLAY, LAYER_SELECT_OVERLAY, - LAYER_ERC_ERR, LAYER_ERC_WARN, LAYER_DANGLING, + LAYER_ERC_ERR, LAYER_ERC_WARN, LAYER_ERC_EXCLUSION, LAYER_DANGLING, LAYER_REFERENCEPART, LAYER_VALUEPART, LAYER_FIELDS, LAYER_INTERSHEET_REFS, LAYER_NETCLASS_REFS, LAYER_BUS_JUNCTION, LAYER_JUNCTION, LAYER_NOCONNECT, diff --git a/eeschema/tools/ee_actions.cpp b/eeschema/tools/ee_actions.cpp index 4052200db7..6e2467e241 100644 --- a/eeschema/tools/ee_actions.cpp +++ b/eeschema/tools/ee_actions.cpp @@ -655,6 +655,19 @@ TOOL_ACTION EE_ACTIONS::toggleHiddenFields( "eeschema.EditorControl.showHiddenFi AS_GLOBAL, 0, "", _( "Show Hidden Fields" ), _( "Toggle display of hidden text fields" ) ); +TOOL_ACTION EE_ACTIONS::toggleERCWarnings( "eeschema.EditorControl.showERCWarnings", + AS_GLOBAL, 0, "", + _( "Show ERC Warnings" ), _( "Show markers for electrical rules checker warnings" ) ); + +TOOL_ACTION EE_ACTIONS::toggleERCErrors( "eeschema.EditorControl.showERCErrors", + AS_GLOBAL, 0, "", + _( "Show ERC Errors" ), _( "Show markers for electrical rules checker errors" ) ); + +TOOL_ACTION EE_ACTIONS::toggleERCExclusions( "eeschema.EditorControl.showERCExclusions", + AS_GLOBAL, 0, "", + _( "Show ERC Exclusions" ), + _( "Show markers for excluded electrical rules checker violations" ) ); + TOOL_ACTION EE_ACTIONS::toggleForceHV( "eeschema.EditorControl.forceHVLines", AS_GLOBAL, 0, "", _( "Force H/V Wires and Buses" ), _( "Switch H & V only mode for new wires and buses" ), diff --git a/eeschema/tools/ee_actions.h b/eeschema/tools/ee_actions.h index 948adc012f..a2523d61fc 100644 --- a/eeschema/tools/ee_actions.h +++ b/eeschema/tools/ee_actions.h @@ -196,6 +196,9 @@ public: // Miscellaneous static TOOL_ACTION toggleHiddenPins; static TOOL_ACTION toggleHiddenFields; + static TOOL_ACTION toggleERCWarnings; + static TOOL_ACTION toggleERCErrors; + static TOOL_ACTION toggleERCExclusions; static TOOL_ACTION toggleSyncedPinsMode; static TOOL_ACTION restartMove; static TOOL_ACTION explicitCrossProbe; diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index 001fe3c94e..d394c94fa9 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -2149,6 +2149,42 @@ int SCH_EDITOR_CONTROL::ToggleHiddenFields( const TOOL_EVENT& aEvent ) } +int SCH_EDITOR_CONTROL::ToggleERCWarnings( const TOOL_EVENT& aEvent ) +{ + EESCHEMA_SETTINGS* cfg = m_frame->eeconfig(); + cfg->m_Appearance.show_erc_warnings = !cfg->m_Appearance.show_erc_warnings; + + getView()->SetLayerVisible( LAYER_ERC_WARN, cfg->m_Appearance.show_erc_warnings ); + m_frame->GetCanvas()->Refresh(); + + return 0; +} + + +int SCH_EDITOR_CONTROL::ToggleERCErrors( const TOOL_EVENT& aEvent ) +{ + EESCHEMA_SETTINGS* cfg = m_frame->eeconfig(); + cfg->m_Appearance.show_erc_errors = !cfg->m_Appearance.show_erc_errors; + + getView()->SetLayerVisible( LAYER_ERC_ERR, cfg->m_Appearance.show_erc_errors ); + m_frame->GetCanvas()->Refresh(); + + return 0; +} + + +int SCH_EDITOR_CONTROL::ToggleERCExclusions( const TOOL_EVENT& aEvent ) +{ + EESCHEMA_SETTINGS* cfg = m_frame->eeconfig(); + cfg->m_Appearance.show_erc_exclusions = !cfg->m_Appearance.show_erc_exclusions; + + getView()->SetLayerVisible( LAYER_ERC_EXCLUSION, cfg->m_Appearance.show_erc_exclusions ); + m_frame->GetCanvas()->Refresh(); + + return 0; +} + + int SCH_EDITOR_CONTROL::ToggleForceHV( const TOOL_EVENT& aEvent ) { m_frame->eeconfig()->m_Drawing.hv_lines_only = !m_frame->eeconfig()->m_Drawing.hv_lines_only; @@ -2327,6 +2363,9 @@ void SCH_EDITOR_CONTROL::setTransitions() Go( &SCH_EDITOR_CONTROL::ToggleHiddenPins, EE_ACTIONS::toggleHiddenPins.MakeEvent() ); Go( &SCH_EDITOR_CONTROL::ToggleHiddenFields, EE_ACTIONS::toggleHiddenFields.MakeEvent() ); + Go( &SCH_EDITOR_CONTROL::ToggleERCWarnings, EE_ACTIONS::toggleERCWarnings.MakeEvent() ); + Go( &SCH_EDITOR_CONTROL::ToggleERCErrors, EE_ACTIONS::toggleERCErrors.MakeEvent() ); + Go( &SCH_EDITOR_CONTROL::ToggleERCExclusions, EE_ACTIONS::toggleERCExclusions.MakeEvent() ); Go( &SCH_EDITOR_CONTROL::ToggleForceHV, EE_ACTIONS::toggleForceHV.MakeEvent() ); Go( &SCH_EDITOR_CONTROL::TogglePythonConsole, EE_ACTIONS::showPythonConsole.MakeEvent() ); diff --git a/eeschema/tools/sch_editor_control.h b/eeschema/tools/sch_editor_control.h index 98b8febce2..a15670f2da 100644 --- a/eeschema/tools/sch_editor_control.h +++ b/eeschema/tools/sch_editor_control.h @@ -137,6 +137,9 @@ public: int ToggleHiddenPins( const TOOL_EVENT& aEvent ); int ToggleHiddenFields( const TOOL_EVENT& aEvent ); + int ToggleERCWarnings( const TOOL_EVENT& aEvent ); + int ToggleERCErrors( const TOOL_EVENT& aEvent ); + int ToggleERCExclusions( const TOOL_EVENT& aEvent ); int ToggleForceHV( const TOOL_EVENT& aEvent ); int TogglePythonConsole( const TOOL_EVENT& aEvent ); diff --git a/include/layer_ids.h b/include/layer_ids.h index f20066339c..ec44b7183a 100644 --- a/include/layer_ids.h +++ b/include/layer_ids.h @@ -344,6 +344,7 @@ enum SCH_LAYER_ID: int LAYER_DANGLING, LAYER_ERC_WARN, LAYER_ERC_ERR, + LAYER_ERC_EXCLUSION, LAYER_DEVICE_BACKGROUND, LAYER_SHEET_BACKGROUND, LAYER_SCHEMATIC_GRID,