Work on internal (nano)metric length units started.
Added configuartion option KICAD_NANOMETRIC for this. * With option set to false: * - it should work and compile as usual - some values are saved with decimal point (which should be backward/forward compatible as old versions should just drop fractional part) * With option set to true: * - lengths in Global Design Rules should be settable 1nm steps. FROM/TO_LEGACY_LU(_DBL) macros introduced for easy interconnection between old and new units.
This commit is contained in:
parent
311a8186ff
commit
a273b7bdb5
|
@ -29,6 +29,9 @@ option(KICAD_GOST "enable/disable building using GOST notation for multiple gate
|
|||
#for those who bored with uppercase
|
||||
option(KICAD_KEEPCASE "turn-off automatic component name conversion to uppercase if selected")
|
||||
|
||||
#highly experimetnal option
|
||||
option(KICAD_NANOMETRE "set length quantum to 1 nm for PCB")
|
||||
|
||||
option(USE_WX_GRAPHICS_CONTEXT
|
||||
"Use wxGraphicsContext for rendering (default OFF). Warning, this is experimental")
|
||||
|
||||
|
@ -99,6 +102,10 @@ if(KICAD_KEEPCASE)
|
|||
add_definitions(-DKICAD_KEEPCASE)
|
||||
endif(KICAD_KEEPCASE)
|
||||
|
||||
if(KICAD_NANOMETRE)
|
||||
add_definitions(-DKICAD_NANOMETRE)
|
||||
endif(KICAD_NANOMETRE)
|
||||
|
||||
if(USE_WX_OVERLAY OR APPLE)
|
||||
add_definitions(-DUSE_WX_OVERLAY)
|
||||
endif(USE_WX_OVERLAY OR APPLE)
|
||||
|
|
|
@ -441,6 +441,133 @@ int ReturnValueFromString( EDA_UNITS_T aUnit, const wxString& TextValue,
|
|||
}
|
||||
|
||||
|
||||
#ifdef KICAD_NANOMETRE
|
||||
|
||||
/*
|
||||
*New common length functions
|
||||
*/
|
||||
|
||||
const LENGTH_UNIT_DESC g_MillimetreDesc =
|
||||
{
|
||||
LENGTH_UNITS<LENGTH_DEF>::millimetre(),
|
||||
_(" mm"),
|
||||
wxT("mm"),
|
||||
6
|
||||
};
|
||||
const LENGTH_UNIT_DESC g_InchDesc =
|
||||
{
|
||||
LENGTH_UNITS<LENGTH_DEF>::inch(),
|
||||
_(" \""),
|
||||
wxT("in"),
|
||||
7
|
||||
};
|
||||
const LENGTH_UNIT_DESC g_MilDesc =
|
||||
{
|
||||
LENGTH_UNITS<LENGTH_DEF>::mil(),
|
||||
_(" mil"),
|
||||
wxT("mil"),
|
||||
5
|
||||
};
|
||||
const LENGTH_UNIT_DESC g_UnscaledDesc = /* stub */
|
||||
{
|
||||
LENGTH_DEF::quantum(),
|
||||
wxT(""),
|
||||
wxT(""),
|
||||
4
|
||||
};
|
||||
|
||||
const LENGTH_UNIT_DESC *UnitDescription( EDA_UNITS_T aUnit ) {
|
||||
switch(aUnit) {
|
||||
case INCHES:
|
||||
return &g_InchDesc;
|
||||
case MILLIMETRES:
|
||||
return &g_MillimetreDesc;
|
||||
default:
|
||||
return &g_UnscaledDesc; /* should not be reached */
|
||||
}
|
||||
}
|
||||
|
||||
wxString LengthToString( const LENGTH_UNIT_DESC *aUnit, LENGTH_DEF aValue,
|
||||
bool aAdd_unit_symbol ) {
|
||||
wxString StringValue;
|
||||
double value_to_print;
|
||||
value_to_print = LENGTH<double>(aValue) / LENGTH<double>(aUnit->m_Value);
|
||||
StringValue.Printf( wxT( "%.*f" ), aUnit->m_Precision, value_to_print);
|
||||
if( aAdd_unit_symbol ) {
|
||||
StringValue += aUnit->m_Postfix;
|
||||
}
|
||||
return StringValue;
|
||||
}
|
||||
LENGTH_DEF StringToLength( const LENGTH_UNIT_DESC *aUnit, const wxString& TextValue )
|
||||
{
|
||||
|
||||
LENGTH_DEF Value;
|
||||
double dtmp = 0;
|
||||
|
||||
/* Acquire the 'right' decimal point separator */
|
||||
const struct lconv* lc = localeconv();
|
||||
wxChar decimal_point = lc->decimal_point[0];
|
||||
wxString buf( TextValue.Strip( wxString::both ) );
|
||||
|
||||
/* Convert the period in decimal point */
|
||||
buf.Replace( wxT( "." ), wxString( decimal_point, 1 ) );
|
||||
// An ugly fix needed by WxWidgets 2.9.1 that sometimes
|
||||
// back to a point as separator, although the separator is the comma
|
||||
// TODO: remove this line if WxWidgets 2.9.2 fixes this issue
|
||||
buf.Replace( wxT( "," ), wxString( decimal_point, 1 ) );
|
||||
|
||||
/* Find the end of the numeric part */
|
||||
unsigned brk_point = 0;
|
||||
while( brk_point < buf.Len() )
|
||||
{
|
||||
wxChar ch = buf[brk_point];
|
||||
if( !( (ch >= '0' && ch <='9') || (ch == decimal_point)
|
||||
|| (ch == '-') || (ch == '+') ) )
|
||||
{
|
||||
break;
|
||||
}
|
||||
++brk_point;
|
||||
}
|
||||
|
||||
/* Extract the numeric part */
|
||||
buf.Left( brk_point ).ToDouble( &dtmp );
|
||||
|
||||
/* Check the optional unit designator (2 ch significant) */
|
||||
wxString unit( buf.Mid( brk_point ).Strip( wxString::leading ).Left( 2 ).Lower() );
|
||||
if( unit == wxT( "in" ) || unit == wxT( "\"" ) )
|
||||
{
|
||||
aUnit = &g_InchDesc;
|
||||
}
|
||||
else if( unit == wxT( "mm" ) )
|
||||
{
|
||||
aUnit = &g_MillimetreDesc;
|
||||
}
|
||||
else if( unit == wxT( "mi" ) || unit == wxT( "th" ) ) /* Mils or thous */
|
||||
{
|
||||
aUnit = &g_MilDesc;
|
||||
}
|
||||
Value = LENGTH_DEF( dtmp * LENGTH< double, 1 >( aUnit->m_Value ) );
|
||||
|
||||
return Value;
|
||||
}
|
||||
|
||||
void LengthToTextCtrl( wxTextCtrl& TextCtr, LENGTH_DEF Value ) {
|
||||
wxString msg = LengthToString( UnitDescription( g_UserUnit ), Value );
|
||||
|
||||
TextCtr.SetValue( msg );
|
||||
}
|
||||
LENGTH_DEF LengthFromTextCtrl( const wxTextCtrl& TextCtr )
|
||||
{
|
||||
LENGTH_DEF value;
|
||||
wxString msg = TextCtr.GetValue();
|
||||
|
||||
value = StringToLength( UnitDescription( g_UserUnit ), msg );
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Function wxStringSplit
|
||||
* Split a String to a String List when founding 'splitter'
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
#include "pcbstruct.h" // NB_COLORS
|
||||
|
||||
#include "lengthpcb.h"
|
||||
|
||||
// Class for handle current printed board design settings
|
||||
class BOARD_DESIGN_SETTINGS
|
||||
{
|
||||
|
@ -22,11 +24,11 @@ public:
|
|||
int m_EdgeSegmentWidth; // current graphic line width (EDGE layer only)
|
||||
int m_PcbTextWidth; // current Pcb (not module) Text width
|
||||
wxSize m_PcbTextSize; // current Pcb (not module) Text size
|
||||
int m_TrackMinWidth; // track min value for width ((min copper size value
|
||||
int m_ViasMinSize; // vias (not micro vias) min diameter
|
||||
int m_ViasMinDrill; // vias (not micro vias) min drill diameter
|
||||
int m_MicroViasMinSize; // micro vias (not vias) min diameter
|
||||
int m_MicroViasMinDrill; // micro vias (not vias) min drill diameter
|
||||
LENGTH_PCB m_TrackMinWidth; // track min value for width ((min copper size value
|
||||
LENGTH_PCB m_ViasMinSize; // vias (not micro vias) min diameter
|
||||
LENGTH_PCB m_ViasMinDrill; // vias (not micro vias) min drill diameter
|
||||
LENGTH_PCB m_MicroViasMinSize; // micro vias (not vias) min diameter
|
||||
LENGTH_PCB m_MicroViasMinDrill; // micro vias (not vias) min drill diameter
|
||||
|
||||
// Global mask margins:
|
||||
int m_SolderMaskMargin; // Solder mask margin
|
||||
|
|
|
@ -10,6 +10,11 @@
|
|||
#include "wx/confbase.h"
|
||||
#include "wx/fileconf.h"
|
||||
|
||||
|
||||
#ifdef KICAD_NANOMETRE
|
||||
#include "length.h"
|
||||
#endif
|
||||
|
||||
class wxAboutDialogInfo;
|
||||
class BASE_SCREEN;
|
||||
class EDA_DRAW_FRAME;
|
||||
|
@ -321,6 +326,7 @@ wxString ReturnStringFromValue( EDA_UNITS_T aUnit,
|
|||
int aInternal_Unit,
|
||||
bool aAdd_unit_symbol = false );
|
||||
|
||||
|
||||
void AddUnitSymbol( wxStaticText& Stext, EDA_UNITS_T aUnit = g_UserUnit );
|
||||
|
||||
/* Add string " (mm):" or " ("):" to the static text Stext.
|
||||
|
@ -334,6 +340,27 @@ void PutValueInLocalUnits( wxTextCtrl& TextCtr, int Value,
|
|||
int ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr,
|
||||
int Internal_Unit );
|
||||
|
||||
#ifdef KICAD_NANOMETRE
|
||||
|
||||
struct LENGTH_UNIT_DESC
|
||||
{
|
||||
LENGTH_DEF m_Value;
|
||||
wxString m_Postfix;
|
||||
wxString m_IntlSymbol;
|
||||
int m_Precision;
|
||||
};
|
||||
extern const LENGTH_UNIT_DESC g_MillimetreDesc, g_InchDesc, g_MilDesc;
|
||||
|
||||
const LENGTH_UNIT_DESC *UnitDescription( EDA_UNITS_T aUnit );
|
||||
|
||||
LENGTH_DEF StringToLength( const LENGTH_UNIT_DESC *aUnit, const wxString& TextValue );
|
||||
wxString LengthToString( const LENGTH_UNIT_DESC *aUnit, LENGTH_DEF aValue,
|
||||
bool aAdd_unit_symbol = false );
|
||||
|
||||
void LengthToTextCtrl( wxTextCtrl& TextCtr, LENGTH_DEF Value );
|
||||
LENGTH_DEF LengthFromTextCtrl( const wxTextCtrl& TextCtr );
|
||||
#endif
|
||||
|
||||
/* return a String List from a string, with a specific splitter*/
|
||||
wxArrayString* wxStringSplit( wxString txt, wxChar splitter );
|
||||
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
/**
|
||||
* The physical length library. Made for nanometer scale.
|
||||
* @file length.h
|
||||
* @brief The physical length library. Made for nanometer scale.
|
||||
*/
|
||||
|
||||
/* sorry it is not styled correctly, i'll work on it further */
|
||||
/* sorry if it is not styled correctly, i'll work on it further */
|
||||
|
||||
#ifndef LENGTH_H_INCLUDED
|
||||
#define LENGTH_H_INCLUDED 1
|
||||
|
||||
#include "limited_int.h"
|
||||
|
||||
/* type to be used by length units by default */
|
||||
typedef int DEF_LENGTH_VALUE;
|
||||
typedef LIMITED_INT< int > DEF_LENGTH_VALUE;
|
||||
|
||||
/**
|
||||
* Length template class
|
||||
* Length template class.
|
||||
* @param T actual type holding a value (be aware of precision and range!)
|
||||
* @param P power of length unit: 1 - length, 2 - area, 3 - volume, -1 - lin. density etc...
|
||||
* This class check length dimension in compile time. In runtime it behaves
|
||||
|
@ -47,6 +49,8 @@ typedef int DEF_LENGTH_VALUE;
|
|||
|
||||
template < typename T = DEF_LENGTH_VALUE, int P = 1 > class LENGTH;
|
||||
|
||||
typedef LENGTH<DEF_LENGTH_VALUE, 1> LENGTH_DEF;
|
||||
|
||||
/**
|
||||
* Length units contained in this class
|
||||
*/
|
||||
|
@ -61,6 +65,38 @@ template < typename T, int P > struct LENGTH_TRAITS
|
|||
typedef LENGTH<T, P> flat;
|
||||
};
|
||||
|
||||
template < typename T > struct LENGTH_CASTS
|
||||
{
|
||||
template< typename X > static T cast( const X x )
|
||||
{
|
||||
return T( x );
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct LENGTH_CASTS < int >
|
||||
{
|
||||
static int cast( const double x )
|
||||
{
|
||||
return floor( x + 0.5 );
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct LENGTH_CASTS < long >
|
||||
{
|
||||
static long cast( const double x )
|
||||
{
|
||||
return floor( x + 0.5 );
|
||||
}
|
||||
};
|
||||
|
||||
template < typename T > struct LENGTH_CASTS < LIMITED_INT< T > >
|
||||
{
|
||||
static LIMITED_INT< T > cast( const double x )
|
||||
{
|
||||
return LIMITED_INT< T > ( floor( x + 0.5 ) );
|
||||
}
|
||||
};
|
||||
|
||||
template < typename T > struct LENGTH_TRAITS< T, 0 >
|
||||
{
|
||||
/* length dimension to power 0 is just a number, so LENGTH<T, 0> should be automatically converted to T */
|
||||
|
@ -92,7 +128,8 @@ public:
|
|||
{
|
||||
dimension = P
|
||||
};
|
||||
LENGTH( const LENGTH <T, P> &orig ) : m_U( orig.m_U )
|
||||
template< typename U > LENGTH( const LENGTH< U, P > &orig )
|
||||
: m_U( LENGTH_CASTS < T >::cast( orig.m_U ) )
|
||||
{
|
||||
}
|
||||
LENGTH( void ) : m_U()
|
||||
|
@ -104,14 +141,20 @@ public:
|
|||
return T(0);
|
||||
}
|
||||
|
||||
/* Do not use this, please */
|
||||
static LENGTH<T, P> quantum ( void )
|
||||
{
|
||||
return T(1);
|
||||
}
|
||||
|
||||
LENGTH<T, P> & operator = ( const LENGTH<T, P> & y )
|
||||
{
|
||||
this->m_U = y.m_U;
|
||||
return *this;
|
||||
}
|
||||
template<typename Y> operator LENGTH< Y, P > ( void )
|
||||
template< typename Y > operator LENGTH< Y, P > ( void )
|
||||
{
|
||||
return this->m_U;
|
||||
return LENGTH< Y, P >( this->m_U );
|
||||
}
|
||||
/*************************/
|
||||
/* comparisons and tests */
|
||||
|
@ -231,6 +274,9 @@ public:
|
|||
* to get numeric value of length in specific units you should use a division
|
||||
* length/LENGTH_UNITS::metre() gives number of metres in length
|
||||
* legnth/LENGTH_UNITS::foot() gives number of feet in length
|
||||
*
|
||||
* Really these units are used in NEWPCB and printing routines, as EESCHEMA
|
||||
* is going to use relative units.
|
||||
*/
|
||||
|
||||
template < typename T = DEF_LENGTH_VALUE > class LENGTH_UNITS {
|
||||
|
@ -275,4 +321,4 @@ template < typename T, int D > class LENGTH_UNITS< LENGTH< T, D > >: public LENG
|
|||
{
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif /* def LENGTH_H_INCLUDED */
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
/**
|
||||
* @file lengthpcb.h
|
||||
* @brief Length definitions for PCBNEW.
|
||||
*/
|
||||
|
||||
#ifndef LENGTHPCB_H_INCLUDED
|
||||
#define LENGTHPCB_H_INCLUDED 1
|
||||
|
||||
#ifdef KICAD_NANOMETRE
|
||||
#include "length.h"
|
||||
|
||||
/* switched type! */
|
||||
typedef LENGTH< LIMITED_INT< int >, 1 > LENGTH_PCB;
|
||||
typedef LENGTH< double, 1 > LENGTH_PCB_DBL;
|
||||
|
||||
/* Transition macros. they are used for unit conversion between
|
||||
* nanometre scale and old (0.1 mil) scale */
|
||||
|
||||
#define PCB_LEGACY_INCH_SCALE 10000
|
||||
#define PCB_LEGACY_UNIT( T ) ( LENGTH_UNITS< T >::inch() / PCB_LEGACY_INCH_SCALE )
|
||||
|
||||
#define TO_LEGACY_LU( x ) \
|
||||
( LENGTH_PCB( x ) / PCB_LEGACY_UNIT( LENGTH_PCB ) )
|
||||
#define TO_LEGACY_LU_DBL( x ) \
|
||||
( LENGTH_PCB_DBL( x ) / PCB_LEGACY_UNIT( LENGTH_PCB_DBL ) )
|
||||
|
||||
static LENGTH_PCB from_legacy_lu( int x ) {
|
||||
return x * PCB_LEGACY_UNIT( LENGTH_PCB );
|
||||
}
|
||||
static LENGTH_PCB from_legacy_lu( double x ) {
|
||||
return LENGTH_PCB( x * PCB_LEGACY_UNIT( LENGTH_PCB_DBL ) );
|
||||
}
|
||||
|
||||
static LENGTH_PCB_DBL from_legacy_lu_dbl( double x ) {
|
||||
return x * LENGTH_UNITS< LENGTH_PCB_DBL >::inch() / PCB_LEGACY_INCH_SCALE;
|
||||
}
|
||||
|
||||
#define FROM_LEGACY_LU( x ) ( from_legacy_lu( x ) )
|
||||
#define FROM_LEGACY_LU_DBL( x ) ( from_legacy_lu_dbl( x ) )
|
||||
|
||||
|
||||
#else
|
||||
|
||||
typedef int LENGTH_PCB;
|
||||
typedef double LENGTH_PCB_DBL;
|
||||
|
||||
/* transition macro stubs */
|
||||
|
||||
#define TO_LEGACY_LU( x ) ( x )
|
||||
#define TO_LEGACY_LU_DBL( x ) ( double( x ) )
|
||||
|
||||
#define FROM_LEGACY_LU( x ) ( x )
|
||||
#define FROM_LEGACY_LU_DBL( x ) ( double( x ) )
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* def LENGTHPCB_H_INCLUDED */
|
|
@ -0,0 +1,309 @@
|
|||
/**
|
||||
* @file limited_int.h
|
||||
* @brief Integer class catching overflows.
|
||||
*/
|
||||
|
||||
/* sorry if it is not styled correctly, i'll work on it further */
|
||||
|
||||
#ifndef LIMITED_INT_H_INCLUDED
|
||||
#define LIMITED_INT_H_INCLUDED 1
|
||||
|
||||
#include <limits>
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
|
||||
template < typename T = int > class LIMITED_INT {
|
||||
private:
|
||||
T m_Value;
|
||||
public:
|
||||
LIMITED_INT( void ) : m_Value() {
|
||||
}
|
||||
template<typename V> LIMITED_INT( const LIMITED_INT< V >& orig )
|
||||
: m_Value( orig.m_Value )
|
||||
{
|
||||
assert(std::numeric_limits<T>::min() <= orig.m_Value);
|
||||
assert(orig.m_Value <= std::numeric_limits<T>::max());
|
||||
}
|
||||
template<typename V> LIMITED_INT( const double v )
|
||||
: m_Value( floor(v+0.5) )
|
||||
{
|
||||
assert(std::numeric_limits<T>::min() <= v);
|
||||
assert(v <= std::numeric_limits<T>::max());
|
||||
}
|
||||
LIMITED_INT( T v ): m_Value( v )
|
||||
{
|
||||
}
|
||||
|
||||
operator T( void ) const
|
||||
{
|
||||
return m_Value;
|
||||
}
|
||||
operator double( void ) const
|
||||
{
|
||||
return ( double )m_Value;
|
||||
}
|
||||
|
||||
LIMITED_INT<T> & operator = ( LIMITED_INT< T > src )
|
||||
{
|
||||
m_Value = src.m_Value;
|
||||
return *this;
|
||||
}
|
||||
LIMITED_INT<T> & operator = ( T src )
|
||||
{
|
||||
m_Value = src;
|
||||
return *this;
|
||||
}
|
||||
/*************************/
|
||||
/* comparisons and tests */
|
||||
/*************************/
|
||||
bool operator ! (void) const {
|
||||
return !m_Value;
|
||||
}
|
||||
|
||||
bool operator == ( const LIMITED_INT< T > &y ) const
|
||||
{
|
||||
return m_Value == y.m_Value;
|
||||
}
|
||||
bool operator == ( const T y ) const
|
||||
{
|
||||
return m_Value == y;
|
||||
}
|
||||
friend bool operator == ( const T x, const LIMITED_INT< T > &y )
|
||||
{
|
||||
return x == y.m_Value;
|
||||
}
|
||||
|
||||
bool operator != ( const LIMITED_INT<T> &y ) const
|
||||
{
|
||||
return m_Value != y.m_Value;
|
||||
}
|
||||
bool operator != ( const T y ) const
|
||||
{
|
||||
return m_Value != y;
|
||||
}
|
||||
friend bool operator != ( const T x, const LIMITED_INT< T > &y )
|
||||
{
|
||||
return x != y.m_Value;
|
||||
}
|
||||
|
||||
bool operator < ( const LIMITED_INT< T > &y ) const
|
||||
{
|
||||
return m_Value < y.m_Value;
|
||||
}
|
||||
bool operator < ( const T y ) const
|
||||
{
|
||||
return m_Value < y;
|
||||
}
|
||||
friend bool operator < ( const T x, const LIMITED_INT< T > &y )
|
||||
{
|
||||
return x < y.m_Value;
|
||||
}
|
||||
|
||||
bool operator >= ( const LIMITED_INT< T > &y ) const
|
||||
{
|
||||
return m_Value >= y.m_Value;
|
||||
}
|
||||
bool operator >= ( const T y ) const
|
||||
{
|
||||
return m_Value >= y;
|
||||
}
|
||||
friend bool operator >= ( const T x, const LIMITED_INT<T> &y )
|
||||
{
|
||||
return x >= y.m_Value;
|
||||
}
|
||||
|
||||
bool operator > ( const LIMITED_INT< T > &y ) const
|
||||
{
|
||||
return m_Value > y.m_Value;
|
||||
}
|
||||
bool operator > ( const T y ) const
|
||||
{
|
||||
return m_Value > y;
|
||||
}
|
||||
friend bool operator > ( const T x, const LIMITED_INT< T > &y )
|
||||
{
|
||||
return x > y.m_Value;
|
||||
}
|
||||
|
||||
bool operator <= ( const LIMITED_INT< T > &y ) const
|
||||
{
|
||||
return m_Value <= y.m_Value;
|
||||
}
|
||||
bool operator <= ( const T y ) const
|
||||
{
|
||||
return m_Value <= y;
|
||||
}
|
||||
friend bool operator <= ( const T x, const LIMITED_INT< T > &y )
|
||||
{
|
||||
return x <= y.m_Value;
|
||||
}
|
||||
|
||||
/*************************/
|
||||
/* basic arithmetic */
|
||||
/*************************/
|
||||
LIMITED_INT< T > operator + ( const LIMITED_INT< T > &y ) const
|
||||
{
|
||||
assert( !( 0 < m_Value ) || y.m_Value <= std::numeric_limits< T >::max() - m_Value );
|
||||
assert( !( m_Value < 0 ) || std::numeric_limits< T >::min() - m_Value <= y.m_Value );
|
||||
return m_Value + y.m_Value;
|
||||
}
|
||||
LIMITED_INT< T > operator + ( const T y ) const
|
||||
{
|
||||
return *this + LIMITED_INT< T >( y );
|
||||
}
|
||||
friend LIMITED_INT< T > operator + ( const T x, const LIMITED_INT< T > &y )
|
||||
{
|
||||
return LIMITED_INT< T >( x ) + y;
|
||||
}
|
||||
double operator + ( const double y ) const
|
||||
{
|
||||
return double( m_Value ) + y;
|
||||
}
|
||||
friend double operator + ( const double x, const LIMITED_INT< T > &y )
|
||||
{
|
||||
return x + double( y.m_Value );
|
||||
}
|
||||
|
||||
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( !( m_Value < 0 ) || y.m_Value <= m_Value - std::numeric_limits< T >::min() );
|
||||
return m_Value - y.m_Value;
|
||||
}
|
||||
LIMITED_INT< T > operator - ( const T y ) const
|
||||
{
|
||||
return *this - LIMITED_INT< T >( y );
|
||||
}
|
||||
friend LIMITED_INT< T > operator - ( const T x, const LIMITED_INT< T > &y )
|
||||
{
|
||||
return LIMITED_INT< T >( x ) - y;
|
||||
}
|
||||
double operator - ( const double y ) const
|
||||
{
|
||||
return double( m_Value ) - y;
|
||||
}
|
||||
friend double operator - ( const double x, const LIMITED_INT< T > &y )
|
||||
{
|
||||
return x - double( y.m_Value );
|
||||
}
|
||||
|
||||
LIMITED_INT< T > operator * ( const LIMITED_INT< T > &y ) const
|
||||
{
|
||||
assert( !( 0 < m_Value && 0 < y.m_Value )
|
||||
|| y.m_Value <= std::numeric_limits<T>::max() / m_Value );
|
||||
assert( !( 0 < m_Value && y.m_Value < 0 )
|
||||
|| std::numeric_limits<T>::min() / m_Value <= y.m_Value );
|
||||
assert( !( m_Value < 0 && 0 < y.m_Value )
|
||||
|| std::numeric_limits<T>::min() / y.m_Value <= m_Value );
|
||||
assert( !( m_Value < 0 && y.m_Value < 0 )
|
||||
|| std::numeric_limits<T>::max() / m_Value <= y.m_Value );
|
||||
return m_Value * y.m_Value;
|
||||
}
|
||||
LIMITED_INT<T> operator * ( const T y) const
|
||||
{
|
||||
return *this * LIMITED_INT< T >( y );
|
||||
}
|
||||
friend LIMITED_INT< T > operator *( const T x, const LIMITED_INT< T > &y )
|
||||
{
|
||||
return LIMITED_INT< T >( x ) * y;
|
||||
}
|
||||
double operator * ( const double y ) const
|
||||
{
|
||||
return double( m_Value ) * y;
|
||||
}
|
||||
friend double operator * ( const double x, const LIMITED_INT< T > &y )
|
||||
{
|
||||
return x * double( y.m_Value );
|
||||
}
|
||||
|
||||
LIMITED_INT<T> operator / ( const LIMITED_INT<T> &y ) const
|
||||
{
|
||||
assert( !( -1 == y.m_Value )
|
||||
|| -std::numeric_limits< T >::max() <= m_Value );
|
||||
return m_Value / y.m_Value;
|
||||
}
|
||||
LIMITED_INT<T> operator / ( const T y ) const
|
||||
{
|
||||
return *this / LIMITED_INT<T>(y);
|
||||
}
|
||||
friend LIMITED_INT< T > operator / ( const T x, const LIMITED_INT< T > &y )
|
||||
{
|
||||
return LIMITED_INT< T >( x ) / y;
|
||||
}
|
||||
double operator / ( const double y ) const
|
||||
{
|
||||
return double( m_Value ) / y;
|
||||
}
|
||||
friend double operator / ( const double x, const LIMITED_INT< T > &y )
|
||||
{
|
||||
return x / double( y.m_Value );
|
||||
}
|
||||
|
||||
LIMITED_INT<T> operator % ( const LIMITED_INT<T> &y ) const
|
||||
{
|
||||
return m_Value % y.m_Value;
|
||||
}
|
||||
LIMITED_INT<T> operator % ( const T y ) const
|
||||
{
|
||||
return *this % LIMITED_INT<T>(y);
|
||||
}
|
||||
friend LIMITED_INT< T > operator % ( const T x, const LIMITED_INT< T > &y )
|
||||
{
|
||||
return LIMITED_INT< T >( x ) % y;
|
||||
}
|
||||
/*************************/
|
||||
/* assignment arithmetic */
|
||||
/*************************/
|
||||
LIMITED_INT< T >& operator += ( const LIMITED_INT< T > &y )
|
||||
{
|
||||
*this = *this + y;
|
||||
return *this;
|
||||
}
|
||||
LIMITED_INT< T >& operator += ( const T y )
|
||||
{
|
||||
*this = *this + y;
|
||||
return *this;
|
||||
}
|
||||
LIMITED_INT< T >& operator ++ ( void )
|
||||
{
|
||||
*this = *this + 1;
|
||||
return *this;
|
||||
}
|
||||
LIMITED_INT< T >& operator -= ( const LIMITED_INT< T > &y )
|
||||
{
|
||||
*this = *this - y;
|
||||
return *this;
|
||||
}
|
||||
LIMITED_INT< T >& operator -= ( const T y )
|
||||
{
|
||||
*this = *this - y;
|
||||
return *this;
|
||||
}
|
||||
LIMITED_INT< T >& operator -- ( void )
|
||||
{
|
||||
*this = *this - 1;
|
||||
return *this;
|
||||
}
|
||||
LIMITED_INT< T >& operator *= ( const LIMITED_INT< T > &y )
|
||||
{
|
||||
*this = *this * y;
|
||||
return *this;
|
||||
}
|
||||
LIMITED_INT< T >& operator *= ( const T y )
|
||||
{
|
||||
*this = *this * y;
|
||||
return *this;
|
||||
}
|
||||
LIMITED_INT< T >& operator /= ( const LIMITED_INT< T > &y )
|
||||
{
|
||||
*this = *this / y;
|
||||
return *this;
|
||||
}
|
||||
LIMITED_INT< T >& operator /= ( const T y )
|
||||
{
|
||||
*this = *this / y;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* def LIMITED_INT_H_INCLUDED*/
|
|
@ -32,11 +32,11 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS()
|
|||
m_EdgeSegmentWidth = 100; // current graphic line width (EDGE layer only)
|
||||
m_PcbTextWidth = 100; // current Pcb (not module) Text width
|
||||
m_PcbTextSize = wxSize( 500, 500 ); // current Pcb (not module) Text size
|
||||
m_TrackMinWidth = 80; // track min value for width ((min copper size value
|
||||
m_ViasMinSize = 350; // vias (not micro vias) min diameter
|
||||
m_ViasMinDrill = 200; // vias (not micro vias) min drill diameter
|
||||
m_MicroViasMinSize = 200; // micro vias (not vias) min diameter
|
||||
m_MicroViasMinDrill = 50; // micro vias (not vias) min drill diameter
|
||||
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_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:
|
||||
m_SolderMaskMargin = 150; // Solder mask margin
|
||||
|
|
|
@ -75,9 +75,9 @@ void NETCLASS::SetParams( const NETCLASS* defaults )
|
|||
// TODO: see how change that.
|
||||
const BOARD_DESIGN_SETTINGS& g = boardDesignSettings;
|
||||
|
||||
SetTrackWidth( g.m_TrackMinWidth );
|
||||
SetViaDiameter( g.m_ViasMinSize );
|
||||
SetuViaDiameter(g.m_MicroViasMinSize );
|
||||
SetTrackWidth( TO_LEGACY_LU( g.m_TrackMinWidth ) );
|
||||
SetViaDiameter( TO_LEGACY_LU( g.m_ViasMinSize ) );
|
||||
SetuViaDiameter( TO_LEGACY_LU( g.m_MicroViasMinSize ) );
|
||||
// Use default values for next parameters:
|
||||
SetClearance( DEFAULT_CLEARANCE );
|
||||
SetViaDrill( DEFAULT_VIA_DRILL );
|
||||
|
@ -412,27 +412,27 @@ bool NETCLASS::ReadDescr( LINE_READER* aReader )
|
|||
|
||||
int NETCLASS::GetTrackMinWidth() const
|
||||
{
|
||||
return m_Parent->GetBoardDesignSettings()->m_TrackMinWidth;
|
||||
return TO_LEGACY_LU( m_Parent->GetBoardDesignSettings()->m_TrackMinWidth );
|
||||
}
|
||||
|
||||
int NETCLASS::GetViaMinDiameter() const
|
||||
{
|
||||
return m_Parent->GetBoardDesignSettings()->m_ViasMinSize;
|
||||
return TO_LEGACY_LU( m_Parent->GetBoardDesignSettings()->m_ViasMinSize );
|
||||
}
|
||||
|
||||
int NETCLASS::GetViaMinDrill() const
|
||||
{
|
||||
return m_Parent->GetBoardDesignSettings()->m_ViasMinDrill;
|
||||
return TO_LEGACY_LU( m_Parent->GetBoardDesignSettings()->m_ViasMinDrill );
|
||||
}
|
||||
|
||||
int NETCLASS::GetuViaMinDiameter() const
|
||||
{
|
||||
return m_Parent->GetBoardDesignSettings()->m_MicroViasMinSize;
|
||||
return TO_LEGACY_LU( m_Parent->GetBoardDesignSettings()->m_MicroViasMinSize );
|
||||
}
|
||||
|
||||
int NETCLASS::GetuViaMinDrill() const
|
||||
{
|
||||
return m_Parent->GetBoardDesignSettings()->m_MicroViasMinDrill;
|
||||
return TO_LEGACY_LU( m_Parent->GetBoardDesignSettings()->m_MicroViasMinDrill );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -213,18 +213,21 @@ void DIALOG_DESIGN_RULES::PrintCurrentSettings()
|
|||
|
||||
// Display min values:
|
||||
value = ReturnStringFromValue( g_UserUnit,
|
||||
m_BrdSettings->m_TrackMinWidth,
|
||||
TO_LEGACY_LU( m_BrdSettings->m_TrackMinWidth ),
|
||||
internal_units,
|
||||
true );
|
||||
msg.Printf( _( "Minimum value for tracks width: <b>%s</b><br>\n" ), GetChars( value ) );
|
||||
m_MessagesList->AppendToPage( msg );
|
||||
|
||||
value = ReturnStringFromValue( g_UserUnit, m_BrdSettings->m_ViasMinSize, internal_units, true );
|
||||
value = ReturnStringFromValue( g_UserUnit,
|
||||
TO_LEGACY_LU( m_BrdSettings->m_ViasMinSize ),
|
||||
internal_units,
|
||||
true );
|
||||
msg.Printf( _( "Minimum value for vias diameter: <b>%s</b><br>\n" ), GetChars( value ) );
|
||||
m_MessagesList->AppendToPage( msg );
|
||||
|
||||
value = ReturnStringFromValue( g_UserUnit,
|
||||
m_BrdSettings->m_MicroViasMinSize,
|
||||
TO_LEGACY_LU( m_BrdSettings->m_MicroViasMinSize ),
|
||||
internal_units,
|
||||
true );
|
||||
msg.Printf( _( "Minimum value for microvias diameter: <b>%s</b><br>\n" ), GetChars( value ) );
|
||||
|
@ -291,21 +294,35 @@ void DIALOG_DESIGN_RULES::InitGlobalRules()
|
|||
AddUnitSymbol( *m_TrackMinWidthTitle );
|
||||
|
||||
int Internal_Unit = m_Parent->m_InternalUnits;
|
||||
PutValueInLocalUnits( *m_SetViasMinSizeCtrl, m_BrdSettings->m_ViasMinSize, Internal_Unit );
|
||||
#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 )
|
||||
m_OptViaType->SetSelection( 1 );
|
||||
|
||||
m_AllowMicroViaCtrl->SetSelection( m_BrdSettings->m_MicroViasAllowed ? 1 : 0 );
|
||||
#ifdef KICAD_NANOMETRE
|
||||
LengthToTextCtrl( *m_SetMicroViasMinSizeCtrl, m_BrdSettings->m_MicroViasMinSize );
|
||||
LengthToTextCtrl( *m_SetMicroViasMinDrillCtrl, m_BrdSettings->m_MicroViasMinDrill );
|
||||
LengthToTextCtrl( *m_SetTrackMinWidthCtrl, m_BrdSettings->m_TrackMinWidth );
|
||||
#else
|
||||
PutValueInLocalUnits( *m_SetMicroViasMinSizeCtrl,
|
||||
m_BrdSettings->m_MicroViasMinSize,
|
||||
Internal_Unit );
|
||||
PutValueInLocalUnits( *m_SetMicroViasMinDrillCtrl,
|
||||
m_BrdSettings->m_MicroViasMinDrill,
|
||||
TO_LEGACY_LU( m_BrdSettings->m_MicroViasMinDrill ),
|
||||
Internal_Unit );
|
||||
|
||||
PutValueInLocalUnits( *m_SetTrackMinWidthCtrl, m_BrdSettings->m_TrackMinWidth, Internal_Unit );
|
||||
PutValueInLocalUnits( *m_SetTrackMinWidthCtrl,
|
||||
m_BrdSettings->m_TrackMinWidth,
|
||||
Internal_Unit );
|
||||
#endif
|
||||
|
||||
// Initialize Vias and Tracks sizes lists.
|
||||
// note we display only extra values, never the current netclass value.
|
||||
|
@ -609,23 +626,40 @@ void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard()
|
|||
if( m_OptViaType->GetSelection() > 0 )
|
||||
m_BrdSettings->m_CurrentViaType = VIA_BLIND_BURIED;
|
||||
|
||||
m_BrdSettings->m_MicroViasAllowed = m_AllowMicroViaCtrl->GetSelection() == 1;
|
||||
|
||||
#ifdef KICAD_NANOMETRE
|
||||
// Update vias minimum values for DRC
|
||||
m_BrdSettings->m_ViasMinSize =
|
||||
LengthFromTextCtrl( *m_SetViasMinSizeCtrl );
|
||||
m_BrdSettings->m_ViasMinDrill =
|
||||
LengthFromTextCtrl( *m_SetViasMinDrillCtrl );
|
||||
|
||||
// Update microvias minimum values for DRC
|
||||
m_BrdSettings->m_MicroViasMinSize =
|
||||
LengthFromTextCtrl( *m_SetMicroViasMinSizeCtrl );
|
||||
m_BrdSettings->m_MicroViasMinDrill =
|
||||
LengthFromTextCtrl( *m_SetMicroViasMinDrillCtrl );
|
||||
|
||||
// Update tracks minimum values for DRC
|
||||
m_BrdSettings->m_TrackMinWidth =
|
||||
LengthFromTextCtrl( *m_SetTrackMinWidthCtrl );
|
||||
#else
|
||||
// Update vias minimum values for DRC
|
||||
m_BrdSettings->m_ViasMinSize =
|
||||
ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl, m_Parent->m_InternalUnits );
|
||||
m_BrdSettings->m_ViasMinDrill =
|
||||
ReturnValueFromTextCtrl( *m_SetViasMinDrillCtrl, m_Parent->m_InternalUnits );
|
||||
|
||||
m_BrdSettings->m_MicroViasAllowed = m_AllowMicroViaCtrl->GetSelection() == 1;
|
||||
|
||||
// Update microvias minimum values for DRC
|
||||
m_BrdSettings->m_MicroViasMinSize =
|
||||
ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl, m_Parent->m_InternalUnits );
|
||||
m_BrdSettings->m_MicroViasMinDrill =
|
||||
ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl, m_Parent->m_InternalUnits );
|
||||
|
||||
// Update tracks minimum values for DRC
|
||||
m_BrdSettings->m_TrackMinWidth =
|
||||
ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -213,7 +213,6 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
|
|||
fgMinValuesSizer->Add( m_MicroViaMinSizeTitle, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT, 5 );
|
||||
|
||||
m_SetMicroViasMinSizeCtrl = new wxTextCtrl( m_panelGolbalDesignRules, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_SetMicroViasMinSizeCtrl->SetMaxLength( 6 );
|
||||
fgMinValuesSizer->Add( m_SetMicroViasMinSizeCtrl, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_MicroViaMinDrillTitle = new wxStaticText( m_panelGolbalDesignRules, wxID_ANY, _("Min uvia drill dia"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
@ -221,7 +220,6 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
|
|||
fgMinValuesSizer->Add( m_MicroViaMinDrillTitle, 0, wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
m_SetMicroViasMinDrillCtrl = new wxTextCtrl( m_panelGolbalDesignRules, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_SetMicroViasMinDrillCtrl->SetMaxLength( 6 );
|
||||
fgMinValuesSizer->Add( m_SetMicroViasMinDrillCtrl, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
sbMinSizesSizer->Add( fgMinValuesSizer, 0, wxEXPAND, 5 );
|
||||
|
|
|
@ -130,12 +130,21 @@ void DIALOG_DRC_CONTROL::InitValues()
|
|||
*/
|
||||
void DIALOG_DRC_CONTROL::SetDrcParmeters( )
|
||||
{
|
||||
m_BrdSettings->m_TrackMinWidth =
|
||||
#ifdef KICAD_NANOMETRE
|
||||
m_BrdSettings->m_TrackMinWidth =
|
||||
LengthFromTextCtrl( *m_SetTrackMinWidthCtrl );
|
||||
m_BrdSettings->m_ViasMinSize =
|
||||
LengthFromTextCtrl( *m_SetViaMinSizeCtrl );
|
||||
m_BrdSettings->m_MicroViasMinSize =
|
||||
LengthFromTextCtrl( *m_SetMicroViakMinSizeCtrl );
|
||||
#else
|
||||
m_BrdSettings->m_TrackMinWidth =
|
||||
ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits );
|
||||
m_BrdSettings->m_ViasMinSize =
|
||||
m_BrdSettings->m_ViasMinSize =
|
||||
ReturnValueFromTextCtrl( *m_SetViaMinSizeCtrl, m_Parent->m_InternalUnits );
|
||||
m_BrdSettings->m_MicroViasMinSize =
|
||||
m_BrdSettings->m_MicroViasMinSize =
|
||||
ReturnValueFromTextCtrl( *m_SetMicroViakMinSizeCtrl, m_Parent->m_InternalUnits );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -54,15 +54,24 @@ void DRC::ShowDialog()
|
|||
|
||||
// copy data retained in this DRC object into the m_ui DrcPanel:
|
||||
|
||||
#ifdef KICAD_NANOMETRE
|
||||
LengthToTextCtrl( *m_ui->m_SetTrackMinWidthCtrl,
|
||||
m_pcb->GetBoardDesignSettings()->m_TrackMinWidth );
|
||||
LengthToTextCtrl( *m_ui->m_SetViaMinSizeCtrl,
|
||||
m_pcb->GetBoardDesignSettings()->m_ViasMinSize );
|
||||
LengthToTextCtrl( *m_ui->m_SetMicroViakMinSizeCtrl,
|
||||
m_pcb->GetBoardDesignSettings()->m_MicroViasMinSize );
|
||||
#else
|
||||
PutValueInLocalUnits( *m_ui->m_SetTrackMinWidthCtrl,
|
||||
m_pcb->GetBoardDesignSettings()->m_TrackMinWidth,
|
||||
TO_LEGACY_LU( m_pcb->GetBoardDesignSettings()->m_TrackMinWidth ),
|
||||
m_mainWindow->m_InternalUnits );
|
||||
PutValueInLocalUnits( *m_ui->m_SetViaMinSizeCtrl,
|
||||
m_pcb->GetBoardDesignSettings()->m_ViasMinSize,
|
||||
TO_LEGACY_LU( m_pcb->GetBoardDesignSettings()->m_ViasMinSize ),
|
||||
m_mainWindow->m_InternalUnits );
|
||||
PutValueInLocalUnits( *m_ui->m_SetMicroViakMinSizeCtrl,
|
||||
m_pcb->GetBoardDesignSettings()->m_MicroViasMinSize,
|
||||
TO_LEGACY_LU( m_pcb->GetBoardDesignSettings()->m_MicroViasMinSize ),
|
||||
m_mainWindow->m_InternalUnits );
|
||||
#endif
|
||||
|
||||
m_ui->m_CreateRptCtrl->SetValue( m_doCreateRptFile );
|
||||
m_ui->m_RptFilenameCtrl->SetValue( m_rptFilename );
|
||||
|
@ -313,12 +322,12 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
|
|||
}
|
||||
#endif
|
||||
|
||||
if( nc->GetTrackWidth() < g.m_TrackMinWidth )
|
||||
if( nc->GetTrackWidth() < TO_LEGACY_LU( g.m_TrackMinWidth ) )
|
||||
{
|
||||
msg.Printf( _( "NETCLASS: '%s' has TrackWidth:%s which is less than global:%s" ),
|
||||
GetChars( nc->GetName() ),
|
||||
FmtVal( nc->GetTrackWidth() ),
|
||||
FmtVal( g.m_TrackMinWidth )
|
||||
FmtVal( TO_LEGACY_LU( g.m_TrackMinWidth ) )
|
||||
);
|
||||
|
||||
m_currentMarker = fillMarker( DRCE_NETCLASS_TRACKWIDTH, msg, m_currentMarker );
|
||||
|
@ -327,12 +336,12 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
|
|||
ret = false;
|
||||
}
|
||||
|
||||
if( nc->GetViaDiameter() < g.m_ViasMinSize )
|
||||
if( nc->GetViaDiameter() < TO_LEGACY_LU( g.m_ViasMinSize ) )
|
||||
{
|
||||
msg.Printf( _( "NETCLASS: '%s' has Via Dia:%s which is less than global:%s" ),
|
||||
GetChars( nc->GetName() ),
|
||||
FmtVal( nc->GetViaDiameter() ),
|
||||
FmtVal( g.m_ViasMinSize )
|
||||
FmtVal( TO_LEGACY_LU( g.m_ViasMinSize ) )
|
||||
);
|
||||
|
||||
m_currentMarker = fillMarker( DRCE_NETCLASS_VIASIZE, msg, m_currentMarker );
|
||||
|
@ -341,12 +350,12 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
|
|||
ret = false;
|
||||
}
|
||||
|
||||
if( nc->GetViaDrill() < g.m_ViasMinDrill )
|
||||
if( nc->GetViaDrill() < TO_LEGACY_LU( g.m_ViasMinDrill ) )
|
||||
{
|
||||
msg.Printf( _( "NETCLASS: '%s' has Via Drill:%s which is less than global:%s" ),
|
||||
GetChars( nc->GetName() ),
|
||||
FmtVal( nc->GetViaDrill() ),
|
||||
FmtVal( g.m_ViasMinDrill )
|
||||
FmtVal( TO_LEGACY_LU( g.m_ViasMinDrill ) )
|
||||
);
|
||||
|
||||
m_currentMarker = fillMarker( DRCE_NETCLASS_VIADRILLSIZE, msg, m_currentMarker );
|
||||
|
@ -355,12 +364,12 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
|
|||
ret = false;
|
||||
}
|
||||
|
||||
if( nc->GetuViaDiameter() < g.m_MicroViasMinSize )
|
||||
if( nc->GetuViaDiameter() < TO_LEGACY_LU( g.m_MicroViasMinSize ) )
|
||||
{
|
||||
msg.Printf( _( "NETCLASS: '%s' has uVia Dia:%s which is less than global:%s" ),
|
||||
GetChars( nc->GetName() ),
|
||||
FmtVal( nc->GetuViaDiameter() ),
|
||||
FmtVal( g.m_MicroViasMinSize )
|
||||
FmtVal( TO_LEGACY_LU( g.m_MicroViasMinSize ) )
|
||||
);
|
||||
|
||||
m_currentMarker = fillMarker( DRCE_NETCLASS_uVIASIZE, msg, m_currentMarker );
|
||||
|
@ -369,12 +378,12 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
|
|||
ret = false;
|
||||
}
|
||||
|
||||
if( nc->GetuViaDrill() < g.m_MicroViasMinDrill )
|
||||
if( nc->GetuViaDrill() < TO_LEGACY_LU( g.m_MicroViasMinDrill ) )
|
||||
{
|
||||
msg.Printf( _( "NETCLASS: '%s' has uVia Drill:%s which is less than global:%s" ),
|
||||
GetChars( nc->GetName() ),
|
||||
FmtVal( nc->GetuViaDrill() ),
|
||||
FmtVal( g.m_MicroViasMinDrill )
|
||||
FmtVal( TO_LEGACY_LU( g.m_MicroViasMinDrill ) )
|
||||
);
|
||||
|
||||
m_currentMarker = fillMarker( DRCE_NETCLASS_uVIADRILLSIZE, msg, m_currentMarker );
|
||||
|
|
|
@ -449,7 +449,8 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
|
|||
|
||||
if( stricmp( line, "TrackMinWidth" ) == 0 )
|
||||
{
|
||||
GetBoard()->GetBoardDesignSettings()->m_TrackMinWidth = atoi( data );
|
||||
double width = atof( data );
|
||||
GetBoard()->GetBoardDesignSettings()->m_TrackMinWidth = FROM_LEGACY_LU( width );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -478,7 +479,8 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
|
|||
|
||||
if( stricmp( line, "ViaMinSize" ) == 0 )
|
||||
{
|
||||
GetBoard()->GetBoardDesignSettings()->m_ViasMinSize = atoi( data );
|
||||
double diameter = atof( data );
|
||||
GetBoard()->GetBoardDesignSettings()->m_ViasMinSize = FROM_LEGACY_LU( diameter );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -489,7 +491,8 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
|
|||
|
||||
if( stricmp( line, "MicroViaMinSize" ) == 0 )
|
||||
{
|
||||
GetBoard()->GetBoardDesignSettings()->m_MicroViasMinSize = atoi( data );
|
||||
double diameter = atof( data );
|
||||
GetBoard()->GetBoardDesignSettings()->m_MicroViasMinSize = FROM_LEGACY_LU( diameter );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -519,7 +522,8 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
|
|||
|
||||
if( stricmp( line, "ViaMinDrill" ) == 0 )
|
||||
{
|
||||
GetBoard()->GetBoardDesignSettings()->m_ViasMinDrill = atoi( data );
|
||||
double diameter = atof( data );
|
||||
GetBoard()->GetBoardDesignSettings()->m_ViasMinDrill = FROM_LEGACY_LU( diameter );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -532,8 +536,8 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
|
|||
|
||||
if( stricmp( line, "MicroViaMinDrill" ) == 0 )
|
||||
{
|
||||
int diameter = atoi( data );
|
||||
GetBoard()->GetBoardDesignSettings()->m_MicroViasMinDrill = diameter;
|
||||
double diameter = atof( data );
|
||||
GetBoard()->GetBoardDesignSettings()->m_MicroViasMinDrill = FROM_LEGACY_LU( diameter );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -694,7 +698,9 @@ static int WriteSetup( FILE* aFile, PCB_EDIT_FRAME* aFrame, BOARD* aBoard )
|
|||
|
||||
fprintf( aFile, "TrackClearence %d\n", netclass_default->GetClearance() );
|
||||
fprintf( aFile, "ZoneClearence %d\n", g_Zone_Default_Setting.m_ZoneClearance );
|
||||
fprintf( aFile, "TrackMinWidth %d\n", aBoard->GetBoardDesignSettings()->m_TrackMinWidth );
|
||||
fprintf( aFile,
|
||||
"TrackMinWidth %f\n",
|
||||
TO_LEGACY_LU_DBL( aBoard->GetBoardDesignSettings()->m_TrackMinWidth ) );
|
||||
|
||||
fprintf( aFile, "DrawSegmWidth %d\n", aBoard->GetBoardDesignSettings()->m_DrawSegmentWidth );
|
||||
fprintf( aFile, "EdgeSegmWidth %d\n", aBoard->GetBoardDesignSettings()->m_EdgeSegmentWidth );
|
||||
|
@ -702,8 +708,12 @@ static int WriteSetup( FILE* aFile, PCB_EDIT_FRAME* aFrame, BOARD* aBoard )
|
|||
// Save current default via size, for compatibility with older Pcbnew version;
|
||||
fprintf( aFile, "ViaSize %d\n", netclass_default->GetViaDiameter() );
|
||||
fprintf( aFile, "ViaDrill %d\n", netclass_default->GetViaDrill() );
|
||||
fprintf( aFile, "ViaMinSize %d\n", aBoard->GetBoardDesignSettings()->m_ViasMinSize );
|
||||
fprintf( aFile, "ViaMinDrill %d\n", aBoard->GetBoardDesignSettings()->m_ViasMinDrill );
|
||||
fprintf( aFile,
|
||||
"ViaMinSize %f\n",
|
||||
TO_LEGACY_LU_DBL( aBoard->GetBoardDesignSettings()->m_ViasMinSize ) );
|
||||
fprintf( aFile,
|
||||
"ViaMinDrill %f\n",
|
||||
TO_LEGACY_LU_DBL( aBoard->GetBoardDesignSettings()->m_ViasMinDrill ) );
|
||||
|
||||
// Save custom vias diameters list (the first is not saved here: this is
|
||||
// the netclass value
|
||||
|
@ -719,11 +729,11 @@ static int WriteSetup( FILE* aFile, PCB_EDIT_FRAME* aFrame, BOARD* aBoard )
|
|||
"MicroViasAllowed %d\n",
|
||||
aBoard->GetBoardDesignSettings()->m_MicroViasAllowed );
|
||||
fprintf( aFile,
|
||||
"MicroViaMinSize %d\n",
|
||||
aBoard->GetBoardDesignSettings()->m_MicroViasMinSize );
|
||||
"MicroViaMinSize %f\n",
|
||||
TO_LEGACY_LU_DBL( aBoard->GetBoardDesignSettings()->m_MicroViasMinSize ) );
|
||||
fprintf( aFile,
|
||||
"MicroViaMinDrill %d\n",
|
||||
aBoard->GetBoardDesignSettings()->m_MicroViasMinDrill );
|
||||
"MicroViaMinDrill %f\n",
|
||||
TO_LEGACY_LU_DBL( aBoard->GetBoardDesignSettings()->m_MicroViasMinDrill ) );
|
||||
|
||||
fprintf( aFile, "TextPcbWidth %d\n", aBoard->GetBoardDesignSettings()->m_PcbTextWidth );
|
||||
fprintf( aFile,
|
||||
|
|
Loading…
Reference in New Issue