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