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 ) :
|
2023-07-17 12:57:48 +00:00
|
|
|
DIALOG_PNS_SETTINGS_BASE( aParent ),
|
|
|
|
m_settings( aSettings )
|
2014-05-14 13:53:54 +00:00
|
|
|
{
|
|
|
|
// Load widgets' values from settings
|
2023-07-17 12:57:48 +00:00
|
|
|
switch( m_settings.Mode() )
|
|
|
|
{
|
|
|
|
case PNS::RM_MarkObstacles: m_rbMarkObstacles->SetValue( true ); break;
|
|
|
|
case PNS::RM_Shove: m_rbShove->SetValue( true ); break;
|
|
|
|
case PNS::RM_Walkaround: m_rbWalkaround->SetValue( true ); break;
|
|
|
|
}
|
|
|
|
|
2014-05-14 13:53:54 +00:00
|
|
|
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();
|
|
|
|
|
2022-12-29 15:31:12 +00:00
|
|
|
SetupStandardButtons();
|
|
|
|
|
|
|
|
finishDialogSettings();
|
2014-05-14 13:53:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-12-29 15:31:12 +00:00
|
|
|
bool DIALOG_PNS_SETTINGS::TransferDataFromWindow()
|
2014-05-14 13:53:54 +00:00
|
|
|
{
|
|
|
|
// Save widgets' values to settings
|
2023-07-17 12:57:48 +00:00
|
|
|
if ( m_rbMarkObstacles->GetValue() ) m_settings.SetMode( PNS::RM_MarkObstacles );
|
|
|
|
else if( m_rbShove->GetValue() ) m_settings.SetMode( PNS::RM_Shove );
|
|
|
|
else if( m_rbWalkaround->GetValue() ) m_settings.SetMode( PNS::RM_Walkaround );
|
|
|
|
|
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() );
|
2023-07-17 12:57:48 +00:00
|
|
|
m_settings.SetAllowDRCViolations( m_violateDrc->GetValue() );
|
|
|
|
m_settings.SetFreeAngleMode( m_freeAngleMode->GetValue() );
|
2020-10-19 11:47:14 +00:00
|
|
|
|
2022-12-29 15:31:12 +00:00
|
|
|
return true;
|
2014-05-14 13:53:54 +00:00
|
|
|
}
|
2018-06-19 04:41:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_PNS_SETTINGS::onModeChange( wxCommandEvent& aEvent )
|
|
|
|
{
|
2023-07-17 12:57:48 +00:00
|
|
|
m_freeAngleMode->Enable( m_rbMarkObstacles->GetValue() );
|
|
|
|
m_violateDrc->Enable( m_rbMarkObstacles->GetValue() );
|
2020-10-19 11:47:14 +00:00
|
|
|
|
2023-07-17 12:57:48 +00:00
|
|
|
m_shoveVias->Enable( m_rbShove->GetValue() );
|
|
|
|
m_backPressure->Enable( m_rbShove->GetValue() );
|
2018-06-19 04:41:10 +00:00
|
|
|
}
|