Implement user units uniformly in EDA_DRAW_FRAME

Step 1 of the g_UserUnit global eradication.  This commit includes
basic hookup of hotkeys, units tool-buttons and grid dialogs.

(cherry picked from commit e0500ab)
This commit is contained in:
Jeff Young 2018-02-02 15:44:53 +00:00
parent b99ea159c8
commit 4f8c546140
17 changed files with 171 additions and 208 deletions

View File

@ -45,8 +45,10 @@
#if defined( PCBNEW ) || defined( CVPCB ) || defined( EESCHEMA ) || defined( GERBVIEW ) || defined( PL_EDITOR ) #if defined( PCBNEW ) || defined( CVPCB ) || defined( EESCHEMA ) || defined( GERBVIEW ) || defined( PL_EDITOR )
#define IU_TO_MM( x ) ( x / IU_PER_MM ) #define IU_TO_MM( x ) ( x / IU_PER_MM )
#define IU_TO_IN( x ) ( x / IU_PER_MILS / 1000 ) #define IU_TO_IN( x ) ( x / IU_PER_MILS / 1000 )
#define IU_TO_MILS( x ) ( x / IU_PER_MILS )
#define MM_TO_IU( x ) ( x * IU_PER_MM ) #define MM_TO_IU( x ) ( x * IU_PER_MM )
#define IN_TO_IU( x ) ( x * IU_PER_MILS * 1000 ) #define IN_TO_IU( x ) ( x * IU_PER_MILS * 1000 )
#define MILS_TO_IU( x ) ( x * IU_PER_MILS )
#else #else
#error "Cannot resolve internal units due to no definition of EESCHEMA, CVPCB or PCBNEW." #error "Cannot resolve internal units due to no definition of EESCHEMA, CVPCB or PCBNEW."
#endif #endif
@ -88,7 +90,7 @@ std::string Double2Str( double aValue )
} }
double To_User_Unit( EDA_UNITS_T aUnit, double aValue ) double To_User_Unit( EDA_UNITS_T aUnit, double aValue, bool aUseMils )
{ {
switch( aUnit ) switch( aUnit )
{ {
@ -96,6 +98,9 @@ double To_User_Unit( EDA_UNITS_T aUnit, double aValue )
return IU_TO_MM( aValue ); return IU_TO_MM( aValue );
case INCHES: case INCHES:
if( aUseMils )
return IU_TO_MILS( aValue );
else
return IU_TO_IN( aValue ); return IU_TO_IN( aValue );
case DEGREES: case DEGREES:
@ -115,12 +120,14 @@ double To_User_Unit( EDA_UNITS_T aUnit, double aValue )
* but not in dialogs, because 4 digits only * but not in dialogs, because 4 digits only
* could truncate the actual value * could truncate the actual value
*/ */
wxString CoordinateToString( int aValue, bool aConvertToMils ) wxString CoordinateToString( int aValue, bool aUseMils )
{ {
return LengthDoubleToString( (double) aValue, aConvertToMils ); return LengthDoubleToString( (double) aValue, aUseMils );
} }
wxString LengthDoubleToString( double aValue, bool aConvertToMils )
// JEY TODO: remove; use StringFromValue() instead
wxString LengthDoubleToString( double aValue, bool aUseMils )
{ {
wxString text; wxString text;
const wxChar* format; const wxChar* format;
@ -128,7 +135,7 @@ wxString LengthDoubleToString( double aValue, bool aConvertToMils )
if( g_UserUnit == INCHES ) if( g_UserUnit == INCHES )
{ {
if( aConvertToMils ) if( aUseMils )
{ {
#if defined( EESCHEMA ) #if defined( EESCHEMA )
format = wxT( "%.0f" ); format = wxT( "%.0f" );
@ -159,7 +166,7 @@ wxString LengthDoubleToString( double aValue, bool aConvertToMils )
text += " "; text += " ";
if( g_UserUnit == INCHES ) if( g_UserUnit == INCHES )
text += ( aConvertToMils ) ? _( "mils" ) : _( "in" ); text += ( aUseMils ) ? _( " mils" ) : _( " in" );
else else
text += _( "mm" ); text += _( "mm" );
@ -202,9 +209,9 @@ 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 aUnit, int aValue, bool aAddUnitSymbol ) wxString StringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol, bool aUseMils )
{ {
double value_to_print = To_User_Unit( aUnit, aValue ); double value_to_print = To_User_Unit( aUnit, aValue, aUseMils );
#if defined( EESCHEMA ) #if defined( EESCHEMA )
wxString stringValue = wxString::Format( wxT( "%.3f" ), value_to_print ); wxString stringValue = wxString::Format( wxT( "%.3f" ), value_to_print );
@ -244,15 +251,18 @@ wxString StringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol )
switch( aUnit ) switch( aUnit )
{ {
case INCHES: case INCHES:
stringValue += " " + _( "\"" ); if( aUseMils )
stringValue += wxT( " mils" );
else
stringValue += wxT( " in" );
break; break;
case MILLIMETRES: case MILLIMETRES:
stringValue += " " + _( "mm" ); stringValue += wxT( " mm" );
break; break;
case DEGREES: case DEGREES:
stringValue += " " + _( "deg" ); stringValue += wxT( " deg" );
break; break;
case UNSCALED_UNITS: case UNSCALED_UNITS:
@ -264,6 +274,7 @@ wxString StringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol )
} }
// JEY TODO: remove
void PutValueInLocalUnits( wxTextCtrl& aTextCtr, int aValue ) void PutValueInLocalUnits( wxTextCtrl& aTextCtr, int aValue )
{ {
wxString msg = StringFromValue( g_UserUnit, aValue ); wxString msg = StringFromValue( g_UserUnit, aValue );
@ -272,35 +283,31 @@ void PutValueInLocalUnits( wxTextCtrl& aTextCtr, int aValue )
} }
double From_User_Unit( EDA_UNITS_T aUnit, double aValue ) double From_User_Unit( EDA_UNITS_T aUnit, double aValue, bool aUseMils )
{ {
double value;
switch( aUnit ) switch( aUnit )
{ {
case MILLIMETRES: case MILLIMETRES:
value = MM_TO_IU( aValue ); return MM_TO_IU( aValue );
break;
case INCHES: case INCHES:
value = IN_TO_IU( aValue ); if( aUseMils )
break; return MILS_TO_IU( aValue );
else
return IN_TO_IU( aValue );
case DEGREES: case DEGREES:
// Convert to "decidegrees" // Convert to "decidegrees"
value = aValue * 10; return aValue * 10;
break;
default: default:
case UNSCALED_UNITS: case UNSCALED_UNITS:
value = aValue; return aValue;
} }
return value;
} }
double DoubleValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue ) double DoubleValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue, bool aUseMils )
{ {
double value; double value;
double dtmp = 0; double dtmp = 0;
@ -342,15 +349,16 @@ double DoubleValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue )
if( unit == wxT( "in" ) || unit == wxT( "\"" ) ) if( unit == wxT( "in" ) || unit == wxT( "\"" ) )
{ {
aUnits = INCHES; aUnits = INCHES;
aUseMils = false;
} }
else if( unit == wxT( "mm" ) ) else if( unit == wxT( "mm" ) )
{ {
aUnits = MILLIMETRES; aUnits = MILLIMETRES;
} }
else if( unit == wxT( "mi" ) || unit == wxT( "th" ) ) // Mils or thous else if( unit == wxT( "mi" ) || unit == wxT( "th" ) ) // "mils" or "thou"
{ {
aUnits = INCHES; aUnits = INCHES;
dtmp /= 1000; aUseMils = true;
} }
} }
else if( aUnits == DEGREES ) else if( aUnits == DEGREES )
@ -361,19 +369,20 @@ double DoubleValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue )
} }
} }
value = From_User_Unit( aUnits, dtmp ); value = From_User_Unit( aUnits, dtmp, aUseMils );
return value; return value;
} }
int ValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue ) int ValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue, bool aUseMils )
{ {
double value = DoubleValueFromString( aUnits, aTextValue ); double value = DoubleValueFromString( aUnits, aTextValue, aUseMils );
return KiROUND( value ); return KiROUND( value );
} }
// JEY TODO: remove
int ValueFromString( const wxString& aTextValue ) int ValueFromString( const wxString& aTextValue )
{ {
int value; int value;
@ -383,6 +392,7 @@ int ValueFromString( const wxString& aTextValue )
return value; return value;
} }
// JEY TODO: remove; use a UNIT_BINDER instead
int ValueFromTextCtrl( const wxTextCtrl& aTextCtr ) int ValueFromTextCtrl( const wxTextCtrl& aTextCtr )
{ {
int value; int value;
@ -455,60 +465,53 @@ wxString ReturnUnitSymbol( EDA_UNITS_T aUnit, const wxString& formatString )
} }
wxString GetUnitsLabel( EDA_UNITS_T aUnit ) wxString GetUnitsLabel( EDA_UNITS_T aUnit, bool aUseMils )
{ {
wxString label;
switch( aUnit ) switch( aUnit )
{ {
case INCHES: case INCHES:
label = _( "inches" ); if( aUseMils )
break; return _( "mils" );
else
return _( "inches" );
case MILLIMETRES: case MILLIMETRES:
label = _( "millimeters" ); return _( "millimeters" );
break;
case UNSCALED_UNITS: case UNSCALED_UNITS:
label = _( "units" ); return _( "units" );
break;
case DEGREES: case DEGREES:
label = _( "degrees" ); return _( "degrees" );
break;
}
return label;
}
wxString GetAbbreviatedUnitsLabel( EDA_UNITS_T aUnit )
{
wxString label;
switch( aUnit )
{
case INCHES:
label = _( "in" );
break;
case MILLIMETRES:
label = _( "mm" );
break;
case UNSCALED_UNITS:
break;
case DEGREES:
label = _( "deg" );
break;
default: default:
label = wxT( "??" ); return wxT( "??" );
break; }
} }
return label;
wxString GetAbbreviatedUnitsLabel( EDA_UNITS_T aUnit, bool aUseMils )
{
switch( aUnit )
{
case INCHES:
if( aUseMils )
return _( "mils" );
else
return _( "in" );
case MILLIMETRES:
return _( "mm" );
case UNSCALED_UNITS:
return wxEmptyString;
case DEGREES:
return _( "deg" );
default:
return wxT( "??" );
}
} }

