Update more places to properly display mils

This commit is contained in:
Ian McInerney 2020-10-04 00:56:42 +01:00
parent b1bd1f2a97
commit ad29a2f3b4
5 changed files with 82 additions and 11 deletions

View File

@ -357,12 +357,27 @@ void GERBER_FILE_IMAGE::DisplayImageInfo( GERBVIEW_FRAME* aMainFrame )
msg = m_ImageJustifyYCenter ? _("Center") : _("Normal");
aMainFrame->AppendMsgPanel( _( "Y Justify" ), msg, DARKRED );
if( aMainFrame->GetUserUnits() == EDA_UNITS::INCHES )
switch( aMainFrame->GetUserUnits() )
{
case EDA_UNITS::MILS:
msg.Printf( wxT( "X=%f Y=%f" ), Iu2Mils( m_ImageJustifyOffset.x ),
Iu2Mils( m_ImageJustifyOffset.y ) );
break;
case EDA_UNITS::INCHES:
msg.Printf( wxT( "X=%f Y=%f" ), Iu2Mils( m_ImageJustifyOffset.x ) / 1000.0,
Iu2Mils( m_ImageJustifyOffset.y ) / 1000.0 );
else
break;
case EDA_UNITS::MILLIMETRES:
msg.Printf( wxT( "X=%f Y=%f" ), Iu2Millimeter( m_ImageJustifyOffset.x ),
Iu2Millimeter( m_ImageJustifyOffset.y ) );
break;
default:
wxASSERT_MSG( false, "Invalid unit" );
}
aMainFrame->AppendMsgPanel( _( "Image Justify Offset" ), msg, DARKRED );
}

View File

@ -540,9 +540,32 @@ void GERBVIEW_FRAME::Liste_D_Codes()
int ii, jj;
wxString Line;
wxArrayString list;
double scale = GetUserUnits() == EDA_UNITS::INCHES ? IU_PER_MILS * 1000 : IU_PER_MM;
int curr_layer = GetActiveLayer();
double scale = 1.0;
wxString units;
switch( GetUserUnits() )
{
case EDA_UNITS::MILLIMETRES:
scale = IU_PER_MM;
units = "mm";
break;
case EDA_UNITS::INCHES:
scale = IU_PER_MILS * 1000;
units = "in";
break;
case EDA_UNITS::MILS:
scale = IU_PER_MILS;
units = "mil";
break;
default:
wxASSERT_MSG( false, "Invalid units" );
}
for( int layer = 0; layer < (int)ImagesMaxCount(); ++layer )
{
GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
@ -560,8 +583,6 @@ void GERBVIEW_FRAME::Liste_D_Codes()
list.Add( Line );
const char* units = GetUserUnits() == EDA_UNITS::INCHES ? "\"" : "mm";
for( ii = 0, jj = 1; ii < TOOLS_MAX_COUNT; ii++ )
{
D_CODE* pt_D_code = gerber->GetDCODE( ii + FIRST_DCODE );

View File

@ -299,8 +299,30 @@ void GERBVIEW_FRAME::updateDCodeSelectBox()
// Build the aperture list of the current layer, and add it to the combo box:
wxArrayString dcode_list;
wxString msg;
const char* units = GetUserUnits() == EDA_UNITS::INCHES ? "mils" : "mm";
double scale = GetUserUnits() == EDA_UNITS::INCHES ? IU_PER_MILS : IU_PER_MM;
double scale = 1.0;
wxString units;
switch( GetUserUnits() )
{
case EDA_UNITS::MILLIMETRES:
scale = IU_PER_MM;
units = "mm";
break;
case EDA_UNITS::INCHES:
scale = IU_PER_MILS * 1000;
units = "in";
break;
case EDA_UNITS::MILS:
scale = IU_PER_MILS;
units = "mil";
break;
default:
wxASSERT_MSG( false, "Invalid units" );
}
for( int ii = 0; ii < TOOLS_MAX_COUNT; ii++ )
{

View File

@ -337,10 +337,23 @@ void DIALOG_BOARD_STATISTICS::getDataFromPCB()
}
}
if( GetUserUnits() == EDA_UNITS::INCHES )
switch( GetUserUnits() )
{
case EDA_UNITS::INCHES:
m_boardArea /= ( IU_PER_MILS * IU_PER_MILS * 1000000 );
else
break;
case EDA_UNITS::MILS:
m_boardArea /= ( IU_PER_MILS * IU_PER_MILS );
break;
case EDA_UNITS::MILLIMETRES:
m_boardArea /= ( IU_PER_MM * IU_PER_MM );
break;
default:
wxASSERT_MSG( false, "Invalid unit" );
}
m_boardWidth = bbox.GetWidth();
m_boardHeight = bbox.GetHeight();

View File

@ -513,7 +513,7 @@ void PCB_EDIT_FRAME::GenFootprintsReport( wxCommandEvent& event )
fn.SetPath( dirDialog.GetPath() );
fn.SetExt( wxT( "rpt" ) );
bool unitMM = GetUserUnits() != EDA_UNITS::INCHES;
bool unitMM = GetUserUnits() == EDA_UNITS::MILLIMETRES;
bool success = DoGenFootprintsReport( fn.GetFullPath(), unitMM );
wxString msg;