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  // Add tool tip to the mode radio box, one by option
33  // (cannot be made with wxFormBuilder for each item )
34  m_mode->SetItemToolTip( 0, _( "DRC violation: highlight obstacles" ) );
35  m_mode->SetItemToolTip( 1, _( "DRC violation: shove tracks and vias" ) );
36  m_mode->SetItemToolTip( 2, _( "DRC violation: walk around obstacles" ) );
37 
38  // Load widgets' values from settings
39  m_mode->SetSelection( m_settings.Mode() );
40  m_shoveVias->SetValue( m_settings.ShoveVias() );
42  m_removeLoops->SetValue( m_settings.RemoveLoops() );
44  m_smartPads->SetValue( m_settings.SmartPads() );
45  m_effort->SetValue( m_settings.OptimizerEffort() );
47  m_violateDrc->SetValue( m_settings.CanViolateDRC() );
49  m_dragToolMode->SetSelection ( m_settings.InlineDragEnabled() ? 1 : 0 );
50  // Enable/disable some options
51  wxCommandEvent event;
52  onModeChange( event );
53 
54  // Don't show options that are not implemented
55  m_suggestEnding->Hide();
56  m_shoveVias->Hide();
57 
58  SetDefaultItem( m_stdButtonsOK );
59  GetSizer()->Fit( this );
60  GetSizer()->SetSizeHints( this );
61 }
62 
63 
64 void DIALOG_PNS_SETTINGS::OnOkClick( wxCommandEvent& aEvent )
65 {
66  // Save widgets' values to settings
67  m_settings.SetMode( (PNS::PNS_MODE) m_mode->GetSelection() );
68  m_settings.SetShoveVias( m_shoveVias->GetValue() );
72  m_settings.SetSmartPads( m_smartPads->GetValue() );
77  m_settings.SetInlineDragEnabled( m_dragToolMode->GetSelection () ? true : false );
78 
79  aEvent.Skip(); // ends returning wxID_OK (default behavior)
80 }
81 
82 
83 void DIALOG_PNS_SETTINGS::onModeChange( wxCommandEvent& aEvent )
84 {
85  if( m_mode->GetSelection() == PNS::RM_MarkObstacles )
86  {
87  m_freeAngleMode->Enable();
88  m_violateDrc->Enable();
89  }
90  else
91  {
92  m_freeAngleMode->SetValue( false );
93  m_freeAngleMode->Enable( false );
94 
95  m_violateDrc->SetValue( false );
96  m_violateDrc->Enable( false );
97  }
98 }
void SetOptimizerEffort(PNS_OPTIMIZATION_EFFORT aEffort)
Sets the optimizer effort. Bigger means cleaner traces, but slower routing.
Class ROUTING_SETTINGS.
bool SmartPads() const
Returns true if Smart Pads (optimized connections) is enabled.
void SetMode(PNS_MODE aMode)
Sets the routing mode.
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 (optimized connections).
Class DIALOG_PNS_SETTINGS_BASE.
bool RemoveLoops() const
Returns true if loop (redundant track) removal is on.
DIALOG_PNS_SETTINGS(wxWindow *aParent, PNS::ROUTING_SETTINGS &aSettings)
Push and Shove router settings dialog.
PNS_OPTIMIZATION_EFFORT OptimizerEffort() const
Returns the optimizer effort. Bigger means cleaner traces, but slower routing.
void SetShoveVias(bool aShoveVias)
Enables/disables shoving vias.
bool SmoothDraggedSegments() const
Returns true if smoothing segments durign dragging is enabled.
PNS_MODE Mode() const
Returns the routing mode.
virtual void OnOkClick(wxCommandEvent &aEvent) override
void SetCanViolateDRC(bool aViolate)
PNS::ROUTING_SETTINGS & m_settings
bool SuggestFinish()
Returns true if suggesting the finish of currently placed track is on.
bool JumpOverObstacles() const
Returns true if jumping over unmovable obstacles is on.
PNS_OPTIMIZATION_EFFORT
Optimization effort
virtual void onModeChange(wxCommandEvent &aEvent) override
bool ShoveVias() const
Returns true if shoving vias is enbled.
void SetSmoothDraggedSegments(bool aSmooth)
Enables/disabled smoothing segments during dragging.
void SetJumpOverObstacles(bool aJumpOverObstacles)
Enables/disables jumping over unmovable obstacles.