KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 The 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
25
26#include "dialog_pns_settings.h"
28
30 DIALOG_PNS_SETTINGS_BASE( aParent ),
31 m_settings( aSettings )
32{
33 // Load widgets' values from settings
34 switch( m_settings.Mode() )
35 {
36 case PNS::RM_MarkObstacles: m_rbMarkObstacles->SetValue( true ); break;
37 case PNS::RM_Shove: m_rbShove->SetValue( true ); break;
38 case PNS::RM_Walkaround: m_rbWalkaround->SetValue( true ); break;
39 }
40
41 m_shoveVias->SetValue( m_settings.ShoveVias() );
42 m_backPressure->SetValue( m_settings.JumpOverObstacles() );
43 m_removeLoops->SetValue( m_settings.RemoveLoops() );
44 m_suggestEnding->SetValue( m_settings.SuggestFinish() );
45 m_smartPads->SetValue( m_settings.SmartPads() );
46 m_smoothDragged->SetValue( m_settings.SmoothDraggedSegments() );
47 m_violateDrc->SetValue( m_settings.GetAllowDRCViolationsSetting() );
48 m_freeAngleMode->SetValue( m_settings.GetFreeAngleMode() );
49 m_optimizeEntireDraggedTrack->SetValue( m_settings.GetOptimizeEntireDraggedTrack() );
50 m_autoPosture->SetValue( m_settings.GetAutoPosture() );
51 m_fixAllSegments->SetValue( m_settings.GetFixAllSegments() );
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
61
63}
64
65
67{
68 // Save widgets' values to settings
69 if ( m_rbMarkObstacles->GetValue() ) m_settings.SetMode( PNS::RM_MarkObstacles );
70 else if( m_rbShove->GetValue() ) m_settings.SetMode( PNS::RM_Shove );
71 else if( m_rbWalkaround->GetValue() ) m_settings.SetMode( PNS::RM_Walkaround );
72
73 m_settings.SetShoveVias( m_shoveVias->GetValue() );
74 m_settings.SetJumpOverObstacles( m_backPressure->GetValue() );
75 m_settings.SetRemoveLoops( m_removeLoops->GetValue() );
76 m_settings.SetSuggestFinish ( m_suggestEnding->GetValue() );
77 m_settings.SetSmartPads( m_smartPads->GetValue() );
78 m_settings.SetSmoothDraggedSegments( m_smoothDragged->GetValue() );
79 m_settings.SetOptimizeEntireDraggedTrack( m_optimizeEntireDraggedTrack->GetValue() );
80 m_settings.SetAutoPosture( m_autoPosture->GetValue() );
81 m_settings.SetFixAllSegments( m_fixAllSegments->GetValue() );
82 m_settings.SetAllowDRCViolations( m_violateDrc->GetValue() );
83 m_settings.SetFreeAngleMode( m_freeAngleMode->GetValue() );
84
85 return true;
86}
87
88
89void DIALOG_PNS_SETTINGS::onModeChange( wxCommandEvent& aEvent )
90{
91 m_freeAngleMode->Enable( m_rbMarkObstacles->GetValue() );
92 m_violateDrc->Enable( m_rbMarkObstacles->GetValue() );
93
94 m_shoveVias->Enable( m_rbShove->GetValue() );
95 m_backPressure->Enable( m_rbShove->GetValue() );
96}
DIALOG_PNS_SETTINGS_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Interactive Router Settings"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
virtual void onModeChange(wxCommandEvent &aEvent) override
bool TransferDataFromWindow() override
PNS::ROUTING_SETTINGS & m_settings
DIALOG_PNS_SETTINGS(wxWindow *aParent, PNS::ROUTING_SETTINGS &aSettings)
Push and Shove router settings dialog.
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
Contain all persistent settings of the router, such as the mode, optimization effort,...
@ RM_MarkObstacles
Ignore collisions, mark obstacles.
@ RM_Walkaround
Only walk around.
@ RM_Shove
Only shove.