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

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
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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() );
}

+1 −1
Original line number Diff line number Diff line
@@ -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
+8 −6
Original line number Diff line number Diff line
@@ -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 );