PNS: Fix all segments by default (and make optional)
Fixes https://gitlab.com/kicad/code/kicad/-/issues/5920
This commit is contained in:
parent
8c247fc97c
commit
8a2667c4c3
|
@ -49,6 +49,7 @@ DIALOG_PNS_SETTINGS::DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS::ROUTING_SETTIN
|
|||
m_dragToolMode->SetSelection ( m_settings.InlineDragEnabled() ? 1 : 0 );
|
||||
m_optimizeDraggedTrack->SetValue( m_settings.GetOptimizeDraggedTrack() );
|
||||
m_autoPosture->SetValue( m_settings.GetAutoPosture() );
|
||||
m_fixAllSegments->SetValue( m_settings.GetFixAllSegments() );
|
||||
|
||||
// Enable/disable some options
|
||||
wxCommandEvent event;
|
||||
|
@ -78,6 +79,7 @@ void DIALOG_PNS_SETTINGS::OnOkClick( wxCommandEvent& aEvent )
|
|||
m_settings.SetInlineDragEnabled( m_dragToolMode->GetSelection () ? true : false );
|
||||
m_settings.SetOptimizeDraggedTrack( m_optimizeDraggedTrack->GetValue() );
|
||||
m_settings.SetAutoPosture( m_autoPosture->GetValue() );
|
||||
m_settings.SetFixAllSegments( m_fixAllSegments->GetValue() );
|
||||
|
||||
if( m_mode->GetSelection() == PNS::RM_MarkObstacles )
|
||||
{
|
||||
|
|
|
@ -91,6 +91,11 @@ DIALOG_PNS_SETTINGS_BASE::DIALOG_PNS_SETTINGS_BASE( wxWindow* parent, wxWindowID
|
|||
|
||||
bOptions->Add( m_autoPosture, 0, wxALL, 5 );
|
||||
|
||||
m_fixAllSegments = new wxCheckBox( bOptions->GetStaticBox(), wxID_ANY, _("Fix all segments on click"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_fixAllSegments->SetToolTip( _("When enabled, all track segments will be fixed in place up to the cursor location. When disabled, the last segment (closest to the cursor) will remain free and follow the cursor.") );
|
||||
|
||||
bOptions->Add( m_fixAllSegments, 0, wxALL, 5 );
|
||||
|
||||
wxBoxSizer* bEffort;
|
||||
bEffort = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
|
|
|
@ -921,6 +921,70 @@
|
|||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="checked">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Fix all segments on click</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_fixAllSegments</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip">When enabled, all track segments will be fixed in place up to the cursor location. When disabled, the last segment (closest to the cursor) will remain free and follow the cursor.</property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxALL</property>
|
||||
|
|
|
@ -50,6 +50,7 @@ class DIALOG_PNS_SETTINGS_BASE : public DIALOG_SHIM
|
|||
wxCheckBox* m_suggestEnding;
|
||||
wxCheckBox* m_optimizeDraggedTrack;
|
||||
wxCheckBox* m_autoPosture;
|
||||
wxCheckBox* m_fixAllSegments;
|
||||
wxStaticText* m_effortLabel;
|
||||
wxSlider* m_effort;
|
||||
wxStaticText* m_lowLabel;
|
||||
|
|
|
@ -722,6 +722,9 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
|||
ret &= fromLegacy<bool>( aCfg, p + "FreeAngleMode", "tools.pns.free_angle_mode" );
|
||||
ret &= fromLegacy<bool>( aCfg, p + "InlineDragEnabled", "tools.pns.inline_drag" );
|
||||
|
||||
// Initialize some new PNS settings to legacy behaviors if coming from legacy
|
||||
( *this )[PointerFromString( "tools.pns.fix_all_segments" )] = false;
|
||||
|
||||
// Migrate color settings that were stored in the pcbnew config file
|
||||
|
||||
COLOR_SETTINGS* cs = Pgm().GetSettingsManager().GetMigratedColorSettings();
|
||||
|
|
|
@ -1089,6 +1089,7 @@ bool LINE_PLACER::Move( const VECTOR2I& aP, ITEM* aEndItem )
|
|||
|
||||
bool LINE_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinish )
|
||||
{
|
||||
bool fixAll = Settings().GetFixAllSegments();
|
||||
bool realEnd = false;
|
||||
int lastV;
|
||||
|
||||
|
@ -1148,7 +1149,7 @@ bool LINE_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinis
|
|||
if( aForceFinish )
|
||||
realEnd = true;
|
||||
|
||||
if( realEnd || m_placingVia )
|
||||
if( realEnd || m_placingVia || fixAll )
|
||||
lastV = l.SegmentCount();
|
||||
else
|
||||
lastV = std::max( 1, l.SegmentCount() - 1 );
|
||||
|
@ -1193,7 +1194,7 @@ bool LINE_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinis
|
|||
if( !realEnd )
|
||||
{
|
||||
setInitialDirection( d_last );
|
||||
m_currentStart = m_placingVia ? p_last : p_pre_last;
|
||||
m_currentStart = ( m_placingVia || fixAll ) ? p_last : p_pre_last;
|
||||
|
||||
m_fixedTail.AddStage( m_p_start, m_currentLayer, m_placingVia, m_direction, m_currentNode );
|
||||
|
||||
|
@ -1251,7 +1252,7 @@ bool LINE_PLACER::UnfixRoute()
|
|||
m_head.RemoveVia();
|
||||
m_tail.RemoveVia();
|
||||
|
||||
if (m_shove)
|
||||
if( m_shove )
|
||||
{
|
||||
m_shove->RewindSpringbackTo( m_currentNode );
|
||||
m_shove->UnlockSpringbackNode( m_currentNode );
|
||||
|
|
|
@ -55,6 +55,7 @@ ROUTING_SETTINGS::ROUTING_SETTINGS( JSON_SETTINGS* aParent, const std::string& a
|
|||
m_maxRadius = 1000000;
|
||||
m_roundedCorners = false;
|
||||
m_autoPosture = true;
|
||||
m_fixAllSegments = true;
|
||||
|
||||
m_params.emplace_back( new PARAM<int>( "mode", reinterpret_cast<int*>( &m_routingMode ),
|
||||
static_cast<int>( RM_Walkaround ) ) );
|
||||
|
@ -97,6 +98,7 @@ ROUTING_SETTINGS::ROUTING_SETTINGS( JSON_SETTINGS* aParent, const std::string& a
|
|||
m_params.emplace_back( new PARAM<int>( "max_radius", &m_maxRadius, 1000000 ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "use_rounded", &m_roundedCorners, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "auto_posture", &m_autoPosture, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "fix_all_segments", &m_fixAllSegments, true ) );
|
||||
|
||||
LoadFromFile();
|
||||
}
|
||||
|
|
|
@ -150,6 +150,9 @@ public:
|
|||
bool GetAutoPosture() const { return m_autoPosture; }
|
||||
void SetAutoPosture( bool aEnable ) { m_autoPosture = aEnable; }
|
||||
|
||||
bool GetFixAllSegments() const { return m_fixAllSegments; }
|
||||
void SetFixAllSegments( bool aEnable ) { m_fixAllSegments = aEnable; }
|
||||
|
||||
void SetMinRadius( int aRadius )
|
||||
{
|
||||
m_minRadius = aRadius;
|
||||
|
@ -186,6 +189,7 @@ private:
|
|||
bool m_roundedCorners;
|
||||
bool m_optimizeDraggedTrack;
|
||||
bool m_autoPosture;
|
||||
bool m_fixAllSegments;
|
||||
|
||||
int m_minRadius;
|
||||
int m_maxRadius;
|
||||
|
|
Loading…
Reference in New Issue