Change name: Truncate -> Round
This commit is contained in:
parent
54aaec3a57
commit
e5316fd1aa
|
@ -309,11 +309,11 @@ public:
|
||||||
|
|
||||||
EDA_ANGLE KeepUpright() const;
|
EDA_ANGLE KeepUpright() const;
|
||||||
|
|
||||||
EDA_ANGLE& Truncate( int digits ) const
|
EDA_ANGLE& Round( int digits ) const
|
||||||
{
|
{
|
||||||
EDA_ANGLE angle( *this );
|
EDA_ANGLE angle( *this );
|
||||||
double truncated = KiROUND( angle.AsDegrees() * pow( 10.0, digits ) ) / pow( 10.0, digits );
|
double rounded = KiROUND( angle.AsDegrees() * pow( 10.0, digits ) ) / pow( 10.0, digits );
|
||||||
angle = EDA_ANGLE( truncated , DEGREES_T );
|
angle = EDA_ANGLE( rounded, DEGREES_T );
|
||||||
return angle;
|
return angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -454,7 +454,7 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
|
||||||
if( m_item->GetShape() == SHAPE_T::SEGMENT )
|
if( m_item->GetShape() == SHAPE_T::SEGMENT )
|
||||||
{
|
{
|
||||||
segment_length = m_item->GetLength();
|
segment_length = m_item->GetLength();
|
||||||
segment_angle = m_item->GetSegmentAngle().Truncate( 3 );
|
segment_angle = m_item->GetSegmentAngle().Round( 3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_item->GetShape() == SHAPE_T::RECT )
|
if( m_item->GetShape() == SHAPE_T::RECT )
|
||||||
|
@ -494,18 +494,15 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
|
||||||
bool change_begin = ( begin_point != m_item->GetStart() );
|
bool change_begin = ( begin_point != m_item->GetStart() );
|
||||||
bool change_end = ( end_point != m_item->GetEnd() );
|
bool change_end = ( end_point != m_item->GetEnd() );
|
||||||
bool change_length = ( segment_length != m_segmentLength.GetValue() );
|
bool change_length = ( segment_length != m_segmentLength.GetValue() );
|
||||||
EDA_ANGLE difference = segment_angle - m_segmentAngle.GetAngleValue();
|
EDA_ANGLE difference = std::abs( segment_angle - m_segmentAngle.GetAngleValue() );
|
||||||
|
|
||||||
if( difference.AsRadians() < 0 )
|
|
||||||
difference = -difference;
|
|
||||||
|
|
||||||
bool change_angle =
|
bool change_angle =
|
||||||
( difference > EDA_ANGLE( 0.0005, DEGREES_T ) );
|
( difference >= EDA_ANGLE( 0.00049, DEGREES_T ) );
|
||||||
|
|
||||||
if( !( change_begin && change_end ) )
|
if( !( change_begin && change_end ) )
|
||||||
{
|
{
|
||||||
segment_length = m_segmentLength.GetValue();
|
segment_length = m_segmentLength.GetValue();
|
||||||
segment_angle = m_segmentAngle.GetAngleValue().Truncate( 3 );
|
segment_angle = m_segmentAngle.GetAngleValue().Round( 3 );
|
||||||
|
|
||||||
if( change_length || change_angle )
|
if( change_length || change_angle )
|
||||||
{
|
{
|
||||||
|
@ -532,9 +529,9 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
|
||||||
m_item->SetLength( m_item->GetLength() );
|
m_item->SetLength( m_item->GetLength() );
|
||||||
|
|
||||||
if( change_angle )
|
if( change_angle )
|
||||||
m_item->SetAngle( m_segmentAngle.GetAngleValue().Truncate( 3 ) );
|
m_item->SetAngle( m_segmentAngle.GetAngleValue().Round( 3 ) );
|
||||||
else
|
else
|
||||||
m_item->SetAngle( m_item->GetSegmentAngle().Truncate( 3 ) );
|
m_item->SetAngle( m_item->GetSegmentAngle().Round( 3 ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,10 +160,10 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
if ( !m_segmentAngleCtrl->HasFlag( wxTE_MULTILINE ) )
|
if ( !m_segmentAngleCtrl->HasFlag( wxTE_MULTILINE ) )
|
||||||
{
|
{
|
||||||
m_segmentAngleCtrl->SetMaxLength( 7 );
|
m_segmentAngleCtrl->SetMaxLength( 8 );
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
m_segmentAngleCtrl->SetMaxLength( 7 );
|
m_segmentAngleCtrl->SetMaxLength( 8 );
|
||||||
#endif
|
#endif
|
||||||
gbSizer2->Add( m_segmentAngleCtrl, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxTOP, 5 );
|
gbSizer2->Add( m_segmentAngleCtrl, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxTOP, 5 );
|
||||||
|
|
||||||
|
|
|
@ -2725,7 +2725,7 @@
|
||||||
<property name="max_size"></property>
|
<property name="max_size"></property>
|
||||||
<property name="maximize_button">0</property>
|
<property name="maximize_button">0</property>
|
||||||
<property name="maximum_size"></property>
|
<property name="maximum_size"></property>
|
||||||
<property name="maxlength">7</property>
|
<property name="maxlength">8</property>
|
||||||
<property name="min_size"></property>
|
<property name="min_size"></property>
|
||||||
<property name="minimize_button">0</property>
|
<property name="minimize_button">0</property>
|
||||||
<property name="minimum_size"></property>
|
<property name="minimum_size"></property>
|
||||||
|
|
Loading…
Reference in New Issue