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() );
48  m_dragToolMode->SetSelection ( m_settings.InlineDragEnabled() ? 1 : 0 );
52 
53  // Enable/disable some options
54  wxCommandEvent event;
55  onModeChange( event );
56 
57  // Don't show options that are not implemented
58  m_suggestEnding->Hide();
59  m_shoveVias->Hide();
60 
61  SetDefaultItem( m_stdButtonsOK );
62  GetSizer()->Fit( this );
63  GetSizer()->SetSizeHints( this );
64 }
65 
66 
67 void DIALOG_PNS_SETTINGS::OnOkClick( wxCommandEvent& aEvent )
68 {
69  // Save widgets' values to settings
70  m_settings.SetMode( (PNS::PNS_MODE) m_mode->GetSelection() );
71  m_settings.SetShoveVias( m_shoveVias->GetValue() );
75  m_settings.SetSmartPads( m_smartPads->GetValue() );
77  m_settings.SetInlineDragEnabled( m_dragToolMode->GetSelection () ? true : false );
81 
82  if( m_mode->GetSelection() == PNS::RM_MarkObstacles )
83  {
86  }
87 
88  aEvent.Skip(); // ends returning wxID_OK (default behavior)
89 }
90 
91 
92 void DIALOG_PNS_SETTINGS::onModeChange( wxCommandEvent& aEvent )
93 {
94  if( m_mode->GetSelection() == PNS::RM_MarkObstacles )
95  {
97  m_freeAngleMode->Enable();
98 
100  m_violateDrc->Enable();
101  }
102  else
103  {
104  if( m_freeAngleMode->IsEnabled() )
106 
107  m_freeAngleMode->SetValue( false );
108  m_freeAngleMode->Enable( false );
109 
110  if( m_violateDrc->IsEnabled() )
112 
113  m_violateDrc->SetValue( false );
114  m_violateDrc->Enable( false );
115  }
116 }
Contain all persistent settings of the router, such as the mode, optimization effort,...
bool SmartPads() const
Enable/disable Smart Pads (optimized connections).
bool GetAllowDRCViolationsSetting() const
void SetMode(PNS_MODE aMode)
Return the optimizer effort. Bigger means cleaner traces, but slower routing.
void SetFreeAngleMode(bool aEnable)
PNS_MODE
< Routing modes
void SetSuggestFinish(bool aSuggestFinish)
Return true if Smart Pads (optimized connections) is enabled.
void SetRemoveLoops(bool aRemoveLoops)
Return true if suggesting the finish of currently placed track is on.
void SetInlineDragEnabled(bool aEnable)
void SetSmartPads(bool aSmartPads)
Return true if follow mouse mode is active (permanently on for the moment).
Class DIALOG_PNS_SETTINGS_BASE.
void SetJumpOverObstacles(bool aJump)
bool RemoveLoops() const
Enable/disable loop (redundant track) removal.
void SetAutoPosture(bool aEnable)
DIALOG_PNS_SETTINGS(wxWindow *aParent, PNS::ROUTING_SETTINGS &aSettings)
Push and Shove router settings dialog.
void SetOptimizeEntireDraggedTrack(bool aEnable)
void SetShoveVias(bool aShoveVias)
Return true if loop (redundant track) removal is on.
bool SmoothDraggedSegments() const
Enable/disable smoothing segments during dragging.
bool GetOptimizeEntireDraggedTrack() const
PNS_MODE Mode() const
Set the routing mode.
#define _(s)
virtual void OnOkClick(wxCommandEvent &aEvent) override
PNS::ROUTING_SETTINGS & m_settings
Ignore collisions, mark obstacles.
bool SuggestFinish()
Enable displaying suggestions for finishing the currently placed track.
void SetAllowDRCViolations(bool aViolate)
virtual void onModeChange(wxCommandEvent &aEvent) override
bool ShoveVias() const
Enable/disable shoving vias.
void SetSmoothDraggedSegments(bool aSmooth)
Return true if jumping over unmovable obstacles is on.
void SetFixAllSegments(bool aEnable)