Change name: Truncate -> Round

This commit is contained in:
Josue 2023-06-27 11:50:09 -05:00 committed by Josue Huaroto
parent 54aaec3a57
commit e5316fd1aa
4 changed files with 12 additions and 15 deletions

View File

@ -309,11 +309,11 @@ public:
EDA_ANGLE KeepUpright() const;
EDA_ANGLE& Truncate( int digits ) const
EDA_ANGLE& Round( int digits ) const
{
EDA_ANGLE angle( *this );
double truncated = KiROUND( angle.AsDegrees() * pow( 10.0, digits ) ) / pow( 10.0, digits );
angle = EDA_ANGLE( truncated , DEGREES_T );
double rounded = KiROUND( angle.AsDegrees() * pow( 10.0, digits ) ) / pow( 10.0, digits );
angle = EDA_ANGLE( rounded, DEGREES_T );
return angle;
}

View File

@ -454,7 +454,7 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
if( m_item->GetShape() == SHAPE_T::SEGMENT )
{
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 )
@ -494,18 +494,15 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
bool change_begin = ( begin_point != m_item->GetStart() );
bool change_end = ( end_point != m_item->GetEnd() );
bool change_length = ( segment_length != m_segmentLength.GetValue() );
EDA_ANGLE difference = segment_angle - m_segmentAngle.GetAngleValue();
if( difference.AsRadians() < 0 )
difference = -difference;
EDA_ANGLE difference = std::abs( segment_angle - m_segmentAngle.GetAngleValue() );
bool change_angle =
( difference > EDA_ANGLE( 0.0005, DEGREES_T ) );
( difference >= EDA_ANGLE( 0.00049, DEGREES_T ) );
if( !( change_begin && change_end ) )
{
segment_length = m_segmentLength.GetValue();
segment_angle = m_segmentAngle.GetAngleValue().Truncate( 3 );
segment_angle = m_segmentAngle.GetAngleValue().Round( 3 );
if( change_length || change_angle )
{
@ -532,9 +529,9 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
m_item->SetLength( m_item->GetLength() );
if( change_angle )
m_item->SetAngle( m_segmentAngle.GetAngleValue().Truncate( 3 ) );
m_item->SetAngle( m_segmentAngle.GetAngleValue().Round( 3 ) );
else
m_item->SetAngle( m_item->GetSegmentAngle().Truncate( 3 ) );
m_item->SetAngle( m_item->GetSegmentAngle().Round( 3 ) );
}

View File

@ -160,10 +160,10 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind
#ifdef __WXGTK__
if ( !m_segmentAngleCtrl->HasFlag( wxTE_MULTILINE ) )
{
m_segmentAngleCtrl->SetMaxLength( 7 );
m_segmentAngleCtrl->SetMaxLength( 8 );
}
#else
m_segmentAngleCtrl->SetMaxLength( 7 );
m_segmentAngleCtrl->SetMaxLength( 8 );
#endif
gbSizer2->Add( m_segmentAngleCtrl, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxTOP, 5 );

View File

@ -2725,7 +2725,7 @@
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">7</property>
<property name="maxlength">8</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>