mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-20 00:21:31 +00:00
Add mils to units, remove useMils variables
This commit is contained in:
parent
676f3221cc
commit
400c15b8eb
common
eeschema
dialogs
fields_grid_table.cpplib_arc.cpplib_bezier.cpplib_circle.cpplib_field.cpplib_pin.cpplib_polyline.cpplib_rectangle.cpplib_text.cppsch_pin.cppsch_text.cppinclude
pcbnew
board_stackup_manager
class_dimension.cppclass_dimension.hclass_drawsegment.cppclass_pad.cppclass_text_mod.cppclass_track.cppclass_zone.cppconvert_drawsegment_list_to_polygon.cppdialogs
dialog_board_reannotate.cppdialog_dimension_properties.cppdialog_global_edit_text_and_graphics.cppdialog_global_edit_tracks_and_vias.cppdialog_pad_basicshapes_properties.cppdialog_pad_properties.cppdialog_plot.cppdialog_pns_length_tuning_settings.cppdialog_track_via_properties.cppdialog_track_via_size.cpppanel_modedit_defaults.cpppanel_setup_feature_constraints.cpppanel_setup_text_and_graphics.cpppanel_setup_tracks_and_vias.cpp
drc
drc_engine.cppdrc_test_provider_annulus.cppdrc_test_provider_copper_clearance.cppdrc_test_provider_diff_pair_coupling.cppdrc_test_provider_edge_clearance.cppdrc_test_provider_hole_clearance.cppdrc_test_provider_hole_size.cppdrc_test_provider_matched_length.cppdrc_test_provider_silk_to_silk.cppdrc_test_provider_track_width.cppdrc_test_provider_via_diameter.cpp
eagle_plugin.cppfootprint_editor_settings.cppfootprint_preview_panel.cppmicrowave
netinfo_item.cpppcb_base_edit_frame.cpppcb_expr_evaluator.cpppcb_parser.cpppcbnew_settings.cppplugins
router
text_mod_grid_table.cpptools
qa/drc_proto
@ -40,6 +40,7 @@
|
||||
#include <macros.h>
|
||||
#include <title_block.h>
|
||||
|
||||
// We need this function even in routines that do not define internal units
|
||||
|
||||
#if defined( PCBNEW ) || defined( CVPCB ) || defined( EESCHEMA ) || defined( GERBVIEW ) || defined( PL_EDITOR )
|
||||
#define IU_TO_MM( x ) ( x / IU_PER_MM )
|
||||
@ -52,7 +53,6 @@
|
||||
#error "Cannot resolve internal units due to no definition of EESCHEMA, CVPCB or PCBNEW."
|
||||
#endif
|
||||
|
||||
|
||||
// Helper function to print a float number without using scientific notation
|
||||
// and no trailing 0
|
||||
// So we cannot always just use the %g or the %f format to print a fp number
|
||||
@ -89,18 +89,18 @@ std::string Double2Str( double aValue )
|
||||
}
|
||||
|
||||
|
||||
double To_User_Unit( EDA_UNITS aUnit, double aValue, bool aUseMils )
|
||||
double To_User_Unit( EDA_UNITS aUnit, double aValue )
|
||||
{
|
||||
switch( aUnit )
|
||||
{
|
||||
case EDA_UNITS::MILLIMETRES:
|
||||
return IU_TO_MM( aValue );
|
||||
|
||||
case EDA_UNITS::MILS:
|
||||
return IU_TO_MILS( aValue );
|
||||
|
||||
case EDA_UNITS::INCHES:
|
||||
if( aUseMils )
|
||||
return IU_TO_MILS( aValue );
|
||||
else
|
||||
return IU_TO_IN( aValue );
|
||||
return IU_TO_IN( aValue );
|
||||
|
||||
case EDA_UNITS::DEGREES:
|
||||
return aValue / 10.0f;
|
||||
@ -121,22 +121,21 @@ double To_User_Unit( EDA_UNITS aUnit, double aValue, bool aUseMils )
|
||||
*/
|
||||
|
||||
// A lower-precision (for readability) version of StringFromValue()
|
||||
wxString MessageTextFromValue( EDA_UNITS aUnits, int aValue, bool aUseMils, EDA_DATA_TYPE aType )
|
||||
wxString MessageTextFromValue( EDA_UNITS aUnits, int aValue, EDA_DATA_TYPE aType )
|
||||
{
|
||||
return MessageTextFromValue( aUnits, double( aValue ), aUseMils );
|
||||
return MessageTextFromValue( aUnits, double( aValue ), aType );
|
||||
}
|
||||
|
||||
|
||||
// A lower-precision (for readability) version of StringFromValue()
|
||||
wxString MessageTextFromValue( EDA_UNITS aUnits, long long int aValue,
|
||||
bool aUseMils, EDA_DATA_TYPE aType )
|
||||
wxString MessageTextFromValue( EDA_UNITS aUnits, long long int aValue, EDA_DATA_TYPE aType )
|
||||
{
|
||||
return MessageTextFromValue( aUnits, double( aValue ), aUseMils );
|
||||
return MessageTextFromValue( aUnits, double( aValue ), aType );
|
||||
}
|
||||
|
||||
|
||||
// A lower-precision (for readability) version of StringFromValue()
|
||||
wxString MessageTextFromValue( EDA_UNITS aUnits, double aValue, bool aUseMils, EDA_DATA_TYPE aType )
|
||||
wxString MessageTextFromValue( EDA_UNITS aUnits, double aValue, EDA_DATA_TYPE aType )
|
||||
{
|
||||
wxString text;
|
||||
const wxChar* format;
|
||||
@ -145,51 +144,51 @@ wxString MessageTextFromValue( EDA_UNITS aUnits, double aValue, bool aUseMils, E
|
||||
switch( aType )
|
||||
{
|
||||
case EDA_DATA_TYPE::VOLUME:
|
||||
value = To_User_Unit( aUnits, value, aUseMils );
|
||||
value = To_User_Unit( aUnits, value );
|
||||
// Fall through to continue computation
|
||||
KI_FALLTHROUGH;
|
||||
|
||||
case EDA_DATA_TYPE::AREA:
|
||||
value = To_User_Unit( aUnits, value, aUseMils );
|
||||
value = To_User_Unit( aUnits, value );
|
||||
// Fall through to continue computation
|
||||
KI_FALLTHROUGH;
|
||||
|
||||
case EDA_DATA_TYPE::DISTANCE:
|
||||
value = To_User_Unit( aUnits, value, aUseMils );
|
||||
value = To_User_Unit( aUnits, value );
|
||||
}
|
||||
|
||||
if( aUnits == EDA_UNITS::INCHES )
|
||||
{
|
||||
if( aUseMils )
|
||||
{
|
||||
#if defined( EESCHEMA )
|
||||
format = wxT( "%.0f" );
|
||||
#else
|
||||
format = wxT( "%.1f" );
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined( EESCHEMA )
|
||||
format = wxT( "%.3f" );
|
||||
#else
|
||||
format = wxT( "%.4f" );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
switch( aUnits )
|
||||
{
|
||||
default:
|
||||
case EDA_UNITS::MILLIMETRES:
|
||||
#if defined( EESCHEMA )
|
||||
format = wxT( "%.4f" );
|
||||
#else
|
||||
format = wxT( "%.3f" );
|
||||
#endif
|
||||
break;
|
||||
|
||||
case EDA_UNITS::MILS:
|
||||
#if defined( EESCHEMA )
|
||||
format = wxT( "%.0f" );
|
||||
#else
|
||||
format = wxT( "%.1f" );
|
||||
#endif
|
||||
break;
|
||||
|
||||
case EDA_UNITS::INCHES:
|
||||
#if defined( EESCHEMA )
|
||||
format = wxT( "%.4f" );
|
||||
#else
|
||||
format = wxT( "%.3f" );
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
text.Printf( format, value );
|
||||
text += " ";
|
||||
|
||||
text += GetAbbreviatedUnitsLabel( aUnits, aUseMils, aType );
|
||||
text += GetAbbreviatedUnitsLabel( aUnits, aType );
|
||||
|
||||
return text;
|
||||
}
|
||||
@ -230,23 +229,22 @@ void StripTrailingZeros( wxString& aStringValue, unsigned aTrailingZeroAllowed )
|
||||
* otherwise the actual value is rounded when read from dialog and converted
|
||||
* in internal units, and therefore modified.
|
||||
*/
|
||||
wxString StringFromValue( EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, bool aUseMils,
|
||||
EDA_DATA_TYPE aType )
|
||||
wxString StringFromValue( EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, EDA_DATA_TYPE aType )
|
||||
{
|
||||
double value_to_print = aValue;
|
||||
|
||||
switch( aType )
|
||||
{
|
||||
case EDA_DATA_TYPE::VOLUME:
|
||||
value_to_print = To_User_Unit( aUnits, value_to_print, aUseMils );
|
||||
value_to_print = To_User_Unit( aUnits, value_to_print );
|
||||
KI_FALLTHROUGH;
|
||||
|
||||
case EDA_DATA_TYPE::AREA:
|
||||
value_to_print = To_User_Unit( aUnits, value_to_print, aUseMils );
|
||||
value_to_print = To_User_Unit( aUnits, value_to_print );
|
||||
KI_FALLTHROUGH;
|
||||
|
||||
case EDA_DATA_TYPE::DISTANCE:
|
||||
value_to_print = To_User_Unit( aUnits, value_to_print, aUseMils );
|
||||
value_to_print = To_User_Unit( aUnits, value_to_print );
|
||||
}
|
||||
|
||||
|
||||
@ -276,7 +274,7 @@ wxString StringFromValue( EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol,
|
||||
}
|
||||
else
|
||||
{
|
||||
if( aUnits == EDA_UNITS::INCHES && aUseMils )
|
||||
if( aUnits == EDA_UNITS::MILS )
|
||||
len = sprintf( buf, "%.7g", value_to_print );
|
||||
else
|
||||
len = sprintf( buf, "%.10g", value_to_print );
|
||||
@ -290,13 +288,6 @@ wxString StringFromValue( EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol,
|
||||
{
|
||||
switch( aUnits )
|
||||
{
|
||||
case EDA_UNITS::INCHES:
|
||||
if( aUseMils )
|
||||
stringValue += wxT( " mils" );
|
||||
else
|
||||
stringValue += wxT( " in" );
|
||||
break;
|
||||
|
||||
case EDA_UNITS::MILLIMETRES:
|
||||
stringValue += wxT( " mm" );
|
||||
break;
|
||||
@ -305,6 +296,14 @@ wxString StringFromValue( EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol,
|
||||
stringValue += wxT( " deg" );
|
||||
break;
|
||||
|
||||
case EDA_UNITS::MILS:
|
||||
stringValue += wxT( " mils" );
|
||||
break;
|
||||
|
||||
case EDA_UNITS::INCHES:
|
||||
stringValue += wxT( " in" );
|
||||
break;
|
||||
|
||||
case EDA_UNITS::PERCENT:
|
||||
stringValue += wxT( "%" );
|
||||
break;
|
||||
@ -318,18 +317,18 @@ wxString StringFromValue( EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol,
|
||||
}
|
||||
|
||||
|
||||
double From_User_Unit( EDA_UNITS aUnits, double aValue, bool aUseMils )
|
||||
double From_User_Unit( EDA_UNITS aUnits, double aValue )
|
||||
{
|
||||
switch( aUnits )
|
||||
{
|
||||
case EDA_UNITS::MILLIMETRES:
|
||||
return MM_TO_IU( aValue );
|
||||
|
||||
case EDA_UNITS::MILS:
|
||||
return MILS_TO_IU( aValue );
|
||||
|
||||
case EDA_UNITS::INCHES:
|
||||
if( aUseMils )
|
||||
return MILS_TO_IU( aValue );
|
||||
else
|
||||
return IN_TO_IU( aValue );
|
||||
return IN_TO_IU( aValue );
|
||||
|
||||
case EDA_UNITS::DEGREES:
|
||||
// Convert to "decidegrees"
|
||||
@ -343,8 +342,7 @@ double From_User_Unit( EDA_UNITS aUnits, double aValue, bool aUseMils )
|
||||
}
|
||||
|
||||
|
||||
double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, bool aUseMils,
|
||||
EDA_DATA_TYPE aType )
|
||||
double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, EDA_DATA_TYPE aType )
|
||||
{
|
||||
double dtmp = 0;
|
||||
|
||||
@ -380,26 +378,23 @@ double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, bool
|
||||
// Check the optional unit designator (2 ch significant)
|
||||
wxString unit( buf.Mid( brk_point ).Strip( wxString::leading ).Left( 2 ).Lower() );
|
||||
|
||||
if( aUnits == EDA_UNITS::INCHES || aUnits == EDA_UNITS::MILLIMETRES )
|
||||
if( aUnits == EDA_UNITS::MILLIMETRES || aUnits == EDA_UNITS::MILS || aUnits == EDA_UNITS::INCHES )
|
||||
{
|
||||
if( unit == wxT( "in" ) || unit == wxT( "\"" ) )
|
||||
{
|
||||
aUnits = EDA_UNITS::INCHES;
|
||||
aUseMils = false;
|
||||
}
|
||||
else if( unit == wxT( "mm" ) )
|
||||
if( unit == wxT( "mm" ) )
|
||||
{
|
||||
aUnits = EDA_UNITS::MILLIMETRES;
|
||||
}
|
||||
else if( unit == wxT( "mi" ) || unit == wxT( "th" ) ) // "mils" or "thou"
|
||||
else if( unit == wxT( "mi" ) || unit == wxT( "th" ) )
|
||||
{
|
||||
aUnits = EDA_UNITS::INCHES;
|
||||
aUseMils = true;
|
||||
aUnits = EDA_UNITS::MILS;
|
||||
}
|
||||
else if( unit == "oz" ) // 1 oz = 1.37 mils
|
||||
else if( unit == wxT( "in" ) || unit == wxT( "\"" ) )
|
||||
{
|
||||
aUnits = EDA_UNITS::INCHES;
|
||||
aUseMils = true;
|
||||
}
|
||||
else if( unit == "oz" ) // 1 oz = 1.37 mils
|
||||
{
|
||||
aUnits = EDA_UNITS::MILS;
|
||||
dtmp *= 1.37;
|
||||
}
|
||||
}
|
||||
@ -414,22 +409,22 @@ double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, bool
|
||||
switch( aType )
|
||||
{
|
||||
case EDA_DATA_TYPE::VOLUME:
|
||||
dtmp = From_User_Unit( aUnits, dtmp, aUseMils );
|
||||
dtmp = From_User_Unit( aUnits, dtmp );
|
||||
KI_FALLTHROUGH;
|
||||
|
||||
case EDA_DATA_TYPE::AREA:
|
||||
dtmp = From_User_Unit( aUnits, dtmp, aUseMils );
|
||||
dtmp = From_User_Unit( aUnits, dtmp );
|
||||
KI_FALLTHROUGH;
|
||||
|
||||
case EDA_DATA_TYPE::DISTANCE:
|
||||
dtmp = From_User_Unit( aUnits, dtmp, aUseMils );
|
||||
dtmp = From_User_Unit( aUnits, dtmp );
|
||||
}
|
||||
|
||||
return dtmp;
|
||||
}
|
||||
|
||||
|
||||
void FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS& aUnits, bool& aUseMils )
|
||||
void FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS& aUnits )
|
||||
{
|
||||
wxString buf( aTextValue.Strip( wxString::both ) );
|
||||
unsigned brk_point = 0;
|
||||
@ -447,31 +442,20 @@ void FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS& aUnits, bool&
|
||||
// Check the unit designator (2 ch significant)
|
||||
wxString unit( buf.Mid( brk_point ).Strip( wxString::leading ).Left( 2 ).Lower() );
|
||||
|
||||
if( unit == wxT( "in" ) || unit == wxT( "\"" ) )
|
||||
{
|
||||
aUnits = EDA_UNITS::INCHES;
|
||||
aUseMils = false;
|
||||
}
|
||||
else if( unit == wxT( "mm" ) )
|
||||
{
|
||||
if( unit == wxT( "mm" ) )
|
||||
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 = EDA_UNITS::MILS;
|
||||
else if( unit == wxT( "in" ) || unit == wxT( "\"" ) )
|
||||
aUnits = EDA_UNITS::INCHES;
|
||||
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 = EDA_UNITS::DEGREES;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
long long int ValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, bool aUseMils,
|
||||
EDA_DATA_TYPE aType )
|
||||
long long int ValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, EDA_DATA_TYPE aType )
|
||||
{
|
||||
double value = DoubleValueFromString( aUnits, aTextValue, aUseMils, aType );
|
||||
double value = DoubleValueFromString( aUnits, aTextValue, aType );
|
||||
return KiROUND<double, long long int>( value );
|
||||
}
|
||||
|
||||
@ -492,42 +476,10 @@ wxString AngleToStringDegrees( double aAngle )
|
||||
}
|
||||
|
||||
|
||||
wxString GetAbbreviatedUnitsLabel( EDA_UNITS aUnit, bool aUseMils, EDA_DATA_TYPE aType )
|
||||
wxString GetAbbreviatedUnitsLabel( EDA_UNITS aUnit, EDA_DATA_TYPE aType )
|
||||
{
|
||||
switch( aUnit )
|
||||
{
|
||||
case EDA_UNITS::INCHES:
|
||||
if( aUseMils )
|
||||
{
|
||||
switch( aType )
|
||||
{
|
||||
default:
|
||||
wxASSERT( 0 );
|
||||
KI_FALLTHROUGH;
|
||||
case EDA_DATA_TYPE::DISTANCE:
|
||||
return _( "mils" );
|
||||
case EDA_DATA_TYPE::AREA:
|
||||
return _( "sq. mils" );
|
||||
case EDA_DATA_TYPE::VOLUME:
|
||||
return _( "cu. mils" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch( aType )
|
||||
{
|
||||
default:
|
||||
wxASSERT( 0 );
|
||||
KI_FALLTHROUGH;
|
||||
case EDA_DATA_TYPE::DISTANCE:
|
||||
return _( "in" );
|
||||
case EDA_DATA_TYPE::AREA:
|
||||
return _( "sq. in" );
|
||||
case EDA_DATA_TYPE::VOLUME:
|
||||
return _( "cu. in" );
|
||||
}
|
||||
}
|
||||
|
||||
case EDA_UNITS::MILLIMETRES:
|
||||
switch( aType )
|
||||
{
|
||||
@ -542,6 +494,34 @@ wxString GetAbbreviatedUnitsLabel( EDA_UNITS aUnit, bool aUseMils, EDA_DATA_TYPE
|
||||
return _( "cu. mm" );
|
||||
}
|
||||
|
||||
case EDA_UNITS::MILS:
|
||||
switch( aType )
|
||||
{
|
||||
default:
|
||||
wxASSERT( 0 );
|
||||
KI_FALLTHROUGH;
|
||||
case EDA_DATA_TYPE::DISTANCE:
|
||||
return _( "mils" );
|
||||
case EDA_DATA_TYPE::AREA:
|
||||
return _( "sq. mils" );
|
||||
case EDA_DATA_TYPE::VOLUME:
|
||||
return _( "cu. mils" );
|
||||
}
|
||||
|
||||
case EDA_UNITS::INCHES:
|
||||
switch( aType )
|
||||
{
|
||||
default:
|
||||
wxASSERT( 0 );
|
||||
KI_FALLTHROUGH;
|
||||
case EDA_DATA_TYPE::DISTANCE:
|
||||
return _( "in" );
|
||||
case EDA_DATA_TYPE::AREA:
|
||||
return _( "sq. in" );
|
||||
case EDA_DATA_TYPE::VOLUME:
|
||||
return _( "cu. in" );
|
||||
}
|
||||
|
||||
case EDA_UNITS::PERCENT:
|
||||
return _( "%" );
|
||||
|
||||
@ -613,4 +593,3 @@ std::string FormatInternalUnits( const wxSize& aSize )
|
||||
{
|
||||
return FormatInternalUnits( aSize.GetWidth() ) + " " + FormatInternalUnits( aSize.GetHeight() );
|
||||
}
|
||||
|
||||
|
@ -86,8 +86,8 @@ bool DIALOG_GRID_SETTINGS::TransferDataFromWindow()
|
||||
|
||||
gridCfg.last_size_idx = m_currentGridCtrl->GetSelection();
|
||||
m_parent->SetGridOrigin( wxPoint( m_gridOriginX.GetValue(), m_gridOriginY.GetValue() ) );
|
||||
gridCfg.user_grid_x = StringFromValue( GetUserUnits(), m_userGridX.GetValue(), true, true );
|
||||
gridCfg.user_grid_y = StringFromValue( GetUserUnits(), m_userGridY.GetValue(), true, true );
|
||||
gridCfg.user_grid_x = StringFromValue( GetUserUnits(), m_userGridX.GetValue(), true );
|
||||
gridCfg.user_grid_y = StringFromValue( GetUserUnits(), m_userGridY.GetValue(), true );
|
||||
gridCfg.fast_grid_1 = m_grid1Ctrl->GetSelection();
|
||||
gridCfg.fast_grid_2 = m_grid2Ctrl->GetSelection();
|
||||
|
||||
@ -111,8 +111,8 @@ bool DIALOG_GRID_SETTINGS::TransferDataToWindow()
|
||||
|
||||
m_currentGridCtrl->SetSelection( m_parent->config()->m_Window.grid.last_size_idx );
|
||||
|
||||
m_userGridX.SetValue( ValueFromString( GetUserUnits(), gridCfg.user_grid_x, true ) );
|
||||
m_userGridY.SetValue( ValueFromString( GetUserUnits(), gridCfg.user_grid_y, true ) );
|
||||
m_userGridX.SetValue( ValueFromString( GetUserUnits(), gridCfg.user_grid_x ) );
|
||||
m_userGridY.SetValue( ValueFromString( GetUserUnits(), gridCfg.user_grid_y ) );
|
||||
|
||||
m_gridOriginX.SetValue( m_parent->GetGridOrigin().x );
|
||||
m_gridOriginY.SetValue( m_parent->GetGridOrigin().y );
|
||||
|
@ -255,10 +255,10 @@ void DIALOG_PAGES_SETTINGS::initDialog()
|
||||
|
||||
void DIALOG_PAGES_SETTINGS::OnOkClick( wxCommandEvent& event )
|
||||
{
|
||||
if( !m_customSizeX.Validate( MIN_PAGE_SIZE_MILS, m_maxPageSizeMils.x, EDA_UNITS::INCHES, true ) )
|
||||
if( !m_customSizeX.Validate( MIN_PAGE_SIZE_MILS, m_maxPageSizeMils.x, EDA_UNITS::INCHES ) )
|
||||
return;
|
||||
|
||||
if( !m_customSizeY.Validate( MIN_PAGE_SIZE_MILS, m_maxPageSizeMils.y, EDA_UNITS::INCHES, true ) )
|
||||
if( !m_customSizeY.Validate( MIN_PAGE_SIZE_MILS, m_maxPageSizeMils.y, EDA_UNITS::INCHES ) )
|
||||
return;
|
||||
|
||||
if( SavePageSettings() )
|
||||
|
@ -199,7 +199,7 @@ static void netclassToGridRow( EDA_UNITS aUnits, wxGrid* aGrid, int aRow, const
|
||||
aGrid->SetCellValue( aRow, GRID_NAME, nc->GetName() );
|
||||
|
||||
#define SET_MILS_CELL( col, val ) \
|
||||
aGrid->SetCellValue( aRow, col, StringFromValue( aUnits, val, true, true ) )
|
||||
aGrid->SetCellValue( aRow, col, StringFromValue( aUnits, val, true ) )
|
||||
|
||||
SET_MILS_CELL( GRID_CLEARANCE, nc->GetClearance() );
|
||||
SET_MILS_CELL( GRID_TRACKSIZE, nc->GetTrackWidth() );
|
||||
@ -327,7 +327,7 @@ static void gridRowToNetclass( EDA_UNITS aUnits, wxGrid* grid, int row, const NE
|
||||
nc->SetName( grid->GetCellValue( row, GRID_NAME ) );
|
||||
|
||||
#define MYCELL( col ) \
|
||||
ValueFromString( aUnits, grid->GetCellValue( row, col ), true )
|
||||
ValueFromString( aUnits, grid->GetCellValue( row, col ) )
|
||||
|
||||
nc->SetClearance( MYCELL( GRID_CLEARANCE ) );
|
||||
nc->SetTrackWidth( MYCELL( GRID_TRACKSIZE ) );
|
||||
|
@ -78,8 +78,8 @@ void EDA_POSITION_CTRL::Enable( bool x_win_on, bool y_win_on )
|
||||
|
||||
void EDA_POSITION_CTRL::SetValue( int x_value, int y_value )
|
||||
{
|
||||
m_FramePosX->SetValue( StringFromValue( m_UserUnit, x_value, true ) );
|
||||
m_FramePosY->SetValue( StringFromValue( m_UserUnit, y_value, true ) );
|
||||
m_FramePosX->SetValue( StringFromValue( m_UserUnit, x_value ) );
|
||||
m_FramePosY->SetValue( StringFromValue( m_UserUnit, y_value ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,6 +45,7 @@ wxString KIGFX::PREVIEW::DimensionLabel( const wxString& prefix, double aVal, ED
|
||||
switch( aUnits )
|
||||
{
|
||||
case EDA_UNITS::MILLIMETRES: fmtStr = wxT( "%.3f" ); break; // 1um
|
||||
case EDA_UNITS::MILS: fmtStr = wxT( "%.1f" ); break; // 0.1mil
|
||||
case EDA_UNITS::INCHES: fmtStr = wxT( "%.4f" ); break; // 0.1mil
|
||||
case EDA_UNITS::DEGREES: fmtStr = wxT( "%.1f" ); break; // 0.1deg
|
||||
case EDA_UNITS::PERCENT: fmtStr = wxT( "%.1f" ); break; // 0.1%
|
||||
@ -54,7 +55,7 @@ wxString KIGFX::PREVIEW::DimensionLabel( const wxString& prefix, double aVal, ED
|
||||
str << wxString::Format( fmtStr, To_User_Unit( aUnits, aVal ) );
|
||||
|
||||
if( aIncludeUnits )
|
||||
str << " " << GetAbbreviatedUnitsLabel( aUnits, false );
|
||||
str << " " << GetAbbreviatedUnitsLabel( aUnits );
|
||||
|
||||
return str;
|
||||
}
|
||||
|
@ -51,12 +51,12 @@ void COMMON_TOOLS::Reset( RESET_REASON aReason )
|
||||
|
||||
for( const wxString& gridDef : settings.sizes )
|
||||
{
|
||||
int gridSize = (int) ValueFromString( EDA_UNITS::MILLIMETRES, gridDef, true );
|
||||
int gridSize = (int) ValueFromString( EDA_UNITS::MILLIMETRES, gridDef );
|
||||
m_grids.emplace_back( gridSize, gridSize );
|
||||
}
|
||||
|
||||
m_grids.emplace_back( ValueFromString( EDA_UNITS::MILLIMETRES, settings.user_grid_x, true ),
|
||||
ValueFromString( EDA_UNITS::MILLIMETRES, settings.user_grid_y, true ) );
|
||||
m_grids.emplace_back( ValueFromString( EDA_UNITS::MILLIMETRES, settings.user_grid_x ),
|
||||
ValueFromString( EDA_UNITS::MILLIMETRES, settings.user_grid_y ) );
|
||||
|
||||
OnGridChanged();
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ void GRID_MENU::BuildChoiceList( wxArrayString* aGridsList, APP_SETTINGS_BASE* a
|
||||
|
||||
for( const wxString& gridSize : aCfg->m_Window.grid.sizes )
|
||||
{
|
||||
int val = (int) ValueFromString( EDA_UNITS::MILLIMETRES, gridSize, true );
|
||||
int val = (int) ValueFromString( EDA_UNITS::MILLIMETRES, gridSize );
|
||||
double gridValueMils = To_User_Unit( EDA_UNITS::INCHES, val ) * 1000;
|
||||
double gridValue_mm = To_User_Unit( EDA_UNITS::MILLIMETRES, val );
|
||||
|
||||
@ -98,7 +98,7 @@ void GRID_MENU::BuildChoiceList( wxArrayString* aGridsList, APP_SETTINGS_BASE* a
|
||||
|
||||
if( !aCfg->m_Window.grid.user_grid_x.empty() )
|
||||
{
|
||||
int val = (int) ValueFromString( EDA_UNITS::INCHES, aCfg->m_Window.grid.user_grid_x, true );
|
||||
int val = (int) ValueFromString( EDA_UNITS::INCHES, aCfg->m_Window.grid.user_grid_x );
|
||||
double gridValueMils = To_User_Unit( EDA_UNITS::INCHES, val ) * 1000;
|
||||
double gridValue_mm = To_User_Unit( EDA_UNITS::MILLIMETRES, val );
|
||||
|
||||
|
@ -37,17 +37,16 @@ wxDEFINE_EVENT( DELAY_FOCUS, wxCommandEvent );
|
||||
|
||||
UNIT_BINDER::UNIT_BINDER( EDA_DRAW_FRAME* aParent,
|
||||
wxStaticText* aLabel, wxWindow* aValue, wxStaticText* aUnitLabel,
|
||||
bool aUseMils, bool allowEval ) :
|
||||
bool allowEval ) :
|
||||
m_frame( aParent ),
|
||||
m_label( aLabel ),
|
||||
m_value( aValue ),
|
||||
m_unitLabel( aUnitLabel ),
|
||||
m_eval( aParent->GetUserUnits(), aUseMils ),
|
||||
m_eval( aParent->GetUserUnits() ),
|
||||
m_originTransforms( aParent->GetOriginTransforms() ),
|
||||
m_coordType( ORIGIN_TRANSFORMS::NOT_A_COORD )
|
||||
{
|
||||
m_units = aParent->GetUserUnits();
|
||||
m_useMils = aUseMils;
|
||||
m_dataType = EDA_DATA_TYPE::DISTANCE;
|
||||
m_allowEval = allowEval && dynamic_cast<wxTextEntry*>( m_value );
|
||||
m_needsEval = false;
|
||||
@ -62,7 +61,7 @@ UNIT_BINDER::UNIT_BINDER( EDA_DRAW_FRAME* aParent,
|
||||
textEntry->ChangeValue( wxT( "0" ) );
|
||||
}
|
||||
|
||||
m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units, m_useMils, m_dataType ) );
|
||||
m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units, m_dataType ) );
|
||||
|
||||
m_value->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( UNIT_BINDER::onSetFocus ), NULL, this );
|
||||
m_value->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( UNIT_BINDER::onKillFocus ), NULL, this );
|
||||
@ -78,18 +77,17 @@ UNIT_BINDER::~UNIT_BINDER()
|
||||
}
|
||||
|
||||
|
||||
void UNIT_BINDER::SetUnits( EDA_UNITS aUnits, bool aUseMils )
|
||||
void UNIT_BINDER::SetUnits( EDA_UNITS aUnits )
|
||||
{
|
||||
m_units = aUnits;
|
||||
m_useMils = aUseMils;
|
||||
m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units, m_useMils, m_dataType ) );
|
||||
m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units, m_dataType ) );
|
||||
}
|
||||
|
||||
|
||||
void UNIT_BINDER::SetDataType( EDA_DATA_TYPE aDataType )
|
||||
{
|
||||
m_dataType = aDataType;
|
||||
m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units, m_useMils, m_dataType ) );
|
||||
m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units, m_dataType ) );
|
||||
}
|
||||
|
||||
|
||||
@ -97,7 +95,7 @@ void UNIT_BINDER::onUnitsChanged( wxCommandEvent& aEvent )
|
||||
{
|
||||
int temp = (int) GetValue();
|
||||
|
||||
SetUnits( m_frame->GetUserUnits(), m_useMils );
|
||||
SetUnits( m_frame->GetUserUnits() );
|
||||
|
||||
SetValue( temp );
|
||||
|
||||
@ -178,7 +176,7 @@ void UNIT_BINDER::delayedFocusHandler( wxCommandEvent& )
|
||||
}
|
||||
|
||||
|
||||
bool UNIT_BINDER::Validate( double aMin, double aMax, EDA_UNITS aUnits, bool aUseMils )
|
||||
bool UNIT_BINDER::Validate( double aMin, double aMax, EDA_UNITS aUnits )
|
||||
{
|
||||
wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_value );
|
||||
|
||||
@ -191,12 +189,12 @@ bool UNIT_BINDER::Validate( double aMin, double aMax, EDA_UNITS aUnits, bool aUs
|
||||
|
||||
// TODO: Validate() does not currently support m_dataType being anything other than DISTANCE
|
||||
// Note: aMin and aMax are not always given in internal units
|
||||
if( GetValue() < From_User_Unit( aUnits, aMin, aUseMils ) )
|
||||
if( GetValue() < From_User_Unit( aUnits, aMin ) )
|
||||
{
|
||||
double val_min_iu = From_User_Unit( aUnits, aMin, aUseMils );
|
||||
double val_min_iu = From_User_Unit( aUnits, aMin );
|
||||
m_errorMessage = wxString::Format( _( "%s must be at least %s." ),
|
||||
valueDescriptionFromLabel( m_label ),
|
||||
StringFromValue( m_units, val_min_iu, true, m_useMils ) );
|
||||
StringFromValue( m_units, val_min_iu, true ) );
|
||||
|
||||
textEntry->SelectAll();
|
||||
// Don't focus directly; we might be inside a KillFocus event handler
|
||||
@ -205,12 +203,12 @@ bool UNIT_BINDER::Validate( double aMin, double aMax, EDA_UNITS aUnits, bool aUs
|
||||
return false;
|
||||
}
|
||||
|
||||
if( GetValue() > From_User_Unit( aUnits, aMax, aUseMils ) )
|
||||
if( GetValue() > From_User_Unit( aUnits, aMax ) )
|
||||
{
|
||||
double val_max_iu = From_User_Unit( aUnits, aMax, aUseMils );
|
||||
double val_max_iu = From_User_Unit( aUnits, aMax );
|
||||
m_errorMessage = wxString::Format( _( "%s must be less than %s." ),
|
||||
valueDescriptionFromLabel( m_label ),
|
||||
StringFromValue( m_units, val_max_iu, true, m_useMils ) );
|
||||
StringFromValue( m_units, val_max_iu, true ) );
|
||||
|
||||
textEntry->SelectAll();
|
||||
// Don't focus directly; we might be inside a KillFocus event handler
|
||||
@ -227,14 +225,14 @@ void UNIT_BINDER::SetValue( int aValue )
|
||||
{
|
||||
double value = aValue;
|
||||
double displayValue = m_originTransforms.ToDisplay( value, m_coordType );
|
||||
SetValue( StringFromValue( m_units, displayValue, false, m_useMils, m_dataType ) );
|
||||
SetValue( StringFromValue( m_units, displayValue, false, m_dataType ) );
|
||||
}
|
||||
|
||||
|
||||
void UNIT_BINDER::SetDoubleValue( double aValue )
|
||||
{
|
||||
double displayValue = m_originTransforms.ToDisplay( aValue, m_coordType );
|
||||
SetValue( StringFromValue( m_units, displayValue, false, m_useMils, m_dataType ) );
|
||||
SetValue( StringFromValue( m_units, displayValue, false, m_dataType ) );
|
||||
}
|
||||
|
||||
|
||||
@ -251,7 +249,7 @@ void UNIT_BINDER::SetValue( wxString aValue )
|
||||
if( m_allowEval )
|
||||
m_eval.Clear();
|
||||
|
||||
m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units, m_useMils, m_dataType ) );
|
||||
m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units, m_dataType ) );
|
||||
}
|
||||
|
||||
|
||||
@ -259,7 +257,7 @@ void UNIT_BINDER::ChangeValue( int aValue )
|
||||
{
|
||||
double value = aValue;
|
||||
double displayValue = m_originTransforms.ToDisplay( value, m_coordType );
|
||||
ChangeValue( StringFromValue( m_units, displayValue, false, m_useMils ) );
|
||||
ChangeValue( StringFromValue( m_units, displayValue, false ) );
|
||||
}
|
||||
|
||||
|
||||
@ -276,7 +274,7 @@ void UNIT_BINDER::ChangeValue( const wxString& aValue )
|
||||
if( m_allowEval )
|
||||
m_eval.Clear();
|
||||
|
||||
m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units, m_useMils, m_dataType ) );
|
||||
m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units, m_dataType ) );
|
||||
}
|
||||
|
||||
|
||||
@ -298,7 +296,7 @@ long long int UNIT_BINDER::GetValue()
|
||||
else
|
||||
return 0;
|
||||
|
||||
long long int displayValue = ValueFromString( m_units, value, m_useMils, m_dataType );
|
||||
long long int displayValue = ValueFromString( m_units, value, m_dataType );
|
||||
return m_originTransforms.FromDisplay( displayValue, m_coordType );
|
||||
}
|
||||
|
||||
@ -321,7 +319,7 @@ double UNIT_BINDER::GetDoubleValue()
|
||||
else
|
||||
return 0.0;
|
||||
|
||||
double displayValue = DoubleValueFromString( m_units, value, m_useMils, m_dataType );
|
||||
double displayValue = DoubleValueFromString( m_units, value, m_dataType );
|
||||
return m_originTransforms.FromDisplay( displayValue, m_coordType );
|
||||
}
|
||||
|
||||
|
@ -435,7 +435,7 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe
|
||||
|
||||
bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow()
|
||||
{
|
||||
if( !m_textSize.Validate( 1.0, 10000.0, EDA_UNITS::INCHES, true ) ) // 1 mil .. 10 inches
|
||||
if( !m_textSize.Validate( 1.0, 10000.0, EDA_UNITS::INCHES ) ) // 1 mil .. 10 inches
|
||||
return false;
|
||||
|
||||
SCH_SHEET_PATH currentSheet = m_parent->GetCurrentSheet();
|
||||
|
@ -112,19 +112,19 @@ public:
|
||||
val = PinOrientationNames()[ PinOrientationIndex( pin->GetOrientation() ) ];
|
||||
break;
|
||||
case COL_NUMBER_SIZE:
|
||||
val = StringFromValue( aUserUnits, pin->GetNumberTextSize(), true, true );
|
||||
val = StringFromValue( aUserUnits, pin->GetNumberTextSize(), true );
|
||||
break;
|
||||
case COL_NAME_SIZE:
|
||||
val = StringFromValue( aUserUnits, pin->GetNameTextSize(), true, true );
|
||||
val = StringFromValue( aUserUnits, pin->GetNameTextSize(), true );
|
||||
break;
|
||||
case COL_LENGTH:
|
||||
val = StringFromValue( aUserUnits, pin->GetLength(), true );
|
||||
val = StringFromValue( aUserUnits, pin->GetLength() );
|
||||
break;
|
||||
case COL_POSX:
|
||||
val = StringFromValue( aUserUnits, pin->GetPosition().x, true );
|
||||
val = StringFromValue( aUserUnits, pin->GetPosition().x );
|
||||
break;
|
||||
case COL_POSY:
|
||||
val = StringFromValue( aUserUnits, pin->GetPosition().y, true );
|
||||
val = StringFromValue( aUserUnits, pin->GetPosition().y );
|
||||
break;
|
||||
default:
|
||||
wxFAIL;
|
||||
@ -186,11 +186,11 @@ public:
|
||||
break;
|
||||
|
||||
case COL_NUMBER_SIZE:
|
||||
pin->SetNumberTextSize( ValueFromString( m_userUnits, aValue, true ) );
|
||||
pin->SetNumberTextSize( ValueFromString( m_userUnits, aValue ) );
|
||||
break;
|
||||
|
||||
case COL_NAME_SIZE:
|
||||
pin->SetNameTextSize( ValueFromString( m_userUnits, aValue, true ) );
|
||||
pin->SetNameTextSize( ValueFromString( m_userUnits, aValue ) );
|
||||
break;
|
||||
|
||||
case COL_LENGTH:
|
||||
@ -261,8 +261,8 @@ public:
|
||||
break;
|
||||
case COL_NUMBER_SIZE:
|
||||
case COL_NAME_SIZE:
|
||||
res = cmp( ValueFromString( units, lhStr, true ),
|
||||
ValueFromString( units, rhStr, true ) );
|
||||
res = cmp( ValueFromString( units, lhStr ),
|
||||
ValueFromString( units, rhStr ) );
|
||||
break;
|
||||
case COL_LENGTH:
|
||||
case COL_POSX:
|
||||
|
@ -59,10 +59,10 @@ bool PANEL_SETUP_FORMATTING::TransferDataToWindow()
|
||||
|
||||
m_choiceSeparatorRefId->SetSelection( refStyleSelection );
|
||||
|
||||
m_textSize.SetUnits( EDA_UNITS::INCHES, true );
|
||||
m_lineWidth.SetUnits( EDA_UNITS::INCHES, true );
|
||||
m_pinSymbolSize.SetUnits( EDA_UNITS::INCHES, true );
|
||||
m_junctionSize.SetUnits( EDA_UNITS::INCHES, true );
|
||||
m_textSize.SetUnits( EDA_UNITS::INCHES );
|
||||
m_lineWidth.SetUnits( EDA_UNITS::INCHES );
|
||||
m_pinSymbolSize.SetUnits( EDA_UNITS::INCHES );
|
||||
m_junctionSize.SetUnits( EDA_UNITS::INCHES );
|
||||
|
||||
m_textSize.SetValue( settings.m_DefaultTextSize );
|
||||
m_lineWidth.SetValue( settings.m_DefaultLineWidth );
|
||||
|
@ -410,7 +410,7 @@ wxString FIELDS_GRID_TABLE<T>::GetValue( int aRow, int aCol )
|
||||
return StringFromBool( field.IsBold() );
|
||||
|
||||
case FDC_TEXT_SIZE:
|
||||
return StringFromValue( m_userUnits, field.GetTextSize().GetHeight(), true, true );
|
||||
return StringFromValue( m_userUnits, field.GetTextSize().GetHeight() );
|
||||
|
||||
case FDC_ORIENTATION:
|
||||
switch ( (int) field.GetTextAngle() )
|
||||
@ -422,10 +422,10 @@ wxString FIELDS_GRID_TABLE<T>::GetValue( int aRow, int aCol )
|
||||
break;
|
||||
|
||||
case FDC_POSX:
|
||||
return StringFromValue( m_userUnits, field.GetTextPos().x, true );
|
||||
return StringFromValue( m_userUnits, field.GetTextPos().x );
|
||||
|
||||
case FDC_POSY:
|
||||
return StringFromValue( m_userUnits, field.GetTextPos().y, true );
|
||||
return StringFromValue( m_userUnits, field.GetTextPos().y );
|
||||
|
||||
default:
|
||||
// we can't assert here because wxWidgets sometimes calls this without checking
|
||||
@ -507,8 +507,8 @@ void FIELDS_GRID_TABLE<T>::SetValue( int aRow, int aCol, const wxString &aValue
|
||||
break;
|
||||
|
||||
case FDC_TEXT_SIZE:
|
||||
field.SetTextSize( wxSize( ValueFromString( m_userUnits, aValue, true ),
|
||||
ValueFromString( m_userUnits, aValue, true ) ) );
|
||||
field.SetTextSize( wxSize( ValueFromString( m_userUnits, aValue ),
|
||||
ValueFromString( m_userUnits, aValue ) ) );
|
||||
break;
|
||||
|
||||
case FDC_ORIENTATION:
|
||||
|
@ -396,7 +396,7 @@ void LIB_ARC::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITE
|
||||
|
||||
LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
|
||||
|
||||
msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width, true );
|
||||
msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width );
|
||||
|
||||
aList.emplace_back( _( "Line Width" ), msg, BLUE );
|
||||
|
||||
|
@ -335,7 +335,7 @@ void LIB_BEZIER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_
|
||||
|
||||
LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
|
||||
|
||||
msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width, true );
|
||||
msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width );
|
||||
|
||||
aList.emplace_back( _( "Line Width" ), msg, BLUE );
|
||||
|
||||
|
@ -244,11 +244,11 @@ void LIB_CIRCLE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList
|
||||
|
||||
LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
|
||||
|
||||
msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width, true );
|
||||
msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width );
|
||||
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
|
||||
|
||||
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetRadius(), true );
|
||||
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetRadius() );
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Radius" ), msg, RED ) );
|
||||
|
||||
msg.Printf( wxT( "(%d, %d, %d, %d)" ),
|
||||
|
@ -431,10 +431,10 @@ void LIB_FIELD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList
|
||||
msg = GetTextStyleName();
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), msg, MAGENTA ) );
|
||||
|
||||
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth(), true );
|
||||
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth() );
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, BLUE ) );
|
||||
|
||||
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextHeight(), true );
|
||||
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextHeight() );
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, BLUE ) );
|
||||
|
||||
// Display field name (ref, value ...)
|
||||
|
@ -1010,7 +1010,7 @@ void LIB_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), text, DARKGREEN ) );
|
||||
|
||||
// Display pin length
|
||||
text = StringFromValue( aFrame->GetUserUnits(), m_length, true );
|
||||
text = StringFromValue( aFrame->GetUserUnits(), m_length );
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Length" ), text, MAGENTA ) );
|
||||
|
||||
text = PinOrientationName( (unsigned) PinOrientationIndex( m_orientation ) );
|
||||
@ -1020,10 +1020,10 @@ void LIB_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
|
||||
pinpos.y = -pinpos.y; // Display coord are top to bottom
|
||||
// lib items coord are bottom to top
|
||||
|
||||
text = MessageTextFromValue( aFrame->GetUserUnits(), pinpos.x, true );
|
||||
text = MessageTextFromValue( aFrame->GetUserUnits(), pinpos.x );
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Pos X" ), text, DARKMAGENTA ) );
|
||||
|
||||
text = MessageTextFromValue( aFrame->GetUserUnits(), pinpos.y, true );
|
||||
text = MessageTextFromValue( aFrame->GetUserUnits(), pinpos.y );
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text, DARKMAGENTA ) );
|
||||
}
|
||||
|
||||
|
@ -335,7 +335,7 @@ void LIB_POLYLINE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aLi
|
||||
|
||||
LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
|
||||
|
||||
msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width, true );
|
||||
msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width );
|
||||
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
|
||||
|
||||
|
@ -192,7 +192,7 @@ void LIB_RECTANGLE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aL
|
||||
{
|
||||
LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
|
||||
|
||||
wxString msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width, true );
|
||||
wxString msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width );
|
||||
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
|
||||
}
|
||||
|
@ -349,7 +349,7 @@ void LIB_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
|
||||
{
|
||||
LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
|
||||
|
||||
wxString msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextThickness(), true );
|
||||
wxString msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextThickness() );
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
|
||||
}
|
||||
|
||||
|
@ -171,16 +171,16 @@ void SCH_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), msg, DARKGREEN ) );
|
||||
|
||||
// Display pin length
|
||||
msg = StringFromValue( aFrame->GetUserUnits(), GetLength(), true );
|
||||
msg = StringFromValue( aFrame->GetUserUnits(), GetLength() );
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Length" ), msg, MAGENTA ) );
|
||||
|
||||
msg = PinOrientationName( (unsigned) PinOrientationIndex( GetOrientation() ) );
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), msg, DARKMAGENTA ) );
|
||||
|
||||
msg = MessageTextFromValue( aFrame->GetUserUnits(), m_position.x, true );
|
||||
msg = MessageTextFromValue( aFrame->GetUserUnits(), m_position.x );
|
||||
aList.emplace_back( _( "Pos X" ), msg, DARKMAGENTA );
|
||||
|
||||
msg = MessageTextFromValue( aFrame->GetUserUnits(), m_position.y, true );
|
||||
msg = MessageTextFromValue( aFrame->GetUserUnits(), m_position.y );
|
||||
aList.emplace_back( _( "Pos Y" ), msg, DARKMAGENTA );
|
||||
|
||||
SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( aFrame );
|
||||
|
@ -663,7 +663,7 @@ void SCH_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
|
||||
}
|
||||
|
||||
// Display text size (X or Y value, with are the same value in Eeschema)
|
||||
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth(), true );
|
||||
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth() );
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Size" ), msg, RED ) );
|
||||
|
||||
SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( aFrame );
|
||||
|
@ -90,9 +90,8 @@ void StripTrailingZeros( wxString& aStringValue, unsigned aTrailingZeroAllowed =
|
||||
* @return The converted value, in double
|
||||
* @param aUnit The units to convert \a aValue to.
|
||||
* @param aValue The value in internal units to convert.
|
||||
* @param aUseMils Indicates mils should be used for imperial units (inches).
|
||||
*/
|
||||
double To_User_Unit( EDA_UNITS aUnit, double aValue, bool aUseMils = false );
|
||||
double To_User_Unit( EDA_UNITS aUnit, double aValue );
|
||||
|
||||
/**
|
||||
* Function AngleToStringDegrees
|
||||
@ -116,18 +115,14 @@ wxString AngleToStringDegrees( double aAngle );
|
||||
* @param aUnits The units to show the value in. The unit string is added to the
|
||||
* message text.
|
||||
* @param aValue The double value to convert.
|
||||
* @param aUseMils Convert inch values to mils if true.
|
||||
* @param aType Type of the unit being used (e.g. distance, area, etc.)
|
||||
* @return The converted string for display in user interface elements.
|
||||
*/
|
||||
wxString MessageTextFromValue( EDA_UNITS aUnits, double aValue, bool aUseMils = false,
|
||||
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
||||
wxString MessageTextFromValue( EDA_UNITS aUnits, double aValue, EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
||||
|
||||
wxString MessageTextFromValue( EDA_UNITS aUnits, int aValue, bool aUseMils = false,
|
||||
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
||||
wxString MessageTextFromValue( EDA_UNITS aUnits, int aValue, EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
||||
|
||||
wxString MessageTextFromValue( EDA_UNITS aUnits, long long int aValue, bool aUseMils = false,
|
||||
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
||||
wxString MessageTextFromValue( EDA_UNITS aUnits, long long int aValue, EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
||||
|
||||
/**
|
||||
* Function StringFromValue
|
||||
@ -146,17 +141,16 @@ wxString MessageTextFromValue( EDA_UNITS aUnits, long long int aValue, bool aUse
|
||||
* @param aUnit = display units (INCHES, MILLIMETRE ..)
|
||||
* @param aValue = value in Internal_Unit
|
||||
* @param aAddUnitSymbol = true to add symbol unit to the string value
|
||||
* @param aUseMils Indicates mils should be used for imperial units (inches).
|
||||
* @return A wxString object containing value and optionally the symbol unit (like 2.000 mm)
|
||||
*/
|
||||
wxString StringFromValue( EDA_UNITS aUnit, double aValue, bool aAddUnitSymbol = false,
|
||||
bool aUseMils = false, EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
||||
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
||||
|
||||
/**
|
||||
* Return in internal units the value "val" given in a real unit
|
||||
* such as "in", "mm" or "deg"
|
||||
*/
|
||||
double From_User_Unit( EDA_UNITS aUnit, double aValue, bool aUseMils = false );
|
||||
double From_User_Unit( EDA_UNITS aUnit, double aValue );
|
||||
|
||||
|
||||
/**
|
||||
@ -166,10 +160,9 @@ double From_User_Unit( EDA_UNITS aUnit, double aValue, bool aUseMils = false );
|
||||
*
|
||||
* @param aUnits The units of \a aTextValue.
|
||||
* @param aTextValue A reference to a wxString object containing the string to convert.
|
||||
* @param aUseMils Indicates mils should be used for imperial units (inches).
|
||||
* @return A double representing that value in internal units
|
||||
*/
|
||||
double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, bool aUseMils = false,
|
||||
double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue,
|
||||
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
||||
|
||||
/**
|
||||
@ -179,28 +172,25 @@ double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, bool
|
||||
*
|
||||
* @param aUnits The units of \a aTextValue.
|
||||
* @param aTextValue A reference to a wxString object containing the string to convert.
|
||||
* @param aUseMils Indicates mils should be used for imperial units (inches).
|
||||
* @return The string from Value, according to units (inch, mm ...) for display,
|
||||
*/
|
||||
long long int ValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, bool aUseMils = false,
|
||||
long long int ValueFromString( EDA_UNITS aUnits, const wxString& aTextValue,
|
||||
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
||||
|
||||
/**
|
||||
* Function FetchUnitsFromString
|
||||
* writes any unit info found in the string to aUnits and aUseMils.
|
||||
* writes any unit info found in the string to aUnits.
|
||||
*/
|
||||
void FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS& aUnits, bool& aUseMils );
|
||||
void FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS& aUnits );
|
||||
|
||||
/**
|
||||
* Get the units string for a given units type.
|
||||
*
|
||||
* @param aUnits - The units requested.
|
||||
* @param aUseMils - Use mils for the unit
|
||||
* @param aType - The data type of the unit (e.g. distance, area, etc.)
|
||||
* @return The human readable units string.
|
||||
*/
|
||||
wxString GetAbbreviatedUnitsLabel( EDA_UNITS aUnit, bool aUseMils = false,
|
||||
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
||||
wxString GetAbbreviatedUnitsLabel( EDA_UNITS aUnit, EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
||||
|
||||
/**
|
||||
* Function FormatInternalUnits
|
||||
|
@ -204,6 +204,7 @@ enum class EDA_UNITS
|
||||
UNSCALED = 2,
|
||||
DEGREES = 3,
|
||||
PERCENT = 4,
|
||||
MILS = 5,
|
||||
};
|
||||
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user