2014-05-14 13:53:54 +00:00
|
|
|
/*
|
|
|
|
* KiRouter - a push-and-(sometimes-)shove PCB router
|
|
|
|
*
|
|
|
|
* Copyright (C) 2014 CERN
|
2016-08-29 14:38:11 +00:00
|
|
|
* Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
|
2014-05-14 13:53:54 +00:00
|
|
|
* Author: Maciej Suminski <maciej.suminski@cern.ch>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
* option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.or/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Push and Shove router settings dialog.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "dialog_pns_settings.h"
|
|
|
|
#include <router/pns_routing_settings.h>
|
|
|
|
|
2016-08-29 17:31:13 +00:00
|
|
|
DIALOG_PNS_SETTINGS::DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS::ROUTING_SETTINGS& aSettings ) :
|
2014-05-14 13:53:54 +00:00
|
|
|
DIALOG_PNS_SETTINGS_BASE( aParent ), m_settings( aSettings )
|
|
|
|
{
|
2015-10-16 15:56:50 +00:00
|
|
|
// Add tool tip to the mode radio box, one by option
|
|
|
|
// (cannot be made with wxFormBuilder for each item )
|
|
|
|
m_mode->SetItemToolTip( 0, _( "DRC violation: highlight obstacles" ) );
|
|
|
|
m_mode->SetItemToolTip( 1, _( "DRC violation: shove tracks and vias" ) );
|
|
|
|
m_mode->SetItemToolTip( 2, _( "DRC violation: walk around obstacles" ) );
|
|
|
|
|
2014-05-14 13:53:54 +00:00
|
|
|
// Load widgets' values from settings
|
|
|
|
m_mode->SetSelection( m_settings.Mode() );
|
|
|
|
m_shoveVias->SetValue( m_settings.ShoveVias() );
|
|
|
|
m_backPressure->SetValue( m_settings.JumpOverObstacles() );
|
|
|
|
m_removeLoops->SetValue( m_settings.RemoveLoops() );
|
|
|
|
m_suggestEnding->SetValue( m_settings.SuggestFinish() );
|
2018-02-15 15:09:39 +00:00
|
|
|
m_smartPads->SetValue( m_settings.SmartPads() );
|
2014-05-14 13:53:54 +00:00
|
|
|
m_smoothDragged->SetValue( m_settings.SmoothDraggedSegments() );
|
2021-04-10 09:31:42 +00:00
|
|
|
m_violateDrc->SetValue( m_settings.GetAllowDRCViolationsSetting() );
|
2015-07-02 14:09:51 +00:00
|
|
|
m_freeAngleMode->SetValue( m_settings.GetFreeAngleMode() );
|
2021-04-10 19:17:29 +00:00
|
|
|
m_optimizeEntireDraggedTrack->SetValue( m_settings.GetOptimizeEntireDraggedTrack() );
|
2020-12-23 22:02:29 +00:00
|
|
|
m_autoPosture->SetValue( m_settings.GetAutoPosture() );
|
2020-12-24 02:55:43 +00:00
|
|
|
m_fixAllSegments->SetValue( m_settings.GetFixAllSegments() );
|
2020-12-23 22:02:29 +00:00
|
|
|
|
2019-02-25 10:34:32 +00:00
|
|
|
// Enable/disable some options
|
|
|
|
wxCommandEvent event;
|
|
|
|
onModeChange( event );
|
2015-02-06 10:54:55 +00:00
|
|
|
|
2018-06-19 04:41:10 +00:00
|
|
|
// Don't show options that are not implemented
|
|
|
|
m_suggestEnding->Hide();
|
|
|
|
m_shoveVias->Hide();
|
|
|
|
|
2015-06-04 12:21:30 +00:00
|
|
|
SetDefaultItem( m_stdButtonsOK );
|
2015-02-06 10:54:55 +00:00
|
|
|
GetSizer()->Fit( this );
|
|
|
|
GetSizer()->SetSizeHints( this );
|
2014-05-14 13:53:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_PNS_SETTINGS::OnOkClick( wxCommandEvent& aEvent )
|
|
|
|
{
|
|
|
|
// Save widgets' values to settings
|
2016-08-29 14:38:11 +00:00
|
|
|
m_settings.SetMode( (PNS::PNS_MODE) m_mode->GetSelection() );
|
2014-05-14 13:53:54 +00:00
|
|
|
m_settings.SetShoveVias( m_shoveVias->GetValue() );
|
|
|
|
m_settings.SetJumpOverObstacles( m_backPressure->GetValue() );
|
|
|
|
m_settings.SetRemoveLoops( m_removeLoops->GetValue() );
|
|
|
|
m_settings.SetSuggestFinish ( m_suggestEnding->GetValue() );
|
2018-02-15 15:09:39 +00:00
|
|
|
m_settings.SetSmartPads( m_smartPads->GetValue() );
|
2014-05-14 13:53:54 +00:00
|
|
|
m_settings.SetSmoothDraggedSegments( m_smoothDragged->GetValue() );
|
2021-04-10 19:17:29 +00:00
|
|
|
m_settings.SetOptimizeEntireDraggedTrack( m_optimizeEntireDraggedTrack->GetValue() );
|
2020-12-23 22:02:29 +00:00
|
|
|
m_settings.SetAutoPosture( m_autoPosture->GetValue() );
|
2020-12-24 02:55:43 +00:00
|
|
|
m_settings.SetFixAllSegments( m_fixAllSegments->GetValue() );
|
2020-02-26 00:36:36 +00:00
|
|
|
|
2020-10-19 11:47:14 +00:00
|
|
|
if( m_mode->GetSelection() == PNS::RM_MarkObstacles )
|
|
|
|
{
|
2021-04-10 09:31:42 +00:00
|
|
|
m_settings.SetAllowDRCViolations( m_violateDrc->GetValue() );
|
2020-10-19 11:47:14 +00:00
|
|
|
m_settings.SetFreeAngleMode( m_freeAngleMode->GetValue() );
|
|
|
|
}
|
|
|
|
|
2015-10-16 15:56:50 +00:00
|
|
|
aEvent.Skip(); // ends returning wxID_OK (default behavior)
|
2014-05-14 13:53:54 +00:00
|
|
|
}
|
2018-06-19 04:41:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_PNS_SETTINGS::onModeChange( wxCommandEvent& aEvent )
|
|
|
|
{
|
|
|
|
if( m_mode->GetSelection() == PNS::RM_MarkObstacles )
|
2019-02-23 16:10:21 +00:00
|
|
|
{
|
2020-10-19 11:47:14 +00:00
|
|
|
m_freeAngleMode->SetValue( m_settings.GetFreeAngleMode() );
|
2018-06-19 04:41:10 +00:00
|
|
|
m_freeAngleMode->Enable();
|
2020-10-19 11:47:14 +00:00
|
|
|
|
2021-04-10 09:31:42 +00:00
|
|
|
m_violateDrc->SetValue( m_settings.GetAllowDRCViolationsSetting() );
|
2019-02-23 16:10:21 +00:00
|
|
|
m_violateDrc->Enable();
|
|
|
|
}
|
2018-06-19 04:41:10 +00:00
|
|
|
else
|
|
|
|
{
|
2020-10-19 11:47:14 +00:00
|
|
|
if( m_freeAngleMode->IsEnabled() )
|
|
|
|
m_settings.SetFreeAngleMode( m_freeAngleMode->GetValue() );
|
|
|
|
|
|
|
|
m_freeAngleMode->SetValue( false );
|
2018-06-19 04:41:10 +00:00
|
|
|
m_freeAngleMode->Enable( false );
|
2020-10-19 11:47:14 +00:00
|
|
|
|
|
|
|
if( m_violateDrc->IsEnabled() )
|
2021-04-10 09:31:42 +00:00
|
|
|
m_settings.SetAllowDRCViolations( m_violateDrc->GetValue() );
|
2020-10-19 11:47:14 +00:00
|
|
|
|
|
|
|
m_violateDrc->SetValue( false );
|
2019-02-23 16:10:21 +00:00
|
|
|
m_violateDrc->Enable( false );
|
2018-06-19 04:41:10 +00:00
|
|
|
}
|
|
|
|
}
|