From b12937af651ace351e12afe17d32c5df12d0c0c8 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 19 Oct 2020 12:47:14 +0100 Subject: [PATCH] Accurately reflect disabled router settings. Fixes https://gitlab.com/kicad/code/kicad/issues/5999 --- pcbnew/dialogs/dialog_pns_settings.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/pcbnew/dialogs/dialog_pns_settings.cpp b/pcbnew/dialogs/dialog_pns_settings.cpp index 3fbb23d433..7fd41cb93e 100644 --- a/pcbnew/dialogs/dialog_pns_settings.cpp +++ b/pcbnew/dialogs/dialog_pns_settings.cpp @@ -73,11 +73,15 @@ void DIALOG_PNS_SETTINGS::OnOkClick( wxCommandEvent& aEvent ) m_settings.SetSmartPads( m_smartPads->GetValue() ); m_settings.SetOptimizerEffort( (PNS::PNS_OPTIMIZATION_EFFORT) m_effort->GetValue() ); m_settings.SetSmoothDraggedSegments( m_smoothDragged->GetValue() ); - m_settings.SetCanViolateDRC( m_violateDrc->GetValue() ); - m_settings.SetFreeAngleMode( m_freeAngleMode->GetValue() ); m_settings.SetInlineDragEnabled( m_dragToolMode->GetSelection () ? true : false ); m_settings.SetOptimizeDraggedTrack( m_optimizeDraggedTrack->GetValue() ); + if( m_mode->GetSelection() == PNS::RM_MarkObstacles ) + { + m_settings.SetCanViolateDRC( m_violateDrc->GetValue() ); + m_settings.SetFreeAngleMode( m_freeAngleMode->GetValue() ); + } + aEvent.Skip(); // ends returning wxID_OK (default behavior) } @@ -86,12 +90,24 @@ void DIALOG_PNS_SETTINGS::onModeChange( wxCommandEvent& aEvent ) { if( m_mode->GetSelection() == PNS::RM_MarkObstacles ) { + m_freeAngleMode->SetValue( m_settings.GetFreeAngleMode() ); m_freeAngleMode->Enable(); + + m_violateDrc->SetValue( m_settings.CanViolateDRC() ); m_violateDrc->Enable(); } else { + if( m_freeAngleMode->IsEnabled() ) + m_settings.SetFreeAngleMode( m_freeAngleMode->GetValue() ); + + m_freeAngleMode->SetValue( false ); m_freeAngleMode->Enable( false ); + + if( m_violateDrc->IsEnabled() ) + m_settings.SetCanViolateDRC( m_violateDrc->GetValue() ); + + m_violateDrc->SetValue( false ); m_violateDrc->Enable( false ); } }