Excise the remaining unused ifdef EESCHEMA

Common units are now shared between programs, so we need a different way
other than compile definitions to choose how many digits to display.
This commit is contained in:
Seth Hillbrand 2024-04-18 17:34:53 -07:00
parent 00538548f5
commit d8b6e28890
3 changed files with 9 additions and 73 deletions

View File

@ -302,6 +302,7 @@ wxString EDA_UNIT_UTILS::UI::StringFromValue( const EDA_IU_SCALE& aIuScale, EDA_
EDA_DATA_TYPE aType )
{
double value_to_print = aValue;
bool is_eeschema = ( aIuScale.IU_PER_MM == SCH_IU_PER_MM );
switch( aType )
{
@ -327,19 +328,11 @@ wxString EDA_UNIT_UTILS::UI::StringFromValue( const EDA_IU_SCALE& aIuScale, EDA_
{
case EDA_UNITS::MILS:
#if defined( EESCHEMA )
format = wxT( "%.3f" );
#else
format = wxT( "%.5f" );
#endif
format = is_eeschema ? wxT( "%.3f" ) : wxT( "%.5f" );
break;
case EDA_UNITS::INCHES:
#if defined( EESCHEMA )
format = wxT( "%.6f" );
#else
format = wxT( "%.8f" );
#endif
format = is_eeschema ? wxT( "%.6f" ) : wxT( "%.8f" );
break;
default:
@ -415,6 +408,7 @@ wxString EDA_UNIT_UTILS::UI::MessageTextFromValue( const EDA_IU_SCALE& aIuScale,
wxString text;
const wxChar* format;
double value = aValue;
bool is_eeschema = ( aIuScale.IU_PER_MM == SCH_IU_PER_MM );
switch( aType )
{
@ -440,43 +434,23 @@ wxString EDA_UNIT_UTILS::UI::MessageTextFromValue( const EDA_IU_SCALE& aIuScale,
{
default:
case EDA_UNITS::MICROMETRES:
#if defined( EESCHEMA )
format = wxT( "%.0f" );
#else
format = wxT( "%.1f" );
#endif
format = is_eeschema ? wxT( "%.0f" ) : wxT( "%.1f" );
break;
case EDA_UNITS::MILLIMETRES:
#if defined( EESCHEMA )
format = wxT( "%.2f" );
#else
format = wxT( "%.4f" );
#endif
format = is_eeschema ? wxT( "%.2f" ) : wxT( "%.4f" );
break;
case EDA_UNITS::CENTIMETRES:
#if defined( EESCHEMA )
format = wxT( "%.3f" );
#else
format = wxT( "%.5f" );
#endif
format = is_eeschema ? wxT( "%.3f" ) : wxT( "%.5f" );
break;
case EDA_UNITS::MILS:
#if defined( EESCHEMA )
format = wxT( "%.0f" );
#else
format = wxT( "%.2f" );
#endif
format = is_eeschema ? wxT( "%.0f" ) : wxT( "%.2f" );
break;
case EDA_UNITS::INCHES:
#if defined( EESCHEMA )
format = wxT( "%.3f" );
#else
format = wxT( "%.4f" );
#endif
format = is_eeschema ? wxT( "%.3f" ) : wxT( "%.4f" );
break;
case EDA_UNITS::DEGREES:

View File

@ -4,8 +4,6 @@ if( COMPILER_SUPPORTS_WARNINGS )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARN_FLAGS_C}")
endif()
add_compile_definitions( EESCHEMA )
if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
if( MSYS )
# For some reason the big file sim/ngspice_models.cpp creates an issue when

View File

@ -536,40 +536,4 @@ constexpr bool IsTypeCorrect( KICAD_T aType )
|| IsMiscType( aType );
}
constexpr bool IsTypeAvailable( KICAD_T aType )
{
if( !IsInstantiableType( aType ) )
return false;
if( IsEeschemaType( aType ) )
{
#ifdef EESCHEMA
return true;
#endif // EESCHEMA
}
if( IsPcbnewType( aType ) )
{
#ifdef PCBNEW
return true;
#endif // PCBNEW
}
if( IsGerbviewType( aType ) )
{
#ifdef GERBVIEW
return true;
#endif // GERBVIEW
}
if( IsPageLayoutEditorType( aType ) )
{
#ifdef PL_EDITOR
return true;
#endif // PL_EDITOR
}
return false;
}
#endif // __KICAD_TYPEINFO_H