Metric KiCad work continues. Partially processed D_PAD class. It is still need to be tested including all these import and export procedures...

This commit is contained in:
Vladimir Ur 2011-11-11 21:44:20 +04:00
parent 77521c4b60
commit 6ebb044d45
39 changed files with 571 additions and 407 deletions

View File

@ -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 )
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 )
{ {
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 );

View File

@ -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:
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

View File

@ -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
{ {

View File

@ -230,6 +230,33 @@ public:
return y / x.m_U; return y / x.m_U;
} }
/*************************/
/* assignment arithmetic */
/*************************/
LENGTH< T, P >& operator -= ( const LENGTH< T, P > y )
{
m_U -= y.m_U;
return *this;
}
LENGTH< T, P >& operator += ( const LENGTH< T, P > y )
{
m_U += y.m_U;
return *this;
}
LENGTH< T, P >& operator *= ( const T y )
{
m_U *= y;
return *this;
}
LENGTH< T, P >& operator /= ( const T y )
{
m_U /= y;
return *this;
}
/*************************/
/* more functions */
/*************************/
friend LENGTH< T, P > sqrt( LENGTH< T, P*2 > y ) friend LENGTH< T, P > sqrt( LENGTH< T, P*2 > y )
{ {
return sqrt( y.m_U ); return sqrt( y.m_U );
@ -238,28 +265,15 @@ public:
{ {
return cbrt( y.m_U ); return cbrt( y.m_U );
} }
/*************************/ friend LENGTH< T, P > hypot( LENGTH< T, P > x, LENGTH< T, P > y )
/* assignment arithmetic */
/*************************/
LENGTH< T, P >& operator -= ( const LENGTH< T, P > y )
{ {
return m_U -= y.m_U; return hypot( x.m_U, y.m_U );
} }
LENGTH< T, P >& operator += ( const LENGTH< T, P > y ) friend double atan2( LENGTH< T, P > x, LENGTH< T, P > y )
{ {
return m_U += y.m_U; return atan2( double ( x.m_U ), double( y.m_U ) );
} }
LENGTH< T, P >& operator *= ( const T y )
{
return m_U *= y;
}
LENGTH< T, P >& operator /= ( const T y )
{
return m_U /= y;
}
/*************************/
/* more arithmetic */
/*************************/
}; };
/** /**

View File

@ -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,7 @@ static LENGTH_PCB_DBL from_legacy_lu_dbl( double x ) {
#define ZERO_LENGTH ( LENGTH_PCB::zero() ) #define ZERO_LENGTH ( LENGTH_PCB::zero() )
#else #else
typedef int LENGTH_PCB; typedef int LENGTH_PCB;
@ -58,5 +62,43 @@ typedef double LENGTH_PCB_DBL;
#endif #endif
/// @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 + (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 ) ) )
#endif /* def LENGTHPCB_H_INCLUDED */ #endif /* def LENGTHPCB_H_INCLUDED */

View File

@ -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 );

View File

@ -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)

View File

@ -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
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,
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,
// 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,
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,
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 ) );
} }

View File

@ -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

View File

@ -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
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() {
SetToDefault();
}
}
void NETCLASS::SetToDefault()
{
// We should use m_Parent->GetBoardDesignSettings()
// But when the NETCLASSES constructor is called // But when the NETCLASSES constructor is called
// (it call NETCLASS constructor), the m_Parent constructor (see BOARD::BOARD) // (it call NETCLASS constructor), the m_Parent constructor (see BOARD::BOARD)
// is not run, and GetBoardDesignSettings() return a bad value // is not run, and GetBoardDesignSettings() return a bad value
// TODO: see how change that. // TODO: see how change that.
const BOARD_DESIGN_SETTINGS& g = boardDesignSettings; const BOARD_DESIGN_SETTINGS& g = boardDesignSettings;
SetTrackWidth( TO_LEGACY_LU( g.m_TrackMinWidth ) ); TrackWidth( 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 );
}
}
//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
// 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 )
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 )
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
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 );
} }

View File

@ -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:
*/ */
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.

View File

@ -27,7 +27,8 @@ D_PAD::D_PAD( MODULE* parent ) : BOARD_CONNECTED_ITEM( parent, PCB_PAD_T )
{ {
m_NumPadName = 0; m_NumPadName = 0;
m_Size.x = m_Size.y = 500; // give it a reasonable size m_Size.x = m_Size.y = FROM_LEGACY_LU( 500 ); // give it a reasonable size
/// TODO: remove hardcoded constant
m_Orient = 0; // Pad rotation in 1/10 degrees m_Orient = 0; // Pad rotation in 1/10 degrees
m_LengthDie = 0; m_LengthDie = 0;
@ -67,21 +68,23 @@ int D_PAD::GetMaxRadius() const
switch( m_PadShape & 0x7F ) switch( m_PadShape & 0x7F )
{ {
case PAD_CIRCLE: case PAD_CIRCLE:
radius = m_Size.x / 2; radius = TO_LEGACY_LU( m_Size.x / 2 );
break; break;
case PAD_OVAL: case PAD_OVAL:
radius = MAX( m_Size.x, m_Size.y ) / 2; radius = TO_LEGACY_LU( MAX( m_Size.x, m_Size.y ) / 2 );
break; break;
case PAD_RECT: case PAD_RECT:
radius = 1 + (int) ( sqrt( (double) m_Size.y * m_Size.y x = TO_LEGACY_LU( m_Size.x );
+ (double) m_Size.x * m_Size.x ) / 2 ); y = TO_LEGACY_LU( m_Size.y );
radius = 1 + (int) ( sqrt( (double) y * y
+ (double) x * x ) / 2 );
break; break;
case PAD_TRAPEZOID: case PAD_TRAPEZOID:
x = m_Size.x + ABS( m_DeltaSize.y ); // Remember: m_DeltaSize.y is the m_Size.x change x = TO_LEGACY_LU( m_Size.x + ABS( m_DeltaSize.y ) ); // Remember: m_DeltaSize.y is the m_Size.x change
y = m_Size.y + ABS( m_DeltaSize.x ); // Remember: m_DeltaSize.x is the m_Size.y change y = TO_LEGACY_LU( m_Size.y + ABS( m_DeltaSize.x ) ); // Remember: m_DeltaSize.x is the m_Size.y change
radius = 1 + (int) ( sqrt( (double) y * y + (double) x * x ) / 2 ); radius = 1 + (int) ( sqrt( (double) y * y + (double) x * x ) / 2 );
break; break;
@ -121,14 +124,14 @@ EDA_RECT D_PAD::GetBoundingBox() const
// Returns the position of the pad. // Returns the position of the pad.
const wxPoint D_PAD::ReturnShapePos() const wxPoint D_PAD::ReturnShapePos()
{ {
if( m_Offset.x == 0 && m_Offset.y == 0 ) if( m_Offset.x == ZERO_LENGTH && m_Offset.y == ZERO_LENGTH )
return m_Pos; return m_Pos;
wxPoint shape_pos; wxPoint shape_pos;
int dX, dY; int dX, dY;
dX = m_Offset.x; dX = TO_LEGACY_LU( m_Offset.x );
dY = m_Offset.y; dY = TO_LEGACY_LU( m_Offset.y );
RotatePoint( &dX, &dY, m_Orient ); RotatePoint( &dX, &dY, m_Orient );
@ -300,7 +303,7 @@ int D_PAD::GetSolderMaskMargin()
// ensure mask have a size always >= 0 // ensure mask have a size always >= 0
if( margin < 0 ) if( margin < 0 )
{ {
int minsize = -MIN( m_Size.x, m_Size.y ) / 2; int minsize = TO_LEGACY_LU( -MIN( m_Size.x, m_Size.y ) / 2 );
if( margin < minsize ) if( margin < minsize )
minsize = minsize; minsize = minsize;
@ -345,15 +348,15 @@ wxSize D_PAD::GetSolderPasteMargin()
} }
wxSize pad_margin; wxSize pad_margin;
pad_margin.x = margin + wxRound( m_Size.x * mratio ); pad_margin.x = margin + wxRound( TO_LEGACY_LU_DBL( m_Size.x ) * mratio );
pad_margin.y = margin + wxRound( m_Size.y * mratio ); pad_margin.y = margin + wxRound( TO_LEGACY_LU_DBL( m_Size.y ) * mratio );
// ensure mask have a size always >= 0 // ensure mask have a size always >= 0
if( pad_margin.x < -m_Size.x / 2 ) if( pad_margin.x < TO_LEGACY_LU( -m_Size.x / 2 ) )
pad_margin.x = -m_Size.x / 2; pad_margin.x = TO_LEGACY_LU( -m_Size.x / 2 );
if( pad_margin.y < -m_Size.y / 2 ) if( pad_margin.y < TO_LEGACY_LU( -m_Size.y / 2 ) )
pad_margin.y = -m_Size.y / 2; pad_margin.y = TO_LEGACY_LU( -m_Size.y / 2 );
return pad_margin; return pad_margin;
} }
@ -375,7 +378,8 @@ int D_PAD::ReadDescr( LINE_READER* aReader )
char* Line; char* Line;
char BufLine[1024], BufCar[256]; char BufLine[1024], BufCar[256];
char* PtLine; char* PtLine;
int nn, ll, dx, dy; int nn, ll;
double sx, sy, ox, oy, dr, dx, dy;
while( aReader->ReadLine() ) while( aReader->ReadLine() )
{ {
@ -417,11 +421,14 @@ int D_PAD::ReadDescr( LINE_READER* aReader )
if( *PtLine == '"' ) if( *PtLine == '"' )
PtLine++; PtLine++;
nn = sscanf( PtLine, " %s %d %d %d %d %d", nn = sscanf( PtLine, " %s %lf %lf %lf %lf %d",
BufCar, &m_Size.x, &m_Size.y, BufCar, &sx, &sy,
&m_DeltaSize.x, &m_DeltaSize.y, &dx, &dy,
&m_Orient ); &m_Orient );
m_Size.x = FROM_LEGACY_LU( sx );
m_Size.y = FROM_LEGACY_LU( sy );
m_DeltaSize.x = FROM_LEGACY_LU( dx );
m_DeltaSize.y = FROM_LEGACY_LU( dy );
ll = 0xFF & BufCar[0]; ll = 0xFF & BufCar[0];
/* Read pad shape */ /* Read pad shape */
@ -447,16 +454,19 @@ int D_PAD::ReadDescr( LINE_READER* aReader )
case 'D': case 'D':
BufCar[0] = 0; BufCar[0] = 0;
nn = sscanf( PtLine, "%d %d %d %s %d %d", &m_Drill.x, nn = sscanf( PtLine, "%lf %lf %lf %s %lf %lf", &dr,
&m_Offset.x, &m_Offset.y, BufCar, &dx, &dy ); &ox, &oy, BufCar, &dx, &dy );
m_Drill.y = m_Drill.x; m_Offset.x = FROM_LEGACY_LU( ox );
m_Offset.y = FROM_LEGACY_LU( oy );
m_Drill.y = m_Drill.x = FROM_LEGACY_LU( dr );
m_DrillShape = PAD_CIRCLE; m_DrillShape = PAD_CIRCLE;
if( nn >= 6 ) // Drill shape = OVAL ? if( nn >= 6 ) // Drill shape = OVAL ?
{ {
if( BufCar[0] == 'O' ) if( BufCar[0] == 'O' )
{ {
m_Drill.x = dx; m_Drill.y = dy; m_Drill.x = FROM_LEGACY_LU( dx );
m_Drill.y = FROM_LEGACY_LU( dy );
m_DrillShape = PAD_OVAL; m_DrillShape = PAD_OVAL;
} }
} }
@ -551,15 +561,15 @@ bool D_PAD::Save( FILE* aFile ) const
break; break;
} }
fprintf( aFile, "Sh \"%.4s\" %c %d %d %d %d %d\n", fprintf( aFile, "Sh \"%.4s\" %c %d %d %d %d %d\n", // TODO: pad name length limit!
m_Padname, cshape, m_Size.x, m_Size.y, m_Padname, cshape, TO_LEGACY_LU( m_Size.x ), TO_LEGACY_LU( m_Size.y ),
m_DeltaSize.x, m_DeltaSize.y, m_Orient ); TO_LEGACY_LU( m_DeltaSize.x ), TO_LEGACY_LU( m_DeltaSize.y ), m_Orient );
fprintf( aFile, "Dr %d %d %d", m_Drill.x, m_Offset.x, m_Offset.y ); fprintf( aFile, "Dr %d %d %d", TO_LEGACY_LU( m_Drill.x ), TO_LEGACY_LU( m_Offset.x ), TO_LEGACY_LU( m_Offset.y ) );
if( m_DrillShape == PAD_OVAL ) if( m_DrillShape == PAD_OVAL )
{ {
fprintf( aFile, " %c %d %d", 'O', m_Drill.x, m_Drill.y ); fprintf( aFile, " %c %d %d", 'O', TO_LEGACY_LU( m_Drill.x ), TO_LEGACY_LU( m_Drill.y ) );
} }
fprintf( aFile, "\n" ); fprintf( aFile, "\n" );
@ -744,13 +754,13 @@ void D_PAD::DisplayInfo( EDA_DRAW_FRAME* frame )
frame->AppendMsgPanel( ShowPadShape(), ShowPadAttr(), DARKGREEN ); frame->AppendMsgPanel( ShowPadShape(), ShowPadAttr(), DARKGREEN );
valeur_param( m_Size.x, Line ); valeur_param( TO_LEGACY_LU( m_Size.x ), Line );
frame->AppendMsgPanel( _( "H Size" ), Line, RED ); frame->AppendMsgPanel( _( "H Size" ), Line, RED );
valeur_param( m_Size.y, Line ); valeur_param( TO_LEGACY_LU( m_Size.y ), Line );
frame->AppendMsgPanel( _( "V Size" ), Line, RED ); frame->AppendMsgPanel( _( "V Size" ), Line, RED );
valeur_param( (unsigned) m_Drill.x, Line ); valeur_param( (unsigned)(int) TO_LEGACY_LU( m_Drill.x ), Line );
if( m_DrillShape == PAD_CIRCLE ) if( m_DrillShape == PAD_CIRCLE )
{ {
@ -758,9 +768,9 @@ void D_PAD::DisplayInfo( EDA_DRAW_FRAME* frame )
} }
else else
{ {
valeur_param( (unsigned) m_Drill.x, Line ); valeur_param( (unsigned) TO_LEGACY_LU( m_Drill.x ), Line );
wxString msg; wxString msg;
valeur_param( (unsigned) m_Drill.y, msg ); valeur_param( (unsigned) TO_LEGACY_LU( m_Drill.y ), msg );
Line += wxT( " / " ) + msg; Line += wxT( " / " ) + msg;
frame->AppendMsgPanel( _( "Drill X / Y" ), Line, RED ); frame->AppendMsgPanel( _( "Drill X / Y" ), Line, RED );
} }
@ -816,8 +826,8 @@ bool D_PAD::HitTest( const wxPoint& refPos )
if( ( abs( delta.x ) > m_ShapeMaxRadius ) || ( abs( delta.y ) > m_ShapeMaxRadius ) ) if( ( abs( delta.x ) > m_ShapeMaxRadius ) || ( abs( delta.y ) > m_ShapeMaxRadius ) )
return false; return false;
dx = m_Size.x >> 1; // dx also is the radius for rounded pads dx = TO_LEGACY_LU( m_Size.x / 2 ); // dx also is the radius for rounded pads
dy = m_Size.y >> 1; dy = TO_LEGACY_LU( m_Size.y / 2 );
switch( m_PadShape & 0x7F ) switch( m_PadShape & 0x7F )
{ {
@ -854,25 +864,25 @@ int D_PAD::Compare( const D_PAD* padref, const D_PAD* padcmp )
{ {
int diff; int diff;
if( (diff = padref->m_PadShape - padcmp->m_PadShape) ) if( ( diff = padref->m_PadShape - padcmp->m_PadShape) )
return diff; return diff;
if( (diff = padref->m_Size.x - padcmp->m_Size.x) ) if( ( diff = TO_LEGACY_LU( padref->m_Size.x - padcmp->m_Size.x ) ) )
return diff; return diff;
if( (diff = padref->m_Size.y - padcmp->m_Size.y) ) if( ( diff = TO_LEGACY_LU( padref->m_Size.y - padcmp->m_Size.y ) ) )
return diff; return diff;
if( (diff = padref->m_Offset.x - padcmp->m_Offset.x) ) if( ( diff = TO_LEGACY_LU( padref->m_Offset.x - padcmp->m_Offset.x ) ) )
return diff; return diff;
if( (diff = padref->m_Offset.y - padcmp->m_Offset.y) ) if( ( diff = TO_LEGACY_LU( padref->m_Offset.y - padcmp->m_Offset.y ) ) )
return diff; return diff;
if( (diff = padref->m_DeltaSize.x - padcmp->m_DeltaSize.x) ) if( ( diff = TO_LEGACY_LU( padref->m_DeltaSize.x - padcmp->m_DeltaSize.x ) ) )
return diff; return diff;
if( (diff = padref->m_DeltaSize.y - padcmp->m_DeltaSize.y) ) if( ( diff = TO_LEGACY_LU( padref->m_DeltaSize.y - padcmp->m_DeltaSize.y ) ) )
return diff; return diff;
// @todo check if export_gencad still works: // @todo check if export_gencad still works:

View File

@ -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:
// 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,9 +110,9 @@ 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 wxPoint m_Pos0; // Initial Pad position (i.e. pas position relative to the
// module anchor, orientation 0 // module anchor, orientation 0

View File

@ -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 )
/* 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 )
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 )
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
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
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
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
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
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

View File

@ -227,11 +227,11 @@ void DIALOG_DESIGN_RULES::PrintCurrentSettings()
#ifdef KICAD_NANOMETRE #ifdef KICAD_NANOMETRE
value = LengthToString( UnitDescription( g_UserUnit ), value = LengthToString( UnitDescription( g_UserUnit ),
m_BrdSettings->m_ViasMinSize, m_BrdSettings->m_MinVia.m_Diameter,
true ); true );
#else #else
value = ReturnStringFromValue( g_UserUnit, value = ReturnStringFromValue( g_UserUnit,
TO_LEGACY_LU( m_BrdSettings->m_ViasMinSize ), TO_LEGACY_LU( m_BrdSettings->m_MinVia.m_Diameter ),
internal_units, internal_units,
true ); true );
#endif #endif
@ -240,11 +240,11 @@ void DIALOG_DESIGN_RULES::PrintCurrentSettings()
#ifdef KICAD_NANOMETRE #ifdef KICAD_NANOMETRE
value = LengthToString( UnitDescription( g_UserUnit ), value = LengthToString( UnitDescription( g_UserUnit ),
m_BrdSettings->m_MicroViasMinSize, m_BrdSettings->m_MinMicroVia.m_Diameter,
true ); true );
#else #else
value = ReturnStringFromValue( g_UserUnit, value = ReturnStringFromValue( g_UserUnit,
TO_LEGACY_LU( m_BrdSettings->m_MicroViasMinSize ), TO_LEGACY_LU( m_BrdSettings->m_MinMicroVia.m_Diameter ),
internal_units, internal_units,
true ); true );
#endif #endif
@ -312,30 +312,29 @@ void DIALOG_DESIGN_RULES::InitGlobalRules()
AddUnitSymbol( *m_TrackMinWidthTitle ); AddUnitSymbol( *m_TrackMinWidthTitle );
int Internal_Unit = m_Parent->m_InternalUnits; int Internal_Unit = m_Parent->m_InternalUnits;
#ifdef KICAD_NANOMETRE
LengthToTextCtrl( *m_SetViasMinSizeCtrl, m_BrdSettings->m_ViasMinSize );
LengthToTextCtrl( *m_SetViasMinDrillCtrl, m_BrdSettings->m_ViasMinDrill );
#else
PutValueInLocalUnits( *m_SetViasMinSizeCtrl,
m_BrdSettings->m_ViasMinSize,
Internal_Unit );
PutValueInLocalUnits( *m_SetViasMinDrillCtrl, m_BrdSettings->m_ViasMinDrill, Internal_Unit );
#endif
if( m_BrdSettings->m_CurrentViaType != VIA_THROUGH ) if( m_BrdSettings->m_CurrentViaType != VIA_THROUGH )
m_OptViaType->SetSelection( 1 ); m_OptViaType->SetSelection( 1 );
m_AllowMicroViaCtrl->SetSelection( m_BrdSettings->m_MicroViasAllowed ? 1 : 0 ); m_AllowMicroViaCtrl->SetSelection( m_BrdSettings->m_MicroViasAllowed ? 1 : 0 );
#ifdef KICAD_NANOMETRE #ifdef KICAD_NANOMETRE
LengthToTextCtrl( *m_SetMicroViasMinSizeCtrl, m_BrdSettings->m_MicroViasMinSize ); LengthToTextCtrl( *m_SetViasMinSizeCtrl, m_BrdSettings->m_MinVia.m_Diameter );
LengthToTextCtrl( *m_SetMicroViasMinDrillCtrl, m_BrdSettings->m_MicroViasMinDrill ); LengthToTextCtrl( *m_SetViasMinDrillCtrl, m_BrdSettings->m_MinVia.m_Drill );
LengthToTextCtrl( *m_SetMicroViasMinSizeCtrl, m_BrdSettings->m_MinMicroVia.m_Diameter );
LengthToTextCtrl( *m_SetMicroViasMinDrillCtrl, m_BrdSettings->m_MinMicroVia.m_Drill );
LengthToTextCtrl( *m_SetTrackMinWidthCtrl, m_BrdSettings->m_TrackMinWidth ); LengthToTextCtrl( *m_SetTrackMinWidthCtrl, m_BrdSettings->m_TrackMinWidth );
#else #else
PutValueInLocalUnits( *m_SetViasMinSizeCtrl,
m_BrdSettings->m_MinVia.m_Diameter,
Internal_Unit );
PutValueInLocalUnits( *m_SetViasMinDrillCtrl,
m_BrdSettings->m_MinVia.m_Drill,
Internal_Unit );
PutValueInLocalUnits( *m_SetMicroViasMinSizeCtrl, PutValueInLocalUnits( *m_SetMicroViasMinSizeCtrl,
m_BrdSettings->m_MicroViasMinSize, m_BrdSettings->m_MinMicroVia.m_Diameter,
Internal_Unit ); Internal_Unit );
PutValueInLocalUnits( *m_SetMicroViasMinDrillCtrl, PutValueInLocalUnits( *m_SetMicroViasMinDrillCtrl,
TO_LEGACY_LU( m_BrdSettings->m_MicroViasMinDrill ), m_BrdSettings->m_MinMicroVia.m_Drill,
Internal_Unit ); Internal_Unit );
PutValueInLocalUnits( *m_SetTrackMinWidthCtrl, PutValueInLocalUnits( *m_SetTrackMinWidthCtrl,
m_BrdSettings->m_TrackMinWidth, m_BrdSettings->m_TrackMinWidth,
@ -550,6 +549,15 @@ static void class2gridRow( wxGrid* grid, int row, NETCLASS* nc, int units )
// label is netclass name // label is netclass name
grid->SetRowLabelValue( row, nc->GetName() ); grid->SetRowLabelValue( row, nc->GetName() );
#ifdef KICAD_NANOMETRE
const LENGTH_UNIT_DESC *ud = UnitDescription( g_UserUnit );
grid->SetCellValue( row, GRID_CLEARANCE, LengthToString( ud, nc->Clearance() ) );
grid->SetCellValue( row, GRID_TRACKSIZE, LengthToString( ud, nc->TrackWidth() ) );
grid->SetCellValue( row, GRID_VIASIZE, LengthToString( ud, nc->Via().m_Diameter ) );
grid->SetCellValue( row, GRID_VIADRILL, LengthToString( ud, nc->Via().m_Drill ) );
grid->SetCellValue( row, GRID_uVIASIZE, LengthToString( ud, nc->MicroVia().m_Diameter ) );
grid->SetCellValue( row, GRID_uVIADRILL, LengthToString( ud, nc->MicroVia().m_Drill ) );
#else
msg = ReturnStringFromValue( g_UserUnit, nc->GetClearance(), units ); msg = ReturnStringFromValue( g_UserUnit, nc->GetClearance(), units );
grid->SetCellValue( row, GRID_CLEARANCE, msg ); grid->SetCellValue( row, GRID_CLEARANCE, msg );
@ -567,6 +575,7 @@ static void class2gridRow( wxGrid* grid, int row, NETCLASS* nc, int units )
msg = ReturnStringFromValue( g_UserUnit, nc->GetuViaDrill(), units ); msg = ReturnStringFromValue( g_UserUnit, nc->GetuViaDrill(), units );
grid->SetCellValue( row, GRID_uVIADRILL, msg ); grid->SetCellValue( row, GRID_uVIADRILL, msg );
#endif
} }
@ -600,6 +609,17 @@ void DIALOG_DESIGN_RULES::InitRulesList()
static void gridRow2class( wxGrid* grid, int row, NETCLASS* nc, int units ) static void gridRow2class( wxGrid* grid, int row, NETCLASS* nc, int units )
{ {
#ifdef KICAD_NANOMETRE
const LENGTH_UNIT_DESC *ud = UnitDescription( g_UserUnit );
nc->Clearance( StringToLength( ud, grid->GetCellValue( row, GRID_CLEARANCE ) ) );
nc->TrackWidth( StringToLength( ud, grid->GetCellValue( row, GRID_TRACKSIZE ) ) );
nc->Via( VIA_DIMENSION(
StringToLength( ud, grid->GetCellValue( row, GRID_VIASIZE ) ),
StringToLength( ud, grid->GetCellValue( row, GRID_VIADRILL ) ) ) );
nc->MicroVia( VIA_DIMENSION(
StringToLength( ud, grid->GetCellValue( row, GRID_uVIASIZE ) ),
StringToLength( ud, grid->GetCellValue( row, GRID_uVIADRILL ) ) ) );
#else
#define MYCELL( col ) \ #define MYCELL( col ) \
ReturnValueFromString( g_UserUnit, grid->GetCellValue( row, col ), units ) ReturnValueFromString( g_UserUnit, grid->GetCellValue( row, col ), units )
@ -609,6 +629,7 @@ static void gridRow2class( wxGrid* grid, int row, NETCLASS* nc, int units )
nc->SetViaDrill( MYCELL( GRID_VIADRILL ) ); nc->SetViaDrill( MYCELL( GRID_VIADRILL ) );
nc->SetuViaDiameter( MYCELL( GRID_uVIASIZE ) ); nc->SetuViaDiameter( MYCELL( GRID_uVIASIZE ) );
nc->SetuViaDrill( MYCELL( GRID_uVIADRILL ) ); nc->SetuViaDrill( MYCELL( GRID_uVIADRILL ) );
#endif
} }
@ -668,15 +689,15 @@ void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard()
#ifdef KICAD_NANOMETRE #ifdef KICAD_NANOMETRE
// Update vias minimum values for DRC // Update vias minimum values for DRC
m_BrdSettings->m_ViasMinSize = m_BrdSettings->m_MinVia.m_Diameter =
LengthFromTextCtrl( *m_SetViasMinSizeCtrl ); LengthFromTextCtrl( *m_SetViasMinSizeCtrl );
m_BrdSettings->m_ViasMinDrill = m_BrdSettings->m_MinVia.m_Drill =
LengthFromTextCtrl( *m_SetViasMinDrillCtrl ); LengthFromTextCtrl( *m_SetViasMinDrillCtrl );
// Update microvias minimum values for DRC // Update microvias minimum values for DRC
m_BrdSettings->m_MicroViasMinSize = m_BrdSettings->m_MinMicroVia.m_Diameter =
LengthFromTextCtrl( *m_SetMicroViasMinSizeCtrl ); LengthFromTextCtrl( *m_SetMicroViasMinSizeCtrl );
m_BrdSettings->m_MicroViasMinDrill = m_BrdSettings->m_MinMicroVia.m_Drill =
LengthFromTextCtrl( *m_SetMicroViasMinDrillCtrl ); LengthFromTextCtrl( *m_SetMicroViasMinDrillCtrl );
// Update tracks minimum values for DRC // Update tracks minimum values for DRC
@ -684,15 +705,15 @@ void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard()
LengthFromTextCtrl( *m_SetTrackMinWidthCtrl ); LengthFromTextCtrl( *m_SetTrackMinWidthCtrl );
#else #else
// Update vias minimum values for DRC // Update vias minimum values for DRC
m_BrdSettings->m_ViasMinSize = m_BrdSettings->m_MinVia.m_Diameter =
ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl, m_Parent->m_InternalUnits );
m_BrdSettings->m_ViasMinDrill = m_BrdSettings->m_MinVia.m_Drill =
ReturnValueFromTextCtrl( *m_SetViasMinDrillCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetViasMinDrillCtrl, m_Parent->m_InternalUnits );
// Update microvias minimum values for DRC // Update microvias minimum values for DRC
m_BrdSettings->m_MicroViasMinSize = m_BrdSettings->m_MinMicroVia.m_Diameter =
ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl, m_Parent->m_InternalUnits );
m_BrdSettings->m_MicroViasMinDrill = m_BrdSettings->m_MinMicroVia.m_Drill =
ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl, m_Parent->m_InternalUnits );
// Update tracks minimum values for DRC // Update tracks minimum values for DRC
m_BrdSettings->m_TrackMinWidth = m_BrdSettings->m_TrackMinWidth =

View File

@ -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
} }

View File

@ -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 )
} }
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++;

View File

@ -130,11 +130,11 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 ); dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
// Calculate a suitable scale to fit the available draw area // Calculate a suitable scale to fit the available draw area
int dim = m_dummyPad->m_Size.x + ABS( m_dummyPad->m_DeltaSize.y); int dim = TO_LEGACY_LU( m_dummyPad->m_Size.x + ABS( m_dummyPad->m_DeltaSize.y ) );
if( m_dummyPad->m_LocalClearance > 0 ) if( m_dummyPad->m_LocalClearance > 0 )
dim += m_dummyPad->m_LocalClearance * 2; dim += m_dummyPad->m_LocalClearance * 2;
double scale = (double) dc_size.x / dim; double scale = (double) dc_size.x / dim;
dim = m_dummyPad->m_Size.y + ABS( m_dummyPad->m_DeltaSize.x); dim = TO_LEGACY_LU( m_dummyPad->m_Size.y + ABS( m_dummyPad->m_DeltaSize.x ) );
if( m_dummyPad->m_LocalClearance > 0 ) if( m_dummyPad->m_LocalClearance > 0 )
dim += m_dummyPad->m_LocalClearance * 2; dim += m_dummyPad->m_LocalClearance * 2;
double altscale = (double) dc_size.y / dim; double altscale = (double) dc_size.y / dim;
@ -239,23 +239,23 @@ void DIALOG_PAD_PROPERTIES::initValues()
PutValueInLocalUnits( *m_PadPosition_X_Ctrl, m_dummyPad->m_Pos.x, internalUnits ); PutValueInLocalUnits( *m_PadPosition_X_Ctrl, m_dummyPad->m_Pos.x, internalUnits );
PutValueInLocalUnits( *m_PadPosition_Y_Ctrl, m_dummyPad->m_Pos.y, internalUnits ); PutValueInLocalUnits( *m_PadPosition_Y_Ctrl, m_dummyPad->m_Pos.y, internalUnits );
PutValueInLocalUnits( *m_PadDrill_X_Ctrl, m_dummyPad->m_Drill.x, internalUnits ); PutValueInLocalUnits( *m_PadDrill_X_Ctrl, TO_LEGACY_LU( m_dummyPad->m_Drill.x ), internalUnits );
PutValueInLocalUnits( *m_PadDrill_Y_Ctrl, m_dummyPad->m_Drill.y, internalUnits ); PutValueInLocalUnits( *m_PadDrill_Y_Ctrl, TO_LEGACY_LU( m_dummyPad->m_Drill.y ), internalUnits );
PutValueInLocalUnits( *m_ShapeSize_X_Ctrl, m_dummyPad->m_Size.x, internalUnits ); PutValueInLocalUnits( *m_ShapeSize_X_Ctrl, TO_LEGACY_LU( m_dummyPad->m_Size.x ), internalUnits );
PutValueInLocalUnits( *m_ShapeSize_Y_Ctrl, m_dummyPad->m_Size.y, internalUnits ); PutValueInLocalUnits( *m_ShapeSize_Y_Ctrl, TO_LEGACY_LU( m_dummyPad->m_Size.y ), internalUnits );
PutValueInLocalUnits( *m_ShapeOffset_X_Ctrl, m_dummyPad->m_Offset.x, internalUnits ); PutValueInLocalUnits( *m_ShapeOffset_X_Ctrl, TO_LEGACY_LU( m_dummyPad->m_Offset.x ), internalUnits );
PutValueInLocalUnits( *m_ShapeOffset_Y_Ctrl, m_dummyPad->m_Offset.y, internalUnits ); PutValueInLocalUnits( *m_ShapeOffset_Y_Ctrl, TO_LEGACY_LU( m_dummyPad->m_Offset.y ), internalUnits );
if( m_dummyPad->m_DeltaSize.x ) if( m_dummyPad->m_DeltaSize.x != ZERO_LENGTH )
{ {
PutValueInLocalUnits( *m_ShapeDelta_Ctrl, m_dummyPad->m_DeltaSize.x, internalUnits ); PutValueInLocalUnits( *m_ShapeDelta_Ctrl, TO_LEGACY_LU( m_dummyPad->m_DeltaSize.x ), internalUnits );
m_radioBtnDeltaXdir->SetValue(true); m_radioBtnDeltaXdir->SetValue(true);
} }
else else
{ {
PutValueInLocalUnits( *m_ShapeDelta_Ctrl, m_dummyPad->m_DeltaSize.y, internalUnits ); PutValueInLocalUnits( *m_ShapeDelta_Ctrl, TO_LEGACY_LU( m_dummyPad->m_DeltaSize.y ), internalUnits );
m_radioBtnDeltaYdir->SetValue(true); m_radioBtnDeltaYdir->SetValue(true);
} }
@ -718,8 +718,8 @@ bool DIALOG_PAD_PROPERTIES::TransfertDataToPad( D_PAD* aPad, bool aPromptOnError
aPad->m_Pos0 = aPad->m_Pos; aPad->m_Pos0 = aPad->m_Pos;
// Read pad drill: // Read pad drill:
aPad->m_Drill.x = ReturnValueFromTextCtrl( *m_PadDrill_X_Ctrl, internalUnits ); aPad->m_Drill.x = FROM_LEGACY_LU( ReturnValueFromTextCtrl( *m_PadDrill_X_Ctrl, internalUnits ) );
aPad->m_Drill.y = ReturnValueFromTextCtrl( *m_PadDrill_Y_Ctrl, internalUnits ); aPad->m_Drill.y = FROM_LEGACY_LU( ReturnValueFromTextCtrl( *m_PadDrill_Y_Ctrl, internalUnits ) );
if( m_DrillShapeCtrl->GetSelection() == 0 ) if( m_DrillShapeCtrl->GetSelection() == 0 )
{ {
aPad->m_DrillShape = PAD_CIRCLE; aPad->m_DrillShape = PAD_CIRCLE;
@ -729,8 +729,8 @@ bool DIALOG_PAD_PROPERTIES::TransfertDataToPad( D_PAD* aPad, bool aPromptOnError
aPad->m_DrillShape = PAD_OVAL; aPad->m_DrillShape = PAD_OVAL;
// Read pad shape size: // Read pad shape size:
aPad->m_Size.x = ReturnValueFromTextCtrl( *m_ShapeSize_X_Ctrl, internalUnits ); aPad->m_Size.x = FROM_LEGACY_LU( ReturnValueFromTextCtrl( *m_ShapeSize_X_Ctrl, internalUnits ) );
aPad->m_Size.y = ReturnValueFromTextCtrl( *m_ShapeSize_Y_Ctrl, internalUnits ); aPad->m_Size.y = FROM_LEGACY_LU( ReturnValueFromTextCtrl( *m_ShapeSize_Y_Ctrl, internalUnits ) );
if( aPad->m_PadShape == PAD_CIRCLE ) if( aPad->m_PadShape == PAD_CIRCLE )
aPad->m_Size.y = aPad->m_Size.x; aPad->m_Size.y = aPad->m_Size.x;
@ -741,38 +741,38 @@ bool DIALOG_PAD_PROPERTIES::TransfertDataToPad( D_PAD* aPad, bool aPromptOnError
delta.x = ReturnValueFromTextCtrl( *m_ShapeDelta_Ctrl, internalUnits ); delta.x = ReturnValueFromTextCtrl( *m_ShapeDelta_Ctrl, internalUnits );
else else
delta.y = ReturnValueFromTextCtrl( *m_ShapeDelta_Ctrl, internalUnits ); delta.y = ReturnValueFromTextCtrl( *m_ShapeDelta_Ctrl, internalUnits );
aPad->m_DeltaSize = delta; aPad->m_DeltaSize = VECTOR_PCB( FROM_LEGACY_LU( delta.x ), FROM_LEGACY_LU( delta.y ) );
// Read pad lenght die // Read pad lenght die
aPad->m_LengthDie = ReturnValueFromTextCtrl( *m_LengthDieCtrl, internalUnits ); aPad->m_LengthDie = ReturnValueFromTextCtrl( *m_LengthDieCtrl, internalUnits );
// Test bad values (be sure delta values are not to large) // Test bad values (be sure delta values are not to large)
// remember DeltaSize.x is the Y size variation // remember DeltaSize.x is the Y size variation TODO: this can be optimized
bool error = false; bool error = false;
if( (aPad->m_DeltaSize.x < 0) && (aPad->m_DeltaSize.x <= -aPad->m_Size.y) ) if( (aPad->m_DeltaSize.x < ZERO_LENGTH) && (aPad->m_DeltaSize.x <= -aPad->m_Size.y ) )
{ {
aPad->m_DeltaSize.x = -aPad->m_Size.y + 2; aPad->m_DeltaSize.x = -aPad->m_Size.y + FROM_LEGACY_LU( 2 );
error = true; error = true;
} }
if( (aPad->m_DeltaSize.x > 0) && (aPad->m_DeltaSize.x >= aPad->m_Size.y) ) if( (aPad->m_DeltaSize.x > ZERO_LENGTH) && (aPad->m_DeltaSize.x >= aPad->m_Size.y ) )
{ {
aPad->m_DeltaSize.x = aPad->m_Size.y - 2; aPad->m_DeltaSize.x = aPad->m_Size.y - FROM_LEGACY_LU( 2 );
error = true; error = true;
} }
if( (aPad->m_DeltaSize.y < 0) && (aPad->m_DeltaSize.y <= -aPad->m_Size.x) ) if( (aPad->m_DeltaSize.y < ZERO_LENGTH) && (aPad->m_DeltaSize.y <= -aPad->m_Size.x ) )
{ {
aPad->m_DeltaSize.y = -aPad->m_Size.x + 2; aPad->m_DeltaSize.y = -aPad->m_Size.x + FROM_LEGACY_LU( 2 );
error = true; error = true;
} }
if( (aPad->m_DeltaSize.y > 0) && (aPad->m_DeltaSize.y >= aPad->m_Size.x) ) if( (aPad->m_DeltaSize.y > ZERO_LENGTH) && (aPad->m_DeltaSize.y >= aPad->m_Size.x ) )
{ {
aPad->m_DeltaSize.y = aPad->m_Size.x - 2; aPad->m_DeltaSize.y = aPad->m_Size.x - FROM_LEGACY_LU( 2 );
error = true; error = true;
} }
// Read pad shape offset: // Read pad shape offset:
aPad->m_Offset.x = ReturnValueFromTextCtrl( *m_ShapeOffset_X_Ctrl, internalUnits ); aPad->m_Offset.x = FROM_LEGACY_LU( ReturnValueFromTextCtrl( *m_ShapeOffset_X_Ctrl, internalUnits ) );
aPad->m_Offset.y = ReturnValueFromTextCtrl( *m_ShapeOffset_Y_Ctrl, internalUnits ); aPad->m_Offset.y = FROM_LEGACY_LU( ReturnValueFromTextCtrl( *m_ShapeOffset_Y_Ctrl, internalUnits ) );
long orient_value = 0; long orient_value = 0;
msg = m_PadOrientCtrl->GetValue(); msg = m_PadOrientCtrl->GetValue();
@ -787,17 +787,17 @@ bool DIALOG_PAD_PROPERTIES::TransfertDataToPad( D_PAD* aPad, bool aPromptOnError
switch( aPad->m_PadShape ) switch( aPad->m_PadShape )
{ {
case PAD_CIRCLE: case PAD_CIRCLE:
aPad->m_Offset = wxSize( 0, 0 ); aPad->m_Offset = VECTOR_PCB( ZERO_LENGTH, ZERO_LENGTH ); // wxSize( 0, 0 );
aPad->m_DeltaSize = wxSize( 0, 0 ); aPad->m_DeltaSize = VECTOR_PCB( ZERO_LENGTH, ZERO_LENGTH );
aPad->m_Size.y = aPad->m_Size.x; aPad->m_Size.y = aPad->m_Size.x;
break; break;
case PAD_RECT: case PAD_RECT:
aPad->m_DeltaSize = wxSize( 0, 0 ); aPad->m_DeltaSize = VECTOR_PCB( ZERO_LENGTH, ZERO_LENGTH );
break; break;
case PAD_OVAL: case PAD_OVAL:
aPad->m_DeltaSize = wxSize( 0, 0 ); aPad->m_DeltaSize = VECTOR_PCB( ZERO_LENGTH, ZERO_LENGTH );
break; break;
case PAD_TRAPEZOID: case PAD_TRAPEZOID:
@ -811,14 +811,14 @@ bool DIALOG_PAD_PROPERTIES::TransfertDataToPad( D_PAD* aPad, bool aPromptOnError
case PAD_CONN: case PAD_CONN:
case PAD_SMD: case PAD_SMD:
aPad->m_Offset = wxSize( 0, 0 ); aPad->m_Offset = VECTOR_PCB( ZERO_LENGTH, ZERO_LENGTH );
aPad->m_Drill = wxSize( 0, 0 ); aPad->m_Drill = VECTOR_PCB( ZERO_LENGTH, ZERO_LENGTH );
break; break;
case PAD_HOLE_NOT_PLATED: case PAD_HOLE_NOT_PLATED:
// Mechanical purpose only: // Mechanical purpose only:
// no offset, no net name, no pad name allowed // no offset, no net name, no pad name allowed
aPad->m_Offset = wxSize( 0, 0 ); aPad->m_Offset = VECTOR_PCB( ZERO_LENGTH, ZERO_LENGTH ); //wxSize( 0, 0 );
aPad->SetPadName( wxEmptyString ); aPad->SetPadName( wxEmptyString );
aPad->SetNetname( wxEmptyString ); aPad->SetNetname( wxEmptyString );
break; break;
@ -875,8 +875,8 @@ bool DIALOG_PAD_PROPERTIES::TransfertDataToPad( D_PAD* aPad, bool aPromptOnError
/* Test for incorrect values */ /* Test for incorrect values */
if( aPromptOnError ) if( aPromptOnError )
{ {
if( (aPad->m_Size.x < aPad->m_Drill.x) if( (aPad->m_Size.x < aPad->m_Drill.x )
|| (aPad->m_Size.y < aPad->m_Drill.y) ) || (aPad->m_Size.y < aPad->m_Drill.y ) )
{ {
DisplayError( NULL, _( "Incorrect value for pad drill: pad drill bigger than pad size" ) ); DisplayError( NULL, _( "Incorrect value for pad drill: pad drill bigger than pad size" ) );
return false; return false;
@ -885,7 +885,7 @@ bool DIALOG_PAD_PROPERTIES::TransfertDataToPad( D_PAD* aPad, bool aPromptOnError
int padlayers_mask = PadLayerMask & (LAYER_BACK | LAYER_FRONT); int padlayers_mask = PadLayerMask & (LAYER_BACK | LAYER_FRONT);
if( padlayers_mask == 0 ) if( padlayers_mask == 0 )
{ {
if( aPad->m_Drill.x || aPad->m_Drill.y ) if( aPad->m_Drill.x != ZERO_LENGTH || aPad->m_Drill.y != ZERO_LENGTH )
{ {
msg = _( "Error: pad is not on a copper layer and has a hole" ); msg = _( "Error: pad is not on a copper layer and has a hole" );
if( aPad->m_Attribut == PAD_HOLE_NOT_PLATED ) if( aPad->m_Attribut == PAD_HOLE_NOT_PLATED )

View File

@ -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 )
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 )
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 )
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 )
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 );
@ -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
} }
} }
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;

View File

@ -290,7 +290,7 @@ 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;
@ -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 )
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 )
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 )
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
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 )

View File

@ -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;

View File

@ -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;
} }

View File

@ -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 ) /*{{{*/
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++ )
{ {

View File

@ -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

View File

@ -443,14 +443,14 @@ void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event )
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",

View File

@ -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 )
{ {
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:

View File

@ -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 )
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;

View File

@ -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 )
} }
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

View File

@ -443,7 +443,7 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
if( stricmp( line, "TrackClearence" ) == 0 ) if( stricmp( line, "TrackClearence" ) == 0 )
{ {
netclass_default->SetClearance( atoi( data ) ); netclass_default->Clearance( FROM_LEGACY_LU( atof( data ) ) );
continue; continue;
} }
@ -480,7 +480,7 @@ 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 = FROM_LEGACY_LU( diameter );
continue; continue;
} }
@ -492,7 +492,7 @@ 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 = FROM_LEGACY_LU( diameter );
continue; continue;
} }
@ -515,29 +515,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 = FROM_LEGACY_LU( atof( 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 = FROM_LEGACY_LU( diameter );
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 = FROM_LEGACY_LU( atof( 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 = FROM_LEGACY_LU( diameter );
continue; continue;
} }
@ -583,15 +585,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 = FROM_LEGACY_LU( atof( data ) );
data = strtok( NULL, delims ); data = strtok( NULL, delims );
g_Pad_Master.m_Size.y = atoi( data ); g_Pad_Master.m_Size.y = FROM_LEGACY_LU( atof( 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 = FROM_LEGACY_LU( atof( 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;
} }
@ -696,7 +698,9 @@ static int WriteSetup( FILE* aFile, PCB_EDIT_FRAME* aFrame, BOARD* aBoard )
fprintf( aFile, "TrackWidthList %f\n", TO_LEGACY_LU_DBL( aBoard->m_TrackWidthList[ii] ) ); fprintf( aFile, "TrackWidthList %f\n", TO_LEGACY_LU_DBL( aBoard->m_TrackWidthList[ii] ) );
fprintf( aFile, "TrackClearence %d\n", netclass_default->GetClearance() ); fprintf( aFile,
"TrackClearence %f\n",
TO_LEGACY_LU_DBL( 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 %f\n",
@ -706,14 +710,18 @@ static int WriteSetup( FILE* aFile, PCB_EDIT_FRAME* aFrame, BOARD* aBoard )
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,
fprintf( aFile, "ViaDrill %d\n", netclass_default->GetViaDrill() ); "ViaSize %f\n",
TO_LEGACY_LU_DBL( netclass_default->Via().m_Diameter ) );
fprintf( aFile,
"ViaDrill %f\n",
TO_LEGACY_LU_DBL( netclass_default->Via().m_Drill ) );
fprintf( aFile, fprintf( aFile,
"ViaMinSize %f\n", "ViaMinSize %f\n",
TO_LEGACY_LU_DBL( aBoard->GetBoardDesignSettings()->m_ViasMinSize ) ); TO_LEGACY_LU_DBL( aBoard->GetBoardDesignSettings()->m_MinVia.m_Diameter ) );
fprintf( aFile, fprintf( aFile,
"ViaMinDrill %f\n", "ViaMinDrill %f\n",
TO_LEGACY_LU_DBL( aBoard->GetBoardDesignSettings()->m_ViasMinDrill ) ); TO_LEGACY_LU_DBL( 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
@ -723,17 +731,21 @@ static int WriteSetup( FILE* aFile, PCB_EDIT_FRAME* aFrame, BOARD* aBoard )
TO_LEGACY_LU_DBL( aBoard->m_ViasDimensionsList[ii].m_Drill ) ); TO_LEGACY_LU_DBL( 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 %f\n",
TO_LEGACY_LU_DBL( netclass_default->MicroVia().m_Diameter ) );
fprintf( aFile,
"MicroViaDrill %f\n",
TO_LEGACY_LU_DBL( 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 %f\n",
TO_LEGACY_LU_DBL( aBoard->GetBoardDesignSettings()->m_MicroViasMinSize ) ); TO_LEGACY_LU_DBL( aBoard->GetBoardDesignSettings()->m_MinMicroVia.m_Diameter ) );
fprintf( aFile, fprintf( aFile,
"MicroViaMinDrill %f\n", "MicroViaMinDrill %f\n",
TO_LEGACY_LU_DBL( aBoard->GetBoardDesignSettings()->m_MicroViasMinDrill ) ); TO_LEGACY_LU_DBL( 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 +756,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 %d %d\n", TO_LEGACY_LU( g_Pad_Master.m_Size.x ), TO_LEGACY_LU( g_Pad_Master.m_Size.y ) );
fprintf( aFile, "PadDrill %d\n", g_Pad_Master.m_Drill.x ); fprintf( aFile, "PadDrill %d\n", ( int )TO_LEGACY_LU( g_Pad_Master.m_Drill.x ) );
fprintf( aFile, fprintf( aFile,
"Pad2MaskClearance %d\n", "Pad2MaskClearance %d\n",
aBoard->GetBoardDesignSettings()->m_SolderMaskMargin ); aBoard->GetBoardDesignSettings()->m_SolderMaskMargin );

View File

@ -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;
@ -710,9 +710,16 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
{ {
pad->m_Pos0 = pad->m_Pos; pad->m_Pos0 = 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;

View File

@ -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 )
{ {
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();

View File

@ -262,7 +262,7 @@ 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 = 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;
@ -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,18 +656,18 @@ 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; oX = pad->m_Pos0.x = -( gap_size + TO_LEGACY_LU( pad->m_Size.x ) ) / 2;
pad->m_Pos.x += pad->m_Pos0.x; pad->m_Pos.x += 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 = oX + gap_size + TO_LEGACY_LU( pad->m_Size.x );
pad->m_Pos.x += pad->m_Pos0.x; pad->m_Pos.x += 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 = -( 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 += pad->m_Pos0.y;
break; break;
@ -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 ) );
@ -1008,8 +1008,8 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
pad2->m_Pos0.x = last_coordinate.x; pad2->m_Pos0.x = 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 = first_coordinate.y / 2;
pad2->m_Pos0.y = last_coordinate.y / 2; pad2->m_Pos0.y = last_coordinate.y / 2;
pad1->m_Pos.y = pad1->m_Pos0.y + Module->m_Pos.y; pad1->m_Pos.y = pad1->m_Pos0.y + Module->m_Pos.y;
@ -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 )
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 = next_pad->m_Pos0.x - pad->m_Pos0.x - TO_LEGACY_LU( 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,17 +1086,17 @@ 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 = 0;
oX = pad->m_Pos0.x = -( (gap_size + pad->m_Size.x) / 2 ); oX = pad->m_Pos0.x = -( ( 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 = pad->m_Pos0.x + Module->m_Pos.x;
pad->m_Pos.y = pad->m_Pos0.y + Module->m_Pos.y; pad->m_Pos.y = 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 = 0;
next_pad->m_Pos0.x = oX + gap_size + next_pad->m_Size.x; next_pad->m_Pos0.x = 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 = 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 = 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,

View File

@ -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 ) );

View File

@ -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
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,
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,
{ {
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,
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,
{ {
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,
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 );
} }
} }

View File

@ -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,
} }
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 */

View File

@ -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,
+ 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;

View File

@ -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 )
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 )
} }
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 )
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 )
} }
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 )
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 )
} }
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 )
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 )
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,7 +527,7 @@ 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( pad->m_Pos0 );
int layerCount = aBoard->GetCopperLayerCount(); int layerCount = aBoard->GetCopperLayerCount();

View File

@ -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

View File

@ -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;