Remember autotrack width setting

Fixes https://gitlab.com/kicad/code/kicad/issues/6971
This commit is contained in:
Seth Hillbrand 2021-01-06 20:11:06 -08:00
parent 0234b7278a
commit 52f822dedb
3 changed files with 17 additions and 4 deletions

View File

@ -154,6 +154,9 @@ PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS( PROJECT* aProject, const wxStrin
&m_RatsnestMode, RATSNEST_MODE::ALL, RATSNEST_MODE::ALL, &m_RatsnestMode, RATSNEST_MODE::ALL, RATSNEST_MODE::ALL,
RATSNEST_MODE::VISIBLE ) ); RATSNEST_MODE::VISIBLE ) );
m_params.emplace_back( new PARAM<bool>( "board.auto_track_width",
&m_AutoTrackWidth, true ) );
m_params.emplace_back( new PARAM_ENUM<ZONE_DISPLAY_MODE>( "board.zone_display_mode", m_params.emplace_back( new PARAM_ENUM<ZONE_DISPLAY_MODE>( "board.zone_display_mode",
&m_ZoneDisplayMode, &m_ZoneDisplayMode,
ZONE_DISPLAY_MODE::SHOW_FILLED, ZONE_DISPLAY_MODE::SHOW_FILLED, ZONE_DISPLAY_MODE::SHOW_FILLED, ZONE_DISPLAY_MODE::SHOW_FILLED,
@ -271,7 +274,7 @@ bool PROJECT_LOCAL_SETTINGS::SaveToFile( const wxString& aDirectory, bool aForce
const PROJECT_FILE_STATE* PROJECT_LOCAL_SETTINGS::GetFileState( const wxString& aFileName ) const PROJECT_FILE_STATE* PROJECT_LOCAL_SETTINGS::GetFileState( const wxString& aFileName )
{ {
auto it = std::find_if( m_files.begin(), m_files.end(), auto it = std::find_if( m_files.begin(), m_files.end(),
[&aFileName]( const PROJECT_FILE_STATE &a ) [&aFileName]( const PROJECT_FILE_STATE &a )
{ {
return a.fileName == aFileName; return a.fileName == aFileName;
@ -290,9 +293,9 @@ void PROJECT_LOCAL_SETTINGS::SaveFileState( const wxString& aFileName,
const WINDOW_SETTINGS* aWindowCfg, bool aOpen ) const WINDOW_SETTINGS* aWindowCfg, bool aOpen )
{ {
auto it = std::find_if( m_files.begin(), m_files.end(), auto it = std::find_if( m_files.begin(), m_files.end(),
[&aFileName]( const PROJECT_FILE_STATE& a ) [&aFileName]( const PROJECT_FILE_STATE& a )
{ {
return a.fileName == aFileName; return a.fileName == aFileName;
} ); } );
if( it == m_files.end() ) if( it == m_files.end() )

View File

@ -116,6 +116,9 @@ public:
/// The current ratsnest draw mode /// The current ratsnest draw mode
RATSNEST_MODE m_RatsnestMode; RATSNEST_MODE m_RatsnestMode;
/// The current setting for whether to automatically adjust track widths to match
bool m_AutoTrackWidth;
/// How zones are drawn /// How zones are drawn
ZONE_DISPLAY_MODE m_ZoneDisplayMode; ZONE_DISPLAY_MODE m_ZoneDisplayMode;

View File

@ -134,6 +134,9 @@ bool PCB_EDIT_FRAME::LoadProjectSettings()
opts.m_ZoneDisplayMode = localSettings.m_ZoneDisplayMode; opts.m_ZoneDisplayMode = localSettings.m_ZoneDisplayMode;
SetDisplayOptions( opts ); SetDisplayOptions( opts );
BOARD_DESIGN_SETTINGS& bds = GetDesignSettings();
bds.m_UseConnectedTrackWidth = localSettings.m_AutoTrackWidth;
wxFileName fn( GetCurrentFileName() ); wxFileName fn( GetCurrentFileName() );
fn.MakeRelativeTo( Prj().GetProjectPath() ); fn.MakeRelativeTo( Prj().GetProjectPath() );
LoadWindowState( fn.GetFullPath() ); LoadWindowState( fn.GetFullPath() );
@ -181,6 +184,10 @@ void PCB_EDIT_FRAME::SaveProjectSettings()
localSettings.m_ZoneOpacity = displayOpts.m_ZoneOpacity; localSettings.m_ZoneOpacity = displayOpts.m_ZoneOpacity;
localSettings.m_ZoneDisplayMode = displayOpts.m_ZoneDisplayMode; localSettings.m_ZoneDisplayMode = displayOpts.m_ZoneDisplayMode;
// Save Design settings
const BOARD_DESIGN_SETTINGS& bds = GetDesignSettings();
localSettings.m_AutoTrackWidth = bds.m_UseConnectedTrackWidth;
// Save render settings that aren't stored in PCB_DISPLAY_OPTIONS // Save render settings that aren't stored in PCB_DISPLAY_OPTIONS
KIGFX::PCB_RENDER_SETTINGS* rs = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( KIGFX::PCB_RENDER_SETTINGS* rs = static_cast<KIGFX::PCB_RENDER_SETTINGS*>(