Commit 4b9b2f4e authored by Vladimir Ur's avatar Vladimir Ur
Browse files

Nanometric work. Design rules, D_PAD (except m_Pos) is now in new units....

Nanometric work. Design rules, D_PAD (except m_Pos) is now in new units. Metric files can be loaded w/o KICAD_NANOMETRE flag set but saved only with this flag, this could help to gain some compatibility during transition process. ifdef'd code is somewhat minimized by using transition macros. Some potential code bugs are commented.
parents 6f3aa6ac 6ebb044d
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -903,8 +903,8 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
    int     color;

    scale = g_Parm_3D_Visu.m_BoardScale;
    holeX = (double) m_Drill.x * scale / 2;
    holeY = (double) m_Drill.y * scale / 2;
    holeX = (double) TO_LEGACY_LU_DBL( m_Drill.x ) * scale / 2;
    holeY = (double) TO_LEGACY_LU_DBL( m_Drill.y ) * scale / 2;
    hole  = MIN( holeX, holeY );

    /* Calculate the center of the pad. */
@@ -914,8 +914,8 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
    xc  = ux0;
    yc  = uy0;

    dx = dx0 = m_Size.x >> 1;
    dy = dy0 = m_Size.y >> 1;
    dx = dx0 = TO_LEGACY_LU( m_Size.x ) >> 1;
    dy = dy0 = TO_LEGACY_LU( m_Size.y ) >> 1;

    angle  = m_Orient;
    drillx = m_Pos.x * scale;
@@ -980,13 +980,13 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
        {
            delta_cx = dx - dy;
            delta_cy = 0;
            w = m_Size.y * scale;
            w = TO_LEGACY_LU( m_Size.y ) * scale;
        }
        else /* Vertical ellipse */
        {
            delta_cx = 0;
            delta_cy = dy - dx;
            w = m_Size.x * scale;
            w = TO_LEGACY_LU( m_Size.x ) * scale;
        }

        RotatePoint( &delta_cx, &delta_cy, angle );
+14 −0
Original line number Diff line number Diff line
@@ -518,6 +518,20 @@ void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent& event )
    tmp << wxT( "OFF\n" );
#endif

    tmp << wxT( "         KICAD_NANOMETRE=" );
#ifdef KICAD_NANOMETRE
    tmp << wxT( "ON\n" );
#else
    tmp << wxT( "OFF\n" );
#endif

    tmp << wxT( "         KICAD_KEEPCASE=" );
#ifdef KICAD_KEEPCASE
    tmp << wxT( "ON\n" );
#else
    tmp << wxT( "OFF\n" );
#endif

    tmp << wxT( "         USE_WX_GRAPHICS_CONTEXT=" );
#ifdef USE_WX_GRAPHICS_CONTEXT
    tmp << wxT( "ON\n" );
+10 −10
Original line number Diff line number Diff line
@@ -416,7 +416,7 @@ int ReturnValueFromString( EDA_UNITS_T aUnit, const wxString& TextValue, int Int
 *New common length functions
 */

const LENGTH_UNIT_DESC g_MillimetreDesc =
const LENGTH_UNIT_DESC MillimetreDesc =
{
    LENGTH_UNITS<LENGTH_DEF>::millimetre(),
    wxT( "mm" ),
@@ -424,7 +424,7 @@ const LENGTH_UNIT_DESC g_MillimetreDesc =
};


const LENGTH_UNIT_DESC g_InchDesc =
const LENGTH_UNIT_DESC InchDesc =
{
    LENGTH_UNITS<LENGTH_DEF>::inch(),
    wxT( "\"" ),
@@ -432,7 +432,7 @@ const LENGTH_UNIT_DESC g_InchDesc =
};


const LENGTH_UNIT_DESC g_MilDesc =
const LENGTH_UNIT_DESC MilDesc =
{
    LENGTH_UNITS<LENGTH_DEF>::mil(),
    wxT( "mil" ),
@@ -440,7 +440,7 @@ const LENGTH_UNIT_DESC g_MilDesc =
};


const LENGTH_UNIT_DESC g_UnscaledDesc = /* stub */
const LENGTH_UNIT_DESC UnscaledDesc = /* stub */
{
    LENGTH_DEF::quantum(),
    wxT( "" ),
@@ -451,11 +451,11 @@ const LENGTH_UNIT_DESC g_UnscaledDesc = /* stub */
const LENGTH_UNIT_DESC *UnitDescription( EDA_UNITS_T aUnit ) {
    switch(aUnit) {
        case INCHES:
            return &g_InchDesc;
            return &InchDesc;
        case MILLIMETRES:
            return &g_MillimetreDesc;
            return &MillimetreDesc;
        default:
            return &g_UnscaledDesc; /* should not be reached */
            return &UnscaledDesc; /* should not be reached */
    }
}

@@ -533,15 +533,15 @@ LENGTH_DEF StringToLength( const LENGTH_UNIT_DESC *aUnit, const wxString& TextVa

    if( unit == wxT( "in" ) || unit == wxT( "\"" ) )
    {
        aUnit = &g_InchDesc;
        aUnit = &InchDesc;
    }
    else if( unit == wxT( "mm" ) )
    {
        aUnit = &g_MillimetreDesc;
        aUnit = &MillimetreDesc;
    }
    else if( unit == wxT( "mi" ) || unit == wxT( "th" ) ) /* Mils or thous */
    {
        aUnit = &g_MilDesc;
        aUnit = &MilDesc;
    }

    Value = LENGTH_DEF( dtmp * LENGTH< double, 1 >( aUnit->m_Value ) );
+9 −4
Original line number Diff line number Diff line
@@ -9,6 +9,8 @@

#include "lengthpcb.h"

#include "class_via_dimension.h"

// Class for handle current printed board design settings
class BOARD_DESIGN_SETTINGS
{
@@ -25,10 +27,13 @@ public:
    int    m_PcbTextWidth;                // current Pcb (not module) Text width
    wxSize m_PcbTextSize;                 // current Pcb (not module) Text size
    LENGTH_PCB m_TrackMinWidth;               // track min value for width ((min copper size value
    LENGTH_PCB m_ViasMinSize;                 // vias (not micro vias) min diameter
    LENGTH_PCB m_ViasMinDrill;                // vias (not micro vias) min drill diameter
    LENGTH_PCB m_MicroViasMinSize;            // micro vias (not vias) min diameter
    LENGTH_PCB m_MicroViasMinDrill;           // micro vias (not vias) min drill diameter
    
    VIA_DIMENSION m_MinVia;
    VIA_DIMENSION m_MinMicroVia;
    //LENGTH_PCB m_ViasMinSize;                 // vias (not micro vias) min diameter
    //LENGTH_PCB m_ViasMinDrill;                // vias (not micro vias) min drill diameter
    //LENGTH_PCB m_MicroViasMinSize;            // micro vias (not vias) min diameter
    //LENGTH_PCB m_MicroViasMinDrill;           // micro vias (not vias) min drill diameter

    // Global mask margins:
    int    m_SolderMaskMargin;            // Solder mask margin
+5 −0
Original line number Diff line number Diff line
@@ -22,6 +22,11 @@ public:
        m_Drill    = FROM_LEGACY_LU( 0 );
    }

    VIA_DIMENSION( LENGTH_PCB diam, LENGTH_PCB drill )
    {
        m_Diameter = diam;
        m_Drill    = drill;
    }

    bool operator ==( const VIA_DIMENSION& other ) const
    {
Loading