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

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
...@@ -903,8 +903,8 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas ) ...@@ -903,8 +903,8 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
int color; int color;
scale = g_Parm_3D_Visu.m_BoardScale; scale = g_Parm_3D_Visu.m_BoardScale;
holeX = (double) m_Drill.x * scale / 2; holeX = (double) TO_LEGACY_LU_DBL( m_Drill.x ) * scale / 2;
holeY = (double) m_Drill.y * scale / 2; holeY = (double) TO_LEGACY_LU_DBL( m_Drill.y ) * scale / 2;
hole = MIN( holeX, holeY ); hole = MIN( holeX, holeY );
/* Calculate the center of the pad. */ /* Calculate the center of the pad. */
...@@ -914,8 +914,8 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas ) ...@@ -914,8 +914,8 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
xc = ux0; xc = ux0;
yc = uy0; yc = uy0;
dx = dx0 = m_Size.x >> 1; dx = dx0 = TO_LEGACY_LU( m_Size.x ) >> 1;
dy = dy0 = m_Size.y >> 1; dy = dy0 = TO_LEGACY_LU( m_Size.y ) >> 1;
angle = m_Orient; angle = m_Orient;
drillx = m_Pos.x * scale; drillx = m_Pos.x * scale;
...@@ -980,13 +980,13 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas ) ...@@ -980,13 +980,13 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
{ {
delta_cx = dx - dy; delta_cx = dx - dy;
delta_cy = 0; delta_cy = 0;
w = m_Size.y * scale; w = TO_LEGACY_LU( m_Size.y ) * scale;
} }
else /* Vertical ellipse */ else /* Vertical ellipse */
{ {
delta_cx = 0; delta_cx = 0;
delta_cy = dy - dx; delta_cy = dy - dx;
w = m_Size.x * scale; w = TO_LEGACY_LU( m_Size.x ) * scale;
} }
RotatePoint( &delta_cx, &delta_cy, angle ); RotatePoint( &delta_cx, &delta_cy, angle );
......
...@@ -518,6 +518,20 @@ void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent& event ) ...@@ -518,6 +518,20 @@ void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent& event )
tmp << wxT( "OFF\n" ); tmp << wxT( "OFF\n" );
#endif #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=" ); tmp << wxT( " USE_WX_GRAPHICS_CONTEXT=" );
#ifdef USE_WX_GRAPHICS_CONTEXT #ifdef USE_WX_GRAPHICS_CONTEXT
tmp << wxT( "ON\n" ); tmp << wxT( "ON\n" );
......
...@@ -416,7 +416,7 @@ int ReturnValueFromString( EDA_UNITS_T aUnit, const wxString& TextValue, int Int ...@@ -416,7 +416,7 @@ int ReturnValueFromString( EDA_UNITS_T aUnit, const wxString& TextValue, int Int
*New common length functions *New common length functions
*/ */
const LENGTH_UNIT_DESC g_MillimetreDesc = const LENGTH_UNIT_DESC MillimetreDesc =
{ {
LENGTH_UNITS<LENGTH_DEF>::millimetre(), LENGTH_UNITS<LENGTH_DEF>::millimetre(),
wxT( "mm" ), wxT( "mm" ),
...@@ -424,7 +424,7 @@ const LENGTH_UNIT_DESC g_MillimetreDesc = ...@@ -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(), LENGTH_UNITS<LENGTH_DEF>::inch(),
wxT( "\"" ), wxT( "\"" ),
...@@ -432,7 +432,7 @@ const LENGTH_UNIT_DESC g_InchDesc = ...@@ -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(), LENGTH_UNITS<LENGTH_DEF>::mil(),
wxT( "mil" ), wxT( "mil" ),
...@@ -440,7 +440,7 @@ const LENGTH_UNIT_DESC g_MilDesc = ...@@ -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(), LENGTH_DEF::quantum(),
wxT( "" ), wxT( "" ),
...@@ -451,11 +451,11 @@ const LENGTH_UNIT_DESC g_UnscaledDesc = /* stub */ ...@@ -451,11 +451,11 @@ const LENGTH_UNIT_DESC g_UnscaledDesc = /* stub */
const LENGTH_UNIT_DESC *UnitDescription( EDA_UNITS_T aUnit ) { const LENGTH_UNIT_DESC *UnitDescription( EDA_UNITS_T aUnit ) {
switch(aUnit) { switch(aUnit) {
case INCHES: case INCHES:
return &g_InchDesc; return &InchDesc;
case MILLIMETRES: case MILLIMETRES:
return &g_MillimetreDesc; return &MillimetreDesc;
default: 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 ...@@ -533,15 +533,15 @@ LENGTH_DEF StringToLength( const LENGTH_UNIT_DESC *aUnit, const wxString& TextVa
if( unit == wxT( "in" ) || unit == wxT( "\"" ) ) if( unit == wxT( "in" ) || unit == wxT( "\"" ) )
{ {
aUnit = &g_InchDesc; aUnit = &InchDesc;
} }
else if( unit == wxT( "mm" ) ) else if( unit == wxT( "mm" ) )
{ {
aUnit = &g_MillimetreDesc; aUnit = &MillimetreDesc;
} }
else if( unit == wxT( "mi" ) || unit == wxT( "th" ) ) /* Mils or thous */ 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 ) ); Value = LENGTH_DEF( dtmp * LENGTH< double, 1 >( aUnit->m_Value ) );
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include "lengthpcb.h" #include "lengthpcb.h"
#include "class_via_dimension.h"
// Class for handle current printed board design settings // Class for handle current printed board design settings
class BOARD_DESIGN_SETTINGS class BOARD_DESIGN_SETTINGS
{ {
...@@ -25,10 +27,13 @@ public: ...@@ -25,10 +27,13 @@ public:
int m_PcbTextWidth; // current Pcb (not module) Text width int m_PcbTextWidth; // current Pcb (not module) Text width
wxSize m_PcbTextSize; // current Pcb (not module) Text size 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_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 VIA_DIMENSION m_MinVia;
LENGTH_PCB m_MicroViasMinSize; // micro vias (not vias) min diameter VIA_DIMENSION m_MinMicroVia;
LENGTH_PCB m_MicroViasMinDrill; // micro vias (not vias) min drill diameter //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: // Global mask margins:
int m_SolderMaskMargin; // Solder mask margin int m_SolderMaskMargin; // Solder mask margin
......
...@@ -22,6 +22,11 @@ public: ...@@ -22,6 +22,11 @@ public:
m_Drill = FROM_LEGACY_LU( 0 ); 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 bool operator ==( const VIA_DIMENSION& other ) const
{ {
......
...@@ -390,7 +390,7 @@ struct LENGTH_UNIT_DESC ...@@ -390,7 +390,7 @@ struct LENGTH_UNIT_DESC
int m_Precision; int m_Precision;
}; };
extern const LENGTH_UNIT_DESC g_MillimetreDesc, g_InchDesc, g_MilDesc; extern const LENGTH_UNIT_DESC MillimetreDesc, InchDesc, MilDesc;
const LENGTH_UNIT_DESC *UnitDescription( EDA_UNITS_T aUnit ); const LENGTH_UNIT_DESC *UnitDescription( EDA_UNITS_T aUnit );
...@@ -401,6 +401,37 @@ wxString LengthToString( const LENGTH_UNIT_DESC *aUnit, LENGTH_DEF aValu ...@@ -401,6 +401,37 @@ wxString LengthToString( const LENGTH_UNIT_DESC *aUnit, LENGTH_DEF aValu
void LengthToTextCtrl( wxTextCtrl& TextCtr, LENGTH_DEF Value ); void LengthToTextCtrl( wxTextCtrl& TextCtr, LENGTH_DEF Value );
LENGTH_DEF LengthFromTextCtrl( const wxTextCtrl& TextCtr ); LENGTH_DEF LengthFromTextCtrl( const wxTextCtrl& TextCtr );
/* transition macros */
#define STR_TO_LENGTH( unit, str, iu ) \
( StringToLength( UnitDescription( ( unit ) ), ( str ) ) )
#define LENGTH_TO_STR( unit, l, iu ) \
( LengthToString( UnitDescription( ( unit ) ), ( l ) ) )
#define LENGTH_TO_STR_SYM( unit, l, iu ) \
( LengthToString( UnitDescription( ( unit ) ), ( l ), true ) )
#define CTR_GET_LENGTH( ctr, iu ) \
( StringToLength( UnitDescription( g_UserUnit ), ( ctr ).GetValue() ) )
#define CTR_PUT_LENGTH( ctr, l, iu ) \
( ( ctr ).SetValue( LengthToString( UnitDescription( g_UserUnit ), ( l ) ) ) )
#else
#define STR_TO_LENGTH( unit, str, iu ) \
ReturnValueFromString( ( unit ), ( str ), ( iu ) )
#define LENGTH_TO_STR( unit, l, iu ) \
( ReturnStringFromValue( ( unit ), ( l ), ( iu ) ) )
#define LENGTH_TO_STR_SYM( unit, l, iu ) \
( ReturnStringFromValue( ( unit ), ( l ), ( iu ), true ) )
#define CTR_GET_LENGTH( ctr, iu ) \
ReturnValueFromString( g_UserUnit, ( ctr ).GetValue(), ( iu ) )
#define CTR_PUT_LENGTH( ctr, l, iu ) \
( ( ctr ).SetValue( ReturnStringFromValue( g_UserUnit, ( l ), ( iu ) ) ) )
#endif #endif
/** /**
......
...@@ -230,36 +230,50 @@ public: ...@@ -230,36 +230,50 @@ public:
return y / x.m_U; return y / x.m_U;
} }
friend LENGTH< T, P > sqrt( LENGTH< T, P*2 > y )
{
return sqrt( y.m_U );
}
friend LENGTH< T, P > cbrt( LENGTH< T, P*3 > y )
{
return cbrt( y.m_U );
}
/*************************/ /*************************/
/* assignment arithmetic */ /* assignment arithmetic */
/*************************/ /*************************/
LENGTH< T, P >& operator -= ( const LENGTH< T, P > y ) LENGTH< T, P >& operator -= ( const LENGTH< T, P > y )
{ {
return m_U -= y.m_U; m_U -= y.m_U;
return *this;
} }
LENGTH< T, P >& operator += ( const LENGTH< T, P > y ) LENGTH< T, P >& operator += ( const LENGTH< T, P > y )
{ {
return m_U += y.m_U; m_U += y.m_U;
return *this;
} }
LENGTH< T, P >& operator *= ( const T y ) LENGTH< T, P >& operator *= ( const T y )
{ {
return m_U *= y; m_U *= y;
return *this;
} }
LENGTH< T, P >& operator /= ( const T y ) LENGTH< T, P >& operator /= ( const T y )
{ {
return m_U /= y; m_U /= y;
return *this;
} }
/*************************/ /*************************/
/* more arithmetic */ /* more functions */
/*************************/ /*************************/
friend LENGTH< T, P > sqrt( LENGTH< T, P*2 > y )
{
return sqrt( y.m_U );
}
friend LENGTH< T, P > cbrt( LENGTH< T, P*3 > y )
{
return cbrt( y.m_U );
}
friend LENGTH< T, P > hypot( LENGTH< T, P > x, LENGTH< T, P > y )
{
return hypot( x.m_U, y.m_U );
}
friend double atan2( LENGTH< T, P > x, LENGTH< T, P > y )
{
return atan2( double ( x.m_U ), double( y.m_U ) );
}
}; };
/** /**
......
...@@ -20,13 +20,16 @@ typedef LENGTH< double, 1 > LENGTH_PCB_DBL; ...@@ -20,13 +20,16 @@ typedef LENGTH< double, 1 > LENGTH_PCB_DBL;
#define PCB_LEGACY_UNIT( T ) ( LENGTH_UNITS< T >::inch() / PCB_LEGACY_INCH_SCALE ) #define PCB_LEGACY_UNIT( T ) ( LENGTH_UNITS< T >::inch() / PCB_LEGACY_INCH_SCALE )
#define TO_LEGACY_LU( x ) \ #define TO_LEGACY_LU( x ) \
( LENGTH_PCB( x ) / PCB_LEGACY_UNIT( LENGTH_PCB ) ) ( (int) ( LENGTH_PCB( x ) / PCB_LEGACY_UNIT( LENGTH_PCB ) ) )
#define TO_LEGACY_LU_DBL( x ) \ #define TO_LEGACY_LU_DBL( x ) \
( LENGTH_PCB_DBL( x ) / PCB_LEGACY_UNIT( LENGTH_PCB_DBL ) ) ( (double) ( LENGTH_PCB_DBL( x ) / PCB_LEGACY_UNIT( LENGTH_PCB_DBL ) ) )
static LENGTH_PCB from_legacy_lu( int x ) { static LENGTH_PCB from_legacy_lu( int x ) {
return x * PCB_LEGACY_UNIT( LENGTH_PCB ); return x * PCB_LEGACY_UNIT( LENGTH_PCB );
} }
static LENGTH_PCB from_legacy_lu( long x ) {
return x * PCB_LEGACY_UNIT( LENGTH_PCB );
}
static LENGTH_PCB from_legacy_lu( double x ) { static LENGTH_PCB from_legacy_lu( double x ) {
return LENGTH_PCB( x * PCB_LEGACY_UNIT( LENGTH_PCB_DBL ) ); return LENGTH_PCB( x * PCB_LEGACY_UNIT( LENGTH_PCB_DBL ) );
} }
...@@ -41,6 +44,10 @@ static LENGTH_PCB_DBL from_legacy_lu_dbl( double x ) { ...@@ -41,6 +44,10 @@ static LENGTH_PCB_DBL from_legacy_lu_dbl( double x ) {
#define ZERO_LENGTH ( LENGTH_PCB::zero() ) #define ZERO_LENGTH ( LENGTH_PCB::zero() )
/* SAVE FILE macros */
#define FM_LENSV "%lf" ///< format specifier for saving
#define ARG_LENSV( x ) TO_LEGACY_LU_DBL( x ) ///< argument for saving
#else #else
typedef int LENGTH_PCB; typedef int LENGTH_PCB;
...@@ -56,7 +63,72 @@ typedef double LENGTH_PCB_DBL; ...@@ -56,7 +63,72 @@ typedef double LENGTH_PCB_DBL;
#define ZERO_LENGTH 0 #define ZERO_LENGTH 0
/* SAVE FILE macros */
/** @TODO: after transition process this could be wrapped in some class */
#define FM_LENSV "%d"
#define ARG_LENSV( x ) ( (int)( x ) )
#endif #endif
/* LOAD FILE macros */
#define FM_LENLD "%lf" ///< scanf format macro for loading
#define ARG_LENLD_TYPE double ///< tmp variable for length read
// they're set to flat type to help the transition process
// there would be some period while program gain ability to
// load float data but not acually save it
#define LENGTH_LOAD_TMP( x ) ( FROM_LEGACY_LU( x ) ) ///< reads tmp value from above
#define LENGTH_LOAD_STR( s ) ( FROM_LEGACY_LU( atof( s ) ) ) ///< reads string
/// @TODO: nice template and refiling for it
struct VECTOR_PCB
{
LENGTH_PCB x, y;
VECTOR_PCB()
{
}
VECTOR_PCB( LENGTH_PCB ax, LENGTH_PCB ay ): x( ax ), y( ay )
{
}
bool operator == ( const VECTOR_PCB &a ) const {
return x == a.x && y == a.y;
}
bool operator != ( const VECTOR_PCB &a ) const {
return x != a.x || y != a.y;
}
VECTOR_PCB & operator = (const VECTOR_PCB &a ) {
x = a.x;
y = a.y;
return *this;
}
VECTOR_PCB & operator += (const VECTOR_PCB &a ) {
x += a.x;
y += a.y;
return *this;
}
VECTOR_PCB & operator -= (const VECTOR_PCB &a ) {
x -= a.x;
y -= a.y;
return *this;
}
VECTOR_PCB operator + (VECTOR_PCB add) const {
return VECTOR_PCB(x + add.x, y + add.y);
}
VECTOR_PCB operator - (VECTOR_PCB add) const {
return VECTOR_PCB(x - add.x, y - add.y);
}
VECTOR_PCB operator * (int factor) const {
return VECTOR_PCB(x * factor, y * factor);
}
VECTOR_PCB operator / (int factor) const {
return VECTOR_PCB(x / factor, y / factor);
}
};
#define TO_LEGACY_LU_WXP( p ) ( wxPoint( TO_LEGACY_LU( ( p ).x ), TO_LEGACY_LU( ( p ).y ) ) )
#define TO_LEGACY_LU_WXS( p ) ( wxSize( TO_LEGACY_LU( ( p ).x ), TO_LEGACY_LU( ( p ).y ) ) )
#define FROM_LEGACY_LU_VEC( p ) ( VECTOR_PCB( FROM_LEGACY_LU( ( p ).x ), FROM_LEGACY_LU( ( p ).y ) ) )
#endif /* def LENGTHPCB_H_INCLUDED */ #endif /* def LENGTHPCB_H_INCLUDED */
...@@ -164,6 +164,11 @@ public: ...@@ -164,6 +164,11 @@ public:
return x + double( y.m_Value ); return x + double( y.m_Value );
} }
LIMITED_INT< T > operator - ( void ) const
{
assert( -std::numeric_limits< T >::max() <= m_Value );
return -m_Value;
}
LIMITED_INT< T > operator - ( const LIMITED_INT< T > &y ) const LIMITED_INT< T > operator - ( const LIMITED_INT< T > &y ) const
{ {
assert( !( 0 < m_Value ) || m_Value - std::numeric_limits< T >::max() <= y.m_Value ); assert( !( 0 < m_Value ) || m_Value - std::numeric_limits< T >::max() <= y.m_Value );
......
...@@ -65,7 +65,8 @@ static inline const wxChar* GetChars( const wxString& s ) ...@@ -65,7 +65,8 @@ static inline const wxChar* GetChars( const wxString& s )
#endif #endif
#ifndef ABS #ifndef ABS
#define ABS( y ) ( (y) >= 0 ? (y) : ( -(y) ) ) #define ABS( y ) ( MAX( ( y ), ( -y ) ) )
// dirty trick: now this should work with LENGTH<> too
#endif #endif
#define NEGATE( x ) (x = -x) #define NEGATE( x ) (x = -x)
......
...@@ -460,7 +460,7 @@ void MoveMarkedItems( MODULE* module, wxPoint offset ) ...@@ -460,7 +460,7 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
continue; continue;
pad->SetPosition( pad->GetPosition() + offset ); pad->SetPosition( pad->GetPosition() + offset );
pad->m_Pos0 += offset; pad->m_Pos0 += FROM_LEGACY_LU_VEC( offset );
} }
item = module->m_Drawings; item = module->m_Drawings;
...@@ -550,7 +550,7 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset ) ...@@ -550,7 +550,7 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
continue; continue;
SETMIRROR( pad->GetPosition().x ); SETMIRROR( pad->GetPosition().x );
pad->m_Pos0.x = pad->GetPosition().x; pad->m_Pos0.x = FROM_LEGACY_LU( pad->GetPosition().x );
NEGATE( pad->m_Offset.x ); NEGATE( pad->m_Offset.x );
NEGATE( pad->m_DeltaSize.x ); NEGATE( pad->m_DeltaSize.x );
pad->m_Orient = 1800 - pad->m_Orient; pad->m_Orient = 1800 - pad->m_Orient;
...@@ -610,7 +610,7 @@ void RotateMarkedItems( MODULE* module, wxPoint offset ) ...@@ -610,7 +610,7 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
continue; continue;
ROTATE( pad->GetPosition() ); ROTATE( pad->GetPosition() );
pad->m_Pos0 = pad->GetPosition(); pad->m_Pos0 = FROM_LEGACY_LU_VEC( pad->GetPosition() );
pad->m_Orient += 900; pad->m_Orient += 900;
NORMALIZE_ANGLE_POS( pad->m_Orient ); NORMALIZE_ANGLE_POS( pad->m_Orient );
} }
......
...@@ -328,13 +328,13 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor ...@@ -328,13 +328,13 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor
{ {
wxPoint corner_position; wxPoint corner_position;
int ii, angle; int ii, angle;
int dx = (m_Size.x / 2) + aClearanceValue; int dx = TO_LEGACY_LU( m_Size.x / 2 ) + aClearanceValue;
int dy = (m_Size.y / 2) + aClearanceValue; int dy = TO_LEGACY_LU( m_Size.y / 2 ) + aClearanceValue;
int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree
wxPoint PadShapePos = ReturnShapePos(); /* Note: for pad having a shape offset, wxPoint PadShapePos = ReturnShapePos(); /* Note: for pad having a shape offset,
* the pad position is NOT the shape position */ * the pad position is NOT the shape position */
wxSize psize = m_Size; /* pad size unsed in RECT and TRAPEZOIDAL pads wxSize psize = TO_LEGACY_LU_WXS( m_Size ); /* pad size unsed in RECT and TRAPEZOIDAL pads
* trapezoidal pads are considered as rect * trapezoidal pads are considered as rect
* pad shape having they boudary box size */ * pad shape having they boudary box size */
...@@ -437,8 +437,8 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor ...@@ -437,8 +437,8 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor
default: default:
case PAD_TRAPEZOID: case PAD_TRAPEZOID:
psize.x += ABS( m_DeltaSize.y ); psize.x += TO_LEGACY_LU( ABS( m_DeltaSize.y ) );
psize.y += ABS( m_DeltaSize.x ); psize.y += TO_LEGACY_LU( ABS( m_DeltaSize.x ) );
// fall through // fall through
case PAD_RECT: case PAD_RECT:
...@@ -572,8 +572,8 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer, ...@@ -572,8 +572,8 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
wxPoint PadShapePos = aPad.ReturnShapePos(); /* Note: for pad having a shape offset, wxPoint PadShapePos = aPad.ReturnShapePos(); /* Note: for pad having a shape offset,
* the pad position is NOT the shape position */ * the pad position is NOT the shape position */
wxSize copper_thickness; wxSize copper_thickness;
int dx = aPad.m_Size.x / 2; int dx = TO_LEGACY_LU( aPad.m_Size.x / 2 );
int dy = aPad.m_Size.y / 2; int dy = TO_LEGACY_LU( aPad.m_Size.y / 2 );
int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree
...@@ -684,8 +684,8 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer, ...@@ -684,8 +684,8 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
// Oval pad support along the lines of round and rectangular pads // Oval pad support along the lines of round and rectangular pads
std::vector <wxPoint> corners_buffer; // Polygon buffer as vector std::vector <wxPoint> corners_buffer; // Polygon buffer as vector
int dx = (aPad.m_Size.x / 2) + aThermalGap; // Cutout radius x int dx = TO_LEGACY_LU( aPad.m_Size.x / 2 ) + aThermalGap; // Cutout radius x
int dy = (aPad.m_Size.y / 2) + aThermalGap; // Cutout radius y int dy = TO_LEGACY_LU( aPad.m_Size.y / 2 ) + aThermalGap; // Cutout radius y
wxPoint shape_offset; wxPoint shape_offset;
...@@ -839,8 +839,8 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer, ...@@ -839,8 +839,8 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
std::vector <wxPoint> corners_buffer; // Polygon buffer as vector std::vector <wxPoint> corners_buffer; // Polygon buffer as vector
int dx = (aPad.m_Size.x / 2) + aThermalGap; // Cutout radius x int dx = TO_LEGACY_LU( aPad.m_Size.x / 2 ) + aThermalGap; // Cutout radius x
int dy = (aPad.m_Size.y / 2) + aThermalGap; // Cutout radius y int dy = TO_LEGACY_LU( aPad.m_Size.y / 2 ) + aThermalGap; // Cutout radius y
// The first point of polygon buffer is left lower corner, second the crosspoint of // The first point of polygon buffer is left lower corner, second the crosspoint of
// thermal spoke sides, the third is upper right corner and the rest are rounding // thermal spoke sides, the third is upper right corner and the rest are rounding
...@@ -861,7 +861,7 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer, ...@@ -861,7 +861,7 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
RotatePoint( &corner_position, 1800 / aCircleToSegmentsCount ); // Start at half increment offset RotatePoint( &corner_position, 1800 / aCircleToSegmentsCount ); // Start at half increment offset
angle_pg = i * delta; angle_pg = i * delta;
RotatePoint( &corner_position, angle_pg ); // Rounding vector rotation RotatePoint( &corner_position, angle_pg ); // Rounding vector rotation
corner_position -= aPad.m_Size / 2; // Rounding vector + Pad corner offset corner_position -= TO_LEGACY_LU_WXS( aPad.m_Size / 2 ); // Rounding vector + Pad corner offset
corners_buffer.push_back( wxPoint( corner_position.x, corner_position.y ) ); corners_buffer.push_back( wxPoint( corner_position.x, corner_position.y ) );
} }
......
...@@ -2003,13 +2003,13 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, ...@@ -2003,13 +2003,13 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace,
if( track->GetState( BEGIN_ONPAD ) ) if( track->GetState( BEGIN_ONPAD ) )
{ {
D_PAD * pad = (D_PAD *) track->start; D_PAD * pad = (D_PAD *) track->start;
lenDie += (double) pad->m_LengthDie; lenDie += TO_LEGACY_LU_DBL( pad->m_LengthDie );
} }
if( track->GetState( END_ONPAD ) ) if( track->GetState( END_ONPAD ) )
{ {
D_PAD * pad = (D_PAD *) track->end; D_PAD * pad = (D_PAD *) track->end;
lenDie += (double) pad->m_LengthDie; lenDie += TO_LEGACY_LU_DBL( pad->m_LengthDie );
} }
} }
} }
...@@ -2033,13 +2033,13 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, ...@@ -2033,13 +2033,13 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace,
if( track->GetState( BEGIN_ONPAD ) ) if( track->GetState( BEGIN_ONPAD ) )
{ {
D_PAD * pad = (D_PAD *) track->start; D_PAD * pad = (D_PAD *) track->start;
lenDie += (double) pad->m_LengthDie; lenDie += TO_LEGACY_LU_DBL( pad->m_LengthDie );
} }
if( track->GetState( END_ONPAD ) ) if( track->GetState( END_ONPAD ) )
{ {
D_PAD * pad = (D_PAD *) track->end; D_PAD * pad = (D_PAD *) track->end;
lenDie += (double) pad->m_LengthDie; lenDie += TO_LEGACY_LU_DBL( pad->m_LengthDie );
} }
} }
} }
......
...@@ -33,10 +33,12 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() ...@@ -33,10 +33,12 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS()
m_PcbTextWidth = 100; // current Pcb (not module) Text width m_PcbTextWidth = 100; // current Pcb (not module) Text width
m_PcbTextSize = wxSize( 500, 500 ); // current Pcb (not module) Text size m_PcbTextSize = wxSize( 500, 500 ); // current Pcb (not module) Text size
m_TrackMinWidth = FROM_LEGACY_LU( 80 ); // track min value for width ((min copper size value m_TrackMinWidth = FROM_LEGACY_LU( 80 ); // track min value for width ((min copper size value
m_ViasMinSize = FROM_LEGACY_LU( 350 ); // vias (not micro vias) min diameter m_MinVia = VIA_DIMENSION( FROM_LEGACY_LU( 350 ), FROM_LEGACY_LU( 200 ) );
m_ViasMinDrill = FROM_LEGACY_LU( 200 ); // vias (not micro vias) min drill diameter m_MinMicroVia = VIA_DIMENSION( FROM_LEGACY_LU( 200 ), FROM_LEGACY_LU( 50 ) );
m_MicroViasMinSize = FROM_LEGACY_LU( 200 ); // micro vias (not vias) min diameter //m_ViasMinSize = FROM_LEGACY_LU( 350 ); // vias (not micro vias) min diameter
m_MicroViasMinDrill = FROM_LEGACY_LU( 50 ); // micro vias (not vias) min drill diameter //m_ViasMinDrill = FROM_LEGACY_LU( 200 ); // vias (not micro vias) min drill diameter
//m_MicroViasMinSize = FROM_LEGACY_LU( 200 ); // micro vias (not vias) min diameter
//m_MicroViasMinDrill = FROM_LEGACY_LU( 50 ); // micro vias (not vias) min drill diameter
// Global mask margins: // Global mask margins:
m_SolderMaskMargin = 150; // Solder mask margin m_SolderMaskMargin = 150; // Solder mask margin
......
...@@ -352,8 +352,8 @@ void MODULE::SetOrientation( int newangle ) ...@@ -352,8 +352,8 @@ void MODULE::SetOrientation( int newangle )
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() ) for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
{ {
px = pad->m_Pos0.x; px = TO_LEGACY_LU( pad->m_Pos0.x );
py = pad->m_Pos0.y; py = TO_LEGACY_LU( pad->m_Pos0.y );
pad->m_Orient += newangle; /* change m_Orientation */ pad->m_Orient += newangle; /* change m_Orientation */
NORMALIZE_ANGLE_POS( pad->m_Orient ); NORMALIZE_ANGLE_POS( pad->m_Orient );
......
...@@ -42,8 +42,8 @@ extern BOARD_DESIGN_SETTINGS boardDesignSettings; ...@@ -42,8 +42,8 @@ extern BOARD_DESIGN_SETTINGS boardDesignSettings;
const wxString NETCLASS::Default = wxT("Default"); const wxString NETCLASS::Default = wxT("Default");
// Initial values for netclass initialization // Initial values for netclass initialization
int NETCLASS::DEFAULT_CLEARANCE = 100; // track to track and track to pads clearance int NETCLASS::DEFAULT_CLEARANCE = 100; // track to track and track to pads clearance
int NETCLASS::DEFAULT_VIA_DRILL = 250; // default via drill int NETCLASS::DEFAULT_VIA_DRILL = 250; // default via drill (TODO: should be gone on refactoring)
int NETCLASS::DEFAULT_UVIA_DRILL = 50; // micro via drill int NETCLASS::DEFAULT_UVIA_DRILL = 50; // micro via drill (TODO: --"--)
NETCLASS::NETCLASS( BOARD* aParent, const wxString& aName, const NETCLASS* initialParameters ) : NETCLASS::NETCLASS( BOARD* aParent, const wxString& aName, const NETCLASS* initialParameters ) :
...@@ -55,36 +55,39 @@ NETCLASS::NETCLASS( BOARD* aParent, const wxString& aName, const NETCLASS* initi ...@@ -55,36 +55,39 @@ NETCLASS::NETCLASS( BOARD* aParent, const wxString& aName, const NETCLASS* initi
SetParams( initialParameters ); SetParams( initialParameters );
} }
void NETCLASS::SetParams( const NETCLASS* defaults ) void NETCLASS::SetParams( const NETCLASS* defaults )
{ {
if( defaults ) if( defaults )
{ {
SetClearance( defaults->GetClearance() ); SetClearance( defaults->GetClearance() );
SetTrackWidth( defaults->GetTrackWidth() ); SetTrackWidth( defaults->GetTrackWidth() );
SetViaDiameter( defaults->GetViaDiameter() ); Via( defaults->Via() );
SetViaDrill( defaults->GetViaDrill() ); MicroVia( defaults->MicroVia() );
SetuViaDiameter( defaults->GetuViaDiameter() );
SetuViaDrill( defaults->GetuViaDrill() );
} }
else else
{ // We should use m_Parent->GetBoardDesignSettings() {
// But when the NETCLASSES constructor is called SetToDefault();
// (it call NETCLASS constructor), the m_Parent constructor (see BOARD::BOARD)
// is not run, and GetBoardDesignSettings() return a bad value
// TODO: see how change that.
const BOARD_DESIGN_SETTINGS& g = boardDesignSettings;
SetTrackWidth( TO_LEGACY_LU( g.m_TrackMinWidth ) );
SetViaDiameter( TO_LEGACY_LU( g.m_ViasMinSize ) );
SetuViaDiameter( TO_LEGACY_LU( g.m_MicroViasMinSize ) );
// Use default values for next parameters:
SetClearance( DEFAULT_CLEARANCE );
SetViaDrill( DEFAULT_VIA_DRILL );
SetuViaDrill( DEFAULT_UVIA_DRILL );
} }
} }
void NETCLASS::SetToDefault()
{
// We should use m_Parent->GetBoardDesignSettings()
// But when the NETCLASSES constructor is called
// (it call NETCLASS constructor), the m_Parent constructor (see BOARD::BOARD)
// is not run, and GetBoardDesignSettings() return a bad value
// TODO: see how change that.
const BOARD_DESIGN_SETTINGS& g = boardDesignSettings;
TrackWidth( g.m_TrackMinWidth );
//SetViaDrill( TO_LEGACY_LU( g.m_ViasMinDrill ) ); // was DEFAULT_VIA_DRILL
//SetuViaDrill( TO_LEGACY_LU( g.m_MicroViasMinDrill ) ); // DEFAULT_UVIA_DRILL
Via( g.m_MinVia );
MicroVia( g.m_MinMicroVia );
// Use default values for next parameters:
Clearance( FROM_LEGACY_LU( DEFAULT_CLEARANCE ) );
}
NETCLASS::~NETCLASS() NETCLASS::~NETCLASS()
{ {
...@@ -294,14 +297,14 @@ bool NETCLASS::Save( FILE* aFile ) const ...@@ -294,14 +297,14 @@ bool NETCLASS::Save( FILE* aFile ) const
// Write parameters // Write parameters
fprintf( aFile, "Clearance %d\n", GetClearance() ); fprintf( aFile, "Clearance %f\n", TO_LEGACY_LU_DBL( Clearance() ) );
fprintf( aFile, "TrackWidth %d\n", GetTrackWidth() ); fprintf( aFile, "TrackWidth %f\n", TO_LEGACY_LU_DBL( TrackWidth() ) );
fprintf( aFile, "ViaDia %d\n", GetViaDiameter() ); fprintf( aFile, "ViaDia %f\n", TO_LEGACY_LU_DBL( Via().m_Diameter ) );
fprintf( aFile, "ViaDrill %d\n", GetViaDrill() ); fprintf( aFile, "ViaDrill %f\n", TO_LEGACY_LU_DBL( Via().m_Drill ) );
fprintf( aFile, "uViaDia %d\n", GetuViaDiameter() ); fprintf( aFile, "uViaDia %f\n", TO_LEGACY_LU_DBL( MicroVia().m_Diameter ) );
fprintf( aFile, "uViaDrill %d\n", GetuViaDrill() ); fprintf( aFile, "uViaDrill %f\n", TO_LEGACY_LU_DBL( MicroVia().m_Drill ) );
// Write members: // Write members:
for( const_iterator i = begin(); i!=end(); ++i ) for( const_iterator i = begin(); i!=end(); ++i )
...@@ -342,6 +345,8 @@ bool NETCLASS::ReadDescr( LINE_READER* aReader ) ...@@ -342,6 +345,8 @@ bool NETCLASS::ReadDescr( LINE_READER* aReader )
char* Line; char* Line;
char Buffer[1024]; char Buffer[1024];
wxString netname; wxString netname;
VIA_DIMENSION via = Via();
VIA_DIMENSION uvia = MicroVia();
while( aReader->ReadLine() ) while( aReader->ReadLine() )
{ {
...@@ -362,33 +367,37 @@ bool NETCLASS::ReadDescr( LINE_READER* aReader ) ...@@ -362,33 +367,37 @@ bool NETCLASS::ReadDescr( LINE_READER* aReader )
if( strnicmp( Line, "Clearance", 9 ) == 0 ) if( strnicmp( Line, "Clearance", 9 ) == 0 )
{ {
SetClearance( atoi( Line + 9 ) ); Clearance( FROM_LEGACY_LU( atof( Line + 9 ) ) );
continue; continue;
} }
if( strnicmp( Line, "TrackWidth", 10 ) == 0 ) if( strnicmp( Line, "TrackWidth", 10 ) == 0 )
{ {
SetTrackWidth( atoi( Line + 10 ) ); TrackWidth( FROM_LEGACY_LU( atof( Line + 10 ) ) );
continue; continue;
} }
if( strnicmp( Line, "ViaDia", 6 ) == 0 ) if( strnicmp( Line, "ViaDia", 6 ) == 0 )
{ {
SetViaDiameter( atoi( Line + 6 ) ); via.m_Diameter = FROM_LEGACY_LU( atof( Line + 6 ) );
Via(via);
continue; continue;
} }
if( strnicmp( Line, "ViaDrill", 8 ) == 0 ) if( strnicmp( Line, "ViaDrill", 8 ) == 0 )
{ {
SetViaDrill( atoi( Line + 8 ) ); via.m_Drill = FROM_LEGACY_LU( atof( Line + 8 ) );
Via(via);
continue; continue;
} }
if( strnicmp( Line, "uViaDia", 7 ) == 0 ) if( strnicmp( Line, "uViaDia", 7 ) == 0 )
{ {
SetuViaDiameter( atoi( Line + 7 ) ); uvia.m_Diameter = FROM_LEGACY_LU( atof( Line + 7 ) );
MicroVia(uvia);
continue; continue;
} }
if( strnicmp( Line, "uViaDrill", 9 ) == 0 ) if( strnicmp( Line, "uViaDrill", 9 ) == 0 )
{ {
SetuViaDrill( atoi( Line + 9 ) ); uvia.m_Drill = FROM_LEGACY_LU( atof( Line + 9 ) );
MicroVia(uvia);
continue; continue;
} }
...@@ -417,22 +426,22 @@ int NETCLASS::GetTrackMinWidth() const ...@@ -417,22 +426,22 @@ int NETCLASS::GetTrackMinWidth() const
int NETCLASS::GetViaMinDiameter() const int NETCLASS::GetViaMinDiameter() const
{ {
return TO_LEGACY_LU( m_Parent->GetBoardDesignSettings()->m_ViasMinSize ); return TO_LEGACY_LU( m_Parent->GetBoardDesignSettings()->m_MinVia.m_Diameter );
} }
int NETCLASS::GetViaMinDrill() const int NETCLASS::GetViaMinDrill() const
{ {
return TO_LEGACY_LU( m_Parent->GetBoardDesignSettings()->m_ViasMinDrill ); return TO_LEGACY_LU( m_Parent->GetBoardDesignSettings()->m_MinVia.m_Drill );
} }
int NETCLASS::GetuViaMinDiameter() const int NETCLASS::GetuViaMinDiameter() const
{ {
return TO_LEGACY_LU( m_Parent->GetBoardDesignSettings()->m_MicroViasMinSize ); return TO_LEGACY_LU( m_Parent->GetBoardDesignSettings()->m_MinMicroVia.m_Diameter );
} }
int NETCLASS::GetuViaMinDrill() const int NETCLASS::GetuViaMinDrill() const
{ {
return TO_LEGACY_LU( m_Parent->GetBoardDesignSettings()->m_MicroViasMinDrill ); return TO_LEGACY_LU( m_Parent->GetBoardDesignSettings()->m_MinMicroVia.m_Drill );
} }
...@@ -178,7 +178,7 @@ public: ...@@ -178,7 +178,7 @@ public:
int GetTrackWidth() const { return TO_LEGACY_LU( m_TrackWidth ); } int GetTrackWidth() const { return TO_LEGACY_LU( m_TrackWidth ); }
int GetTrackMinWidth() const; int GetTrackMinWidth() const;
void SetTrackWidth( int aWidth ) { m_TrackWidth = FROM_LEGACY_LU( aWidth ); } void SetTrackWidth( int aWidth ) { m_TrackWidth = FROM_LEGACY_LU( aWidth ); }
int GetViaDiameter() const { return TO_LEGACY_LU( m_Via.m_Diameter ); } int GetViaDiameter() const { return TO_LEGACY_LU( m_Via.m_Diameter ); }
int GetViaMinDiameter() const; int GetViaMinDiameter() const;
void SetViaDiameter( int aDia ) { m_Via.m_Diameter = FROM_LEGACY_LU( aDia ); } void SetViaDiameter( int aDia ) { m_Via.m_Diameter = FROM_LEGACY_LU( aDia ); }
...@@ -195,6 +195,17 @@ public: ...@@ -195,6 +195,17 @@ public:
int GetuViaMinDrill() const; int GetuViaMinDrill() const;
void SetuViaDrill( int aSize ) { m_uVia.m_Drill = FROM_LEGACY_LU( aSize ); } void SetuViaDrill( int aSize ) { m_uVia.m_Drill = FROM_LEGACY_LU( aSize ); }
LENGTH_PCB Clearance() const { return m_Clearance; }
LENGTH_PCB Clearance( const LENGTH_PCB a ) { return m_Clearance = a; }
LENGTH_PCB TrackWidth() const { return m_TrackWidth; }
LENGTH_PCB TrackWidth( const LENGTH_PCB a ) { return m_TrackWidth = a; }
VIA_DIMENSION Via() const { return m_Via; }
VIA_DIMENSION Via( const VIA_DIMENSION a ) { return m_Via = a; }
VIA_DIMENSION MicroVia() const { return m_uVia; }
VIA_DIMENSION MicroVia( const VIA_DIMENSION a ) { return m_uVia = a; }
/** /**
* Function SetParams * Function SetParams
...@@ -205,6 +216,11 @@ public: ...@@ -205,6 +216,11 @@ public:
*/ */
void SetParams( const NETCLASS* defaults = NULL ); void SetParams( const NETCLASS* defaults = NULL );
/**
* Sets Parameters to their default state.
*/
void SetToDefault();
/** /**
* Function Save * Function Save
* writes the data structures for this object out to a FILE in "*.brd" format. * writes the data structures for this object out to a FILE in "*.brd" format.
......
...@@ -153,7 +153,7 @@ void NETINFO_ITEM::DisplayInfo( EDA_DRAW_FRAME* frame ) ...@@ -153,7 +153,7 @@ void NETINFO_ITEM::DisplayInfo( EDA_DRAW_FRAME* frame )
if( pad->GetNet() == GetNet() ) if( pad->GetNet() == GetNet() )
{ {
count++; count++;
lengthdie += pad->m_LengthDie; lengthdie += TO_LEGACY_LU_DBL( pad->m_LengthDie );
} }
} }
} }
......
This diff is collapsed.
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#include "pad_shapes.h" #include "pad_shapes.h"
#include "PolyLine.h" #include "PolyLine.h"
#include "lengthpcb.h"
class LINE_READER; class LINE_READER;
class EDA_3D_CANVAS; class EDA_3D_CANVAS;
...@@ -85,14 +87,17 @@ public: ...@@ -85,14 +87,17 @@ public:
// 2..14 = internal layers // 2..14 = internal layers
// 16 .. 31 = technical layers // 16 .. 31 = technical layers
int m_PadShape; // Shape: PAD_CIRCLE, PAD_RECT, PAD_OVAL, PAD_TRAPEZOID int m_PadShape; ///< Shape: PAD_CIRCLE, PAD_RECT, PAD_OVAL, PAD_TRAPEZOID
int m_DrillShape; // Shape PAD_CIRCLE, PAD_OVAL int m_DrillShape; ///< Shape PAD_CIRCLE, PAD_OVAL
/// @TODO: as m_DrillShape is eqv. to m_Drill.x==.y
/// it would be relatively easy to remove
/// this redundant flag.
wxSize m_Drill; // Drill diam (drill shape = PAD_CIRCLE) or drill size VECTOR_PCB m_Drill; ///< Drill diam (drill shape = PAD_CIRCLE) or drill size
// (shape = OVAL) for drill shape = PAD_CIRCLE, drill /// (shape = OVAL) for drill shape = PAD_CIRCLE, drill
// diam = m_Drill.x /// diam = m_Drill.x
wxSize m_Offset; /* This parameter is useful only for oblong pads (it can be used for other VECTOR_PCB m_Offset; /* This parameter is useful only for oblong pads (it can be used for other
* shapes, but without any interest). * shapes, but without any interest).
* this is the offset between the pad hole and the pad shape (you must * this is the offset between the pad hole and the pad shape (you must
* understand here pad shape = copper area around the hole) * understand here pad shape = copper area around the hole)
...@@ -105,11 +110,11 @@ public: ...@@ -105,11 +110,11 @@ public:
* D_PAD::ReturnShapePos() returns the physical shape position according to * D_PAD::ReturnShapePos() returns the physical shape position according to
* the offset and the pad rotation.*/ * the offset and the pad rotation.*/
wxSize m_Size; // X and Y size ( relative to orient 0) VECTOR_PCB m_Size; // X and Y size ( relative to orient 0)
wxSize m_DeltaSize; // delta on rectangular shapes VECTOR_PCB m_DeltaSize; // delta on rectangular shapes
wxPoint m_Pos0; // Initial Pad position (i.e. pas position relative to the VECTOR_PCB m_Pos0; // Initial Pad position (i.e. pas position relative to the
// module anchor, orientation 0 // module anchor, orientation 0
int m_ShapeMaxRadius; // radius of the circle containing the pad shape int m_ShapeMaxRadius; // radius of the circle containing the pad shape
...@@ -118,16 +123,16 @@ public: ...@@ -118,16 +123,16 @@ public:
static int m_PadSketchModePenSize; // Pen size used to draw pads in sketch mode static int m_PadSketchModePenSize; // Pen size used to draw pads in sketch mode
// (mode used to print pads on silkscreen layer) // (mode used to print pads on silkscreen layer)
int m_LengthDie; // Length net from pad to die on chip LENGTH_PCB m_LengthDie; // Length net from pad to die on chip
// Local clearance. When null, the module default value is used. // Local clearance. When null, the module default value is used.
// when the module default value is null, the netclass value is used // when the module default value is null, the netclass value is used
// Usually the local clearance is null // Usually the local clearance is null
int m_LocalClearance; LENGTH_PCB m_LocalClearance;
// Local mask margins: when NULL, the parent footprint design values are used // Local mask margins: when NULL, the parent footprint design values are used
int m_LocalSolderMaskMargin; // Local solder mask margin LENGTH_PCB m_LocalSolderMaskMargin; // Local solder mask margin
int m_LocalSolderPasteMargin; // Local solder paste margin absolute value LENGTH_PCB m_LocalSolderPasteMargin; // Local solder paste margin absolute value
double m_LocalSolderPasteMarginRatio; // Local solder mask margin ratio value of pad size double m_LocalSolderPasteMarginRatio; // Local solder mask margin ratio value of pad size
// The final margin is the sum of these 2 values // The final margin is the sum of these 2 values
......
...@@ -392,9 +392,9 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) ...@@ -392,9 +392,9 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
// calculate pad shape position : // calculate pad shape position :
wxPoint shape_pos = ReturnShapePos() - aDrawInfo.m_Offset; wxPoint shape_pos = ReturnShapePos() - aDrawInfo.m_Offset;
wxSize halfsize = m_Size; wxSize halfsize = TO_LEGACY_LU_WXS( m_Size );
halfsize.x >>= 1; halfsize.x /= 2;
halfsize.y >>= 1; halfsize.y /= 2;
switch( GetShape() ) switch( GetShape() )
{ {
...@@ -476,7 +476,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) ...@@ -476,7 +476,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
/* Draw the pad hole */ /* Draw the pad hole */
wxPoint holepos = m_Pos - aDrawInfo.m_Offset; wxPoint holepos = m_Pos - aDrawInfo.m_Offset;
int hole = m_Drill.x >> 1; int hole = TO_LEGACY_LU( m_Drill.x ) / 2;
bool drawhole = hole > 0; bool drawhole = hole > 0;
...@@ -513,20 +513,20 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) ...@@ -513,20 +513,20 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
break; break;
case PAD_OVAL: case PAD_OVAL:
halfsize.x = m_Drill.x >> 1; halfsize.x = TO_LEGACY_LU( m_Drill.x ) / 2;
halfsize.y = m_Drill.y >> 1; halfsize.y = TO_LEGACY_LU( m_Drill.y ) / 2;
if( m_Drill.x > m_Drill.y ) /* horizontal */ if( m_Drill.x > m_Drill.y ) /* horizontal */
{ {
delta_cx = halfsize.x - halfsize.y; delta_cx = halfsize.x - halfsize.y;
delta_cy = 0; delta_cy = 0;
seg_width = m_Drill.y; seg_width = TO_LEGACY_LU( m_Drill.y );
} }
else /* vertical */ else /* vertical */
{ {
delta_cx = 0; delta_cx = 0;
delta_cy = halfsize.y - halfsize.x; delta_cy = halfsize.y - halfsize.x;
seg_width = m_Drill.x; seg_width = TO_LEGACY_LU( m_Drill.x );
} }
RotatePoint( &delta_cx, &delta_cy, angle ); RotatePoint( &delta_cx, &delta_cy, angle );
...@@ -576,13 +576,13 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) ...@@ -576,13 +576,13 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
if( GetShape() == PAD_CIRCLE ) if( GetShape() == PAD_CIRCLE )
angle = 0; angle = 0;
AreaSize = m_Size; AreaSize = TO_LEGACY_LU_WXS( m_Size );
if( m_Size.y > m_Size.x ) if( m_Size.y > m_Size.x )
{ {
angle += 900; angle += 900;
AreaSize.x = m_Size.y; AreaSize.x = TO_LEGACY_LU( m_Size.y );
AreaSize.y = m_Size.x; AreaSize.y = TO_LEGACY_LU( m_Size.x );
} }
if( shortname_len > 0 ) // if there is a netname, provides room to display this netname if( shortname_len > 0 ) // if there is a netname, provides room to display this netname
...@@ -666,21 +666,21 @@ int D_PAD::BuildSegmentFromOvalShape(wxPoint& aSegStart, wxPoint& aSegEnd, int a ...@@ -666,21 +666,21 @@ int D_PAD::BuildSegmentFromOvalShape(wxPoint& aSegStart, wxPoint& aSegEnd, int a
if( m_Size.y < m_Size.x ) // Build an horizontal equiv segment if( m_Size.y < m_Size.x ) // Build an horizontal equiv segment
{ {
int delta = ( m_Size.x - m_Size.y ) / 2; int delta = TO_LEGACY_LU( ( m_Size.x - m_Size.y ) / 2 );
aSegStart.x = -delta; aSegStart.x = -delta;
aSegStart.y = 0; aSegStart.y = 0;
aSegEnd.x = delta; aSegEnd.x = delta;
aSegEnd.y = 0; aSegEnd.y = 0;
width = m_Size.y; width = TO_LEGACY_LU( m_Size.y );
} }
else // Vertical oval: build a vertical equiv segment else // Vertical oval: build a vertical equiv segment
{ {
int delta = ( m_Size.y -m_Size.x ) / 2; int delta = TO_LEGACY_LU( ( m_Size.y -m_Size.x ) / 2 );
aSegStart.x = 0; aSegStart.x = 0;
aSegStart.y = -delta; aSegStart.y = -delta;
aSegEnd.x = 0; aSegEnd.x = 0;
aSegEnd.y = delta; aSegEnd.y = delta;
width = m_Size.x; width = TO_LEGACY_LU( m_Size.x );
} }
if( aRotation ) if( aRotation )
...@@ -701,8 +701,8 @@ void D_PAD::BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotat ...@@ -701,8 +701,8 @@ void D_PAD::BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotat
wxSize delta; wxSize delta;
wxSize halfsize; wxSize halfsize;
halfsize.x = m_Size.x >> 1; halfsize.x = TO_LEGACY_LU( m_Size.x / 2 );
halfsize.y = m_Size.y >> 1; halfsize.y = TO_LEGACY_LU( m_Size.y / 2 );
/* For rectangular shapes, inflate is easy /* For rectangular shapes, inflate is easy
*/ */
...@@ -721,8 +721,8 @@ void D_PAD::BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotat ...@@ -721,8 +721,8 @@ void D_PAD::BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotat
else else
{ {
// Trapezoidal pad: verify delta values // Trapezoidal pad: verify delta values
delta.x = ( m_DeltaSize.x >> 1 ); delta.x = TO_LEGACY_LU( m_DeltaSize.x / 2 );
delta.y = ( m_DeltaSize.y >> 1 ); delta.y = TO_LEGACY_LU( m_DeltaSize.y / 2 );
// be sure delta values are not to large // be sure delta values are not to large
if( (delta.x < 0) && (delta.x <= -halfsize.y) ) if( (delta.x < 0) && (delta.x <= -halfsize.y) )
...@@ -762,7 +762,7 @@ void D_PAD::BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotat ...@@ -762,7 +762,7 @@ void D_PAD::BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotat
if( delta.y ) // lower and upper segment is horizontal if( delta.y ) // lower and upper segment is horizontal
{ {
// Calculate angle of left (or right) segment with vertical axis // Calculate angle of left (or right) segment with vertical axis
angle = atan2( double( m_DeltaSize.y ), double( m_Size.y ) ); angle = atan2( m_DeltaSize.y, m_Size.y ); /// TODO: make atan2 available to LENGTH
// left and right sides are moved by aInflateValue.x in their perpendicular direction // left and right sides are moved by aInflateValue.x in their perpendicular direction
// We must calculate the corresponding displacement on the horizontal axis // We must calculate the corresponding displacement on the horizontal axis
...@@ -778,7 +778,7 @@ void D_PAD::BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotat ...@@ -778,7 +778,7 @@ void D_PAD::BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotat
else if( delta.x ) // left and right segment is vertical else if( delta.x ) // left and right segment is vertical
{ {
// Calculate angle of lower (or upper) segment with horizontal axis // Calculate angle of lower (or upper) segment with horizontal axis
angle = atan2( double( m_DeltaSize.x ), double( m_Size.x ) ); angle = atan2( m_DeltaSize.x, m_Size.x );
// lower and upper sides are moved by aInflateValue.x in their perpendicular direction // lower and upper sides are moved by aInflateValue.x in their perpendicular direction
// We must calculate the corresponding displacement on the vertical axis // We must calculate the corresponding displacement on the vertical axis
......
This diff is collapsed.
...@@ -133,16 +133,16 @@ void DIALOG_DRC_CONTROL::SetDrcParmeters( ) ...@@ -133,16 +133,16 @@ void DIALOG_DRC_CONTROL::SetDrcParmeters( )
#ifdef KICAD_NANOMETRE #ifdef KICAD_NANOMETRE
m_BrdSettings->m_TrackMinWidth = m_BrdSettings->m_TrackMinWidth =
LengthFromTextCtrl( *m_SetTrackMinWidthCtrl ); LengthFromTextCtrl( *m_SetTrackMinWidthCtrl );
m_BrdSettings->m_ViasMinSize = m_BrdSettings->m_MinVia.m_Diameter =
LengthFromTextCtrl( *m_SetViaMinSizeCtrl ); LengthFromTextCtrl( *m_SetViaMinSizeCtrl );
m_BrdSettings->m_MicroViasMinSize = m_BrdSettings->m_MinMicroVia.m_Diameter =
LengthFromTextCtrl( *m_SetMicroViakMinSizeCtrl ); LengthFromTextCtrl( *m_SetMicroViakMinSizeCtrl );
#else #else
m_BrdSettings->m_TrackMinWidth = m_BrdSettings->m_TrackMinWidth =
ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits );
m_BrdSettings->m_ViasMinSize = m_BrdSettings->m_MinVia.m_Diameter =
ReturnValueFromTextCtrl( *m_SetViaMinSizeCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetViaMinSizeCtrl, m_Parent->m_InternalUnits );
m_BrdSettings->m_MicroViasMinSize = m_BrdSettings->m_MinMicroVia.m_Diameter =
ReturnValueFromTextCtrl( *m_SetMicroViakMinSizeCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetMicroViakMinSizeCtrl, m_Parent->m_InternalUnits );
#endif #endif
} }
......
...@@ -185,7 +185,7 @@ void DIALOG_GENDRILL::InitDisplayParams( void ) ...@@ -185,7 +185,7 @@ void DIALOG_GENDRILL::InitDisplayParams( void )
{ {
if( pad->m_DrillShape == PAD_CIRCLE ) if( pad->m_DrillShape == PAD_CIRCLE )
{ {
if( pad->m_Drill.x != 0 ) if( pad->m_Drill.x != ZERO_LENGTH )
{ {
if( pad->m_Attribut == PAD_HOLE_NOT_PLATED ) if( pad->m_Attribut == PAD_HOLE_NOT_PLATED )
m_notplatedPadsHoleCount++; m_notplatedPadsHoleCount++;
...@@ -195,7 +195,7 @@ void DIALOG_GENDRILL::InitDisplayParams( void ) ...@@ -195,7 +195,7 @@ void DIALOG_GENDRILL::InitDisplayParams( void )
} }
else else
{ {
if( MIN( pad->m_Drill.x, pad->m_Drill.y ) != 0 ) if( MIN( TO_LEGACY_LU( pad->m_Drill.x ), TO_LEGACY_LU( pad->m_Drill.y ) ) != 0 )
{ {
if( pad->m_Attribut == PAD_HOLE_NOT_PLATED ) if( pad->m_Attribut == PAD_HOLE_NOT_PLATED )
m_notplatedPadsHoleCount++; m_notplatedPadsHoleCount++;
......
This diff is collapsed.
...@@ -58,18 +58,18 @@ void DRC::ShowDialog() ...@@ -58,18 +58,18 @@ void DRC::ShowDialog()
LengthToTextCtrl( *m_ui->m_SetTrackMinWidthCtrl, LengthToTextCtrl( *m_ui->m_SetTrackMinWidthCtrl,
m_pcb->GetBoardDesignSettings()->m_TrackMinWidth ); m_pcb->GetBoardDesignSettings()->m_TrackMinWidth );
LengthToTextCtrl( *m_ui->m_SetViaMinSizeCtrl, LengthToTextCtrl( *m_ui->m_SetViaMinSizeCtrl,
m_pcb->GetBoardDesignSettings()->m_ViasMinSize ); m_pcb->GetBoardDesignSettings()->m_MinVia.m_Diameter );
LengthToTextCtrl( *m_ui->m_SetMicroViakMinSizeCtrl, LengthToTextCtrl( *m_ui->m_SetMicroViakMinSizeCtrl,
m_pcb->GetBoardDesignSettings()->m_MicroViasMinSize ); m_pcb->GetBoardDesignSettings()->m_MinMicroVia.m_Diameter );
#else #else
PutValueInLocalUnits( *m_ui->m_SetTrackMinWidthCtrl, PutValueInLocalUnits( *m_ui->m_SetTrackMinWidthCtrl,
TO_LEGACY_LU( m_pcb->GetBoardDesignSettings()->m_TrackMinWidth ), TO_LEGACY_LU( m_pcb->GetBoardDesignSettings()->m_TrackMinWidth ),
m_mainWindow->m_InternalUnits ); m_mainWindow->m_InternalUnits );
PutValueInLocalUnits( *m_ui->m_SetViaMinSizeCtrl, PutValueInLocalUnits( *m_ui->m_SetViaMinSizeCtrl,
TO_LEGACY_LU( m_pcb->GetBoardDesignSettings()->m_ViasMinSize ), TO_LEGACY_LU( m_pcb->GetBoardDesignSettings()->m_MinVia.m_Diameter ),
m_mainWindow->m_InternalUnits ); m_mainWindow->m_InternalUnits );
PutValueInLocalUnits( *m_ui->m_SetMicroViakMinSizeCtrl, PutValueInLocalUnits( *m_ui->m_SetMicroViakMinSizeCtrl,
TO_LEGACY_LU( m_pcb->GetBoardDesignSettings()->m_MicroViasMinSize ), TO_LEGACY_LU( m_pcb->GetBoardDesignSettings()->m_MinMicroVia.m_Diameter ),
m_mainWindow->m_InternalUnits ); m_mainWindow->m_InternalUnits );
#endif #endif
...@@ -335,12 +335,12 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg ) ...@@ -335,12 +335,12 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
ret = false; ret = false;
} }
if( nc->GetViaDiameter() < TO_LEGACY_LU( g.m_ViasMinSize ) ) if( nc->GetViaDiameter() < TO_LEGACY_LU( g.m_MinVia.m_Diameter ) )
{ {
msg.Printf( _( "NETCLASS: '%s' has Via Dia:%s which is less than global:%s" ), msg.Printf( _( "NETCLASS: '%s' has Via Dia:%s which is less than global:%s" ),
GetChars( nc->GetName() ), GetChars( nc->GetName() ),
FmtVal( nc->GetViaDiameter() ), FmtVal( nc->GetViaDiameter() ),
FmtVal( TO_LEGACY_LU( g.m_ViasMinSize ) ) FmtVal( TO_LEGACY_LU( g.m_MinVia.m_Diameter ) )
); );
m_currentMarker = fillMarker( DRCE_NETCLASS_VIASIZE, msg, m_currentMarker ); m_currentMarker = fillMarker( DRCE_NETCLASS_VIASIZE, msg, m_currentMarker );
...@@ -349,12 +349,12 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg ) ...@@ -349,12 +349,12 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
ret = false; ret = false;
} }
if( nc->GetViaDrill() < TO_LEGACY_LU( g.m_ViasMinDrill ) ) if( nc->GetViaDrill() < TO_LEGACY_LU( g.m_MinVia.m_Drill ) )
{ {
msg.Printf( _( "NETCLASS: '%s' has Via Drill:%s which is less than global:%s" ), msg.Printf( _( "NETCLASS: '%s' has Via Drill:%s which is less than global:%s" ),
GetChars( nc->GetName() ), GetChars( nc->GetName() ),
FmtVal( nc->GetViaDrill() ), FmtVal( nc->GetViaDrill() ),
FmtVal( TO_LEGACY_LU( g.m_ViasMinDrill ) ) FmtVal( TO_LEGACY_LU( g.m_MinVia.m_Drill ) )
); );
m_currentMarker = fillMarker( DRCE_NETCLASS_VIADRILLSIZE, msg, m_currentMarker ); m_currentMarker = fillMarker( DRCE_NETCLASS_VIADRILLSIZE, msg, m_currentMarker );
...@@ -363,12 +363,12 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg ) ...@@ -363,12 +363,12 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
ret = false; ret = false;
} }
if( nc->GetuViaDiameter() < TO_LEGACY_LU( g.m_MicroViasMinSize ) ) if( nc->GetuViaDiameter() < TO_LEGACY_LU( g.m_MinMicroVia.m_Diameter ) )
{ {
msg.Printf( _( "NETCLASS: '%s' has uVia Dia:%s which is less than global:%s" ), msg.Printf( _( "NETCLASS: '%s' has uVia Dia:%s which is less than global:%s" ),
GetChars( nc->GetName() ), GetChars( nc->GetName() ),
FmtVal( nc->GetuViaDiameter() ), FmtVal( nc->GetuViaDiameter() ),
FmtVal( TO_LEGACY_LU( g.m_MicroViasMinSize ) ) FmtVal( TO_LEGACY_LU( g.m_MinMicroVia.m_Diameter ) )
); );
m_currentMarker = fillMarker( DRCE_NETCLASS_uVIASIZE, msg, m_currentMarker ); m_currentMarker = fillMarker( DRCE_NETCLASS_uVIASIZE, msg, m_currentMarker );
...@@ -377,12 +377,12 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg ) ...@@ -377,12 +377,12 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
ret = false; ret = false;
} }
if( nc->GetuViaDrill() < TO_LEGACY_LU( g.m_MicroViasMinDrill ) ) if( nc->GetuViaDrill() < TO_LEGACY_LU( g.m_MinMicroVia.m_Drill ) )
{ {
msg.Printf( _( "NETCLASS: '%s' has uVia Drill:%s which is less than global:%s" ), msg.Printf( _( "NETCLASS: '%s' has uVia Drill:%s which is less than global:%s" ),
GetChars( nc->GetName() ), GetChars( nc->GetName() ),
FmtVal( nc->GetuViaDrill() ), FmtVal( nc->GetuViaDrill() ),
FmtVal( TO_LEGACY_LU( g.m_MicroViasMinDrill ) ) FmtVal( TO_LEGACY_LU( g.m_MinMicroVia.m_Drill ) )
); );
m_currentMarker = fillMarker( DRCE_NETCLASS_uVIADRILLSIZE, msg, m_currentMarker ); m_currentMarker = fillMarker( DRCE_NETCLASS_uVIADRILLSIZE, msg, m_currentMarker );
...@@ -577,7 +577,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li ...@@ -577,7 +577,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li
MODULE dummymodule( m_pcb ); // Creates a dummy parent MODULE dummymodule( m_pcb ); // Creates a dummy parent
D_PAD dummypad( &dummymodule ); D_PAD dummypad( &dummymodule );
dummypad.m_layerMask |= ALL_CU_LAYERS; // Ensure the hole is on all copper layers dummypad.m_layerMask |= ALL_CU_LAYERS; // Ensure the hole is on all copper layers
dummypad.m_LocalClearance = 1; /* Use the minimal local clearance value for the dummy pad dummypad.m_LocalClearance = FROM_LEGACY_LU( 1 ); /* Use the minimal local clearance value for the dummy pad
* the clearance of the active pad will be used * the clearance of the active pad will be used
* as minimum distance to a hole * as minimum distance to a hole
* (a value = 0 means use netclass value) * (a value = 0 means use netclass value)
...@@ -617,7 +617,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li ...@@ -617,7 +617,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li
/* Here, we must test clearance between holes and pads /* Here, we must test clearance between holes and pads
* dummy pad size and shape is adjusted to pad drill size and shape * dummy pad size and shape is adjusted to pad drill size and shape
*/ */
if( pad->m_Drill.x ) if( pad->m_Drill.x != ZERO_LENGTH )
{ {
// pad under testing has a hole, test this hole against pad reference // pad under testing has a hole, test this hole against pad reference
dummypad.SetPosition( pad->GetPosition() ); dummypad.SetPosition( pad->GetPosition() );
...@@ -637,7 +637,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li ...@@ -637,7 +637,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li
} }
} }
if( aRefPad->m_Drill.x ) // pad reference has a hole if( aRefPad->m_Drill.x != ZERO_LENGTH ) // pad reference has a hole
{ {
dummypad.SetPosition( aRefPad->GetPosition() ); dummypad.SetPosition( aRefPad->GetPosition() );
dummypad.m_Size = aRefPad->m_Drill; dummypad.m_Size = aRefPad->m_Drill;
......
...@@ -290,10 +290,10 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) ...@@ -290,10 +290,10 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
* checkClearanceSegmToPad(),a pseudo pad is used, with a shape and a * checkClearanceSegmToPad(),a pseudo pad is used, with a shape and a
* size like the hole * size like the hole
*/ */
if( pad->m_Drill.x == 0 ) if( pad->m_Drill.x == ZERO_LENGTH )
continue; continue;
dummypad.m_Size = pad->m_Drill; dummypad.m_Size = pad->m_Drill;
dummypad.SetPosition( pad->GetPosition() ); dummypad.SetPosition( pad->GetPosition() );
dummypad.m_PadShape = pad->m_DrillShape; dummypad.m_PadShape = pad->m_DrillShape;
dummypad.m_Orient = pad->m_Orient; dummypad.m_Orient = pad->m_Orient;
...@@ -633,7 +633,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad ) ...@@ -633,7 +633,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
m_segmEnd.x = m_segmEnd.y = 0; m_segmEnd.x = m_segmEnd.y = 0;
m_padToTestPos = relativePadPos; m_padToTestPos = relativePadPos;
diag = checkClearanceSegmToPad( aPad, aRefPad->m_Size.x, dist_min ); diag = checkClearanceSegmToPad( aPad, TO_LEGACY_LU( aRefPad->m_Size.x ), dist_min );
break; break;
case PAD_RECT: case PAD_RECT:
...@@ -644,7 +644,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad ) ...@@ -644,7 +644,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
if( aPad->m_PadShape == PAD_RECT ) if( aPad->m_PadShape == PAD_RECT )
{ {
wxSize size = aPad->m_Size; wxSize size = TO_LEGACY_LU_WXS( aPad->m_Size );
// The trivial case is if both rects are rotated by multiple of 90 deg // The trivial case is if both rects are rotated by multiple of 90 deg
// Most of time this is the case, and the test is fast // Most of time this is the case, and the test is fast
...@@ -664,10 +664,10 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad ) ...@@ -664,10 +664,10 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
relativePadPos.x = ABS( relativePadPos.x ); relativePadPos.x = ABS( relativePadPos.x );
relativePadPos.y = ABS( relativePadPos.y ); relativePadPos.y = ABS( relativePadPos.y );
if( ( relativePadPos.x - ( (size.x + aRefPad->m_Size.x) / 2 ) ) >= dist_min ) if( ( relativePadPos.x - ( (size.x + TO_LEGACY_LU( aRefPad->m_Size.x ) ) / 2 ) ) >= dist_min )
diag = true; diag = true;
if( ( relativePadPos.y - ( (size.y + aRefPad->m_Size.y) / 2 ) ) >= dist_min ) if( ( relativePadPos.y - ( (size.y + TO_LEGACY_LU( aRefPad->m_Size.y) ) / 2 ) ) >= dist_min )
diag = true; diag = true;
} }
else // at least one pad has any other orient. Test is more tricky else // at least one pad has any other orient. Test is more tricky
...@@ -718,13 +718,13 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad ) ...@@ -718,13 +718,13 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
if( aRefPad->m_Size.y < aRefPad->m_Size.x ) // Build an horizontal equiv segment if( aRefPad->m_Size.y < aRefPad->m_Size.x ) // Build an horizontal equiv segment
{ {
segm_width = aRefPad->m_Size.y; segm_width = TO_LEGACY_LU( aRefPad->m_Size.y );
m_segmLength = aRefPad->m_Size.x - aRefPad->m_Size.y; m_segmLength = TO_LEGACY_LU( aRefPad->m_Size.x - aRefPad->m_Size.y );
} }
else // Vertical oval: build an horizontal equiv segment and rotate 90.0 deg else // Vertical oval: build an horizontal equiv segment and rotate 90.0 deg
{ {
segm_width = aRefPad->m_Size.x; segm_width = TO_LEGACY_LU( aRefPad->m_Size.x );
m_segmLength = aRefPad->m_Size.y - aRefPad->m_Size.x; m_segmLength = TO_LEGACY_LU( aRefPad->m_Size.y - aRefPad->m_Size.x );
m_segmAngle += 900; m_segmAngle += 900;
} }
...@@ -796,13 +796,13 @@ bool DRC::checkClearanceSegmToPad( const D_PAD* aPad, int aSegmentWidth, int aMi ...@@ -796,13 +796,13 @@ bool DRC::checkClearanceSegmToPad( const D_PAD* aPad, int aSegmentWidth, int aMi
int segmHalfWidth = aSegmentWidth / 2; int segmHalfWidth = aSegmentWidth / 2;
seuil = segmHalfWidth + aMinDist; seuil = segmHalfWidth + aMinDist;
padHalfsize.x = aPad->m_Size.x >> 1; padHalfsize.x = TO_LEGACY_LU( aPad->m_Size.x / 2 );
padHalfsize.y = aPad->m_Size.y >> 1; padHalfsize.y = TO_LEGACY_LU( aPad->m_Size.y / 2 );
if( aPad->m_PadShape == PAD_TRAPEZOID ) // The size is bigger, due to m_DeltaSize extra size if( aPad->m_PadShape == PAD_TRAPEZOID ) // The size is bigger, due to m_DeltaSize extra size
{ {
padHalfsize.x += ABS(aPad->m_DeltaSize.y) / 2; // Remember: m_DeltaSize.y is the m_Size.x change padHalfsize.x += TO_LEGACY_LU( ABS(aPad->m_DeltaSize.y) / 2 ); // Remember: m_DeltaSize.y is the m_Size.x change
padHalfsize.y += ABS(aPad->m_DeltaSize.x) / 2; // Remember: m_DeltaSize.x is the m_Size.y change padHalfsize.y += TO_LEGACY_LU( ABS(aPad->m_DeltaSize.x) / 2 ); // Remember: m_DeltaSize.x is the m_Size.y change
} }
if( aPad->m_PadShape == PAD_CIRCLE ) if( aPad->m_PadShape == PAD_CIRCLE )
......
...@@ -69,10 +69,10 @@ ...@@ -69,10 +69,10 @@
#define DRCE_TOO_SMALL_MICROVIA 29 ///< Too small micro via size #define DRCE_TOO_SMALL_MICROVIA 29 ///< Too small micro via size
#define DRCE_NETCLASS_TRACKWIDTH 30 ///< netclass has TrackWidth < board.m_designSettings->m_TrackMinWidth #define DRCE_NETCLASS_TRACKWIDTH 30 ///< netclass has TrackWidth < board.m_designSettings->m_TrackMinWidth
#define DRCE_NETCLASS_CLEARANCE 31 ///< netclass has Clearance < board.m_designSettings->m_TrackClearance #define DRCE_NETCLASS_CLEARANCE 31 ///< netclass has Clearance < board.m_designSettings->m_TrackClearance
#define DRCE_NETCLASS_VIASIZE 32 ///< netclass has ViaSize < board.m_designSettings->m_ViasMinSize #define DRCE_NETCLASS_VIASIZE 32 ///< netclass has ViaSize < board.m_designSettings->m_MinVia.m_Diameter
#define DRCE_NETCLASS_VIADRILLSIZE 33 ///< netclass has ViaDrillSize < board.m_designSettings->m_ViasMinDrill #define DRCE_NETCLASS_VIADRILLSIZE 33 ///< netclass has ViaDrillSize < board.m_designSettings->m_MinVia.m_Drill
#define DRCE_NETCLASS_uVIASIZE 34 ///< netclass has ViaSize < board.m_designSettings->m_MicroViasMinSize #define DRCE_NETCLASS_uVIASIZE 34 ///< netclass has ViaSize < board.m_designSettings->m_MinMicroVia.m_Diameter
#define DRCE_NETCLASS_uVIADRILLSIZE 35 ///< netclass has ViaSize < board.m_designSettings->m_MicroViasMinDrill #define DRCE_NETCLASS_uVIADRILLSIZE 35 ///< netclass has ViaSize < board.m_designSettings->m_MinMicroVia.m_Drill
class EDA_DRAW_PANEL; class EDA_DRAW_PANEL;
......
...@@ -82,7 +82,7 @@ void FOOTPRINT_EDIT_FRAME::Place_Ancre( MODULE* pt_mod ) ...@@ -82,7 +82,7 @@ void FOOTPRINT_EDIT_FRAME::Place_Ancre( MODULE* pt_mod )
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() ) for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
{ {
pt_pad->m_Pos0 += moveVector; pt_pad->m_Pos0 += VECTOR_PCB( FROM_LEGACY_LU( moveVector.x ), FROM_LEGACY_LU( moveVector.y ) );
} }
/* Update the draw element coordinates. */ /* Update the draw element coordinates. */
...@@ -93,7 +93,7 @@ void FOOTPRINT_EDIT_FRAME::Place_Ancre( MODULE* pt_mod ) ...@@ -93,7 +93,7 @@ void FOOTPRINT_EDIT_FRAME::Place_Ancre( MODULE* pt_mod )
switch( PtStruct->Type() ) switch( PtStruct->Type() )
{ {
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
#undef STRUCT #undef STRUCT /// @BUG: unsafe type cast
#define STRUCT ( (EDGE_MODULE*) PtStruct ) #define STRUCT ( (EDGE_MODULE*) PtStruct )
STRUCT->m_Start0 += moveVector; STRUCT->m_Start0 += moveVector;
STRUCT->m_End0 += moveVector; STRUCT->m_End0 += moveVector;
......
...@@ -783,7 +783,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo ...@@ -783,7 +783,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
if( g_FirstTrackSegment->GetState( BEGIN_ONPAD ) ) if( g_FirstTrackSegment->GetState( BEGIN_ONPAD ) )
{ {
D_PAD * pad = (D_PAD *) g_FirstTrackSegment->start; D_PAD * pad = (D_PAD *) g_FirstTrackSegment->start;
lenDie = (double) pad->m_LengthDie; lenDie = TO_LEGACY_LU_DBL( pad->m_LengthDie );
} }
// calculate track len on board: // calculate track len on board:
......
...@@ -252,70 +252,70 @@ void CreatePadsShapesSection( FILE* file, BOARD* pcb ) ...@@ -252,70 +252,70 @@ void CreatePadsShapesSection( FILE* file, BOARD* pcb )
fprintf( file, "PAD PAD%d", pad->GetSubRatsnest() ); fprintf( file, "PAD PAD%d", pad->GetSubRatsnest() );
int dx = pad->m_Size.x / 2; int dx = TO_LEGACY_LU( pad->m_Size.x / 2 );
int dy = pad->m_Size.y / 2; int dy = TO_LEGACY_LU( pad->m_Size.y / 2 );
switch( pad->m_PadShape ) switch( pad->m_PadShape )
{ {
default: default:
case PAD_CIRCLE: case PAD_CIRCLE:
pad_type = "ROUND"; pad_type = "ROUND"; // how about oval holes?
fprintf( file, " %s %d\n", pad_type, pad->m_Drill.x ); fprintf( file, " %s %d\n", pad_type, ( int )TO_LEGACY_LU( pad->m_Drill.x ) );
fprintf( file, "CIRCLE %d %d %d\n", fprintf( file, "CIRCLE %d %d %d\n",
pad->m_Offset.x, -pad->m_Offset.y, dx ); TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ), dx );
break; break;
case PAD_RECT: case PAD_RECT:
pad_type = "RECTANGULAR"; pad_type = "RECTANGULAR";
fprintf( file, " %s %d\n", pad_type, pad->m_Drill.x ); fprintf( file, " %s %d\n", pad_type, ( int )TO_LEGACY_LU( pad->m_Drill.x ) );
fprintf( file, "RECTANGLE %d %d %d %d\n", fprintf( file, "RECTANGLE %d %d %d %d\n",
pad->m_Offset.x - dx, -pad->m_Offset.y - dy, TO_LEGACY_LU( pad->m_Offset.x ) - dx, -TO_LEGACY_LU( pad->m_Offset.y ) - dy,
pad->m_Size.x, pad->m_Size.y ); TO_LEGACY_LU( pad->m_Size.x ), TO_LEGACY_LU( pad->m_Size.y ) );
break; break;
case PAD_OVAL: /* Create outline by 2 lines and 2 arcs */ case PAD_OVAL: /* Create outline by 2 lines and 2 arcs */
{ {
pad_type = "FINGER"; pad_type = "FINGER";
fprintf( file, " %s %d\n", pad_type, pad->m_Drill.x ); fprintf( file, " %s %d\n", pad_type, ( int )TO_LEGACY_LU( pad->m_Drill.x ) );
int dr = dx - dy; int dr = dx - dy;
if( dr >= 0 ) // Horizontal oval if( dr >= 0 ) // Horizontal oval
{ {
int radius = dy; int radius = dy;
fprintf( file, "LINE %d %d %d %d\n", fprintf( file, "LINE %d %d %d %d\n",
-dr + pad->m_Offset.x, -pad->m_Offset.y - radius, -dr + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) - radius,
dr + pad->m_Offset.x, -pad->m_Offset.y - radius ); dr + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) - radius );
fprintf( file, "ARC %d %d %d %d %d %d\n", fprintf( file, "ARC %d %d %d %d %d %d\n",
dr + pad->m_Offset.x, -pad->m_Offset.y - radius, dr + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) - radius,
dr + pad->m_Offset.x, -pad->m_Offset.y + radius, dr + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) + radius,
dr + pad->m_Offset.x, -pad->m_Offset.y ); dr + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) );
fprintf( file, "LINE %d %d %d %d\n", fprintf( file, "LINE %d %d %d %d\n",
dr + pad->m_Offset.x, -pad->m_Offset.y + radius, dr + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) + radius,
-dr + pad->m_Offset.x, -pad->m_Offset.y + radius ); -dr + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) + radius );
fprintf( file, "ARC %d %d %d %d %d %d\n", fprintf( file, "ARC %d %d %d %d %d %d\n",
-dr + pad->m_Offset.x, -pad->m_Offset.y + radius, -dr + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) + radius,
-dr + pad->m_Offset.x, -pad->m_Offset.y - radius, -dr + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) - radius,
-dr + pad->m_Offset.x, -pad->m_Offset.y ); -dr + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) );
} }
else // Vertical oval else // Vertical oval
{ {
dr = -dr; dr = -dr;
int radius = dx; int radius = dx;
fprintf( file, "LINE %d %d %d %d\n", fprintf( file, "LINE %d %d %d %d\n",
-radius + pad->m_Offset.x, -pad->m_Offset.y - dr, -radius + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) - dr,
-radius + pad->m_Offset.x, -pad->m_Offset.y + dr ); -radius + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) + dr );
fprintf( file, "ARC %d %d %d %d %d %d\n", fprintf( file, "ARC %d %d %d %d %d %d\n",
-radius + pad->m_Offset.x, -pad->m_Offset.y + dr, -radius + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) + dr,
radius + pad->m_Offset.x, -pad->m_Offset.y + dr, radius + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) + dr,
pad->m_Offset.x, -pad->m_Offset.y + dr ); TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) + dr );
fprintf( file, "LINE %d %d %d %d\n", fprintf( file, "LINE %d %d %d %d\n",
radius + pad->m_Offset.x, -pad->m_Offset.y + dr, radius + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) + dr,
radius + pad->m_Offset.x, -pad->m_Offset.y - dr ); radius + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) - dr );
fprintf( file, "ARC %d %d %d %d %d %d\n", fprintf( file, "ARC %d %d %d %d %d %d\n",
radius + pad->m_Offset.x, -pad->m_Offset.y - dr, radius + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) - dr,
-radius + pad->m_Offset.x, -pad->m_Offset.y - dr, -radius + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) - dr,
pad->m_Offset.x, -pad->m_Offset.y - dr ); TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) - dr );
} }
break; break;
} }
...@@ -410,7 +410,7 @@ void CreateShapesSection( FILE* file, BOARD* pcb ) ...@@ -410,7 +410,7 @@ void CreateShapesSection( FILE* file, BOARD* pcb )
NORMALIZE_ANGLE_POS( orient ); NORMALIZE_ANGLE_POS( orient );
fprintf( file, "PIN %s PAD%d %d %d %s %d %s", fprintf( file, "PIN %s PAD%d %d %d %s %d %s",
TO_UTF8( pinname ), pad->GetSubRatsnest(), TO_UTF8( pinname ), pad->GetSubRatsnest(),
pad->m_Pos0.x, -pad->m_Pos0.y, TO_LEGACY_LU( pad->m_Pos0.x ), TO_LEGACY_LU( -pad->m_Pos0.y ),
layer, orient / 10, mirror ); layer, orient / 10, mirror );
if( orient % 10 ) if( orient % 10 )
......
...@@ -881,8 +881,8 @@ static void export_vrml_edge_module( EDGE_MODULE* module ) /*{{{*/ ...@@ -881,8 +881,8 @@ static void export_vrml_edge_module( EDGE_MODULE* module ) /*{{{*/
static void export_vrml_pad( BOARD* pcb, D_PAD* pad ) /*{{{*/ static void export_vrml_pad( BOARD* pcb, D_PAD* pad ) /*{{{*/
{ {
double hole_drill_w = (double) pad->m_Drill.x / 2; double hole_drill_w = (double) TO_LEGACY_LU_DBL( pad->m_Drill.x / 2 );
double hole_drill_h = (double) pad->m_Drill.y / 2; double hole_drill_h = (double) TO_LEGACY_LU_DBL( pad->m_Drill.y / 2 );
double hole_drill = MIN( hole_drill_w, hole_drill_h ); double hole_drill = MIN( hole_drill_w, hole_drill_h );
double hole_x = pad->m_Pos.x; double hole_x = pad->m_Pos.x;
double hole_y = pad->m_Pos.y; double hole_y = pad->m_Pos.y;
...@@ -913,11 +913,11 @@ static void export_vrml_pad( BOARD* pcb, D_PAD* pad ) /*{{{*/ ...@@ -913,11 +913,11 @@ static void export_vrml_pad( BOARD* pcb, D_PAD* pad ) /*{{{*/
wxPoint pad_pos = pad->ReturnShapePos(); wxPoint pad_pos = pad->ReturnShapePos();
double pad_x = pad_pos.x; double pad_x = pad_pos.x;
double pad_y = pad_pos.y; double pad_y = pad_pos.y;
wxSize pad_delta = pad->m_DeltaSize; wxSize pad_delta = TO_LEGACY_LU_WXS( pad->m_DeltaSize );
double pad_dx = pad_delta.x / 2; double pad_dx = pad_delta.x / 2;
double pad_dy = pad_delta.y / 2; double pad_dy = pad_delta.y / 2;
double pad_w = pad->m_Size.x / 2; double pad_w = TO_LEGACY_LU_DBL( pad->m_Size.x / 2 );
double pad_h = pad->m_Size.y / 2; double pad_h = TO_LEGACY_LU_DBL( pad->m_Size.y / 2 );
for( int layer = FIRST_COPPER_LAYER; layer < copper_layers; layer++ ) for( int layer = FIRST_COPPER_LAYER; layer < copper_layers; layer++ )
{ {
......
...@@ -127,20 +127,21 @@ void Build_Holes_List( BOARD* aPcb, ...@@ -127,20 +127,21 @@ void Build_Holes_List( BOARD* aPcb,
if( aGenerateNPTH_list && pad->m_Attribut != PAD_HOLE_NOT_PLATED ) if( aGenerateNPTH_list && pad->m_Attribut != PAD_HOLE_NOT_PLATED )
continue; continue;
if( pad->m_Drill.x == 0 ) if( pad->m_Drill.x == ZERO_LENGTH )
continue; continue;
new_hole.m_Hole_NotPlated = (pad->m_Attribut == PAD_HOLE_NOT_PLATED); new_hole.m_Hole_NotPlated = (pad->m_Attribut == PAD_HOLE_NOT_PLATED);
new_hole.m_Tool_Reference = -1; // Flag is: Not initialized new_hole.m_Tool_Reference = -1; // Flag is: Not initialized
new_hole.m_Hole_Orient = pad->m_Orient; new_hole.m_Hole_Orient = pad->m_Orient;
new_hole.m_Hole_Shape = 0; // hole shape: round new_hole.m_Hole_Shape = 0; // hole shape: round
new_hole.m_Hole_Diameter = min( pad->m_Drill.x, pad->m_Drill.y ); new_hole.m_Hole_Diameter = min( TO_LEGACY_LU( pad->m_Drill.x ), TO_LEGACY_LU( pad->m_Drill.y ) );
new_hole.m_Hole_Size.x = new_hole.m_Hole_Size.y = new_hole.m_Hole_Diameter; new_hole.m_Hole_Size.x = new_hole.m_Hole_Size.y = new_hole.m_Hole_Diameter;
if( pad->m_DrillShape != PAD_CIRCLE ) if( pad->m_DrillShape != PAD_CIRCLE )
new_hole.m_Hole_Shape = 1; // oval flag set new_hole.m_Hole_Shape = 1; // oval flag set
new_hole.m_Hole_Size = pad->m_Drill; new_hole.m_Hole_Size.x = TO_LEGACY_LU( pad->m_Drill.x );
new_hole.m_Hole_Size.y = TO_LEGACY_LU( pad->m_Drill.y );
new_hole.m_Hole_Pos = pad->m_Pos; // hole position new_hole.m_Hole_Pos = pad->m_Pos; // hole position
new_hole.m_Hole_Bottom_Layer = LAYER_N_BACK; new_hole.m_Hole_Bottom_Layer = LAYER_N_BACK;
new_hole.m_Hole_Top_Layer = LAYER_N_FRONT;// pad holes are through holes new_hole.m_Hole_Top_Layer = LAYER_N_FRONT;// pad holes are through holes
......
...@@ -438,19 +438,19 @@ void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event ) ...@@ -438,19 +438,19 @@ void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event )
{ {
fprintf( rptfile, "$PAD \"%.4s\"\n", pad->m_Padname ); fprintf( rptfile, "$PAD \"%.4s\"\n", pad->m_Padname );
sprintf( line, "position %9.6f %9.6f\n", sprintf( line, "position %9.6f %9.6f\n",
pad->m_Pos0.x * conv_unit, TO_LEGACY_LU_DBL( pad->m_Pos0.x ) * conv_unit,
pad->m_Pos0.y * conv_unit ); TO_LEGACY_LU_DBL( pad->m_Pos0.y ) * conv_unit );
fputs( line, rptfile ); fputs( line, rptfile );
sprintf( line, "size %9.6f %9.6f\n", sprintf( line, "size %9.6f %9.6f\n",
pad->m_Size.x * conv_unit, TO_LEGACY_LU_DBL( pad->m_Size.x ) * conv_unit,
pad->m_Size.y * conv_unit ); TO_LEGACY_LU_DBL( pad->m_Size.y ) * conv_unit );
fputs( line, rptfile ); fputs( line, rptfile );
sprintf( line, "drill %9.6f\n", pad->m_Drill.x * conv_unit ); sprintf( line, "drill %9.6f\n", TO_LEGACY_LU_DBL( pad->m_Drill.x ) * conv_unit );
fputs( line, rptfile ); fputs( line, rptfile );
sprintf( line, "shape_offset %9.6f %9.6f\n", sprintf( line, "shape_offset %9.6f %9.6f\n",
pad->m_Offset.x * conv_unit, TO_LEGACY_LU_DBL( pad->m_Offset.x ) * conv_unit,
pad->m_Offset.y * conv_unit ); TO_LEGACY_LU_DBL( pad->m_Offset.y ) * conv_unit );
fputs( line, rptfile ); fputs( line, rptfile );
sprintf( line, "orientation %.2f\n", sprintf( line, "orientation %.2f\n",
......
...@@ -254,8 +254,8 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw ) ...@@ -254,8 +254,8 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
if( pt_pad->m_PadShape != PAD_TRAPEZOID ) if( pt_pad->m_PadShape != PAD_TRAPEZOID )
{ {
pt_pad->m_DeltaSize.x = 0; pt_pad->m_DeltaSize.x = ZERO_LENGTH;
pt_pad->m_DeltaSize.y = 0; pt_pad->m_DeltaSize.y = ZERO_LENGTH;
} }
if( pt_pad->m_PadShape == PAD_CIRCLE ) if( pt_pad->m_PadShape == PAD_CIRCLE )
pt_pad->m_Size.y = pt_pad->m_Size.x; pt_pad->m_Size.y = pt_pad->m_Size.x;
...@@ -264,9 +264,9 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw ) ...@@ -264,9 +264,9 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
{ {
case PAD_SMD: case PAD_SMD:
case PAD_CONN: case PAD_CONN:
pt_pad->m_Drill = wxSize( 0, 0 ); pt_pad->m_Drill = VECTOR_PCB(ZERO_LENGTH, ZERO_LENGTH);//wxSize( 0, 0 );
pt_pad->m_Offset.x = 0; pt_pad->m_Offset.x = ZERO_LENGTH;
pt_pad->m_Offset.y = 0; pt_pad->m_Offset.y = ZERO_LENGTH;
break; break;
default: default:
......
...@@ -371,8 +371,8 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName ) ...@@ -371,8 +371,8 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
} }
Pad->m_Pos.x = (ibuf[0] + ibuf[2]) / 2; Pad->m_Pos.x = (ibuf[0] + ibuf[2]) / 2;
Pad->m_Pos.y = (ibuf[1] + ibuf[3]) / 2; Pad->m_Pos.y = (ibuf[1] + ibuf[3]) / 2;
Pad->m_Size.x = ibuf[4] + abs( ibuf[0] - ibuf[2] ); Pad->m_Size.x = FROM_LEGACY_LU( ibuf[4] + abs( ibuf[0] - ibuf[2] ) );
Pad->m_Size.y = ibuf[4] + abs( ibuf[1] - ibuf[3] ); Pad->m_Size.y = FROM_LEGACY_LU( ibuf[4] + abs( ibuf[1] - ibuf[3] ) );
Pad->m_Pos.x += m_Pos.x; Pad->m_Pos.x += m_Pos.x;
Pad->m_Pos.y += m_Pos.y; Pad->m_Pos.y += m_Pos.y;
...@@ -430,8 +430,8 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName ) ...@@ -430,8 +430,8 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
Pad->m_Pos.x = ibuf[0]; Pad->m_Pos.x = ibuf[0];
Pad->m_Pos.y = ibuf[1]; Pad->m_Pos.y = ibuf[1];
Pad->m_Drill.x = Pad->m_Drill.y = ibuf[5]; Pad->m_Drill.x = Pad->m_Drill.y = FROM_LEGACY_LU( (int) ibuf[5] );
Pad->m_Size.x = Pad->m_Size.y = ibuf[3] + Pad->m_Drill.x; Pad->m_Size.x = Pad->m_Size.y = FROM_LEGACY_LU( ibuf[3] ) + Pad->m_Drill.x;
Pad->m_Pos.x += m_Pos.x; Pad->m_Pos.x += m_Pos.x;
Pad->m_Pos.y += m_Pos.y; Pad->m_Pos.y += m_Pos.y;
......
...@@ -89,7 +89,7 @@ void PlacePad( BOARD* Pcb, D_PAD* pt_pad, int color, int marge, int op_logic ) ...@@ -89,7 +89,7 @@ void PlacePad( BOARD* Pcb, D_PAD* pt_pad, int color, int marge, int op_logic )
int dx, dy; int dx, dy;
wxPoint shape_pos = pt_pad->ReturnShapePos(); wxPoint shape_pos = pt_pad->ReturnShapePos();
dx = pt_pad->m_Size.x / 2; dx = TO_LEGACY_LU( pt_pad->m_Size.x / 2 );
dx += marge; dx += marge;
if( pt_pad->m_PadShape == PAD_CIRCLE ) if( pt_pad->m_PadShape == PAD_CIRCLE )
...@@ -100,13 +100,13 @@ void PlacePad( BOARD* Pcb, D_PAD* pt_pad, int color, int marge, int op_logic ) ...@@ -100,13 +100,13 @@ void PlacePad( BOARD* Pcb, D_PAD* pt_pad, int color, int marge, int op_logic )
} }
dy = pt_pad->m_Size.y / 2; dy = TO_LEGACY_LU( pt_pad->m_Size.y / 2 );
dy += marge; dy += marge;
if( pt_pad->m_PadShape == PAD_TRAPEZOID ) if( pt_pad->m_PadShape == PAD_TRAPEZOID )
{ {
dx += abs( pt_pad->m_DeltaSize.y ) / 2; dx += TO_LEGACY_LU( ABS( pt_pad->m_DeltaSize.y ) / 2 );
dy += abs( pt_pad->m_DeltaSize.x ) / 2; dy += TO_LEGACY_LU( ABS( pt_pad->m_DeltaSize.x ) / 2 );
} }
if( ( pt_pad->m_Orient % 900 ) == 0 ) /* The pad is a rectangle if( ( pt_pad->m_Orient % 900 ) == 0 ) /* The pad is a rectangle
......
...@@ -436,21 +436,21 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader ) ...@@ -436,21 +436,21 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
if( stricmp( line, "TrackWidthList" ) == 0 ) if( stricmp( line, "TrackWidthList" ) == 0 )
{ {
double tmp = atof( data ); //double tmp = atof( data );
GetBoard()->m_TrackWidthList.push_back( FROM_LEGACY_LU( tmp ) ); GetBoard()->m_TrackWidthList.push_back( LENGTH_LOAD_STR( data ) );
continue; continue;
} }
if( stricmp( line, "TrackClearence" ) == 0 ) if( stricmp( line, "TrackClearence" ) == 0 )
{ {
netclass_default->SetClearance( atoi( data ) ); netclass_default->Clearance( LENGTH_LOAD_STR( data ) );
continue; continue;
} }
if( stricmp( line, "TrackMinWidth" ) == 0 ) if( stricmp( line, "TrackMinWidth" ) == 0 )
{ {
double width = atof( data ); //double width = atof( data );
GetBoard()->GetBoardDesignSettings()->m_TrackMinWidth = FROM_LEGACY_LU( width ); GetBoard()->GetBoardDesignSettings()->m_TrackMinWidth = LENGTH_LOAD_STR( data );
continue; continue;
} }
...@@ -479,8 +479,8 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader ) ...@@ -479,8 +479,8 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
if( stricmp( line, "ViaMinSize" ) == 0 ) if( stricmp( line, "ViaMinSize" ) == 0 )
{ {
double diameter = atof( data ); //double diameter = atof( data );
GetBoard()->GetBoardDesignSettings()->m_ViasMinSize = FROM_LEGACY_LU( diameter ); GetBoard()->GetBoardDesignSettings()->m_MinVia.m_Diameter = LENGTH_LOAD_STR( data );
continue; continue;
} }
...@@ -491,22 +491,23 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader ) ...@@ -491,22 +491,23 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
if( stricmp( line, "MicroViaMinSize" ) == 0 ) if( stricmp( line, "MicroViaMinSize" ) == 0 )
{ {
double diameter = atof( data ); //double diameter = atof( data );
GetBoard()->GetBoardDesignSettings()->m_MicroViasMinSize = FROM_LEGACY_LU( diameter ); GetBoard()->GetBoardDesignSettings()->m_MinMicroVia.m_Diameter = LENGTH_LOAD_STR( data );
continue; continue;
} }
if( stricmp( line, "ViaSizeList" ) == 0 ) if( stricmp( line, "ViaSizeList" ) == 0 )
{ {
double tmp = atof( data ); //double tmp = atof( data );
VIA_DIMENSION via_dim; VIA_DIMENSION via_dim;
via_dim.m_Diameter = FROM_LEGACY_LU( tmp ); via_dim.m_Diameter = LENGTH_LOAD_STR( data );
data = strtok( NULL, " \n\r" ); data = strtok( NULL, " \n\r" );
if( data ) if( data )
{ {
tmp = atof( data ); //tmp = atof( data );
via_dim.m_Drill = FROM_LEGACY_LU( tmp > 0 ? tmp : 0 ); LENGTH_PCB tmp = LENGTH_LOAD_STR( data );
via_dim.m_Drill = tmp > ZERO_LENGTH ? tmp : ZERO_LENGTH;
} }
GetBoard()->m_ViasDimensionsList.push_back( via_dim ); GetBoard()->m_ViasDimensionsList.push_back( via_dim );
...@@ -515,29 +516,31 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader ) ...@@ -515,29 +516,31 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
if( stricmp( line, "ViaDrill" ) == 0 ) if( stricmp( line, "ViaDrill" ) == 0 )
{ {
int diameter = atoi( data ); VIA_DIMENSION via = netclass_default->Via();
netclass_default->SetViaDrill( diameter ); via.m_Drill = LENGTH_LOAD_STR( data );
netclass_default->Via( via );
continue; continue;
} }
if( stricmp( line, "ViaMinDrill" ) == 0 ) if( stricmp( line, "ViaMinDrill" ) == 0 )
{ {
double diameter = atof( data ); //double diameter = atof( data );
GetBoard()->GetBoardDesignSettings()->m_ViasMinDrill = FROM_LEGACY_LU( diameter ); GetBoard()->GetBoardDesignSettings()->m_MinVia.m_Drill = LENGTH_LOAD_STR( data );
continue; continue;
} }
if( stricmp( line, "MicroViaDrill" ) == 0 ) if( stricmp( line, "MicroViaDrill" ) == 0 )
{ {
int diameter = atoi( data ); VIA_DIMENSION via = netclass_default->MicroVia();
netclass_default->SetuViaDrill( diameter ); via.m_Drill = LENGTH_LOAD_STR( data );
netclass_default->MicroVia( via );
continue; continue;
} }
if( stricmp( line, "MicroViaMinDrill" ) == 0 ) if( stricmp( line, "MicroViaMinDrill" ) == 0 )
{ {
double diameter = atof( data ); //double diameter = atof( data );
GetBoard()->GetBoardDesignSettings()->m_MicroViasMinDrill = FROM_LEGACY_LU( diameter ); GetBoard()->GetBoardDesignSettings()->m_MinMicroVia.m_Drill = LENGTH_LOAD_STR( data );
continue; continue;
} }
...@@ -583,15 +586,15 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader ) ...@@ -583,15 +586,15 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
if( stricmp( line, "PadSize" ) == 0 ) if( stricmp( line, "PadSize" ) == 0 )
{ {
g_Pad_Master.m_Size.x = atoi( data ); g_Pad_Master.m_Size.x = LENGTH_LOAD_STR( data );
data = strtok( NULL, delims ); data = strtok( NULL, delims );
g_Pad_Master.m_Size.y = atoi( data ); g_Pad_Master.m_Size.y = LENGTH_LOAD_STR( data );
continue; continue;
} }
if( stricmp( line, "PadDrill" ) == 0 ) if( stricmp( line, "PadDrill" ) == 0 )
{ {
g_Pad_Master.m_Drill.x = atoi( data ); g_Pad_Master.m_Drill.x = LENGTH_LOAD_STR( data );
g_Pad_Master.m_Drill.y = g_Pad_Master.m_Drill.x; g_Pad_Master.m_Drill.y = g_Pad_Master.m_Drill.x;
continue; continue;
} }
...@@ -693,47 +696,57 @@ static int WriteSetup( FILE* aFile, PCB_EDIT_FRAME* aFrame, BOARD* aBoard ) ...@@ -693,47 +696,57 @@ static int WriteSetup( FILE* aFile, PCB_EDIT_FRAME* aFrame, BOARD* aBoard )
// Save custom tracks width list (the first is not saved here: this is the netclass value // Save custom tracks width list (the first is not saved here: this is the netclass value
for( unsigned ii = 1; ii < aBoard->m_TrackWidthList.size(); ii++ ) for( unsigned ii = 1; ii < aBoard->m_TrackWidthList.size(); ii++ )
fprintf( aFile, "TrackWidthList %f\n", TO_LEGACY_LU_DBL( aBoard->m_TrackWidthList[ii] ) ); fprintf( aFile, "TrackWidthList "FM_LENSV"\n", ARG_LENSV( aBoard->m_TrackWidthList[ii] ) );
fprintf( aFile, "TrackClearence %d\n", netclass_default->GetClearance() ); fprintf( aFile,
"TrackClearence "FM_LENSV"\n",
ARG_LENSV( netclass_default->Clearance() ) );
fprintf( aFile, "ZoneClearence %d\n", g_Zone_Default_Setting.m_ZoneClearance ); fprintf( aFile, "ZoneClearence %d\n", g_Zone_Default_Setting.m_ZoneClearance );
fprintf( aFile, fprintf( aFile,
"TrackMinWidth %f\n", "TrackMinWidth "FM_LENSV"\n",
TO_LEGACY_LU_DBL( aBoard->GetBoardDesignSettings()->m_TrackMinWidth ) ); ARG_LENSV( aBoard->GetBoardDesignSettings()->m_TrackMinWidth ) );
fprintf( aFile, "DrawSegmWidth %d\n", aBoard->GetBoardDesignSettings()->m_DrawSegmentWidth ); fprintf( aFile, "DrawSegmWidth %d\n", aBoard->GetBoardDesignSettings()->m_DrawSegmentWidth );
fprintf( aFile, "EdgeSegmWidth %d\n", aBoard->GetBoardDesignSettings()->m_EdgeSegmentWidth ); fprintf( aFile, "EdgeSegmWidth %d\n", aBoard->GetBoardDesignSettings()->m_EdgeSegmentWidth );
// Save current default via size, for compatibility with older Pcbnew version; // Save current default via size, for compatibility with older Pcbnew version;
fprintf( aFile, "ViaSize %d\n", netclass_default->GetViaDiameter() );
fprintf( aFile, "ViaDrill %d\n", netclass_default->GetViaDrill() );
fprintf( aFile, fprintf( aFile,
"ViaMinSize %f\n", "ViaSize "FM_LENSV"\n",
TO_LEGACY_LU_DBL( aBoard->GetBoardDesignSettings()->m_ViasMinSize ) ); ARG_LENSV( netclass_default->Via().m_Diameter ) );
fprintf( aFile,
"ViaDrill "FM_LENSV"\n",
ARG_LENSV( netclass_default->Via().m_Drill ) );
fprintf( aFile,
"ViaMinSize "FM_LENSV"\n",
ARG_LENSV( aBoard->GetBoardDesignSettings()->m_MinVia.m_Diameter ) );
fprintf( aFile, fprintf( aFile,
"ViaMinDrill %f\n", "ViaMinDrill "FM_LENSV"\n",
TO_LEGACY_LU_DBL( aBoard->GetBoardDesignSettings()->m_ViasMinDrill ) ); ARG_LENSV( aBoard->GetBoardDesignSettings()->m_MinVia.m_Drill ) );
// Save custom vias diameters list (the first is not saved here: this is // Save custom vias diameters list (the first is not saved here: this is
// the netclass value // the netclass value
for( unsigned ii = 1; ii < aBoard->m_ViasDimensionsList.size(); ii++ ) for( unsigned ii = 1; ii < aBoard->m_ViasDimensionsList.size(); ii++ )
fprintf( aFile, "ViaSizeList %f %f\n", fprintf( aFile, "ViaSizeList "FM_LENSV" "FM_LENSV"\n",
TO_LEGACY_LU_DBL( aBoard->m_ViasDimensionsList[ii].m_Diameter ), ARG_LENSV( aBoard->m_ViasDimensionsList[ii].m_Diameter ),
TO_LEGACY_LU_DBL( aBoard->m_ViasDimensionsList[ii].m_Drill ) ); ARG_LENSV( aBoard->m_ViasDimensionsList[ii].m_Drill ) );
// for old versions compatibility: // for old versions compatibility:
fprintf( aFile, "MicroViaSize %d\n", netclass_default->GetuViaDiameter() ); fprintf( aFile,
fprintf( aFile, "MicroViaDrill %d\n", netclass_default->GetuViaDrill() ); "MicroViaSize "FM_LENSV"\n",
ARG_LENSV( netclass_default->MicroVia().m_Diameter ) );
fprintf( aFile,
"MicroViaDrill "FM_LENSV"\n",
ARG_LENSV( netclass_default->MicroVia().m_Drill ) );
fprintf( aFile, fprintf( aFile,
"MicroViasAllowed %d\n", "MicroViasAllowed %d\n",
aBoard->GetBoardDesignSettings()->m_MicroViasAllowed ); aBoard->GetBoardDesignSettings()->m_MicroViasAllowed );
fprintf( aFile, fprintf( aFile,
"MicroViaMinSize %f\n", "MicroViaMinSize "FM_LENSV"\n",
TO_LEGACY_LU_DBL( aBoard->GetBoardDesignSettings()->m_MicroViasMinSize ) ); ARG_LENSV( aBoard->GetBoardDesignSettings()->m_MinMicroVia.m_Diameter ) );
fprintf( aFile, fprintf( aFile,
"MicroViaMinDrill %f\n", "MicroViaMinDrill "FM_LENSV"\n",
TO_LEGACY_LU_DBL( aBoard->GetBoardDesignSettings()->m_MicroViasMinDrill ) ); ARG_LENSV( aBoard->GetBoardDesignSettings()->m_MinMicroVia.m_Drill ) );
fprintf( aFile, "TextPcbWidth %d\n", aBoard->GetBoardDesignSettings()->m_PcbTextWidth ); fprintf( aFile, "TextPcbWidth %d\n", aBoard->GetBoardDesignSettings()->m_PcbTextWidth );
fprintf( aFile, fprintf( aFile,
...@@ -744,8 +757,8 @@ static int WriteSetup( FILE* aFile, PCB_EDIT_FRAME* aFrame, BOARD* aBoard ) ...@@ -744,8 +757,8 @@ static int WriteSetup( FILE* aFile, PCB_EDIT_FRAME* aFrame, BOARD* aBoard )
fprintf( aFile, "EdgeModWidth %d\n", g_ModuleSegmentWidth ); fprintf( aFile, "EdgeModWidth %d\n", g_ModuleSegmentWidth );
fprintf( aFile, "TextModSize %d %d\n", g_ModuleTextSize.x, g_ModuleTextSize.y ); fprintf( aFile, "TextModSize %d %d\n", g_ModuleTextSize.x, g_ModuleTextSize.y );
fprintf( aFile, "TextModWidth %d\n", g_ModuleTextWidth ); fprintf( aFile, "TextModWidth %d\n", g_ModuleTextWidth );
fprintf( aFile, "PadSize %d %d\n", g_Pad_Master.m_Size.x, g_Pad_Master.m_Size.y ); fprintf( aFile, "PadSize "FM_LENSV" "FM_LENSV"\n", ARG_LENSV( g_Pad_Master.m_Size.x ), ARG_LENSV( g_Pad_Master.m_Size.y ) );
fprintf( aFile, "PadDrill %d\n", g_Pad_Master.m_Drill.x ); fprintf( aFile, "PadDrill "FM_LENSV"\n", ARG_LENSV( g_Pad_Master.m_Drill.x ) );
fprintf( aFile, fprintf( aFile,
"Pad2MaskClearance %d\n", "Pad2MaskClearance %d\n",
aBoard->GetBoardDesignSettings()->m_SolderMaskMargin ); aBoard->GetBoardDesignSettings()->m_SolderMaskMargin );
......
...@@ -692,7 +692,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -692,7 +692,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
// TODO: this should be refactored in the name of good programming style
void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform ) void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
{ {
D_PAD* pad = module->m_Pads; D_PAD* pad = module->m_Pads;
...@@ -708,11 +708,18 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform ) ...@@ -708,11 +708,18 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
for( ; pad != NULL; pad = (D_PAD*) pad->Next() ) for( ; pad != NULL; pad = (D_PAD*) pad->Next() )
{ {
pad->m_Pos0 = pad->m_Pos; pad->m_Pos0 = FROM_LEGACY_LU_VEC( pad->m_Pos );
pad->m_Orient -= angle; pad->m_Orient -= angle;
RotatePoint( &pad->m_Offset.x, &pad->m_Offset.y, angle ); wxPoint of;
of.x = TO_LEGACY_LU( pad->m_Offset.x );
of.y = TO_LEGACY_LU( pad->m_Offset.y );
RotatePoint( &of.x, &of.y, angle );
pad->m_Offset.x = FROM_LEGACY_LU( of.x );
pad->m_Offset.y = FROM_LEGACY_LU( of.y );
EXCHG( pad->m_Size.x, pad->m_Size.y ); EXCHG( pad->m_Size.x, pad->m_Size.y );
RotatePoint( &pad->m_DeltaSize.x, &pad->m_DeltaSize.y, -angle ); wxSize delta = TO_LEGACY_LU_WXS( pad->m_DeltaSize );
RotatePoint( &delta.x, &delta.y, -angle );
pad->m_DeltaSize = VECTOR_PCB( FROM_LEGACY_LU( delta.x ), FROM_LEGACY_LU( delta.y ) );
} }
module->m_Reference->m_Pos0 = module->m_Reference->m_Pos; module->m_Reference->m_Pos0 = module->m_Reference->m_Pos;
......
...@@ -148,7 +148,7 @@ void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw ) ...@@ -148,7 +148,7 @@ void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
aPad->m_Orient = g_Pad_Master.m_Orient + aPad->m_Orient = g_Pad_Master.m_Orient +
( (MODULE*) aPad->GetParent() )->m_Orient; ( (MODULE*) aPad->GetParent() )->m_Orient;
aPad->m_Size = g_Pad_Master.m_Size; aPad->m_Size = g_Pad_Master.m_Size;
aPad->m_DeltaSize = wxSize( 0, 0 ); aPad->m_DeltaSize = VECTOR_PCB( ZERO_LENGTH, ZERO_LENGTH );//wxSize( 0, 0 );
aPad->m_Offset = g_Pad_Master.m_Offset; aPad->m_Offset = g_Pad_Master.m_Offset;
aPad->m_Drill = g_Pad_Master.m_Drill; aPad->m_Drill = g_Pad_Master.m_Drill;
aPad->m_DrillShape = g_Pad_Master.m_DrillShape; aPad->m_DrillShape = g_Pad_Master.m_DrillShape;
...@@ -168,9 +168,8 @@ void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw ) ...@@ -168,9 +168,8 @@ void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
{ {
case PAD_SMD: case PAD_SMD:
case PAD_CONN: case PAD_CONN:
aPad->m_Drill = wxSize( 0, 0 ); aPad->m_Drill = VECTOR_PCB( ZERO_LENGTH, ZERO_LENGTH ); //wxSize( 0, 0 );
aPad->m_Offset.x = 0; aPad->m_Offset = VECTOR_PCB( ZERO_LENGTH, ZERO_LENGTH );
aPad->m_Offset.y = 0;
} }
aPad->ComputeShapeMaxRadius(); aPad->ComputeShapeMaxRadius();
...@@ -205,8 +204,10 @@ void PCB_BASE_FRAME::AddPad( MODULE* Module, bool draw ) ...@@ -205,8 +204,10 @@ void PCB_BASE_FRAME::AddPad( MODULE* Module, bool draw )
// Set the relative pad position // Set the relative pad position
// ( pad position for module orient, 0, and relative to the module position) // ( pad position for module orient, 0, and relative to the module position)
Pad->m_Pos0 = Pad->m_Pos - Module->m_Pos; Pad->m_Pos0 = FROM_LEGACY_LU_VEC( Pad->m_Pos - Module->m_Pos );
RotatePoint( &Pad->m_Pos0, -Module->m_Orient ); wxPoint p = TO_LEGACY_LU_WXP( Pad->m_Pos0 );
RotatePoint( &p, -Module->m_Orient );
Pad->m_Pos0 = FROM_LEGACY_LU_VEC( p );
/* Automatically increment the current pad number. */ /* Automatically increment the current pad number. */
long num = 0; long num = 0;
...@@ -365,8 +366,8 @@ void PCB_BASE_FRAME::PlacePad( D_PAD* Pad, wxDC* DC ) ...@@ -365,8 +366,8 @@ void PCB_BASE_FRAME::PlacePad( D_PAD* Pad, wxDC* DC )
dY = Pad->m_Pos.y - Pad_OldPos.y; dY = Pad->m_Pos.y - Pad_OldPos.y;
RotatePoint( &dX, &dY, -Module->m_Orient ); RotatePoint( &dX, &dY, -Module->m_Orient );
Pad->m_Pos0.x += dX; Pad->m_Pos0.x += FROM_LEGACY_LU( dX );
s_CurrentSelectedPad->m_Pos0.y += dY; s_CurrentSelectedPad->m_Pos0.y += FROM_LEGACY_LU( dY ); /// @BUG???
Pad->m_Flags = 0; Pad->m_Flags = 0;
......
...@@ -261,8 +261,8 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC ) ...@@ -261,8 +261,8 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
PtPad->SetPadName( wxT( "1" ) ); PtPad->SetPadName( wxT( "1" ) );
PtPad->m_Pos = Mself.m_End; PtPad->m_Pos = Mself.m_End;
PtPad->m_Pos0 = PtPad->m_Pos - Module->m_Pos; PtPad->m_Pos0 = FROM_LEGACY_LU_VEC( PtPad->m_Pos - Module->m_Pos );
PtPad->m_Size.x = PtPad->m_Size.y = Mself.m_Width; PtPad->m_Size.x = PtPad->m_Size.y = FROM_LEGACY_LU( Mself.m_Width );
PtPad->m_layerMask = g_TabOneLayerMask[Module->GetLayer()]; PtPad->m_layerMask = g_TabOneLayerMask[Module->GetLayer()];
PtPad->m_Attribut = PAD_SMD; PtPad->m_Attribut = PAD_SMD;
PtPad->m_PadShape = PAD_CIRCLE; PtPad->m_PadShape = PAD_CIRCLE;
...@@ -276,7 +276,7 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC ) ...@@ -276,7 +276,7 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
PtPad = newpad; PtPad = newpad;
PtPad->SetPadName( wxT( "2" ) ); PtPad->SetPadName( wxT( "2" ) );
PtPad->m_Pos = Mself.m_Start; PtPad->m_Pos = Mself.m_Start;
PtPad->m_Pos0 = PtPad->m_Pos - Module->m_Pos; PtPad->m_Pos0 = FROM_LEGACY_LU_VEC( PtPad->m_Pos - Module->m_Pos );
/* Modify text positions. */ /* Modify text positions. */
Module->DisplayInfo( this ); Module->DisplayInfo( this );
...@@ -552,7 +552,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveBasicShape( const wxString& name, int pad_c ...@@ -552,7 +552,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveBasicShape( const wxString& name, int pad_c
Module->m_Pads.PushFront( pad ); Module->m_Pads.PushFront( pad );
pad->m_Size.x = pad->m_Size.y = GetBoard()->GetCurrentTrackWidth(); pad->m_Size.x = pad->m_Size.y = FROM_LEGACY_LU( GetBoard()->GetCurrentTrackWidth() );
pad->m_Pos = Module->m_Pos; pad->m_Pos = Module->m_Pos;
pad->m_PadShape = PAD_RECT; pad->m_PadShape = PAD_RECT;
pad->m_Attribut = PAD_SMD; pad->m_Attribut = PAD_SMD;
...@@ -656,19 +656,19 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type ) ...@@ -656,19 +656,19 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
switch( shape_type ) switch( shape_type )
{ {
case 0: //Gap : case 0: //Gap :
oX = pad->m_Pos0.x = -( gap_size + pad->m_Size.x ) / 2; pad->m_Pos0.x = FROM_LEGACY_LU( oX = -( gap_size + TO_LEGACY_LU( pad->m_Size.x ) ) / 2 );
pad->m_Pos.x += pad->m_Pos0.x; pad->m_Pos.x += TO_LEGACY_LU( pad->m_Pos0.x );
pad = pad->Next(); pad = pad->Next();
pad->m_Pos0.x = oX + gap_size + pad->m_Size.x; pad->m_Pos0.x = FROM_LEGACY_LU( oX + gap_size + TO_LEGACY_LU( pad->m_Size.x ) );
pad->m_Pos.x += pad->m_Pos0.x; pad->m_Pos.x += TO_LEGACY_LU( pad->m_Pos0.x );
break; break;
case 1: //Stub : case 1: //Stub :
pad->SetPadName( wxT( "1" ) ); pad->SetPadName( wxT( "1" ) );
pad = pad->Next(); pad = pad->Next();
pad->m_Pos0.y = -( gap_size + pad->m_Size.y ) / 2; pad->m_Pos0.y = FROM_LEGACY_LU( -( gap_size + TO_LEGACY_LU( pad->m_Size.y ) ) / 2 );
pad->m_Size.y = gap_size; pad->m_Size.y = FROM_LEGACY_LU( gap_size );
pad->m_Pos.y += pad->m_Pos0.y; pad->m_Pos.y += TO_LEGACY_LU( pad->m_Pos0.y );
break; break;
case 2: // Arc Stub created by a polygonal approach: case 2: // Arc Stub created by a polygonal approach:
...@@ -683,7 +683,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type ) ...@@ -683,7 +683,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
std::vector<wxPoint> polyPoints = edge->GetPolyPoints(); std::vector<wxPoint> polyPoints = edge->GetPolyPoints();
polyPoints.reserve( numPoints ); polyPoints.reserve( numPoints );
edge->m_Start0.y = -pad->m_Size.y / 2; edge->m_Start0.y = TO_LEGACY_LU( -pad->m_Size.y / 2 );
polyPoints.push_back( wxPoint( 0, 0 ) ); polyPoints.push_back( wxPoint( 0, 0 ) );
...@@ -968,12 +968,12 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape() ...@@ -968,12 +968,12 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
Module = Create_MuWaveBasicShape( cmp_name, pad_count ); Module = Create_MuWaveBasicShape( cmp_name, pad_count );
pad1 = Module->m_Pads; pad1 = Module->m_Pads;
pad1->m_Pos0.x = -ShapeSize.x / 2; pad1->m_Pos0.x = FROM_LEGACY_LU( -ShapeSize.x / 2 );
pad1->m_Pos.x += pad1->m_Pos0.x; pad1->m_Pos.x += TO_LEGACY_LU( pad1->m_Pos0.x );
pad2 = (D_PAD*) pad1->Next(); pad2 = (D_PAD*) pad1->Next();
pad2->m_Pos0.x = pad1->m_Pos0.x + ShapeSize.x; pad2->m_Pos0.x = pad1->m_Pos0.x + FROM_LEGACY_LU( ShapeSize.x );
pad2->m_Pos.x += pad2->m_Pos0.x; pad2->m_Pos.x += TO_LEGACY_LU( pad2->m_Pos0.x );
edge = new EDGE_MODULE( Module ); edge = new EDGE_MODULE( Module );
...@@ -987,13 +987,13 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape() ...@@ -987,13 +987,13 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
polyPoints.reserve( 2 * PolyEdges.size() + 2 ); polyPoints.reserve( 2 * PolyEdges.size() + 2 );
// Init start point coord: // Init start point coord:
polyPoints.push_back( wxPoint( pad1->m_Pos0.x, 0 ) ); polyPoints.push_back( wxPoint( TO_LEGACY_LU( pad1->m_Pos0.x ), 0 ) );
wxPoint first_coordinate, last_coordinate; wxPoint first_coordinate, last_coordinate;
for( ii = 0; ii < PolyEdges.size(); ii++ ) // Copy points for( ii = 0; ii < PolyEdges.size(); ii++ ) // Copy points
{ {
last_coordinate.x = wxRound( PolyEdges[ii] * ShapeScaleX ) + pad1->m_Pos0.x; last_coordinate.x = wxRound( PolyEdges[ii] * ShapeScaleX ) + TO_LEGACY_LU( pad1->m_Pos0.x );
last_coordinate.y = -wxRound( PolyEdges[ii] * ShapeScaleY ); last_coordinate.y = -wxRound( PolyEdges[ii] * ShapeScaleY );
polyPoints.push_back( last_coordinate ); polyPoints.push_back( last_coordinate );
} }
...@@ -1005,15 +1005,15 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape() ...@@ -1005,15 +1005,15 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
case 0: // Single case 0: // Single
case 2: // Single mirrored case 2: // Single mirrored
// Init end point coord: // Init end point coord:
pad2->m_Pos0.x = last_coordinate.x; pad2->m_Pos0.x = FROM_LEGACY_LU( last_coordinate.x );
polyPoints.push_back( wxPoint( last_coordinate.x, 0 ) ); polyPoints.push_back( wxPoint( last_coordinate.x, 0 ) );
pad1->m_Size.x = pad1->m_Size.y = ABS( first_coordinate.y ); pad1->m_Size.x = pad1->m_Size.y = FROM_LEGACY_LU( ABS( first_coordinate.y ) );
pad2->m_Size.x = pad2->m_Size.y = ABS( last_coordinate.y ); pad2->m_Size.x = pad2->m_Size.y = FROM_LEGACY_LU( ABS( last_coordinate.y ) );
pad1->m_Pos0.y = first_coordinate.y / 2; pad1->m_Pos0.y = FROM_LEGACY_LU( first_coordinate.y / 2 );
pad2->m_Pos0.y = last_coordinate.y / 2; pad2->m_Pos0.y = FROM_LEGACY_LU( last_coordinate.y / 2 );
pad1->m_Pos.y = pad1->m_Pos0.y + Module->m_Pos.y; pad1->m_Pos.y = TO_LEGACY_LU( pad1->m_Pos0.y ) + Module->m_Pos.y;
pad2->m_Pos.y = pad2->m_Pos0.y + Module->m_Pos.y; pad2->m_Pos.y = TO_LEGACY_LU( pad2->m_Pos0.y ) + Module->m_Pos.y;
break; break;
case 1: // Symmetric case 1: // Symmetric
...@@ -1026,8 +1026,8 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape() ...@@ -1026,8 +1026,8 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
polyPoints.push_back( pt ); polyPoints.push_back( pt );
} }
pad1->m_Size.x = pad1->m_Size.y = 2 * ABS( first_coordinate.y ); pad1->m_Size.x = pad1->m_Size.y = FROM_LEGACY_LU( 2 * ABS( first_coordinate.y ) );
pad2->m_Size.x = pad2->m_Size.y = 2 * ABS( last_coordinate.y ); pad2->m_Size.x = pad2->m_Size.y = FROM_LEGACY_LU( 2 * ABS( last_coordinate.y ) );
break; break;
} }
...@@ -1073,7 +1073,7 @@ void PCB_EDIT_FRAME::Edit_Gap( wxDC* DC, MODULE* Module ) ...@@ -1073,7 +1073,7 @@ void PCB_EDIT_FRAME::Edit_Gap( wxDC* DC, MODULE* Module )
Module->Draw( DrawPanel, DC, GR_XOR ); Module->Draw( DrawPanel, DC, GR_XOR );
/* Calculate the current dimension. */ /* Calculate the current dimension. */
gap_size = next_pad->m_Pos0.x - pad->m_Pos0.x - pad->m_Size.x; gap_size = TO_LEGACY_LU( next_pad->m_Pos0.x - pad->m_Pos0.x - pad->m_Size.x );
/* Entrer the desired length of the gap. */ /* Entrer the desired length of the gap. */
msg = ReturnStringFromValue( g_UserUnit, gap_size, GetScreen()->GetInternalUnits() ); msg = ReturnStringFromValue( g_UserUnit, gap_size, GetScreen()->GetInternalUnits() );
...@@ -1086,19 +1086,19 @@ void PCB_EDIT_FRAME::Edit_Gap( wxDC* DC, MODULE* Module ) ...@@ -1086,19 +1086,19 @@ void PCB_EDIT_FRAME::Edit_Gap( wxDC* DC, MODULE* Module )
gap_size = ReturnValueFromString( g_UserUnit, msg, GetScreen()->GetInternalUnits() ); gap_size = ReturnValueFromString( g_UserUnit, msg, GetScreen()->GetInternalUnits() );
/* Updating sizes of pads forming the gap. */ /* Updating sizes of pads forming the gap. */
pad->m_Size.x = pad->m_Size.y = GetBoard()->GetCurrentTrackWidth(); pad->m_Size.x = pad->m_Size.y = FROM_LEGACY_LU( GetBoard()->GetCurrentTrackWidth() );
pad->m_Pos0.y = 0; pad->m_Pos0.y = ZERO_LENGTH;
oX = pad->m_Pos0.x = -( (gap_size + pad->m_Size.x) / 2 ); pad->m_Pos0.x = FROM_LEGACY_LU( oX = -( ( gap_size + TO_LEGACY_LU( pad->m_Size.x ) ) / 2 ) );
pad->m_Pos.x = pad->m_Pos0.x + Module->m_Pos.x; pad->m_Pos.x = TO_LEGACY_LU( pad->m_Pos0.x ) + Module->m_Pos.x;
pad->m_Pos.y = pad->m_Pos0.y + Module->m_Pos.y; pad->m_Pos.y = TO_LEGACY_LU( pad->m_Pos0.y ) + Module->m_Pos.y;
RotatePoint( &pad->m_Pos.x, &pad->m_Pos.y, RotatePoint( &pad->m_Pos.x, &pad->m_Pos.y,
Module->m_Pos.x, Module->m_Pos.y, Module->m_Orient ); Module->m_Pos.x, Module->m_Pos.y, Module->m_Orient );
next_pad->m_Size.x = next_pad->m_Size.y = GetBoard()->GetCurrentTrackWidth(); next_pad->m_Size.x = next_pad->m_Size.y = FROM_LEGACY_LU( GetBoard()->GetCurrentTrackWidth() );
next_pad->m_Pos0.y = 0; next_pad->m_Pos0.y = ZERO_LENGTH;
next_pad->m_Pos0.x = oX + gap_size + next_pad->m_Size.x; next_pad->m_Pos0.x = FROM_LEGACY_LU( oX + gap_size + TO_LEGACY_LU( next_pad->m_Size.x ) );
next_pad->m_Pos.x = next_pad->m_Pos0.x + Module->m_Pos.x; next_pad->m_Pos.x = TO_LEGACY_LU( next_pad->m_Pos0.x ) + Module->m_Pos.x;
next_pad->m_Pos.y = next_pad->m_Pos0.y + Module->m_Pos.y; next_pad->m_Pos.y = TO_LEGACY_LU( next_pad->m_Pos0.y ) + Module->m_Pos.y;
RotatePoint( &next_pad->m_Pos.x, &next_pad->m_Pos.y, RotatePoint( &next_pad->m_Pos.x, &next_pad->m_Pos.y,
Module->m_Pos.x, Module->m_Pos.y, Module->m_Orient ); Module->m_Pos.x, Module->m_Pos.y, Module->m_Orient );
......
...@@ -217,12 +217,16 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetProjectFileParameters() ...@@ -217,12 +217,16 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetProjectFileParameters()
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ), m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ),
&g_LibraryNames, &g_LibraryNames,
GROUPLIB ) ); GROUPLIB ) );
#ifdef KICAD_NANOMETRE
/* TODO: something should be done here!!! */
#else
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "PadDrlX" ), &g_Pad_Master.m_Drill.x, m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "PadDrlX" ), &g_Pad_Master.m_Drill.x,
320, 0, 0x7FFF ) ); 320, 0, 0x7FFF ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "PadDimH" ), &g_Pad_Master.m_Size.x, m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "PadDimH" ), &g_Pad_Master.m_Size.x,
550, 0, 0x7FFF ) ); 550, 0, 0x7FFF ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "PadDimV" ), &g_Pad_Master.m_Size.y, m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "PadDimV" ), &g_Pad_Master.m_Size.y,
550, 0, 0x7FFF ) ); 550, 0, 0x7FFF ) );
#endif
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "BoardThickness" ), m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "BoardThickness" ),
&boardDesignSettings.m_BoardThickness, &boardDesignSettings.m_BoardThickness,
630, 0, 0xFFFF ) ); 630, 0, 0xFFFF ) );
......
...@@ -97,11 +97,11 @@ void PCB_BASE_FRAME::PlotSilkScreen( PLOTTER* plotter, int aLayerMask, GRTraceMo ...@@ -97,11 +97,11 @@ void PCB_BASE_FRAME::PlotSilkScreen( PLOTTER* plotter, int aLayerMask, GRTraceMo
switch( pad->m_PadShape & 0x7F ) switch( pad->m_PadShape & 0x7F )
{ {
case PAD_CIRCLE: case PAD_CIRCLE:
plotter->flash_pad_circle( shape_pos, pad->m_Size.x, FILAIRE ); plotter->flash_pad_circle( shape_pos, TO_LEGACY_LU( pad->m_Size.x ), FILAIRE );
break; break;
case PAD_OVAL: case PAD_OVAL:
plotter->flash_pad_oval( shape_pos, pad->m_Size, pad->m_Orient, FILAIRE ); plotter->flash_pad_oval( shape_pos, TO_LEGACY_LU_WXS( pad->m_Size ), pad->m_Orient, FILAIRE );
break; break;
case PAD_TRAPEZOID: case PAD_TRAPEZOID:
...@@ -114,7 +114,7 @@ void PCB_BASE_FRAME::PlotSilkScreen( PLOTTER* plotter, int aLayerMask, GRTraceMo ...@@ -114,7 +114,7 @@ void PCB_BASE_FRAME::PlotSilkScreen( PLOTTER* plotter, int aLayerMask, GRTraceMo
case PAD_RECT: case PAD_RECT:
default: default:
plotter->flash_pad_rect( shape_pos, pad->m_Size, pad->m_Orient, FILAIRE ); plotter->flash_pad_rect( shape_pos, TO_LEGACY_LU_WXS( pad->m_Size ), pad->m_Orient, FILAIRE );
break; break;
} }
} }
...@@ -840,8 +840,8 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter, ...@@ -840,8 +840,8 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
break; break;
} }
size.x = pad->m_Size.x + ( 2 * margin.x ); size.x = TO_LEGACY_LU( pad->m_Size.x ) + ( 2 * margin.x );
size.y = pad->m_Size.y + ( 2 * margin.y ); size.y = TO_LEGACY_LU( pad->m_Size.y ) + ( 2 * margin.y );
/* Don't draw a null size item : */ /* Don't draw a null size item : */
if( size.x <= 0 || size.y <= 0 ) if( size.x <= 0 || size.y <= 0 )
...@@ -851,7 +851,8 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter, ...@@ -851,7 +851,8 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
{ {
case PAD_CIRCLE: case PAD_CIRCLE:
if( aSkipNPTH_Pads && if( aSkipNPTH_Pads &&
(pad->m_Size == pad->m_Drill) && ( pad->m_Size.x == pad->m_Drill.x ) &&
( pad->m_Size.y == pad->m_Drill.y ) &&
(pad->m_Attribut == PAD_HOLE_NOT_PLATED) ) (pad->m_Attribut == PAD_HOLE_NOT_PLATED) )
break; break;
...@@ -860,7 +861,8 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter, ...@@ -860,7 +861,8 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
case PAD_OVAL: case PAD_OVAL:
if( aSkipNPTH_Pads && if( aSkipNPTH_Pads &&
(pad->m_Size == pad->m_Drill) && (pad->m_Size.x == pad->m_Drill.x ) &&
(pad->m_Size.y == pad->m_Drill.y ) &&
(pad->m_Attribut == PAD_HOLE_NOT_PLATED) ) (pad->m_Attribut == PAD_HOLE_NOT_PLATED) )
break; break;
...@@ -1016,7 +1018,7 @@ void PCB_BASE_FRAME::PlotDrillMark( PLOTTER* aPlotter, ...@@ -1016,7 +1018,7 @@ void PCB_BASE_FRAME::PlotDrillMark( PLOTTER* aPlotter,
{ {
for( PtPad = Module->m_Pads; PtPad != NULL; PtPad = PtPad->Next() ) for( PtPad = Module->m_Pads; PtPad != NULL; PtPad = PtPad->Next() )
{ {
if( PtPad->m_Drill.x == 0 ) if( PtPad->m_Drill.x == ZERO_LENGTH )
continue; continue;
// Output hole shapes: // Output hole shapes:
...@@ -1024,12 +1026,13 @@ void PCB_BASE_FRAME::PlotDrillMark( PLOTTER* aPlotter, ...@@ -1024,12 +1026,13 @@ void PCB_BASE_FRAME::PlotDrillMark( PLOTTER* aPlotter,
if( PtPad->m_DrillShape == PAD_OVAL ) if( PtPad->m_DrillShape == PAD_OVAL )
{ {
diam = PtPad->m_Drill; diam.x = TO_LEGACY_LU( PtPad->m_Drill.x );
diam.y = TO_LEGACY_LU( PtPad->m_Drill.y );
aPlotter->flash_pad_oval( pos, diam, PtPad->m_Orient, aTraceMode ); aPlotter->flash_pad_oval( pos, diam, PtPad->m_Orient, aTraceMode );
} }
else else
{ {
diam.x = aSmallDrillShape ? SMALL_DRILL : PtPad->m_Drill.x; diam.x = aSmallDrillShape ? SMALL_DRILL : TO_LEGACY_LU( PtPad->m_Drill.x );
aPlotter->flash_pad_circle( pos, diam.x, aTraceMode ); aPlotter->flash_pad_circle( pos, diam.x, aTraceMode );
} }
} }
......
...@@ -351,16 +351,18 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule, ...@@ -351,16 +351,18 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule,
continue; continue;
// Manage hole according to the print drill option // Manage hole according to the print drill option
wxSize drill_tmp = pt_pad->m_Drill; wxSize drill_tmp;
drill_tmp.x = TO_LEGACY_LU( pt_pad->m_Drill.x );
drill_tmp.y = TO_LEGACY_LU( pt_pad->m_Drill.y );
switch ( aDrillShapeOpt ) switch ( aDrillShapeOpt )
{ {
case PRINT_PARAMETERS::NO_DRILL_SHAPE: case PRINT_PARAMETERS::NO_DRILL_SHAPE:
pt_pad->m_Drill = wxSize(0,0); pt_pad->m_Drill = VECTOR_PCB(ZERO_LENGTH, ZERO_LENGTH); //wxSize(0,0);
break; break;
case PRINT_PARAMETERS::SMALL_DRILL_SHAPE: case PRINT_PARAMETERS::SMALL_DRILL_SHAPE:
pt_pad->m_Drill.x = MIN(SMALL_DRILL,pt_pad->m_Drill.x); pt_pad->m_Drill.x = MIN(FROM_LEGACY_LU( SMALL_DRILL ),pt_pad->m_Drill.x );
pt_pad->m_Drill.y = MIN(SMALL_DRILL,pt_pad->m_Drill.y); pt_pad->m_Drill.y = MIN(FROM_LEGACY_LU( SMALL_DRILL ),pt_pad->m_Drill.y );
break; break;
case PRINT_PARAMETERS::FULL_DRILL_SHAPE: case PRINT_PARAMETERS::FULL_DRILL_SHAPE:
// Do nothing // Do nothing
...@@ -368,7 +370,8 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule, ...@@ -368,7 +370,8 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule,
} }
pt_pad->Draw( aPanel, aDC, aDraw_mode ); pt_pad->Draw( aPanel, aDC, aDraw_mode );
pt_pad->m_Drill = drill_tmp; pt_pad->m_Drill.x = FROM_LEGACY_LU( drill_tmp.x );
pt_pad->m_Drill.y = FROM_LEGACY_LU( drill_tmp.y );
} }
/* Print footprint graphic shapes */ /* Print footprint graphic shapes */
......
...@@ -464,8 +464,8 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe, ...@@ -464,8 +464,8 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
+ pcbframe->GetBoard()->m_BoundaryBox.m_Pos.x; + pcbframe->GetBoard()->m_BoundaryBox.m_Pos.x;
int cY = ( Board.m_GridRouting * row_source ) int cY = ( Board.m_GridRouting * row_source )
+ pcbframe->GetBoard()->m_BoundaryBox.m_Pos.y; + pcbframe->GetBoard()->m_BoundaryBox.m_Pos.y;
int dx = pt_cur_ch->m_PadStart->m_Size.x / 2; int dx = TO_LEGACY_LU( pt_cur_ch->m_PadStart->m_Size.x / 2 );
int dy = pt_cur_ch->m_PadStart->m_Size.y / 2; int dy = TO_LEGACY_LU( pt_cur_ch->m_PadStart->m_Size.y / 2 );
int px = pt_cur_ch->m_PadStart->GetPosition().x; int px = pt_cur_ch->m_PadStart->GetPosition().x;
int py = pt_cur_ch->m_PadStart->GetPosition().y; int py = pt_cur_ch->m_PadStart->GetPosition().y;
...@@ -479,8 +479,8 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe, ...@@ -479,8 +479,8 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
+ pcbframe->GetBoard()->m_BoundaryBox.m_Pos.x; + pcbframe->GetBoard()->m_BoundaryBox.m_Pos.x;
cY = ( Board.m_GridRouting * row_target ) cY = ( Board.m_GridRouting * row_target )
+ pcbframe->GetBoard()->m_BoundaryBox.m_Pos.y; + pcbframe->GetBoard()->m_BoundaryBox.m_Pos.y;
dx = pt_cur_ch->m_PadEnd->m_Size.x / 2; dx = TO_LEGACY_LU( pt_cur_ch->m_PadEnd->m_Size.x / 2 );
dy = pt_cur_ch->m_PadEnd->m_Size.y / 2; dy = TO_LEGACY_LU( pt_cur_ch->m_PadEnd->m_Size.y / 2 );
px = pt_cur_ch->m_PadEnd->GetPosition().x; px = pt_cur_ch->m_PadEnd->GetPosition().x;
py = pt_cur_ch->m_PadEnd->GetPosition().y; py = pt_cur_ch->m_PadEnd->GetPosition().y;
......
...@@ -321,11 +321,11 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad ) ...@@ -321,11 +321,11 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
POINT dsnOffset; POINT dsnOffset;
if( aPad->m_Offset.x || aPad->m_Offset.y ) if( aPad->m_Offset.x != ZERO_LENGTH || aPad->m_Offset.y != ZERO_LENGTH )
{ {
char offsetTxt[64]; char offsetTxt[64]; /// @BUG !!!Unsafe
wxPoint offset( aPad->m_Offset.x, aPad->m_Offset.y ); wxPoint offset( TO_LEGACY_LU( aPad->m_Offset.x ), TO_LEGACY_LU( aPad->m_Offset.y ) );
dsnOffset = mapPt( offset ); dsnOffset = mapPt( offset );
...@@ -341,7 +341,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad ) ...@@ -341,7 +341,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
default: default:
case PAD_CIRCLE: case PAD_CIRCLE:
{ {
double diameter = scale(aPad->m_Size.x); double diameter = scale( TO_LEGACY_LU( aPad->m_Size.x ) );
for( int ndx=0; ndx<reportedLayers; ++ndx ) for( int ndx=0; ndx<reportedLayers; ++ndx )
{ {
...@@ -357,7 +357,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad ) ...@@ -357,7 +357,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
} }
snprintf( name, sizeof(name), "Round%sPad_%.6g_mil", snprintf( name, sizeof(name), "Round%sPad_%.6g_mil",
uniqifier.c_str(), scale(aPad->m_Size.x) ); uniqifier.c_str(), scale(TO_LEGACY_LU( aPad->m_Size.x ) ) );
name[ sizeof(name)-1 ] = 0; name[ sizeof(name)-1 ] = 0;
padstack->SetPadstackId( name ); padstack->SetPadstackId( name );
...@@ -366,8 +366,8 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad ) ...@@ -366,8 +366,8 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
case PAD_RECT: case PAD_RECT:
{ {
double dx = scale( aPad->m_Size.x ) / 2.0; double dx = scale( TO_LEGACY_LU( aPad->m_Size.x ) ) / 2.0;
double dy = scale( aPad->m_Size.y ) / 2.0; double dy = scale( TO_LEGACY_LU( aPad->m_Size.y ) ) / 2.0;
POINT lowerLeft( -dx, -dy ); POINT lowerLeft( -dx, -dy );
POINT upperRight( dx, dy ); POINT upperRight( dx, dy );
...@@ -388,7 +388,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad ) ...@@ -388,7 +388,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
} }
snprintf( name, sizeof(name), "Rect%sPad_%.6gx%.6g_mil", snprintf( name, sizeof(name), "Rect%sPad_%.6gx%.6g_mil",
uniqifier.c_str(), scale(aPad->m_Size.x), scale(aPad->m_Size.y) ); uniqifier.c_str(), scale( TO_LEGACY_LU( aPad->m_Size.x ) ), scale( TO_LEGACY_LU( aPad->m_Size.y ) ) );
name[ sizeof(name)-1 ] = 0; name[ sizeof(name)-1 ] = 0;
padstack->SetPadstackId( name ); padstack->SetPadstackId( name );
...@@ -397,8 +397,8 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad ) ...@@ -397,8 +397,8 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
case PAD_OVAL: case PAD_OVAL:
{ {
double dx = scale( aPad->m_Size.x ) / 2.0; double dx = scale( TO_LEGACY_LU( aPad->m_Size.x ) ) / 2.0;
double dy = scale( aPad->m_Size.y ) / 2.0; double dy = scale( TO_LEGACY_LU( aPad->m_Size.y ) ) / 2.0;
double dr = dx - dy; double dr = dx - dy;
double radius; double radius;
POINT start; POINT start;
...@@ -436,7 +436,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad ) ...@@ -436,7 +436,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
} }
snprintf( name, sizeof(name), "Oval%sPad_%.6gx%.6g_mil", snprintf( name, sizeof(name), "Oval%sPad_%.6gx%.6g_mil",
uniqifier.c_str(), scale(aPad->m_Size.x), scale(aPad->m_Size.y) ); uniqifier.c_str(), scale( TO_LEGACY_LU( aPad->m_Size.x ) ), scale( TO_LEGACY_LU( aPad->m_Size.y ) ) );
name[ sizeof(name)-1 ] = 0; name[ sizeof(name)-1 ] = 0;
padstack->SetPadstackId( name ); padstack->SetPadstackId( name );
...@@ -445,11 +445,11 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad ) ...@@ -445,11 +445,11 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
case PAD_TRAPEZOID: case PAD_TRAPEZOID:
{ {
double dx = scale( aPad->m_Size.x ) / 2.0; double dx = scale( TO_LEGACY_LU( aPad->m_Size.x ) ) / 2.0;
double dy = scale( aPad->m_Size.y ) / 2.0; double dy = scale( TO_LEGACY_LU( aPad->m_Size.y ) ) / 2.0;
double ddx = scale( aPad->m_DeltaSize.x ) / 2.0; double ddx = scale( TO_LEGACY_LU( aPad->m_DeltaSize.x ) ) / 2.0;
double ddy = scale( aPad->m_DeltaSize.y ) / 2.0; double ddy = scale( TO_LEGACY_LU( aPad->m_DeltaSize.y ) ) / 2.0;
// see class_pad_draw_functions.cpp which draws the trapezoid pad // see class_pad_draw_functions.cpp which draws the trapezoid pad
POINT lowerLeft( -dx - ddy, -dy - ddx ); POINT lowerLeft( -dx - ddy, -dy - ddx );
...@@ -479,15 +479,15 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad ) ...@@ -479,15 +479,15 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
polygon->AppendPoint( lowerRight ); polygon->AppendPoint( lowerRight );
} }
D(printf( "m_DeltaSize: %d,%d\n", aPad->m_DeltaSize.x, aPad->m_DeltaSize.y );) D(printf( "m_DeltaSize: %d,%d\n", TO_LEGACY_LU( aPad->m_DeltaSize.x ), TO_LEGACY_LU( aPad->m_DeltaSize.y ) );)
// this string _must_ be unique for a given physical shape // this string _must_ be unique for a given physical shape
snprintf( name, sizeof(name), "Trapz%sPad_%.6gx%.6g_%c%.6gx%c%.6g_mil", snprintf( name, sizeof(name), "Trapz%sPad_%.6gx%.6g_%c%.6gx%c%.6g_mil",
uniqifier.c_str(), scale(aPad->m_Size.x), scale(aPad->m_Size.y), uniqifier.c_str(), scale( TO_LEGACY_LU( aPad->m_Size.x ) ), scale( TO_LEGACY_LU( aPad->m_Size.y ) ),
aPad->m_DeltaSize.x < 0 ? 'n' : 'p', aPad->m_DeltaSize.x < ZERO_LENGTH ? 'n' : 'p',
abs( scale( aPad->m_DeltaSize.x )), abs( scale( TO_LEGACY_LU( aPad->m_DeltaSize.x ) )),
aPad->m_DeltaSize.y < 0 ? 'n' : 'p', aPad->m_DeltaSize.y < ZERO_LENGTH ? 'n' : 'p',
abs( scale( aPad->m_DeltaSize.y )) abs( scale( TO_LEGACY_LU( aPad->m_DeltaSize.y ) ))
); );
name[ sizeof(name)-1 ] = 0; name[ sizeof(name)-1 ] = 0;
...@@ -527,8 +527,8 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule ) ...@@ -527,8 +527,8 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
// see if this pad is a through hole with no copper on its perimeter // see if this pad is a through hole with no copper on its perimeter
if( isRoundKeepout( pad ) ) if( isRoundKeepout( pad ) )
{ {
double diameter = scale( pad->m_Drill.x ); double diameter = scale( TO_LEGACY_LU( pad->m_Drill.x ) );
POINT vertex = mapPt( pad->m_Pos0 ); POINT vertex = mapPt( TO_LEGACY_LU_WXP( pad->m_Pos0 ) );
int layerCount = aBoard->GetCopperLayerCount(); int layerCount = aBoard->GetCopperLayerCount();
for( int layer=0; layer<layerCount; ++layer ) for( int layer=0; layer<layerCount; ++layer )
...@@ -596,7 +596,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule ) ...@@ -596,7 +596,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
pin->SetRotation( angle / 10.0 ); pin->SetRotation( angle / 10.0 );
} }
wxPoint pos( pad->m_Pos0 ); wxPoint pos( TO_LEGACY_LU_WXP( pad->m_Pos0 ) );
pin->SetVertex( mapPt( pos ) ); pin->SetVertex( mapPt( pos ) );
} }
......
...@@ -201,7 +201,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -201,7 +201,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
* inside the board (in fact inside the hole. Some photo diodes and Leds are * inside the board (in fact inside the hole. Some photo diodes and Leds are
* like this) * like this)
*/ */
if( (pad->m_Drill.x == 0) && (pad->m_Drill.y == 0) ) if( (pad->m_Drill.x == ZERO_LENGTH) && (pad->m_Drill.y == ZERO_LENGTH) )
continue; continue;
// Use a dummy pad to calculate a hole shape that have the same dimension as // Use a dummy pad to calculate a hole shape that have the same dimension as
......
...@@ -68,15 +68,15 @@ void BuildUnconnectedThermalStubsPolygonList( std::vector<CPolyPt>& aCornerBuffe ...@@ -68,15 +68,15 @@ void BuildUnconnectedThermalStubsPolygonList( std::vector<CPolyPt>& aCornerBuffe
// Thermal bridges are like a segment from a starting point inside the pad // Thermal bridges are like a segment from a starting point inside the pad
// to an ending point outside the pad // to an ending point outside the pad
wxPoint startpoint, endpoint; wxPoint startpoint, endpoint;
endpoint.x = ( pad->m_Size.x / 2 ) + aZone->m_ThermalReliefGapValue; endpoint.x = ( TO_LEGACY_LU( pad->m_Size.x / 2 ) ) + aZone->m_ThermalReliefGapValue;
endpoint.y = ( pad->m_Size.y / 2 ) + aZone->m_ThermalReliefGapValue; endpoint.y = ( TO_LEGACY_LU( pad->m_Size.y / 2 ) ) + aZone->m_ThermalReliefGapValue;
int copperThickness = aZone->m_ThermalReliefCopperBridgeValue - aZone->m_ZoneMinThickness; int copperThickness = aZone->m_ThermalReliefCopperBridgeValue - aZone->m_ZoneMinThickness;
if( copperThickness < 0 ) if( copperThickness < 0 )
copperThickness = 0; copperThickness = 0;
startpoint.x = min( pad->m_Size.x, copperThickness ); startpoint.x = min( TO_LEGACY_LU( pad->m_Size.x ), copperThickness );
startpoint.y = min( pad->m_Size.y, copperThickness ); startpoint.y = min( TO_LEGACY_LU( pad->m_Size.y ), copperThickness );
startpoint.x /= 2; startpoint.x /= 2;
startpoint.y /= 2; startpoint.y /= 2;
......
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