7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 23:13:43 +00:00

Fix a collision with a Windows define and our use of the same var name.

We use IN for INCH as units, but IN is defined in a Windows header
This commit is contained in:
jean-pierre charras 2025-03-02 11:34:30 +01:00
parent 307798ac92
commit eaa1e6d594
65 changed files with 117 additions and 117 deletions
3d-viewer/dialogs
bitmap2component
common
cvpcb
eeschema
gerbview
include
kicad/cli
pagelayout_editor
pcbnew

View File

@ -286,7 +286,7 @@ wxString PANEL_PREVIEW_3D_MODEL::formatRotationValue( double aValue )
wxString PANEL_PREVIEW_3D_MODEL::formatOffsetValue( double aValue )
{
// Convert from internal units (mm) to user units
if( m_userUnits == EDA_UNITS::IN )
if( m_userUnits == EDA_UNITS::INCH )
aValue /= 25.4;
else if( m_userUnits == EDA_UNITS::MILS )
aValue /= 25.4 / 1e3;
@ -511,7 +511,7 @@ void PANEL_PREVIEW_3D_MODEL::doIncrementOffset( wxSpinEvent& event, double aSign
if( wxGetMouseState().ShiftDown( ) )
step_mm = OFFSET_INCREMENT_MM_FINE;
if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::IN )
if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::INCH )
{
step_mm = 25.4*OFFSET_INCREMENT_MIL/1000;
@ -586,7 +586,7 @@ void PANEL_PREVIEW_3D_MODEL::onMouseWheelOffset( wxMouseEvent& event )
if( event.ShiftDown( ) )
step_mm = OFFSET_INCREMENT_MM_FINE;
if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::IN )
if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::INCH )
{
step_mm = 25.4*OFFSET_INCREMENT_MIL/1000.0;

View File

@ -63,7 +63,7 @@ void IMAGE_SIZE::SetOutputSizeFromInitialImageSize()
// Set the m_outputSize value from the m_originalSizePixels and the selected unit
if( m_unit == EDA_UNITS::MM )
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI * 25.4;
else if( m_unit == EDA_UNITS::IN )
else if( m_unit == EDA_UNITS::INCH )
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI;
else
m_outputSize = m_originalDPI;
@ -76,7 +76,7 @@ int IMAGE_SIZE::GetOutputDPI()
if( m_unit == EDA_UNITS::MM )
outputDPI = GetOriginalSizePixels() / ( m_outputSize / 25.4 );
else if( m_unit == EDA_UNITS::IN )
else if( m_unit == EDA_UNITS::INCH )
outputDPI = GetOriginalSizePixels() / m_outputSize;
else
outputDPI = KiROUND( m_outputSize );
@ -102,7 +102,7 @@ void IMAGE_SIZE::SetUnit( EDA_UNITS aUnit )
{
size_mm = m_outputSize;
}
else if( m_unit == EDA_UNITS::IN )
else if( m_unit == EDA_UNITS::INCH )
{
size_mm = m_outputSize * 25.4;
}
@ -121,7 +121,7 @@ void IMAGE_SIZE::SetUnit( EDA_UNITS aUnit )
{
m_outputSize = size_mm;
}
else if( aUnit == EDA_UNITS::IN )
else if( aUnit == EDA_UNITS::INCH )
{
m_outputSize = size_mm / 25.4;
}

View File

@ -268,7 +268,7 @@ wxString BITMAP2CMP_PANEL::formatOutputSize( double aSize )
if( getUnitFromSelection() == EDA_UNITS::MM )
text.Printf( wxS( "%.1f" ), aSize );
else if( getUnitFromSelection() == EDA_UNITS::IN )
else if( getUnitFromSelection() == EDA_UNITS::INCH )
text.Printf( wxS( "%.2f" ), aSize );
else
text.Printf( wxT( "%d" ), KiROUND( aSize ) );
@ -295,7 +295,7 @@ EDA_UNITS BITMAP2CMP_PANEL::getUnitFromSelection()
// return the EDA_UNITS from the m_PixelUnit choice
switch( m_PixelUnit->GetSelection() )
{
case 1: return EDA_UNITS::IN;
case 1: return EDA_UNITS::INCH;
case 2: return EDA_UNITS::UNSCALED;
case 0:
default: return EDA_UNITS::MM;

View File

@ -320,7 +320,7 @@ void EDA_DRAW_FRAME::ToggleUserUnits()
}
else
{
SetUserUnits( GetUserUnits() == EDA_UNITS::IN ? EDA_UNITS::MM : EDA_UNITS::IN );
SetUserUnits( GetUserUnits() == EDA_UNITS::INCH ? EDA_UNITS::MM : EDA_UNITS::INCH );
unitsChangeRefresh();
wxCommandEvent e( EDA_EVT_UNITS_CHANGED );
@ -678,7 +678,7 @@ void EDA_DRAW_FRAME::DisplayUnitsMsg()
switch( GetUserUnits() )
{
case EDA_UNITS::IN: msg = _( "inches" ); break;
case EDA_UNITS::INCH: msg = _( "inches" ); break;
case EDA_UNITS::MILS: msg = _( "mils" ); break;
case EDA_UNITS::MM: msg = _( "mm" ); break;
default: msg = _( "Units" ); break;
@ -1270,7 +1270,7 @@ void EDA_DRAW_FRAME::setupUnits( APP_SETTINGS_BASE* aCfg )
{
default:
case EDA_UNITS::MM: m_toolManager->RunAction( ACTIONS::millimetersUnits ); break;
case EDA_UNITS::IN: m_toolManager->RunAction( ACTIONS::inchesUnits ); break;
case EDA_UNITS::INCH: m_toolManager->RunAction( ACTIONS::inchesUnits ); break;
case EDA_UNITS::MILS: m_toolManager->RunAction( ACTIONS::milsUnits ); break;
}
}

View File

@ -48,7 +48,7 @@ bool EDA_UNIT_UTILS::IsImperialUnit( EDA_UNITS aUnit )
{
switch( aUnit )
{
case EDA_UNITS::IN:
case EDA_UNITS::INCH:
case EDA_UNITS::MILS:
return true;
@ -114,7 +114,7 @@ bool EDA_UNIT_UTILS::FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS
else if( unit == wxT( "mi" ) || unit == wxT( "th" ) ) // "mils" or "thou"
aUnits = EDA_UNITS::MILS;
else if( unit == wxT( "in" ) || unit == wxT( "\"" ) )
aUnits = EDA_UNITS::IN;
aUnits = EDA_UNITS::INCH;
else if( unit == wxT( "de" ) || unit == wxT( "ra" ) ) // "deg" or "rad"
aUnits = EDA_UNITS::DEGREES;
else
@ -135,7 +135,7 @@ wxString EDA_UNIT_UTILS::GetText( EDA_UNITS aUnits, EDA_DATA_TYPE aType )
case EDA_UNITS::CM: label = wxT( " cm" ); break;
case EDA_UNITS::DEGREES: label = wxT( "°" ); break;
case EDA_UNITS::MILS: label = wxT( " mils" ); break;
case EDA_UNITS::IN: label = wxT( " in" ); break;
case EDA_UNITS::INCH: label = wxT( " in" ); break;
case EDA_UNITS::PERCENT: label = wxT( "%" ); break;
case EDA_UNITS::UNSCALED: break;
default: UNIMPLEMENTED_FOR( wxS( "Unknown units" ) ); break;
@ -267,7 +267,7 @@ double EDA_UNIT_UTILS::UI::ToUserUnit( const EDA_IU_SCALE& aIuScale, EDA_UNITS a
case EDA_UNITS::MM: return IU_TO_MM( aValue, aIuScale );
case EDA_UNITS::CM: return IU_TO_MM( aValue, aIuScale ) / 10;
case EDA_UNITS::MILS: return IU_TO_MILS( aValue, aIuScale );
case EDA_UNITS::IN: return IU_TO_IN( aValue, aIuScale );
case EDA_UNITS::INCH: return IU_TO_IN( aValue, aIuScale );
case EDA_UNITS::DEGREES: return aValue;
default: return aValue;
}
@ -305,7 +305,7 @@ wxString EDA_UNIT_UTILS::UI::StringFromValue( const EDA_IU_SCALE& aIuScale, EDA_
{
case EDA_UNITS::MILS: format = is_eeschema ? wxT( "%.3f" ) : wxT( "%.5f" ); break;
case EDA_UNITS::IN: format = is_eeschema ? wxT( "%.6f" ) : wxT( "%.8f" ); break;
case EDA_UNITS::INCH: format = is_eeschema ? wxT( "%.6f" ) : wxT( "%.8f" ); break;
case EDA_UNITS::DEGREES: format = wxT( "%.4f" ); break;
default: format = wxT( "%.10f" ); break;
}
@ -394,7 +394,7 @@ wxString EDA_UNIT_UTILS::UI::MessageTextFromValue( const EDA_IU_SCALE& aIuScale,
case EDA_UNITS::MM: format = is_eeschema ? wxT( "%.2f" ) : wxT( "%.4f" ); break;
case EDA_UNITS::CM: format = is_eeschema ? wxT( "%.3f" ) : wxT( "%.5f" ); break;
case EDA_UNITS::MILS: format = is_eeschema ? wxT( "%.0f" ) : wxT( "%.2f" ); break;
case EDA_UNITS::IN: format = is_eeschema ? wxT( "%.3f" ) : wxT( "%.4f" ); break;
case EDA_UNITS::INCH: format = is_eeschema ? wxT( "%.3f" ) : wxT( "%.4f" ); break;
case EDA_UNITS::DEGREES: format = wxT( "%.3f" ); break;
case EDA_UNITS::UNSCALED: format = wxT( "%.0f" ); break;
}
@ -448,7 +448,7 @@ double EDA_UNIT_UTILS::UI::FromUserUnit( const EDA_IU_SCALE& aIuScale, EDA_UNITS
case EDA_UNITS::MM: return MM_TO_IU( aValue, aIuScale );
case EDA_UNITS::CM: return MM_TO_IU( aValue * 10, aIuScale );
case EDA_UNITS::MILS: return MILS_TO_IU( aValue, aIuScale );
case EDA_UNITS::IN: return IN_TO_IU( aValue, aIuScale );
case EDA_UNITS::INCH: return IN_TO_IU( aValue, aIuScale );
default:
case EDA_UNITS::DEGREES:
case EDA_UNITS::UNSCALED:
@ -532,7 +532,7 @@ double EDA_UNIT_UTILS::UI::DoubleValueFromString( const EDA_IU_SCALE& aIuScale,
|| aUnits == EDA_UNITS::MM
|| aUnits == EDA_UNITS::CM
|| aUnits == EDA_UNITS::MILS
|| aUnits == EDA_UNITS::IN )
|| aUnits == EDA_UNITS::INCH )
{
//check for um, μm (µ is MICRO SIGN) and µm (µ is GREEK SMALL LETTER MU) for micrometre
if( unit == wxT( "um" ) || unit == wxT( "\u00B5m" ) || unit == wxT( "\u03BCm" ) )
@ -553,7 +553,7 @@ double EDA_UNIT_UTILS::UI::DoubleValueFromString( const EDA_IU_SCALE& aIuScale,
}
else if( unit == wxT( "in" ) || unit == wxT( "\"" ) )
{
aUnits = EDA_UNITS::IN;
aUnits = EDA_UNITS::INCH;
}
else if( unit == wxT( "oz" ) ) // 1 oz = 1.37 mils
{

View File

@ -36,7 +36,7 @@ NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_3D::FORMAT,
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_3D::VRML_UNITS,
{
{ JOB_EXPORT_PCB_3D::VRML_UNITS::IN, "in" },
{ JOB_EXPORT_PCB_3D::VRML_UNITS::INCH, "in" },
{ JOB_EXPORT_PCB_3D::VRML_UNITS::METERS, "m" },
{ JOB_EXPORT_PCB_3D::VRML_UNITS::MM, "mm" },
{ JOB_EXPORT_PCB_3D::VRML_UNITS::TENTHS, "tenths" },

View File

@ -125,7 +125,7 @@ public:
enum class VRML_UNITS
{
IN,
INCH, // Do not use IN: it conflicts with a Windows header
MM,
METERS,
TENTHS // inches

View File

@ -36,7 +36,7 @@ NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_DRILL::DRILL_ORIGIN,
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_DRILL::DRILL_UNITS,
{
{ JOB_EXPORT_PCB_DRILL::DRILL_UNITS::IN, "in" },
{ JOB_EXPORT_PCB_DRILL::DRILL_UNITS::INCH, "in" },
{ JOB_EXPORT_PCB_DRILL::DRILL_UNITS::MM, "mm" },
} )
@ -66,7 +66,7 @@ JOB_EXPORT_PCB_DRILL::JOB_EXPORT_PCB_DRILL() :
m_excellonOvalDrillRoute( false ),
m_format( DRILL_FORMAT::EXCELLON ),
m_drillOrigin( DRILL_ORIGIN::ABS ),
m_drillUnits( DRILL_UNITS::IN ),
m_drillUnits( DRILL_UNITS::INCH ),
m_zeroFormat( ZEROS_FORMAT::DECIMAL ),
m_mapFormat( MAP_FORMAT::PDF ),
m_gerberPrecision( 5 ),

View File

@ -48,7 +48,7 @@ public:
enum class DRILL_UNITS
{
IN,
INCH, // Do not use IN: it conflicts with a Windows header
MM
};

View File

@ -30,7 +30,7 @@ NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_DXF::GEN_MODE,
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_DXF::DXF_UNITS,
{
{ JOB_EXPORT_PCB_DXF::DXF_UNITS::IN, "in" },
{ JOB_EXPORT_PCB_DXF::DXF_UNITS::INCH, "in" },
{ JOB_EXPORT_PCB_DXF::DXF_UNITS::MM, "mm" },
} )
@ -38,7 +38,7 @@ JOB_EXPORT_PCB_DXF::JOB_EXPORT_PCB_DXF() :
JOB_EXPORT_PCB_PLOT( JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::DXF, "dxf", false ),
m_plotGraphicItemsUsingContours( true ),
m_polygonMode( true ),
m_dxfUnits( DXF_UNITS::IN ),
m_dxfUnits( DXF_UNITS::INCH ),
m_genMode( GEN_MODE::MULTI )
{
m_plotDrawingSheet = false;

View File

@ -37,7 +37,7 @@ public:
enum class DXF_UNITS
{
IN,
INCH, // Do not use IN: it conflicts with a Windows header
MM
};

View File

@ -24,7 +24,7 @@
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_ODB::ODB_UNITS,
{
{ JOB_EXPORT_PCB_ODB::ODB_UNITS::IN, "in" },
{ JOB_EXPORT_PCB_ODB::ODB_UNITS::INCH, "in" },
{ JOB_EXPORT_PCB_ODB::ODB_UNITS::MM, "mm" },
} )

View File

@ -36,7 +36,7 @@ public:
enum class ODB_UNITS
{
MM,
IN,
INCH, // Do not use IN: it conflicts with a Windows header
};
enum class ODB_COMPRESSION

View File

@ -39,7 +39,7 @@ NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_POS::SIDE,
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_POS::UNITS,
{
{ JOB_EXPORT_PCB_POS::UNITS::IN, "in" },
{ JOB_EXPORT_PCB_POS::UNITS::INCH, "in" },
{ JOB_EXPORT_PCB_POS::UNITS::MM, "mm" },
} )

View File

@ -44,7 +44,7 @@ public:
enum class UNITS
{
IN,
INCH, // Do not use IN: it conflicts with a Windows header
MM
};

View File

@ -22,7 +22,7 @@
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_RC::UNITS, {
{ JOB_RC::UNITS::IN, "in" },
{ JOB_RC::UNITS::INCH, "in" },
{ JOB_RC::UNITS::MM, "mm" },
{ JOB_RC::UNITS::MILS, "mils" },
} )

View File

@ -32,7 +32,7 @@ public:
enum class UNITS
{
IN,
INCH, // Do not use IN: it conflicts with a Windows header
MM,
MILS
};

View File

@ -84,7 +84,7 @@ void NUMERIC_EVALUATOR::SetDefaultUnits( EDA_UNITS aUnits )
{
case EDA_UNITS::MM: m_defaultUnits = Unit::MM; break;
case EDA_UNITS::MILS: m_defaultUnits = Unit::Mil; break;
case EDA_UNITS::IN: m_defaultUnits = Unit::Inch; break;
case EDA_UNITS::INCH: m_defaultUnits = Unit::Inch; break;
case EDA_UNITS::DEGREES: m_defaultUnits = Unit::Degrees; break;
case EDA_UNITS::UNSCALED: m_defaultUnits = Unit::SI; break;
default: m_defaultUnits = Unit::MM; break;

View File

@ -141,7 +141,7 @@ void DXF_PLOTTER::SetUnits( DXF_UNITS aUnit )
m_measurementDirective = 1;
break;
case DXF_UNITS::IN:
case DXF_UNITS::INCH:
default:
m_unitScalingFactor = 0.0001;
m_measurementDirective = 0;

View File

@ -49,7 +49,7 @@ wxString KIGFX::PREVIEW::DimensionLabel( const wxString& prefix, double aVal,
case EDA_UNITS::MM: fmtStr = wxT( "%.3f" ); break; // 1um
case EDA_UNITS::CM: fmtStr = wxT( "%.4f" ); break; // 1um
case EDA_UNITS::MILS: fmtStr = wxT( "%.1f" ); break; // 0.1mil
case EDA_UNITS::IN: fmtStr = wxT( "%.4f" ); break; // 0.1mil
case EDA_UNITS::INCH: fmtStr = wxT( "%.4f" ); break; // 0.1mil
case EDA_UNITS::DEGREES: fmtStr = wxT( "%.1f" ); break; // 0.1deg
case EDA_UNITS::PERCENT: fmtStr = wxT( "%.1f" ); break; // 0.1%
case EDA_UNITS::UNSCALED: fmtStr = wxT( "%f" ); break;

View File

@ -973,7 +973,7 @@ TOOL_ACTION ACTIONS::inchesUnits( TOOL_ACTION_ARGS()
.Icon( BITMAPS::unit_inch )
.ToolbarState( TOOLBAR_STATE::TOGGLE )
.Flags( AF_NONE )
.Parameter( EDA_UNITS::IN ) );
.Parameter( EDA_UNITS::INCH ) );
TOOL_ACTION ACTIONS::milsUnits( TOOL_ACTION_ARGS()
.Name( "common.Control.mils" )

View File

@ -50,7 +50,7 @@
COMMON_TOOLS::COMMON_TOOLS() :
TOOL_INTERACTIVE( "common.Control" ),
m_frame( nullptr ),
m_imperialUnit( EDA_UNITS::IN ),
m_imperialUnit( EDA_UNITS::INCH ),
m_metricUnit( EDA_UNITS::MM )
{
}

View File

@ -204,7 +204,7 @@ void DISPLAY_FOOTPRINTS_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::IN ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCH ) ) );
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
mgr->SetConditions( PCB_ACTIONS::showPadNumbers, CHECK( cond.PadNumbersDisplay() ) );

View File

@ -1146,7 +1146,7 @@ int EESCHEMA_JOBS_HANDLER::JobSchErc( JOB* aJob )
switch( ercJob->m_units )
{
case JOB_SCH_ERC::UNITS::IN: units = EDA_UNITS::IN; break;
case JOB_SCH_ERC::UNITS::INCH: units = EDA_UNITS::INCH; break;
case JOB_SCH_ERC::UNITS::MILS: units = EDA_UNITS::MILS; break;
case JOB_SCH_ERC::UNITS::MM: units = EDA_UNITS::MM; break;
default: units = EDA_UNITS::MM; break;

View File

@ -631,7 +631,7 @@ void SCH_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::toggleGridOverrides, CHECK( cond.GridOverrides() ) );
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::IN ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCH ) ) );
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
mgr->SetConditions( EE_ACTIONS::lineModeFree,

Some files were not shown because too many files have changed in this diff Show More