Commit 99b90d2f authored by jean-pierre charras's avatar jean-pierre charras
Browse files

More work on a better support of polygons in Kicad (code cleaning).

parent ef5f1b9e
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -561,15 +561,15 @@ void LIB_ARC::BeginEdit( int aEditMode, const wxPoint aPosition )
        // Drag either the start, end point or the outline
        // Drag either the start, end point or the outline
        if( HitTestPoints( m_ArcStart, aPosition, MINIMUM_SELECTION_DISTANCE ) )
        if( HitTestPoints( m_ArcStart, aPosition, MINIMUM_SELECTION_DISTANCE ) )
        {
        {
            m_editSelectPoint = START;
            m_editSelectPoint = ARC_STATUS_START;
        }
        }
        else if( HitTestPoints( m_ArcEnd, aPosition, MINIMUM_SELECTION_DISTANCE ) )
        else if( HitTestPoints( m_ArcEnd, aPosition, MINIMUM_SELECTION_DISTANCE ) )
        {
        {
            m_editSelectPoint = END;
            m_editSelectPoint = ARC_STATUS_END;
        }
        }
        else
        else
        {
        {
            m_editSelectPoint = OUTLINE;
            m_editSelectPoint = ARC_STATUS_OUTLINE;
        }
        }


        m_editState = 0;
        m_editState = 0;
@@ -619,12 +619,12 @@ void LIB_ARC::calcEdit( const wxPoint& aPosition )
        wxPoint newCenterPoint, startPos, endPos;
        wxPoint newCenterPoint, startPos, endPos;


        // Choose the point of the arc to be adjusted
        // Choose the point of the arc to be adjusted
        if( m_editSelectPoint == START )
        if( m_editSelectPoint == ARC_STATUS_START )
        {
        {
            startPos = aPosition;
            startPos = aPosition;
            endPos   = m_ArcEnd;
            endPos   = m_ArcEnd;
        }
        }
        else if( m_editSelectPoint == END )
        else if( m_editSelectPoint == ARC_STATUS_END )
        {
        {
            endPos   = aPosition;
            endPos   = aPosition;
            startPos = m_ArcStart;
            startPos = m_ArcStart;
@@ -658,7 +658,7 @@ void LIB_ARC::calcEdit( const wxPoint& aPosition )
                newCenterPoint = m_Pos;
                newCenterPoint = m_Pos;
        }
        }


        if( m_editSelectPoint == START || m_editSelectPoint == END )
        if( m_editSelectPoint == ARC_STATUS_START || m_editSelectPoint == ARC_STATUS_END )
        {
        {
            // Compute the new center point when the start/end points are modified
            // Compute the new center point when the start/end points are modified
            wxPoint middlePoint = wxPoint( (startPos.x + endPos.x) / 2,
            wxPoint middlePoint = wxPoint( (startPos.x + endPos.x) / 2,
+5 −5
Original line number Original line Diff line number Diff line
@@ -37,15 +37,15 @@ class TRANSFORM;


class LIB_ARC : public LIB_ITEM
class LIB_ARC : public LIB_ITEM
{
{
    enum SELECT_T
    enum SELECT_T               // When creating an arc: status of arc
    {
    {
        START,
        ARC_STATUS_START,
        END,
        ARC_STATUS_END,
        OUTLINE,
        ARC_STATUS_OUTLINE,
    };
    };


    int      m_Radius;
    int      m_Radius;
    int      m_t1;              /* First radius angle of the arc in 0.1 degrees. */
    int      m_t1;              // First radius angle of the arc in 0.1 degrees.
    int      m_t2;              /* Second radius angle of the arc in 0.1 degrees. */
    int      m_t2;              /* Second radius angle of the arc in 0.1 degrees. */
    wxPoint  m_ArcStart;
    wxPoint  m_ArcStart;
    wxPoint  m_ArcEnd;          /* Arc end position. */
    wxPoint  m_ArcEnd;          /* Arc end position. */
+2 −2
Original line number Original line Diff line number Diff line
@@ -1302,12 +1302,12 @@ static void AddNewTrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
        g_CurrentTrackList.PushBack( newTrack );
        g_CurrentTrackList.PushBack( newTrack );
    }
    }


    g_FirstTrackSegment->start = pcbframe->GetBoard()->GetPad( g_FirstTrackSegment, START );
    g_FirstTrackSegment->start = pcbframe->GetBoard()->GetPad( g_FirstTrackSegment, FLG_START );


    if( g_FirstTrackSegment->start )
    if( g_FirstTrackSegment->start )
        g_FirstTrackSegment->SetState( BEGIN_ONPAD, ON );
        g_FirstTrackSegment->SetState( BEGIN_ONPAD, ON );


    g_CurrentTrackSegment->end = pcbframe->GetBoard()->GetPad( g_CurrentTrackSegment, END );
    g_CurrentTrackSegment->end = pcbframe->GetBoard()->GetPad( g_CurrentTrackSegment, FLG_END );


    if( g_CurrentTrackSegment->end )
    if( g_CurrentTrackSegment->end )
        g_CurrentTrackSegment->SetState( END_ONPAD, ON );
        g_CurrentTrackSegment->SetState( END_ONPAD, ON );
+2 −2
Original line number Original line Diff line number Diff line
@@ -1681,7 +1681,7 @@ D_PAD* BOARD::GetPad( TRACK* aTrace, int aEndPoint )


    int     aLayerMask = GetLayerMask( aTrace->GetLayer() );
    int     aLayerMask = GetLayerMask( aTrace->GetLayer() );


    if( aEndPoint == START )
    if( aEndPoint == FLG_START )
    {
    {
        aPosition = aTrace->m_Start;
        aPosition = aTrace->m_Start;
    }
    }
@@ -2271,7 +2271,7 @@ TRACK* BOARD::CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS
    aSegment->end = newTrack;
    aSegment->end = newTrack;
    aSegment->SetState( END_ONPAD, OFF );
    aSegment->SetState( END_ONPAD, OFF );


    D_PAD * pad = GetPad( newTrack, START );
    D_PAD * pad = GetPad( newTrack, FLG_START );


    if ( pad )
    if ( pad )
    {
    {
+1 −1
Original line number Original line Diff line number Diff line
@@ -1282,7 +1282,7 @@ TRACK* TRACK::GetTrace( TRACK* aStartTrace, TRACK* aEndTrace, int aEndPoint )
    int     ii;
    int     ii;
    int     max_dist;
    int     max_dist;


    if( aEndPoint == START )
    if( aEndPoint == FLG_START )
        position = m_Start;
        position = m_Start;
    else
    else
        position = m_End;
        position = m_End;
Loading