Commit 6468805c authored by Wayne Stambaugh's avatar Wayne Stambaugh

More internal unit improvements.

* Move all convert from user to internal units into base_units.cpp.
* Remove internal units parameters from all moved conversion functions.
* Revise all source code that calls the moved conversion functions.
* Remove internal units from all dialog text control helper classes.
parent 5d5eb7d3
...@@ -44,13 +44,19 @@ ...@@ -44,13 +44,19 @@
#if defined( USE_PCBNEW_NANOMETRES ) #if defined( USE_PCBNEW_NANOMETRES )
#define IU_TO_MM( x ) ( x * 1e-6 ) #define IU_TO_MM( x ) ( x * 1e-6 )
#define IU_TO_IN( x ) ( ( x * 1e-6 ) / 25.4 ) #define IU_TO_IN( x ) ( ( x * 1e-6 ) / 25.4 )
#define MM_TO_IU( x ) ( x * 1e6 )
#define IN_TO_IU( x ) ( ( x * 25.4 ) * 1e6 )
#else #else
#define IU_TO_MM( x ) ( ( x * 0.0001 ) * 25.4 ) #define IU_TO_MM( x ) ( ( x * 0.0001 ) * 25.4 )
#define IU_TO_IN( x ) ( x * 0.0001 ) #define IU_TO_IN( x ) ( x * 0.0001 )
#define MM_TO_IU( x ) ( ( x / 25.4 ) * 10000.0 )
#define IN_TO_IU( x ) ( x * 10000.0 )
#endif #endif
#elif defined( EESCHEMA ) #elif defined( EESCHEMA )
#define IU_TO_MM( x ) ( ( x * 0.001 ) * 25.4 ) #define IU_TO_MM( x ) ( ( x * 0.001 ) * 25.4 )
#define IU_TO_IN( x ) ( x * 0.001 ) #define IU_TO_IN( x ) ( x * 0.001 )
#define MM_TO_IU( x ) ( ( x / 25.4 ) * 1000.0 )
#define IN_TO_IU( x ) ( x * 1000.0 )
#else #else
#error "Cannot resolve internal units due to no definition of EESCHEMA or PCBNEW." #error "Cannot resolve internal units due to no definition of EESCHEMA or PCBNEW."
#endif #endif
...@@ -159,3 +165,99 @@ void PutValueInLocalUnits( wxTextCtrl& aTextCtr, int aValue ) ...@@ -159,3 +165,99 @@ void PutValueInLocalUnits( wxTextCtrl& aTextCtr, int aValue )
aTextCtr.SetValue( msg ); aTextCtr.SetValue( msg );
} }
int From_User_Unit( EDA_UNITS_T aUnit, double aValue )
{
double value;
switch( aUnit )
{
case MILLIMETRES:
value = MM_TO_IU( aValue );
break;
case INCHES:
value = IN_TO_IU( aValue );
break;
default:
case UNSCALED_UNITS:
value = aValue;
}
return wxRound( value );
}
int ReturnValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue )
{
int Value;
double dtmp = 0;
// Acquire the 'right' decimal point separator
const struct lconv* lc = localeconv();
wxChar decimal_point = lc->decimal_point[0];
wxString buf( aTextValue.Strip( wxString::both ) );
// Convert the period in decimal point
buf.Replace( wxT( "." ), wxString( decimal_point, 1 ) );
// An ugly fix needed by WxWidgets 2.9.1 that sometimes
// back to a point as separator, although the separator is the comma
// TODO: remove this line if WxWidgets 2.9.2 fixes this issue
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) || (ch == '-') || (ch == '+') ) )
{
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( "\"" ) )
{
aUnits = INCHES;
}
else if( unit == wxT( "mm" ) )
{
aUnits = MILLIMETRES;
}
else if( unit == wxT( "mi" ) || unit == wxT( "th" ) ) // Mils or thous
{
aUnits = INCHES;
dtmp /= 1000;
}
Value = From_User_Unit( aUnits, dtmp );
return Value;
}
int ReturnValueFromTextCtrl( const wxTextCtrl& aTextCtr )
{
int value;
wxString msg = aTextCtr.GetValue();
value = ReturnValueFromString( g_UserUnit, msg );
return value;
}
...@@ -253,76 +253,6 @@ void AddUnitSymbol( wxStaticText& Stext, EDA_UNITS_T aUnit ) ...@@ -253,76 +253,6 @@ void AddUnitSymbol( wxStaticText& Stext, EDA_UNITS_T aUnit )
} }
int ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr, int Internal_Unit )
{
int value;
wxString msg = TextCtr.GetValue();
value = ReturnValueFromString( g_UserUnit, msg, Internal_Unit );
return value;
}
int ReturnValueFromString( EDA_UNITS_T aUnit, const wxString& TextValue, int Internal_Unit )
{
int Value;
double dtmp = 0;
// Acquire the 'right' decimal point separator
const struct lconv* lc = localeconv();
wxChar decimal_point = lc->decimal_point[0];
wxString buf( TextValue.Strip( wxString::both ) );
// Convert the period in decimal point
buf.Replace( wxT( "." ), wxString( decimal_point, 1 ) );
// An ugly fix needed by WxWidgets 2.9.1 that sometimes
// back to a point as separator, although the separator is the comma
// TODO: remove this line if WxWidgets 2.9.2 fixes this issue
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) || (ch == '-') || (ch == '+') ) )
{
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;
}
wxArrayString* wxStringSplit( wxString aString, wxChar aSplitter ) wxArrayString* wxStringSplit( wxString aString, wxChar aSplitter )
{ {
wxArrayString* list = new wxArrayString(); wxArrayString* list = new wxArrayString();
...@@ -349,33 +279,6 @@ wxArrayString* wxStringSplit( wxString aString, wxChar aSplitter ) ...@@ -349,33 +279,6 @@ wxArrayString* wxStringSplit( wxString aString, wxChar aSplitter )
} }
/*
* Return in internal units the value "val" given in inch or mm
*/
int From_User_Unit( EDA_UNITS_T aUnit, double val, int internal_unit_value )
{
double value;
switch( aUnit )
{
case MILLIMETRES:
value = val * internal_unit_value / 25.4;
break;
case INCHES:
value = val * internal_unit_value;
break;
default:
case UNSCALED_UNITS:
value = val;
}
return wxRound( value );
}
/* /*
* Return the string date "day month year" like "23 jun 2005" * Return the string date "day month year" like "23 jun 2005"
*/ */
......
...@@ -41,17 +41,14 @@ EDA_GRAPHIC_TEXT_CTRL::EDA_GRAPHIC_TEXT_CTRL( wxWindow* parent, ...@@ -41,17 +41,14 @@ EDA_GRAPHIC_TEXT_CTRL::EDA_GRAPHIC_TEXT_CTRL( wxWindow* parent,
int textsize, int textsize,
EDA_UNITS_T user_unit, EDA_UNITS_T user_unit,
wxBoxSizer* BoxSizer, wxBoxSizer* BoxSizer,
int framelen, int framelen )
int internal_unit )
{ {
m_UserUnit = user_unit; m_UserUnit = user_unit;
m_Internal_Unit = internal_unit;
m_Title = NULL; m_Title = NULL;
m_Title = new wxStaticText( parent, -1, Title ); m_Title = new wxStaticText( parent, -1, Title );
BoxSizer->Add( m_Title, 0, BoxSizer->Add( m_Title, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
m_FrameText = new wxTextCtrl( parent, -1, TextToEdit ); m_FrameText = new wxTextCtrl( parent, -1, TextToEdit );
...@@ -62,14 +59,12 @@ EDA_GRAPHIC_TEXT_CTRL::EDA_GRAPHIC_TEXT_CTRL( wxWindow* parent, ...@@ -62,14 +59,12 @@ EDA_GRAPHIC_TEXT_CTRL::EDA_GRAPHIC_TEXT_CTRL( wxWindow* parent,
wxString msg = _( "Size" ) + ReturnUnitSymbol( m_UserUnit ); 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, 5 );
wxGROW | wxLEFT | wxRIGHT, 5 );
} }
wxString value = FormatSize( m_Internal_Unit, m_UserUnit, textsize ); wxString value = FormatSize( 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 ) );
BoxSizer->Add( m_FrameSize, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); BoxSizer->Add( m_FrameSize, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
} }
...@@ -84,11 +79,8 @@ EDA_GRAPHIC_TEXT_CTRL::~EDA_GRAPHIC_TEXT_CTRL() ...@@ -84,11 +79,8 @@ EDA_GRAPHIC_TEXT_CTRL::~EDA_GRAPHIC_TEXT_CTRL()
} }
wxString EDA_GRAPHIC_TEXT_CTRL::FormatSize( int internalUnit, EDA_UNITS_T aUnit, wxString EDA_GRAPHIC_TEXT_CTRL::FormatSize( EDA_UNITS_T aUnit, int textSize )
int textSize )
{ {
wxString value;
// Limiting the size of the text of reasonable values. // Limiting the size of the text of reasonable values.
if( textSize < 10 ) if( textSize < 10 )
textSize = 10; textSize = 10;
...@@ -96,10 +88,7 @@ wxString EDA_GRAPHIC_TEXT_CTRL::FormatSize( int internalUnit, EDA_UNITS_T aUnit, ...@@ -96,10 +88,7 @@ wxString EDA_GRAPHIC_TEXT_CTRL::FormatSize( int internalUnit, EDA_UNITS_T aUnit,
if( textSize > 3000 ) if( textSize > 3000 )
textSize = 3000; textSize = 3000;
value.Printf( ( internalUnit > 1000 ) ? wxT( "%.4f" ) : wxT( "%.3f" ), return ReturnStringFromValue( aUnit, textSize );
To_User_Unit( aUnit, textSize ) );
return value;
} }
...@@ -117,7 +106,7 @@ void EDA_GRAPHIC_TEXT_CTRL::SetValue( const wxString& value ) ...@@ -117,7 +106,7 @@ void EDA_GRAPHIC_TEXT_CTRL::SetValue( const wxString& value )
void EDA_GRAPHIC_TEXT_CTRL::SetValue( int textSize ) void EDA_GRAPHIC_TEXT_CTRL::SetValue( int textSize )
{ {
wxString value = FormatSize( m_Internal_Unit, m_UserUnit, textSize ); wxString value = FormatSize( m_UserUnit, textSize );
m_FrameSize->SetValue( value ); m_FrameSize->SetValue( value );
} }
...@@ -129,12 +118,11 @@ const wxString EDA_GRAPHIC_TEXT_CTRL::GetText() const ...@@ -129,12 +118,11 @@ const wxString EDA_GRAPHIC_TEXT_CTRL::GetText() const
} }
int EDA_GRAPHIC_TEXT_CTRL::ParseSize( const wxString& sizeText, int EDA_GRAPHIC_TEXT_CTRL::ParseSize( const wxString& sizeText, EDA_UNITS_T aUnit )
int internalUnit, EDA_UNITS_T aUnit )
{ {
int textsize; int textsize;
textsize = ReturnValueFromString( aUnit, sizeText, internalUnit ); textsize = ReturnValueFromString( aUnit, sizeText );
// Limit to reasonable size // Limit to reasonable size
if( textsize < 10 ) if( textsize < 10 )
...@@ -149,7 +137,7 @@ int EDA_GRAPHIC_TEXT_CTRL::ParseSize( const wxString& sizeText, ...@@ -149,7 +137,7 @@ int EDA_GRAPHIC_TEXT_CTRL::ParseSize( const wxString& sizeText,
int EDA_GRAPHIC_TEXT_CTRL::GetTextSize() int EDA_GRAPHIC_TEXT_CTRL::GetTextSize()
{ {
return ParseSize( m_FrameSize->GetValue(), m_Internal_Unit, m_UserUnit ); return ParseSize( m_FrameSize->GetValue(), m_UserUnit );
} }
...@@ -166,13 +154,11 @@ EDA_POSITION_CTRL::EDA_POSITION_CTRL( wxWindow* parent, ...@@ -166,13 +154,11 @@ EDA_POSITION_CTRL::EDA_POSITION_CTRL( wxWindow* parent,
const wxString& title, const wxString& title,
const wxPoint& pos_to_edit, const wxPoint& pos_to_edit,
EDA_UNITS_T user_unit, EDA_UNITS_T user_unit,
wxBoxSizer* BoxSizer, wxBoxSizer* BoxSizer )
int internal_unit )
{ {
wxString text; wxString text;
m_UserUnit = user_unit; m_UserUnit = user_unit;
m_Internal_Unit = internal_unit;
if( title.IsEmpty() ) if( title.IsEmpty() )
text = _( "Pos " ); text = _( "Pos " );
...@@ -182,10 +168,8 @@ EDA_POSITION_CTRL::EDA_POSITION_CTRL( wxWindow* parent, ...@@ -182,10 +168,8 @@ EDA_POSITION_CTRL::EDA_POSITION_CTRL( wxWindow* parent,
text += _( "X" ) + ReturnUnitSymbol( m_UserUnit ); 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, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 ); m_FramePosX = new wxTextCtrl( parent, -1, wxEmptyString, wxDefaultPosition );
m_FramePosX = new wxTextCtrl( parent, -1, wxEmptyString,
wxDefaultPosition );
BoxSizer->Add( m_FramePosX, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); BoxSizer->Add( m_FramePosX, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
...@@ -198,8 +182,7 @@ EDA_POSITION_CTRL::EDA_POSITION_CTRL( wxWindow* parent, ...@@ -198,8 +182,7 @@ EDA_POSITION_CTRL::EDA_POSITION_CTRL( wxWindow* parent,
m_TextY = new wxStaticText( parent, -1, text ); m_TextY = new wxStaticText( parent, -1, text );
BoxSizer->Add( m_TextY, 0, BoxSizer->Add( m_TextY, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
m_FramePosY = new wxTextCtrl( parent, -1, wxEmptyString ); m_FramePosY = new wxTextCtrl( parent, -1, wxEmptyString );
...@@ -224,8 +207,8 @@ wxPoint EDA_POSITION_CTRL::GetValue() ...@@ -224,8 +207,8 @@ wxPoint EDA_POSITION_CTRL::GetValue()
{ {
wxPoint coord; wxPoint coord;
coord.x = ReturnValueFromString( m_UserUnit, m_FramePosX->GetValue(), m_Internal_Unit ); coord.x = ReturnValueFromString( m_UserUnit, m_FramePosX->GetValue() );
coord.y = ReturnValueFromString( m_UserUnit, m_FramePosY->GetValue(), m_Internal_Unit ); coord.y = ReturnValueFromString( m_UserUnit, m_FramePosY->GetValue() );
return coord; return coord;
} }
...@@ -259,12 +242,10 @@ void EDA_POSITION_CTRL::SetValue( int x_value, int y_value ) ...@@ -259,12 +242,10 @@ void EDA_POSITION_CTRL::SetValue( int x_value, int y_value )
/* EDA_SIZE_CTRL */ /* EDA_SIZE_CTRL */
/*******************/ /*******************/
EDA_SIZE_CTRL::EDA_SIZE_CTRL( wxWindow* parent, const wxString& title, EDA_SIZE_CTRL::EDA_SIZE_CTRL( wxWindow* parent, const wxString& title,
const wxSize& size_to_edit, const wxSize& size_to_edit, EDA_UNITS_T aUnit,
EDA_UNITS_T aUnit, wxBoxSizer* aBoxSizer, wxBoxSizer* aBoxSizer ) :
int internal_unit ) : EDA_POSITION_CTRL( parent, title, wxPoint( size_to_edit.x, size_to_edit.y ),
EDA_POSITION_CTRL( parent, title, aUnit, aBoxSizer )
wxPoint( size_to_edit.x, size_to_edit.y ),
aUnit, aBoxSizer, internal_unit )
{ {
} }
...@@ -284,20 +265,17 @@ wxSize EDA_SIZE_CTRL::GetValue() ...@@ -284,20 +265,17 @@ wxSize EDA_SIZE_CTRL::GetValue()
/* Class to display and edit a dimension INCHES, MM, or other */ /* Class to display and edit a dimension INCHES, MM, or other */
/**************************************************************/ /**************************************************************/
EDA_VALUE_CTRL::EDA_VALUE_CTRL( wxWindow* parent, const wxString& title, EDA_VALUE_CTRL::EDA_VALUE_CTRL( wxWindow* parent, const wxString& title,
int value, EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer, int value, EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer )
int internal_unit )
{ {
wxString label = title; wxString label = title;
m_UserUnit = user_unit; m_UserUnit = user_unit;
m_Internal_Unit = internal_unit;
m_Value = value; m_Value = value;
label += ReturnUnitSymbol( m_UserUnit ); 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, 5 );
wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
wxString stringvalue = ReturnStringFromValue( m_UserUnit, m_Value ); wxString stringvalue = ReturnStringFromValue( m_UserUnit, m_Value );
m_ValueCtrl = new wxTextCtrl( parent, -1, stringvalue ); m_ValueCtrl = new wxTextCtrl( parent, -1, stringvalue );
...@@ -321,7 +299,7 @@ int EDA_VALUE_CTRL::GetValue() ...@@ -321,7 +299,7 @@ int EDA_VALUE_CTRL::GetValue()
int coord; int coord;
wxString txtvalue = m_ValueCtrl->GetValue(); wxString txtvalue = m_ValueCtrl->GetValue();
coord = ReturnValueFromString( m_UserUnit, txtvalue, m_Internal_Unit ); coord = ReturnValueFromString( m_UserUnit, txtvalue );
return coord; return coord;
} }
......
...@@ -92,8 +92,7 @@ void DIALOG_SVG_PRINT::OnInitDialog( wxInitDialogEvent& event ) ...@@ -92,8 +92,7 @@ void DIALOG_SVG_PRINT::OnInitDialog( wxInitDialogEvent& event )
void DIALOG_SVG_PRINT::SetPenWidth() void DIALOG_SVG_PRINT::SetPenWidth()
{ {
g_DrawDefaultLineThickness = g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DialogPenWidth );
ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->GetInternalUnits() );
if( g_DrawDefaultLineThickness > WIDTH_MAX_VALUE ) if( g_DrawDefaultLineThickness > WIDTH_MAX_VALUE )
{ {
...@@ -118,7 +117,7 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref ) ...@@ -118,7 +117,7 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
SetPenWidth(); SetPenWidth();
g_DrawDefaultLineThickness = g_DrawDefaultLineThickness =
ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->GetInternalUnits() ); ReturnValueFromTextCtrl( *m_DialogPenWidth );
SCH_SCREEN* screen = (SCH_SCREEN*) m_Parent->GetScreen(); SCH_SCREEN* screen = (SCH_SCREEN*) m_Parent->GetScreen();
......
...@@ -631,8 +631,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel() ...@@ -631,8 +631,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
else else
fieldValueTextCtrl->Enable( true ); fieldValueTextCtrl->Enable( true );
textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( EESCHEMA_INTERNAL_UNIT, textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( g_UserUnit, 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
...@@ -711,11 +710,11 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField() ...@@ -711,11 +710,11 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
setRowItem( fieldNdx, field ); // update fieldListCtrl setRowItem( fieldNdx, field ); // update fieldListCtrl
field.m_Size.x = EDA_GRAPHIC_TEXT_CTRL::ParseSize( textSizeTextCtrl->GetValue(), field.m_Size.x = EDA_GRAPHIC_TEXT_CTRL::ParseSize( textSizeTextCtrl->GetValue(), g_UserUnit );
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();
if( (style & 1 ) != 0 ) if( (style & 1 ) != 0 )
field.m_Italic = true; field.m_Italic = true;
else else
...@@ -726,10 +725,8 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField() ...@@ -726,10 +725,8 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
else else
field.m_Bold = false; field.m_Bold = false;
field.m_Pos.x = ReturnValueFromString( g_UserUnit, posXTextCtrl->GetValue(), field.m_Pos.x = ReturnValueFromString( g_UserUnit, posXTextCtrl->GetValue() );
EESCHEMA_INTERNAL_UNIT ); field.m_Pos.y = ReturnValueFromString( g_UserUnit, posYTextCtrl->GetValue() );
field.m_Pos.y = ReturnValueFromString( g_UserUnit, posYTextCtrl->GetValue(),
EESCHEMA_INTERNAL_UNIT );
return true; return true;
} }
......
...@@ -261,7 +261,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent ) ...@@ -261,7 +261,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent )
m_CurrentText->SetOrientation( m_TextOrient->GetSelection() ); m_CurrentText->SetOrientation( m_TextOrient->GetSelection() );
text = m_TextSize->GetValue(); text = m_TextSize->GetValue();
value = ReturnValueFromString( g_UserUnit, text, m_Parent->GetInternalUnits() ); value = ReturnValueFromString( g_UserUnit, text );
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 )
......
...@@ -658,8 +658,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel() ...@@ -658,8 +658,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
fieldValueTextCtrl->SetValue( field.m_Text ); fieldValueTextCtrl->SetValue( field.m_Text );
textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( EESCHEMA_INTERNAL_UNIT, textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( g_UserUnit, field.m_Size.x ) );
g_UserUnit, field.m_Size.x ) );
wxPoint coord = field.m_Pos; wxPoint coord = field.m_Pos;
wxPoint zero; wxPoint zero;
...@@ -745,8 +744,7 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField() ...@@ -745,8 +744,7 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField()
setRowItem( fieldNdx, field ); // update fieldListCtrl setRowItem( fieldNdx, field ); // update fieldListCtrl
field.m_Size.x = EDA_GRAPHIC_TEXT_CTRL::ParseSize( textSizeTextCtrl->GetValue(), field.m_Size.x = EDA_GRAPHIC_TEXT_CTRL::ParseSize( textSizeTextCtrl->GetValue(), g_UserUnit );
EESCHEMA_INTERNAL_UNIT, g_UserUnit );
field.m_Size.y = field.m_Size.x; field.m_Size.y = field.m_Size.x;
...@@ -761,10 +759,8 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField() ...@@ -761,10 +759,8 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField()
else else
field.m_Bold = false; field.m_Bold = false;
field.m_Pos.x = ReturnValueFromString( g_UserUnit, posXTextCtrl->GetValue(), field.m_Pos.x = ReturnValueFromString( g_UserUnit, posXTextCtrl->GetValue() );
EESCHEMA_INTERNAL_UNIT ); field.m_Pos.y = ReturnValueFromString( g_UserUnit, posYTextCtrl->GetValue() );
field.m_Pos.y = ReturnValueFromString( g_UserUnit, posYTextCtrl->GetValue(),
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
......
...@@ -133,7 +133,7 @@ void DIALOG_EDIT_ONE_FIELD::TransfertDataToField() ...@@ -133,7 +133,7 @@ void DIALOG_EDIT_ONE_FIELD::TransfertDataToField()
{ {
m_textorient = m_Orient->GetValue() ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ; m_textorient = m_Orient->GetValue() ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ;
wxString msg = m_TextSize->GetValue(); wxString msg = m_TextSize->GetValue();
m_textsize = ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ); m_textsize = ReturnValueFromString( g_UserUnit, msg );
switch( m_TextHJustificationOpt->GetSelection() ) switch( m_TextHJustificationOpt->GetSelection() )
{ {
......
#include <fctsys.h> #include <fctsys.h>
#include <macros.h> #include <macros.h>
#include <gr_basic.h> #include <gr_basic.h>
#include <base_units.h>
#include <libeditframe.h> #include <libeditframe.h>
#include <class_libentry.h> #include <class_libentry.h>
#include <lib_pin.h> #include <lib_pin.h>
...@@ -91,11 +93,11 @@ void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event ) ...@@ -91,11 +93,11 @@ void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event )
{ {
if( ! IsShown() ) // do nothing at init time if( ! IsShown() ) // do nothing at init time
return; return;
int units = ((LIB_EDIT_FRAME*)GetParent())->GetInternalUnits();
int pinNameSize = ReturnValueFromString( g_UserUnit, GetNameTextSize(), units ); int pinNameSize = ReturnValueFromString( g_UserUnit, GetNameTextSize() );
int pinNumSize = ReturnValueFromString( g_UserUnit, GetPadNameTextSize(), units); int pinNumSize = ReturnValueFromString( g_UserUnit, GetPadNameTextSize());
int pinOrient = LIB_PIN::GetOrientationCode( GetOrientation() ); int pinOrient = LIB_PIN::GetOrientationCode( GetOrientation() );
int pinLength = ReturnValueFromString( g_UserUnit, GetLength(), units ); int pinLength = ReturnValueFromString( g_UserUnit, GetLength() );
int pinShape = LIB_PIN::GetStyleCode( GetStyle() ); int pinShape = LIB_PIN::GetStyleCode( GetStyle() );
int pinType = GetElectricalType(); int pinType = GetElectricalType();
......
...@@ -148,7 +148,7 @@ void DIALOG_LIB_EDIT_TEXT::OnOkClick( wxCommandEvent& event ) ...@@ -148,7 +148,7 @@ void DIALOG_LIB_EDIT_TEXT::OnOkClick( wxCommandEvent& event )
Line = m_TextValue->GetValue(); Line = m_TextValue->GetValue();
m_parent->m_textOrientation = m_Orient->GetValue() ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ; m_parent->m_textOrientation = 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_UserUnit, msg, m_parent->GetInternalUnits() ); m_parent->m_textSize = ReturnValueFromString( g_UserUnit, msg );
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;
......
...@@ -207,19 +207,19 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::AcceptPlotOffset( wxCommandEvent& event ) ...@@ -207,19 +207,19 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::AcceptPlotOffset( wxCommandEvent& event )
{ {
wxString msg = m_PlotOrgPosition_X->GetValue(); wxString msg = m_PlotOrgPosition_X->GetValue();
s_Offset.x = ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT ); s_Offset.x = ReturnValueFromString( g_UserUnit, msg );
msg = m_PlotOrgPosition_Y->GetValue(); msg = m_PlotOrgPosition_Y->GetValue();
s_Offset.y = ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT ); s_Offset.y = ReturnValueFromString( g_UserUnit, msg );
} }
} }
void DIALOG_PLOT_SCHEMATIC_HPGL::SetPenWidth( ) void DIALOG_PLOT_SCHEMATIC_HPGL::SetPenWidth( )
{ {
g_HPGL_Pen_Descr.m_Pen_Diam = ReturnValueFromTextCtrl( *m_penWidthCtrl, g_HPGL_Pen_Descr.m_Pen_Diam = ReturnValueFromTextCtrl( *m_penWidthCtrl );
EESCHEMA_INTERNAL_UNIT);
if( g_HPGL_Pen_Descr.m_Pen_Diam > 100 ) if( g_HPGL_Pen_Descr.m_Pen_Diam > 100 )
g_HPGL_Pen_Descr.m_Pen_Diam = 100; g_HPGL_Pen_Descr.m_Pen_Diam = 100;
...@@ -262,11 +262,11 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::HPGL_Plot( bool aPlotAll ) ...@@ -262,11 +262,11 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::HPGL_Plot( bool aPlotAll )
{ {
wxString msg = m_PlotOrgPosition_X->GetValue(); wxString msg = m_PlotOrgPosition_X->GetValue();
s_Offset.x = ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT ); s_Offset.x = ReturnValueFromString( g_UserUnit, msg );
msg = m_PlotOrgPosition_Y->GetValue(); msg = m_PlotOrgPosition_Y->GetValue();
s_Offset.y = ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT ); s_Offset.y = ReturnValueFromString( g_UserUnit, msg );
} }
Plot_Schematic_HPGL( aPlotAll ); Plot_Schematic_HPGL( aPlotAll );
......
...@@ -164,8 +164,8 @@ void DIALOG_PLOT_SCHEMATIC_PS::initOptVars() ...@@ -164,8 +164,8 @@ void DIALOG_PLOT_SCHEMATIC_PS::initOptVars()
m_plot_Sheet_Ref = m_Plot_Sheet_Ref_Ctrl->GetValue(); m_plot_Sheet_Ref = m_Plot_Sheet_Ref_Ctrl->GetValue();
m_plotColorOpt = m_PlotPSColorOption->GetSelection(); m_plotColorOpt = m_PlotPSColorOption->GetSelection();
m_pageSizeSelect = m_SizeOption->GetSelection(); m_pageSizeSelect = m_SizeOption->GetSelection();
g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DefaultLineSizeCtrl, g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DefaultLineSizeCtrl );
EESCHEMA_INTERNAL_UNIT );
if( g_DrawDefaultLineThickness < 1 ) if( g_DrawDefaultLineThickness < 1 )
g_DrawDefaultLineThickness = 1; g_DrawDefaultLineThickness = 1;
} }
......
...@@ -119,10 +119,10 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event ) ...@@ -119,10 +119,10 @@ void LIB_EDIT_FRAME::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_UserUnit, dlg.GetNameTextSize(), m_internalUnits ); LastPinNameSize = ReturnValueFromString( g_UserUnit, dlg.GetNameTextSize() );
LastPinNumSize = ReturnValueFromString( g_UserUnit, dlg.GetPadNameTextSize(), m_internalUnits ); LastPinNumSize = ReturnValueFromString( g_UserUnit, dlg.GetPadNameTextSize() );
LastPinOrient = LIB_PIN::GetOrientationCode( dlg.GetOrientation() ); LastPinOrient = LIB_PIN::GetOrientationCode( dlg.GetOrientation() );
LastPinLength = ReturnValueFromString( g_UserUnit, dlg.GetLength(), m_internalUnits ); LastPinLength = ReturnValueFromString( g_UserUnit, dlg.GetLength() );
LastPinShape = LIB_PIN::GetStyleCode( dlg.GetStyle() ); LastPinShape = LIB_PIN::GetStyleCode( dlg.GetStyle() );
LastPinType = dlg.GetElectricalType(); LastPinType = dlg.GetElectricalType();
LastPinCommonConvert = dlg.GetAddToAllBodyStyles(); LastPinCommonConvert = dlg.GetAddToAllBodyStyles();
......
...@@ -189,13 +189,9 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -189,13 +189,9 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
else if( loadFromFile ) else if( loadFromFile )
aSheet->Load( this ); aSheet->Load( this );
aSheet->SetFileNameSize( ReturnValueFromString( g_UserUnit, aSheet->SetFileNameSize( ReturnValueFromString( g_UserUnit, dlg.GetFileNameTextSize() ) );
dlg.GetFileNameTextSize(),
m_internalUnits ) );
aSheet->SetName( dlg.GetSheetName() ); aSheet->SetName( dlg.GetSheetName() );
aSheet->SetSheetNameSize( ReturnValueFromString( g_UserUnit, aSheet->SetSheetNameSize( ReturnValueFromString( g_UserUnit, dlg.GetSheetNameTextSize() ) );
dlg.GetSheetNameTextSize(),
m_internalUnits ) );
if( aSheet->GetName().IsEmpty() ) if( aSheet->GetName().IsEmpty() )
aSheet->SetName( wxString::Format( wxT( "Sheet%8.8lX" ), aSheet->GetTimeStamp() ) ); aSheet->SetName( wxString::Format( wxT( "Sheet%8.8lX" ), aSheet->GetTimeStamp() ) );
......
...@@ -85,8 +85,8 @@ int SCH_EDIT_FRAME::EditSheetPin( SCH_SHEET_PIN* aSheetPin, wxDC* aDC ) ...@@ -85,8 +85,8 @@ int SCH_EDIT_FRAME::EditSheetPin( SCH_SHEET_PIN* aSheetPin, wxDC* aDC )
} }
aSheetPin->m_Text = dlg.GetLabelName(); aSheetPin->m_Text = dlg.GetLabelName();
aSheetPin->m_Size.y = ReturnValueFromString( g_UserUnit, dlg.GetTextHeight(), m_internalUnits ); aSheetPin->m_Size.y = ReturnValueFromString( g_UserUnit, dlg.GetTextHeight() );
aSheetPin->m_Size.x = ReturnValueFromString( g_UserUnit, dlg.GetTextWidth(), m_internalUnits ); aSheetPin->m_Size.x = ReturnValueFromString( g_UserUnit, dlg.GetTextWidth() );
aSheetPin->SetShape( dlg.GetConnectionType() ); aSheetPin->SetShape( dlg.GetConnectionType() );
if( aDC ) if( aDC )
......
...@@ -82,7 +82,7 @@ void LIB_EDIT_FRAME::EditGraphicSymbol( wxDC* DC, LIB_ITEM* DrawItem ) ...@@ -82,7 +82,7 @@ void LIB_EDIT_FRAME::EditGraphicSymbol( wxDC* DC, LIB_ITEM* DrawItem )
return; return;
val = dialog.GetWidth(); val = dialog.GetWidth();
m_drawLineWidth = ReturnValueFromString( g_UserUnit, val, m_internalUnits ); m_drawLineWidth = ReturnValueFromString( g_UserUnit, val );
m_drawSpecificConvert = !dialog.GetApplyToAllConversions(); m_drawSpecificConvert = !dialog.GetApplyToAllConversions();
m_drawSpecificUnit = !dialog.GetApplyToAllUnits(); m_drawSpecificUnit = !dialog.GetApplyToAllUnits();
......
...@@ -93,4 +93,25 @@ wxString ReturnStringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymb ...@@ -93,4 +93,25 @@ wxString ReturnStringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymb
*/ */
void PutValueInLocalUnits( wxTextCtrl& aTextCtr, int aValue ); void PutValueInLocalUnits( wxTextCtrl& aTextCtr, int aValue );
/**
* Return in internal units the value "val" given in inch or mm
*/
int From_User_Unit( EDA_UNITS_T aUnit, double aValue );
/**
* Function ReturnValueFromeString
* converts \a aTextValue in \a aUnits to internal units used by the application.
*
* @param aUnits The units of \a aTextValue.
* @param aTextValue A reference to a wxString object containing the string to convert.
* @return The string from Value, according to units (inch, mm ...) for display,
*/
int ReturnValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue );
/**
* Convert the number Value in a string according to the internal units
* and the selected unit (g_UserUnit) and put it in the wxTextCtrl TextCtrl
*/
int ReturnValueFromTextCtrl( const wxTextCtrl& aTextCtr );
#endif // _BASE_UNITS_H_ #endif // _BASE_UNITS_H_
...@@ -557,23 +557,8 @@ wxString ReturnUnitSymbol( EDA_UNITS_T aUnits = g_UserUnit, ...@@ -557,23 +557,8 @@ wxString ReturnUnitSymbol( EDA_UNITS_T aUnits = g_UserUnit,
wxString GetUnitsLabel( EDA_UNITS_T aUnits ); wxString GetUnitsLabel( EDA_UNITS_T aUnits );
wxString GetAbbreviatedUnitsLabel( EDA_UNITS_T aUnit = g_UserUnit ); wxString GetAbbreviatedUnitsLabel( EDA_UNITS_T aUnit = g_UserUnit );
/**
* Function ReturnValueFromeString
* @return The string from Value, according to units (inch, mm ...) for display,
* and the initial unit for value
* Unit = display units (INCH, MM ..)
* Value = text
* Internal_Unit = units per inch for computed value
*/
int ReturnValueFromString( EDA_UNITS_T aUnit, const wxString& TextValue, int Internal_Unit );
void AddUnitSymbol( wxStaticText& Stext, EDA_UNITS_T aUnit = g_UserUnit ); void AddUnitSymbol( wxStaticText& Stext, EDA_UNITS_T aUnit = g_UserUnit );
/* Convert the number Value in a string according to the internal units
* and the selected unit (g_UserUnit) and put it in the wxTextCtrl TextCtrl
**/
int ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr, int Internal_Unit );
/** /**
* Round to the nearest precision. * Round to the nearest precision.
* *
...@@ -593,11 +578,6 @@ double RoundTo0( double x, double precision ); ...@@ -593,11 +578,6 @@ double RoundTo0( double x, double precision );
*/ */
wxArrayString* wxStringSplit( wxString aString, wxChar aSplitter ); wxArrayString* wxStringSplit( wxString aString, wxChar aSplitter );
/**
* Return in internal units the value "val" given in inch or mm
*/
int From_User_Unit( EDA_UNITS_T aUnit, double val, int internal_unit_value );
/** /**
* Function GenDate * Function GenDate
* @return A wxString object containing the date in the format "day month year" like * @return A wxString object containing the date in the format "day month year" like
......
...@@ -70,7 +70,6 @@ class EDA_GRAPHIC_TEXT_CTRL ...@@ -70,7 +70,6 @@ class EDA_GRAPHIC_TEXT_CTRL
{ {
public: public:
EDA_UNITS_T m_UserUnit; EDA_UNITS_T m_UserUnit;
int m_Internal_Unit;
wxTextCtrl* m_FrameText; wxTextCtrl* m_FrameText;
wxTextCtrl* m_FrameSize; wxTextCtrl* m_FrameSize;
...@@ -80,8 +79,7 @@ private: ...@@ -80,8 +79,7 @@ private:
public: public:
EDA_GRAPHIC_TEXT_CTRL( wxWindow* parent, const wxString& Title, EDA_GRAPHIC_TEXT_CTRL( wxWindow* parent, const wxString& Title,
const wxString& TextToEdit, int textsize, const wxString& TextToEdit, int textsize,
EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer, int framelen = 200, EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer, int framelen = 200 );
int internal_unit = EESCHEMA_INTERNAL_UNIT );
~EDA_GRAPHIC_TEXT_CTRL(); ~EDA_GRAPHIC_TEXT_CTRL();
...@@ -98,10 +96,9 @@ public: ...@@ -98,10 +96,9 @@ 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, EDA_UNITS_T user_unit, int textSize ); static wxString FormatSize( EDA_UNITS_T user_unit, int textSize );
static int ParseSize( const wxString& sizeText, int internalUnit, static int ParseSize( const wxString& sizeText, EDA_UNITS_T user_unit );
EDA_UNITS_T user_unit );
}; };
...@@ -113,7 +110,6 @@ class EDA_POSITION_CTRL ...@@ -113,7 +110,6 @@ class EDA_POSITION_CTRL
{ {
public: public:
EDA_UNITS_T m_UserUnit; EDA_UNITS_T m_UserUnit;
int m_Internal_Unit;
wxPoint m_Pos_To_Edit; wxPoint m_Pos_To_Edit;
wxTextCtrl* m_FramePosX; wxTextCtrl* m_FramePosX;
...@@ -123,9 +119,7 @@ private: ...@@ -123,9 +119,7 @@ private:
public: public:
EDA_POSITION_CTRL( wxWindow* parent, const wxString& title, EDA_POSITION_CTRL( wxWindow* parent, const wxString& title,
const wxPoint& pos_to_edit, const wxPoint& pos_to_edit, EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer );
EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer,
int internal_unit = EESCHEMA_INTERNAL_UNIT );
~EDA_POSITION_CTRL(); ~EDA_POSITION_CTRL();
...@@ -143,9 +137,7 @@ class EDA_SIZE_CTRL : public EDA_POSITION_CTRL ...@@ -143,9 +137,7 @@ class EDA_SIZE_CTRL : public EDA_POSITION_CTRL
{ {
public: public:
EDA_SIZE_CTRL( wxWindow* parent, const wxString& title, EDA_SIZE_CTRL( wxWindow* parent, const wxString& title,
const wxSize& size_to_edit, const wxSize& size_to_edit, EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer );
EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer,
int internal_unit = EESCHEMA_INTERNAL_UNIT );
~EDA_SIZE_CTRL() { } ~EDA_SIZE_CTRL() { }
wxSize GetValue(); wxSize GetValue();
...@@ -162,13 +154,11 @@ public: ...@@ -162,13 +154,11 @@ public:
int m_Value; int m_Value;
wxTextCtrl* m_ValueCtrl; wxTextCtrl* m_ValueCtrl;
private: private:
int m_Internal_Unit;
wxStaticText* m_Text; wxStaticText* m_Text;
public: public:
EDA_VALUE_CTRL( wxWindow* parent, const wxString& title, int value, EDA_VALUE_CTRL( wxWindow* parent, const wxString& title, int value,
EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer, EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer );
int internal_unit = EESCHEMA_INTERNAL_UNIT );
~EDA_VALUE_CTRL(); ~EDA_VALUE_CTRL();
......
...@@ -135,8 +135,7 @@ void DIALOG_SVG_PRINT::initDialog( ) ...@@ -135,8 +135,7 @@ void DIALOG_SVG_PRINT::initDialog( )
void DIALOG_SVG_PRINT::SetPenWidth() void DIALOG_SVG_PRINT::SetPenWidth()
{ {
s_Parameters.m_PenDefaultSize = ReturnValueFromTextCtrl( *m_DialogPenWidth, s_Parameters.m_PenDefaultSize = ReturnValueFromTextCtrl( *m_DialogPenWidth );
m_Parent->GetInternalUnits() );
if( s_Parameters.m_PenDefaultSize > WIDTH_MAX_VALUE ) if( s_Parameters.m_PenDefaultSize > WIDTH_MAX_VALUE )
{ {
......
...@@ -382,8 +382,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab ...@@ -382,8 +382,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab
m_settings.m_FillMode = (m_FillModeCtrl->GetSelection() == 0) ? 0 : 1; m_settings.m_FillMode = (m_FillModeCtrl->GetSelection() == 0) ? 0 : 1;
wxString txtvalue = m_ZoneClearanceCtrl->GetValue(); wxString txtvalue = m_ZoneClearanceCtrl->GetValue();
m_settings.m_ZoneClearance = m_settings.m_ZoneClearance = ReturnValueFromString( g_UserUnit, txtvalue );
ReturnValueFromString( g_UserUnit, txtvalue, m_Parent->GetInternalUnits() );
// 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
...@@ -395,8 +394,8 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab ...@@ -395,8 +394,8 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab
} }
txtvalue = m_ZoneMinThicknessCtrl->GetValue(); txtvalue = m_ZoneMinThicknessCtrl->GetValue();
m_settings.m_ZoneMinThickness = m_settings.m_ZoneMinThickness = ReturnValueFromString( g_UserUnit, txtvalue );
ReturnValueFromString( g_UserUnit, txtvalue, m_Parent->GetInternalUnits() );
if( m_settings.m_ZoneMinThickness < 10 ) if( m_settings.m_ZoneMinThickness < 10 )
{ {
DisplayError( this, DisplayError( this,
...@@ -406,7 +405,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab ...@@ -406,7 +405,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab
m_settings.SetCornerSmoothingType( m_cornerSmoothingChoice->GetSelection() ); m_settings.SetCornerSmoothingType( m_cornerSmoothingChoice->GetSelection() );
txtvalue = m_cornerSmoothingCtrl->GetValue(); txtvalue = m_cornerSmoothingCtrl->GetValue();
m_settings.SetCornerRadius( ReturnValueFromString( g_UserUnit, txtvalue, m_Parent->GetInternalUnits() ) ); m_settings.SetCornerRadius( ReturnValueFromString( g_UserUnit, txtvalue ) );
m_settings.m_ZonePriority = m_PriorityLevelCtrl->GetValue(); m_settings.m_ZonePriority = m_PriorityLevelCtrl->GetValue();
...@@ -415,11 +414,9 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab ...@@ -415,11 +414,9 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab
else else
m_settings.m_Zone_45_Only = true; m_settings.m_Zone_45_Only = true;
m_settings.m_ThermalReliefGap = ReturnValueFromTextCtrl( *m_AntipadSizeValue, PCB_INTERNAL_UNIT ); m_settings.m_ThermalReliefGap = ReturnValueFromTextCtrl( *m_AntipadSizeValue );
m_settings.m_ThermalReliefCopperBridge = ReturnValueFromTextCtrl( m_settings.m_ThermalReliefCopperBridge = ReturnValueFromTextCtrl( *m_CopperWidthValue );
*m_CopperWidthValue,
PCB_INTERNAL_UNIT );
m_Config->Write( ZONE_THERMAL_RELIEF_GAP_STRING_KEY, (long) m_settings.m_ThermalReliefGap ); m_Config->Write( ZONE_THERMAL_RELIEF_GAP_STRING_KEY, (long) m_settings.m_ThermalReliefGap );
......
...@@ -531,7 +531,7 @@ void DIALOG_DESIGN_RULES::InitRulesList() ...@@ -531,7 +531,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_UserUnit, grid->GetCellValue( row, col ), units ) ReturnValueFromString( g_UserUnit, grid->GetCellValue( row, col ) )
nc->SetClearance( MYCELL( GRID_CLEARANCE ) ); nc->SetClearance( MYCELL( GRID_CLEARANCE ) );
nc->SetTrackWidth( MYCELL( GRID_TRACKSIZE ) ); nc->SetTrackWidth( MYCELL( GRID_TRACKSIZE ) );
...@@ -595,22 +595,17 @@ void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard() ...@@ -595,22 +595,17 @@ void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard()
m_BrdSettings.m_CurrentViaType = VIA_BLIND_BURIED; m_BrdSettings.m_CurrentViaType = VIA_BLIND_BURIED;
// Update vias minimum values for DRC // Update vias minimum values for DRC
m_BrdSettings.m_ViasMinSize = m_BrdSettings.m_ViasMinSize = ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl );
ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl, m_Parent->GetInternalUnits() ); m_BrdSettings.m_ViasMinDrill = ReturnValueFromTextCtrl( *m_SetViasMinDrillCtrl );
m_BrdSettings.m_ViasMinDrill =
ReturnValueFromTextCtrl( *m_SetViasMinDrillCtrl, m_Parent->GetInternalUnits() );
m_BrdSettings.m_MicroViasAllowed = m_AllowMicroViaCtrl->GetSelection() == 1; m_BrdSettings.m_MicroViasAllowed = m_AllowMicroViaCtrl->GetSelection() == 1;
// Update microvias minimum values for DRC // Update microvias minimum values for DRC
m_BrdSettings.m_MicroViasMinSize = m_BrdSettings.m_MicroViasMinSize = ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl );
ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl, m_Parent->GetInternalUnits() ); m_BrdSettings.m_MicroViasMinDrill = ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl );
m_BrdSettings.m_MicroViasMinDrill =
ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl, m_Parent->GetInternalUnits() );
// Update tracks minimum values for DRC // Update tracks minimum values for DRC
m_BrdSettings.m_TrackMinWidth = m_BrdSettings.m_TrackMinWidth = ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl );
ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->GetInternalUnits() );
} }
...@@ -625,9 +620,11 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard() ...@@ -625,9 +620,11 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard()
for( int row = 0; row < m_gridTrackWidthList->GetNumberRows(); ++row ) for( int row = 0; row < m_gridTrackWidthList->GetNumberRows(); ++row )
{ {
msg = m_gridTrackWidthList->GetCellValue( row, 0 ); msg = m_gridTrackWidthList->GetCellValue( row, 0 );
if( msg.IsEmpty() ) if( msg.IsEmpty() )
continue; continue;
int value = ReturnValueFromString( g_UserUnit, msg, m_Parent->GetInternalUnits() );
int value = ReturnValueFromString( g_UserUnit, msg );
m_TracksWidthList.push_back( value ); m_TracksWidthList.push_back( value );
} }
...@@ -636,20 +633,25 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard() ...@@ -636,20 +633,25 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard()
// Reinitialize m_TrackWidthList // Reinitialize m_TrackWidthList
m_ViasDimensionsList.clear(); m_ViasDimensionsList.clear();
for( int row = 0; row < m_gridViaSizeList->GetNumberRows(); ++row ) for( int row = 0; row < m_gridViaSizeList->GetNumberRows(); ++row )
{ {
msg = m_gridViaSizeList->GetCellValue( row, 0 ); msg = m_gridViaSizeList->GetCellValue( row, 0 );
if( msg.IsEmpty() ) if( msg.IsEmpty() )
continue; continue;
int value = ReturnValueFromString( g_UserUnit, msg, m_Parent->GetInternalUnits() );
int value = ReturnValueFromString( g_UserUnit, msg );
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_UserUnit, msg, m_Parent->GetInternalUnits() ); value = ReturnValueFromString( g_UserUnit, msg );
via_dim.m_Drill = value; via_dim.m_Drill = value;
} }
m_ViasDimensionsList.push_back( via_dim ); m_ViasDimensionsList.push_back( via_dim );
} }
...@@ -979,23 +981,17 @@ bool DIALOG_DESIGN_RULES::TestDataValidity() ...@@ -979,23 +981,17 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
wxString msg; wxString msg;
int minViaDia = ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl, int minViaDia = ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl );
m_Parent->GetInternalUnits() ); int minViaDrill = ReturnValueFromTextCtrl( *m_SetViasMinDrillCtrl );
int minViaDrill = ReturnValueFromTextCtrl( *m_SetViasMinDrillCtrl, int minUViaDia = ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl );
m_Parent->GetInternalUnits() ); int minUViaDrill = ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl );
int minUViaDia = ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl, int minTrackWidth = ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl );
m_Parent->GetInternalUnits() );
int minUViaDrill = ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl,
m_Parent->GetInternalUnits() );
int minTrackWidth = ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl,
m_Parent->GetInternalUnits() );
for( int row = 0; row < m_grid->GetNumberRows(); row++ ) for( int row = 0; row < m_grid->GetNumberRows(); row++ )
{ {
int tracksize = ReturnValueFromString( g_UserUnit, int tracksize = ReturnValueFromString( g_UserUnit,
m_grid->GetCellValue( row, GRID_TRACKSIZE ), m_grid->GetCellValue( row, GRID_TRACKSIZE ) );
m_Parent->GetInternalUnits() );
if( tracksize < minTrackWidth ) if( tracksize < minTrackWidth )
{ {
result = false; result = false;
...@@ -1007,8 +1003,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity() ...@@ -1007,8 +1003,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
// Test vias // Test vias
int viadia = ReturnValueFromString( g_UserUnit, int viadia = ReturnValueFromString( g_UserUnit,
m_grid->GetCellValue( row, GRID_VIASIZE ), m_grid->GetCellValue( row, GRID_VIASIZE ) );
m_Parent->GetInternalUnits() );
if( viadia < minViaDia ) if( viadia < minViaDia )
{ {
...@@ -1020,8 +1015,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity() ...@@ -1020,8 +1015,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
} }
int viadrill = ReturnValueFromString( g_UserUnit, int viadrill = ReturnValueFromString( g_UserUnit,
m_grid->GetCellValue( row, GRID_VIADRILL ), m_grid->GetCellValue( row, GRID_VIADRILL ) );
m_Parent->GetInternalUnits() );
if( viadrill >= viadia ) if( viadrill >= viadia )
{ {
result = false; result = false;
...@@ -1042,8 +1036,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity() ...@@ -1042,8 +1036,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
// Test Micro vias // Test Micro vias
int muviadia = ReturnValueFromString( g_UserUnit, int muviadia = ReturnValueFromString( g_UserUnit,
m_grid->GetCellValue( row, GRID_uVIASIZE ), m_grid->GetCellValue( row, GRID_uVIASIZE ) );
m_Parent->GetInternalUnits() );
if( muviadia < minUViaDia ) if( muviadia < minUViaDia )
{ {
...@@ -1055,8 +1048,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity() ...@@ -1055,8 +1048,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
} }
int muviadrill = ReturnValueFromString( g_UserUnit, int muviadrill = ReturnValueFromString( g_UserUnit,
m_grid->GetCellValue( row, GRID_uVIADRILL ), m_grid->GetCellValue( row, GRID_uVIADRILL ) );
m_Parent->GetInternalUnits() );
if( muviadrill >= muviadia ) if( muviadrill >= muviadia )
{ {
result = false; result = false;
...@@ -1084,9 +1076,8 @@ bool DIALOG_DESIGN_RULES::TestDataValidity() ...@@ -1084,9 +1076,8 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
if( tvalue.IsEmpty() ) if( tvalue.IsEmpty() )
continue; continue;
int tracksize = ReturnValueFromString( g_UserUnit, int tracksize = ReturnValueFromString( g_UserUnit, tvalue );
tvalue,
m_Parent->GetInternalUnits() );
if( tracksize < minTrackWidth ) if( tracksize < minTrackWidth )
{ {
result = false; result = false;
...@@ -1112,13 +1103,13 @@ bool DIALOG_DESIGN_RULES::TestDataValidity() ...@@ -1112,13 +1103,13 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
if( tvalue.IsEmpty() ) if( tvalue.IsEmpty() )
continue; continue;
int viadia = ReturnValueFromString( g_UserUnit, tvalue, int viadia = ReturnValueFromString( g_UserUnit, tvalue );
m_Parent->GetInternalUnits() );
int viadrill = 0; int viadrill = 0;
wxString drlvalue = m_gridViaSizeList->GetCellValue( row, 1 ); wxString drlvalue = m_gridViaSizeList->GetCellValue( row, 1 );
if( !drlvalue.IsEmpty() ) if( !drlvalue.IsEmpty() )
viadrill = ReturnValueFromString( g_UserUnit, drlvalue, viadrill = ReturnValueFromString( g_UserUnit, drlvalue );
m_Parent->GetInternalUnits() );
if( viadia < minViaDia ) if( viadia < minViaDia )
{ {
result = false; result = false;
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <fctsys.h> #include <fctsys.h>
#include <dialog_drc.h> #include <dialog_drc.h>
#include <wxPcbStruct.h> #include <wxPcbStruct.h>
#include <base_units.h>
#include <class_board_design_settings.h> #include <class_board_design_settings.h>
...@@ -130,12 +131,9 @@ void DIALOG_DRC_CONTROL::InitValues() ...@@ -130,12 +131,9 @@ void DIALOG_DRC_CONTROL::InitValues()
*/ */
void DIALOG_DRC_CONTROL::SetDrcParmeters( ) void DIALOG_DRC_CONTROL::SetDrcParmeters( )
{ {
m_BrdSettings.m_TrackMinWidth = m_BrdSettings.m_TrackMinWidth = ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl );
ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->GetInternalUnits() ); m_BrdSettings.m_ViasMinSize = ReturnValueFromTextCtrl( *m_SetViaMinSizeCtrl );
m_BrdSettings.m_ViasMinSize = m_BrdSettings.m_MicroViasMinSize = ReturnValueFromTextCtrl( *m_SetMicroViakMinSizeCtrl );
ReturnValueFromTextCtrl( *m_SetViaMinSizeCtrl, m_Parent->GetInternalUnits() );
m_BrdSettings.m_MicroViasMinSize =
ReturnValueFromTextCtrl( *m_SetMicroViakMinSizeCtrl, m_Parent->GetInternalUnits() );
m_Parent->GetBoard()->SetDesignSettings( m_BrdSettings ); m_Parent->GetBoard()->SetDesignSettings( m_BrdSettings );
} }
......
...@@ -479,12 +479,9 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event ) ...@@ -479,12 +479,9 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
m_CurrentModule->m_Value->Copy( m_ValueCopy ); m_CurrentModule->m_Value->Copy( m_ValueCopy );
// Initialize masks clearances // Initialize masks clearances
m_CurrentModule->SetLocalClearance( m_CurrentModule->SetLocalClearance( ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl ) );
ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, m_Parent->GetInternalUnits() ) ); m_CurrentModule->SetLocalSolderMaskMargin( ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl ) );
m_CurrentModule->SetLocalSolderMaskMargin( m_CurrentModule->SetLocalSolderPasteMargin( ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl ) );
ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->GetInternalUnits() ) );
m_CurrentModule->SetLocalSolderPasteMargin(
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->GetInternalUnits() ) );
double dtmp = 0.0; double dtmp = 0.0;
msg = m_SolderPasteMarginRatioCtrl->GetValue(); msg = m_SolderPasteMarginRatioCtrl->GetValue();
...@@ -520,8 +517,8 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event ) ...@@ -520,8 +517,8 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
} }
// Set Module Position // Set Module Position
modpos.x = ReturnValueFromTextCtrl( *m_ModPositionX, PCB_INTERNAL_UNIT ); modpos.x = ReturnValueFromTextCtrl( *m_ModPositionX );
modpos.y = ReturnValueFromTextCtrl( *m_ModPositionY, PCB_INTERNAL_UNIT ); modpos.y = ReturnValueFromTextCtrl( *m_ModPositionY );
m_CurrentModule->SetPosition( modpos ); m_CurrentModule->SetPosition( modpos );
if( m_AutoPlaceCtrl->GetSelection() == 1 ) if( m_AutoPlaceCtrl->GetSelection() == 1 )
......
...@@ -367,16 +367,11 @@ void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event ) ...@@ -367,16 +367,11 @@ void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event )
m_CurrentModule->m_Value->Copy(m_ValueCopy ); m_CurrentModule->m_Value->Copy(m_ValueCopy );
// Initialize masks clearances // Initialize masks clearances
int internalUnit = m_Parent->GetInternalUnits(); m_CurrentModule->SetLocalClearance( ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl ) );
m_CurrentModule->SetLocalClearance( m_CurrentModule->SetLocalSolderMaskMargin( ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl ) );
ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, internalUnit ) );
m_CurrentModule->SetLocalSolderMaskMargin( m_CurrentModule->SetLocalSolderPasteMargin( ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl ) );
ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, internalUnit ) );
m_CurrentModule->SetLocalSolderPasteMargin(
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, internalUnit ) );
double dtmp; double dtmp;
wxString msg = m_SolderPasteMarginRatioCtrl->GetValue(); wxString msg = m_SolderPasteMarginRatioCtrl->GetValue();
msg.ToDouble( &dtmp ); msg.ToDouble( &dtmp );
......
...@@ -163,19 +163,17 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event ) ...@@ -163,19 +163,17 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event )
wxPoint tmp; wxPoint tmp;
msg = m_TxtPosCtrlX->GetValue(); msg = m_TxtPosCtrlX->GetValue();
tmp.x = ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ); tmp.x = ReturnValueFromString( g_UserUnit, msg );
msg = m_TxtPosCtrlY->GetValue(); msg = m_TxtPosCtrlY->GetValue();
tmp.y = ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ); tmp.y = ReturnValueFromString( g_UserUnit, msg );
m_currentText->SetPos0( tmp ); m_currentText->SetPos0( tmp );
msg = m_TxtSizeCtrlX->GetValue(); msg = m_TxtSizeCtrlX->GetValue();
m_currentText->m_Size.x = ReturnValueFromString( g_UserUnit, msg, m_currentText->m_Size.x = ReturnValueFromString( g_UserUnit, msg );
m_parent->GetInternalUnits() );
msg = m_TxtSizeCtrlY->GetValue(); msg = m_TxtSizeCtrlY->GetValue();
m_currentText->m_Size.y = ReturnValueFromString( g_UserUnit, msg, m_currentText->m_Size.y = ReturnValueFromString( g_UserUnit, msg );
m_parent->GetInternalUnits() );
// Test for a reasonnable size: // Test for a reasonnable size:
if( m_currentText->m_Size.x< TEXTS_MIN_SIZE ) if( m_currentText->m_Size.x< TEXTS_MIN_SIZE )
...@@ -184,7 +182,7 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event ) ...@@ -184,7 +182,7 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event )
m_currentText->m_Size.y = TEXTS_MIN_SIZE; m_currentText->m_Size.y = TEXTS_MIN_SIZE;
msg = m_TxtWidthCtlr->GetValue(); msg = m_TxtWidthCtlr->GetValue();
int width = ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ); int width = ReturnValueFromString( g_UserUnit, msg );
// Test for a reasonnable width: // Test for a reasonnable width:
if( width <= 1 ) if( width <= 1 )
......
...@@ -199,22 +199,22 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event ) ...@@ -199,22 +199,22 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event )
m_Item->Draw( m_parent->GetCanvas(), m_DC, GR_XOR ); m_Item->Draw( m_parent->GetCanvas(), m_DC, GR_XOR );
msg = m_Center_StartXCtrl->GetValue(); msg = m_Center_StartXCtrl->GetValue();
m_Item->SetStartX( ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() )); m_Item->SetStartX( ReturnValueFromString( g_UserUnit, msg ) );
msg = m_Center_StartYCtrl->GetValue(); msg = m_Center_StartYCtrl->GetValue();
m_Item->SetStartY( ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() )); m_Item->SetStartY( ReturnValueFromString( g_UserUnit, msg ) );
msg = m_EndX_Radius_Ctrl->GetValue(); msg = m_EndX_Radius_Ctrl->GetValue();
m_Item->SetEndX( ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() )); m_Item->SetEndX( ReturnValueFromString( g_UserUnit, msg ) );
msg = m_EndY_Ctrl->GetValue(); msg = m_EndY_Ctrl->GetValue();
m_Item->SetEndY( ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() )); m_Item->SetEndY( ReturnValueFromString( g_UserUnit, msg ) );
msg = m_ThicknessCtrl->GetValue(); msg = m_ThicknessCtrl->GetValue();
m_Item->SetWidth( ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() )); m_Item->SetWidth( ReturnValueFromString( g_UserUnit, msg ) );
msg = m_DefaultThicknessCtrl->GetValue(); msg = m_DefaultThicknessCtrl->GetValue();
int thickness = ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ); int thickness = ReturnValueFromString( g_UserUnit, msg );
m_Item->SetLayer( m_LayerSelectionCtrl->GetCurrentSelection() + FIRST_NO_COPPER_LAYER); m_Item->SetLayer( m_LayerSelectionCtrl->GetCurrentSelection() + FIRST_NO_COPPER_LAYER);
......
...@@ -213,24 +213,24 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event ) ...@@ -213,24 +213,24 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event )
wxPoint coord; wxPoint coord;
msg = m_Center_StartXCtrl->GetValue(); msg = m_Center_StartXCtrl->GetValue();
coord.x = ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ); coord.x = ReturnValueFromString( g_UserUnit, msg );
msg = m_Center_StartYCtrl->GetValue(); msg = m_Center_StartYCtrl->GetValue();
coord.y = ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ); coord.y = ReturnValueFromString( g_UserUnit, msg );
m_item->SetStart( coord ); m_item->SetStart( coord );
m_item->SetStart0( coord ); m_item->SetStart0( coord );
msg = m_EndX_Radius_Ctrl->GetValue(); msg = m_EndX_Radius_Ctrl->GetValue();
coord.x = ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ); coord.x = ReturnValueFromString( g_UserUnit, msg );
msg = m_EndY_Ctrl->GetValue(); msg = m_EndY_Ctrl->GetValue();
coord.y = ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ); coord.y = ReturnValueFromString( g_UserUnit, msg );
m_item->SetEnd( coord ); m_item->SetEnd( coord );
m_item->SetEnd0( coord ); m_item->SetEnd0( coord );
msg = m_ThicknessCtrl->GetValue(); msg = m_ThicknessCtrl->GetValue();
m_item->SetWidth( ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() )); m_item->SetWidth( ReturnValueFromString( g_UserUnit, msg ) );
msg = m_DefaultThicknessCtrl->GetValue(); msg = m_DefaultThicknessCtrl->GetValue();
int thickness = ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ); int thickness = ReturnValueFromString( g_UserUnit, msg );
m_brdSettings.m_ModuleSegmentWidth = thickness; m_brdSettings.m_ModuleSegmentWidth = thickness;
m_parent->SetDesignSettings( m_brdSettings ); m_parent->SetDesignSettings( m_brdSettings );
......
...@@ -97,30 +97,20 @@ void DIALOG_GRAPHIC_ITEMS_OPTIONS::initValues() ...@@ -97,30 +97,20 @@ void DIALOG_GRAPHIC_ITEMS_OPTIONS::initValues()
void DIALOG_GRAPHIC_ITEMS_OPTIONS::OnOkClick( wxCommandEvent& event ) void DIALOG_GRAPHIC_ITEMS_OPTIONS::OnOkClick( wxCommandEvent& event )
{ {
m_brdSettings.m_DrawSegmentWidth = m_brdSettings.m_DrawSegmentWidth = ReturnValueFromTextCtrl( *m_OptPcbSegmWidth );
ReturnValueFromTextCtrl( *m_OptPcbSegmWidth, PCB_INTERNAL_UNIT ); m_brdSettings.m_EdgeSegmentWidth = ReturnValueFromTextCtrl( *m_OptPcbEdgesWidth );
m_brdSettings.m_EdgeSegmentWidth = m_brdSettings.m_PcbTextWidth = ReturnValueFromTextCtrl( *m_OptPcbTextWidth );
ReturnValueFromTextCtrl( *m_OptPcbEdgesWidth, PCB_INTERNAL_UNIT ); m_brdSettings.m_PcbTextSize.y = ReturnValueFromTextCtrl( *m_OptPcbTextVSize );
m_brdSettings.m_PcbTextWidth = m_brdSettings.m_PcbTextSize.x = ReturnValueFromTextCtrl( *m_OptPcbTextHSize );
ReturnValueFromTextCtrl( *m_OptPcbTextWidth, PCB_INTERNAL_UNIT );
m_brdSettings.m_PcbTextSize.y =
ReturnValueFromTextCtrl( *m_OptPcbTextVSize, PCB_INTERNAL_UNIT );
m_brdSettings.m_PcbTextSize.x =
ReturnValueFromTextCtrl( *m_OptPcbTextHSize, PCB_INTERNAL_UNIT );
m_parent->GetBoard()->SetDesignSettings( m_brdSettings ); m_parent->GetBoard()->SetDesignSettings( m_brdSettings );
m_brdSettings.m_ModuleSegmentWidth = m_brdSettings.m_ModuleSegmentWidth = ReturnValueFromTextCtrl( *m_OptModuleEdgesWidth );
ReturnValueFromTextCtrl( *m_OptModuleEdgesWidth, PCB_INTERNAL_UNIT ); m_brdSettings.m_ModuleTextWidth = ReturnValueFromTextCtrl( *m_OptModuleTextWidth );
m_brdSettings.m_ModuleTextWidth = m_brdSettings.m_ModuleTextSize.y = ReturnValueFromTextCtrl( *m_OptModuleTextVSize );
ReturnValueFromTextCtrl( *m_OptModuleTextWidth, PCB_INTERNAL_UNIT ); m_brdSettings.m_ModuleTextSize.x = ReturnValueFromTextCtrl( *m_OptModuleTextHSize );
m_brdSettings.m_ModuleTextSize.y =
ReturnValueFromTextCtrl( *m_OptModuleTextVSize, PCB_INTERNAL_UNIT ); g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DefaultPenSizeCtrl );
m_brdSettings.m_ModuleTextSize.x =
ReturnValueFromTextCtrl( *m_OptModuleTextHSize, PCB_INTERNAL_UNIT );
g_DrawDefaultLineThickness =
ReturnValueFromTextCtrl( *m_DefaultPenSizeCtrl, PCB_INTERNAL_UNIT );
if( g_DrawDefaultLineThickness < 0 ) if( g_DrawDefaultLineThickness < 0 )
g_DrawDefaultLineThickness = 0; g_DrawDefaultLineThickness = 0;
......
...@@ -83,11 +83,9 @@ void DIALOG_PADS_MASK_CLEARANCE::MyInit() ...@@ -83,11 +83,9 @@ void DIALOG_PADS_MASK_CLEARANCE::MyInit()
void DIALOG_PADS_MASK_CLEARANCE::OnButtonOkClick( wxCommandEvent& event ) void DIALOG_PADS_MASK_CLEARANCE::OnButtonOkClick( wxCommandEvent& event )
{ {
m_BrdSettings.m_SolderMaskMargin = m_BrdSettings.m_SolderMaskMargin = ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl );
ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->GetInternalUnits() );
m_BrdSettings.m_SolderPasteMargin = m_BrdSettings.m_SolderPasteMargin = ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl );
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->GetInternalUnits() );
double dtmp = 0; double dtmp = 0;
wxString msg = m_SolderPasteMarginRatioCtrl->GetValue(); wxString msg = m_SolderPasteMarginRatioCtrl->GetValue();
......
...@@ -848,7 +848,6 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event ) ...@@ -848,7 +848,6 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad ) bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
{ {
long padLayerMask; long padLayerMask;
int internalUnits = m_Parent->GetInternalUnits();
wxString msg; wxString msg;
int x, y; int x, y;
...@@ -856,16 +855,11 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad ) ...@@ -856,16 +855,11 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
aPad->SetShape( CodeShape[m_PadShape->GetSelection()] ); aPad->SetShape( CodeShape[m_PadShape->GetSelection()] );
// Read pad clearances values: // Read pad clearances values:
aPad->SetLocalClearance( ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, aPad->SetLocalClearance( ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl ) );
internalUnits ) ); aPad->SetLocalSolderMaskMargin( ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl ) );
aPad->SetLocalSolderMaskMargin( ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, aPad->SetLocalSolderPasteMargin( ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl ) );
internalUnits ) ); aPad->SetThermalWidth( ReturnValueFromTextCtrl( *m_ThermalWidthCtrl ) );
aPad->SetLocalSolderPasteMargin( ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, aPad->SetThermalGap( ReturnValueFromTextCtrl( *m_ThermalGapCtrl ) );
internalUnits ) );
aPad->SetThermalWidth( ReturnValueFromTextCtrl( *m_ThermalWidthCtrl,
internalUnits ) );
aPad->SetThermalGap( ReturnValueFromTextCtrl( *m_ThermalGapCtrl,
internalUnits ) );
double dtmp = 0.0; double dtmp = 0.0;
msg = m_SolderPasteMarginRatioCtrl->GetValue(); msg = m_SolderPasteMarginRatioCtrl->GetValue();
msg.ToDouble( &dtmp ); msg.ToDouble( &dtmp );
...@@ -899,15 +893,15 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad ) ...@@ -899,15 +893,15 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
} }
// Read pad position: // Read pad position:
x = ReturnValueFromTextCtrl( *m_PadPosition_X_Ctrl, internalUnits ); x = ReturnValueFromTextCtrl( *m_PadPosition_X_Ctrl );
y = ReturnValueFromTextCtrl( *m_PadPosition_Y_Ctrl, internalUnits ); y = ReturnValueFromTextCtrl( *m_PadPosition_Y_Ctrl );
aPad->SetPosition( wxPoint( x, y ) ); aPad->SetPosition( wxPoint( x, y ) );
aPad->SetPos0( wxPoint( x, y ) ); aPad->SetPos0( wxPoint( x, y ) );
// Read pad drill: // Read pad drill:
x = ReturnValueFromTextCtrl( *m_PadDrill_X_Ctrl, internalUnits ); x = ReturnValueFromTextCtrl( *m_PadDrill_X_Ctrl );
y = ReturnValueFromTextCtrl( *m_PadDrill_Y_Ctrl, internalUnits ); y = ReturnValueFromTextCtrl( *m_PadDrill_Y_Ctrl );
if( m_DrillShapeCtrl->GetSelection() == 0 ) if( m_DrillShapeCtrl->GetSelection() == 0 )
{ {
...@@ -920,24 +914,24 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad ) ...@@ -920,24 +914,24 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
aPad->SetDrillSize( wxSize( x, y ) ); aPad->SetDrillSize( wxSize( x, y ) );
// Read pad shape size: // Read pad shape size:
x = ReturnValueFromTextCtrl( *m_ShapeSize_X_Ctrl, internalUnits ); x = ReturnValueFromTextCtrl( *m_ShapeSize_X_Ctrl );
y = ReturnValueFromTextCtrl( *m_ShapeSize_Y_Ctrl, internalUnits ); y = ReturnValueFromTextCtrl( *m_ShapeSize_Y_Ctrl );
if( aPad->GetShape() == PAD_CIRCLE ) if( aPad->GetShape() == PAD_CIRCLE )
y = x; y = x;
aPad->SetSize( wxSize( x, y ) ); aPad->SetSize( wxSize( x, y ) );
// Read pad length die // Read pad length die
aPad->SetDieLength( ReturnValueFromTextCtrl( *m_LengthDieCtrl, internalUnits ) ); aPad->SetDieLength( ReturnValueFromTextCtrl( *m_LengthDieCtrl ) );
// Read pad shape delta size: // Read pad shape delta size:
// m_DeltaSize.x or m_DeltaSize.y must be NULL. for a trapezoid. // m_DeltaSize.x or m_DeltaSize.y must be NULL. for a trapezoid.
wxSize delta; wxSize delta;
if( m_trapDeltaDirChoice->GetSelection() == 0 ) if( m_trapDeltaDirChoice->GetSelection() == 0 )
delta.x = ReturnValueFromTextCtrl( *m_ShapeDelta_Ctrl, internalUnits ); delta.x = ReturnValueFromTextCtrl( *m_ShapeDelta_Ctrl );
else else
delta.y = ReturnValueFromTextCtrl( *m_ShapeDelta_Ctrl, internalUnits ); delta.y = ReturnValueFromTextCtrl( *m_ShapeDelta_Ctrl );
// Test bad values (be sure delta values are not too large) // Test bad values (be sure delta values are not too large)
// remember DeltaSize.x is the Y size variation // remember DeltaSize.x is the Y size variation
...@@ -970,8 +964,8 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad ) ...@@ -970,8 +964,8 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
aPad->SetDelta( delta ); aPad->SetDelta( delta );
// Read pad shape offset: // Read pad shape offset:
x = ReturnValueFromTextCtrl( *m_ShapeOffset_X_Ctrl, internalUnits ); x = ReturnValueFromTextCtrl( *m_ShapeOffset_X_Ctrl );
y = ReturnValueFromTextCtrl( *m_ShapeOffset_Y_Ctrl, internalUnits ); y = ReturnValueFromTextCtrl( *m_ShapeOffset_Y_Ctrl );
aPad->SetOffset( wxPoint( x, y ) ); aPad->SetOffset( wxPoint( x, y ) );
double orient_value = 0; double orient_value = 0;
......
...@@ -219,17 +219,13 @@ void DIALOG_PCB_TEXT_PROPERTIES::OnOkClick( wxCommandEvent& event ) ...@@ -219,17 +219,13 @@ void DIALOG_PCB_TEXT_PROPERTIES::OnOkClick( wxCommandEvent& event )
} }
// Set PCB Text position // Set PCB Text position
newPosition.x = ReturnValueFromString( g_UserUnit, m_PositionXCtrl->GetValue(), newPosition.x = ReturnValueFromString( g_UserUnit, m_PositionXCtrl->GetValue() );
m_Parent->GetInternalUnits() ); newPosition.y = ReturnValueFromString( g_UserUnit, m_PositionYCtrl->GetValue() );
newPosition.y = ReturnValueFromString( g_UserUnit, m_PositionYCtrl->GetValue(),
m_Parent->GetInternalUnits() );
m_SelectedPCBText->m_Pos = newPosition; m_SelectedPCBText->m_Pos = newPosition;
// Check constraints and set PCB Text size // Check constraints and set PCB Text size
newSize.x = ReturnValueFromString( g_UserUnit, m_SizeXCtrl->GetValue(), newSize.x = ReturnValueFromString( g_UserUnit, m_SizeXCtrl->GetValue() );
m_Parent->GetInternalUnits() ); newSize.y = ReturnValueFromString( g_UserUnit, m_SizeYCtrl->GetValue() );
newSize.y = ReturnValueFromString( g_UserUnit, m_SizeYCtrl->GetValue(),
m_Parent->GetInternalUnits() );
if( newSize.x < TEXTS_MIN_SIZE ) if( newSize.x < TEXTS_MIN_SIZE )
newSize.x = TEXTS_MIN_SIZE; newSize.x = TEXTS_MIN_SIZE;
...@@ -247,8 +243,7 @@ void DIALOG_PCB_TEXT_PROPERTIES::OnOkClick( wxCommandEvent& event ) ...@@ -247,8 +243,7 @@ void DIALOG_PCB_TEXT_PROPERTIES::OnOkClick( wxCommandEvent& event )
// Set the new thickness // Set the new thickness
m_SelectedPCBText->m_Thickness = ReturnValueFromString( g_UserUnit, m_SelectedPCBText->m_Thickness = ReturnValueFromString( g_UserUnit,
m_ThicknessCtrl->GetValue(), m_ThicknessCtrl->GetValue() );
m_Parent->GetInternalUnits() );
// Test for acceptable values for thickness and size and clamp if fails // Test for acceptable values for thickness and size and clamp if fails
int maxthickness = Clamp_Text_PenSize( m_SelectedPCBText->m_Thickness, int maxthickness = Clamp_Text_PenSize( m_SelectedPCBText->m_Thickness,
......
...@@ -385,7 +385,7 @@ void DIALOG_PRINT_USING_PRINTER::SetPenWidth() ...@@ -385,7 +385,7 @@ void DIALOG_PRINT_USING_PRINTER::SetPenWidth()
// Get the new pen width value, and verify min et max value // Get the new pen width value, and verify min et max value
// NOTE: s_Parameters.m_PenDefaultSize is in internal units // NOTE: s_Parameters.m_PenDefaultSize is in internal units
s_Parameters.m_PenDefaultSize = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_parent->GetInternalUnits() ); s_Parameters.m_PenDefaultSize = ReturnValueFromTextCtrl( *m_DialogPenWidth );
if( s_Parameters.m_PenDefaultSize > WIDTH_MAX_VALUE ) if( s_Parameters.m_PenDefaultSize > WIDTH_MAX_VALUE )
{ {
......
...@@ -144,25 +144,20 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event ) ...@@ -144,25 +144,20 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event )
// Get new size value: // Get new size value:
msg = m_TxtSizeXCtrl->GetValue(); msg = m_TxtSizeXCtrl->GetValue();
CurrentDimension->m_Text.m_Size.x = ReturnValueFromString( g_UserUnit, msg, CurrentDimension->m_Text.m_Size.x = ReturnValueFromString( g_UserUnit, msg );
m_Parent->GetInternalUnits() );
msg = m_TxtSizeYCtrl->GetValue(); msg = m_TxtSizeYCtrl->GetValue();
CurrentDimension->m_Text.m_Size.y = ReturnValueFromString( g_UserUnit, msg, CurrentDimension->m_Text.m_Size.y = ReturnValueFromString( g_UserUnit, msg );
m_Parent->GetInternalUnits() );
// Get new position value: // Get new position value:
// It will be copied later in dimension, because // It will be copied later in dimension, because
msg = m_textCtrlPosX->GetValue(); msg = m_textCtrlPosX->GetValue();
CurrentDimension->m_Text.m_Pos.x = ReturnValueFromString( g_UserUnit, msg, CurrentDimension->m_Text.m_Pos.x = ReturnValueFromString( g_UserUnit, msg );
m_Parent->GetInternalUnits() );
msg = m_textCtrlPosY->GetValue(); msg = m_textCtrlPosY->GetValue();
CurrentDimension->m_Text.m_Pos.y = ReturnValueFromString( g_UserUnit, msg, CurrentDimension->m_Text.m_Pos.y = ReturnValueFromString( g_UserUnit, msg );
m_Parent->GetInternalUnits() );
// Get new line thickness value: // Get new line thickness value:
msg = m_TxtWidthCtrl->GetValue(); msg = m_TxtWidthCtrl->GetValue();
int width = ReturnValueFromString( g_UserUnit, msg, int width = ReturnValueFromString( g_UserUnit, msg );
m_Parent->GetInternalUnits() );
int maxthickness = Clamp_Text_PenSize( width, CurrentDimension->m_Text.m_Size ); int maxthickness = Clamp_Text_PenSize( width, CurrentDimension->m_Text.m_Size );
if( width > maxthickness ) if( width > maxthickness )
......
...@@ -246,8 +246,7 @@ void FOOTPRINT_EDIT_FRAME::Enter_Edge_Width( EDGE_MODULE* aEdge ) ...@@ -246,8 +246,7 @@ void FOOTPRINT_EDIT_FRAME::Enter_Edge_Width( EDGE_MODULE* aEdge )
return; // canceled by user return; // canceled by user
buffer = dlg.GetValue( ); buffer = dlg.GetValue( );
GetDesignSettings().m_ModuleSegmentWidth = GetDesignSettings().m_ModuleSegmentWidth = ReturnValueFromString( g_UserUnit, buffer );
ReturnValueFromString( g_UserUnit, buffer, GetScreen()->GetInternalUnits() );
if( aEdge ) if( aEdge )
{ {
......
...@@ -103,14 +103,12 @@ TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME ...@@ -103,14 +103,12 @@ TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME
// Size: // Size:
m_MireSizeCtrl = new EDA_VALUE_CTRL( this, _( "Size" ), m_MireSizeCtrl = new EDA_VALUE_CTRL( this, _( "Size" ),
m_Target->GetSize(), m_Target->GetSize(),
g_UserUnit, LeftBoxSizer, g_UserUnit, LeftBoxSizer );
m_Parent->GetInternalUnits() );
// Width: // Width:
m_MireWidthCtrl = new EDA_VALUE_CTRL( this, _( "Width" ), m_MireWidthCtrl = new EDA_VALUE_CTRL( this, _( "Width" ),
m_Target->GetWidth(), m_Target->GetWidth(),
g_UserUnit, LeftBoxSizer, g_UserUnit, LeftBoxSizer );
m_Parent->GetInternalUnits() );
// Shape // Shape
wxString shape_list[2] = { _( "shape +" ), _( "shape X" ) }; wxString shape_list[2] = { _( "shape +" ), _( "shape X" ) };
......
...@@ -205,7 +205,7 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC ) ...@@ -205,7 +205,7 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
return NULL; // canceled by user return NULL; // canceled by user
msg = dlg.GetValue(); msg = dlg.GetValue();
Mself.lng = ReturnValueFromString( g_UserUnit, msg, GetScreen()->GetInternalUnits() ); Mself.lng = ReturnValueFromString( g_UserUnit, msg );
// Control values (ii = minimum length) // Control values (ii = minimum length)
if( Mself.lng < min_len ) if( Mself.lng < min_len )
...@@ -621,7 +621,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type ) ...@@ -621,7 +621,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
} }
value = dlg.GetValue(); value = dlg.GetValue();
gap_size = ReturnValueFromString( g_UserUnit, value, GetScreen()->GetInternalUnits() ); gap_size = ReturnValueFromString( g_UserUnit, value );
bool abort = false; bool abort = false;
...@@ -821,9 +821,7 @@ WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent, ...@@ -821,9 +821,7 @@ WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent,
wxRA_SPECIFY_COLS ); wxRA_SPECIFY_COLS );
LeftBoxSizer->Add( m_ShapeOptionCtrl, 0, wxGROW | wxALL, 5 ); LeftBoxSizer->Add( m_ShapeOptionCtrl, 0, wxGROW | wxALL, 5 );
m_SizeCtrl = new EDA_SIZE_CTRL( this, _( "Size" ), ShapeSize, m_SizeCtrl = new EDA_SIZE_CTRL( this, _( "Size" ), ShapeSize, g_UserUnit, LeftBoxSizer );
g_UserUnit, LeftBoxSizer,
PCB_INTERNAL_UNIT );
GetSizer()->Fit( this ); GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
...@@ -1094,7 +1092,7 @@ void PCB_EDIT_FRAME::Edit_Gap( wxDC* DC, MODULE* aModule ) ...@@ -1094,7 +1092,7 @@ void PCB_EDIT_FRAME::Edit_Gap( wxDC* DC, MODULE* aModule )
return; // cancelled by user return; // cancelled by user
msg = dlg.GetValue(); msg = dlg.GetValue();
gap_size = ReturnValueFromString( g_UserUnit, msg, GetScreen()->GetInternalUnits() ); gap_size = ReturnValueFromString( g_UserUnit, msg );
// Updating sizes of pads forming the gap. // Updating sizes of pads forming the gap.
int tw = GetBoard()->GetCurrentTrackWidth(); int tw = GetBoard()->GetCurrentTrackWidth();
......
...@@ -450,7 +450,7 @@ void DIALOG_PLOT::applyPlotSettings() ...@@ -450,7 +450,7 @@ void DIALOG_PLOT::applyPlotSettings()
// since the values may have been constrained by the setters. // since the values may have been constrained by the setters.
// HPLG pen size // HPLG pen size
wxString msg = m_HPGLPenSizeOpt->GetValue(); wxString msg = m_HPGLPenSizeOpt->GetValue();
int tmp = ReturnValueFromString( g_UserUnit, msg, UNITS_MILS ); int tmp = ReturnValueFromString( g_UserUnit, msg );
if( !tempOptions.SetHpglPenDiameter( tmp ) ) if( !tempOptions.SetHpglPenDiameter( tmp ) )
{ {
...@@ -462,7 +462,7 @@ void DIALOG_PLOT::applyPlotSettings() ...@@ -462,7 +462,7 @@ void DIALOG_PLOT::applyPlotSettings()
// HPGL pen speed // HPGL pen speed
msg = m_HPGLPenSpeedOpt->GetValue(); msg = m_HPGLPenSpeedOpt->GetValue();
tmp = ReturnValueFromString( UNSCALED_UNITS, msg, 1 ); tmp = ReturnValueFromString( UNSCALED_UNITS, msg );
if( !tempOptions.SetHpglPenSpeed( tmp ) ) if( !tempOptions.SetHpglPenSpeed( tmp ) )
{ {
...@@ -474,7 +474,7 @@ void DIALOG_PLOT::applyPlotSettings() ...@@ -474,7 +474,7 @@ void DIALOG_PLOT::applyPlotSettings()
// HPGL pen overlay // HPGL pen overlay
msg = m_HPGLPenOverlayOpt->GetValue(); msg = m_HPGLPenOverlayOpt->GetValue();
tmp = ReturnValueFromString( g_UserUnit, msg, UNITS_MILS ); tmp = ReturnValueFromString( g_UserUnit, msg );
if( !tempOptions.SetHpglPenOverlay( tmp ) ) if( !tempOptions.SetHpglPenOverlay( tmp ) )
{ {
...@@ -486,7 +486,7 @@ void DIALOG_PLOT::applyPlotSettings() ...@@ -486,7 +486,7 @@ void DIALOG_PLOT::applyPlotSettings()
// Default linewidth // Default linewidth
msg = m_linesWidth->GetValue(); msg = m_linesWidth->GetValue();
tmp = ReturnValueFromString( g_UserUnit, msg, PCB_INTERNAL_UNIT ); tmp = ReturnValueFromString( g_UserUnit, msg );
if( !tempOptions.SetPlotLineWidth( tmp ) ) if( !tempOptions.SetPlotLineWidth( tmp ) )
{ {
...@@ -527,7 +527,7 @@ void DIALOG_PLOT::applyPlotSettings() ...@@ -527,7 +527,7 @@ void DIALOG_PLOT::applyPlotSettings()
// PS Width correction // PS Width correction
msg = m_PSFineAdjustWidthOpt->GetValue(); msg = m_PSFineAdjustWidthOpt->GetValue();
tmpDouble = ReturnValueFromString( g_UserUnit, msg, PCB_INTERNAL_UNIT ); tmpDouble = ReturnValueFromString( g_UserUnit, msg );
if( !setDouble( &m_PSWidthAdjust, tmpDouble, m_WidthAdjustMinValue, m_WidthAdjustMaxValue ) ) if( !setDouble( &m_PSWidthAdjust, tmpDouble, m_WidthAdjustMinValue, m_WidthAdjustMaxValue ) )
{ {
......
...@@ -125,8 +125,8 @@ wxPoint DIALOG_SET_GRID::GetGridOrigin() ...@@ -125,8 +125,8 @@ wxPoint DIALOG_SET_GRID::GetGridOrigin()
wxPoint grid; wxPoint grid;
/* TODO: Some error checking here would be a good thing. */ /* TODO: Some error checking here would be a good thing. */
grid.x = ReturnValueFromTextCtrl( *m_GridOriginXCtrl, m_internalUnits ); grid.x = ReturnValueFromTextCtrl( *m_GridOriginXCtrl );
grid.y = ReturnValueFromTextCtrl( *m_GridOriginYCtrl, m_internalUnits ); grid.y = ReturnValueFromTextCtrl( *m_GridOriginYCtrl );
return grid; return grid;
} }
......
...@@ -128,8 +128,7 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::OnOkClick( wxCommandEvent& event ) ...@@ -128,8 +128,7 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::OnOkClick( wxCommandEvent& event )
{ {
wxString txtvalue = m_ZoneMinThicknessCtrl->GetValue(); wxString txtvalue = m_ZoneMinThicknessCtrl->GetValue();
m_settings.m_ZoneMinThickness = m_settings.m_ZoneMinThickness = ReturnValueFromString( g_UserUnit, txtvalue );
ReturnValueFromString( g_UserUnit, txtvalue, m_Parent->GetInternalUnits() );
if( m_settings.m_ZoneMinThickness < 10 ) if( m_settings.m_ZoneMinThickness < 10 )
{ {
......
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