Pcbnew: fix bad initialization of default track width and vias sizes when starting pcbnew with no board loaded.

This commit is contained in:
jean-pierre charras 2011-12-09 11:36:00 +01:00
parent d8ad2cceb0
commit a67ff643f3
3 changed files with 11 additions and 8 deletions

View File

@ -59,7 +59,8 @@ BOARD::BOARD() :
m_ViaSizeSelector = 0;
m_TrackWidthSelector = 0;
// Initialize default values.
// Initialize default values in default netclass.
m_NetClasses.GetDefault()->SetParams();
SetCurrentNetClass( m_NetClasses.GetDefault()->GetName() );
}

View File

@ -32,7 +32,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS()
m_EdgeSegmentWidth = 100; // current graphic line width (EDGE layer only)
m_PcbTextWidth = 100; // current Pcb (not module) Text width
m_PcbTextSize = wxSize( 500, 500 ); // current Pcb (not module) Text size
m_TrackMinWidth = 80; // track min value for width ((min copper size value
m_TrackMinWidth = 100; // track min value for width ((min copper size value
m_ViasMinSize = 350; // vias (not micro vias) min diameter
m_ViasMinDrill = 200; // vias (not micro vias) min drill diameter
m_MicroViasMinSize = 200; // micro vias (not vias) min diameter

View File

@ -66,12 +66,14 @@ void NETCLASS::SetParams( const NETCLASS* defaults )
SetuViaDrill( defaults->GetuViaDrill() );
}
else
{ // We should use m_Parent->GetDesignSettings()
// But when the NETCLASSES constructor is called
// (it call NETCLASS constructor), the m_Parent constructor (see BOARD::BOARD)
// is not run, and GetDesignSettings() return a bad value
// TODO: see how change that.
const BOARD_DESIGN_SETTINGS& g = m_Parent->GetDesignSettings(); // like that?
{ // Note:
// We use m_Parent->GetDesignSettings() to get some default values
// But when this function is called when instantiating a BOARD class,
// by the NETCLASSES constructor that calls NETCLASS constructor,
// the BOARD constructor (see BOARD::BOARD) is not yet run,
// and BOARD::m_designSettings contains not yet initialized values.
// So inside the BOARD constructor itself, you SHOULD recall SetParams
const BOARD_DESIGN_SETTINGS& g = m_Parent->GetDesignSettings();
SetTrackWidth( g.m_TrackMinWidth );
SetViaDiameter( g.m_ViasMinSize );