Don't run courtyard conflicts in footprint editor.

This commit is contained in:
Jeff Young 2022-06-20 21:15:06 +01:00
parent 426c46abb1
commit 23e8bafd9c
1 changed files with 12 additions and 7 deletions

View File

@ -304,6 +304,7 @@ int EDIT_TOOL::MoveWithReference( const TOOL_EVENT& aEvent )
int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference ) int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
{ {
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>(); PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
BOARD* board = editFrame->GetBoard();
KIGFX::VIEW_CONTROLS* controls = getViewControls(); KIGFX::VIEW_CONTROLS* controls = getViewControls();
VECTOR2I originalCursorPos = controls->GetCursorPosition(); VECTOR2I originalCursorPos = controls->GetCursorPosition();
@ -317,7 +318,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
}, },
// Prompt user regarding locked items if in board editor and in free-pad-mode (if // Prompt user regarding locked items if in board editor and in free-pad-mode (if
// we're not in free-pad mode we delay this until the second RequestSelection()). // we're not in free-pad mode we delay this until the second RequestSelection()).
frame()->Settings().m_AllowFreePads && !m_isFootprintEditor ); editFrame->Settings().m_AllowFreePads && !m_isFootprintEditor );
if( m_dragging || selection.Empty() ) if( m_dragging || selection.Empty() )
return 0; return 0;
@ -329,7 +330,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
// Now filter out pads if not in free pads mode. We cannot do this in the first // Now filter out pads if not in free pads mode. We cannot do this in the first
// RequestSelection() as we need the item_layers when a pad is the selection front. // RequestSelection() as we need the item_layers when a pad is the selection front.
if( !m_isFootprintEditor && !frame()->Settings().m_AllowFreePads ) if( !m_isFootprintEditor && !editFrame->Settings().m_AllowFreePads )
{ {
selection = m_selectionTool->RequestSelection( selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool ) []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
@ -401,12 +402,17 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
bool hasRedrawn3D = false; bool hasRedrawn3D = false;
bool allowRedraw3D = editFrame->Settings().m_Display.m_Live3DRefresh; bool allowRedraw3D = editFrame->Settings().m_Display.m_Live3DRefresh;
// Courtyard conflicts will be tested only if the LAYER_CONFLICTS_SHADOW gal layer is visible // Courtyard conflicts will be tested only if the LAYER_CONFLICTS_SHADOW gal layer is visible
bool showCourtyardConflicts = editFrame->GetBoard()->IsElementVisible( LAYER_CONFLICTS_SHADOW ); bool showCourtyardConflicts = !m_isFootprintEditor
&& board->IsElementVisible( LAYER_CONFLICTS_SHADOW );
// Used to test courtyard overlaps // Used to test courtyard overlaps
DRC_TEST_PROVIDER_COURTYARD_CLEARANCE_ON_MOVE drc_on_move; DRC_TEST_PROVIDER_COURTYARD_CLEARANCE_ON_MOVE drc_on_move;
drc_on_move.Init( editFrame->GetBoard() );
drc_on_move.SetDRCEngine( m_toolMgr->GetTool<DRC_TOOL>()->GetDRCEngine().get() ); if( showCourtyardConflicts )
{
drc_on_move.Init( board );
drc_on_move.SetDRCEngine( m_toolMgr->GetTool<DRC_TOOL>()->GetDRCEngine().get() );
}
// Prime the pump // Prime the pump
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->RunAction( ACTIONS::refreshPreview );
@ -632,8 +638,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified ); m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
} }
m_toolMgr->RunAction( PCB_ACTIONS::updateLocalRatsnest, false, m_toolMgr->RunAction( PCB_ACTIONS::updateLocalRatsnest, false, new VECTOR2I( movement ) );
new VECTOR2I( movement ) );
} }
else if( evt->IsCancelInteractive() || evt->IsActivate() ) else if( evt->IsCancelInteractive() || evt->IsActivate() )
{ {