Update DRC exclusions model to match terminology.
DRC exclusions were originally written following the C++ pragma model (ie: allow this violation here). However, the "exclusion" terminology we used in the GUI suggests a model model where the exclusions go away when the violation no longer exists. Fixes https://gitlab.com/kicad/code/kicad/issues/14351
This commit is contained in:
parent
27ebba6b33
commit
521aa5b5ae
|
@ -306,7 +306,7 @@ void BOARD::UpdateRatsnestExclusions()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<PCB_MARKER*> BOARD::ResolveDRCExclusions()
|
std::vector<PCB_MARKER*> BOARD::ResolveDRCExclusions( bool aCreateMarkers )
|
||||||
{
|
{
|
||||||
for( PCB_MARKER* marker : GetBoard()->Markers() )
|
for( PCB_MARKER* marker : GetBoard()->Markers() )
|
||||||
{
|
{
|
||||||
|
@ -321,28 +321,31 @@ std::vector<PCB_MARKER*> BOARD::ResolveDRCExclusions()
|
||||||
|
|
||||||
std::vector<PCB_MARKER*> newMarkers;
|
std::vector<PCB_MARKER*> newMarkers;
|
||||||
|
|
||||||
for( const wxString& exclusionData : m_designSettings->m_DrcExclusions )
|
if( aCreateMarkers )
|
||||||
{
|
{
|
||||||
PCB_MARKER* marker = PCB_MARKER::Deserialize( exclusionData );
|
for( const wxString& exclusionData : m_designSettings->m_DrcExclusions )
|
||||||
|
|
||||||
if( !marker )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Check to see if items still exist
|
|
||||||
for( const KIID& guid : marker->GetRCItem()->GetIDs() )
|
|
||||||
{
|
{
|
||||||
if( GetItem( guid ) == DELETED_BOARD_ITEM::GetInstance() )
|
PCB_MARKER* marker = PCB_MARKER::Deserialize( exclusionData );
|
||||||
|
|
||||||
|
if( !marker )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Check to see if items still exist
|
||||||
|
for( const KIID& guid : marker->GetRCItem()->GetIDs() )
|
||||||
{
|
{
|
||||||
delete marker;
|
if( GetItem( guid ) == DELETED_BOARD_ITEM::GetInstance() )
|
||||||
marker = nullptr;
|
{
|
||||||
break;
|
delete marker;
|
||||||
|
marker = nullptr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if( marker )
|
if( marker )
|
||||||
{
|
{
|
||||||
marker->SetExcluded( true );
|
marker->SetExcluded( true );
|
||||||
newMarkers.push_back( marker );
|
newMarkers.push_back( marker );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -460,8 +460,12 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rebuild DRC markers from the serialized data in BOARD_DESIGN_SETTINGS.
|
* Rebuild DRC markers from the serialized data in BOARD_DESIGN_SETTINGS.
|
||||||
|
*
|
||||||
|
* @param aCreateMarkers if true, create markers from serialized data; if false only
|
||||||
|
* use serialized data to set existing markers to excluded.
|
||||||
|
* The former is used on board load; the later after a DRC.
|
||||||
*/
|
*/
|
||||||
std::vector<PCB_MARKER*> ResolveDRCExclusions();
|
std::vector<PCB_MARKER*> ResolveDRCExclusions( bool aCreateMarkers );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the visibility flags on the current unconnected ratsnest lines.
|
* Update the visibility flags on the current unconnected ratsnest lines.
|
||||||
|
|
|
@ -826,7 +826,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
||||||
|
|
||||||
// we should not ask PLUGINs to do these items:
|
// we should not ask PLUGINs to do these items:
|
||||||
loadedBoard->BuildListOfNets();
|
loadedBoard->BuildListOfNets();
|
||||||
ResolveDRCExclusions();
|
ResolveDRCExclusions( true );
|
||||||
m_toolManager->RunAction( PCB_ACTIONS::repairBoard, true, true);
|
m_toolManager->RunAction( PCB_ACTIONS::repairBoard, true, true);
|
||||||
|
|
||||||
if( loadedBoard->IsModified() )
|
if( loadedBoard->IsModified() )
|
||||||
|
|
|
@ -984,11 +984,11 @@ void PCB_EDIT_FRAME::RecordDRCExclusions()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_EDIT_FRAME::ResolveDRCExclusions()
|
void PCB_EDIT_FRAME::ResolveDRCExclusions( bool aCreateMarkers )
|
||||||
{
|
{
|
||||||
BOARD_COMMIT commit( this );
|
BOARD_COMMIT commit( this );
|
||||||
|
|
||||||
for( PCB_MARKER* marker : GetBoard()->ResolveDRCExclusions() )
|
for( PCB_MARKER* marker : GetBoard()->ResolveDRCExclusions( aCreateMarkers ) )
|
||||||
{
|
{
|
||||||
if( marker->GetMarkerType() == MARKER_BASE::MARKER_DRAWING_SHEET )
|
if( marker->GetMarkerType() == MARKER_BASE::MARKER_DRAWING_SHEET )
|
||||||
marker->GetRCItem()->SetItems( GetCanvas()->GetDrawingSheet() );
|
marker->GetRCItem()->SetItems( GetCanvas()->GetDrawingSheet() );
|
||||||
|
|
|
@ -238,9 +238,10 @@ public:
|
||||||
void RecordDRCExclusions();
|
void RecordDRCExclusions();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update markers to match recorded exclusions.
|
* If aCreateMarkers then create DRC exclusion markers from the serialized data. If false,
|
||||||
|
* then use the serialized data to set exclusion flags on existing markers.
|
||||||
*/
|
*/
|
||||||
void ResolveDRCExclusions();
|
void ResolveDRCExclusions( bool aCreateMarkers );
|
||||||
|
|
||||||
void Process_Special_Functions( wxCommandEvent& event );
|
void Process_Special_Functions( wxCommandEvent& event );
|
||||||
void Tracks_and_Vias_Size_Event( wxCommandEvent& event );
|
void Tracks_and_Vias_Size_Event( wxCommandEvent& event );
|
||||||
|
|
|
@ -183,7 +183,7 @@ BOARD* LoadBoard( wxString& aFileName, IO_MGR::PCB_FILE_T aFormat )
|
||||||
// Best efforts...
|
// Best efforts...
|
||||||
}
|
}
|
||||||
|
|
||||||
for( PCB_MARKER* marker : brd->ResolveDRCExclusions() )
|
for( PCB_MARKER* marker : brd->ResolveDRCExclusions( true ) )
|
||||||
brd->Add( marker );
|
brd->Add( marker );
|
||||||
|
|
||||||
brd->BuildConnectivity();
|
brd->BuildConnectivity();
|
||||||
|
|
|
@ -206,7 +206,7 @@ void DRC_TOOL::updatePointers()
|
||||||
// update my pointers, m_editFrame is the only unchangeable one
|
// update my pointers, m_editFrame is the only unchangeable one
|
||||||
m_pcb = m_editFrame->GetBoard();
|
m_pcb = m_editFrame->GetBoard();
|
||||||
|
|
||||||
m_editFrame->ResolveDRCExclusions();
|
m_editFrame->ResolveDRCExclusions( false );
|
||||||
|
|
||||||
if( m_drcDialog )
|
if( m_drcDialog )
|
||||||
m_drcDialog->UpdateData();
|
m_drcDialog->UpdateData();
|
||||||
|
|
Loading…
Reference in New Issue