No DRC engine in footprint editor.

Fixes https://gitlab.com/kicad/code/kicad/issues/12658
This commit is contained in:
Jeff Young 2022-10-16 18:37:19 +01:00
parent 631980b0ab
commit e9f8454a67
1 changed files with 13 additions and 9 deletions

View File

@ -431,11 +431,14 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, bool aPickReference )
&& board->IsElementVisible( LAYER_CONFLICTS_SHADOW ); && board->IsElementVisible( LAYER_CONFLICTS_SHADOW );
// Used to test courtyard overlaps // Used to test courtyard overlaps
std::shared_ptr<DRC_ENGINE> drcEngine = m_toolMgr->GetTool<DRC_TOOL>()->GetDRCEngine(); std::unique_ptr<DRC_INTERACTIVE_COURTYARD_CLEARANCE> drc_on_move = nullptr;
DRC_INTERACTIVE_COURTYARD_CLEARANCE drc_on_move( drcEngine );
if( showCourtyardConflicts ) if( showCourtyardConflicts )
drc_on_move.Init( board ); {
std::shared_ptr<DRC_ENGINE> drcEngine = m_toolMgr->GetTool<DRC_TOOL>()->GetDRCEngine();
drc_on_move.reset( new DRC_INTERACTIVE_COURTYARD_CLEARANCE( drcEngine ) );
drc_on_move->Init( board );
}
displayConstraintsMessage( hv45Mode ); displayConstraintsMessage( hv45Mode );
@ -538,10 +541,10 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, bool aPickReference )
hasRedrawn3D = true; hasRedrawn3D = true;
} }
if( showCourtyardConflicts && drc_on_move.m_FpInMove.size() ) if( showCourtyardConflicts && drc_on_move->m_FpInMove.size() )
{ {
drc_on_move.Run(); drc_on_move->Run();
drc_on_move.UpdateConflicts( m_toolMgr->GetView(), true ); drc_on_move->UpdateConflicts( m_toolMgr->GetView(), true );
} }
m_toolMgr->PostEvent( EVENTS::SelectedItemsMoved ); m_toolMgr->PostEvent( EVENTS::SelectedItemsMoved );
@ -628,8 +631,8 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, bool aPickReference )
{ {
items.push_back( static_cast<BOARD_ITEM*>( item ) ); items.push_back( static_cast<BOARD_ITEM*>( item ) );
if( item->Type() == PCB_FOOTPRINT_T ) if( showCourtyardConflicts && item->Type() == PCB_FOOTPRINT_T )
drc_on_move.m_FpInMove.push_back( static_cast<FOOTPRINT*>( item ) ); drc_on_move->m_FpInMove.push_back( static_cast<FOOTPRINT*>( item ) );
} }
m_cursor = grid.BestDragOrigin( originalCursorPos, items ); m_cursor = grid.BestDragOrigin( originalCursorPos, items );
@ -737,7 +740,8 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, bool aPickReference )
} while( ( evt = Wait() ) ); // Assignment (instead of equality test) is intentional } while( ( evt = Wait() ) ); // Assignment (instead of equality test) is intentional
// Clear temporary COURTYARD_CONFLICT flag and ensure the conflict shadow is cleared // Clear temporary COURTYARD_CONFLICT flag and ensure the conflict shadow is cleared
drc_on_move.ClearConflicts( m_toolMgr->GetView() ); if( showCourtyardConflicts )
drc_on_move->ClearConflicts( m_toolMgr->GetView() );
controls->ForceCursorPosition( false ); controls->ForceCursorPosition( false );
controls->ShowCursor( false ); controls->ShowCursor( false );