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_effort->SetValue( m_settings.OptimizerEffort() );
|
|
|
|
m_smoothDragged->SetValue( m_settings.SmoothDraggedSegments() );
|
|
|
|
m_violateDrc->SetValue( m_settings.CanViolateDRC() );
|
2015-07-02 14:09:51 +00:00
|
|
|
m_freeAngleMode->SetValue( m_settings.GetFreeAngleMode() );
|
2015-07-02 14:10:54 +00:00
|
|
|
m_dragToolMode->SetSelection ( m_settings.InlineDragEnabled() ? 1 : 0 );
|
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() );
|
2016-08-29 14:38:11 +00:00
|
|
|
m_settings.SetOptimizerEffort( (PNS::PNS_OPTIMIZATION_EFFORT) m_effort->GetValue() );
|
2014-05-14 13:53:54 +00:00
|
|
|
m_settings.SetSmoothDraggedSegments( m_smoothDragged->GetValue() );
|
|
|
|
m_settings.SetCanViolateDRC( m_violateDrc->GetValue() );
|
2015-07-02 14:09:51 +00:00
|
|
|
m_settings.SetFreeAngleMode( m_freeAngleMode->GetValue() );
|
2015-07-02 14:10:54 +00:00
|
|
|
m_settings.SetInlineDragEnabled( m_dragToolMode->GetSelection () ? true : false );
|
2014-05-14 13:53:54 +00:00
|
|
|
|
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
|
|
|
{
|
2018-06-19 04:41:10 +00:00
|
|
|
m_freeAngleMode->Enable();
|
2019-02-23 16:10:21 +00:00
|
|
|
m_violateDrc->Enable();
|
|
|
|
}
|
2018-06-19 04:41:10 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
m_freeAngleMode->Enable( false );
|
2019-02-23 16:10:21 +00:00
|
|
|
m_violateDrc->Enable( false );
|
2018-06-19 04:41:10 +00:00
|
|
|
}
|
|
|
|
}
|