Give up on enforcing non-defined-internal-units.
It results in trade-offs in packaging and/or conidtional compilation which are worse than the disease.
This commit is contained in:
parent
47ab7c78a6
commit
fc44506fe1
|
@ -10,8 +10,8 @@ include_directories( BEFORE ${INC_BEFORE} )
|
||||||
include_directories( ${INC_AFTER} )
|
include_directories( ${INC_AFTER} )
|
||||||
|
|
||||||
set( BITMAP2COMPONENT_SRCS
|
set( BITMAP2COMPONENT_SRCS
|
||||||
|
${CMAKE_SOURCE_DIR}/common/base_units.cpp
|
||||||
${CMAKE_SOURCE_DIR}/common/single_top.cpp
|
${CMAKE_SOURCE_DIR}/common/single_top.cpp
|
||||||
|
|
||||||
bitmap2cmp_main.cpp
|
bitmap2cmp_main.cpp
|
||||||
bitmap2cmp_settings.cpp
|
bitmap2cmp_settings.cpp
|
||||||
bitmap2component.cpp
|
bitmap2component.cpp
|
||||||
|
|
|
@ -41,16 +41,12 @@
|
||||||
#include <title_block.h>
|
#include <title_block.h>
|
||||||
|
|
||||||
|
|
||||||
#if defined( PCBNEW ) || defined( CVPCB ) || defined( EESCHEMA ) || defined( GERBVIEW ) || defined( PL_EDITOR )
|
|
||||||
#define IU_TO_MM( x ) ( x / IU_PER_MM )
|
#define IU_TO_MM( x ) ( x / IU_PER_MM )
|
||||||
#define IU_TO_IN( x ) ( x / IU_PER_MILS / 1000 )
|
#define IU_TO_IN( x ) ( x / IU_PER_MILS / 1000 )
|
||||||
#define IU_TO_MILS( x ) ( x / IU_PER_MILS )
|
#define IU_TO_MILS( x ) ( x / IU_PER_MILS )
|
||||||
#define MM_TO_IU( x ) ( x * IU_PER_MM )
|
#define MM_TO_IU( x ) ( x * IU_PER_MM )
|
||||||
#define IN_TO_IU( x ) ( x * IU_PER_MILS * 1000 )
|
#define IN_TO_IU( x ) ( x * IU_PER_MILS * 1000 )
|
||||||
#define MILS_TO_IU( x ) ( x * IU_PER_MILS )
|
#define MILS_TO_IU( x ) ( x * IU_PER_MILS )
|
||||||
#else
|
|
||||||
#error "Cannot resolve internal units due to no definition of EESCHEMA, CVPCB or PCBNEW."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// Helper function to print a float number without using scientific notation
|
// Helper function to print a float number without using scientific notation
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <settings/app_settings.h>
|
#include <settings/app_settings.h>
|
||||||
#include <settings/common_settings.h>
|
#include <settings/common_settings.h>
|
||||||
#include <settings/parameters.h>
|
#include <settings/parameters.h>
|
||||||
|
#include <base_units.h>
|
||||||
|
|
||||||
///! Update the schema version whenever a migration is required
|
///! Update the schema version whenever a migration is required
|
||||||
const int appSettingsSchemaVersion = 0;
|
const int appSettingsSchemaVersion = 0;
|
||||||
|
@ -211,7 +212,6 @@ bool APP_SETTINGS_BASE::migrateWindowConfig( wxConfigBase* aCfg, const std::stri
|
||||||
ret &= fromLegacy<int>( aCfg,
|
ret &= fromLegacy<int>( aCfg,
|
||||||
aFrame + "_LastGridSize", aJsonPath + ".grid.last_size" );
|
aFrame + "_LastGridSize", aJsonPath + ".grid.last_size" );
|
||||||
|
|
||||||
#if defined( PCBNEW )
|
|
||||||
double x, y;
|
double x, y;
|
||||||
|
|
||||||
if( aCfg->Read( aFrame + "PcbUserGrid_X", &x ) && aCfg->Read( aFrame + "PcbUserGrid_Y", &y ) )
|
if( aCfg->Read( aFrame + "PcbUserGrid_X", &x ) && aCfg->Read( aFrame + "PcbUserGrid_Y", &y ) )
|
||||||
|
@ -221,7 +221,6 @@ bool APP_SETTINGS_BASE::migrateWindowConfig( wxConfigBase* aCfg, const std::stri
|
||||||
( *this )[PointerFromString( ".grid.user_grid_x" )] = StringFromValue( u, x, true, true );
|
( *this )[PointerFromString( ".grid.user_grid_x" )] = StringFromValue( u, x, true, true );
|
||||||
( *this )[PointerFromString( ".grid.user_grid_y" )] = StringFromValue( u, y, true, true );
|
( *this )[PointerFromString( ".grid.user_grid_y" )] = StringFromValue( u, y, true, true );
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
ret &= fromLegacy<bool>( aCfg,
|
ret &= fromLegacy<bool>( aCfg,
|
||||||
aFrame + gd + "GridAxesEnabled", aJsonPath + ".grid.axes_enabled" );
|
aFrame + gd + "GridAxesEnabled", aJsonPath + ".grid.axes_enabled" );
|
||||||
|
|
|
@ -86,12 +86,13 @@ constexpr inline int Iu2Mils( int iu )
|
||||||
return static_cast< int >( mils < 0 ? mils - 0.5 : mils + 0.5 );
|
return static_cast< int >( mils < 0 ? mils - 0.5 : mils + 0.5 );
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// Here, we do not know the value of internal units: do not define
|
// Here, we do not know the value of internal units: just use something safe to allow
|
||||||
// conversion functions (They do not have meaning)
|
// easier packaging of compilation units
|
||||||
#define UNKNOWN_IU
|
constexpr double IU_PER_MM = 1;
|
||||||
|
constexpr double IU_PER_MILS = IU_PER_MM * 0.0254;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef UNKNOWN_IU
|
|
||||||
// Other definitions used in a few files
|
// Other definitions used in a few files
|
||||||
constexpr double MM_PER_IU = ( 1 / IU_PER_MM );
|
constexpr double MM_PER_IU = ( 1 / IU_PER_MM );
|
||||||
|
|
||||||
|
@ -121,6 +122,4 @@ constexpr inline double Iu2Millimeter( int iu )
|
||||||
constexpr int ARC_LOW_DEF = Millimeter2iu( 0.02 );
|
constexpr int ARC_LOW_DEF = Millimeter2iu( 0.02 );
|
||||||
constexpr int ARC_HIGH_DEF = Millimeter2iu( 0.005 );
|
constexpr int ARC_HIGH_DEF = Millimeter2iu( 0.005 );
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // CONVERT_TO_BIU_H_
|
#endif // CONVERT_TO_BIU_H_
|
||||||
|
|
|
@ -15,6 +15,7 @@ include_directories(
|
||||||
|
|
||||||
|
|
||||||
set( KICAD_SRCS
|
set( KICAD_SRCS
|
||||||
|
${CMAKE_SOURCE_DIR}/common/base_units.cpp
|
||||||
dialogs/dialog_template_selector_base.cpp
|
dialogs/dialog_template_selector_base.cpp
|
||||||
dialogs/dialog_template_selector.cpp
|
dialogs/dialog_template_selector.cpp
|
||||||
files-io.cpp
|
files-io.cpp
|
||||||
|
|
|
@ -10,6 +10,7 @@ include_directories(
|
||||||
)
|
)
|
||||||
|
|
||||||
set( PCB_CALCULATOR_SRCS
|
set( PCB_CALCULATOR_SRCS
|
||||||
|
${CMAKE_SOURCE_DIR}/common/base_units.cpp
|
||||||
attenuators.cpp
|
attenuators.cpp
|
||||||
board_classes_values.cpp
|
board_classes_values.cpp
|
||||||
colorcode.cpp
|
colorcode.cpp
|
||||||
|
|
Loading…
Reference in New Issue