Switch to scoped enums

This commit is contained in:
Mark Roszko 2019-12-20 14:11:39 +00:00 committed by Seth Hillbrand
parent 6b9f2ac91a
commit 11ff16be4e
206 changed files with 951 additions and 814 deletions

View File

@ -131,7 +131,7 @@ void PANEL_PREV_3D::loadCommonSettings()
*/ */
static double rotationFromString( const wxString& aValue ) static double rotationFromString( const wxString& aValue )
{ {
double rotation = DoubleValueFromString( DEGREES, aValue ) / 10.0; double rotation = DoubleValueFromString( EDA_UNITS::DEGREES, aValue ) / 10.0;
if( rotation > MAX_ROTATION ) if( rotation > MAX_ROTATION )
{ {
@ -156,14 +156,14 @@ wxString PANEL_PREV_3D::formatScaleValue( double aValue )
wxString PANEL_PREV_3D::formatRotationValue( double aValue ) wxString PANEL_PREV_3D::formatRotationValue( double aValue )
{ {
return wxString::Format( "%.2f %s", aValue, GetAbbreviatedUnitsLabel( DEGREES ) ); return wxString::Format( "%.2f %s", aValue, GetAbbreviatedUnitsLabel( EDA_UNITS::DEGREES ) );
} }
wxString PANEL_PREV_3D::formatOffsetValue( double aValue ) wxString PANEL_PREV_3D::formatOffsetValue( double aValue )
{ {
// Convert from internal units (mm) to user units // Convert from internal units (mm) to user units
if( m_userUnits == INCHES ) if( m_userUnits == EDA_UNITS::INCHES )
aValue /= 25.4f; aValue /= 25.4f;
return wxString::Format( "%.4f %s", aValue, GetAbbreviatedUnitsLabel( m_userUnits ) ); return wxString::Format( "%.4f %s", aValue, GetAbbreviatedUnitsLabel( m_userUnits ) );
@ -218,9 +218,9 @@ void PANEL_PREV_3D::updateOrientation( wxCommandEvent &event )
// Write settings back to the parent // Write settings back to the parent
MODULE_3D_SETTINGS* modelInfo = &m_parentModelList->at( (unsigned) m_selected ); MODULE_3D_SETTINGS* modelInfo = &m_parentModelList->at( (unsigned) m_selected );
modelInfo->m_Scale.x = DoubleValueFromString( UNSCALED_UNITS, xscale->GetValue() ); modelInfo->m_Scale.x = DoubleValueFromString( EDA_UNITS::UNSCALED, xscale->GetValue() );
modelInfo->m_Scale.y = DoubleValueFromString( UNSCALED_UNITS, yscale->GetValue() ); modelInfo->m_Scale.y = DoubleValueFromString( EDA_UNITS::UNSCALED, yscale->GetValue() );
modelInfo->m_Scale.z = DoubleValueFromString( UNSCALED_UNITS, zscale->GetValue() ); modelInfo->m_Scale.z = DoubleValueFromString( EDA_UNITS::UNSCALED, zscale->GetValue() );
modelInfo->m_Rotation.x = rotationFromString( xrot->GetValue() ); modelInfo->m_Rotation.x = rotationFromString( xrot->GetValue() );
modelInfo->m_Rotation.y = rotationFromString( yrot->GetValue() ); modelInfo->m_Rotation.y = rotationFromString( yrot->GetValue() );
@ -247,7 +247,7 @@ void PANEL_PREV_3D::doIncrementScale( wxSpinEvent& event, double aSign )
else if( spinCtrl == m_spinZscale ) else if( spinCtrl == m_spinZscale )
textCtrl = zscale; textCtrl = zscale;
double curr_value = DoubleValueFromString( UNSCALED_UNITS, textCtrl->GetValue() ); double curr_value = DoubleValueFromString( EDA_UNITS::UNSCALED, textCtrl->GetValue() );
curr_value += ( SCALE_INCREMENT * aSign ); curr_value += ( SCALE_INCREMENT * aSign );
curr_value = std::max( 1/MAX_SCALE, curr_value ); curr_value = std::max( 1/MAX_SCALE, curr_value );
@ -267,7 +267,7 @@ void PANEL_PREV_3D::doIncrementRotation( wxSpinEvent& aEvent, double aSign )
else if( spinCtrl == m_spinZrot ) else if( spinCtrl == m_spinZrot )
textCtrl = zrot; textCtrl = zrot;
double curr_value = DoubleValueFromString( DEGREES, textCtrl->GetValue() ) / 10.0; double curr_value = DoubleValueFromString( EDA_UNITS::DEGREES, textCtrl->GetValue() ) / 10.0;
curr_value += ( ROTATION_INCREMENT * aSign ); curr_value += ( ROTATION_INCREMENT * aSign );
curr_value = std::max( -MAX_ROTATION, curr_value ); curr_value = std::max( -MAX_ROTATION, curr_value );
@ -290,7 +290,7 @@ void PANEL_PREV_3D::doIncrementOffset( wxSpinEvent& event, double aSign )
double step = OFFSET_INCREMENT_MM; double step = OFFSET_INCREMENT_MM;
if( m_userUnits == INCHES ) if( m_userUnits == EDA_UNITS::INCHES )
step = OFFSET_INCREMENT_MIL/1000.0; step = OFFSET_INCREMENT_MIL/1000.0;
double curr_value = DoubleValueFromString( m_userUnits, textCtrl->GetValue() ) / IU_PER_MM; double curr_value = DoubleValueFromString( m_userUnits, textCtrl->GetValue() ) / IU_PER_MM;
@ -315,7 +315,7 @@ void PANEL_PREV_3D::onMouseWheelScale( wxMouseEvent& event )
if( event.GetWheelRotation() >= 0 ) if( event.GetWheelRotation() >= 0 )
step = -step; step = -step;
double curr_value = DoubleValueFromString( UNSCALED_UNITS, textCtrl->GetValue() ); double curr_value = DoubleValueFromString( EDA_UNITS::UNSCALED, textCtrl->GetValue() );
curr_value += step; curr_value += step;
curr_value = std::max( 1/MAX_SCALE, curr_value ); curr_value = std::max( 1/MAX_SCALE, curr_value );
@ -337,7 +337,7 @@ void PANEL_PREV_3D::onMouseWheelRot( wxMouseEvent& event )
if( event.GetWheelRotation() >= 0 ) if( event.GetWheelRotation() >= 0 )
step = -step; step = -step;
double curr_value = DoubleValueFromString( DEGREES, textCtrl->GetValue() ) / 10.0; double curr_value = DoubleValueFromString( EDA_UNITS::DEGREES, textCtrl->GetValue() ) / 10.0;
curr_value += step; curr_value += step;
curr_value = std::max( -MAX_ROTATION, curr_value ); curr_value = std::max( -MAX_ROTATION, curr_value );
@ -356,7 +356,7 @@ void PANEL_PREV_3D::onMouseWheelOffset( wxMouseEvent& event )
if( event.ShiftDown( ) ) if( event.ShiftDown( ) )
step = OFFSET_INCREMENT_MM_FINE; step = OFFSET_INCREMENT_MM_FINE;
if( m_userUnits == INCHES ) if( m_userUnits == EDA_UNITS::INCHES )
{ {
step = OFFSET_INCREMENT_MIL/1000.0; step = OFFSET_INCREMENT_MIL/1000.0;
if( event.ShiftDown( ) ) if( event.ShiftDown( ) )

View File

@ -87,7 +87,7 @@ private:
std::vector<MODULE_3D_SETTINGS>* m_parentModelList; std::vector<MODULE_3D_SETTINGS>* m_parentModelList;
int m_selected; /// Index into m_parentInfoList int m_selected; /// Index into m_parentInfoList
EDA_UNITS_T m_userUnits; EDA_UNITS m_userUnits;
// Methods of the class // Methods of the class
private: private:

View File

@ -61,18 +61,18 @@ IMAGE_SIZE::IMAGE_SIZE()
m_outputSize = 0.0; m_outputSize = 0.0;
m_originalDPI = DEFAULT_DPI; m_originalDPI = DEFAULT_DPI;
m_originalSizePixels = 0; m_originalSizePixels = 0;
m_unit = MILLIMETRES; m_unit = EDA_UNITS::MILLIMETRES;
} }
void IMAGE_SIZE::SetOutputSizeFromInitialImageSize() void IMAGE_SIZE::SetOutputSizeFromInitialImageSize()
{ {
// Set the m_outputSize value from the m_originalSizePixels and the selected unit // Set the m_outputSize value from the m_originalSizePixels and the selected unit
if( m_unit == MILLIMETRES ) if( m_unit == EDA_UNITS::MILLIMETRES )
{ {
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI * 25.4; m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI * 25.4;
} }
else if( m_unit == INCHES ) else if( m_unit == EDA_UNITS::INCHES )
{ {
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI; m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI;
} }
@ -88,11 +88,11 @@ int IMAGE_SIZE::GetOutputDPI()
{ {
int outputDPI; int outputDPI;
if( m_unit == MILLIMETRES ) if( m_unit == EDA_UNITS::MILLIMETRES )
{ {
outputDPI = GetOriginalSizePixels() / ( m_outputSize / 25.4 ); outputDPI = GetOriginalSizePixels() / ( m_outputSize / 25.4 );
} }
else if( m_unit == INCHES ) else if( m_unit == EDA_UNITS::INCHES )
{ {
outputDPI = GetOriginalSizePixels() / m_outputSize; outputDPI = GetOriginalSizePixels() / m_outputSize;
} }
@ -105,7 +105,7 @@ int IMAGE_SIZE::GetOutputDPI()
} }
void IMAGE_SIZE::SetUnit( EDA_UNITS_T aUnit ) void IMAGE_SIZE::SetUnit( EDA_UNITS aUnit )
{ {
// Set the unit used for m_outputSize, and convert the old m_outputSize value // Set the unit used for m_outputSize, and convert the old m_outputSize value
// to the value in new unit // to the value in new unit
@ -115,11 +115,11 @@ void IMAGE_SIZE::SetUnit( EDA_UNITS_T aUnit )
// Convert m_outputSize to mm: // Convert m_outputSize to mm:
double size_mm; double size_mm;
if( m_unit == MILLIMETRES ) if( m_unit == EDA_UNITS::MILLIMETRES )
{ {
size_mm = m_outputSize; size_mm = m_outputSize;
} }
else if( m_unit == INCHES ) else if( m_unit == EDA_UNITS::INCHES )
{ {
size_mm = m_outputSize * 25.4; size_mm = m_outputSize * 25.4;
} }
@ -134,11 +134,11 @@ void IMAGE_SIZE::SetUnit( EDA_UNITS_T aUnit )
} }
// Convert m_outputSize to new value: // Convert m_outputSize to new value:
if( aUnit == MILLIMETRES ) if( aUnit == EDA_UNITS::MILLIMETRES )
{ {
m_outputSize = size_mm; m_outputSize = size_mm;
} }
else if( aUnit == INCHES ) else if( aUnit == EDA_UNITS::INCHES )
{ {
m_outputSize = size_mm / 25.4; m_outputSize = size_mm / 25.4;
} }
@ -471,11 +471,11 @@ wxString BM2CMP_FRAME::FormatOutputSize( double aSize )
{ {
wxString text; wxString text;
if( getUnitFromSelection() == MILLIMETRES ) if( getUnitFromSelection() == EDA_UNITS::MILLIMETRES )
{ {
text.Printf( "%.1f", aSize ); text.Printf( "%.1f", aSize );
} }
else if( getUnitFromSelection() == INCHES ) else if( getUnitFromSelection() == EDA_UNITS::INCHES )
{ {
text.Printf( "%.2f", aSize ); text.Printf( "%.2f", aSize );
} }
@ -506,23 +506,23 @@ void BM2CMP_FRAME::updateImageInfo()
} }
EDA_UNITS_T BM2CMP_FRAME::getUnitFromSelection() EDA_UNITS BM2CMP_FRAME::getUnitFromSelection()
{ {
// return the EDA_UNITS_T from the m_PixelUnit choice // return the EDA_UNITS from the m_PixelUnit choice
switch( m_PixelUnit->GetSelection() ) switch( m_PixelUnit->GetSelection() )
{ {
case 1: case 1:
return INCHES; return EDA_UNITS::INCHES;
case 2: case 2:
return UNSCALED_UNITS; return EDA_UNITS::UNSCALED;
case 0: case 0:
default: default:
break; break;
} }
return MILLIMETRES; return EDA_UNITS::MILLIMETRES;
} }
@ -536,7 +536,7 @@ void BM2CMP_FRAME::OnSizeChangeX( wxCommandEvent& event )
{ {
double calculatedY = new_size / m_AspectRatio; double calculatedY = new_size / m_AspectRatio;
if( getUnitFromSelection() == UNSCALED_UNITS ) if( getUnitFromSelection() == EDA_UNITS::UNSCALED )
{ {
// for units in DPI, keeping aspect ratio cannot use m_AspectRatioLocked. // for units in DPI, keeping aspect ratio cannot use m_AspectRatioLocked.
// just rescale the other dpi // just rescale the other dpi
@ -565,7 +565,7 @@ void BM2CMP_FRAME::OnSizeChangeY( wxCommandEvent& event )
{ {
double calculatedX = new_size * m_AspectRatio; double calculatedX = new_size * m_AspectRatio;
if( getUnitFromSelection() == UNSCALED_UNITS ) if( getUnitFromSelection() == EDA_UNITS::UNSCALED )
{ {
// for units in DPI, keeping aspect ratio cannot use m_AspectRatioLocked. // for units in DPI, keeping aspect ratio cannot use m_AspectRatioLocked.
// just rescale the other dpi // just rescale the other dpi

View File

@ -26,8 +26,8 @@
#include "bitmap2component.h" #include "bitmap2component.h"
#include "bitmap2cmp_gui_base.h" #include "bitmap2cmp_gui_base.h"
#include <common.h> // for EDA_UNITS
#include <potracelib.h> #include <potracelib.h>
#include <common.h> // for EDA_UNITS_T
class IMAGE_SIZE class IMAGE_SIZE
@ -37,7 +37,7 @@ public:
// Set the unit used for m_outputSize, and convert the old m_outputSize value // Set the unit used for m_outputSize, and convert the old m_outputSize value
// to the value in new unit // to the value in new unit
void SetUnit( EDA_UNITS_T aUnit ); void SetUnit( EDA_UNITS aUnit );
// Accessors: // Accessors:
void SetOriginalDPI( int aDPI ) void SetOriginalDPI( int aDPI )
@ -55,7 +55,7 @@ public:
return m_outputSize; return m_outputSize;
} }
void SetOutputSize( double aSize, EDA_UNITS_T aUnit ) void SetOutputSize( double aSize, EDA_UNITS aUnit )
{ {
m_unit = aUnit; m_unit = aUnit;
m_outputSize = aSize; m_outputSize = aSize;
@ -75,7 +75,7 @@ public:
int GetOutputDPI(); int GetOutputDPI();
private: private:
EDA_UNITS_T m_unit; // The units for m_outputSize (mm, inch, dpi) EDA_UNITS m_unit; // The units for m_outputSize (mm, inch, dpi)
double m_outputSize; // The size in m_unit of the output image, depending on double m_outputSize; // The size in m_unit of the output image, depending on
// the user settings. Set to the initial image size // the user settings. Set to the initial image size
int m_originalDPI; // The image DPI if specified in file, or 0 if unknown int m_originalDPI; // The image DPI if specified in file, or 0 if unknown
@ -101,8 +101,8 @@ private:
void OnExportToFile( wxCommandEvent& event ) override; void OnExportToFile( wxCommandEvent& event ) override;
void OnExportToClipboard( wxCommandEvent& event ) override; void OnExportToClipboard( wxCommandEvent& event ) override;
///> @return the EDA_UNITS_T from the m_PixelUnit choice ///> @return the EDA_UNITS from the m_PixelUnit choice
EDA_UNITS_T getUnitFromSelection(); EDA_UNITS getUnitFromSelection();
// return a string giving the output size, according to the selected unit // return a string giving the output size, according to the selected unit
wxString FormatOutputSize( double aSize ); wxString FormatOutputSize( double aSize );

View File

@ -112,8 +112,8 @@ int BASE_SCREEN::BuildGridsChoiceList( wxArrayString& aGridsList, bool aMmFirst)
for( size_t i = 0; i < GetGridCount(); i++ ) for( size_t i = 0; i < GetGridCount(); i++ )
{ {
const GRID_TYPE& grid = m_grids[i]; const GRID_TYPE& grid = m_grids[i];
double gridValueMils = To_User_Unit( INCHES, grid.m_Size.x ) * 1000; double gridValueMils = To_User_Unit( EDA_UNITS::INCHES, grid.m_Size.x ) * 1000;
double gridValue_mm = To_User_Unit( MILLIMETRES, grid.m_Size.x ); double gridValue_mm = To_User_Unit( EDA_UNITS::MILLIMETRES, grid.m_Size.x );
if( grid.m_CmdId == ID_POPUP_GRID_USER ) if( grid.m_CmdId == ID_POPUP_GRID_USER )
{ {
@ -220,7 +220,7 @@ void BASE_SCREEN::AddGrid( const GRID_TYPE& aGrid )
} }
void BASE_SCREEN::AddGrid( const wxRealPoint& size, EDA_UNITS_T aUnit, int id ) void BASE_SCREEN::AddGrid( const wxRealPoint& size, EDA_UNITS aUnit, int id )
{ {
wxRealPoint new_size; wxRealPoint new_size;
GRID_TYPE new_grid; GRID_TYPE new_grid;

View File

@ -144,7 +144,7 @@ SEARCH_RESULT EDA_ITEM::Visit( INSPECTOR inspector, void* testData, const KICAD_
} }
wxString EDA_ITEM::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString EDA_ITEM::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
wxFAIL_MSG( wxT( "GetSelectMenuText() was not overridden for schematic item type " ) + wxFAIL_MSG( wxT( "GetSelectMenuText() was not overridden for schematic item type " ) +
GetClass() ); GetClass() );

View File

@ -90,20 +90,20 @@ std::string Double2Str( double aValue )
} }
double To_User_Unit( EDA_UNITS_T aUnit, double aValue, bool aUseMils ) double To_User_Unit( EDA_UNITS aUnit, double aValue, bool aUseMils )
{ {
switch( aUnit ) switch( aUnit )
{ {
case MILLIMETRES: case EDA_UNITS::MILLIMETRES:
return IU_TO_MM( aValue ); return IU_TO_MM( aValue );
case INCHES: case EDA_UNITS::INCHES:
if( aUseMils ) if( aUseMils )
return IU_TO_MILS( aValue ); return IU_TO_MILS( aValue );
else else
return IU_TO_IN( aValue ); return IU_TO_IN( aValue );
case DEGREES: case EDA_UNITS::DEGREES:
return aValue / 10.0f; return aValue / 10.0f;
default: default:
@ -122,27 +122,27 @@ double To_User_Unit( EDA_UNITS_T aUnit, double aValue, bool aUseMils )
*/ */
// A lower-precision (for readability) version of StringFromValue() // A lower-precision (for readability) version of StringFromValue()
wxString MessageTextFromValue( EDA_UNITS_T aUnits, int aValue, bool aUseMils ) wxString MessageTextFromValue( EDA_UNITS aUnits, int aValue, bool aUseMils )
{ {
return MessageTextFromValue( aUnits, double( aValue ), aUseMils ); return MessageTextFromValue( aUnits, double( aValue ), aUseMils );
} }
// A lower-precision (for readability) version of StringFromValue() // A lower-precision (for readability) version of StringFromValue()
wxString MessageTextFromValue( EDA_UNITS_T aUnits, long long int aValue, bool aUseMils ) wxString MessageTextFromValue( EDA_UNITS aUnits, long long int aValue, bool aUseMils )
{ {
return MessageTextFromValue( aUnits, double( aValue ), aUseMils ); return MessageTextFromValue( aUnits, double( aValue ), aUseMils );
} }
// A lower-precision (for readability) version of StringFromValue() // A lower-precision (for readability) version of StringFromValue()
wxString MessageTextFromValue( EDA_UNITS_T aUnits, double aValue, bool aUseMils ) wxString MessageTextFromValue( EDA_UNITS aUnits, double aValue, bool aUseMils )
{ {
wxString text; wxString text;
const wxChar* format; const wxChar* format;
double value = To_User_Unit( aUnits, aValue, aUseMils ); double value = To_User_Unit( aUnits, aValue, aUseMils );
if( aUnits == INCHES ) if( aUnits == EDA_UNITS::INCHES )
{ {
if( aUseMils ) if( aUseMils )
{ {
@ -214,7 +214,7 @@ void StripTrailingZeros( wxString& aStringValue, unsigned aTrailingZeroAllowed )
* otherwise the actual value is rounded when read from dialog and converted * otherwise the actual value is rounded when read from dialog and converted
* in internal units, and therefore modified. * in internal units, and therefore modified.
*/ */
wxString StringFromValue( EDA_UNITS_T aUnits, double aValue, bool aAddUnitSymbol, bool aUseMils ) wxString StringFromValue( EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, bool aUseMils )
{ {
double value_to_print = To_User_Unit( aUnits, aValue, aUseMils ); double value_to_print = To_User_Unit( aUnits, aValue, aUseMils );
@ -244,7 +244,7 @@ wxString StringFromValue( EDA_UNITS_T aUnits, double aValue, bool aAddUnitSymbol
} }
else else
{ {
if( aUnits == INCHES && aUseMils ) if( aUnits == EDA_UNITS::INCHES && aUseMils )
len = sprintf( buf, "%.7g", value_to_print ); len = sprintf( buf, "%.7g", value_to_print );
else else
len = sprintf( buf, "%.10g", value_to_print ); len = sprintf( buf, "%.10g", value_to_print );
@ -258,26 +258,26 @@ wxString StringFromValue( EDA_UNITS_T aUnits, double aValue, bool aAddUnitSymbol
{ {
switch( aUnits ) switch( aUnits )
{ {
case INCHES: case EDA_UNITS::INCHES:
if( aUseMils ) if( aUseMils )
stringValue += wxT( " mils" ); stringValue += wxT( " mils" );
else else
stringValue += wxT( " in" ); stringValue += wxT( " in" );
break; break;
case MILLIMETRES: case EDA_UNITS::MILLIMETRES:
stringValue += wxT( " mm" ); stringValue += wxT( " mm" );
break; break;
case DEGREES: case EDA_UNITS::DEGREES:
stringValue += wxT( " deg" ); stringValue += wxT( " deg" );
break; break;
case PERCENT: case EDA_UNITS::PERCENT:
stringValue += wxT( "%" ); stringValue += wxT( "%" );
break; break;
case UNSCALED_UNITS: case EDA_UNITS::UNSCALED:
break; break;
} }
} }
@ -286,32 +286,32 @@ wxString StringFromValue( EDA_UNITS_T aUnits, double aValue, bool aAddUnitSymbol
} }
double From_User_Unit( EDA_UNITS_T aUnits, double aValue, bool aUseMils ) double From_User_Unit( EDA_UNITS aUnits, double aValue, bool aUseMils )
{ {
switch( aUnits ) switch( aUnits )
{ {
case MILLIMETRES: case EDA_UNITS::MILLIMETRES:
return MM_TO_IU( aValue ); return MM_TO_IU( aValue );
case INCHES: case EDA_UNITS::INCHES:
if( aUseMils ) if( aUseMils )
return MILS_TO_IU( aValue ); return MILS_TO_IU( aValue );
else else
return IN_TO_IU( aValue ); return IN_TO_IU( aValue );
case DEGREES: case EDA_UNITS::DEGREES:
// Convert to "decidegrees" // Convert to "decidegrees"
return aValue * 10; return aValue * 10;
default: default:
case UNSCALED_UNITS: case EDA_UNITS::UNSCALED:
case PERCENT: case EDA_UNITS::PERCENT:
return aValue; return aValue;
} }
} }
double DoubleValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue, bool aUseMils ) double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, bool aUseMils )
{ {
double value; double value;
double dtmp = 0; double dtmp = 0;
@ -348,30 +348,30 @@ double DoubleValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue, bo
// Check the optional unit designator (2 ch significant) // Check the optional unit designator (2 ch significant)
wxString unit( buf.Mid( brk_point ).Strip( wxString::leading ).Left( 2 ).Lower() ); wxString unit( buf.Mid( brk_point ).Strip( wxString::leading ).Left( 2 ).Lower() );
if( aUnits == INCHES || aUnits == MILLIMETRES ) if( aUnits == EDA_UNITS::INCHES || aUnits == EDA_UNITS::MILLIMETRES )
{ {
if( unit == wxT( "in" ) || unit == wxT( "\"" ) ) if( unit == wxT( "in" ) || unit == wxT( "\"" ) )
{ {
aUnits = INCHES; aUnits = EDA_UNITS::INCHES;
aUseMils = false; aUseMils = false;
} }
else if( unit == wxT( "mm" ) ) else if( unit == wxT( "mm" ) )
{ {
aUnits = MILLIMETRES; aUnits = EDA_UNITS::MILLIMETRES;
} }
else if( unit == wxT( "mi" ) || unit == wxT( "th" ) ) // "mils" or "thou" else if( unit == wxT( "mi" ) || unit == wxT( "th" ) ) // "mils" or "thou"
{ {
aUnits = INCHES; aUnits = EDA_UNITS::INCHES;
aUseMils = true; aUseMils = true;
} }
else if( unit == "oz" ) // 1 oz = 1.37 mils else if( unit == "oz" ) // 1 oz = 1.37 mils
{ {
aUnits = INCHES; aUnits = EDA_UNITS::INCHES;
aUseMils = true; aUseMils = true;
dtmp *= 1.37; dtmp *= 1.37;
} }
} }
else if( aUnits == DEGREES ) else if( aUnits == EDA_UNITS::DEGREES )
{ {
if( unit == wxT( "ra" ) ) // Radians if( unit == wxT( "ra" ) ) // Radians
{ {
@ -385,7 +385,7 @@ double DoubleValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue, bo
} }
void FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS_T& aUnits, bool& aUseMils ) void FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS& aUnits, bool& aUseMils )
{ {
wxString buf( aTextValue.Strip( wxString::both ) ); wxString buf( aTextValue.Strip( wxString::both ) );
unsigned brk_point = 0; unsigned brk_point = 0;
@ -405,26 +405,26 @@ void FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS_T& aUnits, bool
if( unit == wxT( "in" ) || unit == wxT( "\"" ) ) if( unit == wxT( "in" ) || unit == wxT( "\"" ) )
{ {
aUnits = INCHES; aUnits = EDA_UNITS::INCHES;
aUseMils = false; aUseMils = false;
} }
else if( unit == wxT( "mm" ) ) else if( unit == wxT( "mm" ) )
{ {
aUnits = MILLIMETRES; aUnits = EDA_UNITS::MILLIMETRES;
} }
else if( unit == wxT( "mi" ) || unit == wxT( "th" ) ) // "mils" or "thou" else if( unit == wxT( "mi" ) || unit == wxT( "th" ) ) // "mils" or "thou"
{ {
aUnits = INCHES; aUnits = EDA_UNITS::INCHES;
aUseMils = true; aUseMils = true;
} }
else if( unit == wxT( "de" ) || unit == wxT( "ra" ) ) // "deg" or "rad" else if( unit == wxT( "de" ) || unit == wxT( "ra" ) ) // "deg" or "rad"
{ {
aUnits = DEGREES; aUnits = EDA_UNITS::DEGREES;
} }
} }
long long int ValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue, bool aUseMils ) long long int ValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, bool aUseMils )
{ {
double value = DoubleValueFromString( aUnits, aTextValue, aUseMils ); double value = DoubleValueFromString( aUnits, aTextValue, aUseMils );
return KiROUND<double, long long int>( value ); return KiROUND<double, long long int>( value );
@ -447,26 +447,26 @@ wxString AngleToStringDegrees( double aAngle )
} }
wxString GetAbbreviatedUnitsLabel( EDA_UNITS_T aUnit, bool aUseMils ) wxString GetAbbreviatedUnitsLabel( EDA_UNITS aUnit, bool aUseMils )
{ {
switch( aUnit ) switch( aUnit )
{ {
case INCHES: case EDA_UNITS::INCHES:
if( aUseMils ) if( aUseMils )
return _( "mils" ); return _( "mils" );
else else
return _( "in" ); return _( "in" );
case MILLIMETRES: case EDA_UNITS::MILLIMETRES:
return _( "mm" ); return _( "mm" );
case PERCENT: case EDA_UNITS::PERCENT:
return _( "%" ); return _( "%" );
case UNSCALED_UNITS: case EDA_UNITS::UNSCALED:
return wxEmptyString; return wxEmptyString;
case DEGREES: case EDA_UNITS::DEGREES:
return _( "deg" ); return _( "deg" );
default: default:

View File

@ -66,11 +66,10 @@ END_EVENT_TABLE()
DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& title, DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size, long style, const wxPoint& pos, const wxSize& size, long style, const wxString& name )
const wxString& name ) : : wxDialog( aParent, id, title, pos, size, style, name ),
wxDialog( aParent, id, title, pos, size, style, name ),
KIWAY_HOLDER( nullptr, KIWAY_HOLDER::DIALOG ), KIWAY_HOLDER( nullptr, KIWAY_HOLDER::DIALOG ),
m_units( MILLIMETRES ), m_units( EDA_UNITS::MILLIMETRES ),
m_firstPaintEvent( true ), m_firstPaintEvent( true ),
m_initialFocusTarget( nullptr ), m_initialFocusTarget( nullptr ),
m_qmodal_loop( nullptr ), m_qmodal_loop( nullptr ),

View File

@ -111,7 +111,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
// BLACK for Pcbnew, BLACK or WHITE for eeschema // BLACK for Pcbnew, BLACK or WHITE for eeschema
m_MsgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight(); m_MsgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight();
m_zoomLevelCoeff = 1.0; m_zoomLevelCoeff = 1.0;
m_userUnits = MILLIMETRES; m_userUnits = EDA_UNITS::MILLIMETRES;
m_PolarCoords = false; m_PolarCoords = false;
m_findReplaceData = new wxFindReplaceData( wxFR_DOWN ); m_findReplaceData = new wxFindReplaceData( wxFR_DOWN );
@ -389,11 +389,11 @@ void EDA_DRAW_FRAME::DisplayGridMsg()
switch( m_userUnits ) switch( m_userUnits )
{ {
case INCHES: case EDA_UNITS::INCHES:
gridformatter = "grid %.3f"; gridformatter = "grid %.3f";
break; break;
case MILLIMETRES: case EDA_UNITS::MILLIMETRES:
gridformatter = "grid %.4f"; gridformatter = "grid %.4f";
break; break;
@ -416,8 +416,12 @@ void EDA_DRAW_FRAME::DisplayUnitsMsg()
switch( m_userUnits ) switch( m_userUnits )
{ {
case INCHES: msg = _( "Inches" ); break; case EDA_UNITS::INCHES:
case MILLIMETRES: msg = _( "mm" ); break; msg = _( "Inches" );
break;
case EDA_UNITS::MILLIMETRES:
msg = _( "mm" );
break;
default: msg = _( "Units" ); break; default: msg = _( "Units" ); break;
} }
@ -461,12 +465,12 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg )
wxConfigBase* cmnCfg = Pgm().CommonSettings(); wxConfigBase* cmnCfg = Pgm().CommonSettings();
// Read units used in dialogs and toolbars // Read units used in dialogs and toolbars
EDA_UNITS_T unitsTmp; EDA_UNITS unitsTmp;
if( aCfg->Read( baseCfgName + UserUnitsEntryKeyword, (int*) &unitsTmp ) ) if( aCfg->Read( baseCfgName + UserUnitsEntryKeyword, (int*) &unitsTmp ) )
SetUserUnits( unitsTmp ); SetUserUnits( unitsTmp );
else else
SetUserUnits( MILLIMETRES ); SetUserUnits( EDA_UNITS::MILLIMETRES );
// Read show/hide grid entry // Read show/hide grid entry
bool btmp; bool btmp;

View File

@ -32,7 +32,7 @@
/* Class to display and edit a coordinated INCHES or MM */ /* Class to display and edit a coordinated INCHES or MM */
/********************************************************/ /********************************************************/
EDA_POSITION_CTRL::EDA_POSITION_CTRL( wxWindow* parent, const wxString& title, const wxPoint& aPos, EDA_POSITION_CTRL::EDA_POSITION_CTRL( wxWindow* parent, const wxString& title, const wxPoint& aPos,
EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer ) EDA_UNITS user_unit, wxBoxSizer* BoxSizer )
{ {
m_UserUnit = user_unit; m_UserUnit = user_unit;
@ -88,8 +88,8 @@ void EDA_POSITION_CTRL::SetValue( int x_value, int y_value )
/* EDA_SIZE_CTRL */ /* EDA_SIZE_CTRL */
/*******************/ /*******************/
EDA_SIZE_CTRL::EDA_SIZE_CTRL( wxWindow* parent, const wxString& title, const wxSize& aSize, EDA_SIZE_CTRL::EDA_SIZE_CTRL( wxWindow* parent, const wxString& title, const wxSize& aSize,
EDA_UNITS_T aUnit, wxBoxSizer* aBoxSizer ) : EDA_UNITS aUnit, wxBoxSizer* aBoxSizer )
EDA_POSITION_CTRL( parent, title, wxPoint( aSize.x, aSize.y ), aUnit, aBoxSizer ) : EDA_POSITION_CTRL( parent, title, wxPoint( aSize.x, aSize.y ), aUnit, aBoxSizer )
{ {
} }

View File

@ -43,7 +43,7 @@ namespace numEval
} /* namespace numEval */ } /* namespace numEval */
NUMERIC_EVALUATOR::NUMERIC_EVALUATOR( EDA_UNITS_T aUnits, bool aUseMils ) NUMERIC_EVALUATOR::NUMERIC_EVALUATOR( EDA_UNITS aUnits, bool aUseMils )
{ {
struct lconv* lc = localeconv(); struct lconv* lc = localeconv();
m_localeDecimalSeparator = *lc->decimal_point; m_localeDecimalSeparator = *lc->decimal_point;
@ -55,13 +55,14 @@ NUMERIC_EVALUATOR::NUMERIC_EVALUATOR( EDA_UNITS_T aUnits, bool aUseMils )
switch( aUnits ) switch( aUnits )
{ {
case INCHES: case EDA_UNITS::INCHES:
if( aUseMils ) if( aUseMils )
m_defaultUnits = Unit::Mil; m_defaultUnits = Unit::Mil;
else else
m_defaultUnits = Unit::Inch; m_defaultUnits = Unit::Inch;
break; break;
case MILLIMETRES:m_defaultUnits = Unit::Metric; case EDA_UNITS::MILLIMETRES:
m_defaultUnits = Unit::Metric;
break; break;
default:m_defaultUnits = Unit::Metric; default:m_defaultUnits = Unit::Metric;
break; break;

View File

@ -103,9 +103,9 @@ MARKER_BASE::MARKER_BASE( int aScalingFactor )
} }
MARKER_BASE::MARKER_BASE( EDA_UNITS_T aUnits, int aErrorCode, const wxPoint& aMarkerPos, MARKER_BASE::MARKER_BASE( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos,
EDA_ITEM* aItem, const wxPoint& aPos, EDA_ITEM* aItem, const wxPoint& aPos, EDA_ITEM* bItem, const wxPoint& bPos,
EDA_ITEM* bItem, const wxPoint& bPos, int aScalingFactor ) int aScalingFactor )
{ {
m_ScalingFactor = aScalingFactor; m_ScalingFactor = aScalingFactor;
init(); init();
@ -140,9 +140,8 @@ MARKER_BASE::~MARKER_BASE()
} }
void MARKER_BASE::SetData( EDA_UNITS_T aUnits, int aErrorCode, const wxPoint& aMarkerPos, void MARKER_BASE::SetData( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos,
EDA_ITEM* aItem, const wxPoint& aPos, EDA_ITEM* aItem, const wxPoint& aPos, EDA_ITEM* bItem, const wxPoint& bPos )
EDA_ITEM* bItem, const wxPoint& bPos )
{ {
m_Pos = aMarkerPos; m_Pos = aMarkerPos;
m_drc.SetData( aUnits, aErrorCode, aItem, aPos, bItem, bPos ); m_drc.SetData( aUnits, aErrorCode, aItem, aPos, bItem, bPos );

View File

@ -95,7 +95,7 @@ bool WS_DRAW_ITEM_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aAc
} }
void WS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) void WS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
{ {
wxString msg; wxString msg;
WS_DATA_ITEM* dataItem = GetPeer(); WS_DATA_ITEM* dataItem = GetPeer();
@ -137,10 +137,10 @@ void WS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aL
aList.push_back( MSG_PANEL_ITEM( _( "First Page Option" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "First Page Option" ), msg, BROWN ) );
msg = MessageTextFromValue( UNSCALED_UNITS, dataItem->m_RepeatCount ); msg = MessageTextFromValue( EDA_UNITS::UNSCALED, dataItem->m_RepeatCount );
aList.push_back( MSG_PANEL_ITEM( _( "Repeat Count" ), msg, BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Repeat Count" ), msg, BLUE ) );
msg = MessageTextFromValue( UNSCALED_UNITS, dataItem->m_IncrementLabel ); msg = MessageTextFromValue( EDA_UNITS::UNSCALED, dataItem->m_IncrementLabel );
aList.push_back( MSG_PANEL_ITEM( _( "Repeat Label Increment" ), msg, DARKGRAY ) ); aList.push_back( MSG_PANEL_ITEM( _( "Repeat Label Increment" ), msg, DARKGRAY ) );
msg.Printf( wxT( "(%s, %s)" ), msg.Printf( wxT( "(%s, %s)" ),
@ -179,7 +179,7 @@ bool WS_DRAW_ITEM_TEXT::HitTest( const EDA_RECT& aRect, bool aContains, int aAcc
} }
wxString WS_DRAW_ITEM_TEXT::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString WS_DRAW_ITEM_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Text %s at (%s, %s)" ), return wxString::Format( _( "Text %s at (%s, %s)" ),
GetShownText(), GetShownText(),
@ -279,7 +279,7 @@ bool WS_DRAW_ITEM_POLYPOLYGONS::HitTest( const EDA_RECT& aRect, bool aContained,
} }
wxString WS_DRAW_ITEM_POLYPOLYGONS::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString WS_DRAW_ITEM_POLYPOLYGONS::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Imported shape at (%s, %s)" ), return wxString::Format( _( "Imported shape at (%s, %s)" ),
MessageTextFromValue( aUnits, GetPosition().x ), MessageTextFromValue( aUnits, GetPosition().x ),
@ -336,7 +336,7 @@ bool WS_DRAW_ITEM_RECT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
} }
wxString WS_DRAW_ITEM_RECT::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString WS_DRAW_ITEM_RECT::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Rectangle from (%s, %s) to (%s, %s)" ), return wxString::Format( _( "Rectangle from (%s, %s) to (%s, %s)" ),
MessageTextFromValue( aUnits, GetStart().x ), MessageTextFromValue( aUnits, GetStart().x ),
@ -367,7 +367,7 @@ bool WS_DRAW_ITEM_LINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
} }
wxString WS_DRAW_ITEM_LINE::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString WS_DRAW_ITEM_LINE::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Line from (%s, %s) to (%s, %s)" ), return wxString::Format( _( "Line from (%s, %s) to (%s, %s)" ),
MessageTextFromValue( aUnits, GetStart().x ), MessageTextFromValue( aUnits, GetStart().x ),
@ -420,7 +420,7 @@ bool WS_DRAW_ITEM_BITMAP::HitTest( const EDA_RECT& aRect, bool aContains, int aA
} }
wxString WS_DRAW_ITEM_BITMAP::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString WS_DRAW_ITEM_BITMAP::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Image at (%s, %s)" ), return wxString::Format( _( "Image at (%s, %s)" ),
MessageTextFromValue( aUnits, GetPosition().x ), MessageTextFromValue( aUnits, GetPosition().x ),
@ -428,7 +428,7 @@ wxString WS_DRAW_ITEM_BITMAP::GetSelectMenuText( EDA_UNITS_T aUnits ) const
} }
wxString WS_DRAW_ITEM_PAGE::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString WS_DRAW_ITEM_PAGE::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
wxString txt( "Page limits" ); wxString txt( "Page limits" );
return txt; return txt;

View File

@ -128,12 +128,12 @@ void DXF_PLOTTER::SetUnits( DXF_UNITS aUnit )
switch( aUnit ) switch( aUnit )
{ {
case DXF_UNIT_MILLIMETERS: case DXF_UNITS::MILLIMETERS:
m_unitScalingFactor = 0.00254; m_unitScalingFactor = 0.00254;
m_measurementDirective = 1; m_measurementDirective = 1;
break; break;
case DXF_UNIT_INCHES: case DXF_UNITS::INCHES:
default: default:
m_unitScalingFactor = 0.0001; m_unitScalingFactor = 0.0001;
m_measurementDirective = 0; m_measurementDirective = 0;

View File

@ -34,10 +34,8 @@
using namespace KIGFX::PREVIEW; using namespace KIGFX::PREVIEW;
ARC_ASSISTANT::ARC_ASSISTANT( const ARC_GEOM_MANAGER& aManager, EDA_UNITS_T aUnits ) : ARC_ASSISTANT::ARC_ASSISTANT( const ARC_GEOM_MANAGER& aManager, EDA_UNITS aUnits )
EDA_ITEM( NOT_USED ), : EDA_ITEM( NOT_USED ), m_constructMan( aManager ), m_units( aUnits )
m_constructMan( aManager ),
m_units( aUnits )
{ {
} }
@ -131,7 +129,8 @@ void ARC_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
double degs = getNormDeciDegFromRad( initAngle ); double degs = getNormDeciDegFromRad( initAngle );
cursorStrings.push_back( DimensionLabel( "r", m_constructMan.GetRadius(), m_units ) ); cursorStrings.push_back( DimensionLabel( "r", m_constructMan.GetRadius(), m_units ) );
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), degs, DEGREES ) ); cursorStrings.push_back(
DimensionLabel( wxString::FromUTF8( "θ" ), degs, EDA_UNITS::DEGREES ) );
} }
else else
{ {
@ -148,8 +147,10 @@ void ARC_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
// draw dimmed extender line to cursor // draw dimmed extender line to cursor
preview_ctx.DrawLineWithAngleHighlight( origin, m_constructMan.GetLastPoint(), true ); preview_ctx.DrawLineWithAngleHighlight( origin, m_constructMan.GetLastPoint(), true );
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "Δθ" ), subtendedDeg, DEGREES ) ); cursorStrings.push_back(
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), endAngleDeg, DEGREES ) ); DimensionLabel( wxString::FromUTF8( "Δθ" ), subtendedDeg, EDA_UNITS::DEGREES ) );
cursorStrings.push_back(
DimensionLabel( wxString::FromUTF8( "θ" ), endAngleDeg, EDA_UNITS::DEGREES ) );
} }
// place the text next to cursor, on opposite side from radius // place the text next to cursor, on opposite side from radius

View File

@ -29,7 +29,7 @@ double KIGFX::PREVIEW::PreviewOverlayDeemphAlpha( bool aDeemph )
} }
static wxString formatPreviewDimension( double aVal, EDA_UNITS_T aUnits ) static wxString formatPreviewDimension( double aVal, EDA_UNITS aUnits )
{ {
int precision = 4; int precision = 4;
@ -37,23 +37,23 @@ static wxString formatPreviewDimension( double aVal, EDA_UNITS_T aUnits )
// be accurate down to the nanometre // be accurate down to the nanometre
switch( aUnits ) switch( aUnits )
{ {
case MILLIMETRES: case EDA_UNITS::MILLIMETRES:
precision = 3; // 1um precision = 3; // 1um
break; break;
case INCHES: case EDA_UNITS::INCHES:
precision = 4; // 0.1mil precision = 4; // 0.1mil
break; break;
case DEGREES: case EDA_UNITS::DEGREES:
precision = 1; // 0.1deg precision = 1; // 0.1deg
break; break;
case PERCENT: case EDA_UNITS::PERCENT:
precision = 1; // 0.1% precision = 1; // 0.1%
break; break;
case UNSCALED_UNITS: case EDA_UNITS::UNSCALED:
break; break;
} }
@ -70,8 +70,7 @@ static wxString formatPreviewDimension( double aVal, EDA_UNITS_T aUnits )
} }
wxString KIGFX::PREVIEW::DimensionLabel( const wxString& prefix, wxString KIGFX::PREVIEW::DimensionLabel( const wxString& prefix, double aVal, EDA_UNITS aUnits )
double aVal, EDA_UNITS_T aUnits )
{ {
wxString str; wxString str;

View File

@ -39,8 +39,8 @@ static const double midTickLengthFactor = 1.5;
static const double majorTickLengthFactor = 2.5; static const double majorTickLengthFactor = 2.5;
static void drawCursorStrings( KIGFX::VIEW* aView, const VECTOR2D& aCursor, static void drawCursorStrings(
const VECTOR2D& aRulerVec, EDA_UNITS_T aUnits ) KIGFX::VIEW* aView, const VECTOR2D& aCursor, const VECTOR2D& aRulerVec, EDA_UNITS aUnits )
{ {
// draw the cursor labels // draw the cursor labels
std::vector<wxString> cursorStrings; std::vector<wxString> cursorStrings;
@ -51,7 +51,8 @@ static void drawCursorStrings( KIGFX::VIEW* aView, const VECTOR2D& aCursor,
cursorStrings.push_back( DimensionLabel( "r", aRulerVec.EuclideanNorm(), aUnits ) ); cursorStrings.push_back( DimensionLabel( "r", aRulerVec.EuclideanNorm(), aUnits ) );
double degs = RAD2DECIDEG( -aRulerVec.Angle() ); double degs = RAD2DECIDEG( -aRulerVec.Angle() );
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), degs, DEGREES ) ); cursorStrings.push_back(
DimensionLabel( wxString::FromUTF8( "θ" ), degs, EDA_UNITS::DEGREES ) );
auto temp = aRulerVec; auto temp = aRulerVec;
DrawTextNextToCursor( aView, aCursor, -temp, cursorStrings ); DrawTextNextToCursor( aView, aCursor, -temp, cursorStrings );
@ -70,7 +71,7 @@ struct TICK_FORMAT
}; };
static TICK_FORMAT getTickFormatForScale( double aScale, double& aTickSpace, EDA_UNITS_T aUnits ) static TICK_FORMAT getTickFormatForScale( double aScale, double& aTickSpace, EDA_UNITS aUnits )
{ {
// simple 1/2/5 scales per decade // simple 1/2/5 scales per decade
static std::vector<TICK_FORMAT> tickFormats = static std::vector<TICK_FORMAT> tickFormats =
@ -84,7 +85,7 @@ static TICK_FORMAT getTickFormatForScale( double aScale, double& aTickSpace, EDA
aTickSpace = 1; aTickSpace = 1;
// convert to a round (mod-10) number of mils // convert to a round (mod-10) number of mils
if( aUnits == INCHES ) if( aUnits == EDA_UNITS::INCHES )
{ {
aTickSpace *= 2.54; aTickSpace *= 2.54;
} }
@ -115,8 +116,8 @@ static TICK_FORMAT getTickFormatForScale( double aScale, double& aTickSpace, EDA
* @param aLine line vector * @param aLine line vector
* @param aMinorTickLen length of minor ticks in IU * @param aMinorTickLen length of minor ticks in IU
*/ */
void drawTicksAlongLine( KIGFX::VIEW *aView, const VECTOR2D& aOrigin, void drawTicksAlongLine( KIGFX::VIEW* aView, const VECTOR2D& aOrigin, const VECTOR2D& aLine,
const VECTOR2D& aLine, double aMinorTickLen, EDA_UNITS_T aUnits ) double aMinorTickLen, EDA_UNITS aUnits )
{ {
VECTOR2D tickLine = aLine.Rotate( -M_PI_2 ); VECTOR2D tickLine = aLine.Rotate( -M_PI_2 );
auto gal = aView->GetGAL(); auto gal = aView->GetGAL();
@ -198,11 +199,12 @@ void drawBacksideTicks( KIGFX::GAL& aGal, const VECTOR2D& aOrigin,
} }
RULER_ITEM::RULER_ITEM( const TWO_POINT_GEOMETRY_MANAGER& aGeomMgr, EDA_UNITS_T userUnits ): RULER_ITEM::RULER_ITEM( const TWO_POINT_GEOMETRY_MANAGER& aGeomMgr, EDA_UNITS userUnits )
EDA_ITEM( NOT_USED ), // Never added to anything - just a preview : EDA_ITEM( NOT_USED ), // Never added to anything - just a preview
m_geomMgr( aGeomMgr ), m_geomMgr( aGeomMgr ),
m_userUnits( userUnits ) m_userUnits( userUnits )
{} {
}
const BOX2I RULER_ITEM::ViewBBox() const const BOX2I RULER_ITEM::ViewBBox() const

View File

@ -447,21 +447,23 @@ int COMMON_TOOLS::GridProperties( const TOOL_EVENT& aEvent )
int COMMON_TOOLS::MetricUnits( const TOOL_EVENT& aEvent ) int COMMON_TOOLS::MetricUnits( const TOOL_EVENT& aEvent )
{ {
m_frame->ChangeUserUnits( MILLIMETRES ); m_frame->ChangeUserUnits( EDA_UNITS::MILLIMETRES );
return 0; return 0;
} }
int COMMON_TOOLS::ImperialUnits( const TOOL_EVENT& aEvent ) int COMMON_TOOLS::ImperialUnits( const TOOL_EVENT& aEvent )
{ {
m_frame->ChangeUserUnits( INCHES ); m_frame->ChangeUserUnits( EDA_UNITS::INCHES );
return 0; return 0;
} }
int COMMON_TOOLS::ToggleUnits( const TOOL_EVENT& aEvent ) int COMMON_TOOLS::ToggleUnits( const TOOL_EVENT& aEvent )
{ {
m_frame->ChangeUserUnits( m_frame->GetUserUnits() == INCHES ? MILLIMETRES : INCHES ); m_frame->ChangeUserUnits( m_frame->GetUserUnits() == EDA_UNITS::INCHES ?
EDA_UNITS::MILLIMETRES :
EDA_UNITS::INCHES );
return 0; return 0;
} }

View File

@ -43,7 +43,7 @@ GRID_MENU::GRID_MENU( EDA_DRAW_FRAME* aParent ) :
SetIcon( grid_select_xpm ); SetIcon( grid_select_xpm );
wxArrayString gridsList; wxArrayString gridsList;
screen->BuildGridsChoiceList( gridsList, m_parent->GetUserUnits() != INCHES ); screen->BuildGridsChoiceList( gridsList, m_parent->GetUserUnits() != EDA_UNITS::INCHES );
for( unsigned int i = 0; i < gridsList.GetCount(); ++i ) for( unsigned int i = 0; i < gridsList.GetCount(); ++i )
{ {
@ -69,7 +69,7 @@ void GRID_MENU::update()
int currentId = screen->GetGridCmdId(); int currentId = screen->GetGridCmdId();
wxArrayString gridsList; wxArrayString gridsList;
screen->BuildGridsChoiceList( gridsList, m_parent->GetUserUnits() != INCHES ); screen->BuildGridsChoiceList( gridsList, m_parent->GetUserUnits() != EDA_UNITS::INCHES );
for( unsigned int i = 0; i < GetMenuItemCount(); ++i ) for( unsigned int i = 0; i < GetMenuItemCount(); ++i )
{ {

View File

@ -24,18 +24,16 @@
#include <widgets/text_ctrl_eval.h> #include <widgets/text_ctrl_eval.h>
TEXT_CTRL_EVAL::TEXT_CTRL_EVAL( wxWindow* aParent, wxWindowID aId, const TEXT_CTRL_EVAL::TEXT_CTRL_EVAL( wxWindow* aParent, wxWindowID aId, const wxString& aValue,
wxString& aValue, const wxPoint& aPos, const wxSize& aSize, long aStyle, const wxPoint& aPos, const wxSize& aSize, long aStyle, const wxValidator& aValidator,
const wxValidator& aValidator, const wxString& aName ) const wxString& aName )
: wxTextCtrl( aParent, aId, aValue, aPos, aSize, aStyle | wxTE_PROCESS_ENTER, aValidator, aName ), : wxTextCtrl( aParent, aId, aValue, aPos, aSize, aStyle | wxTE_PROCESS_ENTER, aValidator,
m_eval( UNSCALED_UNITS ) aName ),
m_eval( EDA_UNITS::UNSCALED )
{ {
Connect( wxEVT_SET_FOCUS, Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( TEXT_CTRL_EVAL::onTextFocusGet ), NULL, this );
wxFocusEventHandler( TEXT_CTRL_EVAL::onTextFocusGet ), NULL, this ); Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( TEXT_CTRL_EVAL::onTextFocusLost ), NULL, this );
Connect( wxEVT_KILL_FOCUS, Connect( wxEVT_TEXT_ENTER, wxCommandEventHandler( TEXT_CTRL_EVAL::onTextEnter ), NULL, this );
wxFocusEventHandler( TEXT_CTRL_EVAL::onTextFocusLost ), NULL, this );
Connect( wxEVT_TEXT_ENTER,
wxCommandEventHandler( TEXT_CTRL_EVAL::onTextEnter ), NULL, this );
} }

View File

@ -65,7 +65,7 @@ UNIT_BINDER::UNIT_BINDER( EDA_DRAW_FRAME* aParent,
} }
void UNIT_BINDER::SetUnits( EDA_UNITS_T aUnits, bool aUseMils ) void UNIT_BINDER::SetUnits( EDA_UNITS aUnits, bool aUseMils )
{ {
m_units = aUnits; m_units = aUnits;
m_useMils = aUseMils; m_useMils = aUseMils;

View File

@ -435,8 +435,8 @@ void DISPLAY_FOOTPRINTS_FRAME::SyncToolbars()
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() ); m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
m_optionsToolBar->Toggle( ACTIONS::selectionTool, IsCurrentTool( ACTIONS::selectionTool ) ); m_optionsToolBar->Toggle( ACTIONS::selectionTool, IsCurrentTool( ACTIONS::selectionTool ) );
m_optionsToolBar->Toggle( ACTIONS::measureTool, IsCurrentTool( ACTIONS::measureTool ) ); m_optionsToolBar->Toggle( ACTIONS::measureTool, IsCurrentTool( ACTIONS::measureTool ) );
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES ); m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != EDA_UNITS::INCHES );
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES ); m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == EDA_UNITS::INCHES );
m_optionsToolBar->Refresh(); m_optionsToolBar->Refresh();
} }

View File

@ -821,7 +821,7 @@ void CONNECTION_GRAPH::buildConnectionGraph()
} }
default: default:
wxLogTrace( "CONN", "Driver type unsupported: %s", wxLogTrace( "CONN", "Driver type unsupported: %s",
driver->GetSelectMenuText( MILLIMETRES ) ); driver->GetSelectMenuText( EDA_UNITS::MILLIMETRES ) );
break; break;
} }
@ -893,7 +893,7 @@ void CONNECTION_GRAPH::buildConnectionGraph()
} }
default: default:
wxLogTrace( "CONN", "Unexpected strong driver %s", wxLogTrace( "CONN", "Unexpected strong driver %s",
driver->GetSelectMenuText( MILLIMETRES ) ); driver->GetSelectMenuText( EDA_UNITS::MILLIMETRES ) );
break; break;
} }
} }

View File

@ -68,7 +68,7 @@ public:
* Function DisplayList(); * Function DisplayList();
* Build the Html marker list and show it * Build the Html marker list and show it
*/ */
void DisplayList( EDA_UNITS_T aUnits ) void DisplayList( EDA_UNITS aUnits )
{ {
wxString htmlpage; wxString htmlpage;
wxColour bgcolor = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ); wxColour bgcolor = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW );

View File

@ -311,7 +311,7 @@ int DIALOG_ANNOTATE::GetAnnotateAlgo()
int DIALOG_ANNOTATE::GetStartNumber() int DIALOG_ANNOTATE::GetStartNumber()
{ {
return ValueFromString( EDA_UNITS_T::UNSCALED_UNITS, m_textNumberAfter->GetValue() ); return ValueFromString( EDA_UNITS::UNSCALED, m_textNumberAfter->GetValue() );
} }

View File

@ -58,13 +58,13 @@ private:
// contains only a single pin. // contains only a single pin.
std::vector<LIB_PINS> m_rows; std::vector<LIB_PINS> m_rows;
EDA_UNITS_T m_userUnits; EDA_UNITS m_userUnits;
bool m_edited; bool m_edited;
public: public:
PIN_TABLE_DATA_MODEL( EDA_UNITS_T aUserUnits ) : PIN_TABLE_DATA_MODEL( EDA_UNITS aUserUnits ) : m_userUnits( aUserUnits ), m_edited( false )
m_userUnits( aUserUnits ), m_edited( false ) {
{} }
int GetNumberRows() override { return (int) m_rows.size(); } int GetNumberRows() override { return (int) m_rows.size(); }
int GetNumberCols() override { return COL_COUNT; } int GetNumberCols() override { return COL_COUNT; }
@ -97,7 +97,7 @@ public:
return GetValue( m_rows[ aRow ], aCol, m_userUnits ); return GetValue( m_rows[ aRow ], aCol, m_userUnits );
} }
static wxString GetValue( const LIB_PINS& pins, int aCol, EDA_UNITS_T aUserUnits ) static wxString GetValue( const LIB_PINS& pins, int aCol, EDA_UNITS aUserUnits )
{ {
wxString fieldValue; wxString fieldValue;
@ -232,8 +232,8 @@ public:
return -1; return -1;
} }
static bool compare( const LIB_PINS& lhs, const LIB_PINS& rhs, static bool compare(
int sortCol, bool ascending, EDA_UNITS_T units ) const LIB_PINS& lhs, const LIB_PINS& rhs, int sortCol, bool ascending, EDA_UNITS units )
{ {
wxString lhStr = GetValue( lhs, sortCol, units ); wxString lhStr = GetValue( lhs, sortCol, units );
wxString rhStr = GetValue( rhs, sortCol, units ); wxString rhStr = GetValue( rhs, sortCol, units );

View File

@ -67,9 +67,9 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataToWindow()
m_choiceSeparatorRefId->SetSelection( refStyleSelection ); m_choiceSeparatorRefId->SetSelection( refStyleSelection );
m_busWidth.SetUnits( INCHES, true ); m_busWidth.SetUnits( EDA_UNITS::INCHES, true );
m_wireWidth.SetUnits( INCHES, true ); m_wireWidth.SetUnits( EDA_UNITS::INCHES, true );
m_junctionSize.SetUnits( INCHES, true ); m_junctionSize.SetUnits( EDA_UNITS::INCHES, true );
m_busWidth.SetValue( GetDefaultBusThickness() ); m_busWidth.SetValue( GetDefaultBusThickness() );
m_wireWidth.SetValue( GetDefaultWireThickness() ); m_wireWidth.SetValue( GetDefaultWireThickness() );

View File

@ -37,11 +37,14 @@ PANEL_EESCHEMA_SETTINGS::PANEL_EESCHEMA_SETTINGS( SCH_EDIT_FRAME* aFrame, wxWind
bool PANEL_EESCHEMA_SETTINGS::TransferDataToWindow() bool PANEL_EESCHEMA_SETTINGS::TransferDataToWindow()
{ {
m_choiceUnits->SetSelection( m_frame->GetUserUnits() == INCHES ? 0 : 1 ); m_choiceUnits->SetSelection( m_frame->GetUserUnits() == EDA_UNITS::INCHES ? 0 : 1 );
m_textSizeCtrl->SetValue( StringFromValue( INCHES, GetDefaultTextSize(), false, true ) ); m_textSizeCtrl->SetValue(
m_hPitchCtrl->SetValue( StringFromValue( INCHES, m_frame->GetRepeatStep().x, false, true ) ); StringFromValue( EDA_UNITS::INCHES, GetDefaultTextSize(), false, true ) );
m_vPitchCtrl->SetValue( StringFromValue( INCHES, m_frame->GetRepeatStep().y, false, true ) ); m_hPitchCtrl->SetValue(
StringFromValue( EDA_UNITS::INCHES, m_frame->GetRepeatStep().x, false, true ) );
m_vPitchCtrl->SetValue(
StringFromValue( EDA_UNITS::INCHES, m_frame->GetRepeatStep().y, false, true ) );
m_spinRepeatLabel->SetValue( m_frame->GetRepeatDeltaLabel() ); m_spinRepeatLabel->SetValue( m_frame->GetRepeatDeltaLabel() );
m_checkHVOrientation->SetValue( m_frame->GetForceHVLines() ); m_checkHVOrientation->SetValue( m_frame->GetForceHVLines() );
@ -61,9 +64,10 @@ bool PANEL_EESCHEMA_SETTINGS::TransferDataToWindow()
bool PANEL_EESCHEMA_SETTINGS::TransferDataFromWindow() bool PANEL_EESCHEMA_SETTINGS::TransferDataFromWindow()
{ {
m_frame->SetUserUnits( m_choiceUnits->GetSelection() == 0 ? INCHES : MILLIMETRES ); m_frame->SetUserUnits(
m_choiceUnits->GetSelection() == 0 ? EDA_UNITS::INCHES : EDA_UNITS::MILLIMETRES );
int textSize = ValueFromString( INCHES, m_textSizeCtrl->GetValue(), true ); int textSize = ValueFromString( EDA_UNITS::INCHES, m_textSizeCtrl->GetValue(), true );
if( textSize != GetDefaultTextSize() ) if( textSize != GetDefaultTextSize() )
{ {
@ -71,8 +75,9 @@ bool PANEL_EESCHEMA_SETTINGS::TransferDataFromWindow()
m_frame->SaveProjectSettings( false ); m_frame->SaveProjectSettings( false );
} }
m_frame->SetRepeatStep( wxPoint( ValueFromString( INCHES, m_hPitchCtrl->GetValue(), true ), m_frame->SetRepeatStep(
ValueFromString( INCHES, m_vPitchCtrl->GetValue(), true ) ) ); wxPoint( ValueFromString( EDA_UNITS::INCHES, m_hPitchCtrl->GetValue(), true ),
ValueFromString( EDA_UNITS::INCHES, m_vPitchCtrl->GetValue(), true ) ) );
m_frame->SetRepeatDeltaLabel( m_spinRepeatLabel->GetValue() ); m_frame->SetRepeatDeltaLabel( m_spinRepeatLabel->GetValue() );
m_frame->SetForceHVLines( m_checkHVOrientation->GetValue() ); m_frame->SetForceHVLines( m_checkHVOrientation->GetValue() );

View File

@ -39,12 +39,18 @@ PANEL_LIBEDIT_SETTINGS::PANEL_LIBEDIT_SETTINGS( LIB_EDIT_FRAME* aFrame, wxWindow
bool PANEL_LIBEDIT_SETTINGS::TransferDataToWindow() bool PANEL_LIBEDIT_SETTINGS::TransferDataToWindow()
{ {
m_lineWidthCtrl->SetValue( StringFromValue( INCHES, GetDefaultLineThickness(), false, true ) ); m_lineWidthCtrl->SetValue(
m_pinLengthCtrl->SetValue( StringFromValue( INCHES, m_frame->GetDefaultPinLength(), false, true ) ); StringFromValue( EDA_UNITS::INCHES, GetDefaultLineThickness(), false, true ) );
m_pinNumSizeCtrl->SetValue( StringFromValue( INCHES, m_frame->GetPinNumDefaultSize(), false, true ) ); m_pinLengthCtrl->SetValue(
m_pinNameSizeCtrl->SetValue( StringFromValue( INCHES, m_frame->GetPinNameDefaultSize(), false, true ) ); StringFromValue( EDA_UNITS::INCHES, m_frame->GetDefaultPinLength(), false, true ) );
m_hPitchCtrl->SetValue( StringFromValue( INCHES, m_frame->GetRepeatStep().x, false, true ) ); m_pinNumSizeCtrl->SetValue(
m_vPitchCtrl->SetValue( StringFromValue( INCHES, m_frame->GetRepeatStep().y, false, true ) ); StringFromValue( EDA_UNITS::INCHES, m_frame->GetPinNumDefaultSize(), false, true ) );
m_pinNameSizeCtrl->SetValue(
StringFromValue( EDA_UNITS::INCHES, m_frame->GetPinNameDefaultSize(), false, true ) );
m_hPitchCtrl->SetValue(
StringFromValue( EDA_UNITS::INCHES, m_frame->GetRepeatStep().x, false, true ) );
m_vPitchCtrl->SetValue(
StringFromValue( EDA_UNITS::INCHES, m_frame->GetRepeatStep().y, false, true ) );
m_choicePinDisplacement->SetSelection( m_frame->GetRepeatPinStep() == 50 ? 1 : 0 ); m_choicePinDisplacement->SetSelection( m_frame->GetRepeatPinStep() == 50 ? 1 : 0 );
m_spinRepeatLabel->SetValue( m_frame->GetRepeatDeltaLabel() ); m_spinRepeatLabel->SetValue( m_frame->GetRepeatDeltaLabel() );
@ -56,12 +62,17 @@ bool PANEL_LIBEDIT_SETTINGS::TransferDataToWindow()
bool PANEL_LIBEDIT_SETTINGS::TransferDataFromWindow() bool PANEL_LIBEDIT_SETTINGS::TransferDataFromWindow()
{ {
SetDefaultLineThickness( ValueFromString( INCHES, m_lineWidthCtrl->GetValue(), true ) ); SetDefaultLineThickness(
m_frame->SetDefaultPinLength( ValueFromString( INCHES, m_pinLengthCtrl->GetValue(), true ) ); ValueFromString( EDA_UNITS::INCHES, m_lineWidthCtrl->GetValue(), true ) );
m_frame->SetPinNumDefaultSize( ValueFromString( INCHES, m_pinNumSizeCtrl->GetValue(), true ) ); m_frame->SetDefaultPinLength(
m_frame->SetPinNameDefaultSize( ValueFromString( INCHES, m_pinNameSizeCtrl->GetValue(), true ) ); ValueFromString( EDA_UNITS::INCHES, m_pinLengthCtrl->GetValue(), true ) );
m_frame->SetRepeatStep( wxPoint( ValueFromString( INCHES, m_hPitchCtrl->GetValue(), true ), m_frame->SetPinNumDefaultSize(
ValueFromString( INCHES, m_vPitchCtrl->GetValue(), true ) ) ); ValueFromString( EDA_UNITS::INCHES, m_pinNumSizeCtrl->GetValue(), true ) );
m_frame->SetPinNameDefaultSize(
ValueFromString( EDA_UNITS::INCHES, m_pinNameSizeCtrl->GetValue(), true ) );
m_frame->SetRepeatStep(
wxPoint( ValueFromString( EDA_UNITS::INCHES, m_hPitchCtrl->GetValue(), true ),
ValueFromString( EDA_UNITS::INCHES, m_vPitchCtrl->GetValue(), true ) ) );
m_frame->SetRepeatPinStep( m_choicePinDisplacement->GetSelection() == 1 ? 50 : 100 ); m_frame->SetRepeatPinStep( m_choicePinDisplacement->GetSelection() == 1 ? 50 : 100 );
m_frame->SetRepeatDeltaLabel( m_spinRepeatLabel->GetValue() ); m_frame->SetRepeatDeltaLabel( m_spinRepeatLabel->GetValue() );

View File

@ -84,7 +84,7 @@ wxString DRC_ITEM::GetErrorText() const
} }
} }
wxString DRC_ITEM::ShowCoord( EDA_UNITS_T aUnits, const wxPoint& aPos ) wxString DRC_ITEM::ShowCoord( EDA_UNITS aUnits, const wxPoint& aPos )
{ {
return wxString::Format( "@(%s, %s)", return wxString::Format( "@(%s, %s)",
MessageTextFromValue( aUnits, aPos.x ), MessageTextFromValue( aUnits, aPos.x ),
@ -92,7 +92,7 @@ wxString DRC_ITEM::ShowCoord( EDA_UNITS_T aUnits, const wxPoint& aPos )
} }
wxString DRC_ITEM::ShowHtml( EDA_UNITS_T aUnits ) const wxString DRC_ITEM::ShowHtml( EDA_UNITS aUnits ) const
{ {
wxString mainText = m_MainText; wxString mainText = m_MainText;
// a wxHtmlWindows does not like < and > in the text to display // a wxHtmlWindows does not like < and > in the text to display
@ -138,7 +138,7 @@ wxString DRC_ITEM::ShowHtml( EDA_UNITS_T aUnits ) const
} }
wxString DRC_ITEM::ShowReport( EDA_UNITS_T aUnits ) const wxString DRC_ITEM::ShowReport( EDA_UNITS aUnits ) const
{ {
if( m_hasSecondItem ) if( m_hasSecondItem )
{ {

View File

@ -349,8 +349,8 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings()
m_configSettings.push_back( new PARAM_CFG_BOOL( true, ShowPageLimitsEntry, m_configSettings.push_back( new PARAM_CFG_BOOL( true, ShowPageLimitsEntry,
&m_showPageLimits, true ) ); &m_showPageLimits, true ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, UnitsEntry, m_configSettings.push_back( new PARAM_CFG_INT(
(int*)&m_userUnits, MILLIMETRES ) ); true, UnitsEntry, (int*) &m_userUnits, (int) EDA_UNITS::MILLIMETRES ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, PrintMonochromeEntry, m_configSettings.push_back( new PARAM_CFG_BOOL( true, PrintMonochromeEntry,
&m_printMonochrome, true ) ); &m_printMonochrome, true ) );

View File

@ -566,7 +566,7 @@ int NETLIST_OBJECT_LIST::CountPinsInNet( unsigned aNetStart )
return count; return count;
} }
bool WriteDiagnosticERC( EDA_UNITS_T aUnits, const wxString& aFullFileName ) bool WriteDiagnosticERC( EDA_UNITS aUnits, const wxString& aFullFileName )
{ {
wxFFile file( aFullFileName, wxT( "wt" ) ); wxFFile file( aFullFileName, wxT( "wt" ) );

View File

@ -88,7 +88,7 @@ enum ERCE_T
* *
* @param aFullFileName A wxString object containing the file name and path. * @param aFullFileName A wxString object containing the file name and path.
*/ */
bool WriteDiagnosticERC( EDA_UNITS_T aUnits, const wxString& aFullFileName ); bool WriteDiagnosticERC( EDA_UNITS aUnits, const wxString& aFullFileName );
/** /**
* Performs ERC testing and creates an ERC marker to show the ERC problem for aNetItemRef * Performs ERC testing and creates an ERC marker to show the ERC problem for aNetItemRef

View File

@ -100,7 +100,7 @@ public:
private: private:
SCH_BASE_FRAME* m_frame; SCH_BASE_FRAME* m_frame;
EDA_UNITS_T m_userUnits; EDA_UNITS m_userUnits;
LIB_PART* m_part; LIB_PART* m_part;
SCH_FIELD_VALIDATOR m_fieldNameValidator; SCH_FIELD_VALIDATOR m_fieldNameValidator;

View File

@ -388,7 +388,7 @@ const EDA_RECT LIB_ARC::GetBoundingBox() const
} }
void LIB_ARC::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) void LIB_ARC::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList )
{ {
wxString msg; wxString msg;
EDA_RECT bBox = GetBoundingBox(); EDA_RECT bBox = GetBoundingBox();
@ -406,7 +406,7 @@ void LIB_ARC::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >
} }
wxString LIB_ARC::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString LIB_ARC::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Arc center (%s, %s), radius %s" ), return wxString::Format( _( "Arc center (%s, %s), radius %s" ),
MessageTextFromValue( aUnits, m_Pos.x ), MessageTextFromValue( aUnits, m_Pos.x ),

View File

@ -75,7 +75,7 @@ public:
const EDA_RECT GetBoundingBox() const override; const EDA_RECT GetBoundingBox() const override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
int GetPenSize() const override; int GetPenSize() const override;
@ -122,7 +122,7 @@ public:
void CalcRadiusAngles(); void CalcRadiusAngles();
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
BITMAP_DEF GetMenuImage() const override; BITMAP_DEF GetMenuImage() const override;

View File

@ -332,7 +332,7 @@ const EDA_RECT LIB_BEZIER::GetBoundingBox() const
} }
void LIB_BEZIER::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) void LIB_BEZIER::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList )
{ {
wxString msg; wxString msg;
EDA_RECT bBox = GetBoundingBox(); EDA_RECT bBox = GetBoundingBox();

View File

@ -94,7 +94,7 @@ public:
int GetPenSize( ) const override; int GetPenSize( ) const override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
EDA_ITEM* Clone() const override; EDA_ITEM* Clone() const override;

View File

@ -228,7 +228,7 @@ const EDA_RECT LIB_CIRCLE::GetBoundingBox() const
} }
void LIB_CIRCLE::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) void LIB_CIRCLE::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
{ {
wxString msg; wxString msg;
EDA_RECT bBox = GetBoundingBox(); EDA_RECT bBox = GetBoundingBox();
@ -252,7 +252,7 @@ void LIB_CIRCLE::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList )
} }
wxString LIB_CIRCLE::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString LIB_CIRCLE::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Circle center (%s, %s), radius %s" ), return wxString::Format( _( "Circle center (%s, %s), radius %s" ),
MessageTextFromValue( aUnits, m_Pos.x ), MessageTextFromValue( aUnits, m_Pos.x ),

View File

@ -61,7 +61,7 @@ public:
const EDA_RECT GetBoundingBox() const override; const EDA_RECT GetBoundingBox() const override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
void BeginEdit( const wxPoint aStartPoint ) override; void BeginEdit( const wxPoint aStartPoint ) override;
void CalcEdit( const wxPoint& aPosition ) override; void CalcEdit( const wxPoint& aPosition ) override;
@ -90,7 +90,7 @@ public:
void SetRadius( int aRadius ) { m_EndPos = wxPoint( m_Pos.x + aRadius, m_Pos.y ); } void SetRadius( int aRadius ) { m_EndPos = wxPoint( m_Pos.x + aRadius, m_Pos.y ); }
int GetRadius() const { return KiROUND( GetLineLength( m_EndPos, m_Pos ) ); } int GetRadius() const { return KiROUND( GetLineLength( m_EndPos, m_Pos ) ); }
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
BITMAP_DEF GetMenuImage() const override; BITMAP_DEF GetMenuImage() const override;

View File

@ -408,7 +408,7 @@ void LIB_FIELD::SetName( const wxString& aName )
} }
wxString LIB_FIELD::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString LIB_FIELD::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Field %s \"%s\"" ), GetName(), ShortenedShownText() ); return wxString::Format( _( "Field %s \"%s\"" ), GetName(), ShortenedShownText() );
} }
@ -426,7 +426,7 @@ void LIB_FIELD::CalcEdit( const wxPoint& aPosition )
} }
void LIB_FIELD::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) void LIB_FIELD::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
{ {
wxString msg; wxString msg;

View File

@ -148,7 +148,7 @@ public:
const EDA_RECT GetBoundingBox() const override; const EDA_RECT GetBoundingBox() const override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
@ -188,7 +188,7 @@ public:
int GetWidth() const override { return GetThickness(); } int GetWidth() const override { return GetThickness(); }
void SetWidth( int aWidth ) override { SetThickness( aWidth ); } void SetWidth( int aWidth ) override { SetThickness( aWidth ); }
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
BITMAP_DEF GetMenuImage() const override; BITMAP_DEF GetMenuImage() const override;

View File

@ -49,7 +49,7 @@ LIB_ITEM::LIB_ITEM( KICAD_T aType,
} }
void LIB_ITEM::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) void LIB_ITEM::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
{ {
wxString msg; wxString msg;

View File

@ -204,7 +204,7 @@ public:
* </p> * </p>
* @param aList is the list to populate. * @param aList is the list to populate.
*/ */
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
/** /**
* Test LIB_ITEM objects for equivalence. * Test LIB_ITEM objects for equivalence.

View File

@ -1373,7 +1373,7 @@ void LIB_PIN::SetWidth( int aWidth )
} }
void LIB_PIN::getMsgPanelInfoBase( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) void LIB_PIN::getMsgPanelInfoBase( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
{ {
wxString text = m_number.IsEmpty() ? wxT( "?" ) : m_number; wxString text = m_number.IsEmpty() ? wxT( "?" ) : m_number;
@ -1397,7 +1397,7 @@ void LIB_PIN::getMsgPanelInfoBase( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), text, DARKMAGENTA ) ); aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), text, DARKMAGENTA ) );
} }
void LIB_PIN::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) void LIB_PIN::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
{ {
getMsgPanelInfoBase( aUnits, aList ); getMsgPanelInfoBase( aUnits, aList );
@ -1413,8 +1413,8 @@ void LIB_PIN::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text, DARKMAGENTA ) ); aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text, DARKMAGENTA ) );
} }
void LIB_PIN::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList, void LIB_PIN::GetMsgPanelInfo(
SCH_COMPONENT* aComponent ) EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList, SCH_COMPONENT* aComponent )
{ {
getMsgPanelInfoBase( aUnits, aList ); getMsgPanelInfoBase( aUnits, aList );
@ -1603,7 +1603,7 @@ BITMAP_DEF LIB_PIN::GetMenuImage() const
} }
wxString LIB_PIN::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString LIB_PIN::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Pin %s, %s, %s" ), return wxString::Format( _( "Pin %s, %s, %s" ),
m_number, m_number,
@ -1614,7 +1614,7 @@ wxString LIB_PIN::GetSelectMenuText( EDA_UNITS_T aUnits ) const
bool LIB_PIN::Matches( wxFindReplaceData& aSearchData, void* aAuxDat ) bool LIB_PIN::Matches( wxFindReplaceData& aSearchData, void* aAuxDat )
{ {
wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( MILLIMETRES ) ); wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( EDA_UNITS::MILLIMETRES ) );
// Note: this will have to be modified if we add find and replace capability to the // Note: this will have to be modified if we add find and replace capability to the
// compoment library editor. Otherwise, you wont be able to replace pin text. // compoment library editor. Otherwise, you wont be able to replace pin text.
@ -1622,7 +1622,8 @@ bool LIB_PIN::Matches( wxFindReplaceData& aSearchData, void* aAuxDat )
|| ( aSearchData.GetFlags() & FR_SEARCH_REPLACE ) ) || ( aSearchData.GetFlags() & FR_SEARCH_REPLACE ) )
return false; return false;
wxLogTrace( traceFindItem, wxT( " child item " ) + GetSelectMenuText( MILLIMETRES ) ); wxLogTrace(
traceFindItem, wxT( " child item " ) + GetSelectMenuText( EDA_UNITS::MILLIMETRES ) );
return EDA_ITEM::Matches( GetName(), aSearchData ) return EDA_ITEM::Matches( GetName(), aSearchData )
|| EDA_ITEM::Matches( m_number, aSearchData ); || EDA_ITEM::Matches( m_number, aSearchData );

View File

@ -111,7 +111,7 @@ public:
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
/** /**
* Display pin info (given by GetMsgPanelInfo) and add some info related to aComponent * Display pin info (given by GetMsgPanelInfo) and add some info related to aComponent
@ -119,8 +119,8 @@ public:
* @param aList is the message list to fill * @param aList is the message list to fill
* @param aComponent is the component which "owns" the pin * @param aComponent is the component which "owns" the pin
*/ */
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList, void GetMsgPanelInfo(
SCH_COMPONENT* aComponent ); EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList, SCH_COMPONENT* aComponent );
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override; bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override;
@ -446,7 +446,7 @@ public:
BITMAP_DEF GetMenuImage() const override; BITMAP_DEF GetMenuImage() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
EDA_ITEM* Clone() const override; EDA_ITEM* Clone() const override;
@ -458,7 +458,7 @@ private:
* they are pin info without the actual pin position, which * they are pin info without the actual pin position, which
* is not known in schematic without knowing the parent component * is not known in schematic without knowing the parent component
*/ */
void getMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ); void getMsgPanelInfoBase( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList );
/** /**

View File

@ -327,7 +327,7 @@ void LIB_POLYLINE::DeleteSegment( const wxPoint aPosition )
} }
void LIB_POLYLINE::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) void LIB_POLYLINE::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
{ {
wxString msg; wxString msg;
EDA_RECT bBox = GetBoundingBox(); EDA_RECT bBox = GetBoundingBox();
@ -345,7 +345,7 @@ void LIB_POLYLINE::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList )
} }
wxString LIB_POLYLINE::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString LIB_POLYLINE::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Polyline at (%s, %s) with %d points" ), return wxString::Format( _( "Polyline at (%s, %s) with %d points" ),
MessageTextFromValue( aUnits, m_PolyPoints[0].x ), MessageTextFromValue( aUnits, m_PolyPoints[0].x ),

View File

@ -79,7 +79,7 @@ public:
int GetPenSize( ) const override; int GetPenSize( ) const override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
void BeginEdit( const wxPoint aStartPoint ) override; void BeginEdit( const wxPoint aStartPoint ) override;
void CalcEdit( const wxPoint& aPosition ) override; void CalcEdit( const wxPoint& aPosition ) override;
@ -104,7 +104,7 @@ public:
int GetWidth() const override { return m_Width; } int GetWidth() const override { return m_Width; }
void SetWidth( int aWidth ) override { m_Width = aWidth; } void SetWidth( int aWidth ) override { m_Width = aWidth; }
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
BITMAP_DEF GetMenuImage() const override; BITMAP_DEF GetMenuImage() const override;

View File

@ -182,7 +182,7 @@ void LIB_RECTANGLE::print( wxDC* aDC, const wxPoint& aOffset, void* aData,
} }
void LIB_RECTANGLE::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) void LIB_RECTANGLE::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
{ {
LIB_ITEM::GetMsgPanelInfo( aUnits, aList ); LIB_ITEM::GetMsgPanelInfo( aUnits, aList );
@ -248,7 +248,7 @@ bool LIB_RECTANGLE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
} }
wxString LIB_RECTANGLE::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString LIB_RECTANGLE::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Rectangle from (%s, %s) to (%s, %s)" ), return wxString::Format( _( "Rectangle from (%s, %s) to (%s, %s)" ),
MessageTextFromValue( aUnits, m_Pos.x ), MessageTextFromValue( aUnits, m_Pos.x ),

View File

@ -62,7 +62,7 @@ public:
const EDA_RECT GetBoundingBox() const override; const EDA_RECT GetBoundingBox() const override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
void BeginEdit( const wxPoint aStartPoint ) override; void BeginEdit( const wxPoint aStartPoint ) override;
void CalcEdit( const wxPoint& aPosition ) override; void CalcEdit( const wxPoint& aPosition ) override;
@ -88,7 +88,7 @@ public:
void SetEnd( const wxPoint& aEnd ) { m_End = aEnd; } void SetEnd( const wxPoint& aEnd ) { m_End = aEnd; }
wxPoint GetEnd() const { return m_End; } wxPoint GetEnd() const { return m_End; }
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
BITMAP_DEF GetMenuImage() const override; BITMAP_DEF GetMenuImage() const override;

View File

@ -259,7 +259,7 @@ void LIB_TEXT::print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRAN
} }
void LIB_TEXT::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) void LIB_TEXT::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
{ {
LIB_ITEM::GetMsgPanelInfo( aUnits, aList ); LIB_ITEM::GetMsgPanelInfo( aUnits, aList );
@ -293,7 +293,7 @@ const EDA_RECT LIB_TEXT::GetBoundingBox() const
} }
wxString LIB_TEXT::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString LIB_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Graphic Text \"%s\"" ), ShortenedShownText() ); return wxString::Format( _( "Graphic Text \"%s\"" ), ShortenedShownText() );
} }

View File

@ -70,7 +70,7 @@ public:
int GetPenSize( ) const override; int GetPenSize( ) const override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
const EDA_RECT GetBoundingBox() const override; const EDA_RECT GetBoundingBox() const override;
@ -95,7 +95,7 @@ public:
int GetWidth() const override { return GetThickness(); } int GetWidth() const override { return GetThickness(); }
void SetWidth( int aWidth ) override { SetThickness( aWidth ); } void SetWidth( int aWidth ) override { SetThickness( aWidth ); }
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
BITMAP_DEF GetMenuImage() const override; BITMAP_DEF GetMenuImage() const override;

View File

@ -124,10 +124,10 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
return IsGridVisible(); return IsGridVisible();
}; };
auto imperialUnitsCondition = [this]( const SELECTION& aSel ) { auto imperialUnitsCondition = [this]( const SELECTION& aSel ) {
return GetUserUnits() == INCHES; return GetUserUnits() == EDA_UNITS::INCHES;
}; };
auto metricUnitsCondition = [this]( const SELECTION& aSel ) { auto metricUnitsCondition = [this]( const SELECTION& aSel ) {
return GetUserUnits() == MILLIMETRES; return GetUserUnits() == EDA_UNITS::MILLIMETRES;
}; };
auto fullCrosshairCondition = [ this ] ( const SELECTION& aSel ) { auto fullCrosshairCondition = [ this ] ( const SELECTION& aSel ) {
return GetGalDisplayOptions().m_fullscreenCursor; return GetGalDisplayOptions().m_fullscreenCursor;

View File

@ -173,8 +173,8 @@ void LIB_EDIT_FRAME::SyncToolbars()
m_mainToolBar->Refresh(); m_mainToolBar->Refresh();
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() ); m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES ); m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != EDA_UNITS::INCHES );
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES ); m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == EDA_UNITS::INCHES );
m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, galOpts.m_fullscreenCursor ); m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, galOpts.m_fullscreenCursor );
m_optionsToolBar->Toggle( EE_ACTIONS::showElectricalTypes, GetShowElectricalType() ); m_optionsToolBar->Toggle( EE_ACTIONS::showElectricalTypes, GetShowElectricalType() );
m_optionsToolBar->Toggle( EE_ACTIONS::showComponentTree, IsSearchTreeShown() ); m_optionsToolBar->Toggle( EE_ACTIONS::showComponentTree, IsSearchTreeShown() );

View File

@ -163,10 +163,10 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
return IsGridVisible(); return IsGridVisible();
}; };
auto imperialUnitsCondition = [this]( const SELECTION& aSel ) { auto imperialUnitsCondition = [this]( const SELECTION& aSel ) {
return GetUserUnits() == INCHES; return GetUserUnits() == EDA_UNITS::INCHES;
}; };
auto metricUnitsCondition = [this]( const SELECTION& aSel ) { auto metricUnitsCondition = [this]( const SELECTION& aSel ) {
return GetUserUnits() == MILLIMETRES; return GetUserUnits() == EDA_UNITS::MILLIMETRES;
}; };
auto fullCrosshairCondition = [ this ] ( const SELECTION& aSel ) { auto fullCrosshairCondition = [ this ] ( const SELECTION& aSel ) {
return GetGalDisplayOptions().m_fullscreenCursor; return GetGalDisplayOptions().m_fullscreenCursor;

View File

@ -185,7 +185,7 @@ void SCH_BASE_FRAME::UpdateStatusBar()
double dXpos = To_User_Unit( GetUserUnits(), cursorPos.x ); double dXpos = To_User_Unit( GetUserUnits(), cursorPos.x );
double dYpos = To_User_Unit( GetUserUnits(), cursorPos.y ); double dYpos = To_User_Unit( GetUserUnits(), cursorPos.y );
if ( GetUserUnits() == MILLIMETRES ) if( GetUserUnits() == EDA_UNITS::MILLIMETRES )
{ {
dXpos = RoundTo0( dXpos, 100.0 ); dXpos = RoundTo0( dXpos, 100.0 );
dYpos = RoundTo0( dYpos, 100.0 ); dYpos = RoundTo0( dYpos, 100.0 );
@ -196,17 +196,17 @@ void SCH_BASE_FRAME::UpdateStatusBar()
switch( GetUserUnits() ) switch( GetUserUnits() )
{ {
case INCHES: case EDA_UNITS::INCHES:
absformatter = "X %.3f Y %.3f"; absformatter = "X %.3f Y %.3f";
locformatter = "dx %.3f dy %.3f dist %.3f"; locformatter = "dx %.3f dy %.3f dist %.3f";
break; break;
case MILLIMETRES: case EDA_UNITS::MILLIMETRES:
absformatter = "X %.2f Y %.2f"; absformatter = "X %.2f Y %.2f";
locformatter = "dx %.2f dy %.2f dist %.2f"; locformatter = "dx %.2f dy %.2f dist %.2f";
break; break;
case UNSCALED_UNITS: case EDA_UNITS::UNSCALED:
absformatter = "X %f Y %f"; absformatter = "X %f Y %f";
locformatter = "dx %f dy %f dist %f"; locformatter = "dx %f dy %f dist %f";
break; break;
@ -226,7 +226,7 @@ void SCH_BASE_FRAME::UpdateStatusBar()
dXpos = To_User_Unit( GetUserUnits(), dx ); dXpos = To_User_Unit( GetUserUnits(), dx );
dYpos = To_User_Unit( GetUserUnits(), dy ); dYpos = To_User_Unit( GetUserUnits(), dy );
if( GetUserUnits() == MILLIMETRES ) if( GetUserUnits() == EDA_UNITS::MILLIMETRES )
{ {
dXpos = RoundTo0( dXpos, 100.0 ); dXpos = RoundTo0( dXpos, 100.0 );
dYpos = RoundTo0( dYpos, 100.0 ); dYpos = RoundTo0( dYpos, 100.0 );

View File

@ -193,12 +193,14 @@ BITMAP_DEF SCH_BITMAP::GetMenuImage() const
} }
void SCH_BITMAP::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) void SCH_BITMAP::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
{ {
aList.push_back( MSG_PANEL_ITEM( _( "Bitmap" ), wxEmptyString, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "Bitmap" ), wxEmptyString, RED ) );
aList.push_back( MSG_PANEL_ITEM( _( "Width" ), MessageTextFromValue( aUnits, GetSize().x ), RED ) ); aList.push_back(
aList.push_back( MSG_PANEL_ITEM( _( "Height" ), MessageTextFromValue( aUnits, GetSize().y ), RED ) ); MSG_PANEL_ITEM( _( "Width" ), MessageTextFromValue( aUnits, GetSize().x ), RED ) );
aList.push_back(
MSG_PANEL_ITEM( _( "Height" ), MessageTextFromValue( aUnits, GetSize().y ), RED ) );
} }

View File

@ -128,14 +128,14 @@ public:
void MirrorX( int aXaxis_position ) override; void MirrorX( int aXaxis_position ) override;
void Rotate( wxPoint aPosition ) override; void Rotate( wxPoint aPosition ) override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
{ {
return wxString( _( "Image" ) ); return wxString( _( "Image" ) );
} }
BITMAP_DEF GetMenuImage() const override; BITMAP_DEF GetMenuImage() const override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
wxPoint GetPosition() const override { return m_pos; } wxPoint GetPosition() const override { return m_pos; }
void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; } void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; }

View File

@ -299,13 +299,13 @@ void SCH_BUS_ENTRY_BASE::GetConnectionPoints( std::vector< wxPoint >& aPoints )
} }
wxString SCH_BUS_WIRE_ENTRY::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString SCH_BUS_WIRE_ENTRY::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString( _( "Bus to Wire Entry" ) ); return wxString( _( "Bus to Wire Entry" ) );
} }
wxString SCH_BUS_BUS_ENTRY::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString SCH_BUS_BUS_ENTRY::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString( _( "Bus to Bus Entry" ) ); return wxString( _( "Bus to Bus Entry" ) );
} }
@ -381,7 +381,7 @@ char SCH_BUS_ENTRY_BASE::GetBusEntryShape() const
} }
void SCH_BUS_ENTRY_BASE::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) void SCH_BUS_ENTRY_BASE::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
{ {
wxString msg; wxString msg;

View File

@ -112,7 +112,7 @@ public:
void Plot( PLOTTER* aPlotter ) override; void Plot( PLOTTER* aPlotter ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); } void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
@ -152,7 +152,7 @@ public:
( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS ); ( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS );
} }
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
EDA_ITEM* Clone() const override; EDA_ITEM* Clone() const override;
@ -198,7 +198,7 @@ public:
return aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_BUS; return aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_BUS;
} }
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
EDA_ITEM* Clone() const override; EDA_ITEM* Clone() const override;

View File

@ -1344,7 +1344,7 @@ const EDA_RECT SCH_COMPONENT::GetBoundingBox() const
} }
void SCH_COMPONENT::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) void SCH_COMPONENT::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
{ {
wxString msg; wxString msg;
@ -1487,7 +1487,7 @@ void SCH_COMPONENT::Rotate( wxPoint aPosition )
bool SCH_COMPONENT::Matches( wxFindReplaceData& aSearchData, void* aAuxData ) bool SCH_COMPONENT::Matches( wxFindReplaceData& aSearchData, void* aAuxData )
{ {
wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( MILLIMETRES ) ); wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( EDA_UNITS::MILLIMETRES ) );
// Components are searchable via the child field and pin item text. // Components are searchable via the child field and pin item text.
return false; return false;
@ -1597,7 +1597,7 @@ LIB_ITEM* SCH_COMPONENT::GetDrawItem( const wxPoint& aPosition, KICAD_T aType )
} }
wxString SCH_COMPONENT::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString SCH_COMPONENT::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Symbol %s, %s" ), return wxString::Format( _( "Symbol %s, %s" ),
GetLibId().GetLibItemName().wx_str(), GetLibId().GetLibItemName().wx_str(),

View File

@ -291,7 +291,7 @@ public:
*/ */
int GetOrientation(); int GetOrientation();
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
/** /**
* Clear exiting component annotation. * Clear exiting component annotation.
@ -603,7 +603,7 @@ public:
*/ */
LIB_ITEM* GetDrawItem( const wxPoint& aPosition, KICAD_T aType = TYPE_NOT_INIT ); LIB_ITEM* GetDrawItem( const wxPoint& aPosition, KICAD_T aType = TYPE_NOT_INIT );
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
BITMAP_DEF GetMenuImage() const override; BITMAP_DEF GetMenuImage() const override;

View File

@ -371,7 +371,7 @@ void SCH_CONNECTION::AppendDebugInfoToMsgPanel( MSG_PANEL_ITEMS& aList ) const
if( auto driver = Driver() ) if( auto driver = Driver() )
{ {
msg.Printf( "%s at %p", driver->GetSelectMenuText( MILLIMETRES ), driver ); msg.Printf( "%s at %p", driver->GetSelectMenuText( EDA_UNITS::MILLIMETRES ), driver );
aList.push_back( MSG_PANEL_ITEM( "Connection Source", msg, RED ) ); aList.push_back( MSG_PANEL_ITEM( "Connection Source", msg, RED ) );
} }
} }

View File

@ -284,7 +284,8 @@ bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData )
if( ( flags & FR_SEARCH_REPLACE ) && m_id == REFERENCE && !( flags & FR_REPLACE_REFERENCES ) ) if( ( flags & FR_SEARCH_REPLACE ) && m_id == REFERENCE && !( flags & FR_REPLACE_REFERENCES ) )
return false; return false;
wxLogTrace( traceFindItem, wxT( " child item " ) + GetSelectMenuText( MILLIMETRES ) ); wxLogTrace(
traceFindItem, wxT( " child item " ) + GetSelectMenuText( EDA_UNITS::MILLIMETRES ) );
// Take sheet path into account which effects the reference field and the unit for // Take sheet path into account which effects the reference field and the unit for
// components with multiple parts. // components with multiple parts.
@ -361,7 +362,7 @@ void SCH_FIELD::Rotate( wxPoint aPosition )
} }
wxString SCH_FIELD::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString SCH_FIELD::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Field %s" ), GetName() ); return wxString::Format( _( "Field %s" ), GetName() );
} }

View File

@ -183,7 +183,7 @@ public:
bool Replace( wxFindReplaceData& aSearchData, void* aAuxData = NULL ) override; bool Replace( wxFindReplaceData& aSearchData, void* aAuxData = NULL ) override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
BITMAP_DEF GetMenuImage() const override; BITMAP_DEF GetMenuImage() const override;

View File

@ -88,7 +88,7 @@ public:
aItem->Type() == SCH_COMPONENT_T; aItem->Type() == SCH_COMPONENT_T;
} }
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
{ {
return wxString( _( "Junction" ) ); return wxString( _( "Junction" ) );
} }

View File

@ -622,7 +622,7 @@ void SCH_LINE::GetSelectedPoints( std::vector< wxPoint >& aPoints ) const
} }
wxString SCH_LINE::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString SCH_LINE::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
wxString txtfmt, orient; wxString txtfmt, orient;
@ -787,7 +787,7 @@ void SCH_LINE::SetPosition( const wxPoint& aPosition )
} }
void SCH_LINE::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) void SCH_LINE::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
{ {
wxString msg; wxString msg;

View File

@ -193,7 +193,7 @@ public:
bool CanConnect( const SCH_ITEM* aItem ) const override; bool CanConnect( const SCH_ITEM* aItem ) const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
BITMAP_DEF GetMenuImage() const override; BITMAP_DEF GetMenuImage() const override;
@ -213,7 +213,7 @@ public:
void SwapData( SCH_ITEM* aItem ) override; void SwapData( SCH_ITEM* aItem ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const override; void Show( int nestLevel, std::ostream& os ) const override;

View File

@ -107,7 +107,7 @@ const EDA_RECT SCH_MARKER::GetBoundingBox() const
} }
void SCH_MARKER::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) void SCH_MARKER::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
{ {
aList.push_back( MSG_PANEL_ITEM( _( "Electronics Rule Check Error" ), aList.push_back( MSG_PANEL_ITEM( _( "Electronics Rule Check Error" ),
GetReporter().GetErrorText(), DARKRED ) ); GetReporter().GetErrorText(), DARKRED ) );

View File

@ -86,9 +86,9 @@ public:
*/ */
bool Matches( wxFindReplaceData& aSearchData, void* aAuxDat ) override; bool Matches( wxFindReplaceData& aSearchData, void* aAuxDat ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
{ {
return wxString( _( "ERC Marker" ) ); return wxString( _( "ERC Marker" ) );
} }

View File

@ -94,7 +94,7 @@ public:
void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const override; void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
{ {
return wxString( _( "No Connect" ) ); return wxString( _( "No Connect" ) );
} }

View File

@ -67,7 +67,7 @@ SCH_COMPONENT* SCH_PIN::GetParentComponent() const
} }
wxString SCH_PIN::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString SCH_PIN::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( "%s %s", return wxString::Format( "%s %s",
GetParentComponent()->GetSelectMenuText( aUnits ), GetParentComponent()->GetSelectMenuText( aUnits ),
@ -75,7 +75,7 @@ wxString SCH_PIN::GetSelectMenuText( EDA_UNITS_T aUnits ) const
} }
void SCH_PIN::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) void SCH_PIN::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
{ {
m_libPin->GetMsgPanelInfo( aUnits, aList, GetParentComponent() ); m_libPin->GetMsgPanelInfo( aUnits, aList, GetParentComponent() );
} }

View File

@ -65,8 +65,8 @@ public:
wxString GetDefaultNetName( const SCH_SHEET_PATH aPath ); wxString GetDefaultNetName( const SCH_SHEET_PATH aPath );
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) override; void GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) override;
void Print( wxDC* aDC, const wxPoint& aOffset ) override {} void Print( wxDC* aDC, const wxPoint& aOffset ) override {}

View File

@ -664,7 +664,7 @@ wxString SCH_SHEET::GetFileName( void ) const
} }
void SCH_SHEET::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) void SCH_SHEET::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
{ {
aList.push_back( MSG_PANEL_ITEM( _( "Sheet Name" ), m_name, CYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Sheet Name" ), m_name, CYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "File Name" ), m_fileName, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "File Name" ), m_fileName, BROWN ) );
@ -750,7 +750,7 @@ void SCH_SHEET::Resize( const wxSize& aSize )
bool SCH_SHEET::Matches( wxFindReplaceData& aSearchData, void* aAuxData ) bool SCH_SHEET::Matches( wxFindReplaceData& aSearchData, void* aAuxData )
{ {
wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( MILLIMETRES ) ); wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( EDA_UNITS::MILLIMETRES ) );
// Ignore the sheet file name if searching to replace. // Ignore the sheet file name if searching to replace.
if( !(aSearchData.GetFlags() & FR_SEARCH_REPLACE) if( !(aSearchData.GetFlags() & FR_SEARCH_REPLACE)
@ -846,7 +846,7 @@ SEARCH_RESULT SCH_SHEET::Visit( INSPECTOR aInspector, void* testData, const KICA
} }
wxString SCH_SHEET::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString SCH_SHEET::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Hierarchical Sheet %s" ), m_name ); return wxString::Format( _( "Hierarchical Sheet %s" ), m_name );
} }

View File

@ -188,7 +188,7 @@ public:
bool IsConnectable() const override { return true; } bool IsConnectable() const override { return true; }
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
BITMAP_DEF GetMenuImage() const override; BITMAP_DEF GetMenuImage() const override;
@ -314,7 +314,7 @@ public:
*/ */
int GetScreenCount() const; int GetScreenCount() const;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
/* there is no member for orientation in sch_sheet, to preserve file /* there is no member for orientation in sch_sheet, to preserve file
* format, we detect orientation based on pin edges * format, we detect orientation based on pin edges
@ -529,7 +529,7 @@ public:
SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override; SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
BITMAP_DEF GetMenuImage() const override; BITMAP_DEF GetMenuImage() const override;

View File

@ -269,7 +269,7 @@ void SCH_SHEET_PIN::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
} }
wxString SCH_SHEET_PIN::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString SCH_SHEET_PIN::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Hierarchical Sheet Pin %s" ), ShortenedShownText() ); return wxString::Format( _( "Hierarchical Sheet Pin %s" ), ShortenedShownText() );
} }

View File

@ -446,7 +446,7 @@ const EDA_RECT SCH_TEXT::GetBoundingBox() const
} }
wxString SCH_TEXT::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString SCH_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Graphic Text \"%s\"" ), GetChars( ShortenedShownText() ) ); return wxString::Format( _( "Graphic Text \"%s\"" ), GetChars( ShortenedShownText() ) );
} }
@ -556,7 +556,7 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter )
} }
void SCH_TEXT::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) void SCH_TEXT::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
{ {
wxString msg; wxString msg;
@ -715,7 +715,7 @@ const EDA_RECT SCH_LABEL::GetBoundingBox() const
} }
wxString SCH_LABEL::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString SCH_LABEL::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Label %s" ), ShortenedShownText() ); return wxString::Format( _( "Label %s" ), ShortenedShownText() );
} }
@ -987,7 +987,7 @@ const EDA_RECT SCH_GLOBALLABEL::GetBoundingBox() const
} }
wxString SCH_GLOBALLABEL::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString SCH_GLOBALLABEL::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Global Label %s" ), ShortenedShownText() ); return wxString::Format( _( "Global Label %s" ), ShortenedShownText() );
} }
@ -1170,7 +1170,7 @@ wxPoint SCH_HIERLABEL::GetSchematicTextOffset() const
} }
wxString SCH_HIERLABEL::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString SCH_HIERLABEL::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Hierarchical Label %s" ), ShortenedShownText() ); return wxString::Format( _( "Hierarchical Label %s" ), ShortenedShownText() );
} }

View File

@ -189,7 +189,7 @@ public:
bool CanIncrementLabel() const override { return true; } bool CanIncrementLabel() const override { return true; }
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
BITMAP_DEF GetMenuImage() const override; BITMAP_DEF GetMenuImage() const override;
@ -205,7 +205,7 @@ public:
EDA_ITEM* Clone() const override; EDA_ITEM* Clone() const override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const override; void Show( int nestLevel, std::ostream& os ) const override;
@ -244,7 +244,7 @@ public:
( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS ); ( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS );
} }
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
BITMAP_DEF GetMenuImage() const override; BITMAP_DEF GetMenuImage() const override;
@ -294,7 +294,7 @@ public:
( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS ); ( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS );
} }
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
BITMAP_DEF GetMenuImage() const override; BITMAP_DEF GetMenuImage() const override;
@ -344,7 +344,7 @@ public:
( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS ); ( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS );
} }
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
BITMAP_DEF GetMenuImage() const override; BITMAP_DEF GetMenuImage() const override;

View File

@ -178,8 +178,8 @@ void SCH_EDIT_FRAME::SyncToolbars()
m_mainToolBar->Refresh(); m_mainToolBar->Refresh();
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() ); m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES ); m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != EDA_UNITS::INCHES );
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES ); m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == EDA_UNITS::INCHES );
m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, galOpts.m_fullscreenCursor ); m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, galOpts.m_fullscreenCursor );
m_optionsToolBar->Toggle( EE_ACTIONS::toggleHiddenPins, GetShowAllPins() ); m_optionsToolBar->Toggle( EE_ACTIONS::toggleHiddenPins, GetShowAllPins() );
m_optionsToolBar->Toggle( EE_ACTIONS::toggleForceHV, GetForceHVLines() ); m_optionsToolBar->Toggle( EE_ACTIONS::toggleForceHV, GetForceHVLines() );

View File

@ -37,7 +37,7 @@ PANEL_GERBVIEW_SETTINGS::PANEL_GERBVIEW_SETTINGS( GERBVIEW_FRAME *aFrame, wxWind
bool PANEL_GERBVIEW_SETTINGS::TransferDataToWindow( ) bool PANEL_GERBVIEW_SETTINGS::TransferDataToWindow( )
{ {
m_PolarDisplay->SetSelection( m_Parent->GetShowPolarCoords() ? 1 : 0 ); m_PolarDisplay->SetSelection( m_Parent->GetShowPolarCoords() ? 1 : 0 );
m_BoxUnits->SetSelection( m_Parent->GetUserUnits() ? 1 : 0 ); m_BoxUnits->SetSelection( ( m_Parent->GetUserUnits() == EDA_UNITS::MILLIMETRES ) ? 1 : 0 );
m_ShowPageLimitsOpt->SetValue( m_Parent->GetDisplayOptions().m_DisplayPageLimits ); m_ShowPageLimitsOpt->SetValue( m_Parent->GetDisplayOptions().m_DisplayPageLimits );
for( unsigned i = 0; i < arrayDim( g_GerberPageSizeList ); ++i ) for( unsigned i = 0; i < arrayDim( g_GerberPageSizeList ); ++i )
@ -56,7 +56,8 @@ bool PANEL_GERBVIEW_SETTINGS::TransferDataToWindow( )
bool PANEL_GERBVIEW_SETTINGS::TransferDataFromWindow() bool PANEL_GERBVIEW_SETTINGS::TransferDataFromWindow()
{ {
m_Parent->SetShowPolarCoords( m_PolarDisplay->GetSelection() != 0 ); m_Parent->SetShowPolarCoords( m_PolarDisplay->GetSelection() != 0 );
m_Parent->SetUserUnits( m_BoxUnits->GetSelection() == 0 ? INCHES : MILLIMETRES ); m_Parent->SetUserUnits(
m_BoxUnits->GetSelection() == 0 ? EDA_UNITS::INCHES : EDA_UNITS::MILLIMETRES );
auto opts = m_Parent->GetDisplayOptions(); auto opts = m_Parent->GetDisplayOptions();
opts.m_DisplayPageLimits = m_ShowPageLimitsOpt->GetValue(); opts.m_DisplayPageLimits = m_ShowPageLimitsOpt->GetValue();

View File

@ -643,7 +643,7 @@ void GERBER_DRAW_ITEM::PrintGerberPoly( wxDC* aDC, COLOR4D aColor, const wxPoint
} }
void GERBER_DRAW_ITEM::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) void GERBER_DRAW_ITEM::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList )
{ {
wxString msg; wxString msg;
wxString text; wxString text;
@ -955,7 +955,7 @@ SEARCH_RESULT GERBER_DRAW_ITEM::Visit( INSPECTOR inspector, void* testData, cons
} }
wxString GERBER_DRAW_ITEM::GetSelectMenuText( EDA_UNITS_T aUnits ) const wxString GERBER_DRAW_ITEM::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
wxString layerName; wxString layerName;

View File

@ -256,7 +256,7 @@ public:
/* divers */ /* divers */
int Shape() const { return m_Shape; } int Shape() const { return m_Shape; }
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
wxString ShowGBRShape() const; wxString ShowGBRShape() const;
@ -326,7 +326,7 @@ public:
SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override; SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
///> @copydoc EDA_ITEM::GetSelectMenuText() ///> @copydoc EDA_ITEM::GetSelectMenuText()
virtual wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; virtual wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
///> @copydoc EDA_ITEM::GetMenuImage() ///> @copydoc EDA_ITEM::GetMenuImage()
BITMAP_DEF GetMenuImage() const override; BITMAP_DEF GetMenuImage() const override;

View File

@ -363,7 +363,7 @@ void GERBER_FILE_IMAGE::DisplayImageInfo( GERBVIEW_FRAME* aMainFrame )
msg = m_ImageJustifyYCenter ? _("Center") : _("Normal"); msg = m_ImageJustifyYCenter ? _("Center") : _("Normal");
aMainFrame->AppendMsgPanel( _( "Y Justify" ), msg, DARKRED ); aMainFrame->AppendMsgPanel( _( "Y Justify" ), msg, DARKRED );
if( aMainFrame->GetUserUnits() == INCHES ) if( aMainFrame->GetUserUnits() == EDA_UNITS::INCHES )
msg.Printf( wxT( "X=%f Y=%f" ), Iu2Mils( m_ImageJustifyOffset.x ) / 1000.0, msg.Printf( wxT( "X=%f Y=%f" ), Iu2Mils( m_ImageJustifyOffset.x ) / 1000.0,
Iu2Mils( m_ImageJustifyOffset.y ) / 1000.0 ); Iu2Mils( m_ImageJustifyOffset.y ) / 1000.0 );
else else

View File

@ -94,8 +94,8 @@ void GERBVIEW_DRAW_PANEL_GAL::SetHighContrastLayer( int aLayer )
} }
void GERBVIEW_DRAW_PANEL_GAL::GetMsgPanelInfo( EDA_UNITS_T aUnits, void GERBVIEW_DRAW_PANEL_GAL::GetMsgPanelInfo(
std::vector<MSG_PANEL_ITEM>& aList ) EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList )
{ {
} }

View File

@ -51,7 +51,7 @@ public:
virtual void SetHighContrastLayer( int aLayer ) override; virtual void SetHighContrastLayer( int aLayer ) override;
///> @copydoc EDA_DRAW_PANEL_GAL::GetMsgPanelInfo() ///> @copydoc EDA_DRAW_PANEL_GAL::GetMsgPanelInfo()
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override; void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
///> @copydoc EDA_DRAW_PANEL_GAL::OnShow() ///> @copydoc EDA_DRAW_PANEL_GAL::OnShow()
void OnShow() override; void OnShow() override;

View File

@ -530,7 +530,7 @@ void GERBVIEW_FRAME::Liste_D_Codes()
int ii, jj; int ii, jj;
wxString Line; wxString Line;
wxArrayString list; wxArrayString list;
double scale = GetUserUnits() == INCHES ? IU_PER_MILS * 1000 : IU_PER_MM; double scale = GetUserUnits() == EDA_UNITS::INCHES ? IU_PER_MILS * 1000 : IU_PER_MM;
int curr_layer = GetActiveLayer(); int curr_layer = GetActiveLayer();
for( int layer = 0; layer < (int)ImagesMaxCount(); ++layer ) for( int layer = 0; layer < (int)ImagesMaxCount(); ++layer )
@ -550,7 +550,7 @@ void GERBVIEW_FRAME::Liste_D_Codes()
list.Add( Line ); list.Add( Line );
const char* units = GetUserUnits() == INCHES ? "\"" : "mm"; const char* units = GetUserUnits() == EDA_UNITS::INCHES ? "\"" : "mm";
for( ii = 0, jj = 1; ii < TOOLS_MAX_COUNT; ii++ ) for( ii = 0, jj = 1; ii < TOOLS_MAX_COUNT; ii++ )
{ {
@ -980,11 +980,11 @@ void GERBVIEW_FRAME::DisplayGridMsg()
switch( m_userUnits ) switch( m_userUnits )
{ {
case INCHES: case EDA_UNITS::INCHES:
gridformatter = "grid X %.6f Y %.6f"; gridformatter = "grid X %.6f Y %.6f";
break; break;
case MILLIMETRES: case EDA_UNITS::MILLIMETRES:
gridformatter = "grid X %.6f Y %.6f"; gridformatter = "grid X %.6f Y %.6f";
break; break;
@ -996,7 +996,7 @@ void GERBVIEW_FRAME::DisplayGridMsg()
BASE_SCREEN* screen = GetScreen(); BASE_SCREEN* screen = GetScreen();
wxArrayString gridsList; wxArrayString gridsList;
int icurr = screen->BuildGridsChoiceList( gridsList, m_userUnits != INCHES ); int icurr = screen->BuildGridsChoiceList( gridsList, m_userUnits != EDA_UNITS::INCHES );
GRID_TYPE& grid = screen->GetGrid( icurr ); GRID_TYPE& grid = screen->GetGrid( icurr );
double grid_x = To_User_Unit( m_userUnits, grid.m_Size.x ); double grid_x = To_User_Unit( m_userUnits, grid.m_Size.x );
double grid_y = To_User_Unit( m_userUnits, grid.m_Size.y ); double grid_y = To_User_Unit( m_userUnits, grid.m_Size.y );
@ -1028,9 +1028,15 @@ void GERBVIEW_FRAME::UpdateStatusBar()
switch( GetUserUnits() ) switch( GetUserUnits() )
{ {
case INCHES: formatter = wxT( "r %.6f theta %.1f" ); break; case EDA_UNITS::INCHES:
case MILLIMETRES: formatter = wxT( "r %.5f theta %.1f" ); break; formatter = wxT( "r %.6f theta %.1f" );
case UNSCALED_UNITS: formatter = wxT( "r %f theta %f" ); break; break;
case EDA_UNITS::MILLIMETRES:
formatter = wxT( "r %.5f theta %.1f" );
break;
case EDA_UNITS::UNSCALED:
formatter = wxT( "r %f theta %f" );
break;
default: wxASSERT( false ); break; default: wxASSERT( false ); break;
} }
@ -1048,17 +1054,17 @@ void GERBVIEW_FRAME::UpdateStatusBar()
switch( GetUserUnits() ) switch( GetUserUnits() )
{ {
case INCHES: case EDA_UNITS::INCHES:
absformatter = wxT( "X %.6f Y %.6f" ); absformatter = wxT( "X %.6f Y %.6f" );
relformatter = wxT( "dx %.6f dy %.6f dist %.4f" ); relformatter = wxT( "dx %.6f dy %.6f dist %.4f" );
break; break;
case MILLIMETRES: case EDA_UNITS::MILLIMETRES:
absformatter = wxT( "X %.5f Y %.5f" ); absformatter = wxT( "X %.5f Y %.5f" );
relformatter = wxT( "dx %.5f dy %.5f dist %.3f" ); relformatter = wxT( "dx %.5f dy %.5f dist %.3f" );
break; break;
case UNSCALED_UNITS: case EDA_UNITS::UNSCALED:
absformatter = wxT( "X %f Y %f" ); absformatter = wxT( "X %f Y %f" );
relformatter = wxT( "dx %f dy %f dist %f" ); relformatter = wxT( "dx %f dy %f dist %f" );
break; break;
@ -1178,7 +1184,7 @@ void GERBVIEW_FRAME::updateGridSelectBox()
// Update grid values with the current units setting. // Update grid values with the current units setting.
m_gridSelectBox->Clear(); m_gridSelectBox->Clear();
wxArrayString gridsList; wxArrayString gridsList;
int icurr = GetScreen()->BuildGridsChoiceList( gridsList, GetUserUnits() != INCHES ); int icurr = GetScreen()->BuildGridsChoiceList( gridsList, GetUserUnits() != EDA_UNITS::INCHES );
for( size_t i = 0; i < GetScreen()->GetGridCount(); i++ ) for( size_t i = 0; i < GetScreen()->GetGridCount(); i++ )
{ {

View File

@ -154,10 +154,10 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
return m_show_layer_manager_tools; return m_show_layer_manager_tools;
}; };
auto imperialUnitsCondition = [this]( const SELECTION& aSel ) { auto imperialUnitsCondition = [this]( const SELECTION& aSel ) {
return GetUserUnits() == INCHES; return GetUserUnits() == EDA_UNITS::INCHES;
}; };
auto metricUnitsCondition = [this]( const SELECTION& aSel ) { auto metricUnitsCondition = [this]( const SELECTION& aSel ) {
return GetUserUnits() == MILLIMETRES; return GetUserUnits() == EDA_UNITS::MILLIMETRES;
}; };
auto sketchFlashedCondition = [ this ] ( const SELECTION& aSel ) { auto sketchFlashedCondition = [ this ] ( const SELECTION& aSel ) {
return !m_DisplayOptions.m_DisplayFlashedItemsFill; return !m_DisplayOptions.m_DisplayFlashedItemsFill;

View File

@ -274,8 +274,8 @@ void GERBVIEW_FRAME::updateDCodeSelectBox()
// Build the aperture list of the current layer, and add it to the combo box: // Build the aperture list of the current layer, and add it to the combo box:
wxArrayString dcode_list; wxArrayString dcode_list;
wxString msg; wxString msg;
const char* units = GetUserUnits() == INCHES ? "mils" : "mm"; const char* units = GetUserUnits() == EDA_UNITS::INCHES ? "mils" : "mm";
double scale = GetUserUnits() == INCHES ? IU_PER_MILS : IU_PER_MM; double scale = GetUserUnits() == EDA_UNITS::INCHES ? IU_PER_MILS : IU_PER_MM;
for( int ii = 0; ii < TOOLS_MAX_COUNT; ii++ ) for( int ii = 0; ii < TOOLS_MAX_COUNT; ii++ )
{ {
@ -474,8 +474,8 @@ void GERBVIEW_FRAME::SyncToolbars()
TOGGLE_TOOL( m_optionsToolBar, ACTIONS::selectionTool ); TOGGLE_TOOL( m_optionsToolBar, ACTIONS::selectionTool );
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() ); m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES ); m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != EDA_UNITS::INCHES );
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES ); m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == EDA_UNITS::INCHES );
m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, !galOpts.m_fullscreenCursor ); m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, !galOpts.m_fullscreenCursor );
m_optionsToolBar->Toggle( GERBVIEW_ACTIONS::flashedDisplayOutlines, m_optionsToolBar->Toggle( GERBVIEW_ACTIONS::flashedDisplayOutlines,
!m_DisplayOptions.m_DisplayFlashedItemsFill ); !m_DisplayOptions.m_DisplayFlashedItemsFill );

View File

@ -305,7 +305,7 @@ public:
int SetGrid( int aCommandId ); int SetGrid( int aCommandId );
void AddGrid( const GRID_TYPE& aGrid ); void AddGrid( const GRID_TYPE& aGrid );
void AddGrid( const wxRealPoint& size, EDA_UNITS_T aUnit, int id ); void AddGrid( const wxRealPoint& size, EDA_UNITS aUnit, int id );
/** /**
* Function GridExists * Function GridExists

View File

@ -325,7 +325,7 @@ public:
* *
* @param aList is the list to populate. * @param aList is the list to populate.
*/ */
virtual void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) virtual void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList )
{ {
} }
@ -485,7 +485,7 @@ public:
* *
* @return The menu text string. * @return The menu text string.
*/ */
virtual wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const; virtual wxString GetSelectMenuText( EDA_UNITS aUnits ) const;
/** /**
* Function GetMenuImage * Function GetMenuImage

View File

@ -81,7 +81,7 @@ void StripTrailingZeros( wxString& aStringValue, unsigned aTrailingZeroAllowed =
* @param aValue The value in internal units to convert. * @param aValue The value in internal units to convert.
* @param aUseMils Indicates mils should be used for imperial units (inches). * @param aUseMils Indicates mils should be used for imperial units (inches).
*/ */
double To_User_Unit( EDA_UNITS_T aUnit, double aValue, bool aUseMils = false ); double To_User_Unit( EDA_UNITS aUnit, double aValue, bool aUseMils = false );
/** /**
* Function AngleToStringDegrees * Function AngleToStringDegrees
@ -108,11 +108,11 @@ wxString AngleToStringDegrees( double aAngle );
* @param aUseMils Convert inch values to mils if true. * @param aUseMils Convert inch values to mils if true.
* @return The converted string for display in user interface elements. * @return The converted string for display in user interface elements.
*/ */
wxString MessageTextFromValue( EDA_UNITS_T aUnits, double aValue, bool aUseMils = false ); wxString MessageTextFromValue( EDA_UNITS aUnits, double aValue, bool aUseMils = false );
wxString MessageTextFromValue( EDA_UNITS_T aUnits, int aValue, bool aUseMils = false ); wxString MessageTextFromValue( EDA_UNITS aUnits, int aValue, bool aUseMils = false );
wxString MessageTextFromValue( EDA_UNITS_T aUnits, long long int aValue, bool aUseMils = false ); wxString MessageTextFromValue( EDA_UNITS aUnits, long long int aValue, bool aUseMils = false );
/** /**
* Function StringFromValue * Function StringFromValue
@ -135,13 +135,13 @@ wxString MessageTextFromValue( EDA_UNITS_T aUnits, long long int aValue, bool aU
* @return A wxString object containing value and optionally the symbol unit (like 2.000 mm) * @return A wxString object containing value and optionally the symbol unit (like 2.000 mm)
*/ */
wxString StringFromValue( wxString StringFromValue(
EDA_UNITS_T aUnit, double aValue, bool aAddUnitSymbol = false, bool aUseMils = false ); EDA_UNITS aUnit, double aValue, bool aAddUnitSymbol = false, bool aUseMils = false );
/** /**
* Return in internal units the value "val" given in a real unit * Return in internal units the value "val" given in a real unit
* such as "in", "mm" or "deg" * such as "in", "mm" or "deg"
*/ */
double From_User_Unit( EDA_UNITS_T aUnit, double aValue, bool aUseMils = false ); double From_User_Unit( EDA_UNITS aUnit, double aValue, bool aUseMils = false );
/** /**
@ -152,8 +152,7 @@ double From_User_Unit( EDA_UNITS_T aUnit, double aValue, bool aUseMils = false )
* @param aUseMils Indicates mils should be used for imperial units (inches). * @param aUseMils Indicates mils should be used for imperial units (inches).
* @return A double representing that value in internal units * @return A double representing that value in internal units
*/ */
double DoubleValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue, double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, bool aUseMils = false );
bool aUseMils = false );
/** /**
* Function ValueFromString * Function ValueFromString
@ -165,13 +164,13 @@ double DoubleValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue,
* @return The string from Value, according to units (inch, mm ...) for display, * @return The string from Value, according to units (inch, mm ...) for display,
*/ */
long long int ValueFromString( long long int ValueFromString(
EDA_UNITS_T aUnits, const wxString& aTextValue, bool aUseMils = false ); EDA_UNITS aUnits, const wxString& aTextValue, bool aUseMils = false );
/** /**
* Function FetchUnitsFromString * Function FetchUnitsFromString
* writes any unit info found in the string to aUnits and aUseMils. * writes any unit info found in the string to aUnits and aUseMils.
*/ */
void FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS_T& aUnits, bool& aUseMils ); void FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS& aUnits, bool& aUseMils );
/** /**
* Get the units string for a given units type. * Get the units string for a given units type.
@ -179,7 +178,7 @@ void FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS_T& aUnits, bool
* @param aUnits - The units requested. * @param aUnits - The units requested.
* @return The human readable units string. * @return The human readable units string.
*/ */
wxString GetAbbreviatedUnitsLabel( EDA_UNITS_T aUnit, bool aUseMils = false ); wxString GetAbbreviatedUnitsLabel( EDA_UNITS aUnit, bool aUseMils = false );
/** /**
* Function FormatInternalUnits * Function FormatInternalUnits

View File

@ -147,7 +147,7 @@ public:
*/ */
virtual void SetTopLayer( int aLayer ); virtual void SetTopLayer( int aLayer );
virtual void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector<MSG_PANEL_ITEM>& aList ) virtual void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList )
{ {
wxASSERT( false ); wxASSERT( false );
} }

View File

@ -130,10 +130,11 @@ constexpr ret_type KiROUND( fp_type v )
//-----</KiROUND KIT>----------------------------------------------------------- //-----</KiROUND KIT>-----------------------------------------------------------
enum EDA_UNITS_T { enum class EDA_UNITS
{
INCHES = 0, INCHES = 0,
MILLIMETRES = 1, MILLIMETRES = 1,
UNSCALED_UNITS = 2, UNSCALED = 2,
DEGREES = 3, DEGREES = 3,
PERCENT = 4, PERCENT = 4,
}; };

View File

@ -32,8 +32,8 @@
#define DIALOG_HELPERS_H_ #define DIALOG_HELPERS_H_
#include <common.h> // EDA_UNITS_T
#include <../common/dialogs/dialog_list_selector_base.h> #include <../common/dialogs/dialog_list_selector_base.h>
#include <common.h> // EDA_UNITS
void ConvertMarkdown2Html( const wxString& aMarkdownInput, wxString& aHtmlOutput ); void ConvertMarkdown2Html( const wxString& aMarkdownInput, wxString& aHtmlOutput );
@ -107,7 +107,7 @@ private:
class EDA_POSITION_CTRL class EDA_POSITION_CTRL
{ {
public: public:
EDA_UNITS_T m_UserUnit; EDA_UNITS m_UserUnit;
wxTextCtrl* m_FramePosX; wxTextCtrl* m_FramePosX;
wxTextCtrl* m_FramePosY; wxTextCtrl* m_FramePosY;
@ -116,8 +116,8 @@ private:
wxStaticText* m_TextX, * m_TextY; wxStaticText* m_TextX, * m_TextY;
public: public:
EDA_POSITION_CTRL( wxWindow* parent, const wxString& title, EDA_POSITION_CTRL( wxWindow* parent, const wxString& title, const wxPoint& pos_to_edit,
const wxPoint& pos_to_edit, EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer ); EDA_UNITS user_unit, wxBoxSizer* BoxSizer );
~EDA_POSITION_CTRL(); ~EDA_POSITION_CTRL();
@ -134,8 +134,8 @@ public:
class EDA_SIZE_CTRL : public EDA_POSITION_CTRL class EDA_SIZE_CTRL : public EDA_POSITION_CTRL
{ {
public: public:
EDA_SIZE_CTRL( wxWindow* parent, const wxString& title, EDA_SIZE_CTRL( wxWindow* parent, const wxString& title, const wxSize& size_to_edit,
const wxSize& size_to_edit, EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer ); EDA_UNITS user_unit, wxBoxSizer* BoxSizer );
~EDA_SIZE_CTRL() { } ~EDA_SIZE_CTRL() { }
wxSize GetValue(); wxSize GetValue();

View File

@ -129,7 +129,10 @@ public:
void OnPaint( wxPaintEvent &event ); void OnPaint( wxPaintEvent &event );
EDA_UNITS_T GetUserUnits() const { return m_units; } EDA_UNITS GetUserUnits() const
{
return m_units;
}
static bool IsCtrl( int aChar, const wxKeyEvent& e ) static bool IsCtrl( int aChar, const wxKeyEvent& e )
{ {
@ -190,7 +193,7 @@ protected:
*/ */
void ResetSize(); void ResetSize();
EDA_UNITS_T m_units; // userUnits for display and parsing EDA_UNITS m_units; // userUnits for display and parsing
std::string m_hash_key; // alternate for class_map when classname re-used std::string m_hash_key; // alternate for class_map when classname re-used
// On MacOS (at least) SetFocus() calls made in the constructor will fail because a // On MacOS (at least) SetFocus() calls made in the constructor will fail because a

View File

@ -72,13 +72,13 @@ public:
m_auxItemWeakRef = nullptr; m_auxItemWeakRef = nullptr;
} }
DRC_ITEM( EDA_UNITS_T aUnits, int aErrorCode, EDA_ITEM* aMainItem, const wxPoint& aMainPos, DRC_ITEM( EDA_UNITS aUnits, int aErrorCode, EDA_ITEM* aMainItem, const wxPoint& aMainPos,
EDA_ITEM* bAuxiliaryItem, const wxPoint& bAuxiliaryPos ) EDA_ITEM* bAuxiliaryItem, const wxPoint& bAuxiliaryPos )
{ {
SetData( aUnits, aErrorCode, aMainItem, aMainPos, bAuxiliaryItem, bAuxiliaryPos ); SetData( aUnits, aErrorCode, aMainItem, aMainPos, bAuxiliaryItem, bAuxiliaryPos );
} }
DRC_ITEM( EDA_UNITS_T aUnits, int aErrorCode, EDA_ITEM* aMainItem, const wxPoint& aMainPos ) DRC_ITEM( EDA_UNITS aUnits, int aErrorCode, EDA_ITEM* aMainItem, const wxPoint& aMainPos )
{ {
SetData( aUnits, aErrorCode, aMainItem, aMainPos ); SetData( aUnits, aErrorCode, aMainItem, aMainPos );
} }
@ -100,7 +100,7 @@ public:
* @param aMainPos = position the first item and therefore of this issue * @param aMainPos = position the first item and therefore of this issue
* @param bAuxiliaryPos = position the second item * @param bAuxiliaryPos = position the second item
*/ */
void SetData( EDA_UNITS_T aUnits, int aErrorCode, EDA_ITEM* aMainItem, const wxPoint& aMainPos, void SetData( EDA_UNITS aUnits, int aErrorCode, EDA_ITEM* aMainItem, const wxPoint& aMainPos,
EDA_ITEM* bAuxiliaryItem = nullptr, const wxPoint& bAuxiliaryPos = wxPoint() ) EDA_ITEM* bAuxiliaryItem = nullptr, const wxPoint& bAuxiliaryPos = wxPoint() )
{ {
m_ErrorCode = aErrorCode; m_ErrorCode = aErrorCode;
@ -186,7 +186,7 @@ public:
* wxWidget's wxHtmlListBox class. * wxWidget's wxHtmlListBox class.
* @return wxString - the html text. * @return wxString - the html text.
*/ */
wxString ShowHtml( EDA_UNITS_T aUnits ) const; wxString ShowHtml( EDA_UNITS aUnits ) const;
/** /**
* Function ShowReport * Function ShowReport
@ -194,7 +194,7 @@ public:
* to disk in a report. * to disk in a report.
* @return wxString - the simple multi-line report text. * @return wxString - the simple multi-line report text.
*/ */
wxString ShowReport( EDA_UNITS_T aUnits ) const; wxString ShowReport( EDA_UNITS aUnits ) const;
/** /**
* Function GetErrorCode * Function GetErrorCode
@ -241,7 +241,7 @@ public:
* @param aPos The position to format * @param aPos The position to format
* @return wxString - The formated string * @return wxString - The formated string
*/ */
static wxString ShowCoord( EDA_UNITS_T aUnits, const wxPoint& aPos ); static wxString ShowCoord( EDA_UNITS aUnits, const wxPoint& aPos );
}; };

View File

@ -148,7 +148,7 @@ protected:
wxString m_mruPath; // Most recently used path. wxString m_mruPath; // Most recently used path.
EDA_UNITS_T m_userUnits; EDA_UNITS m_userUnits;
///> Default style flags used for wxAUI toolbars ///> Default style flags used for wxAUI toolbars
static constexpr int KICAD_AUI_TB_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_PLAIN_BACKGROUND; static constexpr int KICAD_AUI_TB_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_PLAIN_BACKGROUND;
@ -208,10 +208,17 @@ public:
/** /**
* Return the user units currently in use. * Return the user units currently in use.
*/ */
EDA_UNITS_T GetUserUnits() const { return m_userUnits; } EDA_UNITS GetUserUnits() const
void SetUserUnits( EDA_UNITS_T aUnits ) { m_userUnits = aUnits; } {
return m_userUnits;
}
void ChangeUserUnits( EDA_UNITS_T aUnits ) void SetUserUnits( EDA_UNITS aUnits )
{
m_userUnits = aUnits;
}
void ChangeUserUnits( EDA_UNITS aUnits )
{ {
SetUserUnits( aUnits ); SetUserUnits( aUnits );
unitsChangeRefresh(); unitsChangeRefresh();

View File

@ -96,7 +96,7 @@ class NUMERIC_EVALUATOR
enum class Unit { Invalid, Metric, Inch, Mil }; enum class Unit { Invalid, Metric, Inch, Mil };
public: public:
NUMERIC_EVALUATOR( EDA_UNITS_T aUnits, bool aUseMils = false ); NUMERIC_EVALUATOR( EDA_UNITS aUnits, bool aUseMils = false );
~NUMERIC_EVALUATOR(); ~NUMERIC_EVALUATOR();
/* clear() should be invoked by the client if a new input string is to be processed. It /* clear() should be invoked by the client if a new input string is to be processed. It

View File

@ -79,9 +79,8 @@ public:
* @param bPos The position of the second of two objects * @param bPos The position of the second of two objects
* @param aScalingFactor the scaling factor to convert the shape coordinates to IU coordinates * @param aScalingFactor the scaling factor to convert the shape coordinates to IU coordinates
*/ */
MARKER_BASE( EDA_UNITS_T aUnits, int aErrorCode, const wxPoint& aMarkerPos, MARKER_BASE( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos, EDA_ITEM* aItem,
EDA_ITEM* aItem, const wxPoint& aPos, const wxPoint& aPos, EDA_ITEM* bItem, const wxPoint& bPos, int aScalingFactor );
EDA_ITEM* bItem, const wxPoint& bPos, int aScalingFactor );
/** /**
* Constructor * Constructor
@ -199,9 +198,8 @@ public:
* @param bItem The second of the two conflicting objects * @param bItem The second of the two conflicting objects
* @param bPos The position of the second of two objects * @param bPos The position of the second of two objects
*/ */
void SetData( EDA_UNITS_T aUnits, int aErrorCode, const wxPoint& aMarkerPos, void SetData( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos, EDA_ITEM* aItem,
EDA_ITEM* aItem, const wxPoint& aPos, const wxPoint& aPos, EDA_ITEM* bItem = nullptr, const wxPoint& bPos = wxPoint() );
EDA_ITEM* bItem = nullptr, const wxPoint& bPos = wxPoint() );
/** /**
* Function SetData * Function SetData

View File

@ -1390,7 +1390,7 @@ public:
textAsLines = true; textAsLines = true;
m_currentColor = COLOR4D::BLACK; m_currentColor = COLOR4D::BLACK;
m_currentLineType = 0; m_currentLineType = 0;
SetUnits( DXF_PLOTTER::DXF_UNIT_INCHES ); SetUnits( DXF_UNITS::INCHES );
} }
virtual PlotFormat GetPlotterType() const override virtual PlotFormat GetPlotterType() const override
@ -1477,10 +1477,10 @@ public:
// Must be in the same order as the drop-down list in the plot dialog inside pcbnew // Must be in the same order as the drop-down list in the plot dialog inside pcbnew
enum DXF_UNITS enum class DXF_UNITS
{ {
DXF_UNIT_INCHES = 0, INCHES = 0,
DXF_UNIT_MILLIMETERS = 1 MILLIMETERS = 1
}; };
/** /**

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