diff --git a/include/board_design_settings.h b/include/board_design_settings.h index 43ebf20307..8f29cc4e5e 100644 --- a/include/board_design_settings.h +++ b/include/board_design_settings.h @@ -485,10 +485,7 @@ public: * ( using the default netclass value or a preset/custom value ) * the default netclass is always in m_TrackWidthList[0] */ - inline int GetCurrentTrackWidth() const - { - return m_useCustomTrackVia ? m_customTrackWidth : m_TrackWidthList[m_trackWidthIndex]; - } + int GetCurrentTrackWidth() const; /** * Function SetCustomTrackWidth @@ -534,13 +531,7 @@ public: * ( using the default netclass value or a preset/custom value ) * the default netclass is always in m_TrackWidthList[0] */ - inline int GetCurrentViaSize() const - { - if( m_useCustomTrackVia ) - return m_customViaSize.m_Diameter; - else - return m_ViasDimensionsList[m_viaSizeIndex].m_Diameter; - } + int GetCurrentViaSize() const; /** * Function SetCustomViaSize diff --git a/pcbnew/board_design_settings.cpp b/pcbnew/board_design_settings.cpp index c7aa0a961b..e452ae13d7 100644 --- a/pcbnew/board_design_settings.cpp +++ b/pcbnew/board_design_settings.cpp @@ -886,14 +886,27 @@ void BOARD_DESIGN_SETTINGS::SetViaSizeIndex( unsigned aIndex ) } +int BOARD_DESIGN_SETTINGS::GetCurrentViaSize() const +{ + if( m_useCustomTrackVia ) + return m_customViaSize.m_Diameter; + else if( m_viaSizeIndex == 0 ) + return GetNetClasses().GetDefaultPtr()->GetViaDiameter(); + else + return m_ViasDimensionsList[ m_viaSizeIndex ].m_Diameter; +} + + int BOARD_DESIGN_SETTINGS::GetCurrentViaDrill() const { int drill; if( m_useCustomTrackVia ) drill = m_customViaSize.m_Drill; + else if( m_viaSizeIndex == 0 ) + drill = GetNetClasses().GetDefaultPtr()->GetViaDrill(); else - drill = m_ViasDimensionsList[m_viaSizeIndex].m_Drill; + drill = m_ViasDimensionsList[ m_viaSizeIndex ].m_Drill; return drill > 0 ? drill : -1; } @@ -906,6 +919,17 @@ void BOARD_DESIGN_SETTINGS::SetTrackWidthIndex( unsigned aIndex ) } +int BOARD_DESIGN_SETTINGS::GetCurrentTrackWidth() const +{ + if( m_useCustomTrackVia ) + return m_customTrackWidth; + else if( m_trackWidthIndex == 0 ) + return GetNetClasses().GetDefaultPtr()->GetTrackWidth(); + else + return m_TrackWidthList[ m_trackWidthIndex ]; +} + + void BOARD_DESIGN_SETTINGS::SetDiffPairIndex( unsigned aIndex ) { m_diffPairIndex = std::min( aIndex, (unsigned) 8 ); diff --git a/pcbnew/dialogs/panel_setup_tracks_and_vias.cpp b/pcbnew/dialogs/panel_setup_tracks_and_vias.cpp index ad931e7fce..d6df0d56e5 100644 --- a/pcbnew/dialogs/panel_setup_tracks_and_vias.cpp +++ b/pcbnew/dialogs/panel_setup_tracks_and_vias.cpp @@ -197,13 +197,13 @@ bool PANEL_SETUP_TRACKS_AND_VIAS::TransferDataFromWindow() sort( vias.begin(), vias.end() ); sort( diffPairs.begin(), diffPairs.end() ); - trackWidths.insert( trackWidths.begin(), m_BrdSettings->m_TrackWidthList[ 0 ] ); + trackWidths.insert( trackWidths.begin(), 0 ); // dummy value for "use netclass" m_BrdSettings->m_TrackWidthList = trackWidths; - vias.insert( vias.begin(), m_BrdSettings->m_ViasDimensionsList[ 0 ] ); + vias.insert( vias.begin(), { 0, 0 } ); // dummy value for "use netclass" m_BrdSettings->m_ViasDimensionsList = vias; - diffPairs.insert( diffPairs.begin(), m_BrdSettings->m_DiffPairDimensionsList[ 0 ] ); + diffPairs.insert( diffPairs.begin(), { 0, 0, 0 } ); // dummy value for "use netclass" m_BrdSettings->m_DiffPairDimensionsList = diffPairs; return true;