View File

@ -66,6 +66,9 @@ static const wxString traceScrollSettings( wxT( "KicadScrollSettings" ) );
///@{ ///@{
/// \ingroup config /// \ingroup config
/// User units
static const wxString UserUnitsEntryKeyword( wxT( "Units" ) );
static const wxString FpEditorUserUnitsEntryKeyword( wxT( "FpEditorUnits" ) );
/// Nonzero to show grid (suffix) /// Nonzero to show grid (suffix)
static const wxString ShowGridEntryKeyword( wxT( "ShowGrid" ) ); static const wxString ShowGridEntryKeyword( wxT( "ShowGrid" ) );
/// Grid color ID (suffix) /// Grid color ID (suffix)
@ -350,14 +353,16 @@ wxAuiToolBarItem* EDA_DRAW_FRAME::GetToolbarTool( int aToolId )
void EDA_DRAW_FRAME::OnSelectUnits( wxCommandEvent& aEvent ) void EDA_DRAW_FRAME::OnSelectUnits( wxCommandEvent& aEvent )
{ {
if( aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_MM && g_UserUnit != MILLIMETRES ) if( aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_MM && m_UserUnits != MILLIMETRES )
{ {
g_UserUnit = MILLIMETRES; g_UserUnit = MILLIMETRES; // JEY TODO: double-up while in transition...
m_UserUnits = MILLIMETRES;
unitsChangeRefresh(); unitsChangeRefresh();
} }
else if( aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_INCH && g_UserUnit != INCHES ) else if( aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_INCH && m_UserUnits != INCHES )
{ {
g_UserUnit = INCHES; g_UserUnit = INCHES; // JEY TODO: double-up while in transition...
m_UserUnits = INCHES;
unitsChangeRefresh(); unitsChangeRefresh();
} }
} }
@ -394,8 +399,8 @@ void EDA_DRAW_FRAME::OnUpdateUnits( wxUpdateUIEvent& aEvent )
{ {
bool enable; bool enable;
enable = ( ((aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_MM) && (g_UserUnit == MILLIMETRES)) enable = ( ((aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_MM) && (m_UserUnits == MILLIMETRES))
|| ((aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_INCH) && (g_UserUnit == INCHES)) ); || ((aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_INCH) && (m_UserUnits == INCHES)) );
aEvent.Check( enable ); aEvent.Check( enable );
DisplayUnitsMsg(); DisplayUnitsMsg();
@ -559,7 +564,7 @@ void EDA_DRAW_FRAME::DisplayUnitsMsg()
{ {
wxString msg; wxString msg;
switch( g_UserUnit ) switch( m_UserUnits )
{ {
case INCHES: case INCHES:
msg = _( "Inches" ); msg = _( "Inches" );
@ -763,6 +768,17 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg )
wxString baseCfgName = ConfigBaseName(); wxString baseCfgName = ConfigBaseName();
// Read units used in dialogs and toolbars
EDA_UNITS_T unitsTmp;
if( aCfg->Read( baseCfgName + UserUnitsEntryKeyword, (int*) &unitsTmp ) )
SetUserUnits( unitsTmp );
else
SetUserUnits( MILLIMETRES );
g_UserUnit = GetUserUnits(); // JEY TODO: double-up while in transition
// Read show/hide grid entry
bool btmp; bool btmp;
if( aCfg->Read( baseCfgName + ShowGridEntryKeyword, &btmp ) ) if( aCfg->Read( baseCfgName + ShowGridEntryKeyword, &btmp ) )
SetGridVisibility( btmp ); SetGridVisibility( btmp );
@ -795,6 +811,7 @@ void EDA_DRAW_FRAME::SaveSettings( wxConfigBase* aCfg )
wxString baseCfgName = ConfigBaseName(); wxString baseCfgName = ConfigBaseName();
aCfg->Write( baseCfgName + UserUnitsEntryKeyword, (int) m_UserUnits );
aCfg->Write( baseCfgName + ShowGridEntryKeyword, IsGridVisible() ); aCfg->Write( baseCfgName + ShowGridEntryKeyword, IsGridVisible() );
aCfg->Write( baseCfgName + GridColorEntryKeyword, aCfg->Write( baseCfgName + GridColorEntryKeyword,
GetGridColor().ToColour().GetAsString( wxC2S_CSS_SYNTAX ) ); GetGridColor().ToColour().GetAsString( wxC2S_CSS_SYNTAX ) );

View File

@ -231,7 +231,7 @@ void SCH_EDIT_FRAME::OnPreferencesOptions( wxCommandEvent& event )
units.Add( GetUnitsLabel( INCHES ) ); units.Add( GetUnitsLabel( INCHES ) );
units.Add( GetUnitsLabel( MILLIMETRES ) ); units.Add( GetUnitsLabel( MILLIMETRES ) );
dlg.SetUnits( units, g_UserUnit ); dlg.SetUnits( units, GetUserUnits() );
dlg.SetGridSizes( grid_list, GetScreen()->GetGridCmdId() ); dlg.SetGridSizes( grid_list, GetScreen()->GetGridCmdId() );
dlg.SetBusWidth( GetDefaultBusThickness() ); dlg.SetBusWidth( GetDefaultBusThickness() );
dlg.SetLineWidth( GetDefaultLineThickness() ); dlg.SetLineWidth( GetDefaultLineThickness() );
@ -262,7 +262,10 @@ void SCH_EDIT_FRAME::OnPreferencesOptions( wxCommandEvent& event )
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;
g_UserUnit = (EDA_UNITS_T)dlg.GetUnitsSelection(); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetId( (dlg.GetUnitsSelection() == MILLIMETRES) ?
ID_TB_OPTIONS_SELECT_UNIT_MM : ID_TB_OPTIONS_SELECT_UNIT_INCH );
GetEventHandler()->ProcessEvent( cmd );
wxRealPoint gridsize = grid_list[ (size_t) dlg.GetGridSelection() ].m_Size; wxRealPoint gridsize = grid_list[ (size_t) dlg.GetGridSelection() ].m_Size;
m_LastGridSizeId = GetScreen()->SetGrid( gridsize ); m_LastGridSizeId = GetScreen()->SetGrid( gridsize );
@ -484,7 +487,7 @@ 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( true, UnitsEntry,
(int*)&g_UserUnit, MILLIMETRES ) ); (int*)&m_UserUnits, 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

@ -77,9 +77,6 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings()
if( !m_configSettings.empty() ) if( !m_configSettings.empty() )
return m_configSettings; return m_configSettings;
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ),
(int*) &g_UserUnit, 0, 0, 1 ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "DrawModeOption" ), m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "DrawModeOption" ),
&m_displayMode, 2, 0, 2 ) ); &m_displayMode, 2, 0, 2 ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true,

View File

@ -601,7 +601,7 @@ void GERBVIEW_FRAME::Liste_D_Codes()
int ii, jj; int ii, jj;
wxString Line; wxString Line;
wxArrayString list; wxArrayString list;
double scale = g_UserUnit == INCHES ? IU_PER_MILS * 1000 : IU_PER_MM; double scale = GetUserUnits() == 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 )
@ -621,7 +621,7 @@ void GERBVIEW_FRAME::Liste_D_Codes()
list.Add( Line ); list.Add( Line );
const char* units = g_UserUnit == INCHES ? "\"" : "mm"; const char* units = GetUserUnits() == INCHES ? "\"" : "mm";
for( ii = 0, jj = 1; ii < TOOLS_MAX_COUNT; ii++ ) for( ii = 0, jj = 1; ii < TOOLS_MAX_COUNT; ii++ )
{ {
@ -1119,7 +1119,7 @@ void GERBVIEW_FRAME::UpdateStatusBar()
ro = hypot( dx, dy ); ro = hypot( dx, dy );
wxString formatter; wxString formatter;
switch( g_UserUnit ) switch( GetUserUnits() )
{ {
case INCHES: case INCHES:
formatter = wxT( "r %.6f theta %.1f" ); formatter = wxT( "r %.6f theta %.1f" );
@ -1138,18 +1138,18 @@ void GERBVIEW_FRAME::UpdateStatusBar()
break; break;
} }
line.Printf( formatter, To_User_Unit( g_UserUnit, ro ), theta ); line.Printf( formatter, To_User_Unit( GetUserUnits(), ro ), theta );
SetStatusText( line, 3 ); SetStatusText( line, 3 );
} }
// Display absolute coordinates: // Display absolute coordinates:
dXpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().x ); dXpos = To_User_Unit( GetUserUnits(), GetCrossHairPosition().x );
dYpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().y ); dYpos = To_User_Unit( GetUserUnits(), GetCrossHairPosition().y );
wxString absformatter; wxString absformatter;
switch( g_UserUnit ) switch( GetUserUnits() )
{ {
case INCHES: case INCHES:
absformatter = wxT( "X %.6f Y %.6f" ); absformatter = wxT( "X %.6f Y %.6f" );
@ -1179,8 +1179,8 @@ void GERBVIEW_FRAME::UpdateStatusBar()
// Display relative coordinates: // Display relative coordinates:
dx = GetCrossHairPosition().x - screen->m_O_Curseur.x; dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = GetCrossHairPosition().y - screen->m_O_Curseur.y; dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
dXpos = To_User_Unit( g_UserUnit, dx ); dXpos = To_User_Unit( GetUserUnits(), dx );
dYpos = To_User_Unit( g_UserUnit, dy ); dYpos = To_User_Unit( GetUserUnits(), dy );
// We already decided the formatter above // We already decided the formatter above
line.Printf( locformatter, dXpos, dYpos, hypot( dXpos, dYpos ) ); line.Printf( locformatter, dXpos, dYpos, hypot( dXpos, dYpos ) );

View File

@ -207,7 +207,9 @@ bool GERBVIEW_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
break; break;
case HK_SWITCH_UNITS: case HK_SWITCH_UNITS:
g_UserUnit = (g_UserUnit == INCHES ) ? MILLIMETRES : INCHES; cmd.SetId( (GetUserUnits() == INCHES) ?
ID_TB_OPTIONS_SELECT_UNIT_MM : ID_TB_OPTIONS_SELECT_UNIT_INCH );
GetEventHandler()->ProcessEvent( cmd );
break; break;
case HK_GBR_LINES_DISPLAY_MODE: case HK_GBR_LINES_DISPLAY_MODE:

View File

@ -69,8 +69,9 @@ void StripTrailingZeros( wxString& aStringValue, unsigned aTrailingZeroAllowed =
* @return The converted value, in double * @return The converted value, in double
* @param aUnit The units to convert \a aValue to. * @param aUnit The units to convert \a aValue to.
* @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).
*/ */
double To_User_Unit( EDA_UNITS_T aUnit, double aValue ); double To_User_Unit( EDA_UNITS_T aUnit, double aValue, bool aUseMils = false );
/** /**
* Function CoordinateToString * Function CoordinateToString
@ -83,11 +84,10 @@ double To_User_Unit( EDA_UNITS_T aUnit, double aValue );
* However the actual internal value could need up to 8 digits to be printed * However the actual internal value could need up to 8 digits to be printed
* *
* @param aValue The integer coordinate to convert. * @param aValue The integer coordinate to convert.
* @param aConvertToMils Convert inch values to mils if true. This setting has no effect if * @param aUseMils Convert inch values to mils if true.
* the current user unit is millimeters.
* @return The converted string for display in user interface elements. * @return The converted string for display in user interface elements.
*/ */
wxString CoordinateToString( int aValue, bool aConvertToMils = false ); wxString CoordinateToString( int aValue, bool aUseMils = false );
/** /**
* Function AngleToStringDegrees * Function AngleToStringDegrees
@ -107,11 +107,10 @@ wxString AngleToStringDegrees( double aAngle );
* However the actual internal value could need up to 8 digits to be printed * However the actual internal value could need up to 8 digits to be printed
* *
* @param aValue The double value to convert. * @param aValue The double value to convert.
* @param aConvertToMils Convert inch values to mils if true. This setting has no effect if * @param aUseMils Convert inch values to mils if true.
* the current user unit is millimeters.
* @return The converted string for display in user interface elements. * @return The converted string for display in user interface elements.
*/ */
wxString LengthDoubleToString( double aValue, bool aConvertToMils = false ); wxString LengthDoubleToString( double aValue, bool aUseMils = false );
/** /**
* Function StringFromValue * Function StringFromValue
@ -130,9 +129,11 @@ wxString LengthDoubleToString( double aValue, bool aConvertToMils = false );
* @param aUnit = display units (INCHES, MILLIMETRE ..) * @param aUnit = display units (INCHES, MILLIMETRE ..)
* @param aValue = value in Internal_Unit * @param aValue = value in Internal_Unit
* @param aAddUnitSymbol = true to add symbol unit to the string value * @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) * @return A wxString object containing value and optionally the symbol unit (like 2.000 mm)
*/ */
wxString StringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol = false ); wxString StringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol = false,
bool aUseMils = false );
/** /**
* Operator << overload * Operator << overload
@ -157,7 +158,7 @@ void PutValueInLocalUnits( wxTextCtrl& aTextCtr, int aValue );
* 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 ); double From_User_Unit( EDA_UNITS_T aUnit, double aValue, bool aUseMils = false );
/** /**
@ -165,9 +166,11 @@ double From_User_Unit( EDA_UNITS_T aUnit, double aValue );
* converts \a aTextValue to a double * converts \a aTextValue to a double
* @param aUnits The units of \a aTextValue. * @param aUnits The units of \a aTextValue.
* @param aTextValue A reference to a wxString object containing the string to convert. * @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 * @return A double representing that value in internal units
*/ */
double DoubleValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue ); double DoubleValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue,
bool aUseMils = false );
/** /**
* Function ValueFromString * Function ValueFromString
@ -175,9 +178,10 @@ double DoubleValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue );
* *
* @param aUnits The units of \a aTextValue. * @param aUnits The units of \a aTextValue.
* @param aTextValue A reference to a wxString object containing the string to convert. * @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, * @return The string from Value, according to units (inch, mm ...) for display,
*/ */
int ValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue ); int ValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue, bool aUseMils = false );
/** /**
* Function ValueFromString * Function ValueFromString
@ -217,8 +221,8 @@ wxString ReturnUnitSymbol( EDA_UNITS_T aUnits = g_UserUnit,
* @param aUnits - The units text to return. * @param aUnits - The units text to return.
* @return The human readable units string. * @return The human readable units string.
*/ */
wxString GetUnitsLabel( EDA_UNITS_T aUnits ); wxString GetUnitsLabel( EDA_UNITS_T aUnits, bool aUseMils = false );
wxString GetAbbreviatedUnitsLabel( EDA_UNITS_T aUnit = g_UserUnit ); wxString GetAbbreviatedUnitsLabel( EDA_UNITS_T aUnit = g_UserUnit, bool aUseMils = false );
void AddUnitSymbol( wxStaticText& Stext, EDA_UNITS_T aUnit = g_UserUnit ); void AddUnitSymbol( wxStaticText& Stext, EDA_UNITS_T aUnit = g_UserUnit );

