REMOVE: USE_PCBNEW_NANOMETERS by making it the only way to go in pcbnew, effectively removing the deci-mils build.
This commit is contained in:
parent
4c6f7bc158
commit
3f8343b341
|
@ -14,9 +14,6 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
|
|||
# reports.
|
||||
#
|
||||
|
||||
option(USE_PCBNEW_NANOMETRES
|
||||
"Use nanometers for Pcbnew internal units instead of deci-mils (default ON)." ON)
|
||||
|
||||
# Russian GOST patch
|
||||
option(wxUSE_UNICODE "enable/disable building unicode (default OFF)")
|
||||
option(KICAD_GOST "enable/disable building using GOST notation for multiple gates per package (default OFF)")
|
||||
|
|
|
@ -75,15 +75,8 @@
|
|||
|
||||
#cmakedefine USE_IMAGES_IN_MENUS 1
|
||||
|
||||
/// Definitions to enable the s-expression file formats and nanometer units.
|
||||
#cmakedefine USE_PCBNEW_NANOMETRES
|
||||
|
||||
/// The legacy file format revision of the *.brd file created by this build
|
||||
#if defined(USE_PCBNEW_NANOMETRES)
|
||||
#define LEGACY_BOARD_FILE_VERSION 2
|
||||
#else
|
||||
#define LEGACY_BOARD_FILE_VERSION 1
|
||||
#endif
|
||||
|
||||
/// Definition to compile with Pcbnew footprint library table implementation.
|
||||
#cmakedefine USE_FP_LIB_TABLE
|
||||
|
|
|
@ -111,10 +111,6 @@ This option is used to enable or disable building KiCad with images in menu
|
|||
items. If this is not defined when CMake is used to create the build files,
|
||||
images will be included in menu items on all platforms except OSX.
|
||||
|
||||
USE_PCBNEW_NANOMETRES (ON/OFF)
|
||||
This option is used to enable or disable the nano-meter internal units for
|
||||
Pcbnew. The default is ON.
|
||||
|
||||
KICAD_GOST (ON/OFF)
|
||||
-------------------
|
||||
This option is used to enable or disable the GOST notation for multiple gates
|
||||
|
|
|
@ -25,10 +25,10 @@ Contribute to KiCad (under Linux)
|
|||
6) Compile:
|
||||
cd kicad_john
|
||||
mkdir build; cd build
|
||||
cmake ../ -DKICAD_TESTING_VERSION=ON -DCMAKE_BUILD_TYPE=Debug
|
||||
cmake ../ -DCMAKE_BUILD_TYPE=Debug
|
||||
to build a debug version
|
||||
or
|
||||
cmake ../ -DKICAD_TESTING_VERSION=ON -DCMAKE_BUILD_TYPE=Release
|
||||
cmake ../ -DCMAKE_BUILD_TYPE=Release
|
||||
to build a release version
|
||||
make
|
||||
|
||||
|
|
|
@ -502,13 +502,6 @@ void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent& event )
|
|||
tmp << wxT( "Boost version: " ) << ( BOOST_VERSION / 100000 ) << wxT( "." )
|
||||
<< ( BOOST_VERSION / 100 % 1000 ) << wxT( "." ) << ( BOOST_VERSION % 100 ) << wxT( "\n" );
|
||||
|
||||
tmp << wxT( "Options: USE_PCBNEW_NANOMETRES=" );
|
||||
#ifdef USE_PCBNEW_NANOMETRES
|
||||
tmp << wxT( "ON\n" );
|
||||
#else
|
||||
tmp << wxT( "OFF\n" );
|
||||
#endif
|
||||
|
||||
tmp << wxT( " USE_WX_GRAPHICS_CONTEXT=" );
|
||||
#ifdef USE_WX_GRAPHICS_CONTEXT
|
||||
tmp << wxT( "ON\n" );
|
||||
|
|
|
@ -755,7 +755,6 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
|
|||
DBOX clientRectIU( xIU, yIU, clientSizeIU.x, clientSizeIU.y );
|
||||
wxPoint centerPositionIU;
|
||||
|
||||
#if 1 || defined( USE_PCBNEW_NANOMETRES )
|
||||
// put "int" limits on the clientRect
|
||||
if( clientRectIU.GetLeft() < VIRT_MIN )
|
||||
clientRectIU.MoveLeftTo( VIRT_MIN );
|
||||
|
@ -765,7 +764,6 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
|
|||
clientRectIU.MoveRightTo( VIRT_MAX );
|
||||
if( clientRectIU.GetBottom() > VIRT_MAX )
|
||||
clientRectIU.MoveBottomTo( VIRT_MAX );
|
||||
#endif
|
||||
|
||||
centerPositionIU.x = KiROUND( clientRectIU.x + clientRectIU.width/2 );
|
||||
centerPositionIU.y = KiROUND( clientRectIU.y + clientRectIU.height/2 );
|
||||
|
@ -838,11 +836,9 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
|
|||
}
|
||||
}
|
||||
|
||||
#if 1 || defined( USE_PCBNEW_NANOMETRES )
|
||||
// put "int" limits on the virtualSizeIU
|
||||
virtualSizeIU.x = std::min( virtualSizeIU.x, MAX_AXIS );
|
||||
virtualSizeIU.y = std::min( virtualSizeIU.y, MAX_AXIS );
|
||||
#endif
|
||||
|
||||
if( screen->m_Center )
|
||||
{
|
||||
|
|
|
@ -31,11 +31,10 @@
|
|||
#ifndef _CONVERT_FROM_IU_
|
||||
#define _CONVERT_FROM_IU_
|
||||
|
||||
#include <config.h> // USE_PCBNEW_NANOMETRES is defined here
|
||||
#include <config.h>
|
||||
|
||||
/// Convert from internal units to user units.
|
||||
#if defined(PCBNEW) || defined(CVPCB) || defined(GERBVIEW)
|
||||
#if defined( USE_PCBNEW_NANOMETRES )
|
||||
#if defined(GERBVIEW)
|
||||
#define MM_PER_IU 1.0 / 1e5 // Gerbview uses 10 micrometer.
|
||||
#else
|
||||
|
@ -43,32 +42,19 @@
|
|||
#endif
|
||||
#define MILS_PER_IU ( MM_PER_IU * 0.0254 )
|
||||
#define DECIMILS_PER_IU (MM_PER_IU * 0.00254 )
|
||||
#else // Pcbnew in deci-mils.
|
||||
#define DECIMILS_PER_IU 1
|
||||
#define MILS_PER_IU 0.1
|
||||
#define MM_PER_IU (25.4 / 1e4)
|
||||
#endif
|
||||
|
||||
/// Convert PCBNEW internal units (iu) to mils.
|
||||
inline int Iu2Mils( int iu )
|
||||
{
|
||||
#if defined( USE_PCBNEW_NANOMETRES )
|
||||
double x = iu * MILS_PER_IU;
|
||||
return int( x < 0 ? x - 0.5 : x + 0.5 );
|
||||
#else
|
||||
return iu * MILS_PER_IU;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Convert PCBNEW internal units (iu) to deci-mils.
|
||||
inline int Iu2DMils( int iu )
|
||||
{
|
||||
#if defined( USE_PCBNEW_NANOMETRES )
|
||||
double x = iu * DECIMILS_PER_IU;
|
||||
return int( x < 0 ? x - 0.5 : x + 0.5 );
|
||||
#else
|
||||
return iu;
|
||||
#endif
|
||||
}
|
||||
|
||||
#else // Eeschema and anything else.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CONVERT_TO_BIU_H_
|
||||
#define CONVERT_TO_BIU_H_
|
||||
|
||||
#include <config.h> // USE_PCBNEW_NANOMETRES is defined here
|
||||
#include <config.h>
|
||||
|
||||
/**
|
||||
* @file convert_to_biu.h
|
||||
|
@ -18,7 +18,6 @@
|
|||
|
||||
/// Scaling factor to convert mils to internal units.
|
||||
#if defined(PCBNEW) || defined(CVPCB) || defined(GERBVIEW)
|
||||
#if defined( USE_PCBNEW_NANOMETRES )
|
||||
#if defined(GERBVIEW)
|
||||
#define IU_PER_MM 1e5 // Gerbview IU is 10 nanometers.
|
||||
#else
|
||||
|
@ -27,32 +26,18 @@
|
|||
#define IU_PER_MILS (IU_PER_MM * 0.0254)
|
||||
#define IU_PER_DECIMILS (IU_PER_MM * 0.00254)
|
||||
|
||||
#else // Pcbnew compiled for deci-mils.
|
||||
#define IU_PER_DECIMILS 1
|
||||
#define IU_PER_MILS 10.0
|
||||
#define IU_PER_MM (1e4 / 25.4)
|
||||
#endif
|
||||
|
||||
/// Convert mils to PCBNEW internal units (iu).
|
||||
inline int Mils2iu( int mils )
|
||||
{
|
||||
#if defined( USE_PCBNEW_NANOMETRES )
|
||||
double x = mils * IU_PER_MILS;
|
||||
return int( x < 0 ? x - 0.5 : x + 0.5 );
|
||||
#else
|
||||
return mils * IU_PER_MILS;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Convert deci-mils to PCBNEW internal units (iu).
|
||||
inline int DMils2iu( int dmils )
|
||||
{
|
||||
#if defined( USE_PCBNEW_NANOMETRES )
|
||||
double x = dmils * IU_PER_DECIMILS;
|
||||
return int( x < 0 ? x - 0.5 : x + 0.5 );
|
||||
#else
|
||||
return dmils;
|
||||
#endif
|
||||
}
|
||||
|
||||
#elif defined (PL_EDITOR)
|
||||
|
|
|
@ -270,10 +270,6 @@ if (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
|
|||
set( SWIG_FLAGS ${SWIG_FLAGS} -D${d} )
|
||||
endforeach()
|
||||
|
||||
if( USE_PCBNEW_NANOMETRES )
|
||||
set( SWIG_FLAGS ${SWIG_FLAGS} -DUSE_PCBNEW_NANOMETRES )
|
||||
endif( USE_PCBNEW_NANOMETRES )
|
||||
|
||||
endif(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
|
||||
|
||||
|
||||
|
|
|
@ -618,7 +618,6 @@ void PCB_BASE_FRAME::UpdateStatusBar()
|
|||
|
||||
switch( g_UserUnit )
|
||||
{
|
||||
#if defined( USE_PCBNEW_NANOMETRES )
|
||||
case INCHES:
|
||||
absformatter = wxT( "X %.6f Y %.6f" );
|
||||
locformatter = wxT( "dx %.6f dy %.6f d %.6f" );
|
||||
|
@ -628,19 +627,6 @@ void PCB_BASE_FRAME::UpdateStatusBar()
|
|||
absformatter = wxT( "X %.6f Y %.6f" );
|
||||
locformatter = wxT( "dx %.6f dy %.6f d %.6f" );
|
||||
break;
|
||||
#else
|
||||
case INCHES:
|
||||
absformatter = wxT( "X %.4f Y %.4f" );
|
||||
locformatter = wxT( "dx %.4f dy %.4f d %.4f" );
|
||||
break;
|
||||
|
||||
case MILLIMETRES:
|
||||
dXpos = RoundTo0( dXpos, 1000.0 );
|
||||
dYpos = RoundTo0( dYpos, 1000.0 );
|
||||
absformatter = wxT( "X %.3f Y %.3f" );
|
||||
locformatter = wxT( "dx %.3f dy %.3f d %.3f" );
|
||||
break;
|
||||
#endif
|
||||
|
||||
case UNSCALED_UNITS:
|
||||
absformatter = wxT( "X %f Y %f" );
|
||||
|
@ -659,14 +645,6 @@ void PCB_BASE_FRAME::UpdateStatusBar()
|
|||
dXpos = To_User_Unit( g_UserUnit, dx );
|
||||
dYpos = To_User_Unit( g_UserUnit, dy );
|
||||
|
||||
#ifndef USE_PCBNEW_NANOMETRES
|
||||
if ( g_UserUnit == MILLIMETRES )
|
||||
{
|
||||
dXpos = RoundTo0( dXpos, 1000.0 );
|
||||
dYpos = RoundTo0( dYpos, 1000.0 );
|
||||
}
|
||||
#endif
|
||||
|
||||
// We already decided the formatter above
|
||||
line.Printf( locformatter, dXpos, dYpos, hypot( dXpos, dYpos ) );
|
||||
SetStatusText( line, 3 );
|
||||
|
|
|
@ -88,7 +88,7 @@ wxString BOARD_ITEM::GetLayerName() const
|
|||
|
||||
std::string BOARD_ITEM::FormatInternalUnits( int aValue )
|
||||
{
|
||||
#if 1 // !defined( USE_PCBNEW_NANOMETRES )
|
||||
#if 1
|
||||
|
||||
char buf[50];
|
||||
int len;
|
||||
|
|
|
@ -64,12 +64,9 @@
|
|||
*/
|
||||
static const double pcbZoomList[] =
|
||||
{
|
||||
#if defined( USE_PCBNEW_NANOMETRES )
|
||||
ZOOM_FACTOR( 0.1 ),
|
||||
ZOOM_FACTOR( 0.2 ),
|
||||
ZOOM_FACTOR( 0.3 ),
|
||||
#endif
|
||||
|
||||
ZOOM_FACTOR( 0.5 ),
|
||||
ZOOM_FACTOR( 1.0 ),
|
||||
ZOOM_FACTOR( 1.5 ),
|
||||
|
@ -129,13 +126,6 @@ static const double pcbZoomList[] =
|
|||
The largest ZOOM_FACTOR in above table is ZOOM_FACTOR( 300 ), which computes
|
||||
out to 762000 just below 790885.
|
||||
*/
|
||||
|
||||
|
||||
#if !defined( USE_PCBNEW_NANOMETRES )
|
||||
ZOOM_FACTOR( 500.0 ),
|
||||
ZOOM_FACTOR( 1000.0 ),
|
||||
ZOOM_FACTOR( 2000.0 )
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -411,11 +411,7 @@ void LEGACY_PLUGIN::loadGENERAL()
|
|||
|
||||
if( !strcmp( data, "mm" ) )
|
||||
{
|
||||
#if defined( USE_PCBNEW_NANOMETRES )
|
||||
diskToBiu = IU_PER_MM;
|
||||
#else
|
||||
THROW_IO_ERROR( _( "May not load millimeter *.brd file into 'Pcbnew compiled for deci-mils'" ) );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2822,11 +2818,7 @@ void LEGACY_PLUGIN::init( PROPERTIES* aProperties )
|
|||
m_props = aProperties;
|
||||
|
||||
// conversion factor for saving RAM BIUs to KICAD legacy file format.
|
||||
#if defined( USE_PCBNEW_NANOMETRES )
|
||||
biuToDisk = 1.0/IU_PER_MM; // BIUs are nanometers & file is mm
|
||||
#else
|
||||
biuToDisk = 1.0; // BIUs are deci-mils
|
||||
#endif
|
||||
|
||||
// Conversion factor for loading KICAD legacy file format into BIUs in RAM
|
||||
// Start by assuming the *.brd file is in deci-mils.
|
||||
|
@ -2835,8 +2827,7 @@ void LEGACY_PLUGIN::init( PROPERTIES* aProperties )
|
|||
// mm to nanometers. The deci-mil legacy files have no such "Units" marker
|
||||
// so we must assume the file is in deci-mils until told otherwise.
|
||||
|
||||
diskToBiu = IU_PER_DECIMILS; // BIUs are nanometers if defined(USE_PCBNEW_NANOMETRES)
|
||||
// else are deci-mils
|
||||
diskToBiu = IU_PER_DECIMILS; // BIUs are nanometers
|
||||
}
|
||||
|
||||
|
||||
|
@ -2918,11 +2909,7 @@ void LEGACY_PLUGIN::saveGENERAL( const BOARD* aBoard ) const
|
|||
fprintf( m_fp, "encoding utf-8\n" );
|
||||
|
||||
// tell folks the units used within the file, as early as possible here.
|
||||
#if defined( USE_PCBNEW_NANOMETRES )
|
||||
fprintf( m_fp, "Units mm\n" );
|
||||
#else
|
||||
fprintf( m_fp, "Units deci-mils\n" );
|
||||
#endif
|
||||
|
||||
// Write copper layer count
|
||||
fprintf( m_fp, "LayerCount %d\n", aBoard->GetCopperLayerCount() );
|
||||
|
@ -3991,11 +3978,7 @@ void FPL_CACHE::ReadAndVerifyHeader( LINE_READER* aReader )
|
|||
|
||||
if( !strcmp( units, "mm" ) )
|
||||
{
|
||||
#if defined( USE_PCBNEW_NANOMETRES )
|
||||
m_owner->diskToBiu = IU_PER_MM;
|
||||
#else
|
||||
THROW_IO_ERROR( _( "May not load millimeter legacy library file into 'Pcbnew compiled for deci-mils'" ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4191,11 +4174,7 @@ void FPL_CACHE::SaveHeader( FILE* aFile )
|
|||
{
|
||||
fprintf( aFile, "%s %s\n", FOOTPRINT_LIBRARY_HEADER, TO_UTF8( DateAndTime() ) );
|
||||
fprintf( aFile, "# encoding utf-8\n" );
|
||||
#if defined( USE_PCBNEW_NANOMETRES )
|
||||
fprintf( aFile, "Units mm\n" );
|
||||
#else
|
||||
fprintf( aFile, "Units deci-mils\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -201,18 +201,12 @@ const KICAD_T SPECCTRA_DB::scanPADs[] = { PCB_PAD_T, EOT };
|
|||
*/
|
||||
static inline double scale( int kicadDist )
|
||||
{
|
||||
#if defined(USE_PCBNEW_NANOMETRES)
|
||||
|
||||
// nanometers to um
|
||||
return kicadDist / ( IU_PER_MM / 1000.0 );
|
||||
|
||||
// nanometers to mils
|
||||
// return kicadDist/IU_PER_MILS;
|
||||
|
||||
#else
|
||||
// deci-mils to mils.
|
||||
return kicadDist / 10.0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -1356,7 +1350,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
|
|||
|
||||
//-----<unit_descriptor> & <resolution_descriptor>--------------------
|
||||
{
|
||||
#if defined(USE_PCBNEW_NANOMETRES)
|
||||
|
||||
// tell freerouter to use "tenths of micrometers",
|
||||
// which is 100 nm resolution. Possibly more resolution is possible
|
||||
// in freerouter, but it would need testing.
|
||||
|
@ -1365,18 +1359,6 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
|
|||
pcb->resolution->units = T_um;
|
||||
pcb->resolution->value = 10; // tenths of a um
|
||||
// pcb->resolution->value = 1000; // "thousandths of a um" (i.e. "nm")
|
||||
|
||||
#else
|
||||
pcb->unit->units = T_mil;
|
||||
pcb->resolution->units = T_mil;
|
||||
|
||||
// Kicad only supports 1/10th of mil internal coordinates. So to avoid
|
||||
// having the router give us back 1/100th of mil coordinates which we
|
||||
// will have to round and thereby cause error, we declare our maximum
|
||||
// resolution precisely at 1/10th for now. For more on this, see:
|
||||
// http://www.freerouting.net/usren/viewtopic.php?f=3&t=354
|
||||
pcb->resolution->value = 10;
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----<boundary_descriptor>------------------------------------------
|
||||
|
|
|
@ -147,8 +147,6 @@ static int scale( double distance, UNIT_RES* aResolution )
|
|||
double resValue = aResolution->GetValue();
|
||||
double factor;
|
||||
|
||||
#if defined(USE_PCBNEW_NANOMETRES)
|
||||
|
||||
switch( aResolution->GetEngUnits() )
|
||||
{
|
||||
default:
|
||||
|
@ -171,36 +169,6 @@ static int scale( double distance, UNIT_RES* aResolution )
|
|||
|
||||
int ret = KiROUND( factor * distance / resValue );
|
||||
|
||||
#else
|
||||
|
||||
switch( aResolution->GetEngUnits() )
|
||||
{
|
||||
default:
|
||||
case T_inch:
|
||||
factor = 1000.0;
|
||||
break;
|
||||
case T_mil:
|
||||
factor = 1.0;
|
||||
break;
|
||||
case T_cm:
|
||||
factor = 1000.0/2.54;
|
||||
break;
|
||||
case T_mm:
|
||||
factor = 1000.0/25.4;
|
||||
break;
|
||||
case T_um:
|
||||
factor = 1.0/25.4;
|
||||
break;
|
||||
}
|
||||
|
||||
// the factor of 10.0 is used to convert mils to deci-mils, the units
|
||||
// used within KiCad.
|
||||
factor *= 10.0;
|
||||
|
||||
int ret = KiROUND( factor * distance / resValue );
|
||||
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue