Cleanup.
This commit is contained in:
parent
8de4f762e1
commit
d299ddbc7e
|
@ -115,6 +115,15 @@ wxString MessageTextFromValue( EDA_UNITS aUnits, long long int aValue, bool aAdd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxString MessageTextFromValue( EDA_ANGLE aValue, bool aAddUnitLabel )
|
||||||
|
{
|
||||||
|
if( aAddUnitLabel )
|
||||||
|
return wxString::Format( wxT( "%.1f°" ), aValue.AsDegrees() );
|
||||||
|
else
|
||||||
|
return wxString::Format( wxT( "%.1f" ), aValue.AsDegrees() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// A lower-precision (for readability) version of StringFromValue()
|
// A lower-precision (for readability) version of StringFromValue()
|
||||||
wxString MessageTextFromValue( EDA_UNITS aUnits, double aValue, bool aAddUnitLabel,
|
wxString MessageTextFromValue( EDA_UNITS aUnits, double aValue, bool aAddUnitLabel,
|
||||||
EDA_DATA_TYPE aType )
|
EDA_DATA_TYPE aType )
|
||||||
|
|
|
@ -557,7 +557,7 @@ void EDA_SHAPE::ShapeGetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
|
||||||
case SHAPE_T::ARC:
|
case SHAPE_T::ARC:
|
||||||
aList.emplace_back( shape, _( "Arc" ) );
|
aList.emplace_back( shape, _( "Arc" ) );
|
||||||
|
|
||||||
msg.Printf( wxT( "%.1f" ), GetArcAngle().AsDegrees() );
|
msg = MessageTextFromValue( GetArcAngle() );
|
||||||
aList.emplace_back( _( "Angle" ), msg );
|
aList.emplace_back( _( "Angle" ), msg );
|
||||||
|
|
||||||
msg = MessageTextFromValue( units, GetRadius() );
|
msg = MessageTextFromValue( units, GetRadius() );
|
||||||
|
@ -596,9 +596,9 @@ void EDA_SHAPE::ShapeGetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
|
||||||
aList.emplace_back( _( "Length" ), msg );
|
aList.emplace_back( _( "Length" ), msg );
|
||||||
|
|
||||||
// angle counter-clockwise from 3'o-clock
|
// angle counter-clockwise from 3'o-clock
|
||||||
const double deg = RAD2DEG( atan2( (double)( GetStart().y - GetEnd().y ),
|
EDA_ANGLE angle( atan2( (double)( GetStart().y - GetEnd().y ),
|
||||||
(double)( GetEnd().x - GetStart().x ) ) );
|
(double)( GetEnd().x - GetStart().x ) ), RADIANS_T );
|
||||||
aList.emplace_back( _( "Angle" ), wxString::Format( "%.1f", deg ) );
|
aList.emplace_back( _( "Angle" ), MessageTextFromValue( angle ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,6 +105,8 @@ wxString MessageTextFromValue( EDA_UNITS aUnits, int aValue, bool aAddUnitLabel
|
||||||
wxString MessageTextFromValue( EDA_UNITS aUnits, long long int aValue, bool aAddUnitLabel = true,
|
wxString MessageTextFromValue( EDA_UNITS aUnits, long long int aValue, bool aAddUnitLabel = true,
|
||||||
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
||||||
|
|
||||||
|
wxString MessageTextFromValue( EDA_ANGLE aValue, bool aAddUnitLabel = true );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function StringFromValue
|
* Function StringFromValue
|
||||||
* returns the string from \a aValue according to units (inch, mm ...) for display,
|
* returns the string from \a aValue according to units (inch, mm ...) for display,
|
||||||
|
|
|
@ -335,13 +335,14 @@ int EDIT_TOOL::DragArcTrack( const TOOL_EVENT& aEvent )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
PCB_ARC* theArc = static_cast<PCB_ARC*>( selection.Front() );
|
PCB_ARC* theArc = static_cast<PCB_ARC*>( selection.Front() );
|
||||||
double arcAngleDegrees = std::abs( theArc->GetAngle().AsDegrees() );
|
EDA_ANGLE maxTangentDeviation( ADVANCED_CFG::GetCfg().m_MaxTangentAngleDeviation, DEGREES_T );
|
||||||
|
|
||||||
if( arcAngleDegrees + ADVANCED_CFG::GetCfg().m_MaxTangentAngleDeviation >= 180.0 )
|
if( theArc->GetAngle() + maxTangentDeviation >= ANGLE_180 )
|
||||||
{
|
{
|
||||||
frame()->ShowInfoBarError(
|
wxString msg = wxString::Format( _( "Unable to resize arc tracks of %s or greater." ),
|
||||||
wxString::Format( _( "Unable to resize arc tracks %.1f degrees or greater." ),
|
MessageTextFromValue( ANGLE_180 - maxTangentDeviation ) );
|
||||||
180.0 - ADVANCED_CFG::GetCfg().m_MaxTangentAngleDeviation ) );
|
frame()->ShowInfoBarError( msg );
|
||||||
|
|
||||||
return 0; // don't bother with > 180 degree arcs
|
return 0; // don't bother with > 180 degree arcs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,12 +395,9 @@ int EDIT_TOOL::DragArcTrack( const TOOL_EVENT& aEvent )
|
||||||
SEG trackSeg( retval->GetStart(), retval->GetEnd() );
|
SEG trackSeg( retval->GetStart(), retval->GetEnd() );
|
||||||
|
|
||||||
// Allow deviations in colinearity as defined in ADVANCED_CFG
|
// Allow deviations in colinearity as defined in ADVANCED_CFG
|
||||||
if( trackSeg.Angle( aCollinearSeg )
|
if( trackSeg.Angle( aCollinearSeg ) > maxTangentDeviation )
|
||||||
> EDA_ANGLE( ADVANCED_CFG::GetCfg().m_MaxTangentAngleDeviation, DEGREES_T ) )
|
|
||||||
{
|
|
||||||
retval = nullptr;
|
retval = nullptr;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if( !retval )
|
if( !retval )
|
||||||
{
|
{
|
||||||
|
@ -1151,7 +1149,7 @@ int EDIT_TOOL::ChangeTrackWidth( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_commit->Push( _("Edit track width/via size") );
|
m_commit->Push( _( "Edit track width/via size" ) );
|
||||||
|
|
||||||
if( selection.IsHover() )
|
if( selection.IsHover() )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue