Fixes: lp:1622164 (pl-editor does not accept both '.' and ',' as floating point separator in countries which use ',' as separator)
https://bugs.launchpad.net/kicad/+bug/1622164
This commit is contained in:
parent
104a066268
commit
89a9b9177f
|
@ -83,42 +83,33 @@ void PROPERTIES_FRAME::CopyPrmsFromGeneralToPanel()
|
||||||
// Data transfert from widgets to general properties
|
// Data transfert from widgets to general properties
|
||||||
bool PROPERTIES_FRAME::CopyPrmsFromPanelToGeneral()
|
bool PROPERTIES_FRAME::CopyPrmsFromPanelToGeneral()
|
||||||
{
|
{
|
||||||
double dtmp;
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
// Import default parameters from widgets
|
// Import default parameters from widgets
|
||||||
msg = m_textCtrlDefaultLineWidth->GetValue();
|
msg = m_textCtrlDefaultLineWidth->GetValue();
|
||||||
msg.ToDouble( &dtmp );
|
WORKSHEET_DATAITEM::m_DefaultLineWidth = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||||
WORKSHEET_DATAITEM::m_DefaultLineWidth = dtmp;
|
|
||||||
|
|
||||||
msg = m_textCtrlDefaultTextSizeX->GetValue();
|
msg = m_textCtrlDefaultTextSizeX->GetValue();
|
||||||
msg.ToDouble( &dtmp );
|
WORKSHEET_DATAITEM::m_DefaultTextSize.x = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||||
WORKSHEET_DATAITEM::m_DefaultTextSize.x = dtmp;
|
|
||||||
msg = m_textCtrlDefaultTextSizeY->GetValue();
|
msg = m_textCtrlDefaultTextSizeY->GetValue();
|
||||||
msg.ToDouble( &dtmp );
|
WORKSHEET_DATAITEM::m_DefaultTextSize.y = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||||
WORKSHEET_DATAITEM::m_DefaultTextSize.y = dtmp;
|
|
||||||
|
|
||||||
msg = m_textCtrlDefaultTextThickness->GetValue();
|
msg = m_textCtrlDefaultTextThickness->GetValue();
|
||||||
msg.ToDouble( &dtmp );
|
WORKSHEET_DATAITEM::m_DefaultTextThickness = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||||
WORKSHEET_DATAITEM::m_DefaultTextThickness = dtmp;
|
|
||||||
|
|
||||||
// Get page margins values
|
// Get page margins values
|
||||||
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
|
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
|
||||||
|
|
||||||
msg = m_textCtrlRightMargin->GetValue();
|
msg = m_textCtrlRightMargin->GetValue();
|
||||||
msg.ToDouble( &dtmp );
|
pglayout.SetRightMargin( DoubleValueFromString( UNSCALED_UNITS, msg ) );
|
||||||
pglayout.SetRightMargin( dtmp );
|
|
||||||
msg = m_textCtrlDefaultBottomMargin->GetValue();
|
msg = m_textCtrlDefaultBottomMargin->GetValue();
|
||||||
msg.ToDouble( &dtmp );
|
pglayout.SetBottomMargin( DoubleValueFromString( UNSCALED_UNITS, msg ) );
|
||||||
pglayout.SetBottomMargin( dtmp );
|
|
||||||
|
|
||||||
// cordinates of the left top corner are the left and top margins
|
// cordinates of the left top corner are the left and top margins
|
||||||
msg = m_textCtrlLeftMargin->GetValue();
|
msg = m_textCtrlLeftMargin->GetValue();
|
||||||
msg.ToDouble( &dtmp );
|
pglayout.SetLeftMargin( DoubleValueFromString( UNSCALED_UNITS, msg ) );
|
||||||
pglayout.SetLeftMargin( dtmp );
|
|
||||||
msg = m_textCtrlTopMargin->GetValue();
|
msg = m_textCtrlTopMargin->GetValue();
|
||||||
msg.ToDouble( &dtmp );
|
pglayout.SetTopMargin( DoubleValueFromString( UNSCALED_UNITS, msg ) );
|
||||||
pglayout.SetTopMargin( dtmp );
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -315,13 +306,16 @@ void PROPERTIES_FRAME::OnAcceptPrms( wxCommandEvent& event )
|
||||||
if( item )
|
if( item )
|
||||||
{
|
{
|
||||||
CopyPrmsFromPanelToItem( item );
|
CopyPrmsFromPanelToItem( item );
|
||||||
// Be sure what is displayed is waht is set for item
|
// Be sure what is displayed is what is set for item
|
||||||
// (mainly, texts can be modified if they contain "\n")
|
// (mainly, texts can be modified if they contain "\n")
|
||||||
CopyPrmsFromItemToPanel( item );
|
CopyPrmsFromItemToPanel( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyPrmsFromPanelToGeneral();
|
CopyPrmsFromPanelToGeneral();
|
||||||
|
|
||||||
|
// Refresh values, exactly as they are converted, to avoid any mistake
|
||||||
|
CopyPrmsFromGeneralToPanel();
|
||||||
|
|
||||||
m_parent->OnModify();
|
m_parent->OnModify();
|
||||||
m_parent->GetCanvas()->Refresh();
|
m_parent->GetCanvas()->Refresh();
|
||||||
}
|
}
|
||||||
|
@ -345,7 +339,6 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( WORKSHEET_DATAITEM* aItem )
|
||||||
if( aItem == NULL )
|
if( aItem == NULL )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
double dtmp;
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
// Import common parameters:
|
// Import common parameters:
|
||||||
|
@ -369,17 +362,14 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( WORKSHEET_DATAITEM* aItem )
|
||||||
|
|
||||||
// Import thickness
|
// Import thickness
|
||||||
msg = m_textCtrlThickness->GetValue();
|
msg = m_textCtrlThickness->GetValue();
|
||||||
msg.ToDouble( &dtmp );
|
aItem->m_LineWidth = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||||
aItem->m_LineWidth = dtmp;
|
|
||||||
|
|
||||||
// Import Start point
|
// Import Start point
|
||||||
msg = m_textCtrlPosX->GetValue();
|
msg = m_textCtrlPosX->GetValue();
|
||||||
msg.ToDouble( &dtmp );
|
aItem->m_Pos.m_Pos.x = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||||
aItem->m_Pos.m_Pos.x = dtmp;
|
|
||||||
|
|
||||||
msg = m_textCtrlPosY->GetValue();
|
msg = m_textCtrlPosY->GetValue();
|
||||||
msg.ToDouble( &dtmp );
|
aItem->m_Pos.m_Pos.y = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||||
aItem->m_Pos.m_Pos.y = dtmp;
|
|
||||||
|
|
||||||
switch( m_comboBoxCornerPos->GetSelection() )
|
switch( m_comboBoxCornerPos->GetSelection() )
|
||||||
{
|
{
|
||||||
|
@ -391,12 +381,10 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( WORKSHEET_DATAITEM* aItem )
|
||||||
|
|
||||||
// Import End point
|
// Import End point
|
||||||
msg = m_textCtrlEndX->GetValue();
|
msg = m_textCtrlEndX->GetValue();
|
||||||
msg.ToDouble( &dtmp );
|
aItem->m_End.m_Pos.x = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||||
aItem->m_End.m_Pos.x = dtmp;
|
|
||||||
|
|
||||||
msg = m_textCtrlEndY->GetValue();
|
msg = m_textCtrlEndY->GetValue();
|
||||||
msg.ToDouble( &dtmp );
|
aItem->m_End.m_Pos.y = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||||
aItem->m_End.m_Pos.y = dtmp;
|
|
||||||
|
|
||||||
switch( m_comboBoxCornerEnd->GetSelection() )
|
switch( m_comboBoxCornerEnd->GetSelection() )
|
||||||
{
|
{
|
||||||
|
@ -413,12 +401,10 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( WORKSHEET_DATAITEM* aItem )
|
||||||
aItem->m_RepeatCount = itmp;
|
aItem->m_RepeatCount = itmp;
|
||||||
|
|
||||||
msg = m_textCtrlStepX->GetValue();
|
msg = m_textCtrlStepX->GetValue();
|
||||||
msg.ToDouble( &dtmp );
|
aItem->m_IncrementVector.x = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||||
aItem->m_IncrementVector.x = dtmp;
|
|
||||||
|
|
||||||
msg = m_textCtrlStepY->GetValue();
|
msg = m_textCtrlStepY->GetValue();
|
||||||
msg.ToDouble( &dtmp );
|
aItem->m_IncrementVector.y = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||||
aItem->m_IncrementVector.y = dtmp;
|
|
||||||
|
|
||||||
if( aItem->GetType() == WORKSHEET_DATAITEM::WS_TEXT )
|
if( aItem->GetType() == WORKSHEET_DATAITEM::WS_TEXT )
|
||||||
{
|
{
|
||||||
|
@ -447,26 +433,21 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( WORKSHEET_DATAITEM* aItem )
|
||||||
}
|
}
|
||||||
|
|
||||||
msg = m_textCtrlRotation->GetValue();
|
msg = m_textCtrlRotation->GetValue();
|
||||||
msg.ToDouble( &dtmp );
|
item->m_Orient = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||||
item->m_Orient = dtmp;
|
|
||||||
|
|
||||||
// Import text size
|
// Import text size
|
||||||
msg = m_textCtrlTextSizeX->GetValue();
|
msg = m_textCtrlTextSizeX->GetValue();
|
||||||
msg.ToDouble( &dtmp );
|
item->m_TextSize.x = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||||
item->m_TextSize.x = dtmp;
|
|
||||||
|
|
||||||
msg = m_textCtrlTextSizeY->GetValue();
|
msg = m_textCtrlTextSizeY->GetValue();
|
||||||
msg.ToDouble( &dtmp );
|
item->m_TextSize.y = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||||
item->m_TextSize.y = dtmp;
|
|
||||||
|
|
||||||
// Import constraints:
|
// Import constraints:
|
||||||
msg = m_textCtrlConstraintX->GetValue();
|
msg = m_textCtrlConstraintX->GetValue();
|
||||||
msg.ToDouble( &dtmp );
|
item->m_BoundingBoxSize.x = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||||
item->m_BoundingBoxSize.x = dtmp;
|
|
||||||
|
|
||||||
msg = m_textCtrlConstraintY->GetValue();
|
msg = m_textCtrlConstraintY->GetValue();
|
||||||
msg.ToDouble( &dtmp );
|
item->m_BoundingBoxSize.y = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||||
item->m_BoundingBoxSize.y = dtmp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aItem->GetType() == WORKSHEET_DATAITEM::WS_POLYPOLYGON )
|
if( aItem->GetType() == WORKSHEET_DATAITEM::WS_POLYPOLYGON )
|
||||||
|
@ -474,8 +455,7 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( WORKSHEET_DATAITEM* aItem )
|
||||||
WORKSHEET_DATAITEM_POLYPOLYGON* item = (WORKSHEET_DATAITEM_POLYPOLYGON*) aItem;
|
WORKSHEET_DATAITEM_POLYPOLYGON* item = (WORKSHEET_DATAITEM_POLYPOLYGON*) aItem;
|
||||||
|
|
||||||
msg = m_textCtrlRotation->GetValue();
|
msg = m_textCtrlRotation->GetValue();
|
||||||
msg.ToDouble( &dtmp );
|
item->m_Orient = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||||
item->m_Orient = dtmp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aItem->GetType() == WORKSHEET_DATAITEM::WS_BITMAP )
|
if( aItem->GetType() == WORKSHEET_DATAITEM::WS_BITMAP )
|
||||||
|
|
Loading…
Reference in New Issue