Commit bc14e66d authored by Dick Hollenbeck's avatar Dick Hollenbeck

A little useful feature: even if the default unit can be changed between

inches and mm, the industry is crazy enough to force us with mixed
design. For example I routinely use imperial units for track size and
clearance, but drilling is strictly a metric issue...

So I added a little parser to recognize a suffix specification in the
unit text boxes... so you can put in things like:
1in (1 inch)
1" (idem)
25th (25 thou)
25mi (25 mils, the same)
6mm (6 mm, obviously)

The rules are: spaces between the number and the unit are accepted, only
the first two letters are significant.

As a bonus, it also recognize the period (.) as a decimal point
substituting it with the correct locale character (there was a wishlist
for it, IIRC). Most useful for number pad fans :D 
parent 428ecb53
...@@ -183,7 +183,7 @@ Info_3D_Visu::~Info_3D_Visu() ...@@ -183,7 +183,7 @@ Info_3D_Visu::~Info_3D_Visu()
* units */ * units */
WinEDA_VertexCtrl::WinEDA_VertexCtrl( wxWindow* parent, const wxString& title, WinEDA_VertexCtrl::WinEDA_VertexCtrl( wxWindow* parent, const wxString& title,
wxBoxSizer* BoxSizer, wxBoxSizer* BoxSizer,
int units, int internal_unit ) UserUnitType units, int internal_unit )
{ {
wxString text; wxString text;
wxStaticText* msgtitle; wxStaticText* msgtitle;
......
...@@ -123,7 +123,7 @@ private: ...@@ -123,7 +123,7 @@ private:
public: public:
WinEDA_VertexCtrl( wxWindow* parent, const wxString& title, WinEDA_VertexCtrl( wxWindow* parent, const wxString& title,
wxBoxSizer* BoxSizer, int units, int internal_unit ); wxBoxSizer* BoxSizer, UserUnitType units, int internal_unit );
~WinEDA_VertexCtrl(); ~WinEDA_VertexCtrl();
......
...@@ -443,26 +443,24 @@ void BASE_SCREEN::AddGrid( const wxRealPoint& size, int id ) ...@@ -443,26 +443,24 @@ void BASE_SCREEN::AddGrid( const wxRealPoint& size, int id )
} }
void BASE_SCREEN::AddGrid( const wxRealPoint& size, int units, int id ) void BASE_SCREEN::AddGrid( const wxRealPoint& size, UserUnitType aUnit, int id )
{ {
double x, y; double x, y;
wxRealPoint new_size; wxRealPoint new_size;
GRID_TYPE new_grid; GRID_TYPE new_grid;
if( units == MILLIMETRE ) switch( aUnit )
{ {
case MILLIMETRES:
x = size.x / 25.4; x = size.x / 25.4;
y = size.y / 25.4; y = size.y / 25.4;
} break;
else if( units == CENTIMETRE )
{ case INCHES:
x = size.x / 2.54; case UNSCALED_UNITS:
y = size.y / 2.54;
}
else
{
x = size.x; x = size.x;
y = size.y; y = size.y;
break;
} }
new_size.x = x * GetInternalUnits(); new_size.x = x * GetInternalUnits();
......
...@@ -80,8 +80,8 @@ int g_KeyPressed; ...@@ -80,8 +80,8 @@ int g_KeyPressed;
wxString g_Prj_Default_Config_FullFilename; wxString g_Prj_Default_Config_FullFilename;
wxString g_Prj_Config_LocalFilename; wxString g_Prj_Config_LocalFilename;
// Handle the preferred editor for browsing report files: /* Current user unit of measure */
int g_UnitMetric; // display units mm = 1, inches = 0, cm = 2 UserUnitType g_UserUnit;
/* Draw color for moving objects: */ /* Draw color for moving objects: */
int g_GhostColor; int g_GhostColor;
...@@ -221,23 +221,22 @@ Ki_PageDescr::Ki_PageDescr( const wxSize& size, ...@@ -221,23 +221,22 @@ Ki_PageDescr::Ki_PageDescr( const wxSize& size,
} }
wxString ReturnUnitSymbol( int aUnits, const wxString& formatString ) wxString ReturnUnitSymbol( UserUnitType aUnit, const wxString& formatString )
{ {
wxString tmp; wxString tmp;
wxString label; wxString label;
switch( aUnits ) switch( aUnit )
{ {
case INCHES: case INCHES:
tmp = _( "\"" ); tmp = _( "\"" );
break; break;
case MILLIMETRE: case MILLIMETRES:
tmp = _( "mm" ); tmp = _( "mm" );
break; break;
default: case UNSCALED_UNITS:
tmp = _( "??" );
break; break;
} }
...@@ -250,26 +249,22 @@ wxString ReturnUnitSymbol( int aUnits, const wxString& formatString ) ...@@ -250,26 +249,22 @@ wxString ReturnUnitSymbol( int aUnits, const wxString& formatString )
} }
wxString GetUnitsLabel( int aUnits ) wxString GetUnitsLabel( UserUnitType aUnit )
{ {
wxString label; wxString label;
switch( aUnits ) switch( aUnit )
{ {
case INCHES: case INCHES:
label = _( "inches" ); label = _( "inches" );
break; break;
case MILLIMETRE: case MILLIMETRES:
label = _( "millimeters" ); label = _( "millimeters" );
break; break;
case CENTIMETRE: case UNSCALED_UNITS:
label = _( "centimeters" ); label = _( "units" );
break;
default:
label = _( "Unknown" );
break; break;
} }
...@@ -277,26 +272,21 @@ wxString GetUnitsLabel( int aUnits ) ...@@ -277,26 +272,21 @@ wxString GetUnitsLabel( int aUnits )
} }
wxString GetAbbreviatedUnitsLabel( int aUnits ) wxString GetAbbreviatedUnitsLabel( UserUnitType aUnit )
{ {
wxString label; wxString label;
switch( aUnits ) switch( aUnit )
{ {
case INCHES: case INCHES:
label = _( "in" ); label = _( "in" );
break; break;
case MILLIMETRE: case MILLIMETRES:
label = _( "mm" ); label = _( "mm" );
break; break;
case CENTIMETRE: case UNSCALED_UNITS:
label = _( "cm" );
break;
default:
label = _( "??" );
break; break;
} }
...@@ -308,10 +298,11 @@ wxString GetAbbreviatedUnitsLabel( int aUnits ) ...@@ -308,10 +298,11 @@ wxString GetAbbreviatedUnitsLabel( int aUnits )
* Add string " (mm):" or " ("):" to the static text Stext. * Add string " (mm):" or " ("):" to the static text Stext.
* Used in dialog boxes for entering values depending on selected units * Used in dialog boxes for entering values depending on selected units
*/ */
void AddUnitSymbol( wxStaticText& Stext, int Units ) void AddUnitSymbol( wxStaticText& Stext, UserUnitType aUnit )
{ {
wxString msg = Stext.GetLabel(); wxString msg = Stext.GetLabel();
msg += ReturnUnitSymbol( Units );
msg += ReturnUnitSymbol( aUnit );
Stext.SetLabel( msg ); Stext.SetLabel( msg );
} }
...@@ -319,11 +310,11 @@ void AddUnitSymbol( wxStaticText& Stext, int Units ) ...@@ -319,11 +310,11 @@ void AddUnitSymbol( wxStaticText& Stext, int Units )
/* /*
* Convert the number Value in a string according to the internal units * Convert the number Value in a string according to the internal units
* and the selected unit (g_UnitMetric) and put it in the wxTextCtrl TextCtrl * and the selected unit (g_UserUnit) and put it in the wxTextCtrl TextCtrl
*/ */
void PutValueInLocalUnits( wxTextCtrl& TextCtr, int Value, int Internal_Unit ) void PutValueInLocalUnits( wxTextCtrl& TextCtr, int Value, int Internal_Unit )
{ {
wxString msg = ReturnStringFromValue( g_UnitMetric, Value, Internal_Unit ); wxString msg = ReturnStringFromValue( g_UserUnit, Value, Internal_Unit );
TextCtr.SetValue( msg ); TextCtr.SetValue( msg );
} }
...@@ -331,14 +322,14 @@ void PutValueInLocalUnits( wxTextCtrl& TextCtr, int Value, int Internal_Unit ) ...@@ -331,14 +322,14 @@ void PutValueInLocalUnits( wxTextCtrl& TextCtr, int Value, int Internal_Unit )
/* /*
* Convert the Value in the wxTextCtrl TextCtrl in an integer, * Convert the Value in the wxTextCtrl TextCtrl in an integer,
* according to the internal units and the selected unit (g_UnitMetric) * according to the internal units and the selected unit (g_UserUnit)
*/ */
int ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr, int Internal_Unit ) int ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr, int Internal_Unit )
{ {
int value; int value;
wxString msg = TextCtr.GetValue(); wxString msg = TextCtr.GetValue();
value = ReturnValueFromString( g_UnitMetric, msg, Internal_Unit ); value = ReturnValueFromString( g_UserUnit, msg, Internal_Unit );
return value; return value;
} }
...@@ -354,35 +345,30 @@ int ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr, int Internal_Unit ) ...@@ -354,35 +345,30 @@ int ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr, int Internal_Unit )
* @return a wxString what contains value and optionally the symbol unit * @return a wxString what contains value and optionally the symbol unit
* (like 2.000 mm) * (like 2.000 mm)
*/ */
wxString ReturnStringFromValue( int aUnits, int aValue, int aInternal_Unit, wxString ReturnStringFromValue( UserUnitType aUnit, int aValue, int aInternal_Unit,
bool aAdd_unit_symbol ) bool aAdd_unit_symbol )
{ {
wxString StringValue; wxString StringValue;
double value_to_print; double value_to_print;
if( aUnits >= CENTIMETRE ) value_to_print = To_User_Unit( aUnit, aValue, aInternal_Unit );
StringValue << aValue; /* Yet another 'if pcbnew' :( */
else
{
value_to_print = To_User_Unit( (bool) aUnits, (double) aValue,
aInternal_Unit );
StringValue.Printf( ( aInternal_Unit > 1000 ) ? wxT( "%.4f" ) : StringValue.Printf( ( aInternal_Unit > 1000 ) ? wxT( "%.4f" ) :
wxT( "%.3f" ), wxT( "%.3f" ),
value_to_print ); value_to_print );
}
if( aAdd_unit_symbol ) if( aAdd_unit_symbol )
switch( aUnits ) switch( aUnit )
{ {
case INCHES: case INCHES:
StringValue += _( " \"" ); StringValue += _( " \"" );
break; break;
case MILLIMETRE: case MILLIMETRES:
StringValue += _( " mm" ); StringValue += _( " mm" );
break; break;
default: case UNSCALED_UNITS:
break; break;
} }
...@@ -397,17 +383,51 @@ wxString ReturnStringFromValue( int aUnits, int aValue, int aInternal_Unit, ...@@ -397,17 +383,51 @@ wxString ReturnStringFromValue( int aUnits, int aValue, int aInternal_Unit,
* Value = text * Value = text
* Internal_Unit = units per inch for computed value * Internal_Unit = units per inch for computed value
*/ */
int ReturnValueFromString( int Units, const wxString& TextValue, int ReturnValueFromString( UserUnitType aUnit, const wxString& TextValue,
int Internal_Unit ) int Internal_Unit )
{ {
int Value; int Value;
double dtmp = 0; double dtmp = 0;
TextValue.ToDouble( &dtmp ); /* Acquire the 'right' decimal point separator */
if( Units >= CENTIMETRE ) const struct lconv* lc = localeconv();
Value = wxRound( dtmp ); wxChar decimal_point = lc->decimal_point[0];
else wxString buf( TextValue.Strip( wxString::both ) );
Value = From_User_Unit( (bool) Units, dtmp, Internal_Unit );
/* Convert the period in decimal point */
buf.Replace( wxT( "." ), wxString( decimal_point, 1 ) );
/* Find the end of the numeric part */
unsigned brk_point = 0;
while( brk_point < buf.Len() )
{
wxChar ch = buf[brk_point];
if( !( (ch >= '0' && ch <='9') || (ch == decimal_point) ) )
{
break;
}
++brk_point;
}
/* Extract the numeric part */
buf.Left( brk_point ).ToDouble( &dtmp );
/* Check the optional unit designator (2 ch significant) */
wxString unit( buf.Mid( brk_point ).Strip( wxString::leading ).Left( 2 ).Lower() );
if( unit == wxT( "in" ) || unit == wxT( "\"" ) )
{
aUnit = INCHES;
}
else if( unit == wxT( "mm" ) )
{
aUnit = MILLIMETRES;
}
else if( unit == wxT( "mi" ) || unit == wxT( "th" ) ) /* Mils or thous */
{
aUnit = INCHES;
dtmp /= 1000;
}
Value = From_User_Unit( aUnit, dtmp, Internal_Unit );
return Value; return Value;
} }
...@@ -449,34 +469,46 @@ wxArrayString* wxStringSplit( wxString txt, wxChar splitter ) ...@@ -449,34 +469,46 @@ wxArrayString* wxStringSplit( wxString txt, wxChar splitter )
* Function To_User_Unit * Function To_User_Unit
* Convert in inch or mm the variable "val" (double)given in internal units * Convert in inch or mm the variable "val" (double)given in internal units
* @return the converted value, in double * @return the converted value, in double
* @param is_metric : true if the result must be returned in mm , false if inches * @param aUnit : user measure unit
* @param val : double : the given value * @param val : double : the given value
* @param internal_unit_value = internal units per inch * @param internal_unit_value = internal units per inch
*/ */
double To_User_Unit( bool is_metric, double val, int internal_unit_value ) double To_User_Unit( UserUnitType aUnit, double val, int internal_unit_value )
{ {
double value; switch( aUnit )
{
case MILLIMETRES:
return val * 25.4 / internal_unit_value;
if( is_metric ) case INCHES:
value = val * 25.4 / internal_unit_value; return val / internal_unit_value;
else
value = val / internal_unit_value;
return value; default:
return val;
}
} }
/* /*
* Return in internal units the value "val" given in inch or mm * Return in internal units the value "val" given in inch or mm
*/ */
int From_User_Unit( bool is_metric, double val, int internal_unit_value ) int From_User_Unit( UserUnitType aUnit, double val, int internal_unit_value )
{ {
double value; double value;
if( is_metric ) switch( aUnit )
{
case MILLIMETRES:
value = val * internal_unit_value / 25.4; value = val * internal_unit_value / 25.4;
else break;
case INCHES:
value = val * internal_unit_value; value = val * internal_unit_value;
break;
case UNSCALED_UNITS:
value = val;
}
return wxRound( value ); return wxRound( value );
} }
...@@ -654,13 +686,19 @@ int GetTimeStamp() ...@@ -654,13 +686,19 @@ int GetTimeStamp()
*/ */
const wxString& valeur_param( int valeur, wxString& buf_texte ) const wxString& valeur_param( int valeur, wxString& buf_texte )
{ {
if( g_UnitMetric ) switch( g_UserUnit )
{ {
case MILLIMETRES:
buf_texte.Printf( wxT( "%3.3f mm" ), valeur * 0.00254 ); buf_texte.Printf( wxT( "%3.3f mm" ), valeur * 0.00254 );
} break;
else
{ case INCHES:
buf_texte.Printf( wxT( "%2.4f \"" ), valeur * 0.0001 ); buf_texte.Printf( wxT( "%2.4f \"" ), valeur * 0.0001 );
break;
case UNSCALED_UNITS:
buf_texte.Printf( wxT( "%d" ), valeur );
break;
} }
return buf_texte; return buf_texte;
......
...@@ -81,24 +81,36 @@ void DIALOG_PAGES_SETTINGS::initDialog() ...@@ -81,24 +81,36 @@ void DIALOG_PAGES_SETTINGS::initDialog()
msg.Printf(format, m_Screen->m_ScreenNumber); msg.Printf(format, m_Screen->m_ScreenNumber);
m_TextSheetNumber->SetLabel(msg); m_TextSheetNumber->SetLabel(msg);
if( g_UnitMetric ) switch( g_UserUnit )
{ {
UserSizeX = (double)g_Sheet_user.m_Size.x * 25.4 / 1000; case MILLIMETRES:
UserSizeY = (double)g_Sheet_user.m_Size.y * 25.4 / 1000; UserSizeX = (double) g_Sheet_user.m_Size.x * 25.4 / 1000;
msg.Printf( wxT("%.2f"), UserSizeX ); UserSizeY = (double) g_Sheet_user.m_Size.y * 25.4 / 1000;
m_TextUserSizeX->SetValue(msg); msg.Printf( wxT( "%.2f" ), UserSizeX );
msg.Printf( wxT("%.2f"), UserSizeY ); m_TextUserSizeX->SetValue( msg );
m_TextUserSizeY->SetValue(msg); msg.Printf( wxT( "%.2f" ), UserSizeY );
} m_TextUserSizeY->SetValue( msg );
else break;
{
UserSizeX = (double)g_Sheet_user.m_Size.x / 1000; case INCHES:
UserSizeY = (double)g_Sheet_user.m_Size.y / 1000; UserSizeX = (double) g_Sheet_user.m_Size.x / 1000;
msg.Printf( wxT("%.3f"), UserSizeX ); UserSizeY = (double) g_Sheet_user.m_Size.y / 1000;
m_TextUserSizeX->SetValue(msg); msg.Printf( wxT( "%.3f" ), UserSizeX );
msg.Printf( wxT("%.3f"), UserSizeY ); m_TextUserSizeX->SetValue( msg );
m_TextUserSizeY->SetValue(msg); msg.Printf( wxT( "%.3f" ), UserSizeY );
m_TextUserSizeY->SetValue( msg );
break;
case UNSCALED_UNITS:
UserSizeX = g_Sheet_user.m_Size.x;
UserSizeY = g_Sheet_user.m_Size.y;
msg.Printf( wxT( "%f" ), UserSizeX );
m_TextUserSizeX->SetValue( msg );
msg.Printf( wxT( "%f" ), UserSizeY );
m_TextUserSizeY->SetValue( msg );
break;
} }
// Set validators // Set validators
m_PageSizeBox->SetValidator( wxGenericValidator(& m_CurrentSelection) ); m_PageSizeBox->SetValidator( wxGenericValidator(& m_CurrentSelection) );
m_TextRevision->SetValidator( wxTextValidator(wxFILTER_NONE, & m_Screen->m_Revision) ); m_TextRevision->SetValidator( wxTextValidator(wxFILTER_NONE, & m_Screen->m_Revision) );
...@@ -185,15 +197,22 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings(wxCommandEvent& event) ...@@ -185,15 +197,22 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings(wxCommandEvent& event)
m_SelectedSheet = SheetList[ii]; m_SelectedSheet = SheetList[ii];
m_Screen->m_CurrentSheetDesc = m_SelectedSheet; m_Screen->m_CurrentSheetDesc = m_SelectedSheet;
if( g_UnitMetric ) switch( g_UserUnit )
{
g_Sheet_user.m_Size.x = (int)( UserSizeX * 1000 / 25.4 );
g_Sheet_user.m_Size.y = (int)( UserSizeY * 1000 / 25.4 );
}
else
{ {
g_Sheet_user.m_Size.x = (int)( UserSizeX * 1000 ); case MILLIMETRES:
g_Sheet_user.m_Size.y = (int)( UserSizeY * 1000 ); g_Sheet_user.m_Size.x = (int) ( UserSizeX * 1000 / 25.4 );
g_Sheet_user.m_Size.y = (int) ( UserSizeY * 1000 / 25.4 );
break;
case INCHES:
g_Sheet_user.m_Size.x = (int) ( UserSizeX * 1000 );
g_Sheet_user.m_Size.y = (int) ( UserSizeY * 1000 );
break;
case UNSCALED_UNITS:
g_Sheet_user.m_Size.x = (int) ( UserSizeX );
g_Sheet_user.m_Size.y = (int) ( UserSizeY );
break;
} }
if( g_Sheet_user.m_Size.x < 6000 ) if( g_Sheet_user.m_Size.x < 6000 )
......
...@@ -72,7 +72,6 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype, ...@@ -72,7 +72,6 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
m_Draw_Sheet_Ref = FALSE; // TRUE to display reference sheet. m_Draw_Sheet_Ref = FALSE; // TRUE to display reference sheet.
m_Print_Sheet_Ref = TRUE; // TRUE to print reference sheet. m_Print_Sheet_Ref = TRUE; // TRUE to print reference sheet.
m_Draw_Auxiliary_Axis = FALSE; // TRUE draw auxilary axis. m_Draw_Auxiliary_Axis = FALSE; // TRUE draw auxilary axis.
m_UnitType = INTERNAL_UNIT_TYPE; // Internal unit = inch
m_CursorShape = 0; m_CursorShape = 0;
m_LastGridSizeId = 0; m_LastGridSizeId = 0;
m_DrawGrid = true; // hide/Show grid. default = show m_DrawGrid = true; // hide/Show grid. default = show
...@@ -334,18 +333,18 @@ void WinEDA_DrawFrame::DisplayUnitsMsg() ...@@ -334,18 +333,18 @@ void WinEDA_DrawFrame::DisplayUnitsMsg()
{ {
wxString msg; wxString msg;
switch( g_UnitMetric ) switch( g_UserUnit )
{ {
case INCHES: case INCHES:
msg = _( "Inch" ); msg = _( "Inches" );
break; break;
case MILLIMETRE: case MILLIMETRES:
msg += _( "mm" ); msg += _( "mm" );
break; break;
default: default:
msg += _( "??" ); msg += _( "Units" );
break; break;
} }
...@@ -610,45 +609,68 @@ void WinEDA_DrawFrame::UpdateStatusBar() ...@@ -610,45 +609,68 @@ void WinEDA_DrawFrame::UpdateStatusBar()
SetStatusText( Line, 1 ); SetStatusText( Line, 1 );
/* Display absolute coordinates: */ /* Display absolute coordinates: */
double dXpos = To_User_Unit( g_UnitMetric, screen->m_Curseur.x, double dXpos = To_User_Unit( g_UserUnit, screen->m_Curseur.x,
m_InternalUnits ); m_InternalUnits );
double dYpos = To_User_Unit( g_UnitMetric, screen->m_Curseur.y, double dYpos = To_User_Unit( g_UserUnit, screen->m_Curseur.y,
m_InternalUnits ); m_InternalUnits );
/* /*
* Converting from inches to mm can give some coordinates due to * Converting from inches to mm can give some coordinates due to
* float point precision rounding errors, like 1.999 or 2.001 so * float point precision rounding errors, like 1.999 or 2.001 so
* round to the nearest drawing precision required by the application. * round to the nearest drawing precision required by the application.
*/ */
if ( g_UnitMetric ) if ( g_UserUnit == MILLIMETRES )
{ {
dXpos = RoundTo0( dXpos, (double)( m_InternalUnits / 10 ) ); dXpos = RoundTo0( dXpos, (double)( m_InternalUnits / 10 ) );
dYpos = RoundTo0( dYpos, (double)( m_InternalUnits / 10 ) ); dYpos = RoundTo0( dYpos, (double)( m_InternalUnits / 10 ) );
} }
/* The following sadly is an if eeschema/if pcbnew */
wxString formatter;
switch( g_UserUnit )
{
case INCHES:
if( m_InternalUnits == EESCHEMA_INTERNAL_UNIT )
{
formatter = wxT( "X %.3f Y %.3f" );
}
else
{
formatter = wxT( "X %.4f Y %.4f" );
}
break;
case MILLIMETRES:
if( m_InternalUnits == EESCHEMA_INTERNAL_UNIT ) if( m_InternalUnits == EESCHEMA_INTERNAL_UNIT )
Line.Printf( g_UnitMetric ? wxT( "X %.2f Y %.2f" ) : {
wxT( "X %.3f Y %.3f" ), dXpos, dYpos ); formatter = wxT( "X %.2f Y %.2f" );
}
else else
Line.Printf( g_UnitMetric ? wxT( "X %.3f Y %.3f" ) : {
wxT( "X %.4f Y %.4f" ), dXpos, dYpos ); formatter = wxT( "X %.3f Y %.3f" );
}
break;
case UNSCALED_UNITS:
formatter = wxT( "X %f Y %f" );
break;
}
Line.Printf( formatter, dXpos, dYpos );
SetStatusText( Line, 2 ); SetStatusText( Line, 2 );
/* Display relative coordinates: */ /* Display relative coordinates: */
dx = screen->m_Curseur.x - screen->m_O_Curseur.x; dx = screen->m_Curseur.x - screen->m_O_Curseur.x;
dy = screen->m_Curseur.y - screen->m_O_Curseur.y; dy = screen->m_Curseur.y - screen->m_O_Curseur.y;
dXpos = To_User_Unit( g_UnitMetric, dx, m_InternalUnits ); dXpos = To_User_Unit( g_UserUnit, dx, m_InternalUnits );
dYpos = To_User_Unit( g_UnitMetric, dy, m_InternalUnits ); dYpos = To_User_Unit( g_UserUnit, dy, m_InternalUnits );
if ( g_UnitMetric ) if( g_UserUnit == MILLIMETRES )
{ {
dXpos = RoundTo0( dXpos, (double)( m_InternalUnits / 10 ) ); dXpos = RoundTo0( dXpos, (double) ( m_InternalUnits / 10 ) );
dYpos = RoundTo0( dYpos, (double)( m_InternalUnits / 10 ) ); dYpos = RoundTo0( dYpos, (double) ( m_InternalUnits / 10 ) );
} }
if( m_InternalUnits == EESCHEMA_INTERNAL_UNIT )
Line.Printf( g_UnitMetric ? wxT( "X %.2f Y %.2f" ) :
wxT( "X %.3f Y %.3f" ), dXpos, dYpos );
else
Line.Printf( g_UnitMetric ? wxT( "x %.3f y %.3f" ) :
wxT( "x %.4f y %.4f" ), dXpos, dYpos );
/* We already decided the formatter above */
Line.Printf( formatter, dXpos, dYpos );
SetStatusText( Line, 3 ); SetStatusText( Line, 3 );
} }
......
...@@ -89,12 +89,12 @@ WinEDA_GraphicTextCtrl::WinEDA_GraphicTextCtrl( wxWindow* parent, ...@@ -89,12 +89,12 @@ WinEDA_GraphicTextCtrl::WinEDA_GraphicTextCtrl( wxWindow* parent,
const wxString& Title, const wxString& Title,
const wxString& TextToEdit, const wxString& TextToEdit,
int textsize, int textsize,
int units, UserUnitType user_unit,
wxBoxSizer* BoxSizer, wxBoxSizer* BoxSizer,
int framelen, int framelen,
int internal_unit ) int internal_unit )
{ {
m_Units = units; m_UserUnit = user_unit;
m_Internal_Unit = internal_unit; m_Internal_Unit = internal_unit;
m_Title = NULL; m_Title = NULL;
...@@ -109,14 +109,14 @@ WinEDA_GraphicTextCtrl::WinEDA_GraphicTextCtrl( wxWindow* parent, ...@@ -109,14 +109,14 @@ WinEDA_GraphicTextCtrl::WinEDA_GraphicTextCtrl( wxWindow* parent,
if( !Title.IsEmpty() ) if( !Title.IsEmpty() )
{ {
wxString msg = _( "Size" ) + ReturnUnitSymbol( m_Units ); wxString msg = _( "Size" ) + ReturnUnitSymbol( m_UserUnit );
wxStaticText* text = new wxStaticText( parent, -1, msg ); wxStaticText* text = new wxStaticText( parent, -1, msg );
BoxSizer->Add( text, 0, BoxSizer->Add( text, 0,
wxGROW | wxLEFT | wxRIGHT | wxADJUST_MINSIZE, 5 ); wxGROW | wxLEFT | wxRIGHT | wxADJUST_MINSIZE, 5 );
} }
wxString value = FormatSize( m_Internal_Unit, m_Units, textsize ); wxString value = FormatSize( m_Internal_Unit, m_UserUnit, textsize );
m_FrameSize = new wxTextCtrl( parent, -1, value, wxDefaultPosition, m_FrameSize = new wxTextCtrl( parent, -1, value, wxDefaultPosition,
wxSize( 70, -1 ) ); wxSize( 70, -1 ) );
...@@ -134,7 +134,7 @@ WinEDA_GraphicTextCtrl::~WinEDA_GraphicTextCtrl() ...@@ -134,7 +134,7 @@ WinEDA_GraphicTextCtrl::~WinEDA_GraphicTextCtrl()
} }
wxString WinEDA_GraphicTextCtrl::FormatSize( int internalUnit, int units, wxString WinEDA_GraphicTextCtrl::FormatSize( int internalUnit, UserUnitType aUnit,
int textSize ) int textSize )
{ {
wxString value; wxString value;
...@@ -147,7 +147,7 @@ wxString WinEDA_GraphicTextCtrl::FormatSize( int internalUnit, int units, ...@@ -147,7 +147,7 @@ wxString WinEDA_GraphicTextCtrl::FormatSize( int internalUnit, int units,
textSize = 3000; textSize = 3000;
value.Printf( ( internalUnit > 1000 ) ? wxT( "%.4f" ) : wxT( "%.3f" ), value.Printf( ( internalUnit > 1000 ) ? wxT( "%.4f" ) : wxT( "%.3f" ),
To_User_Unit( units, textSize, internalUnit ) ); To_User_Unit( aUnit, textSize, internalUnit ) );
return value; return value;
} }
...@@ -167,7 +167,7 @@ void WinEDA_GraphicTextCtrl::SetValue( const wxString& value ) ...@@ -167,7 +167,7 @@ void WinEDA_GraphicTextCtrl::SetValue( const wxString& value )
void WinEDA_GraphicTextCtrl::SetValue( int textSize ) void WinEDA_GraphicTextCtrl::SetValue( int textSize )
{ {
wxString value = FormatSize( m_Internal_Unit, m_Units, textSize ); wxString value = FormatSize( m_Internal_Unit, m_UserUnit, textSize );
m_FrameSize->SetValue( value ); m_FrameSize->SetValue( value );
} }
...@@ -180,15 +180,11 @@ wxString WinEDA_GraphicTextCtrl::GetText() ...@@ -180,15 +180,11 @@ wxString WinEDA_GraphicTextCtrl::GetText()
int WinEDA_GraphicTextCtrl::ParseSize( const wxString& sizeText, int WinEDA_GraphicTextCtrl::ParseSize( const wxString& sizeText,
int internalUnit, int units ) int internalUnit, UserUnitType aUnit )
{ {
int textsize; int textsize;
double dtmp; textsize = ReturnValueFromString( aUnit, sizeText, internalUnit );
sizeText.ToDouble( &dtmp );
textsize = (int) From_User_Unit( units, dtmp, internalUnit );
// Limit to reasonable size // Limit to reasonable size
if( textsize < 10 ) if( textsize < 10 )
...@@ -203,7 +199,7 @@ int WinEDA_GraphicTextCtrl::ParseSize( const wxString& sizeText, ...@@ -203,7 +199,7 @@ int WinEDA_GraphicTextCtrl::ParseSize( const wxString& sizeText,
int WinEDA_GraphicTextCtrl::GetTextSize() int WinEDA_GraphicTextCtrl::GetTextSize()
{ {
return ParseSize( m_FrameSize->GetValue(), m_Internal_Unit, m_Units ); return ParseSize( m_FrameSize->GetValue(), m_Internal_Unit, m_UserUnit );
} }
...@@ -219,19 +215,19 @@ void WinEDA_GraphicTextCtrl::Enable( bool state ) ...@@ -219,19 +215,19 @@ void WinEDA_GraphicTextCtrl::Enable( bool state )
WinEDA_PositionCtrl::WinEDA_PositionCtrl( wxWindow* parent, WinEDA_PositionCtrl::WinEDA_PositionCtrl( wxWindow* parent,
const wxString& title, const wxString& title,
const wxPoint& pos_to_edit, const wxPoint& pos_to_edit,
int units, UserUnitType user_unit,
wxBoxSizer* BoxSizer, wxBoxSizer* BoxSizer,
int internal_unit ) int internal_unit )
{ {
wxString text; wxString text;
m_Units = units; m_UserUnit = user_unit;
m_Internal_Unit = internal_unit; m_Internal_Unit = internal_unit;
if( title.IsEmpty() ) if( title.IsEmpty() )
text = _( "Pos " ); text = _( "Pos " );
else else
text = title; text = title;
text += _( "X" ) + ReturnUnitSymbol( m_Units ); text += _( "X" ) + ReturnUnitSymbol( m_UserUnit );
m_TextX = new wxStaticText( parent, -1, text ); m_TextX = new wxStaticText( parent, -1, text );
BoxSizer->Add( m_TextX, 0, BoxSizer->Add( m_TextX, 0,
...@@ -246,7 +242,7 @@ WinEDA_PositionCtrl::WinEDA_PositionCtrl( wxWindow* parent, ...@@ -246,7 +242,7 @@ WinEDA_PositionCtrl::WinEDA_PositionCtrl( wxWindow* parent,
text = _( "Pos " ); text = _( "Pos " );
else else
text = title; text = title;
text += _( "Y" ) + ReturnUnitSymbol( m_Units ); text += _( "Y" ) + ReturnUnitSymbol( m_UserUnit );
m_TextY = new wxStaticText( parent, -1, text ); m_TextY = new wxStaticText( parent, -1, text );
BoxSizer->Add( m_TextY, 0, BoxSizer->Add( m_TextY, 0,
...@@ -274,12 +270,9 @@ WinEDA_PositionCtrl::~WinEDA_PositionCtrl() ...@@ -274,12 +270,9 @@ WinEDA_PositionCtrl::~WinEDA_PositionCtrl()
wxPoint WinEDA_PositionCtrl::GetValue() wxPoint WinEDA_PositionCtrl::GetValue()
{ {
wxPoint coord; wxPoint coord;
double value = 0;
m_FramePosX->GetValue().ToDouble( &value ); coord.x = ReturnValueFromString( m_UserUnit, m_FramePosX->GetValue(), m_Internal_Unit );
coord.x = From_User_Unit( m_Units, value, m_Internal_Unit ); coord.y = ReturnValueFromString( m_UserUnit, m_FramePosY->GetValue(), m_Internal_Unit );
m_FramePosY->GetValue().ToDouble( &value );
coord.y = From_User_Unit( m_Units, value, m_Internal_Unit );
return coord; return coord;
} }
...@@ -299,11 +292,11 @@ void WinEDA_PositionCtrl::SetValue( int x_value, int y_value ) ...@@ -299,11 +292,11 @@ void WinEDA_PositionCtrl::SetValue( int x_value, int y_value )
m_Pos_To_Edit.x = x_value; m_Pos_To_Edit.x = x_value;
m_Pos_To_Edit.y = y_value; m_Pos_To_Edit.y = y_value;
msg = ReturnStringFromValue( m_Units, m_Pos_To_Edit.x, m_Internal_Unit ); msg = ReturnStringFromValue( m_UserUnit, m_Pos_To_Edit.x, m_Internal_Unit );
m_FramePosX->Clear(); m_FramePosX->Clear();
m_FramePosX->SetValue( msg ); m_FramePosX->SetValue( msg );
msg = ReturnStringFromValue( m_Units, m_Pos_To_Edit.y, m_Internal_Unit ); msg = ReturnStringFromValue( m_UserUnit, m_Pos_To_Edit.y, m_Internal_Unit );
m_FramePosY->Clear(); m_FramePosY->Clear();
m_FramePosY->SetValue( msg ); m_FramePosY->SetValue( msg );
} }
...@@ -314,11 +307,11 @@ void WinEDA_PositionCtrl::SetValue( int x_value, int y_value ) ...@@ -314,11 +307,11 @@ void WinEDA_PositionCtrl::SetValue( int x_value, int y_value )
/*******************/ /*******************/
WinEDA_SizeCtrl::WinEDA_SizeCtrl( wxWindow* parent, const wxString& title, WinEDA_SizeCtrl::WinEDA_SizeCtrl( wxWindow* parent, const wxString& title,
const wxSize& size_to_edit, const wxSize& size_to_edit,
int units, wxBoxSizer* BoxSizer, UserUnitType aUnit, wxBoxSizer* BoxSizer,
int internal_unit ) : int internal_unit ) :
WinEDA_PositionCtrl( parent, title, WinEDA_PositionCtrl( parent, title,
wxPoint( size_to_edit.x, size_to_edit.y ), wxPoint( size_to_edit.x, size_to_edit.y ),
units, BoxSizer, internal_unit ) aUnit, BoxSizer, internal_unit )
{ {
} }
...@@ -338,22 +331,22 @@ wxSize WinEDA_SizeCtrl::GetValue() ...@@ -338,22 +331,22 @@ wxSize WinEDA_SizeCtrl::GetValue()
/* Class to display and edit a dimension INCHES, MM, or other */ /* Class to display and edit a dimension INCHES, MM, or other */
/**************************************************************/ /**************************************************************/
WinEDA_ValueCtrl::WinEDA_ValueCtrl( wxWindow* parent, const wxString& title, WinEDA_ValueCtrl::WinEDA_ValueCtrl( wxWindow* parent, const wxString& title,
int value, int units, wxBoxSizer* BoxSizer, int value, UserUnitType user_unit, wxBoxSizer* BoxSizer,
int internal_unit ) int internal_unit )
{ {
wxString label = title; wxString label = title;
m_Units = units; m_UserUnit = user_unit;
m_Internal_Unit = internal_unit; m_Internal_Unit = internal_unit;
m_Value = value; m_Value = value;
label += ReturnUnitSymbol( m_Units ); label += ReturnUnitSymbol( m_UserUnit );
m_Text = new wxStaticText( parent, -1, label ); m_Text = new wxStaticText( parent, -1, label );
BoxSizer->Add( m_Text, 0, BoxSizer->Add( m_Text, 0,
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 ); wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 );
wxString stringvalue = ReturnStringFromValue( m_Units, m_Value, wxString stringvalue = ReturnStringFromValue( m_UserUnit, m_Value,
m_Internal_Unit ); m_Internal_Unit );
m_ValueCtrl = new wxTextCtrl( parent, -1, stringvalue ); m_ValueCtrl = new wxTextCtrl( parent, -1, stringvalue );
...@@ -376,7 +369,7 @@ int WinEDA_ValueCtrl::GetValue() ...@@ -376,7 +369,7 @@ int WinEDA_ValueCtrl::GetValue()
int coord; int coord;
wxString txtvalue = m_ValueCtrl->GetValue(); wxString txtvalue = m_ValueCtrl->GetValue();
coord = ReturnValueFromString( m_Units, txtvalue, m_Internal_Unit ); coord = ReturnValueFromString( m_UserUnit, txtvalue, m_Internal_Unit );
return coord; return coord;
} }
...@@ -387,7 +380,7 @@ void WinEDA_ValueCtrl::SetValue( int new_value ) ...@@ -387,7 +380,7 @@ void WinEDA_ValueCtrl::SetValue( int new_value )
m_Value = new_value; m_Value = new_value;
buffer = ReturnStringFromValue( m_Units, m_Value, m_Internal_Unit ); buffer = ReturnStringFromValue( m_UserUnit, m_Value, m_Internal_Unit );
m_ValueCtrl->SetValue( buffer ); m_ValueCtrl->SetValue( buffer );
} }
......
...@@ -235,8 +235,8 @@ void WinEDA_DrawFrame::AddMenuZoomAndGrid( wxMenu* MasterMenu ) ...@@ -235,8 +235,8 @@ void WinEDA_DrawFrame::AddMenuZoomAndGrid( wxMenu* MasterMenu )
for( unsigned i = 0; i < screen->m_GridList.GetCount(); i++ ) for( unsigned i = 0; i < screen->m_GridList.GetCount(); i++ )
{ {
tmp = screen->m_GridList[i]; tmp = screen->m_GridList[i];
double gridValueInch = To_User_Unit( 0, tmp.m_Size.x, m_InternalUnits ); double gridValueInch = To_User_Unit( INCHES, tmp.m_Size.x, m_InternalUnits );
double gridValue_mm = To_User_Unit( 1, tmp.m_Size.x, m_InternalUnits ); double gridValue_mm = To_User_Unit( MILLIMETRES, tmp.m_Size.x, m_InternalUnits );
if( tmp.m_Id == ID_POPUP_GRID_USER ) if( tmp.m_Id == ID_POPUP_GRID_USER )
{ {
...@@ -244,12 +244,22 @@ void WinEDA_DrawFrame::AddMenuZoomAndGrid( wxMenu* MasterMenu ) ...@@ -244,12 +244,22 @@ void WinEDA_DrawFrame::AddMenuZoomAndGrid( wxMenu* MasterMenu )
} }
else else
{ {
if( g_UnitMetric == 0 ) // inches switch( g_UserUnit )
{
case INCHES:
msg.Printf( wxT( "%.1f mils, (%.3f mm)" ), msg.Printf( wxT( "%.1f mils, (%.3f mm)" ),
gridValueInch * 1000, gridValue_mm ); gridValueInch * 1000, gridValue_mm );
else break;
case MILLIMETRES:
msg.Printf( wxT( "%.3f mm, (%.1f mils)" ), msg.Printf( wxT( "%.3f mm, (%.1f mils)" ),
gridValue_mm, gridValueInch * 1000 ); gridValue_mm, gridValueInch * 1000 );
break;
case UNSCALED_UNITS:
msg = wxT( "???" );
break;
}
} }
gridMenu->Append( tmp.m_Id, msg, wxEmptyString, true ); gridMenu->Append( tmp.m_Id, msg, wxEmptyString, true );
if( grid == tmp.m_Size ) if( grid == tmp.m_Size )
......
...@@ -252,10 +252,9 @@ void DISPLAY_FOOTPRINTS_FRAME::SetToolbars() ...@@ -252,10 +252,9 @@ void DISPLAY_FOOTPRINTS_FRAME::SetToolbars()
{ {
m_OptionsToolBar->ToggleTool( m_OptionsToolBar->ToggleTool(
ID_TB_OPTIONS_SELECT_UNIT_MM, ID_TB_OPTIONS_SELECT_UNIT_MM,
g_UnitMetric == g_UserUnit == MILLIMETRES );
MILLIMETRE ? TRUE : false );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH,
g_UnitMetric == INCHES ? TRUE : false ); g_UserUnit == INCHES );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood ); DisplayOpt.DisplayPolarCood );
...@@ -342,12 +341,12 @@ void DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -342,12 +341,12 @@ void DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
break; break;
case ID_TB_OPTIONS_SELECT_UNIT_MM: case ID_TB_OPTIONS_SELECT_UNIT_MM:
g_UnitMetric = MILLIMETRE; g_UserUnit = MILLIMETRES;
UpdateStatusBar(); UpdateStatusBar();
break; break;
case ID_TB_OPTIONS_SELECT_UNIT_INCH: case ID_TB_OPTIONS_SELECT_UNIT_INCH:
g_UnitMetric = INCHES; g_UserUnit = INCHES;
UpdateStatusBar(); UpdateStatusBar();
break; break;
......
...@@ -363,7 +363,7 @@ void LIB_TEXT::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -363,7 +363,7 @@ void LIB_TEXT::DisplayInfo( WinEDA_DrawFrame* frame )
LIB_DRAW_ITEM::DisplayInfo( frame ); LIB_DRAW_ITEM::DisplayInfo( frame );
msg = ReturnStringFromValue( g_UnitMetric, m_Width, msg = ReturnStringFromValue( g_UserUnit, m_Width,
EESCHEMA_INTERNAL_UNIT, true ); EESCHEMA_INTERNAL_UNIT, true );
frame->AppendMsgPanel( _( "Line width" ), msg, BLUE ); frame->AppendMsgPanel( _( "Line width" ), msg, BLUE );
......
...@@ -1647,7 +1647,7 @@ void LIB_PIN::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -1647,7 +1647,7 @@ void LIB_PIN::DisplayInfo( WinEDA_DrawFrame* frame )
frame->AppendMsgPanel( _( "Visible" ), Text, DARKGREEN ); frame->AppendMsgPanel( _( "Visible" ), Text, DARKGREEN );
/* Display pin length */ /* Display pin length */
Text = ReturnStringFromValue( g_UnitMetric, m_PinLen, Text = ReturnStringFromValue( g_UserUnit, m_PinLen,
EESCHEMA_INTERNAL_UNIT, true ); EESCHEMA_INTERNAL_UNIT, true );
frame->AppendMsgPanel( _( "Length" ), Text, MAGENTA ); frame->AppendMsgPanel( _( "Length" ), Text, MAGENTA );
......
...@@ -530,7 +530,7 @@ void LIB_ARC::DisplayInfo( WinEDA_DrawFrame* aFrame ) ...@@ -530,7 +530,7 @@ void LIB_ARC::DisplayInfo( WinEDA_DrawFrame* aFrame )
LIB_DRAW_ITEM::DisplayInfo( aFrame ); LIB_DRAW_ITEM::DisplayInfo( aFrame );
msg = ReturnStringFromValue( g_UnitMetric, m_Width, msg = ReturnStringFromValue( g_UserUnit, m_Width,
EESCHEMA_INTERNAL_UNIT, true ); EESCHEMA_INTERNAL_UNIT, true );
aFrame->AppendMsgPanel( _( "Line width" ), msg, BLUE ); aFrame->AppendMsgPanel( _( "Line width" ), msg, BLUE );
...@@ -791,12 +791,12 @@ void LIB_CIRCLE::DisplayInfo( WinEDA_DrawFrame* aFrame ) ...@@ -791,12 +791,12 @@ void LIB_CIRCLE::DisplayInfo( WinEDA_DrawFrame* aFrame )
LIB_DRAW_ITEM::DisplayInfo( aFrame ); LIB_DRAW_ITEM::DisplayInfo( aFrame );
msg = ReturnStringFromValue( g_UnitMetric, m_Width, msg = ReturnStringFromValue( g_UserUnit, m_Width,
EESCHEMA_INTERNAL_UNIT, true ); EESCHEMA_INTERNAL_UNIT, true );
aFrame->AppendMsgPanel( _( "Line width" ), msg, BLUE ); aFrame->AppendMsgPanel( _( "Line width" ), msg, BLUE );
msg = ReturnStringFromValue( g_UnitMetric, m_Radius, msg = ReturnStringFromValue( g_UserUnit, m_Radius,
EESCHEMA_INTERNAL_UNIT, true ); EESCHEMA_INTERNAL_UNIT, true );
aFrame->AppendMsgPanel( _( "Radius" ), msg, RED ); aFrame->AppendMsgPanel( _( "Radius" ), msg, RED );
...@@ -1020,7 +1020,7 @@ void LIB_RECTANGLE::DisplayInfo( WinEDA_DrawFrame* aFrame ) ...@@ -1020,7 +1020,7 @@ void LIB_RECTANGLE::DisplayInfo( WinEDA_DrawFrame* aFrame )
LIB_DRAW_ITEM::DisplayInfo( aFrame ); LIB_DRAW_ITEM::DisplayInfo( aFrame );
msg = ReturnStringFromValue( g_UnitMetric, m_Width, EESCHEMA_INTERNAL_UNIT, true ); msg = ReturnStringFromValue( g_UserUnit, m_Width, EESCHEMA_INTERNAL_UNIT, true );
aFrame->AppendMsgPanel( _( "Line width" ), msg, BLUE ); aFrame->AppendMsgPanel( _( "Line width" ), msg, BLUE );
} }
...@@ -1271,7 +1271,7 @@ void LIB_SEGMENT::DisplayInfo( WinEDA_DrawFrame* aFrame ) ...@@ -1271,7 +1271,7 @@ void LIB_SEGMENT::DisplayInfo( WinEDA_DrawFrame* aFrame )
LIB_DRAW_ITEM::DisplayInfo( aFrame ); LIB_DRAW_ITEM::DisplayInfo( aFrame );
msg = ReturnStringFromValue( g_UnitMetric, m_Width, msg = ReturnStringFromValue( g_UserUnit, m_Width,
EESCHEMA_INTERNAL_UNIT, true ); EESCHEMA_INTERNAL_UNIT, true );
aFrame->AppendMsgPanel( _( "Line width" ), msg, BLUE ); aFrame->AppendMsgPanel( _( "Line width" ), msg, BLUE );
...@@ -1689,7 +1689,7 @@ void LIB_POLYLINE::DisplayInfo( WinEDA_DrawFrame* aFrame ) ...@@ -1689,7 +1689,7 @@ void LIB_POLYLINE::DisplayInfo( WinEDA_DrawFrame* aFrame )
LIB_DRAW_ITEM::DisplayInfo( aFrame ); LIB_DRAW_ITEM::DisplayInfo( aFrame );
msg = ReturnStringFromValue( g_UnitMetric, m_Width, msg = ReturnStringFromValue( g_UserUnit, m_Width,
EESCHEMA_INTERNAL_UNIT, true ); EESCHEMA_INTERNAL_UNIT, true );
aFrame->AppendMsgPanel(_( "Line width" ), msg, BLUE ); aFrame->AppendMsgPanel(_( "Line width" ), msg, BLUE );
...@@ -2060,7 +2060,7 @@ void LIB_BEZIER::DisplayInfo( WinEDA_DrawFrame* aFrame ) ...@@ -2060,7 +2060,7 @@ void LIB_BEZIER::DisplayInfo( WinEDA_DrawFrame* aFrame )
LIB_DRAW_ITEM::DisplayInfo( aFrame ); LIB_DRAW_ITEM::DisplayInfo( aFrame );
msg = ReturnStringFromValue( g_UnitMetric, m_Width, msg = ReturnStringFromValue( g_UserUnit, m_Width,
EESCHEMA_INTERNAL_UNIT, true ); EESCHEMA_INTERNAL_UNIT, true );
aFrame->AppendMsgPanel( _( "Line width" ), msg, BLUE ); aFrame->AppendMsgPanel( _( "Line width" ), msg, BLUE );
......
...@@ -100,9 +100,9 @@ void DIALOG_SVG_PRINT::OnInitDialog( wxInitDialogEvent& event ) ...@@ -100,9 +100,9 @@ void DIALOG_SVG_PRINT::OnInitDialog( wxInitDialogEvent& event )
m_ModeColorOption->SetSelection(s_PlotBlackAndWhite); m_ModeColorOption->SetSelection(s_PlotBlackAndWhite);
AddUnitSymbol(* m_TextPenWidth, g_UnitMetric ); AddUnitSymbol(* m_TextPenWidth, g_UserUnit );
m_DialogPenWidth->SetValue( m_DialogPenWidth->SetValue(
ReturnStringFromValue(g_UnitMetric, g_DrawDefaultLineThickness, ReturnStringFromValue(g_UserUnit, g_DrawDefaultLineThickness,
m_Parent->m_InternalUnits ) ); m_Parent->m_InternalUnits ) );
m_Print_Sheet_Ref->SetValue( s_Print_Frame_Ref ); m_Print_Sheet_Ref->SetValue( s_Print_Frame_Ref );
if (GetSizer()) if (GetSizer())
...@@ -128,7 +128,7 @@ void DIALOG_SVG_PRINT::SetPenWidth() ...@@ -128,7 +128,7 @@ void DIALOG_SVG_PRINT::SetPenWidth()
} }
m_DialogPenWidth->SetValue( m_DialogPenWidth->SetValue(
ReturnStringFromValue( g_UnitMetric, g_DrawDefaultLineThickness, ReturnStringFromValue( g_UserUnit, g_DrawDefaultLineThickness,
m_Parent->m_InternalUnits ) ); m_Parent->m_InternalUnits ) );
} }
......
...@@ -91,17 +91,17 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow ...@@ -91,17 +91,17 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow
columnLabel.SetText( _( "Value" ) ); columnLabel.SetText( _( "Value" ) );
fieldListCtrl->InsertColumn( 1, columnLabel ); fieldListCtrl->InsertColumn( 1, columnLabel );
wxString label = _( "Size" ) + ReturnUnitSymbol( g_UnitMetric ); wxString label = _( "Size" ) + ReturnUnitSymbol( g_UserUnit );
textSizeLabel->SetLabel( label ); textSizeLabel->SetLabel( label );
label = _( "Pos " ); label = _( "Pos " );
label += _( "X" ); label += _( "X" );
label += ReturnUnitSymbol( g_UnitMetric ); label += ReturnUnitSymbol( g_UserUnit );
posXLabel->SetLabel( label ); posXLabel->SetLabel( label );
label = _( "Pos " ); label = _( "Pos " );
label += _( "Y" ); label += _( "Y" );
label += ReturnUnitSymbol( g_UnitMetric ); label += ReturnUnitSymbol( g_UserUnit );
posYLabel->SetLabel( label ); posYLabel->SetLabel( label );
copySelectedFieldToPanel(); copySelectedFieldToPanel();
...@@ -599,7 +599,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel() ...@@ -599,7 +599,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
textSizeTextCtrl->SetValue( textSizeTextCtrl->SetValue(
WinEDA_GraphicTextCtrl::FormatSize( EESCHEMA_INTERNAL_UNIT, WinEDA_GraphicTextCtrl::FormatSize( EESCHEMA_INTERNAL_UNIT,
g_UnitMetric, field.m_Size.x ) ); g_UserUnit, field.m_Size.x ) );
wxPoint coord = field.m_Pos; wxPoint coord = field.m_Pos;
wxPoint zero = -m_Cmp->m_Pos; // relative zero wxPoint zero = -m_Cmp->m_Pos; // relative zero
...@@ -623,11 +623,11 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel() ...@@ -623,11 +623,11 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
// top of each other. // top of each other.
} }
wxString coordText = ReturnStringFromValue( g_UnitMetric, coord.x, wxString coordText = ReturnStringFromValue( g_UserUnit, coord.x,
EESCHEMA_INTERNAL_UNIT ); EESCHEMA_INTERNAL_UNIT );
posXTextCtrl->SetValue( coordText ); posXTextCtrl->SetValue( coordText );
coordText = ReturnStringFromValue( g_UnitMetric, coord.y, coordText = ReturnStringFromValue( g_UserUnit, coord.y,
EESCHEMA_INTERNAL_UNIT ); EESCHEMA_INTERNAL_UNIT );
posYTextCtrl->SetValue( coordText ); posYTextCtrl->SetValue( coordText );
} }
...@@ -667,7 +667,7 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField() ...@@ -667,7 +667,7 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
setRowItem( fieldNdx, field ); // update fieldListCtrl setRowItem( fieldNdx, field ); // update fieldListCtrl
field.m_Size.x = WinEDA_GraphicTextCtrl::ParseSize( field.m_Size.x = WinEDA_GraphicTextCtrl::ParseSize(
textSizeTextCtrl->GetValue(), EESCHEMA_INTERNAL_UNIT, g_UnitMetric ); textSizeTextCtrl->GetValue(), EESCHEMA_INTERNAL_UNIT, g_UserUnit );
field.m_Size.y = field.m_Size.x; field.m_Size.y = field.m_Size.x;
int style = m_StyleRadioBox->GetSelection(); int style = m_StyleRadioBox->GetSelection();
...@@ -681,14 +681,9 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField() ...@@ -681,14 +681,9 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
else else
field.m_Bold = false; field.m_Bold = false;
double value; field.m_Pos.x = ReturnValueFromString( g_UserUnit, posXTextCtrl->GetValue(),
posXTextCtrl->GetValue().ToDouble( &value );
field.m_Pos.x = From_User_Unit( g_UnitMetric, value,
EESCHEMA_INTERNAL_UNIT ); EESCHEMA_INTERNAL_UNIT );
field.m_Pos.y = ReturnValueFromString( g_UserUnit, posYTextCtrl->GetValue(),
posYTextCtrl->GetValue().ToDouble( &value );
field.m_Pos.y = From_User_Unit( g_UnitMetric, value,
EESCHEMA_INTERNAL_UNIT ); EESCHEMA_INTERNAL_UNIT );
return true; return true;
......
...@@ -140,11 +140,11 @@ void DialogLabelEditor::InitDialog() ...@@ -140,11 +140,11 @@ void DialogLabelEditor::InitDialog()
m_TextStyle->SetSelection( style ); m_TextStyle->SetSelection( style );
wxString units = ReturnUnitSymbol( g_UnitMetric, wxT( "(%s)" ) ); wxString units = ReturnUnitSymbol( g_UserUnit, wxT( "(%s)" ) );
msg = _( "H" ) + units + _( " x W" ) + units; msg = _( "H" ) + units + _( " x W" ) + units;
m_staticSizeUnits->SetLabel( msg ); m_staticSizeUnits->SetLabel( msg );
msg = ReturnStringFromValue( g_UnitMetric, m_CurrentText->m_Size.x, msg = ReturnStringFromValue( g_UserUnit, m_CurrentText->m_Size.x,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
m_TextSize->SetValue( msg ); m_TextSize->SetValue( msg );
...@@ -206,7 +206,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent ) ...@@ -206,7 +206,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent )
m_CurrentText->SetSchematicTextOrientation( m_TextOrient->GetSelection() ); m_CurrentText->SetSchematicTextOrientation( m_TextOrient->GetSelection() );
text = m_TextSize->GetValue(); text = m_TextSize->GetValue();
value = ReturnValueFromString( g_UnitMetric, text, m_Parent->m_InternalUnits ); value = ReturnValueFromString( g_UserUnit, text, m_Parent->m_InternalUnits );
m_CurrentText->m_Size.x = m_CurrentText->m_Size.y = value; m_CurrentText->m_Size.x = m_CurrentText->m_Size.y = value;
if( m_TextShape ) if( m_TextShape )
m_CurrentText->m_Shape = m_TextShape->GetSelection(); m_CurrentText->m_Shape = m_TextShape->GetSelection();
......
...@@ -157,17 +157,17 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnInitDialog( wxInitDialogEvent& event ...@@ -157,17 +157,17 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnInitDialog( wxInitDialogEvent& event
columnLabel.SetText( _( "Value" ) ); columnLabel.SetText( _( "Value" ) );
fieldListCtrl->InsertColumn( COLUMN_TEXT, columnLabel ); fieldListCtrl->InsertColumn( COLUMN_TEXT, columnLabel );
wxString label = _( "Size" ) + ReturnUnitSymbol( g_UnitMetric ); wxString label = _( "Size" ) + ReturnUnitSymbol( g_UserUnit );
textSizeLabel->SetLabel( label ); textSizeLabel->SetLabel( label );
label = _( "Pos " ); label = _( "Pos " );
label += _( "X" ); label += _( "X" );
label += ReturnUnitSymbol( g_UnitMetric ); label += ReturnUnitSymbol( g_UserUnit );
posXLabel->SetLabel( label ); posXLabel->SetLabel( label );
label = _( "Pos " ); label = _( "Pos " );
label += _( "Y" ); label += _( "Y" );
label += ReturnUnitSymbol( g_UnitMetric ); label += ReturnUnitSymbol( g_UserUnit );
posYLabel->SetLabel( label ); posYLabel->SetLabel( label );
InitBuffers(); InitBuffers();
...@@ -638,7 +638,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel() ...@@ -638,7 +638,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
fieldValueTextCtrl->SetValue( field.m_Text ); fieldValueTextCtrl->SetValue( field.m_Text );
textSizeTextCtrl->SetValue( textSizeTextCtrl->SetValue(
WinEDA_GraphicTextCtrl::FormatSize( EESCHEMA_INTERNAL_UNIT, g_UnitMetric, field.m_Size.x ) ); WinEDA_GraphicTextCtrl::FormatSize( EESCHEMA_INTERNAL_UNIT, g_UserUnit, field.m_Size.x ) );
wxPoint coord = field.m_Pos; wxPoint coord = field.m_Pos;
wxPoint zero; wxPoint zero;
...@@ -659,13 +659,13 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel() ...@@ -659,13 +659,13 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
// top of each other. // top of each other.
} }
wxString coordText = ReturnStringFromValue( g_UnitMetric, coord.x, EESCHEMA_INTERNAL_UNIT ); wxString coordText = ReturnStringFromValue( g_UserUnit, coord.x, EESCHEMA_INTERNAL_UNIT );
posXTextCtrl->SetValue( coordText ); posXTextCtrl->SetValue( coordText );
// Note: the Y axis for components in lib is from bottom to top // Note: the Y axis for components in lib is from bottom to top
// and the screen axis is top to bottom: we must change the y coord sign for editing // and the screen axis is top to bottom: we must change the y coord sign for editing
NEGATE( coord.y ); NEGATE( coord.y );
coordText = ReturnStringFromValue( g_UnitMetric, coord.y, EESCHEMA_INTERNAL_UNIT ); coordText = ReturnStringFromValue( g_UserUnit, coord.y, EESCHEMA_INTERNAL_UNIT );
posYTextCtrl->SetValue( coordText ); posYTextCtrl->SetValue( coordText );
} }
...@@ -719,7 +719,7 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField() ...@@ -719,7 +719,7 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField()
setRowItem( fieldNdx, field ); // update fieldListCtrl setRowItem( fieldNdx, field ); // update fieldListCtrl
field.m_Size.x = WinEDA_GraphicTextCtrl::ParseSize( field.m_Size.x = WinEDA_GraphicTextCtrl::ParseSize(
textSizeTextCtrl->GetValue(), EESCHEMA_INTERNAL_UNIT, g_UnitMetric ); textSizeTextCtrl->GetValue(), EESCHEMA_INTERNAL_UNIT, g_UserUnit );
field.m_Size.y = field.m_Size.x; field.m_Size.y = field.m_Size.x;
...@@ -734,13 +734,10 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField() ...@@ -734,13 +734,10 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField()
else else
field.m_Bold = false; field.m_Bold = false;
double value; field.m_Pos.x = ReturnValueFromString( g_UserUnit, posXTextCtrl->GetValue(),
EESCHEMA_INTERNAL_UNIT );
posXTextCtrl->GetValue().ToDouble( &value ); field.m_Pos.y = ReturnValueFromString( g_UserUnit, posYTextCtrl->GetValue(),
field.m_Pos.x = From_User_Unit( g_UnitMetric, value, EESCHEMA_INTERNAL_UNIT ); EESCHEMA_INTERNAL_UNIT );
posYTextCtrl->GetValue().ToDouble( &value );
field.m_Pos.y = From_User_Unit( g_UnitMetric, value, EESCHEMA_INTERNAL_UNIT );
// Note: the Y axis for components in lib is from bottom to top // Note: the Y axis for components in lib is from bottom to top
// and the screen axis is top to bottom: we must change the y coord sign for editing // and the screen axis is top to bottom: we must change the y coord sign for editing
......
...@@ -56,7 +56,7 @@ void Dialog_BodyGraphicText_Properties::InitDialog( ) ...@@ -56,7 +56,7 @@ void Dialog_BodyGraphicText_Properties::InitDialog( )
if ( m_GraphicText ) if ( m_GraphicText )
{ {
msg = ReturnStringFromValue(g_UnitMetric, m_GraphicText->m_Size.x, msg = ReturnStringFromValue(g_UserUnit, m_GraphicText->m_Size.x,
m_Parent->m_InternalUnits); m_Parent->m_InternalUnits);
m_TextSize->SetValue( msg ); m_TextSize->SetValue( msg );
m_TextValue->SetValue( m_GraphicText->m_Text ); m_TextValue->SetValue( m_GraphicText->m_Text );
...@@ -109,7 +109,7 @@ void Dialog_BodyGraphicText_Properties::InitDialog( ) ...@@ -109,7 +109,7 @@ void Dialog_BodyGraphicText_Properties::InitDialog( )
} }
else else
{ {
msg = ReturnStringFromValue( g_UnitMetric, m_Parent->m_textSize, msg = ReturnStringFromValue( g_UserUnit, m_Parent->m_textSize,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
m_TextSize->SetValue( msg ); m_TextSize->SetValue( msg );
...@@ -148,7 +148,7 @@ void Dialog_BodyGraphicText_Properties::OnOkClick( wxCommandEvent& event ) ...@@ -148,7 +148,7 @@ void Dialog_BodyGraphicText_Properties::OnOkClick( wxCommandEvent& event )
m_Parent->m_textOrientation = m_Parent->m_textOrientation =
m_Orient->GetValue() ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ; m_Orient->GetValue() ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ;
wxString msg = m_TextSize->GetValue(); wxString msg = m_TextSize->GetValue();
m_Parent->m_textSize = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_textSize = ReturnValueFromString( g_UserUnit, msg,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
m_Parent->m_drawSpecificConvert = m_CommonConvert->GetValue() ? false : true; m_Parent->m_drawSpecificConvert = m_CommonConvert->GetValue() ? false : true;
m_Parent->m_drawSpecificUnit = m_CommonUnit->GetValue() ? false : true; m_Parent->m_drawSpecificUnit = m_CommonUnit->GetValue() ? false : true;
......
...@@ -189,9 +189,9 @@ void WinEDA_SchematicFrame::OnSetOptions( wxCommandEvent& event ) ...@@ -189,9 +189,9 @@ void WinEDA_SchematicFrame::OnSetOptions( wxCommandEvent& event )
grid_list.Index( GetBaseScreen()->GetGrid() ) ); grid_list.Index( GetBaseScreen()->GetGrid() ) );
units.Add( GetUnitsLabel( INCHES ) ); units.Add( GetUnitsLabel( INCHES ) );
units.Add( GetUnitsLabel( MILLIMETRE ) ); units.Add( GetUnitsLabel( MILLIMETRES ) );
dlg.SetUnits( units, g_UnitMetric ); dlg.SetUnits( units, g_UserUnit );
dlg.SetGridSizes( grid_list, GetBaseScreen()->GetGridId() ); dlg.SetGridSizes( grid_list, GetBaseScreen()->GetGridId() );
dlg.SetLineWidth( g_DrawDefaultLineThickness ); dlg.SetLineWidth( g_DrawDefaultLineThickness );
dlg.SetTextSize( g_DefaultTextLabelSize ); dlg.SetTextSize( g_DefaultTextLabelSize );
...@@ -220,7 +220,7 @@ void WinEDA_SchematicFrame::OnSetOptions( wxCommandEvent& event ) ...@@ -220,7 +220,7 @@ void WinEDA_SchematicFrame::OnSetOptions( wxCommandEvent& event )
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;
g_UnitMetric = dlg.GetUnitsSelection(); g_UserUnit = (UserUnitType)dlg.GetUnitsSelection();
GetBaseScreen()->SetGrid( GetBaseScreen()->SetGrid(
grid_list[ (size_t) dlg.GetGridSelection() ].m_Size ); grid_list[ (size_t) dlg.GetGridSelection() ].m_Size );
...@@ -495,8 +495,8 @@ PARAM_CFG_ARRAY& WinEDA_SchematicFrame::GetConfigurationSettings( void ) ...@@ -495,8 +495,8 @@ PARAM_CFG_ARRAY& WinEDA_SchematicFrame::GetConfigurationSettings( void )
if( !m_configSettings.empty() ) if( !m_configSettings.empty() )
return m_configSettings; return m_configSettings;
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Unite" ), m_configSettings.push_back( new PARAM_CFG_INT( wxT( "Unite" ),
&g_UnitMetric, 0, 0, 1 ) ); (int*)&g_UserUnit, 0 ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColWire" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColWire" ),
&g_LayerDescr.LayerColor[LAYER_WIRE], &g_LayerDescr.LayerColor[LAYER_WIRE],
GREEN ) ); GREEN ) );
......
...@@ -67,8 +67,8 @@ void WinEDA_SchematicFrame::OnFindDrcMarker( wxFindDialogEvent& event ) ...@@ -67,8 +67,8 @@ void WinEDA_SchematicFrame::OnFindDrcMarker( wxFindDialogEvent& event )
wxString path = sheetFoundIn->Path(); wxString path = sheetFoundIn->Path();
wxString units = GetAbbreviatedUnitsLabel(); wxString units = GetAbbreviatedUnitsLabel();
double x = To_User_Unit( g_UnitMetric, (double) lastMarker->m_Pos.x, m_InternalUnits ); double x = To_User_Unit( g_UserUnit, (double) lastMarker->m_Pos.x, m_InternalUnits );
double y = To_User_Unit( g_UnitMetric, (double) lastMarker->m_Pos.y, m_InternalUnits ); double y = To_User_Unit( g_UserUnit, (double) lastMarker->m_Pos.y, m_InternalUnits );
msg.Printf( _( "Design rule check marker found in sheet %s at %0.3f%s, %0.3f%s" ), msg.Printf( _( "Design rule check marker found in sheet %s at %0.3f%s, %0.3f%s" ),
GetChars( path ), x, GetChars( units ), y, GetChars( units) ); GetChars( path ), x, GetChars( units ), y, GetChars( units) );
SetStatusText( msg ); SetStatusText( msg );
......
...@@ -81,7 +81,7 @@ void WinEDA_LibeditFrame::OnEditPin( wxCommandEvent& event ) ...@@ -81,7 +81,7 @@ void WinEDA_LibeditFrame::OnEditPin( wxCommandEvent& event )
DIALOG_LIB_EDIT_PIN dlg( this ); DIALOG_LIB_EDIT_PIN dlg( this );
wxString units = GetUnitsLabel( g_UnitMetric ); wxString units = GetUnitsLabel( g_UserUnit );
dlg.SetOrientationList( LIB_PIN::GetOrientationNames(), dlg.SetOrientationList( LIB_PIN::GetOrientationNames(),
LIB_PIN::GetOrientationSymbols() ); LIB_PIN::GetOrientationSymbols() );
dlg.SetOrientation( LIB_PIN::GetOrientationCodeIndex( pin->m_Orient ) ); dlg.SetOrientation( LIB_PIN::GetOrientationCodeIndex( pin->m_Orient ) );
...@@ -92,16 +92,16 @@ void WinEDA_LibeditFrame::OnEditPin( wxCommandEvent& event ) ...@@ -92,16 +92,16 @@ void WinEDA_LibeditFrame::OnEditPin( wxCommandEvent& event )
LIB_PIN::GetElectricalTypeSymbols()); LIB_PIN::GetElectricalTypeSymbols());
dlg.SetElectricalType( pin->m_PinType ); dlg.SetElectricalType( pin->m_PinType );
dlg.SetName( pin->m_PinName ); dlg.SetName( pin->m_PinName );
dlg.SetNameTextSize( ReturnStringFromValue( g_UnitMetric, dlg.SetNameTextSize( ReturnStringFromValue( g_UserUnit,
pin->m_PinNameSize, pin->m_PinNameSize,
m_InternalUnits ) ); m_InternalUnits ) );
dlg.SetNameTextSizeUnits( units ); dlg.SetNameTextSizeUnits( units );
dlg.SetNumber( pin->GetNumber() ); dlg.SetNumber( pin->GetNumber() );
dlg.SetNumberTextSize( ReturnStringFromValue( g_UnitMetric, dlg.SetNumberTextSize( ReturnStringFromValue( g_UserUnit,
pin->m_PinNumSize, pin->m_PinNumSize,
m_InternalUnits ) ); m_InternalUnits ) );
dlg.SetNumberTextSizeUnits( units ); dlg.SetNumberTextSizeUnits( units );
dlg.SetLength( ReturnStringFromValue( g_UnitMetric, pin->m_PinLen, dlg.SetLength( ReturnStringFromValue( g_UserUnit, pin->m_PinLen,
m_InternalUnits ) ); m_InternalUnits ) );
dlg.SetLengthUnits( units ); dlg.SetLengthUnits( units );
dlg.SetAddToAllParts( pin->m_Unit == 0 ); dlg.SetAddToAllParts( pin->m_Unit == 0 );
...@@ -129,14 +129,14 @@ void WinEDA_LibeditFrame::OnEditPin( wxCommandEvent& event ) ...@@ -129,14 +129,14 @@ void WinEDA_LibeditFrame::OnEditPin( wxCommandEvent& event )
} }
/* Save the pin properties to use for the next new pin. */ /* Save the pin properties to use for the next new pin. */
LastPinNameSize = ReturnValueFromString( g_UnitMetric, LastPinNameSize = ReturnValueFromString( g_UserUnit,
dlg.GetNameTextSize(), dlg.GetNameTextSize(),
m_InternalUnits ); m_InternalUnits );
LastPinNumSize = ReturnValueFromString( g_UnitMetric, LastPinNumSize = ReturnValueFromString( g_UserUnit,
dlg.GetNumberTextSize(), dlg.GetNumberTextSize(),
m_InternalUnits ); m_InternalUnits );
LastPinOrient = LIB_PIN::GetOrientationCode( dlg.GetOrientation() ); LastPinOrient = LIB_PIN::GetOrientationCode( dlg.GetOrientation() );
LastPinLength = ReturnValueFromString( g_UnitMetric, dlg.GetLength(), LastPinLength = ReturnValueFromString( g_UserUnit, dlg.GetLength(),
m_InternalUnits ); m_InternalUnits );
LastPinShape = LIB_PIN::GetStyleCode( dlg.GetStyle() ); LastPinShape = LIB_PIN::GetStyleCode( dlg.GetStyle() );
LastPinType = dlg.GetElectricalType(); LastPinType = dlg.GetElectricalType();
......
...@@ -492,11 +492,11 @@ void WinEDA_PlotHPGLFrame::SetPageOffsetValue() ...@@ -492,11 +492,11 @@ void WinEDA_PlotHPGLFrame::SetPageOffsetValue()
if( HPGL_SizeSelect != PAGE_DEFAULT ) if( HPGL_SizeSelect != PAGE_DEFAULT )
{ {
msg = ReturnStringFromValue( g_UnitMetric, msg = ReturnStringFromValue( g_UserUnit,
Plot_sheet_list[HPGL_SizeSelect]->m_Offset.x, Plot_sheet_list[HPGL_SizeSelect]->m_Offset.x,
EESCHEMA_INTERNAL_UNIT ); EESCHEMA_INTERNAL_UNIT );
m_PlotOrgPosition_X->SetValue( msg ); m_PlotOrgPosition_X->SetValue( msg );
msg = ReturnStringFromValue( g_UnitMetric, msg = ReturnStringFromValue( g_UserUnit,
Plot_sheet_list[HPGL_SizeSelect]-> m_Offset.y, Plot_sheet_list[HPGL_SizeSelect]-> m_Offset.y,
EESCHEMA_INTERNAL_UNIT ); EESCHEMA_INTERNAL_UNIT );
m_PlotOrgPosition_Y->SetValue( msg ); m_PlotOrgPosition_Y->SetValue( msg );
...@@ -525,10 +525,10 @@ void WinEDA_PlotHPGLFrame::AcceptPlotOffset( wxCommandEvent& event ) ...@@ -525,10 +525,10 @@ void WinEDA_PlotHPGLFrame::AcceptPlotOffset( wxCommandEvent& event )
{ {
wxString msg = m_PlotOrgPosition_X->GetValue(); wxString msg = m_PlotOrgPosition_X->GetValue();
Plot_sheet_list[HPGL_SizeSelect]->m_Offset.x = Plot_sheet_list[HPGL_SizeSelect]->m_Offset.x =
ReturnValueFromString( g_UnitMetric, msg, EESCHEMA_INTERNAL_UNIT ); ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT );
msg = m_PlotOrgPosition_Y->GetValue(); msg = m_PlotOrgPosition_Y->GetValue();
Plot_sheet_list[HPGL_SizeSelect]->m_Offset.y = Plot_sheet_list[HPGL_SizeSelect]->m_Offset.y =
ReturnValueFromString( g_UnitMetric, msg, EESCHEMA_INTERNAL_UNIT ); ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT );
} }
} }
...@@ -574,10 +574,10 @@ void WinEDA_PlotHPGLFrame::HPGL_Plot( wxCommandEvent& event ) ...@@ -574,10 +574,10 @@ void WinEDA_PlotHPGLFrame::HPGL_Plot( wxCommandEvent& event )
{ {
wxString msg = m_PlotOrgPosition_X->GetValue(); wxString msg = m_PlotOrgPosition_X->GetValue();
Plot_sheet_list[HPGL_SizeSelect]->m_Offset.x = Plot_sheet_list[HPGL_SizeSelect]->m_Offset.x =
ReturnValueFromString( g_UnitMetric, msg, EESCHEMA_INTERNAL_UNIT ); ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT );
msg = m_PlotOrgPosition_Y->GetValue(); msg = m_PlotOrgPosition_Y->GetValue();
Plot_sheet_list[HPGL_SizeSelect]->m_Offset.y = Plot_sheet_list[HPGL_SizeSelect]->m_Offset.y =
ReturnValueFromString( g_UnitMetric, msg, EESCHEMA_INTERNAL_UNIT ); ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT );
} }
Plot_Schematic_HPGL( Select_PlotAll, HPGL_SizeSelect ); Plot_Schematic_HPGL( Select_PlotAll, HPGL_SizeSelect );
......
...@@ -255,7 +255,7 @@ void WinEDA_PlotPSFrame::CreateControls() ...@@ -255,7 +255,7 @@ void WinEDA_PlotPSFrame::CreateControls()
m_DefaultLineSizeCtrl = new WinEDA_ValueCtrl( this, m_DefaultLineSizeCtrl = new WinEDA_ValueCtrl( this,
_( "Default Line Width" ), _( "Default Line Width" ),
g_DrawDefaultLineThickness, g_DrawDefaultLineThickness,
g_UnitMetric, g_UserUnit,
m_DefaultLineSizeCtrlSizer, m_DefaultLineSizeCtrlSizer,
EESCHEMA_INTERNAL_UNIT ); EESCHEMA_INTERNAL_UNIT );
} }
......
...@@ -563,10 +563,10 @@ void WinEDA_SchematicFrame::OnUpdateSelectCursor( wxUpdateUIEvent& event ) ...@@ -563,10 +563,10 @@ void WinEDA_SchematicFrame::OnUpdateSelectCursor( wxUpdateUIEvent& event )
void WinEDA_SchematicFrame::OnUpdateUnits( wxUpdateUIEvent& event ) void WinEDA_SchematicFrame::OnUpdateUnits( wxUpdateUIEvent& event )
{ {
bool is_metric = g_UnitMetric == MILLIMETRE ? true : false; bool is_metric = ( g_UserUnit == MILLIMETRES ) ? true : false;
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM, is_metric ); m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM, g_UserUnit == MILLIMETRES );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, !is_metric ); m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, g_UserUnit == INCHES );
DisplayUnitsMsg(); DisplayUnitsMsg();
} }
......
...@@ -43,14 +43,14 @@ bool WinEDA_SchematicFrame::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -43,14 +43,14 @@ bool WinEDA_SchematicFrame::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
DIALOG_SCH_SHEET_PROPS dlg( this ); DIALOG_SCH_SHEET_PROPS dlg( this );
wxString units = GetUnitsLabel( g_UnitMetric ); wxString units = GetUnitsLabel( g_UserUnit );
dlg.SetFileName( aSheet->GetFileName() ); dlg.SetFileName( aSheet->GetFileName() );
dlg.SetFileNameTextSize( ReturnStringFromValue( g_UnitMetric, dlg.SetFileNameTextSize( ReturnStringFromValue( g_UserUnit,
aSheet->m_FileNameSize, aSheet->m_FileNameSize,
m_InternalUnits ) ); m_InternalUnits ) );
dlg.SetFileNameTextSizeUnits( units ); dlg.SetFileNameTextSizeUnits( units );
dlg.SetSheetName( aSheet->m_SheetName ); dlg.SetSheetName( aSheet->m_SheetName );
dlg.SetSheetNameTextSize( ReturnStringFromValue( g_UnitMetric, dlg.SetSheetNameTextSize( ReturnStringFromValue( g_UserUnit,
aSheet->m_SheetNameSize, aSheet->m_SheetNameSize,
m_InternalUnits ) ); m_InternalUnits ) );
dlg.SetSheetNameTextSizeUnits( units ); dlg.SetSheetNameTextSizeUnits( units );
...@@ -109,12 +109,12 @@ structures and cannot be undone.\nOk to continue renaming?" ); ...@@ -109,12 +109,12 @@ structures and cannot be undone.\nOk to continue renaming?" );
else else
SaveCopyInUndoList( aSheet, UR_CHANGED ); SaveCopyInUndoList( aSheet, UR_CHANGED );
aSheet->m_FileNameSize = ReturnValueFromString( g_UnitMetric, aSheet->m_FileNameSize = ReturnValueFromString( g_UserUnit,
dlg.GetFileNameTextSize(), dlg.GetFileNameTextSize(),
m_InternalUnits ); m_InternalUnits );
aSheet->m_SheetName = dlg.GetSheetName(); aSheet->m_SheetName = dlg.GetSheetName();
aSheet->m_SheetNameSize = ReturnValueFromString( g_UnitMetric, aSheet->m_SheetNameSize = ReturnValueFromString( g_UserUnit,
dlg.GetSheetNameTextSize(), dlg.GetSheetNameTextSize(),
m_InternalUnits ); m_InternalUnits );
......
...@@ -87,7 +87,7 @@ WinEDA_PinSheetPropertiesFrame::WinEDA_PinSheetPropertiesFrame( ...@@ -87,7 +87,7 @@ WinEDA_PinSheetPropertiesFrame::WinEDA_PinSheetPropertiesFrame(
m_TextWin = new WinEDA_GraphicTextCtrl( this, _( "Text:" ), m_TextWin = new WinEDA_GraphicTextCtrl( this, _( "Text:" ),
m_CurrentPinSheet->m_Text, m_CurrentPinSheet->m_Text,
m_CurrentPinSheet->m_Size.x, m_CurrentPinSheet->m_Size.x,
g_UnitMetric, LeftBoxSizer, 200 ); g_UserUnit, LeftBoxSizer, 200 );
// Display shape selection : // Display shape selection :
#define NBSHAPES 5 #define NBSHAPES 5
......
...@@ -68,9 +68,9 @@ void WinEDA_LibeditFrame::EditGraphicSymbol( wxDC* DC, LIB_DRAW_ITEM* DrawItem ) ...@@ -68,9 +68,9 @@ void WinEDA_LibeditFrame::EditGraphicSymbol( wxDC* DC, LIB_DRAW_ITEM* DrawItem )
DIALOG_LIB_EDIT_DRAW_ITEM dialog( this, DrawItem->m_typeName ); DIALOG_LIB_EDIT_DRAW_ITEM dialog( this, DrawItem->m_typeName );
dialog.SetWidthUnits( ReturnUnitSymbol( g_UnitMetric ) ); dialog.SetWidthUnits( ReturnUnitSymbol( g_UserUnit ) );
wxString val = ReturnStringFromValue( g_UnitMetric, m_drawLineWidth, wxString val = ReturnStringFromValue( g_UserUnit, m_drawLineWidth,
m_InternalUnits ); m_InternalUnits );
dialog.SetWidth( val ); dialog.SetWidth( val );
dialog.SetApplyToAllUnits( !m_drawSpecificUnit ); dialog.SetApplyToAllUnits( !m_drawSpecificUnit );
...@@ -85,7 +85,7 @@ void WinEDA_LibeditFrame::EditGraphicSymbol( wxDC* DC, LIB_DRAW_ITEM* DrawItem ) ...@@ -85,7 +85,7 @@ void WinEDA_LibeditFrame::EditGraphicSymbol( wxDC* DC, LIB_DRAW_ITEM* DrawItem )
return; return;
val = dialog.GetWidth(); val = dialog.GetWidth();
m_drawLineWidth = ReturnValueFromString( g_UnitMetric, val, m_drawLineWidth = ReturnValueFromString( g_UserUnit, val,
m_InternalUnits ); m_InternalUnits );
m_drawSpecificConvert = !dialog.GetApplyToAllConversions(); m_drawSpecificConvert = !dialog.GetApplyToAllConversions();
m_drawSpecificUnit = !dialog.GetApplyToAllUnits(); m_drawSpecificUnit = !dialog.GetApplyToAllUnits();
......
...@@ -294,13 +294,13 @@ void WinEDA_SchematicFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -294,13 +294,13 @@ void WinEDA_SchematicFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break; break;
case ID_TB_OPTIONS_SELECT_UNIT_MM: case ID_TB_OPTIONS_SELECT_UNIT_MM:
g_UnitMetric = MILLIMETRE; g_UserUnit = MILLIMETRES;
UpdateStatusBar(); UpdateStatusBar();
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
case ID_TB_OPTIONS_SELECT_UNIT_INCH: case ID_TB_OPTIONS_SELECT_UNIT_INCH:
g_UnitMetric = INCHES; g_UserUnit = INCHES;
UpdateStatusBar(); UpdateStatusBar();
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
......
...@@ -286,10 +286,10 @@ void WinEDA_GerberFrame::SetToolbars() ...@@ -286,10 +286,10 @@ void WinEDA_GerberFrame::SetToolbars()
{ {
m_OptionsToolBar->ToggleTool( m_OptionsToolBar->ToggleTool(
ID_TB_OPTIONS_SELECT_UNIT_MM, ID_TB_OPTIONS_SELECT_UNIT_MM,
g_UnitMetric == g_UserUnit ==
MILLIMETRE ? TRUE : FALSE ); MILLIMETRES ? TRUE : FALSE );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH,
g_UnitMetric == INCHES ? TRUE : FALSE ); g_UserUnit == INCHES ? TRUE : FALSE );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood ); DisplayOpt.DisplayPolarCood );
......
...@@ -36,8 +36,8 @@ static PARAM_CFG_WXSTRING DrillExtBufCfg ...@@ -36,8 +36,8 @@ static PARAM_CFG_WXSTRING DrillExtBufCfg
static PARAM_CFG_INT UnitCfg // Units; 0 inches, 1 mm static PARAM_CFG_INT UnitCfg // Units; 0 inches, 1 mm
( (
wxT("Unite"), wxT("Unite"),
&g_UnitMetric, (int*)&g_UserUnit,
FALSE MILLIMETRES
); );
static PARAM_CFG_INT GerberScaleCfg // default scale; 0 2.3, 1 3.4 static PARAM_CFG_INT GerberScaleCfg // default scale; 0 2.3, 1 3.4
......
...@@ -131,7 +131,7 @@ void WinEDA_GerberFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -131,7 +131,7 @@ void WinEDA_GerberFrame::OnHotKey( wxDC* DC, int hotkey,
break; break;
case HK_SWITCH_UNITS: case HK_SWITCH_UNITS:
g_UnitMetric = (g_UnitMetric == INCHES ) ? MILLIMETRE : INCHES; g_UserUnit = (g_UserUnit == INCHES ) ? MILLIMETRES : INCHES;
break; break;
case HK_SWITCH_TRACK_DISPLAY_MODE: case HK_SWITCH_TRACK_DISPLAY_MODE:
......
...@@ -46,12 +46,12 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -46,12 +46,12 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break; break;
case ID_TB_OPTIONS_SELECT_UNIT_MM: case ID_TB_OPTIONS_SELECT_UNIT_MM:
g_UnitMetric = MILLIMETRE; g_UserUnit = MILLIMETRES;
UpdateStatusBar(); UpdateStatusBar();
break; break;
case ID_TB_OPTIONS_SELECT_UNIT_INCH: case ID_TB_OPTIONS_SELECT_UNIT_INCH:
g_UnitMetric = INCHES; g_UserUnit = INCHES;
UpdateStatusBar(); UpdateStatusBar();
break; break;
...@@ -206,7 +206,7 @@ WinEDA_GerberGeneralOptionsFrame::WinEDA_GerberGeneralOptionsFrame( ...@@ -206,7 +206,7 @@ WinEDA_GerberGeneralOptionsFrame::WinEDA_GerberGeneralOptionsFrame(
m_BoxUnits = new wxRadioBox( this, -1, _( "Units" ), wxDefaultPosition, m_BoxUnits = new wxRadioBox( this, -1, _( "Units" ), wxDefaultPosition,
wxDefaultSize, wxDefaultSize,
2, list_units, 1 ); 2, list_units, 1 );
m_BoxUnits->SetSelection( g_UnitMetric ? 1 : 0 ); m_BoxUnits->SetSelection( g_UserUnit ? 1 : 0 );
LeftBoxSizer->Add( m_BoxUnits, 0, wxGROW | wxALL, 5 ); LeftBoxSizer->Add( m_BoxUnits, 0, wxGROW | wxALL, 5 );
/* Selection of cursor shape */ /* Selection of cursor shape */
...@@ -242,7 +242,7 @@ void WinEDA_GerberGeneralOptionsFrame::OnOkClick( wxCommandEvent& event ) ...@@ -242,7 +242,7 @@ void WinEDA_GerberGeneralOptionsFrame::OnOkClick( wxCommandEvent& event )
{ {
DisplayOpt.DisplayPolarCood = DisplayOpt.DisplayPolarCood =
(m_PolarDisplay->GetSelection() == 0) ? FALSE : TRUE; (m_PolarDisplay->GetSelection() == 0) ? FALSE : TRUE;
g_UnitMetric = (m_BoxUnits->GetSelection() == 0) ? 0 : 1; g_UserUnit = (m_BoxUnits->GetSelection() == 0) ? INCHES : MILLIMETRES;
m_Parent->m_CursorShape = m_CursorShape->GetSelection(); m_Parent->m_CursorShape = m_CursorShape->GetSelection();
g_Default_GERBER_Format = g_Default_GERBER_Format =
(m_GerberDefaultScale->GetSelection() == 0) ? 23 : 34; (m_GerberDefaultScale->GetSelection() == 0) ? 23 : 34;
......
...@@ -15,7 +15,6 @@ extern std::ostream& operator <<( std::ostream& out, const wxPoint& pt ); ...@@ -15,7 +15,6 @@ extern std::ostream& operator <<( std::ostream& out, const wxPoint& pt );
#endif #endif
/* Id for class identification, at run time */ /* Id for class identification, at run time */
enum KICAD_T { enum KICAD_T {
NOT_USED = -1, // the 3d code uses this value NOT_USED = -1, // the 3d code uses this value
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base_struct.h" #include "base_struct.h"
#include "class_undoredo_container.h" #include "class_undoredo_container.h"
#include "block_commande.h" #include "block_commande.h"
#include "common.h"
// Forward declarations: // Forward declarations:
...@@ -325,7 +326,7 @@ public: ...@@ -325,7 +326,7 @@ public:
void SetGridList( GridArray& sizelist ); void SetGridList( GridArray& sizelist );
void AddGrid( const GRID_TYPE& grid ); void AddGrid( const GRID_TYPE& grid );
void AddGrid( const wxRealPoint& size, int id ); void AddGrid( const wxRealPoint& size, int id );
void AddGrid( const wxRealPoint& size, int units, int id ); void AddGrid( const wxRealPoint& size, UserUnitType aUnit, int id );
/** /**
......
...@@ -15,7 +15,6 @@ class WinEDA_DrawFrame; ...@@ -15,7 +15,6 @@ class WinEDA_DrawFrame;
class WinEDAListBox; class WinEDAListBox;
class WinEDA_DrawPanel; class WinEDA_DrawPanel;
/* Flag for special keys */ /* Flag for special keys */
#define GR_KB_RIGHTSHIFT 0x10000000 /* Keybd states: right #define GR_KB_RIGHTSHIFT 0x10000000 /* Keybd states: right
* shift key depressed */ * shift key depressed */
...@@ -78,9 +77,11 @@ enum pseudokeys { ...@@ -78,9 +77,11 @@ enum pseudokeys {
#define ON 1 #define ON 1
#define OFF 0 #define OFF 0
#define INCHES 0 enum UserUnitType {
#define MILLIMETRE 1 INCHES = 0,
#define CENTIMETRE 2 MILLIMETRES = 1,
UNSCALED_UNITS = 2
};
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
#define LEFTMARGIN 800 /* 20mm */ #define LEFTMARGIN 800 /* 20mm */
...@@ -184,7 +185,7 @@ extern wxString g_Prj_Default_Config_FullFilename; ...@@ -184,7 +185,7 @@ extern wxString g_Prj_Default_Config_FullFilename;
// Name of local configuration file. (<curr projet>.pro) // Name of local configuration file. (<curr projet>.pro)
extern wxString g_Prj_Config_LocalFilename; extern wxString g_Prj_Config_LocalFilename;
extern int g_UnitMetric; // display units mm = 1, inches = 0, cm = 2 extern UserUnitType g_UserUnit; ///< display units
/* Draw color for moving objects: */ /* Draw color for moving objects: */
extern int g_GhostColor; extern int g_GhostColor;
...@@ -324,10 +325,10 @@ wxString ReturnUnitSymbol( int aUnits = g_UnitMetric, ...@@ -324,10 +325,10 @@ wxString ReturnUnitSymbol( int aUnits = g_UnitMetric,
* @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( int aUnits ); wxString GetUnitsLabel( UserUnitType aUnit );
wxString GetAbbreviatedUnitsLabel( int aUnits = g_UnitMetric ); wxString GetAbbreviatedUnitsLabel( UserUnitType aUnit = g_UserUnit );
int ReturnValueFromString( int Units, const wxString& TextValue, int ReturnValueFromString( UserUnitType aUnit, const wxString& TextValue,
int Internal_Unit ); int Internal_Unit );
/** Function ReturnStringFromValue /** Function ReturnStringFromValue
...@@ -340,12 +341,12 @@ int ReturnValueFromString( int Units, const wxString& TextValue, ...@@ -340,12 +341,12 @@ int ReturnValueFromString( int Units, const wxString& TextValue,
* @return a wxString what contains value and optionally the symbol unit (like * @return a wxString what contains value and optionally the symbol unit (like
* 2.000 mm) * 2.000 mm)
*/ */
wxString ReturnStringFromValue( int aUnits, wxString ReturnStringFromValue( UserUnitType aUnit,
int aValue, int aValue,
int aInternal_Unit, int aInternal_Unit,
bool aAdd_unit_symbol = false ); bool aAdd_unit_symbol = false );
void AddUnitSymbol( wxStaticText& Stext, int Units = g_UnitMetric ); void AddUnitSymbol( wxStaticText& Stext, UserUnitType aUnit = g_UserUnit );
/* Add string " (mm):" or " ("):" to the static text Stext. /* Add string " (mm):" or " ("):" to the static text Stext.
* Used in dialog boxes for entering values depending on selected units */ * Used in dialog boxes for entering values depending on selected units */
...@@ -353,7 +354,7 @@ void PutValueInLocalUnits( wxTextCtrl& TextCtr, int Value, ...@@ -353,7 +354,7 @@ void PutValueInLocalUnits( wxTextCtrl& TextCtr, int Value,
int Internal_Unit ); int Internal_Unit );
/* Convert the number Value in a string according to the internal units /* Convert the number Value in a string according to the internal units
* and the selected unit (g_UnitMetric) and put it in the wxTextCtrl TextCtrl * and the selected unit (g_UserUnit) and put it in the wxTextCtrl TextCtrl
**/ **/
int ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr, int ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr,
int Internal_Unit ); int Internal_Unit );
...@@ -365,16 +366,15 @@ wxArrayString* wxStringSplit( wxString txt, wxChar splitter ); ...@@ -365,16 +366,15 @@ wxArrayString* wxStringSplit( wxString txt, wxChar splitter );
* Function To_User_Unit * Function To_User_Unit
* Convert in inch or mm the variable "val" (double)given in internal units * Convert in inch or mm the variable "val" (double)given in internal units
* @return the converted value, in double * @return the converted value, in double
* @param is_metric : true if the result must be returned in mm , false if * @param aUnit : user unit to be converted to
* inches
* @param val : double : the given value * @param val : double : the given value
* @param internal_unit_value = internal units per inch * @param internal_unit_value = internal units per inch
*/ */
double To_User_Unit( bool is_metric, double To_User_Unit( UserUnitType aUnit,
double val, double val,
int internal_unit_value ); int internal_unit_value );
int From_User_Unit( bool is_metric, int From_User_Unit( UserUnitType aUnit,
double val, double val,
int internal_unit_value ); int internal_unit_value );
wxString GenDate(); wxString GenDate();
......
...@@ -58,7 +58,7 @@ public: ...@@ -58,7 +58,7 @@ public:
int m_DisplayModText; // How to display module texts (line/ filled / sketch) int m_DisplayModText; // How to display module texts (line/ filled / sketch)
bool m_DisplayPcbTrackFill; /* FALSE : tracks are show in sketch mode, bool m_DisplayPcbTrackFill; /* FALSE : tracks are show in sketch mode,
* TRUE = filled */ * TRUE = filled */
int m_UserGridUnits; UserUnitType m_UserGridUnit;
wxRealPoint m_UserGridSize; wxRealPoint m_UserGridSize;
WinEDA3D_DrawFrame* m_Draw3DFrame; WinEDA3D_DrawFrame* m_Draw3DFrame;
......
...@@ -16,14 +16,13 @@ ...@@ -16,14 +16,13 @@
#include <wx/aui/aui.h> #include <wx/aui/aui.h>
#include "colors.h" #include "colors.h"
#include "common.h"
//C++ guarantees that operator delete checks its argument for null-ness //C++ guarantees that operator delete checks its argument for null-ness
#ifndef SAFE_DELETE #ifndef SAFE_DELETE
#define SAFE_DELETE( p ) delete (p); (p) = NULL; #define SAFE_DELETE( p ) delete (p); (p) = NULL;
#endif #endif
#define INTERNAL_UNIT_TYPE 0 // Internal unit = inch
#ifndef EESCHEMA_INTERNAL_UNIT #ifndef EESCHEMA_INTERNAL_UNIT
#define EESCHEMA_INTERNAL_UNIT 1000 #define EESCHEMA_INTERNAL_UNIT 1000
#endif #endif
...@@ -169,7 +168,6 @@ public: ...@@ -169,7 +168,6 @@ public:
// = 1000 for eeschema, = 10000 // = 1000 for eeschema, = 10000
// for PCBnew and Gerbview // for PCBnew and Gerbview
int m_UnitType; // Internal Unit type (0 = inch)
bool m_Draw_Axis; // TRUE to show X and Y axis bool m_Draw_Axis; // TRUE to show X and Y axis
bool m_Draw_Sheet_Ref; // TRUE to show frame references bool m_Draw_Sheet_Ref; // TRUE to show frame references
...@@ -566,7 +564,8 @@ public: ...@@ -566,7 +564,8 @@ public:
class WinEDA_GraphicTextCtrl class WinEDA_GraphicTextCtrl
{ {
public: public:
int m_Units, m_Internal_Unit; UserUnitType m_UserUnit;
int m_Internal_Unit;
wxTextCtrl* m_FrameText; wxTextCtrl* m_FrameText;
wxTextCtrl* m_FrameSize; wxTextCtrl* m_FrameSize;
...@@ -576,7 +575,7 @@ private: ...@@ -576,7 +575,7 @@ private:
public: public:
WinEDA_GraphicTextCtrl( wxWindow* parent, const wxString& Title, WinEDA_GraphicTextCtrl( wxWindow* parent, const wxString& Title,
const wxString& TextToEdit, int textsize, const wxString& TextToEdit, int textsize,
int units, wxBoxSizer* BoxSizer, int framelen = 200, UserUnitType user_unit, wxBoxSizer* BoxSizer, int framelen = 200,
int internal_unit = EESCHEMA_INTERNAL_UNIT ); int internal_unit = EESCHEMA_INTERNAL_UNIT );
~WinEDA_GraphicTextCtrl(); ~WinEDA_GraphicTextCtrl();
...@@ -594,10 +593,10 @@ public: ...@@ -594,10 +593,10 @@ public:
* Function FormatSize * Function FormatSize
* formats a string containing the size in the desired units. * formats a string containing the size in the desired units.
*/ */
static wxString FormatSize( int internalUnit, int units, int textSize ); static wxString FormatSize( int internalUnit, UserUnitType user_unit, int textSize );
static int ParseSize( const wxString& sizeText, int internalUnit, static int ParseSize( const wxString& sizeText, int internalUnit,
int units ); UserUnitType user_unit );
}; };
...@@ -608,7 +607,8 @@ public: ...@@ -608,7 +607,8 @@ public:
class WinEDA_PositionCtrl class WinEDA_PositionCtrl
{ {
public: public:
int m_Units, m_Internal_Unit; UserUnitType m_UserUnit;
int m_Internal_Unit;
wxPoint m_Pos_To_Edit; wxPoint m_Pos_To_Edit;
wxTextCtrl* m_FramePosX; wxTextCtrl* m_FramePosX;
...@@ -619,7 +619,7 @@ private: ...@@ -619,7 +619,7 @@ private:
public: public:
WinEDA_PositionCtrl( wxWindow* parent, const wxString& title, WinEDA_PositionCtrl( wxWindow* parent, const wxString& title,
const wxPoint& pos_to_edit, const wxPoint& pos_to_edit,
int units, wxBoxSizer* BoxSizer, UserUnitType user_unit, wxBoxSizer* BoxSizer,
int internal_unit = EESCHEMA_INTERNAL_UNIT ); int internal_unit = EESCHEMA_INTERNAL_UNIT );
~WinEDA_PositionCtrl(); ~WinEDA_PositionCtrl();
...@@ -639,7 +639,7 @@ class WinEDA_SizeCtrl : public WinEDA_PositionCtrl ...@@ -639,7 +639,7 @@ class WinEDA_SizeCtrl : public WinEDA_PositionCtrl
public: public:
WinEDA_SizeCtrl( wxWindow* parent, const wxString& title, WinEDA_SizeCtrl( wxWindow* parent, const wxString& title,
const wxSize& size_to_edit, const wxSize& size_to_edit,
int units, wxBoxSizer* BoxSizer, UserUnitType user_unit, wxBoxSizer* BoxSizer,
int internal_unit = EESCHEMA_INTERNAL_UNIT ); int internal_unit = EESCHEMA_INTERNAL_UNIT );
~WinEDA_SizeCtrl() { } ~WinEDA_SizeCtrl() { }
...@@ -653,7 +653,7 @@ public: ...@@ -653,7 +653,7 @@ public:
class WinEDA_ValueCtrl class WinEDA_ValueCtrl
{ {
public: public:
int m_Units; UserUnitType m_UserUnit;
int m_Value; int m_Value;
wxTextCtrl* m_ValueCtrl; wxTextCtrl* m_ValueCtrl;
private: private:
...@@ -662,7 +662,7 @@ private: ...@@ -662,7 +662,7 @@ private:
public: public:
WinEDA_ValueCtrl( wxWindow* parent, const wxString& title, int value, WinEDA_ValueCtrl( wxWindow* parent, const wxString& title, int value,
int units, wxBoxSizer* BoxSizer, UserUnitType user_unit, wxBoxSizer* BoxSizer,
int internal_unit = EESCHEMA_INTERNAL_UNIT ); int internal_unit = EESCHEMA_INTERNAL_UNIT );
~WinEDA_ValueCtrl(); ~WinEDA_ValueCtrl();
......
...@@ -66,7 +66,7 @@ WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father, ...@@ -66,7 +66,7 @@ WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father,
m_ModuleEditFrame = NULL; // Frame for footprint edition m_ModuleEditFrame = NULL; // Frame for footprint edition
m_UserGridSize = wxRealPoint( 100.0, 100.0 ); m_UserGridSize = wxRealPoint( 100.0, 100.0 );
m_UserGridUnits = INCHES; m_UserGridUnit = INCHES;
m_Collector = new GENERAL_COLLECTOR(); m_Collector = new GENERAL_COLLECTOR();
} }
...@@ -340,9 +340,23 @@ void WinEDA_BasePcbFrame::UpdateStatusBar() ...@@ -340,9 +340,23 @@ void WinEDA_BasePcbFrame::UpdateStatusBar()
theta = theta * 180.0 / M_PI; theta = theta * 180.0 / M_PI;
ro = sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) ); ro = sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) );
Line.Printf( g_UnitMetric ? wxT( "Ro %.3f Th %.1f" ) : wxString formatter;
wxT( "Ro %.4f Th %.1f" ), switch( g_UserUnit )
To_User_Unit( g_UnitMetric, ro, m_InternalUnits ), {
case INCHES:
formatter = wxT( "Ro %.4f Th %.1f" );
break;
case MILLIMETRES:
formatter = wxT( "Ro %.3f Th %.1f" );
break;
case UNSCALED_UNITS:
formatter = wxT( "Ro %f Th %f" );
break;
}
Line.Printf( formatter, To_User_Unit( g_UserUnit, ro, m_InternalUnits ),
theta ); theta );
// overwrite the absolute cartesian coordinates // overwrite the absolute cartesian coordinates
...@@ -378,7 +392,7 @@ void WinEDA_BasePcbFrame::LoadSettings() ...@@ -378,7 +392,7 @@ void WinEDA_BasePcbFrame::LoadSettings()
cfg->Read( m_FrameName + UserGridSizeXEntry, &m_UserGridSize.x, 0.01 ); cfg->Read( m_FrameName + UserGridSizeXEntry, &m_UserGridSize.x, 0.01 );
cfg->Read( m_FrameName + UserGridSizeYEntry, &m_UserGridSize.y, 0.01 ); cfg->Read( m_FrameName + UserGridSizeYEntry, &m_UserGridSize.y, 0.01 );
cfg->Read( m_FrameName + UserGridUnitsEntry, &m_UserGridUnits, cfg->Read( m_FrameName + UserGridUnitsEntry, (long*)&m_UserGridUnit,
( long )INCHES ); ( long )INCHES );
cfg->Read( m_FrameName + DisplayPadFillEntry, &m_DisplayPadFill, true ); cfg->Read( m_FrameName + DisplayPadFillEntry, &m_DisplayPadFill, true );
cfg->Read( m_FrameName + DisplayViaFillEntry, &m_DisplayViaFill, true ); cfg->Read( m_FrameName + DisplayViaFillEntry, &m_DisplayViaFill, true );
...@@ -409,7 +423,7 @@ void WinEDA_BasePcbFrame::SaveSettings() ...@@ -409,7 +423,7 @@ void WinEDA_BasePcbFrame::SaveSettings()
WinEDA_DrawFrame::SaveSettings(); WinEDA_DrawFrame::SaveSettings();
cfg->Write( m_FrameName + UserGridSizeXEntry, m_UserGridSize.x ); cfg->Write( m_FrameName + UserGridSizeXEntry, m_UserGridSize.x );
cfg->Write( m_FrameName + UserGridSizeYEntry, m_UserGridSize.y ); cfg->Write( m_FrameName + UserGridSizeYEntry, m_UserGridSize.y );
cfg->Write( m_FrameName + UserGridUnitsEntry, ( long )m_UserGridUnits ); cfg->Write( m_FrameName + UserGridUnitsEntry, ( long )m_UserGridUnit );
cfg->Write( m_FrameName + DisplayPadFillEntry, m_DisplayPadFill ); cfg->Write( m_FrameName + DisplayPadFillEntry, m_DisplayPadFill );
cfg->Write( m_FrameName + DisplayViaFillEntry, m_DisplayViaFill ); cfg->Write( m_FrameName + DisplayViaFillEntry, m_DisplayViaFill );
cfg->Write( m_FrameName + DisplayPadNumberEntry, m_DisplayPadNum ); cfg->Write( m_FrameName + DisplayPadNumberEntry, m_DisplayPadNum );
......
...@@ -95,9 +95,9 @@ void DIALOG_SVG_PRINT::initDialog( ) ...@@ -95,9 +95,9 @@ void DIALOG_SVG_PRINT::initDialog( )
} }
s_Parameters.m_PenDefaultSize = g_DrawDefaultLineThickness; s_Parameters.m_PenDefaultSize = g_DrawDefaultLineThickness;
AddUnitSymbol( *m_TextPenWidth, g_UnitMetric ); AddUnitSymbol( *m_TextPenWidth, g_UserUnit );
m_DialogPenWidth->SetValue( m_DialogPenWidth->SetValue(
ReturnStringFromValue( g_UnitMetric, s_Parameters.m_PenDefaultSize, ReturnStringFromValue( g_UserUnit, s_Parameters.m_PenDefaultSize,
m_Parent->m_InternalUnits ) ); m_Parent->m_InternalUnits ) );
m_Print_Frame_Ref_Ctrl->SetValue( s_Parameters.m_Print_Sheet_Ref ); m_Print_Frame_Ref_Ctrl->SetValue( s_Parameters.m_Print_Sheet_Ref );
...@@ -177,7 +177,7 @@ void DIALOG_SVG_PRINT::SetPenWidth() ...@@ -177,7 +177,7 @@ void DIALOG_SVG_PRINT::SetPenWidth()
g_DrawDefaultLineThickness = s_Parameters.m_PenDefaultSize; g_DrawDefaultLineThickness = s_Parameters.m_PenDefaultSize;
m_DialogPenWidth->SetValue( m_DialogPenWidth->SetValue(
ReturnStringFromValue( g_UnitMetric, s_Parameters.m_PenDefaultSize, ReturnStringFromValue( g_UserUnit, s_Parameters.m_PenDefaultSize,
m_Parent->m_InternalUnits ) ); m_Parent->m_InternalUnits ) );
} }
......
...@@ -62,14 +62,14 @@ void dialog_copper_zone::initDialog( ) ...@@ -62,14 +62,14 @@ void dialog_copper_zone::initDialog( )
m_FillModeCtrl->SetSelection( m_Zone_Setting->m_FillMode ? 1 : 0 ); m_FillModeCtrl->SetSelection( m_Zone_Setting->m_FillMode ? 1 : 0 );
AddUnitSymbol( *m_ClearanceValueTitle, g_UnitMetric ); AddUnitSymbol( *m_ClearanceValueTitle, g_UserUnit );
msg = ReturnStringFromValue( g_UnitMetric, msg = ReturnStringFromValue( g_UserUnit,
m_Zone_Setting->m_ZoneClearance, m_Zone_Setting->m_ZoneClearance,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
m_ZoneClearanceCtrl->SetValue( msg ); m_ZoneClearanceCtrl->SetValue( msg );
AddUnitSymbol( *m_MinThicknessValueTitle, g_UnitMetric ); AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit );
msg = ReturnStringFromValue( g_UnitMetric, msg = ReturnStringFromValue( g_UserUnit,
m_Zone_Setting->m_ZoneMinThickness, m_Zone_Setting->m_ZoneMinThickness,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
m_ZoneMinThicknessCtrl->SetValue( msg ); m_ZoneMinThicknessCtrl->SetValue( msg );
...@@ -101,8 +101,8 @@ void dialog_copper_zone::initDialog( ) ...@@ -101,8 +101,8 @@ void dialog_copper_zone::initDialog( )
m_CopperWidthValue->Enable( true ); m_CopperWidthValue->Enable( true );
} }
AddUnitSymbol( *m_AntipadSizeText, g_UnitMetric ); AddUnitSymbol( *m_AntipadSizeText, g_UserUnit );
AddUnitSymbol( *m_CopperBridgeWidthText, g_UnitMetric ); AddUnitSymbol( *m_CopperBridgeWidthText, g_UserUnit );
PutValueInLocalUnits( *m_AntipadSizeValue, PutValueInLocalUnits( *m_AntipadSizeValue,
m_Zone_Setting->m_ThermalReliefGapValue, m_Zone_Setting->m_ThermalReliefGapValue,
PCB_INTERNAL_UNIT ); PCB_INTERNAL_UNIT );
...@@ -266,7 +266,7 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab ...@@ -266,7 +266,7 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab
wxString txtvalue = m_ZoneClearanceCtrl->GetValue(); wxString txtvalue = m_ZoneClearanceCtrl->GetValue();
m_Zone_Setting->m_ZoneClearance = m_Zone_Setting->m_ZoneClearance =
ReturnValueFromString( g_UnitMetric, txtvalue, m_Parent->m_InternalUnits ); ReturnValueFromString( g_UserUnit, txtvalue, m_Parent->m_InternalUnits );
// Test if this is a reasonnable value for this parameter // Test if this is a reasonnable value for this parameter
// A too large value can hang pcbnew // A too large value can hang pcbnew
...@@ -279,7 +279,7 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab ...@@ -279,7 +279,7 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab
txtvalue = m_ZoneMinThicknessCtrl->GetValue(); txtvalue = m_ZoneMinThicknessCtrl->GetValue();
m_Zone_Setting->m_ZoneMinThickness = m_Zone_Setting->m_ZoneMinThickness =
ReturnValueFromString( g_UnitMetric, txtvalue, m_Parent->m_InternalUnits ); ReturnValueFromString( g_UserUnit, txtvalue, m_Parent->m_InternalUnits );
if( m_Zone_Setting->m_ZoneMinThickness < 10 ) if( m_Zone_Setting->m_ZoneMinThickness < 10 )
{ {
DisplayError( this, DisplayError( this,
......
...@@ -156,15 +156,15 @@ void DIALOG_DESIGN_RULES::PrintCurrentSettings( ) ...@@ -156,15 +156,15 @@ void DIALOG_DESIGN_RULES::PrintCurrentSettings( )
m_MessagesList->AppendToPage(_("<b>Current general settings:</b><br>") ); m_MessagesList->AppendToPage(_("<b>Current general settings:</b><br>") );
// Display min values: // Display min values:
value = ReturnStringFromValue( g_UnitMetric, m_BrdSettings->m_TrackMinWidth, internal_units, true ); value = ReturnStringFromValue( g_UserUnit, m_BrdSettings->m_TrackMinWidth, internal_units, true );
msg.Printf(_("Minimum value for tracks width: <b>%s</b><br>\n"), GetChars( value ) ); msg.Printf(_("Minimum value for tracks width: <b>%s</b><br>\n"), GetChars( value ) );
m_MessagesList->AppendToPage(msg); m_MessagesList->AppendToPage(msg);
value = ReturnStringFromValue( g_UnitMetric, m_BrdSettings->m_ViasMinSize, internal_units, true ); value = ReturnStringFromValue( g_UserUnit, m_BrdSettings->m_ViasMinSize, internal_units, true );
msg.Printf(_("Minimum value for vias diameter: <b>%s</b><br>\n"), GetChars( value ) ); msg.Printf(_("Minimum value for vias diameter: <b>%s</b><br>\n"), GetChars( value ) );
m_MessagesList->AppendToPage(msg); m_MessagesList->AppendToPage(msg);
value = ReturnStringFromValue( g_UnitMetric, m_BrdSettings->m_MicroViasMinSize, internal_units, true ); value = ReturnStringFromValue( g_UserUnit, m_BrdSettings->m_MicroViasMinSize, internal_units, true );
msg.Printf(_("Minimum value for microvias diameter: <b>%s</b><br>\n"), GetChars( value ) ); msg.Printf(_("Minimum value for microvias diameter: <b>%s</b><br>\n"), GetChars( value ) );
m_MessagesList->AppendToPage(msg); m_MessagesList->AppendToPage(msg);
...@@ -264,18 +264,18 @@ void DIALOG_DESIGN_RULES::InitDimensionsLists() ...@@ -264,18 +264,18 @@ void DIALOG_DESIGN_RULES::InitDimensionsLists()
for( unsigned ii = 0; ii < m_TracksWidthList.size(); ii++ ) for( unsigned ii = 0; ii < m_TracksWidthList.size(); ii++ )
{ {
msg = ReturnStringFromValue( g_UnitMetric, m_TracksWidthList[ii], Internal_Unit, false ); msg = ReturnStringFromValue( g_UserUnit, m_TracksWidthList[ii], Internal_Unit, false );
m_gridTrackWidthList->SetCellValue( ii, 0, msg ); m_gridTrackWidthList->SetCellValue( ii, 0, msg );
} }
for( unsigned ii = 0; ii < m_ViasDimensionsList.size(); ii++ ) for( unsigned ii = 0; ii < m_ViasDimensionsList.size(); ii++ )
{ {
msg = ReturnStringFromValue( g_UnitMetric, m_ViasDimensionsList[ii].m_Diameter, msg = ReturnStringFromValue( g_UserUnit, m_ViasDimensionsList[ii].m_Diameter,
Internal_Unit, false ); Internal_Unit, false );
m_gridViaSizeList->SetCellValue( ii, 0, msg ); m_gridViaSizeList->SetCellValue( ii, 0, msg );
if( m_ViasDimensionsList[ii].m_Drill > 0 ) if( m_ViasDimensionsList[ii].m_Drill > 0 )
{ {
msg = ReturnStringFromValue( g_UnitMetric, m_ViasDimensionsList[ii].m_Drill, msg = ReturnStringFromValue( g_UserUnit, m_ViasDimensionsList[ii].m_Drill,
Internal_Unit, false ); Internal_Unit, false );
m_gridViaSizeList->SetCellValue( ii, 1, msg ); m_gridViaSizeList->SetCellValue( ii, 1, msg );
} }
...@@ -425,22 +425,22 @@ static void class2gridRow( wxGrid* grid, int row, NETCLASS* nc, int units ) ...@@ -425,22 +425,22 @@ static void class2gridRow( wxGrid* grid, int row, NETCLASS* nc, int units )
// label is netclass name // label is netclass name
grid->SetRowLabelValue( row, nc->GetName() ); grid->SetRowLabelValue( row, nc->GetName() );
msg = ReturnStringFromValue( g_UnitMetric, nc->GetClearance(), units ); msg = ReturnStringFromValue( g_UserUnit, nc->GetClearance(), units );
grid->SetCellValue( row, GRID_CLEARANCE, msg ); grid->SetCellValue( row, GRID_CLEARANCE, msg );
msg = ReturnStringFromValue( g_UnitMetric, nc->GetTrackWidth(), units ); msg = ReturnStringFromValue( g_UserUnit, nc->GetTrackWidth(), units );
grid->SetCellValue( row, GRID_TRACKSIZE, msg ); grid->SetCellValue( row, GRID_TRACKSIZE, msg );
msg = ReturnStringFromValue( g_UnitMetric, nc->GetViaDiameter(), units ); msg = ReturnStringFromValue( g_UserUnit, nc->GetViaDiameter(), units );
grid->SetCellValue( row, GRID_VIASIZE, msg ); grid->SetCellValue( row, GRID_VIASIZE, msg );
msg = ReturnStringFromValue( g_UnitMetric, nc->GetViaDrill(), units ); msg = ReturnStringFromValue( g_UserUnit, nc->GetViaDrill(), units );
grid->SetCellValue( row, GRID_VIADRILL, msg ); grid->SetCellValue( row, GRID_VIADRILL, msg );
msg = ReturnStringFromValue( g_UnitMetric, nc->GetuViaDiameter(), units ); msg = ReturnStringFromValue( g_UserUnit, nc->GetuViaDiameter(), units );
grid->SetCellValue( row, GRID_uVIASIZE, msg ); grid->SetCellValue( row, GRID_uVIASIZE, msg );
msg = ReturnStringFromValue( g_UnitMetric, nc->GetuViaDrill(), units ); msg = ReturnStringFromValue( g_UserUnit, nc->GetuViaDrill(), units );
grid->SetCellValue( row, GRID_uVIADRILL, msg ); grid->SetCellValue( row, GRID_uVIADRILL, msg );
} }
...@@ -474,7 +474,7 @@ void DIALOG_DESIGN_RULES::InitRulesList() ...@@ -474,7 +474,7 @@ void DIALOG_DESIGN_RULES::InitRulesList()
static void gridRow2class( wxGrid* grid, int row, NETCLASS* nc, int units ) static void gridRow2class( wxGrid* grid, int row, NETCLASS* nc, int units )
{ {
#define MYCELL(col) \ #define MYCELL(col) \
ReturnValueFromString( g_UnitMetric, grid->GetCellValue( row, col ), units ) ReturnValueFromString( g_UserUnit, grid->GetCellValue( row, col ), units )
nc->SetClearance( MYCELL( GRID_CLEARANCE ) ); nc->SetClearance( MYCELL( GRID_CLEARANCE ) );
nc->SetTrackWidth( MYCELL( GRID_TRACKSIZE ) ); nc->SetTrackWidth( MYCELL( GRID_TRACKSIZE ) );
...@@ -568,7 +568,7 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard( ) ...@@ -568,7 +568,7 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard( )
msg = m_gridTrackWidthList->GetCellValue( row, 0 ); msg = m_gridTrackWidthList->GetCellValue( row, 0 );
if( msg.IsEmpty() ) if( msg.IsEmpty() )
continue; continue;
int value = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits ); int value = ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits );
m_TracksWidthList.push_back( value); m_TracksWidthList.push_back( value);
} }
// Sort new list by by increasing value // Sort new list by by increasing value
...@@ -581,13 +581,13 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard( ) ...@@ -581,13 +581,13 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard( )
msg = m_gridViaSizeList->GetCellValue( row, 0 ); msg = m_gridViaSizeList->GetCellValue( row, 0 );
if( msg.IsEmpty() ) if( msg.IsEmpty() )
continue; continue;
int value = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits ); int value = ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits );
VIA_DIMENSION via_dim; VIA_DIMENSION via_dim;
via_dim.m_Diameter = value; via_dim.m_Diameter = value;
msg = m_gridViaSizeList->GetCellValue( row, 1 ); msg = m_gridViaSizeList->GetCellValue( row, 1 );
if( ! msg.IsEmpty() ) if( ! msg.IsEmpty() )
{ {
value = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits ); value = ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits );
via_dim.m_Drill = value; via_dim.m_Drill = value;
} }
m_ViasDimensionsList.push_back( via_dim); m_ViasDimensionsList.push_back( via_dim);
...@@ -913,7 +913,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity() ...@@ -913,7 +913,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
for( int row = 0; row < m_grid->GetNumberRows(); row++ ) for( int row = 0; row < m_grid->GetNumberRows(); row++ )
{ {
int tracksize = ReturnValueFromString( g_UnitMetric, int tracksize = ReturnValueFromString( g_UserUnit,
m_grid->GetCellValue( row, GRID_TRACKSIZE ), m_grid->GetCellValue( row, GRID_TRACKSIZE ),
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
if( tracksize < minTrackWidth ) if( tracksize < minTrackWidth )
...@@ -926,7 +926,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity() ...@@ -926,7 +926,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
} }
// Test vias // Test vias
int viadia = ReturnValueFromString( g_UnitMetric, int viadia = ReturnValueFromString( g_UserUnit,
m_grid->GetCellValue( row, GRID_VIASIZE ), m_grid->GetCellValue( row, GRID_VIASIZE ),
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
...@@ -939,7 +939,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity() ...@@ -939,7 +939,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
m_MessagesList->AppendToPage( msg ); m_MessagesList->AppendToPage( msg );
} }
int viadrill = ReturnValueFromString( g_UnitMetric, int viadrill = ReturnValueFromString( g_UserUnit,
m_grid->GetCellValue( row, GRID_VIADRILL ), m_grid->GetCellValue( row, GRID_VIADRILL ),
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
if( viadrill >= viadia ) if( viadrill >= viadia )
...@@ -961,7 +961,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity() ...@@ -961,7 +961,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
} }
// Test Micro vias // Test Micro vias
int muviadia = ReturnValueFromString( g_UnitMetric, int muviadia = ReturnValueFromString( g_UserUnit,
m_grid->GetCellValue( row, GRID_uVIASIZE ), m_grid->GetCellValue( row, GRID_uVIASIZE ),
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
...@@ -974,7 +974,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity() ...@@ -974,7 +974,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
m_MessagesList->AppendToPage( msg ); m_MessagesList->AppendToPage( msg );
} }
int muviadrill = ReturnValueFromString( g_UnitMetric, int muviadrill = ReturnValueFromString( g_UserUnit,
m_grid->GetCellValue( row, GRID_uVIADRILL ), m_grid->GetCellValue( row, GRID_uVIADRILL ),
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
if( muviadrill >= muviadia ) if( muviadrill >= muviadia )
...@@ -1003,7 +1003,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity() ...@@ -1003,7 +1003,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
if( tvalue.IsEmpty() ) if( tvalue.IsEmpty() )
continue; continue;
int tracksize = ReturnValueFromString( g_UnitMetric, int tracksize = ReturnValueFromString( g_UserUnit,
tvalue, tvalue,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
if( tracksize < minTrackWidth ) if( tracksize < minTrackWidth )
...@@ -1030,7 +1030,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity() ...@@ -1030,7 +1030,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
if( tvalue.IsEmpty() ) if( tvalue.IsEmpty() )
continue; continue;
int viadia = ReturnValueFromString( g_UnitMetric, int viadia = ReturnValueFromString( g_UserUnit,
tvalue, tvalue,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
if( viadia < minViaDia ) if( viadia < minViaDia )
......
...@@ -57,11 +57,11 @@ void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties() ...@@ -57,11 +57,11 @@ void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties()
{ {
PutValueInLocalUnits( *m_ModPositionX, PutValueInLocalUnits( *m_ModPositionX,
m_CurrentModule->GetPosition().x, PCB_INTERNAL_UNIT ); m_CurrentModule->GetPosition().x, PCB_INTERNAL_UNIT );
AddUnitSymbol( *XPositionStatic, g_UnitMetric ); AddUnitSymbol( *XPositionStatic, g_UserUnit );
PutValueInLocalUnits( *m_ModPositionY, PutValueInLocalUnits( *m_ModPositionY,
m_CurrentModule->GetPosition().y, PCB_INTERNAL_UNIT ); m_CurrentModule->GetPosition().y, PCB_INTERNAL_UNIT );
AddUnitSymbol( *YPositionStatic, g_UnitMetric ); AddUnitSymbol( *YPositionStatic, g_UserUnit );
m_LayerCtrl->SetSelection( m_LayerCtrl->SetSelection(
(m_CurrentModule->GetLayer() == LAYER_N_BACK) ? 1 : 0 ); (m_CurrentModule->GetLayer() == LAYER_N_BACK) ? 1 : 0 );
...@@ -100,9 +100,9 @@ void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties() ...@@ -100,9 +100,9 @@ void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties()
m_OrientValue->Enable( select ); m_OrientValue->Enable( select );
// Initialize dialog relative to masks clearances // Initialize dialog relative to masks clearances
m_NetClearanceUnits->SetLabel( GetUnitsLabel( g_UnitMetric ) ); m_NetClearanceUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_SolderMaskMarginUnits->SetLabel( GetUnitsLabel( g_UnitMetric ) ); m_SolderMaskMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_SolderPasteMarginUnits->SetLabel( GetUnitsLabel( g_UnitMetric ) ); m_SolderPasteMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
int internalUnit = m_Parent->m_InternalUnits; int internalUnit = m_Parent->m_InternalUnits;
PutValueInLocalUnits( *m_NetClearanceValueCtrl, PutValueInLocalUnits( *m_NetClearanceValueCtrl,
...@@ -263,17 +263,17 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties() ...@@ -263,17 +263,17 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties()
wxBoxSizer* BoxSizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* BoxSizer = new wxBoxSizer( wxVERTICAL );
m_3D_Scale = new WinEDA_VertexCtrl( m_Panel3D, _( "Shape Scale:" ), m_3D_Scale = new WinEDA_VertexCtrl( m_Panel3D, _( "Shape Scale:" ),
BoxSizer, 2, 1 ); BoxSizer, UNSCALED_UNITS, 1 );
m_Sizer3DValues->Add( BoxSizer, 0, wxGROW | wxALL, 5 ); m_Sizer3DValues->Add( BoxSizer, 0, wxGROW | wxALL, 5 );
BoxSizer = new wxBoxSizer( wxVERTICAL ); BoxSizer = new wxBoxSizer( wxVERTICAL );
m_3D_Offset = new WinEDA_VertexCtrl( m_Panel3D, _( "Shape Offset:" ), m_3D_Offset = new WinEDA_VertexCtrl( m_Panel3D, _( "Shape Offset:" ),
BoxSizer, 2, 1 ); BoxSizer, UNSCALED_UNITS, 1 );
m_Sizer3DValues->Add( BoxSizer, 0, wxGROW | wxALL, 5 ); m_Sizer3DValues->Add( BoxSizer, 0, wxGROW | wxALL, 5 );
BoxSizer = new wxBoxSizer( wxVERTICAL ); BoxSizer = new wxBoxSizer( wxVERTICAL );
m_3D_Rotation = new WinEDA_VertexCtrl( m_Panel3D, _( "Shape Rotation:" ), m_3D_Rotation = new WinEDA_VertexCtrl( m_Panel3D, _( "Shape Rotation:" ),
BoxSizer, 2, 1 ); BoxSizer, UNSCALED_UNITS, 1 );
m_Sizer3DValues->Add( BoxSizer, 0, wxGROW | wxALL, 5 ); m_Sizer3DValues->Add( BoxSizer, 0, wxGROW | wxALL, 5 );
} }
......
...@@ -123,21 +123,21 @@ void DIALOG_MODULE_MODULE_EDITOR::InitModeditProperties() ...@@ -123,21 +123,21 @@ void DIALOG_MODULE_MODULE_EDITOR::InitModeditProperties()
// Initialize 3D parameters // Initialize 3D parameters
wxBoxSizer* BoxSizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* BoxSizer = new wxBoxSizer( wxVERTICAL );
m_3D_Scale = new WinEDA_VertexCtrl( m_Panel3D, _( "Shape Scale:" ), BoxSizer, 2, 1 ); m_3D_Scale = new WinEDA_VertexCtrl( m_Panel3D, _( "Shape Scale:" ), BoxSizer, UNSCALED_UNITS, 1 );
m_Sizer3DValues->Add( BoxSizer, 0, wxGROW | wxALL, 5 ); m_Sizer3DValues->Add( BoxSizer, 0, wxGROW | wxALL, 5 );
BoxSizer = new wxBoxSizer( wxVERTICAL ); BoxSizer = new wxBoxSizer( wxVERTICAL );
m_3D_Offset = new WinEDA_VertexCtrl( m_Panel3D, _( "Shape Offset:" ), BoxSizer, 2, 1 ); m_3D_Offset = new WinEDA_VertexCtrl( m_Panel3D, _( "Shape Offset:" ), BoxSizer, UNSCALED_UNITS, 1 );
m_Sizer3DValues->Add( BoxSizer, 0, wxGROW | wxALL, 5 ); m_Sizer3DValues->Add( BoxSizer, 0, wxGROW | wxALL, 5 );
BoxSizer = new wxBoxSizer( wxVERTICAL ); BoxSizer = new wxBoxSizer( wxVERTICAL );
m_3D_Rotation = new WinEDA_VertexCtrl( m_Panel3D, _( "Shape Rotation:" ), BoxSizer, 2, 1 ); m_3D_Rotation = new WinEDA_VertexCtrl( m_Panel3D, _( "Shape Rotation:" ), BoxSizer, UNSCALED_UNITS, 1 );
m_Sizer3DValues->Add( BoxSizer, 0, wxGROW | wxALL, 5 ); m_Sizer3DValues->Add( BoxSizer, 0, wxGROW | wxALL, 5 );
// Initialize dialog relative to masks clearances // Initialize dialog relative to masks clearances
m_NetClearanceUnits->SetLabel( GetUnitsLabel( g_UnitMetric ) ); m_NetClearanceUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_SolderMaskMarginUnits->SetLabel( GetUnitsLabel( g_UnitMetric ) ); m_SolderMaskMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_SolderPasteMarginUnits->SetLabel( GetUnitsLabel( g_UnitMetric ) ); m_SolderPasteMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
wxString msg; wxString msg;
int internalUnit = m_Parent->m_InternalUnits; int internalUnit = m_Parent->m_InternalUnits;
......
...@@ -156,17 +156,17 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event ) ...@@ -156,17 +156,17 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event )
msg = m_TxtPosCtrlX->GetValue(); msg = m_TxtPosCtrlX->GetValue();
m_CurrentTextMod->m_Pos0.x = ReturnValueFromString( g_UnitMetric, msg, m_CurrentTextMod->m_Pos0.x = ReturnValueFromString( g_UserUnit, msg,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
msg = m_TxtPosCtrlY->GetValue(); msg = m_TxtPosCtrlY->GetValue();
m_CurrentTextMod->m_Pos0.y = ReturnValueFromString( g_UnitMetric, msg, m_CurrentTextMod->m_Pos0.y = ReturnValueFromString( g_UserUnit, msg,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
msg = m_TxtSizeCtrlX->GetValue(); msg = m_TxtSizeCtrlX->GetValue();
m_CurrentTextMod->m_Size.x = ReturnValueFromString( g_UnitMetric, msg, m_CurrentTextMod->m_Size.x = ReturnValueFromString( g_UserUnit, msg,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
msg = m_TxtSizeCtrlY->GetValue(); msg = m_TxtSizeCtrlY->GetValue();
m_CurrentTextMod->m_Size.y = ReturnValueFromString( g_UnitMetric, msg, m_CurrentTextMod->m_Size.y = ReturnValueFromString( g_UserUnit, msg,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
// Test for a reasonnable size: // Test for a reasonnable size:
...@@ -176,7 +176,7 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event ) ...@@ -176,7 +176,7 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event )
m_CurrentTextMod->m_Size.y = TEXTS_MIN_SIZE; m_CurrentTextMod->m_Size.y = TEXTS_MIN_SIZE;
msg = m_TxtWidthCtlr->GetValue(); msg = m_TxtWidthCtlr->GetValue();
int width = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits ); int width = ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits );
// Test for a reasonnable width: // Test for a reasonnable width:
if( width <= 1 ) if( width <= 1 )
......
...@@ -38,7 +38,7 @@ void Dialog_GeneralOptions::init() ...@@ -38,7 +38,7 @@ void Dialog_GeneralOptions::init()
/* Set display options */ /* Set display options */
m_PolarDisplay->SetSelection( DisplayOpt.DisplayPolarCood ? 1 : 0 ); m_PolarDisplay->SetSelection( DisplayOpt.DisplayPolarCood ? 1 : 0 );
m_UnitsSelection->SetSelection( g_UnitMetric ? 1 : 0 ); m_UnitsSelection->SetSelection( g_UserUnit ? 1 : 0 );
m_CursorShape->SetSelection( m_Parent->m_CursorShape ? 1 : 0 ); m_CursorShape->SetSelection( m_Parent->m_CursorShape ? 1 : 0 );
wxString timevalue; wxString timevalue;
...@@ -69,13 +69,13 @@ void Dialog_GeneralOptions::OnCancelClick( wxCommandEvent& event ) ...@@ -69,13 +69,13 @@ void Dialog_GeneralOptions::OnCancelClick( wxCommandEvent& event )
void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event ) void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event )
{ {
int ii; UserUnitType ii;
DisplayOpt.DisplayPolarCood = DisplayOpt.DisplayPolarCood =
( m_PolarDisplay->GetSelection() == 0 ) ? FALSE : true; ( m_PolarDisplay->GetSelection() == 0 ) ? FALSE : true;
ii = g_UnitMetric; ii = g_UserUnit;
g_UnitMetric = ( m_UnitsSelection->GetSelection() == 0 ) ? 0 : 1; g_UserUnit = ( m_UnitsSelection->GetSelection() == 0 ) ? INCHES : MILLIMETRES;
if( ii != g_UnitMetric ) if( ii != g_UserUnit )
m_Parent->ReCreateAuxiliaryToolbar(); m_Parent->ReCreateAuxiliaryToolbar();
m_Parent->m_CursorShape = m_CursorShape->GetSelection(); m_Parent->m_CursorShape = m_CursorShape->GetSelection();
...@@ -132,11 +132,11 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -132,11 +132,11 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break; break;
case ID_TB_OPTIONS_SELECT_UNIT_MM: case ID_TB_OPTIONS_SELECT_UNIT_MM:
g_UnitMetric = MILLIMETRE; g_UserUnit = MILLIMETRES;
case ID_TB_OPTIONS_SELECT_UNIT_INCH: case ID_TB_OPTIONS_SELECT_UNIT_INCH:
if( id == ID_TB_OPTIONS_SELECT_UNIT_INCH ) if( id == ID_TB_OPTIONS_SELECT_UNIT_INCH )
g_UnitMetric = INCHES; g_UserUnit = INCHES;
m_TrackAndViasSizesList_Changed = true; m_TrackAndViasSizesList_Changed = true;
UpdateStatusBar(); UpdateStatusBar();
ReCreateAuxiliaryToolbar(); ReCreateAuxiliaryToolbar();
......
...@@ -72,56 +72,56 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit() ...@@ -72,56 +72,56 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit()
// Display current values, and current netclass values: // Display current values, and current netclass values:
int value = netclass->GetTrackWidth(); // Display track width int value = netclass->GetTrackWidth(); // Display track width
msg = ReturnStringFromValue( g_UnitMetric, value, Internal_Unit, true ); msg = ReturnStringFromValue( g_UserUnit, value, Internal_Unit, true );
m_gridDisplayCurrentSettings->SetCellValue( 0, 0, msg ); m_gridDisplayCurrentSettings->SetCellValue( 0, 0, msg );
if( board->m_TrackWidthSelector ) if( board->m_TrackWidthSelector )
{ {
value = board->GetCurrentTrackWidth(); value = board->GetCurrentTrackWidth();
msg = ReturnStringFromValue( g_UnitMetric, value, Internal_Unit, true ); msg = ReturnStringFromValue( g_UserUnit, value, Internal_Unit, true );
} }
else else
msg = _( "Default" ); msg = _( "Default" );
m_gridDisplayCurrentSettings->SetCellValue( 1, 0, msg ); m_gridDisplayCurrentSettings->SetCellValue( 1, 0, msg );
value = netclass->GetViaDiameter(); // Display via diameter value = netclass->GetViaDiameter(); // Display via diameter
msg = ReturnStringFromValue( g_UnitMetric, value, Internal_Unit, true ); msg = ReturnStringFromValue( g_UserUnit, value, Internal_Unit, true );
m_gridDisplayCurrentSettings->SetCellValue( 0, 1, msg ); m_gridDisplayCurrentSettings->SetCellValue( 0, 1, msg );
if( board->m_ViaSizeSelector ) if( board->m_ViaSizeSelector )
{ {
value = board->GetCurrentViaSize(); value = board->GetCurrentViaSize();
msg = ReturnStringFromValue( g_UnitMetric, value, Internal_Unit, true ); msg = ReturnStringFromValue( g_UserUnit, value, Internal_Unit, true );
} }
else else
msg = _( "Default" ); msg = _( "Default" );
m_gridDisplayCurrentSettings->SetCellValue( 1, 1, msg ); m_gridDisplayCurrentSettings->SetCellValue( 1, 1, msg );
value = netclass->GetViaDrill(); // Display via drill value = netclass->GetViaDrill(); // Display via drill
msg = ReturnStringFromValue( g_UnitMetric, value, Internal_Unit, true ); msg = ReturnStringFromValue( g_UserUnit, value, Internal_Unit, true );
m_gridDisplayCurrentSettings->SetCellValue( 0, 2, msg ); m_gridDisplayCurrentSettings->SetCellValue( 0, 2, msg );
value = board->GetCurrentViaDrill(); value = board->GetCurrentViaDrill();
if( value >= 0 ) if( value >= 0 )
msg = ReturnStringFromValue( g_UnitMetric, value, Internal_Unit, true ); msg = ReturnStringFromValue( g_UserUnit, value, Internal_Unit, true );
else else
msg = _( "Default" ); msg = _( "Default" );
m_gridDisplayCurrentSettings->SetCellValue( 1, 2, msg ); m_gridDisplayCurrentSettings->SetCellValue( 1, 2, msg );
value = netclass->GetuViaDiameter(); // Display micro via diameter value = netclass->GetuViaDiameter(); // Display micro via diameter
msg = ReturnStringFromValue( g_UnitMetric, value, Internal_Unit, true ); msg = ReturnStringFromValue( g_UserUnit, value, Internal_Unit, true );
m_gridDisplayCurrentSettings->SetCellValue( 0, 3, msg ); m_gridDisplayCurrentSettings->SetCellValue( 0, 3, msg );
#if 0 // Currently we use always the default netclass value #if 0 // Currently we use always the default netclass value
value = board->GetCurrentMicroViaSize(); value = board->GetCurrentMicroViaSize();
msg = ReturnStringFromValue( g_UnitMetric, value, Internal_Unit, true ); msg = ReturnStringFromValue( g_UserUnit, value, Internal_Unit, true );
#endif #endif
msg = _( "Default" ); msg = _( "Default" );
m_gridDisplayCurrentSettings->SetCellValue( 1, 3, msg ); m_gridDisplayCurrentSettings->SetCellValue( 1, 3, msg );
value = netclass->GetuViaDrill(); // Display micro via drill value = netclass->GetuViaDrill(); // Display micro via drill
msg = ReturnStringFromValue( g_UnitMetric, value, Internal_Unit, true ); msg = ReturnStringFromValue( g_UserUnit, value, Internal_Unit, true );
m_gridDisplayCurrentSettings->SetCellValue( 0, 4, msg ); m_gridDisplayCurrentSettings->SetCellValue( 0, 4, msg );
#if 0 // Currently we use always the default netclass value #if 0 // Currently we use always the default netclass value
value = board->GetCurrentMicroViaDrill(); value = board->GetCurrentMicroViaDrill();
if( value >= 0 ) if( value >= 0 )
msg = ReturnStringFromValue( g_UnitMetric, value, Internal_Unit, true ); msg = ReturnStringFromValue( g_UserUnit, value, Internal_Unit, true );
else else
#endif #endif
msg = _( "Default" ); msg = _( "Default" );
......
...@@ -181,27 +181,27 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event ) ...@@ -181,27 +181,27 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event )
m_Item->Draw( m_Parent->DrawPanel, m_DC, GR_XOR ); m_Item->Draw( m_Parent->DrawPanel, m_DC, GR_XOR );
msg = m_Center_StartXCtrl->GetValue(); msg = m_Center_StartXCtrl->GetValue();
m_Item->m_Start.x = ReturnValueFromString( g_UnitMetric, msg, m_Item->m_Start.x = ReturnValueFromString( g_UserUnit, msg,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
msg = m_Center_StartYCtrl->GetValue(); msg = m_Center_StartYCtrl->GetValue();
m_Item->m_Start.y = ReturnValueFromString( g_UnitMetric, msg, m_Item->m_Start.y = ReturnValueFromString( g_UserUnit, msg,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
msg = m_EndX_Radius_Ctrl->GetValue(); msg = m_EndX_Radius_Ctrl->GetValue();
m_Item->m_End.x = ReturnValueFromString( g_UnitMetric, msg, m_Item->m_End.x = ReturnValueFromString( g_UserUnit, msg,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
msg = m_EndY_Ctrl->GetValue(); msg = m_EndY_Ctrl->GetValue();
m_Item->m_End.y = ReturnValueFromString( g_UnitMetric, msg, m_Item->m_End.y = ReturnValueFromString( g_UserUnit, msg,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
msg = m_ThicknessCtrl->GetValue(); msg = m_ThicknessCtrl->GetValue();
m_Item->m_Width = ReturnValueFromString( g_UnitMetric, msg, m_Item->m_Width = ReturnValueFromString( g_UserUnit, msg,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
msg = m_DefaultThicknessCtrl->GetValue(); msg = m_DefaultThicknessCtrl->GetValue();
int thickness = ReturnValueFromString( g_UnitMetric, msg, int thickness = ReturnValueFromString( g_UserUnit, msg,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
m_Item->SetLayer( m_LayerSelection->GetCurrentSelection() + FIRST_NO_COPPER_LAYER); m_Item->SetLayer( m_LayerSelection->GetCurrentSelection() + FIRST_NO_COPPER_LAYER);
......
...@@ -95,7 +95,7 @@ DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE::DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE( wxWindow* ...@@ -95,7 +95,7 @@ DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE::DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE( wxWindow*
wxStaticBoxSizer* sbSizerRight; wxStaticBoxSizer* sbSizerRight;
sbSizerRight = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("General:") ), wxVERTICAL ); sbSizerRight = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("General:") ), wxVERTICAL );
m_DefaultPenSizeTitle = new wxStaticText( this, wxID_ANY, _("Default pen size:"), wxDefaultPosition, wxDefaultSize, 0 ); m_DefaultPenSizeTitle = new wxStaticText( this, wxID_ANY, _("Default pen size"), wxDefaultPosition, wxDefaultSize, 0 );
m_DefaultPenSizeTitle->Wrap( -1 ); m_DefaultPenSizeTitle->Wrap( -1 );
m_DefaultPenSizeTitle->SetToolTip( _("Pen size used to draw items that have no pen size specified.\nUsed mainly to draw items in sketch mode.") ); m_DefaultPenSizeTitle->SetToolTip( _("Pen size used to draw items that have no pen size specified.\nUsed mainly to draw items in sketch mode.") );
......
...@@ -1090,7 +1090,7 @@ ...@@ -1090,7 +1090,7 @@
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Default pen size:</property> <property name="label">Default pen size</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_DefaultPenSizeTitle</property> <property name="name">m_DefaultPenSizeTitle</property>
......
...@@ -38,8 +38,8 @@ void DIALOG_PADS_MASK_CLEARANCE::MyInit() ...@@ -38,8 +38,8 @@ void DIALOG_PADS_MASK_CLEARANCE::MyInit()
{ {
SetFocus(); SetFocus();
m_SolderMaskMarginUnits->SetLabel( GetUnitsLabel( g_UnitMetric ) ); m_SolderMaskMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_SolderPasteMarginUnits->SetLabel( GetUnitsLabel( g_UnitMetric ) ); m_SolderPasteMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
int Internal_Unit = m_Parent->m_InternalUnits; int Internal_Unit = m_Parent->m_InternalUnits;
PutValueInLocalUnits( *m_SolderMaskMarginCtrl, PutValueInLocalUnits( *m_SolderMaskMarginCtrl,
......
...@@ -123,21 +123,21 @@ void DIALOG_PAD_PROPERTIES::InitDialog( ) ...@@ -123,21 +123,21 @@ void DIALOG_PAD_PROPERTIES::InitDialog( )
pad = &g_Pad_Master; pad = &g_Pad_Master;
// Display current unit name in dialog: // Display current unit name in dialog:
m_PadPosX_Unit->SetLabel( GetUnitsLabel( g_UnitMetric ) ); m_PadPosX_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_PadPosY_Unit->SetLabel( GetUnitsLabel( g_UnitMetric ) ); m_PadPosY_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_PadDrill_X_Unit->SetLabel( GetUnitsLabel( g_UnitMetric ) ); m_PadDrill_X_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_PadDrill_Y_Unit->SetLabel( GetUnitsLabel( g_UnitMetric ) ); m_PadDrill_Y_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_PadShapeSizeX_Unit->SetLabel( GetUnitsLabel( g_UnitMetric ) ); m_PadShapeSizeX_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_PadShapeSizeY_Unit->SetLabel( GetUnitsLabel( g_UnitMetric ) ); m_PadShapeSizeY_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_PadShapeOffsetX_Unit->SetLabel( GetUnitsLabel( g_UnitMetric ) ); m_PadShapeOffsetX_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_PadShapeOffsetY_Unit->SetLabel( GetUnitsLabel( g_UnitMetric ) ); m_PadShapeOffsetY_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_PadShapeDeltaX_Unit->SetLabel( GetUnitsLabel( g_UnitMetric ) ); m_PadShapeDeltaX_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_PadShapeDeltaY_Unit->SetLabel( GetUnitsLabel( g_UnitMetric ) ); m_PadShapeDeltaY_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_NetClearanceUnits->SetLabel( GetUnitsLabel( g_UnitMetric ) ); m_NetClearanceUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
// Display current pad masks clearances units // Display current pad masks clearances units
m_NetClearanceUnits->SetLabel( GetUnitsLabel( g_UnitMetric ) ); m_NetClearanceUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_SolderMaskMarginUnits->SetLabel( GetUnitsLabel( g_UnitMetric ) ); m_SolderMaskMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_SolderPasteMarginUnits->SetLabel( GetUnitsLabel( g_UnitMetric ) ); m_SolderPasteMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
// Display current pad parameters units: // Display current pad parameters units:
PutValueInLocalUnits( *m_PadPosition_X_Ctrl, pad->m_Pos.x, internalUnits ); PutValueInLocalUnits( *m_PadPosition_X_Ctrl, pad->m_Pos.x, internalUnits );
......
...@@ -112,17 +112,17 @@ WinEDA_TextPCBPropertiesFrame::WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* p ...@@ -112,17 +112,17 @@ WinEDA_TextPCBPropertiesFrame::WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* p
m_TxtSizeCtrl = new WinEDA_SizeCtrl( this, _( "Size" ), m_TxtSizeCtrl = new WinEDA_SizeCtrl( this, _( "Size" ),
TextPCB->m_Size, TextPCB->m_Size,
g_UnitMetric, LeftBoxSizer, g_UserUnit, LeftBoxSizer,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
m_TxtWidthCtlr = new WinEDA_ValueCtrl( this, _( "Width" ), m_TxtWidthCtlr = new WinEDA_ValueCtrl( this, _( "Width" ),
TextPCB->m_Width, TextPCB->m_Width,
g_UnitMetric, LeftBoxSizer, g_UserUnit, LeftBoxSizer,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
m_TxtPosCtrl = new WinEDA_PositionCtrl( this, _( "Position" ), m_TxtPosCtrl = new WinEDA_PositionCtrl( this, _( "Position" ),
TextPCB->m_Pos, TextPCB->m_Pos,
g_UnitMetric, LeftBoxSizer, g_UserUnit, LeftBoxSizer,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
m_SelLayerBox = new WinEDAChoiceBox( this, ID_TEXTPCB_SELECT_LAYER, m_SelLayerBox = new WinEDAChoiceBox( this, ID_TEXTPCB_SELECT_LAYER,
......
...@@ -171,7 +171,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr ...@@ -171,7 +171,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
bButtonsSizer->Add( m_PlotNoViaOnMaskOpt, 0, wxALL, 5 ); bButtonsSizer->Add( m_PlotNoViaOnMaskOpt, 0, wxALL, 5 );
m_staticText6 = new wxStaticText( this, wxID_ANY, _("Default pen size:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText6 = new wxStaticText( this, wxID_ANY, _("Default pen size"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText6->Wrap( -1 ); m_staticText6->Wrap( -1 );
m_staticText6->SetToolTip( _("Pen size used to draw items that have no pen size specified.\nUsed mainly to draw items in sketch mode.") ); m_staticText6->SetToolTip( _("Pen size used to draw items that have no pen size specified.\nUsed mainly to draw items in sketch mode.") );
......
...@@ -1368,7 +1368,7 @@ ...@@ -1368,7 +1368,7 @@
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Default pen size:</property> <property name="label">Default pen size</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_staticText6</property> <property name="name">m_staticText6</property>
......
...@@ -258,9 +258,9 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) ...@@ -258,9 +258,9 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
m_ModeColorOption->SetSelection( 0 ); m_ModeColorOption->SetSelection( 0 );
s_Parameters.m_PenDefaultSize = g_DrawDefaultLineThickness; s_Parameters.m_PenDefaultSize = g_DrawDefaultLineThickness;
AddUnitSymbol( *m_TextPenWidth, g_UnitMetric ); AddUnitSymbol( *m_TextPenWidth, g_UserUnit );
m_DialogPenWidth->SetValue( m_DialogPenWidth->SetValue(
ReturnStringFromValue( g_UnitMetric, s_Parameters.m_PenDefaultSize, m_Parent->m_InternalUnits ) ); ReturnStringFromValue( g_UserUnit, s_Parameters.m_PenDefaultSize, m_Parent->m_InternalUnits ) );
// Create scale adjust option // Create scale adjust option
...@@ -429,7 +429,7 @@ void DIALOG_PRINT_USING_PRINTER::SetPenWidth() ...@@ -429,7 +429,7 @@ void DIALOG_PRINT_USING_PRINTER::SetPenWidth()
g_DrawDefaultLineThickness = s_Parameters.m_PenDefaultSize; g_DrawDefaultLineThickness = s_Parameters.m_PenDefaultSize;
m_DialogPenWidth->SetValue( m_DialogPenWidth->SetValue(
ReturnStringFromValue( g_UnitMetric, s_Parameters.m_PenDefaultSize, m_Parent->m_InternalUnits ) ); ReturnStringFromValue( g_UserUnit, s_Parameters.m_PenDefaultSize, m_Parent->m_InternalUnits ) );
} }
void DIALOG_PRINT_USING_PRINTER::OnScaleSelectionClick( wxCommandEvent& event ) void DIALOG_PRINT_USING_PRINTER::OnScaleSelectionClick( wxCommandEvent& event )
......
...@@ -75,7 +75,7 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare ...@@ -75,7 +75,7 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare
wxStaticBoxSizer* sbOptionsSizer; wxStaticBoxSizer* sbOptionsSizer;
sbOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options:") ), wxVERTICAL ); sbOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options:") ), wxVERTICAL );
m_TextPenWidth = new wxStaticText( this, wxID_ANY, _("Default pen size:"), wxDefaultPosition, wxDefaultSize, 0 ); m_TextPenWidth = new wxStaticText( this, wxID_ANY, _("Default pen size"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextPenWidth->Wrap( -1 ); m_TextPenWidth->Wrap( -1 );
m_TextPenWidth->SetToolTip( _("Pen size used to draw items that have no pen size specified.\nUsed mainly to draw items in sketch mode.") ); m_TextPenWidth->SetToolTip( _("Pen size used to draw items that have no pen size specified.\nUsed mainly to draw items in sketch mode.") );
......
...@@ -490,7 +490,7 @@ ...@@ -490,7 +490,7 @@
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Default pen size:</property> <property name="label">Default pen size</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_TextPenWidth</property> <property name="name">m_TextPenWidth</property>
......
...@@ -114,11 +114,11 @@ DIMENSION_EDITOR_DIALOG::DIMENSION_EDITOR_DIALOG( WinEDA_PcbFrame* parent, ...@@ -114,11 +114,11 @@ DIMENSION_EDITOR_DIALOG::DIMENSION_EDITOR_DIALOG( WinEDA_PcbFrame* parent,
m_TxtSizeCtrl = new WinEDA_SizeCtrl( this, _( "Size" ), m_TxtSizeCtrl = new WinEDA_SizeCtrl( this, _( "Size" ),
Dimension->m_Text->m_Size, Dimension->m_Text->m_Size,
g_UnitMetric, LeftBoxSizer, m_Parent->m_InternalUnits ); g_UserUnit, LeftBoxSizer, m_Parent->m_InternalUnits );
m_TxtWidthCtrl = new WinEDA_ValueCtrl( this, _( "Width" ), m_TxtWidthCtrl = new WinEDA_ValueCtrl( this, _( "Width" ),
Dimension->m_Width, Dimension->m_Width,
g_UnitMetric, LeftBoxSizer, m_Parent->m_InternalUnits ); g_UserUnit, LeftBoxSizer, m_Parent->m_InternalUnits );
wxStaticText* text = new wxStaticText( this, -1, _( "Layer:" ) ); wxStaticText* text = new wxStaticText( this, -1, _( "Layer:" ) );
LeftBoxSizer->Add( text, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 ); LeftBoxSizer->Add( text, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
......
...@@ -317,7 +317,7 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg ) ...@@ -317,7 +317,7 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
const BOARD_DESIGN_SETTINGS& g = *m_pcb->GetBoardDesignSettings(); const BOARD_DESIGN_SETTINGS& g = *m_pcb->GetBoardDesignSettings();
#define FmtVal( x ) GetChars( ReturnStringFromValue( g_UnitMetric, x, PCB_INTERNAL_UNIT ) ) #define FmtVal( x ) GetChars( ReturnStringFromValue( g_UserUnit, x, PCB_INTERNAL_UNIT ) )
#if 0 // set to 1 when (if...) BOARD_DESIGN_SETTINGS has a m_MinClearance value #if 0 // set to 1 when (if...) BOARD_DESIGN_SETTINGS has a m_MinClearance value
if( nc->GetClearance() < g.m_MinClearance ) if( nc->GetClearance() < g.m_MinClearance )
......
...@@ -365,7 +365,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ...@@ -365,7 +365,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
break; break;
case HK_SWITCH_UNITS: case HK_SWITCH_UNITS:
g_UnitMetric = (g_UnitMetric == INCHES) ? MILLIMETRE : INCHES; g_UserUnit = (g_UserUnit == INCHES) ? MILLIMETRES : INCHES;
break; break;
case HK_SWITCH_TRACK_DISPLAY_MODE: case HK_SWITCH_TRACK_DISPLAY_MODE:
...@@ -726,7 +726,7 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -726,7 +726,7 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* DC, int hotkey,
break; break;
case HK_SWITCH_UNITS: case HK_SWITCH_UNITS:
g_UnitMetric = (g_UnitMetric == INCHES) ? MILLIMETRE : INCHES; g_UserUnit = (g_UserUnit == INCHES) ? MILLIMETRES : INCHES;
break; break;
case HK_ZOOM_IN: case HK_ZOOM_IN:
......
...@@ -105,13 +105,13 @@ WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame( ...@@ -105,13 +105,13 @@ WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame(
// Size: // Size:
m_MireSizeCtrl = new WinEDA_ValueCtrl( this, _( "Size" ), m_MireSizeCtrl = new WinEDA_ValueCtrl( this, _( "Size" ),
m_MirePcb->m_Size, m_MirePcb->m_Size,
g_UnitMetric, LeftBoxSizer, g_UserUnit, LeftBoxSizer,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
// Width: // Width:
m_MireWidthCtrl = new WinEDA_ValueCtrl( this, _( "Width" ), m_MireWidthCtrl = new WinEDA_ValueCtrl( this, _( "Width" ),
m_MirePcb->m_Width, m_MirePcb->m_Width,
g_UnitMetric, LeftBoxSizer, g_UserUnit, LeftBoxSizer,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
// Shape // Shape
......
...@@ -27,11 +27,11 @@ void WinEDA_ModuleEditFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -27,11 +27,11 @@ void WinEDA_ModuleEditFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break; break;
case ID_TB_OPTIONS_SELECT_UNIT_MM: case ID_TB_OPTIONS_SELECT_UNIT_MM:
g_UnitMetric = MILLIMETRE; g_UserUnit = MILLIMETRES;
case ID_TB_OPTIONS_SELECT_UNIT_INCH: case ID_TB_OPTIONS_SELECT_UNIT_INCH:
if( id == ID_TB_OPTIONS_SELECT_UNIT_INCH ) if( id == ID_TB_OPTIONS_SELECT_UNIT_INCH )
g_UnitMetric = INCHES; g_UserUnit = INCHES;
UpdateStatusBar(); UpdateStatusBar();
ReCreateAuxiliaryToolbar(); ReCreateAuxiliaryToolbar();
break; break;
......
...@@ -178,7 +178,7 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father, ...@@ -178,7 +178,7 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
LoadSettings(); LoadSettings();
GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnits, ID_POPUP_GRID_USER ); GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER );
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
...@@ -351,10 +351,10 @@ void WinEDA_ModuleEditFrame::SetToolbars() ...@@ -351,10 +351,10 @@ void WinEDA_ModuleEditFrame::SetToolbars()
{ {
m_OptionsToolBar->ToggleTool( m_OptionsToolBar->ToggleTool(
ID_TB_OPTIONS_SELECT_UNIT_MM, ID_TB_OPTIONS_SELECT_UNIT_MM,
g_UnitMetric == g_UserUnit ==
MILLIMETRE ? TRUE : false ); MILLIMETRES ? TRUE : false );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH,
g_UnitMetric == INCHES ? TRUE : false ); g_UserUnit == INCHES ? TRUE : false );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood ); DisplayOpt.DisplayPolarCood );
......
...@@ -220,7 +220,7 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC ) ...@@ -220,7 +220,7 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
} }
/* Enter the desired length. */ /* Enter the desired length. */
if( !g_UnitMetric ) if( !g_UserUnit )
{ {
fcoeff = 10000.0; fcoeff = 10000.0;
msg.Printf( wxT( "%1.4f" ), Mself.lng / fcoeff ); msg.Printf( wxT( "%1.4f" ), Mself.lng / fcoeff );
...@@ -677,7 +677,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type ) ...@@ -677,7 +677,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type )
} }
wxString value; wxString value;
if( g_UnitMetric ) if( g_UserUnit )
{ {
fcoeff = 10000.0f / 25.4f; fcoeff = 10000.0f / 25.4f;
value.Printf( wxT( "%2.4f" ), gap_size / fcoeff ); value.Printf( wxT( "%2.4f" ), gap_size / fcoeff );
...@@ -862,7 +862,7 @@ WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( WinEDA_PcbFrame* parent, ...@@ -862,7 +862,7 @@ WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( WinEDA_PcbFrame* parent,
LeftBoxSizer->Add( m_ShapeOptionCtrl, 0, wxGROW | wxALL, 5 ); LeftBoxSizer->Add( m_ShapeOptionCtrl, 0, wxGROW | wxALL, 5 );
m_SizeCtrl = new WinEDA_SizeCtrl( this, _( "Size" ), ShapeSize, m_SizeCtrl = new WinEDA_SizeCtrl( this, _( "Size" ), ShapeSize,
g_UnitMetric, LeftBoxSizer, g_UserUnit, LeftBoxSizer,
PCB_INTERNAL_UNIT ); PCB_INTERNAL_UNIT );
GetSizer()->Fit( this ); GetSizer()->Fit( this );
...@@ -1163,7 +1163,7 @@ void WinEDA_PcbFrame::Edit_Gap( wxDC* DC, MODULE* Module ) ...@@ -1163,7 +1163,7 @@ void WinEDA_PcbFrame::Edit_Gap( wxDC* DC, MODULE* Module )
gap_size = next_pad->m_Pos0.x - pad->m_Pos0.x - pad->m_Size.x; gap_size = next_pad->m_Pos0.x - pad->m_Pos0.x - pad->m_Size.x;
/* Entrance to the desired length of the gap. */ /* Entrance to the desired length of the gap. */
if( g_UnitMetric ) if( g_UserUnit )
{ {
fcoeff = 10000.0f / 25.4f; fcoeff = 10000.0f / 25.4f;
msg.Printf( wxT( "%2.3f" ), gap_size / fcoeff ); msg.Printf( wxT( "%2.3f" ), gap_size / fcoeff );
......
...@@ -837,7 +837,7 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard ) ...@@ -837,7 +837,7 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard )
for( unsigned ii = 0; ii < aBoard->m_TrackWidthList.size(); ii++ ) for( unsigned ii = 0; ii < aBoard->m_TrackWidthList.size(); ii++ )
{ {
value = ReturnStringFromValue( g_UnitMetric, aBoard->m_TrackWidthList[ii], value = ReturnStringFromValue( g_UserUnit, aBoard->m_TrackWidthList[ii],
PCB_INTERNAL_UNIT, true ); PCB_INTERNAL_UNIT, true );
msg.Printf( _( "Track %s" ), GetChars( value ) ); msg.Printf( _( "Track %s" ), GetChars( value ) );
if( ii == 0 ) if( ii == 0 )
...@@ -857,9 +857,9 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard ) ...@@ -857,9 +857,9 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard )
trackwidth_menu->AppendSeparator(); trackwidth_menu->AppendSeparator();
for( unsigned ii = 0; ii < aBoard->m_ViasDimensionsList.size(); ii++ ) for( unsigned ii = 0; ii < aBoard->m_ViasDimensionsList.size(); ii++ )
{ {
value = ReturnStringFromValue( g_UnitMetric, aBoard->m_ViasDimensionsList[ii].m_Diameter, value = ReturnStringFromValue( g_UserUnit, aBoard->m_ViasDimensionsList[ii].m_Diameter,
PCB_INTERNAL_UNIT, true ); PCB_INTERNAL_UNIT, true );
wxString drill = ReturnStringFromValue( g_UnitMetric, wxString drill = ReturnStringFromValue( g_UserUnit,
aBoard->m_ViasDimensionsList[ii].m_Drill, aBoard->m_ViasDimensionsList[ii].m_Drill,
PCB_INTERNAL_UNIT, true ); PCB_INTERNAL_UNIT, true );
if( aBoard->m_ViasDimensionsList[ii].m_Drill <= 0 ) if( aBoard->m_ViasDimensionsList[ii].m_Drill <= 0 )
......
...@@ -303,7 +303,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, ...@@ -303,7 +303,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
LoadSettings(); LoadSettings();
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnits, ID_POPUP_GRID_USER ); GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER );
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
if( DrawPanel ) if( DrawPanel )
......
...@@ -302,7 +302,7 @@ PARAM_CFG_ARRAY& WinEDA_PcbFrame::GetConfigurationSettings() ...@@ -302,7 +302,7 @@ PARAM_CFG_ARRAY& WinEDA_PcbFrame::GetConfigurationSettings()
OPT_VIA_HOLE_END - 1 ) ); OPT_VIA_HOLE_END - 1 ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ShowNetNamesMode" ), m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ShowNetNamesMode" ),
&DisplayOpt.DisplayNetNamesMode, 3, 0, 3 ) ); &DisplayOpt.DisplayNetNamesMode, 3, 0, 3 ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Unite" ), &g_UnitMetric, FALSE ) ); m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Unite" ), (int*)&g_UserUnit, MILLIMETRES ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "SegFill" ), m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "SegFill" ),
&DisplayOpt.DisplayPcbTrackFill, TRUE ) ); &DisplayOpt.DisplayPcbTrackFill, TRUE ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "TrackDisplayClearance" ), m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "TrackDisplayClearance" ),
......
...@@ -151,22 +151,22 @@ void DIALOG_PLOT::Init_Dialog() ...@@ -151,22 +151,22 @@ void DIALOG_PLOT::Init_Dialog()
// Set units and value for HPGL pen speed. // Set units and value for HPGL pen speed.
AddUnitSymbol( *m_textPenSize, g_UnitMetric ); AddUnitSymbol( *m_textPenSize, g_UserUnit );
msg = ReturnStringFromValue( g_UnitMetric, g_pcb_plot_options.HPGL_Pen_Diam, UNITS_MILS ); msg = ReturnStringFromValue( g_UserUnit, g_pcb_plot_options.HPGL_Pen_Diam, UNITS_MILS );
m_HPGLPenSizeOpt->AppendText( msg ); m_HPGLPenSizeOpt->AppendText( msg );
// Set units to cm for standard HPGL pen speed. // Set units to cm for standard HPGL pen speed.
msg = ReturnStringFromValue( CENTIMETRE, g_pcb_plot_options.HPGL_Pen_Speed, 1 ); msg = ReturnStringFromValue( UNSCALED_UNITS, g_pcb_plot_options.HPGL_Pen_Speed, 1 );
m_HPGLPenSpeedOpt->AppendText( msg ); m_HPGLPenSpeedOpt->AppendText( msg );
// Set units and value for HPGL pen overlay. // Set units and value for HPGL pen overlay.
AddUnitSymbol( *m_textPenOvr, g_UnitMetric ); AddUnitSymbol( *m_textPenOvr, g_UserUnit );
msg = ReturnStringFromValue( g_UnitMetric, msg = ReturnStringFromValue( g_UserUnit,
g_pcb_plot_options.HPGL_Pen_Recouvrement, g_pcb_plot_options.HPGL_Pen_Recouvrement,
UNITS_MILS ); UNITS_MILS );
m_HPGLPenOverlayOpt->AppendText( msg ); m_HPGLPenOverlayOpt->AppendText( msg );
msg = ReturnStringFromValue( g_UnitMetric, msg = ReturnStringFromValue( g_UserUnit,
g_pcb_plot_options.PlotLine_Width, g_pcb_plot_options.PlotLine_Width,
PCB_INTERNAL_UNIT ); PCB_INTERNAL_UNIT );
m_LinesWidth->AppendText( msg ); m_LinesWidth->AppendText( msg );
...@@ -443,19 +443,19 @@ void DIALOG_PLOT::SaveOptPlot( wxCommandEvent& event ) ...@@ -443,19 +443,19 @@ void DIALOG_PLOT::SaveOptPlot( wxCommandEvent& event )
g_pcb_plot_options.DrawViaOnMaskLayer = m_PlotNoViaOnMaskOpt->GetValue(); g_pcb_plot_options.DrawViaOnMaskLayer = m_PlotNoViaOnMaskOpt->GetValue();
wxString msg = m_HPGLPenSizeOpt->GetValue(); wxString msg = m_HPGLPenSizeOpt->GetValue();
int tmp = ReturnValueFromString( g_UnitMetric, msg, UNITS_MILS ); int tmp = ReturnValueFromString( g_UserUnit, msg, UNITS_MILS );
g_pcb_plot_options.HPGL_Pen_Diam = tmp; g_pcb_plot_options.HPGL_Pen_Diam = tmp;
msg = m_HPGLPenSpeedOpt->GetValue(); msg = m_HPGLPenSpeedOpt->GetValue();
tmp = ReturnValueFromString( CENTIMETRE, msg, 1 ); tmp = ReturnValueFromString( MILLIMETRES, msg, 1 );
g_pcb_plot_options.HPGL_Pen_Speed = tmp; g_pcb_plot_options.HPGL_Pen_Speed = tmp;
msg = m_HPGLPenOverlayOpt->GetValue(); msg = m_HPGLPenOverlayOpt->GetValue();
tmp = ReturnValueFromString( g_UnitMetric, msg, UNITS_MILS ); tmp = ReturnValueFromString( g_UserUnit, msg, UNITS_MILS );
g_pcb_plot_options.HPGL_Pen_Recouvrement = tmp; g_pcb_plot_options.HPGL_Pen_Recouvrement = tmp;
msg = m_LinesWidth->GetValue(); msg = m_LinesWidth->GetValue();
tmp = ReturnValueFromString( g_UnitMetric, msg, PCB_INTERNAL_UNIT ); tmp = ReturnValueFromString( g_UserUnit, msg, PCB_INTERNAL_UNIT );
g_pcb_plot_options.PlotLine_Width = tmp; g_pcb_plot_options.PlotLine_Width = tmp;
g_DrawDefaultLineThickness = g_pcb_plot_options.PlotLine_Width; g_DrawDefaultLineThickness = g_pcb_plot_options.PlotLine_Width;
......
...@@ -21,15 +21,15 @@ void WinEDA_BasePcbFrame::InstallGridFrame( const wxPoint& pos ) ...@@ -21,15 +21,15 @@ void WinEDA_BasePcbFrame::InstallGridFrame( const wxPoint& pos )
WinEDA_PcbGridFrame dlg( this, pos ); WinEDA_PcbGridFrame dlg( this, pos );
dlg.SetGridSize( m_UserGridSize ); dlg.SetGridSize( m_UserGridSize );
dlg.SetGridUnits( m_UserGridUnits ); dlg.SetGridUnits( m_UserGridUnit );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;
m_UserGridSize = dlg.GetGridSize(); m_UserGridSize = dlg.GetGridSize();
m_UserGridUnits = dlg.GetGridUnits(); m_UserGridUnit = (UserUnitType)dlg.GetGridUnits();
GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnits, ID_POPUP_GRID_USER ); GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER );
// If the user grid is the current option, recall SetGrid() // If the user grid is the current option, recall SetGrid()
// to force new values put in list as current grid value // to force new values put in list as current grid value
......
...@@ -293,15 +293,25 @@ void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar() ...@@ -293,15 +293,25 @@ void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar()
m_SelGridBox->Clear(); m_SelGridBox->Clear();
for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ ) for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ )
{ {
double value = To_User_Unit( g_UnitMetric, double value = To_User_Unit( g_UserUnit,
GetScreen()->m_GridList[i].m_Size.x, GetScreen()->m_GridList[i].m_Size.x,
PCB_INTERNAL_UNIT ); PCB_INTERNAL_UNIT );
if( GetScreen()->m_GridList[i].m_Id != ID_POPUP_GRID_USER ) if( GetScreen()->m_GridList[i].m_Id != ID_POPUP_GRID_USER )
{ {
if( g_UnitMetric == INCHES ) switch( g_UserUnit )
{
case INCHES:
msg.Printf( _( "Grid %.1f" ), value * 1000 ); msg.Printf( _( "Grid %.1f" ), value * 1000 );
else break;
case MILLIMETRES:
msg.Printf( _( "Grid %.3f" ), value ); msg.Printf( _( "Grid %.3f" ), value );
break;
case UNSCALED_UNITS:
msg.Printf( _( "Grid %f" ), value );
break;
}
} }
else else
{ {
......
...@@ -616,22 +616,39 @@ an existing track use its width\notherwise, use current width setting" ), ...@@ -616,22 +616,39 @@ an existing track use its width\notherwise, use current width setting" ),
// Update displayed values // Update displayed values
m_SelGridBox->Clear(); m_SelGridBox->Clear();
wxString format = _( "Grid"); wxString format = _( "Grid");
if( g_UnitMetric == INCHES ) switch( g_UserUnit )
{
case INCHES:
format += wxT( " %.1f" ); format += wxT( " %.1f" );
else break;
case MILLIMETRES:
format += wxT( " %.3f" ); format += wxT( " %.3f" );
break;
case UNSCALED_UNITS:
format += wxT( " %f" );
break;
}
for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ ) for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ )
{ {
GRID_TYPE grid = GetScreen()->m_GridList[i]; GRID_TYPE grid = GetScreen()->m_GridList[i];
double value = To_User_Unit( g_UnitMetric, grid.m_Size.x, double value = To_User_Unit( g_UserUnit, grid.m_Size.x,
m_InternalUnits ); m_InternalUnits );
if( grid.m_Id != ID_POPUP_GRID_USER ) if( grid.m_Id != ID_POPUP_GRID_USER )
{ {
if( g_UnitMetric == INCHES ) switch( g_UserUnit )
{
case INCHES:
msg.Printf( format.GetData(), value * 1000 ); msg.Printf( format.GetData(), value * 1000 );
else break;
case MILLIMETRES:
case UNSCALED_UNITS:
msg.Printf( format.GetData(), value ); msg.Printf( format.GetData(), value );
break;
}
} }
else else
msg = _( "User Grid" ); msg = _( "User Grid" );
......
...@@ -19,15 +19,15 @@ ...@@ -19,15 +19,15 @@
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
/* helper to convert an integer value to a string, using mils or mm /* helper to convert an integer value to a string, using mils or mm
* according to g_UnitMetric value * according to g_UserUnit value
*/ */
static wxString ReturnStringValue( int aValue ) static wxString ReturnStringValue( int aValue )
{ {
wxString text; wxString text;
const wxChar* format; const wxChar* format;
double value = To_User_Unit( g_UnitMetric, aValue, PCB_INTERNAL_UNIT ); double value = To_User_Unit( g_UserUnit, aValue, PCB_INTERNAL_UNIT );
if( g_UnitMetric == INCHES ) if( g_UserUnit == INCHES )
{ {
format = wxT( " %.1f" ); format = wxT( " %.1f" );
value *= 1000; value *= 1000;
...@@ -35,7 +35,7 @@ static wxString ReturnStringValue( int aValue ) ...@@ -35,7 +35,7 @@ static wxString ReturnStringValue( int aValue )
else else
format = wxT( " %.3f" ); format = wxT( " %.3f" );
text.Printf( format, value ); text.Printf( format, value );
if( g_UnitMetric == INCHES ) if( g_UserUnit == INCHES )
text += _( " mils" ); text += _( " mils" );
else else
text += _( " mm" ); text += _( " mm" );
...@@ -196,9 +196,9 @@ void WinEDA_PcbFrame::SetToolbars() ...@@ -196,9 +196,9 @@ void WinEDA_PcbFrame::SetToolbars()
_( "Enable design rule checking" ) ); _( "Enable design rule checking" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM,
g_UnitMetric == MILLIMETRE ? TRUE : false ); g_UserUnit == MILLIMETRES );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH,
g_UnitMetric == INCHES ? TRUE : false ); g_UserUnit == INCHES );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood ); DisplayOpt.DisplayPolarCood );
......
...@@ -81,8 +81,8 @@ void DialogNonCopperZonesEditor::Init() ...@@ -81,8 +81,8 @@ void DialogNonCopperZonesEditor::Init()
m_FillModeCtrl->SetSelection( m_Zone_Setting->m_FillMode ? 1 : 0 ); m_FillModeCtrl->SetSelection( m_Zone_Setting->m_FillMode ? 1 : 0 );
AddUnitSymbol( *m_MinThicknessValueTitle, g_UnitMetric ); AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit );
wxString msg = ReturnStringFromValue( g_UnitMetric, wxString msg = ReturnStringFromValue( g_UserUnit,
m_Zone_Setting->m_ZoneMinThickness, m_Zone_Setting->m_ZoneMinThickness,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
m_ZoneMinThicknessCtrl->SetValue( msg ); m_ZoneMinThicknessCtrl->SetValue( msg );
...@@ -134,7 +134,7 @@ void DialogNonCopperZonesEditor::OnOkClick( wxCommandEvent& event ) ...@@ -134,7 +134,7 @@ void DialogNonCopperZonesEditor::OnOkClick( wxCommandEvent& event )
{ {
wxString txtvalue = m_ZoneMinThicknessCtrl->GetValue(); wxString txtvalue = m_ZoneMinThicknessCtrl->GetValue();
m_Zone_Setting->m_ZoneMinThickness = m_Zone_Setting->m_ZoneMinThickness =
ReturnValueFromString( g_UnitMetric, txtvalue, m_Parent->m_InternalUnits ); ReturnValueFromString( g_UserUnit, txtvalue, m_Parent->m_InternalUnits );
if( m_Zone_Setting->m_ZoneMinThickness < 10 ) if( m_Zone_Setting->m_ZoneMinThickness < 10 )
{ {
DisplayError( this, DisplayError( this,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment