PCB Editor: changes to track width overrides starting track width

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/8797
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/8797
This commit is contained in:
Mike Williams 2021-12-15 10:48:34 -05:00 committed by Jon Evans
parent 97c2627de6
commit 956ac871c3
6 changed files with 36 additions and 8 deletions

View File

@ -687,6 +687,8 @@ public:
bool m_UseConnectedTrackWidth; // use width of existing track when creating a new,
// connected track
bool m_TempOverrideTrackWidth; // use selected track width temporarily even when
// using connected track width
int m_MinClearance; // overall min clearance
int m_TrackMinWidth; // overall min track width
int m_ViasMinAnnularWidth; // overall minimum width of the via copper ring

View File

@ -191,6 +191,7 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
else
{
GetDesignSettings().SetTrackWidthIndex( ii );
GetDesignSettings().m_TempOverrideTrackWidth = true;
}
break;

View File

@ -466,7 +466,7 @@ bool PNS_KICAD_IFACE_BASE::ImportSizes( PNS::SIZES_SETTINGS& aSizes, PNS::ITEM*
int trackWidth = bds.m_TrackMinWidth;
bool found = false;
if( bds.m_UseConnectedTrackWidth && aStartItem != nullptr )
if( bds.m_UseConnectedTrackWidth && !bds.m_TempOverrideTrackWidth && aStartItem != nullptr )
{
found = inheritTrackWidth( aStartItem, &trackWidth );
@ -502,7 +502,7 @@ bool PNS_KICAD_IFACE_BASE::ImportSizes( PNS::SIZES_SETTINGS& aSizes, PNS::ITEM*
}
aSizes.SetTrackWidth( trackWidth );
aSizes.SetTrackWidthIsExplicit( !bds.m_UseConnectedTrackWidth );
aSizes.SetTrackWidthIsExplicit( !bds.m_UseConnectedTrackWidth || bds.m_TempOverrideTrackWidth );
int viaDiameter = bds.m_ViasMinSize;
int viaDrill = bds.m_MinThroughDrill;

View File

@ -268,13 +268,14 @@ protected:
if( id == ID_POPUP_PCB_SELECT_CUSTOM_WIDTH )
{
bds.UseCustomTrackViaSize( true );
bds.m_UseConnectedTrackWidth = false;
bds.m_TempOverrideTrackWidth = true;
m_frame.GetToolManager()->RunAction( ACT_CustomTrackWidth, true );
}
else if( id == ID_POPUP_PCB_SELECT_AUTO_WIDTH )
{
bds.UseCustomTrackViaSize( false );
bds.m_UseConnectedTrackWidth = true;
bds.m_TempOverrideTrackWidth = false;
}
else if( id == ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES )
{
@ -286,13 +287,12 @@ protected:
else if( id >= ID_POPUP_PCB_SELECT_VIASIZE1 && id <= ID_POPUP_PCB_SELECT_VIASIZE16 )
{
bds.UseCustomTrackViaSize( false );
bds.m_UseConnectedTrackWidth = false;
bds.SetViaSizeIndex( id - ID_POPUP_PCB_SELECT_VIASIZE1 );
}
else if( id >= ID_POPUP_PCB_SELECT_WIDTH1 && id <= ID_POPUP_PCB_SELECT_WIDTH16 )
{
bds.UseCustomTrackViaSize( false );
bds.m_UseConnectedTrackWidth = false;
bds.m_TempOverrideTrackWidth = true;
bds.SetTrackWidthIndex( id - ID_POPUP_PCB_SELECT_WIDTH1 );
}
@ -1082,6 +1082,8 @@ bool ROUTER_TOOL::prepareInteractive()
PNS::SIZES_SETTINGS sizes( m_router->Sizes() );
m_iface->SetStartLayer( routingLayer );
frame()->GetBoard()->GetDesignSettings().m_TempOverrideTrackWidth = false;
m_iface->ImportSizes( sizes, m_startItem, -1 );
sizes.AddLayerPair( frame()->GetScreen()->m_Route_Layer_TOP,
frame()->GetScreen()->m_Route_Layer_BOTTOM );
@ -2018,6 +2020,7 @@ int ROUTER_TOOL::CustomTrackWidthDialog( const TOOL_EVENT& aEvent )
if( sizeDlg.ShowModal() == wxID_OK )
{
bds.m_TempOverrideTrackWidth = true;
bds.UseCustomTrackViaSize( true );
TOOL_EVENT dummy;

View File

@ -813,7 +813,7 @@ void PCB_EDIT_FRAME::OnUpdateSelectAutoWidth( wxUpdateUIEvent& aEvent )
{
BOARD_DESIGN_SETTINGS& bds = GetDesignSettings();
aEvent.Check( bds.m_UseConnectedTrackWidth && !bds.UseCustomTrackViaSize() );
aEvent.Check( bds.m_UseConnectedTrackWidth );
}

View File

@ -745,7 +745,18 @@ int BOARD_EDITOR_CONTROL::TrackWidthInc( const TOOL_EVENT& aEvent )
}
else
{
int widthIndex = designSettings.GetTrackWidthIndex() + 1;
int widthIndex = designSettings.GetTrackWidthIndex();
if( routerTool && routerTool->IsToolActive()
&& routerTool->Router()->GetState() == PNS::ROUTER::RouterState::ROUTE_TRACK
&& designSettings.m_UseConnectedTrackWidth && !designSettings.m_TempOverrideTrackWidth )
{
designSettings.m_TempOverrideTrackWidth = true;
}
else
{
widthIndex++;
}
// If we go past the last track width entry in the list, start over at the beginning
if( widthIndex >= (int) designSettings.m_TrackWidthList.size() )
@ -814,7 +825,18 @@ int BOARD_EDITOR_CONTROL::TrackWidthDec( const TOOL_EVENT& aEvent )
}
else
{
int widthIndex = designSettings.GetTrackWidthIndex() - 1;
int widthIndex = designSettings.GetTrackWidthIndex();
if( routerTool && routerTool->IsToolActive()
&& routerTool->Router()->GetState() == PNS::ROUTER::RouterState::ROUTE_TRACK
&& designSettings.m_UseConnectedTrackWidth && !designSettings.m_TempOverrideTrackWidth )
{
designSettings.m_TempOverrideTrackWidth = true;
}
else
{
widthIndex--;
}
// If we get to the lowest entry start over at the highest
if( widthIndex < 0 )