Clean up a confusing API.
AllowDRCViolations is kept in any mode as a *setting*, but only controls router behaviour when the mode is mark obstacles. Fixes https://gitlab.com/kicad/code/kicad/issues/7795
This commit is contained in:
parent
176fcd43d8
commit
dc0cf3b802
|
@ -44,7 +44,7 @@ DIALOG_PNS_SETTINGS::DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS::ROUTING_SETTIN
|
|||
m_smartPads->SetValue( m_settings.SmartPads() );
|
||||
m_effort->SetValue( m_settings.OptimizerEffort() );
|
||||
m_smoothDragged->SetValue( m_settings.SmoothDraggedSegments() );
|
||||
m_violateDrc->SetValue( m_settings.CanViolateDRC() );
|
||||
m_violateDrc->SetValue( m_settings.GetAllowDRCViolationsSetting() );
|
||||
m_freeAngleMode->SetValue( m_settings.GetFreeAngleMode() );
|
||||
m_dragToolMode->SetSelection ( m_settings.InlineDragEnabled() ? 1 : 0 );
|
||||
m_optimizeDraggedTrack->SetValue( m_settings.GetOptimizeDraggedTrack() );
|
||||
|
@ -83,7 +83,7 @@ void DIALOG_PNS_SETTINGS::OnOkClick( wxCommandEvent& aEvent )
|
|||
|
||||
if( m_mode->GetSelection() == PNS::RM_MarkObstacles )
|
||||
{
|
||||
m_settings.SetCanViolateDRC( m_violateDrc->GetValue() );
|
||||
m_settings.SetAllowDRCViolations( m_violateDrc->GetValue() );
|
||||
m_settings.SetFreeAngleMode( m_freeAngleMode->GetValue() );
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ void DIALOG_PNS_SETTINGS::onModeChange( wxCommandEvent& aEvent )
|
|||
m_freeAngleMode->SetValue( m_settings.GetFreeAngleMode() );
|
||||
m_freeAngleMode->Enable();
|
||||
|
||||
m_violateDrc->SetValue( m_settings.CanViolateDRC() );
|
||||
m_violateDrc->SetValue( m_settings.GetAllowDRCViolationsSetting() );
|
||||
m_violateDrc->Enable();
|
||||
}
|
||||
else
|
||||
|
@ -110,7 +110,7 @@ void DIALOG_PNS_SETTINGS::onModeChange( wxCommandEvent& aEvent )
|
|||
m_freeAngleMode->Enable( false );
|
||||
|
||||
if( m_violateDrc->IsEnabled() )
|
||||
m_settings.SetCanViolateDRC( m_violateDrc->GetValue() );
|
||||
m_settings.SetAllowDRCViolations( m_violateDrc->GetValue() );
|
||||
|
||||
m_violateDrc->SetValue( false );
|
||||
m_violateDrc->Enable( false );
|
||||
|
|
|
@ -163,7 +163,8 @@ bool COMPONENT_DRAGGER::FixRoute()
|
|||
if( node )
|
||||
{
|
||||
bool ok;
|
||||
if( Settings().CanViolateDRC() )
|
||||
|
||||
if( Settings().AllowDRCViolations() )
|
||||
ok = true;
|
||||
else
|
||||
ok = !node->CheckColliding( m_draggedItems );
|
||||
|
|
|
@ -713,11 +713,10 @@ void DIFF_PAIR_PLACER::UpdateSizes( const SIZES_SETTINGS& aSizes )
|
|||
|
||||
bool DIFF_PAIR_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinish )
|
||||
{
|
||||
if( !m_fitOk && !Settings().CanViolateDRC() )
|
||||
if( !m_fitOk && !Settings().AllowDRCViolations() )
|
||||
return false;
|
||||
|
||||
if( m_currentTrace.CP().SegmentCount() < 1 ||
|
||||
m_currentTrace.CN().SegmentCount() < 1 )
|
||||
if( m_currentTrace.CP().SegmentCount() < 1 || m_currentTrace.CN().SegmentCount() < 1 )
|
||||
return false;
|
||||
|
||||
if( m_currentTrace.CP().SegmentCount() > 1 )
|
||||
|
|
|
@ -256,7 +256,7 @@ bool DRAGGER::dragMarkObstacles( const VECTOR2I& aP )
|
|||
}
|
||||
}
|
||||
|
||||
if( Settings().CanViolateDRC() )
|
||||
if( Settings().AllowDRCViolations() )
|
||||
m_dragStatus = true;
|
||||
else
|
||||
m_dragStatus = !m_world->CheckColliding( m_draggedItems );
|
||||
|
@ -619,7 +619,7 @@ bool DRAGGER::FixRoute()
|
|||
return false;
|
||||
}
|
||||
|
||||
if( !m_dragStatus && !Settings().CanViolateDRC() )
|
||||
if( !m_dragStatus && !Settings().AllowDRCViolations() )
|
||||
return false;
|
||||
|
||||
Router()->CommitRouting( node );
|
||||
|
|
|
@ -520,7 +520,7 @@ bool LINE_PLACER::rhMarkObstacles( const VECTOR2I& aP, LINE& aNewHead )
|
|||
m_head.SetBlockingObstacle( nullptr );
|
||||
|
||||
// If we are enforcing DRC violations, push back to the hull
|
||||
if( !Settings().CanViolateDRC() )
|
||||
if( !Settings().AllowDRCViolations() )
|
||||
{
|
||||
NODE::OPT_OBSTACLE obs = m_currentNode->NearestObstacle( &m_head );
|
||||
|
||||
|
@ -1048,7 +1048,7 @@ bool LINE_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinis
|
|||
}
|
||||
|
||||
// Collisions still prevent fixing unless "Allow DRC violations" is checked
|
||||
if( !Settings().CanViolateDRC() && m_world->CheckColliding( &pl ) )
|
||||
if( !Settings().AllowDRCViolations() && m_world->CheckColliding( &pl ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ bool ROUTER::StartDragging( const VECTOR2I& aP, ITEM_SET aStartItems, int aDragM
|
|||
|
||||
bool ROUTER::isStartingPointRoutable( const VECTOR2I& aWhere, ITEM* aStartItem, int aLayer )
|
||||
{
|
||||
if( Settings().CanViolateDRC() && Settings().Mode() == RM_MarkObstacles )
|
||||
if( Settings().AllowDRCViolations() )
|
||||
return true;
|
||||
|
||||
if( m_mode == PNS_MODE_ROUTE_DIFF_PAIR )
|
||||
|
|
|
@ -45,7 +45,7 @@ ROUTING_SETTINGS::ROUTING_SETTINGS( JSON_SETTINGS* aParent, const std::string& a
|
|||
m_walkaroundIterationLimit = 40;
|
||||
m_jumpOverObstacles = false;
|
||||
m_smoothDraggedSegments = true;
|
||||
m_canViolateDRC = false;
|
||||
m_allowDRCViolations = false;
|
||||
m_freeAngleMode = false;
|
||||
m_inlineDragEnabled = false;
|
||||
m_snapToTracks = false;
|
||||
|
@ -85,7 +85,7 @@ ROUTING_SETTINGS::ROUTING_SETTINGS( JSON_SETTINGS* aParent, const std::string& a
|
|||
|
||||
m_params.emplace_back( new PARAM<bool>( "smooth_dragged_segments", &m_smoothDraggedSegments, true ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "can_violate_drc", &m_canViolateDRC, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "can_violate_drc", &m_allowDRCViolations, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "free_angle_mode", &m_freeAngleMode, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "inline_drag", &m_inlineDragEnabled, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "snap_to_tracks", &m_snapToTracks, false ) );
|
||||
|
|
|
@ -119,17 +119,17 @@ public:
|
|||
|
||||
///< Return true if jumping over unmovable obstacles is on.
|
||||
bool JumpOverObstacles() const { return m_jumpOverObstacles; }
|
||||
|
||||
///< Enable/disable jumping over unmovable obstacles.
|
||||
void SetJumpOverObstacles( bool aJumpOverObstacles )
|
||||
{
|
||||
m_jumpOverObstacles = aJumpOverObstacles;
|
||||
}
|
||||
void SetJumpOverObstacles( bool aJump ) { m_jumpOverObstacles = aJump; }
|
||||
|
||||
void SetStartDiagonal( bool aStartDiagonal ) { m_startDiagonal = aStartDiagonal; }
|
||||
|
||||
bool CanViolateDRC() const { return m_canViolateDRC; }
|
||||
void SetCanViolateDRC( bool aViolate ) { m_canViolateDRC = aViolate; }
|
||||
bool AllowDRCViolations() const
|
||||
{
|
||||
return m_routingMode == PNS_MODE::RM_MarkObstacles && m_allowDRCViolations;
|
||||
}
|
||||
|
||||
bool GetAllowDRCViolationsSetting() const { return m_allowDRCViolations; }
|
||||
void SetAllowDRCViolations( bool aViolate ) { m_allowDRCViolations = aViolate; }
|
||||
|
||||
bool GetFreeAngleMode() const { return m_freeAngleMode; }
|
||||
|
||||
|
@ -173,7 +173,7 @@ private:
|
|||
bool m_followMouse;
|
||||
bool m_jumpOverObstacles;
|
||||
bool m_smoothDraggedSegments;
|
||||
bool m_canViolateDRC;
|
||||
bool m_allowDRCViolations;
|
||||
bool m_freeAngleMode;
|
||||
bool m_inlineDragEnabled;
|
||||
bool m_snapToTracks;
|
||||
|
|
|
@ -2218,10 +2218,9 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
|
|||
m_worstClearance( 0 ),
|
||||
m_flaggedDRC( false )
|
||||
{
|
||||
ROUTER_TOOL* router = m_frame->GetToolManager()->GetTool<ROUTER_TOOL>();
|
||||
PNS::ROUTING_SETTINGS& cfg = router->Router()->Settings();
|
||||
ROUTER_TOOL* router = m_frame->GetToolManager()->GetTool<ROUTER_TOOL>();
|
||||
|
||||
m_allowDRCViolations = cfg.Mode() == PNS::RM_MarkObstacles && cfg.CanViolateDRC();
|
||||
m_allowDRCViolations = router->Router()->Settings().AllowDRCViolations();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue