Commit a67ff643 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: fix bad initialization of default track width and vias sizes when...

Pcbnew: fix bad initialization of default track width and vias sizes when starting pcbnew with no board loaded.
parent d8ad2cce
......@@ -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() );
}
......
......@@ -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
......
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment