Replace UNIT by EAGLE_UNIT in Eagle plugin to avoid having a lot of useless hits when grep for "UNIT"
This commit is contained in:
parent
7418deb454
commit
2d6496c7f6
|
@ -34,7 +34,7 @@
|
||||||
constexpr auto DEFAULT_ALIGNMENT = ETEXT::BOTTOM_LEFT;
|
constexpr auto DEFAULT_ALIGNMENT = ETEXT::BOTTOM_LEFT;
|
||||||
|
|
||||||
|
|
||||||
ECOORD::ECOORD( const wxString& aValue, enum ECOORD::UNIT aUnit )
|
ECOORD::ECOORD( const wxString& aValue, enum ECOORD::EAGLE_UNIT aUnit )
|
||||||
{
|
{
|
||||||
// this array is used to adjust the fraction part value basing on the number of digits in the fraction
|
// this array is used to adjust the fraction part value basing on the number of digits in the fraction
|
||||||
constexpr int DIVIDERS[] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000 };
|
constexpr int DIVIDERS[] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000 };
|
||||||
|
@ -75,16 +75,17 @@ ECOORD::ECOORD( const wxString& aValue, enum ECOORD::UNIT aUnit )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
long long int ECOORD::ToNanoMeters( int aValue, enum UNIT aUnit )
|
long long int ECOORD::ToNanoMeters( int aValue, enum EAGLE_UNIT aUnit )
|
||||||
{
|
{
|
||||||
long long int ret;
|
long long int ret;
|
||||||
|
|
||||||
switch( aUnit )
|
switch( aUnit )
|
||||||
{
|
{
|
||||||
case NM: ret = aValue; break;
|
default:
|
||||||
case MM: ret = (long long) aValue * 1000000; break;
|
case EAGLE_NM: ret = aValue; break;
|
||||||
case INCH: ret = (long long) aValue * 25400000; break;
|
case EAGLE_MM: ret = (long long) aValue * 1000000; break;
|
||||||
case MIL: ret = (long long) aValue * 25400; break;
|
case EAGLE_INCH: ret = (long long) aValue * 25400000; break;
|
||||||
|
case EAGLE_MIL: ret = (long long) aValue * 25400; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxASSERT( ( ret > 0 ) == ( aValue > 0 ) ); // check for overflow
|
wxASSERT( ( ret > 0 ) == ( aValue > 0 ) ); // check for overflow
|
||||||
|
@ -165,7 +166,7 @@ template<>
|
||||||
ECOORD Convert<ECOORD>( const wxString& aCoord )
|
ECOORD Convert<ECOORD>( const wxString& aCoord )
|
||||||
{
|
{
|
||||||
// Eagle uses millimeters as the default unit
|
// Eagle uses millimeters as the default unit
|
||||||
return ECOORD( aCoord, ECOORD::UNIT::MM );
|
return ECOORD( aCoord, ECOORD::EAGLE_UNIT::EAGLE_MM );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -386,31 +386,31 @@ typedef OPTIONAL_XML_ATTRIBUTE<ECOORD> opt_ecoord;
|
||||||
// Eagle coordinates
|
// Eagle coordinates
|
||||||
struct ECOORD
|
struct ECOORD
|
||||||
{
|
{
|
||||||
enum UNIT
|
enum EAGLE_UNIT
|
||||||
{
|
{
|
||||||
NM, ///< nanometers
|
EAGLE_NM, ///< nanometers
|
||||||
MM, ///< millimeters
|
EAGLE_MM, ///< millimeters
|
||||||
INCH, ///< inches
|
EAGLE_INCH, ///< inches
|
||||||
MIL, ///< mils/thous
|
EAGLE_MIL, ///< mils/thous
|
||||||
};
|
};
|
||||||
|
|
||||||
///> Value expressed in nanometers
|
///> Value expressed in nanometers
|
||||||
long long int value;
|
long long int value;
|
||||||
|
|
||||||
///> Unit used for the value field
|
///> Unit used for the value field
|
||||||
static constexpr UNIT ECOORD_UNIT = NM;
|
static constexpr EAGLE_UNIT ECOORD_UNIT = EAGLE_NM;
|
||||||
|
|
||||||
ECOORD()
|
ECOORD()
|
||||||
: value( 0 )
|
: value( 0 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ECOORD( int aValue, enum UNIT aUnit )
|
ECOORD( int aValue, enum EAGLE_UNIT aUnit )
|
||||||
: value( ToNanoMeters( aValue, aUnit ) )
|
: value( ToNanoMeters( aValue, aUnit ) )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ECOORD( const wxString& aValue, enum UNIT aUnit );
|
ECOORD( const wxString& aValue, enum EAGLE_UNIT aUnit );
|
||||||
|
|
||||||
int ToSchUnits() const
|
int ToSchUnits() const
|
||||||
{
|
{
|
||||||
|
@ -444,7 +444,7 @@ struct ECOORD
|
||||||
return value == aOther.value;
|
return value == aOther.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long long int ToNanoMeters( int aValue, enum UNIT aUnit );
|
static long long int ToNanoMeters( int aValue, enum EAGLE_UNIT aUnit );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -85,8 +85,8 @@ typedef MODULE_MAP::const_iterator MODULE_CITER;
|
||||||
/// Return is in BIU.
|
/// Return is in BIU.
|
||||||
static int parseEagle( const wxString& aDistance )
|
static int parseEagle( const wxString& aDistance )
|
||||||
{
|
{
|
||||||
ECOORD::UNIT unit = ( aDistance.npos != aDistance.find( "mil" ) )
|
ECOORD::EAGLE_UNIT unit = ( aDistance.npos != aDistance.find( "mil" ) )
|
||||||
? ECOORD::UNIT::MIL : ECOORD::UNIT::MM;
|
? ECOORD::EAGLE_UNIT::EAGLE_MIL : ECOORD::EAGLE_UNIT::EAGLE_MM;
|
||||||
|
|
||||||
ECOORD coord( aDistance, unit );
|
ECOORD coord( aDistance, unit );
|
||||||
|
|
||||||
|
@ -700,14 +700,14 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
|
||||||
if( *d.dimensionType == "horizontal" )
|
if( *d.dimensionType == "horizontal" )
|
||||||
{
|
{
|
||||||
int newY = ( d.y1.ToPcbUnits() + d.y2.ToPcbUnits() ) / 2;
|
int newY = ( d.y1.ToPcbUnits() + d.y2.ToPcbUnits() ) / 2;
|
||||||
d.y1 = ECOORD( newY, ECOORD::UNIT::NM );
|
d.y1 = ECOORD( newY, ECOORD::EAGLE_UNIT::EAGLE_NM );
|
||||||
d.y2 = ECOORD( newY, ECOORD::UNIT::NM );
|
d.y2 = ECOORD( newY, ECOORD::EAGLE_UNIT::EAGLE_NM );
|
||||||
}
|
}
|
||||||
else if( *d.dimensionType == "vertical" )
|
else if( *d.dimensionType == "vertical" )
|
||||||
{
|
{
|
||||||
int newX = ( d.x1.ToPcbUnits() + d.x2.ToPcbUnits() ) / 2;
|
int newX = ( d.x1.ToPcbUnits() + d.x2.ToPcbUnits() ) / 2;
|
||||||
d.x1 = ECOORD( newX, ECOORD::UNIT::NM );
|
d.x1 = ECOORD( newX, ECOORD::EAGLE_UNIT::EAGLE_NM );
|
||||||
d.x2 = ECOORD( newX, ECOORD::UNIT::NM );
|
d.x2 = ECOORD( newX, ECOORD::EAGLE_UNIT::EAGLE_NM );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue