KiCad PCB EDA Suite
dialog_pns_settings.cpp
Go to the documentation of this file.
1 /*
2  * KiRouter - a push-and-(sometimes-)shove PCB router
3  *
4  * Copyright (C) 2014 CERN
5  * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
6  * Author: Maciej Suminski <maciej.suminski@cern.ch>
7  *
8  * This program is free software: you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation, either version 3 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.or/licenses/>.
20  */
21 
26 #include "dialog_pns_settings.h"
28 
30  DIALOG_PNS_SETTINGS_BASE( aParent ), m_settings( aSettings )
31 {
32  // "Figure out what's best" is not available yet
33  m_mode->Enable( PNS::RM_Smart, false );
34 
35  // Add tool tip to the mode radio box, one by option
36  // (cannot be made with wxFormBuilder for each item )
37  m_mode->SetItemToolTip( 0, _( "DRC violation: highlight obstacles" ) );
38  m_mode->SetItemToolTip( 1, _( "DRC violation: shove tracks and vias" ) );
39  m_mode->SetItemToolTip( 2, _( "DRC violation: walk around obstacles" ) );
40 
41  // Load widgets' values from settings
42  m_mode->SetSelection( m_settings.Mode() );
43  m_shoveVias->SetValue( m_settings.ShoveVias() );
45  m_removeLoops->SetValue( m_settings.RemoveLoops() );
47  m_autoNeckdown->SetValue( m_settings.SmartPads() );
48  m_effort->SetValue( m_settings.OptimizerEffort() );
50  m_violateDrc->SetValue( m_settings.CanViolateDRC() );
52  m_dragToolMode->SetSelection ( m_settings.InlineDragEnabled() ? 1 : 0 );
53 
54  SetDefaultItem( m_stdButtonsOK );
55  GetSizer()->Fit( this );
56  GetSizer()->SetSizeHints( this );
57 }
58 
59 
60 void DIALOG_PNS_SETTINGS::OnOkClick( wxCommandEvent& aEvent )
61 {
62  // Save widgets' values to settings
63  m_settings.SetMode( (PNS::PNS_MODE) m_mode->GetSelection() );
64  m_settings.SetShoveVias( m_shoveVias->GetValue() );
68  m_settings.SetSmartPads( m_autoNeckdown->GetValue() );
73  m_settings.SetInlineDragEnabled( m_dragToolMode->GetSelection () ? true : false );
74 
75  aEvent.Skip(); // ends returning wxID_OK (default behavior)
76 }
void SetOptimizerEffort(PNS_OPTIMIZATION_EFFORT aEffort)
Sets the optimizer effort. Bigger means cleaner traces, but slower routing.
PNS_MODE Mode() const
Returns the routing mode.
bool SmoothDraggedSegments() const
Returns true if smoothing segments durign dragging is enabled.
Class ROUTING_SETTINGS.
void SetMode(PNS_MODE aMode)
Sets the routing mode.
PNS_OPTIMIZATION_EFFORT OptimizerEffort() const
Returns the optimizer effort. Bigger means cleaner traces, but slower routing.
void SetFreeAngleMode(bool aEnable)
PNS_MODE
Routing modes
void SetSuggestFinish(bool aSuggestFinish)
Enables displaying suggestions for finishing the currently placed track.
void SetRemoveLoops(bool aRemoveLoops)
Enables/disables loop (redundant track) removal.
void SetInlineDragEnabled(bool aEnable)
void SetSmartPads(bool aSmartPads)
Enables/disables Smart Pads (automatic neckdown).
Class DIALOG_PNS_SETTINGS_BASE.
DIALOG_PNS_SETTINGS(wxWindow *aParent, PNS::ROUTING_SETTINGS &aSettings)
Push and Shove router settings dialog.
void SetShoveVias(bool aShoveVias)
Enables/disables shoving vias.
virtual void OnOkClick(wxCommandEvent &aEvent) override
void SetCanViolateDRC(bool aViolate)
PNS::ROUTING_SETTINGS & m_settings
bool ShoveVias() const
Returns true if shoving vias is enbled.
Only walkaround
bool RemoveLoops() const
Returns true if loop (redundant track) removal is on.
bool JumpOverObstacles() const
Returns true if jumping over unmovable obstacles is on.
bool SuggestFinish()
Returns true if suggesting the finish of currently placed track is on.
bool SmartPads() const
Returns true if Smart Pads (automatic neckdown) is enabled.
PNS_OPTIMIZATION_EFFORT
Optimization effort
void SetSmoothDraggedSegments(bool aSmooth)
Enables/disabled smoothing segments during dragging.
void SetJumpOverObstacles(bool aJumpOverObstacles)
Enables/disables jumping over unmovable obstacles.