diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp index 52f2efdb77..8a2003740a 100644 --- a/pcbnew/dialogs/dialog_drc.cpp +++ b/pcbnew/dialogs/dialog_drc.cpp @@ -443,7 +443,7 @@ void DIALOG_DRC::OnDRCItemDClick( wxDataViewEvent& aEvent ) Show( false ); } - // Do not skip aVent here: this is not useful, and Pcbnew crashes + // Do not skip aEvent here: this is not useful, and Pcbnew crashes // if skipped (at least on Windows) } @@ -456,6 +456,7 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent ) return; std::shared_ptr rcItem = node->m_RcItem; + DRC_ITEM* drcItem = static_cast( rcItem.get() ); wxString listName; wxMenu menu; wxString msg; @@ -471,11 +472,25 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent ) { menu.Append( 1, _( "Remove exclusion for this violation" ), wxString::Format( _( "It will be placed back in the %s list" ), listName ) ); + + if( drcItem->GetViolatingRule() && !drcItem->GetViolatingRule()->m_Implicit ) + { + msg.Printf( _( "Remove all exclusions for violations of rule '%s'" ), + drcItem->GetViolatingRule()->m_Name ); + menu.Append( 11, msg ); + } } else { menu.Append( 2, _( "Exclude this violation" ), wxString::Format( _( "It will be excluded from the %s list" ), listName ) ); + + if( drcItem->GetViolatingRule() && !drcItem->GetViolatingRule()->m_Implicit ) + { + msg.Printf( _( "Exclude all violations of rule '%s'" ), + drcItem->GetViolatingRule()->m_Name ); + menu.Append( 21, msg ); + } } if( rcItem->GetErrorCode() == DRCE_CLEARANCE @@ -552,6 +567,38 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent ) break; } + case 11: + { + for( PCB_MARKER* marker : m_frame->GetBoard()->Markers() ) + { + DRC_ITEM* candidateDrcItem = static_cast( marker->GetRCItem().get() ); + + if( candidateDrcItem->GetViolatingRule() == drcItem->GetViolatingRule() ) + marker->SetExcluded( false ); + } + + // Rebuild model and view + static_cast( aEvent.GetModel() )->SetProvider( m_markersProvider ); + modified = true; + break; + } + + case 21: + { + for( PCB_MARKER* marker : m_frame->GetBoard()->Markers() ) + { + DRC_ITEM* candidateDrcItem = static_cast( marker->GetRCItem().get() ); + + if( candidateDrcItem->GetViolatingRule() == drcItem->GetViolatingRule() ) + marker->SetExcluded( true ); + } + + // Rebuild model and view + static_cast( aEvent.GetModel() )->SetProvider( m_markersProvider ); + modified = true; + break; + } + case 3: { TOOL_MANAGER* toolMgr = m_frame->GetToolManager(); @@ -822,7 +869,7 @@ void DIALOG_DRC::ExcludeMarker() RC_TREE_NODE* node = RC_TREE_MODEL::ToNode( m_markerDataView->GetCurrentItem() ); PCB_MARKER* marker = dynamic_cast( node->m_RcItem->GetParent() ); - if( marker && !marker->GetSeverity() == RPT_SEVERITY_EXCLUSION ) + if( marker && marker->GetSeverity() != RPT_SEVERITY_EXCLUSION ) { marker->SetExcluded( true ); m_frame->GetCanvas()->GetView()->Update( marker ); diff --git a/pcbnew/drc/drc_item.cpp b/pcbnew/drc/drc_item.cpp index 75aa466fb2..d28d59f954 100644 --- a/pcbnew/drc/drc_item.cpp +++ b/pcbnew/drc/drc_item.cpp @@ -372,6 +372,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" ); }