View File

@ -101,6 +101,7 @@ protected:
// is at scale = 1 // is at scale = 1
int m_UndoRedoCountMax; ///< default Undo/Redo command Max depth, to be handed int m_UndoRedoCountMax; ///< default Undo/Redo command Max depth, to be handed
// to screens // to screens
EDA_UNITS_T m_UserUnits;
/// The area to draw on. /// The area to draw on.
EDA_DRAW_PANEL* m_canvas; EDA_DRAW_PANEL* m_canvas;
@ -253,6 +254,13 @@ public:
*/ */
virtual const wxSize GetPageSizeIU() const = 0; virtual const wxSize GetPageSizeIU() const = 0;
/**
* Function GetUserUnits
* returns the user unit currently in use
*/
EDA_UNITS_T GetUserUnits() const { return m_UserUnits; }
void SetUserUnits( EDA_UNITS_T aUnits ) { m_UserUnits = aUnits; }
/** /**
* Function GetAuxOrigin * Function GetAuxOrigin
* returns the origin of the axis used for plotting and various exports. * returns the origin of the axis used for plotting and various exports.

View File

@ -97,8 +97,7 @@ PARAM_CFG_ARRAY& PL_EDITOR_FRAME::GetConfigurationSettings()
if( !m_configSettings.empty() ) if( !m_configSettings.empty() )
return m_configSettings; return m_configSettings;
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ), // Add settings here....
(int*) &g_UserUnit, 0, 0, 1 ) );
return m_configSettings; return m_configSettings;
} }

View File

@ -53,6 +53,7 @@ class DIALOG_SET_GRID : public DIALOG_SET_GRID_BASE
{ {
PCB_BASE_FRAME* m_parent; PCB_BASE_FRAME* m_parent;
wxArrayString m_fast_grid_opts; wxArrayString m_fast_grid_opts;
EDA_UNITS_T m_units;
public: public:
/// This has no dependencies on calling wxFrame derivative, such as PCB_BASE_FRAME. /// This has no dependencies on calling wxFrame derivative, such as PCB_BASE_FRAME.
@ -72,14 +73,8 @@ private:
FinishDialogSettings(); FinishDialogSettings();
} }
void setGridSize( const wxPoint& grid );
bool getGridSize( wxPoint& aGrisSize ); bool getGridSize( wxPoint& aGrisSize );
void setGridOrigin( const wxPoint& grid );
bool getGridOrigin( wxPoint& aGridOrigin ); bool getGridOrigin( wxPoint& aGridOrigin );
void setGridForFastSwitching( const wxArrayString& aGrids, int aGrid1, int aGrid2 );
void getGridForFastSwitching( int& aGrid1, int& aGrid2 );
}; };
@ -90,11 +85,13 @@ DIALOG_SET_GRID::DIALOG_SET_GRID( PCB_BASE_FRAME* aParent, const wxArrayString&
{ {
m_sdbSizerOK->SetDefault(); // set OK button as default response to 'Enter' key m_sdbSizerOK->SetDefault(); // set OK button as default response to 'Enter' key
m_TextPosXUnits->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) ); m_units = m_parent->GetUserUnits();
m_TextPosYUnits->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_TextSizeXUnits->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) ); m_TextPosXUnits->SetLabel( GetAbbreviatedUnitsLabel( m_units ) );
m_TextSizeYUnits->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) ); m_TextPosYUnits->SetLabel( GetAbbreviatedUnitsLabel( m_units ) );
m_TextSizeXUnits->SetLabel( GetAbbreviatedUnitsLabel( m_units, true ) );
m_TextSizeYUnits->SetLabel( GetAbbreviatedUnitsLabel( m_units, true ) );
} }
@ -105,10 +102,9 @@ bool DIALOG_SET_GRID::TransferDataFromWindow()
if( !getGridOrigin( gridOrigin ) ) if( !getGridOrigin( gridOrigin ) )
{ {
wxMessageBox( wxString::Format( _( "Incorrect grid origin " wxMessageBox( wxString::Format( _( "Invalid grid origin (must be between %.3f mm and %.3f mm)" ),
"(coordinates must be >= %.3f mm and <= %.3f mm)" ), -MAX_GRID_OFFSET/IU_PER_MM,
-MAX_GRID_OFFSET/IU_PER_MM, MAX_GRID_OFFSET/IU_PER_MM ) ); MAX_GRID_OFFSET/IU_PER_MM ) );
return false; return false;
} }
@ -116,24 +112,20 @@ bool DIALOG_SET_GRID::TransferDataFromWindow()
if( !getGridSize( gridSize ) ) if( !getGridSize( gridSize ) )
{ {
wxMessageBox( wxString::Format( _( "Incorrect grid size " wxMessageBox( wxString::Format( _( "Invalid grid size (must be between %.3f mm and %.3f mm)" ),
"(size must be >= %.3f mm and <= %.3f mm)" ), MIN_GRID_SIZE/IU_PER_MM,
MIN_GRID_SIZE/IU_PER_MM, MAX_GRID_SIZE/IU_PER_MM ) ); MAX_GRID_SIZE/IU_PER_MM ) );
return false; return false;
} }
int fastGrid1, fastGrid2;
getGridForFastSwitching( fastGrid1, fastGrid2 );
// Apply the new settings // Apply the new settings
// Because grid origin is saved in board, show as modified // Because grid origin is saved in board, show as modified
m_parent->OnModify(); m_parent->OnModify();
m_parent->SetGridOrigin( gridOrigin ); m_parent->SetGridOrigin( gridOrigin );
m_parent->m_UserGridSize = gridSize; m_parent->m_UserGridSize = gridSize;
m_parent->m_FastGrid1 = fastGrid1; m_parent->m_FastGrid1 = m_comboBoxGrid1->GetSelection();
m_parent->m_FastGrid2 = fastGrid2; m_parent->m_FastGrid2 = m_comboBoxGrid2->GetSelection();
// User grid // User grid
BASE_SCREEN* screen = m_parent->GetScreen(); BASE_SCREEN* screen = m_parent->GetScreen();
@ -163,49 +155,31 @@ bool DIALOG_SET_GRID::TransferDataFromWindow()
bool DIALOG_SET_GRID::TransferDataToWindow() bool DIALOG_SET_GRID::TransferDataToWindow()
{ {
setGridSize( m_parent->m_UserGridSize ); m_OptGridSizeX->SetValue( StringFromValue( m_units, m_parent->m_UserGridSize.x, false, true ) );
setGridOrigin( m_parent->GetGridOrigin() ); m_OptGridSizeY->SetValue( StringFromValue( m_units, m_parent->m_UserGridSize.y, false, true ) );
setGridForFastSwitching( m_fast_grid_opts, m_parent->m_FastGrid1, m_parent->m_FastGrid2 );
m_GridOriginXCtrl->SetValue( StringFromValue( m_units, m_parent->GetGridOrigin().x ) );
m_GridOriginYCtrl->SetValue( StringFromValue( m_units, m_parent->GetGridOrigin().y ) );
m_comboBoxGrid1->Append( m_fast_grid_opts );
m_comboBoxGrid2->Append( m_fast_grid_opts );
m_comboBoxGrid1->SetSelection( m_parent->m_FastGrid1 );
m_comboBoxGrid2->SetSelection( m_parent->m_FastGrid2 );
return wxDialog::TransferDataToWindow(); return wxDialog::TransferDataToWindow();
} }
void DIALOG_SET_GRID::setGridSize( const wxPoint& grid )
{
wxString msg;
msg.Printf( wxT( "%.10g" ), To_User_Unit( g_UserUnit, grid.x ) );
m_OptGridSizeX->SetValue( msg );
msg.Printf( wxT( "%.10g" ), To_User_Unit( g_UserUnit, grid.y ) );
m_OptGridSizeY->SetValue( msg );
}
bool DIALOG_SET_GRID::getGridSize( wxPoint& aGridSize ) bool DIALOG_SET_GRID::getGridSize( wxPoint& aGridSize )
{ {
double x, y; double x = DoubleValueFromString( m_units, m_OptGridSizeX->GetValue(), true );
const wxString& x_str = m_OptGridSizeX->GetValue();
if( !x_str.ToDouble( &x ) )
return false;
x = DoubleValueFromString( g_UserUnit, x_str );
// Some error checking here is a good thing.
if( x < MIN_GRID_SIZE || x > MAX_GRID_SIZE ) if( x < MIN_GRID_SIZE || x > MAX_GRID_SIZE )
return false; return false;
const wxString& y_str = m_OptGridSizeY->GetValue(); double y = DoubleValueFromString( m_units, m_OptGridSizeY->GetValue(), true );
if( !y_str.ToDouble( &y ) )
return false;
y = DoubleValueFromString( g_UserUnit, y_str );
// Some error checking here is a good thing.
if( y < MIN_GRID_SIZE || y > MAX_GRID_SIZE ) if( y < MIN_GRID_SIZE || y > MAX_GRID_SIZE )
return false; return false;
@ -218,31 +192,17 @@ bool DIALOG_SET_GRID::getGridSize( wxPoint& aGridSize )
bool DIALOG_SET_GRID::getGridOrigin( wxPoint& aGridOrigin ) bool DIALOG_SET_GRID::getGridOrigin( wxPoint& aGridOrigin )
{ {
double x, y; double x = DoubleValueFromString( m_units, m_GridOriginXCtrl->GetValue() );
const wxString& x_str = m_GridOriginXCtrl->GetValue();
if( !x_str.ToDouble( &x ) )
return false;
x = DoubleValueFromString( g_UserUnit, x_str );
// Some error checking here is a good thing. // Some error checking here is a good thing.
if( x < -MAX_GRID_OFFSET || x > MAX_GRID_OFFSET ) if( x < -MAX_GRID_OFFSET || x > MAX_GRID_OFFSET )
return false; return false;
double y = DoubleValueFromString( m_units, m_GridOriginYCtrl->GetValue() );
const wxString& y_str = m_GridOriginYCtrl->GetValue();
if( !y_str.ToDouble( &y ) )
return false;
y = DoubleValueFromString( g_UserUnit, y_str );
if( y < -MAX_GRID_OFFSET || y > MAX_GRID_OFFSET ) if( y < -MAX_GRID_OFFSET || y > MAX_GRID_OFFSET )
return false; return false;
aGridOrigin.x = KiROUND( x ); aGridOrigin.x = KiROUND( x );
aGridOrigin.y = KiROUND( y ); aGridOrigin.y = KiROUND( y );
@ -250,33 +210,10 @@ bool DIALOG_SET_GRID::getGridOrigin( wxPoint& aGridOrigin )
} }
void DIALOG_SET_GRID::setGridOrigin( const wxPoint& grid )
{
PutValueInLocalUnits( *m_GridOriginXCtrl, grid.x );
PutValueInLocalUnits( *m_GridOriginYCtrl, grid.y );
}
void DIALOG_SET_GRID::setGridForFastSwitching( const wxArrayString& aGrids, int aGrid1, int aGrid2 )
{
m_comboBoxGrid1->Append( aGrids );
m_comboBoxGrid2->Append( aGrids );
m_comboBoxGrid1->SetSelection( aGrid1 );
m_comboBoxGrid2->SetSelection( aGrid2 );
}
void DIALOG_SET_GRID::getGridForFastSwitching( int& aGrid1, int& aGrid2 )
{
aGrid1 = m_comboBoxGrid1->GetSelection();
aGrid2 = m_comboBoxGrid2->GetSelection();
}
void DIALOG_SET_GRID::OnResetGridOrgClick( wxCommandEvent& event ) void DIALOG_SET_GRID::OnResetGridOrgClick( wxCommandEvent& event )
{ {
setGridOrigin( wxPoint( 0, 0 ) ); m_GridOriginXCtrl->SetValue( wxT( "0" ) );
m_GridOriginYCtrl->SetValue( wxT( "0" ) );
} }

View File

@ -73,14 +73,14 @@ DIALOG_SET_GRID_BASE::DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id, con
m_staticTextSizeX = new wxStaticText( sbUserGridSizer->GetStaticBox(), wxID_ANY, _("Size X:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextSizeX = new wxStaticText( sbUserGridSizer->GetStaticBox(), wxID_ANY, _("Size X:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSizeX->Wrap( -1 ); m_staticTextSizeX->Wrap( -1 );
fgSizer31->Add( m_staticTextSizeX, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); fgSizer31->Add( m_staticTextSizeX, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 );
m_OptGridSizeX = new wxTextCtrl( sbUserGridSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_OptGridSizeX = new wxTextCtrl( sbUserGridSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer31->Add( m_OptGridSizeX, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); fgSizer31->Add( m_OptGridSizeX, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_TextSizeXUnits = new wxStaticText( sbUserGridSizer->GetStaticBox(), wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); m_TextSizeXUnits = new wxStaticText( sbUserGridSizer->GetStaticBox(), wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextSizeXUnits->Wrap( -1 ); m_TextSizeXUnits->Wrap( -1 );
fgSizer31->Add( m_TextSizeXUnits, 0, wxALIGN_CENTER_VERTICAL, 5 ); fgSizer31->Add( m_TextSizeXUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 );
m_staticTextSizeY = new wxStaticText( sbUserGridSizer->GetStaticBox(), wxID_ANY, _("Size Y:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextSizeY = new wxStaticText( sbUserGridSizer->GetStaticBox(), wxID_ANY, _("Size Y:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSizeY->Wrap( -1 ); m_staticTextSizeY->Wrap( -1 );

View File

@ -778,7 +778,7 @@
<property name="vgap">0</property> <property name="vgap">0</property>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT</property> <property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticText" expanded="0"> <object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -952,7 +952,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property> <property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticText" expanded="1"> <object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>

View File

@ -89,8 +89,6 @@ PARAM_CFG_ARRAY& FOOTPRINT_EDIT_FRAME::GetConfigurationSettings()
m_configParams.clear(); // boost::ptr_vector destroys the pointers inside m_configParams.clear(); // boost::ptr_vector destroys the pointers inside
// Display options: // Display options:
m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorUnits" ),
(int*)&g_UserUnit, MILLIMETRES ) );
m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorDisplayPolarCoords" ), m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorDisplayPolarCoords" ),
&displ_opts->m_DisplayPolarCood, false ) ); &displ_opts->m_DisplayPolarCood, false ) );
m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorPadDisplayMode" ), m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorPadDisplayMode" ),

View File

@ -587,7 +587,7 @@ bool FOOTPRINT_VIEWER_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aP
break; break;
case HK_SWITCH_UNITS: case HK_SWITCH_UNITS:
cmd.SetId( (g_UserUnit == INCHES) ? cmd.SetId( (GetUserUnits() == INCHES) ?
ID_TB_OPTIONS_SELECT_UNIT_MM : ID_TB_OPTIONS_SELECT_UNIT_INCH ); ID_TB_OPTIONS_SELECT_UNIT_MM : ID_TB_OPTIONS_SELECT_UNIT_INCH );
GetEventHandler()->ProcessEvent( cmd ); GetEventHandler()->ProcessEvent( cmd );
break; break;

View File

@ -278,7 +278,7 @@ bool PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
break; break;
case HK_SWITCH_UNITS: case HK_SWITCH_UNITS:
evt_type = (g_UserUnit == INCHES) ? evt_type = (GetUserUnits() == INCHES) ?
ID_TB_OPTIONS_SELECT_UNIT_MM : ID_TB_OPTIONS_SELECT_UNIT_INCH; ID_TB_OPTIONS_SELECT_UNIT_MM : ID_TB_OPTIONS_SELECT_UNIT_INCH;
break; break;

View File

@ -977,8 +977,8 @@ void PCB_BASE_FRAME::SaveSettings( wxConfigBase* aCfg )
wxString baseCfgName = GetName(); wxString baseCfgName = GetName();
aCfg->Write( baseCfgName + UserGridSizeXEntry, To_User_Unit( g_UserUnit, m_UserGridSize.x ) ); aCfg->Write( baseCfgName + UserGridSizeXEntry, To_User_Unit( m_UserUnits, m_UserGridSize.x ) );
aCfg->Write( baseCfgName + UserGridSizeYEntry, To_User_Unit( g_UserUnit, m_UserGridSize.y ) ); aCfg->Write( baseCfgName + UserGridSizeYEntry, To_User_Unit( m_UserUnits, m_UserGridSize.y ) );
aCfg->Write( baseCfgName + UserGridUnitsEntry, ( long )g_UserUnit ); aCfg->Write( baseCfgName + UserGridUnitsEntry, ( long )g_UserUnit );
aCfg->Write( baseCfgName + DisplayPadFillEntry, m_DisplayOptions.m_DisplayPadFill ); aCfg->Write( baseCfgName + DisplayPadFillEntry, m_DisplayOptions.m_DisplayPadFill );
aCfg->Write( baseCfgName + DisplayViaFillEntry, m_DisplayOptions.m_DisplayViaFill ); aCfg->Write( baseCfgName + DisplayViaFillEntry, m_DisplayOptions.m_DisplayViaFill );

View File

@ -302,11 +302,6 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings()
if( m_configParams.empty() ) if( m_configParams.empty() )
{ {
// Units used in dialogs and toolbars
m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "Units" ),
(int*)&g_UserUnit, MILLIMETRES ) );
m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "DisplayPolarCoords" ), m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "DisplayPolarCoords" ),
&displ_opts->m_DisplayPolarCood, false ) ); &displ_opts->m_DisplayPolarCood, false ) );
// Display options and modes: // Display options and modes: