Commit 23c1c4a0 authored by Heikki Pulkkinen's avatar Heikki Pulkkinen Committed by jean-pierre charras
Browse files

Pcbnew: commit patch from Heikki Pulkkinen (via displayed with its right size...

Pcbnew: commit patch from Heikki Pulkkinen (via displayed with its right size and clearance during track creation/edition)
parent 84c7b07e
Loading
Loading
Loading
Loading
+26 −11
Original line number Diff line number Diff line
@@ -652,12 +652,25 @@ static void PushTrack( EDA_DRAW_PANEL* panel )
}


//Helpre function: Draws Via circle and Via Clearence circle.
inline void DrawViaCirclesWhenEditingNewTrack( EDA_RECT* aPanelClipBox,
                                               wxDC* aDC, const wxPoint& aPos,
                                               int aViaRadius,
                                               int aViaRadiusWithClearence,
                                               EDA_COLOR_T aColor)
{
    //Current viasize clearence circle
    GRCircle( aPanelClipBox, aDC, aPos.x, aPos.y, aViaRadiusWithClearence, aColor );
    //Current viasize circle
    GRCircle( aPanelClipBox, aDC, aPos.x, aPos.y, aViaRadius, aColor );
}

/* Redraw the current track being created when the mouse cursor is moved
 */
void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
                                   bool aErase )
{
    D( g_CurrentTrackList.VerifyListIntegrity(); );
//    D( g_CurrentTrackList.VerifyListIntegrity(); );

    PCB_SCREEN*     screen = (PCB_SCREEN*) aPanel->GetScreen();
    PCB_BASE_FRAME* frame  = (PCB_BASE_FRAME*) aPanel->GetParent();
@@ -674,6 +687,11 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
    if( showTrackClearanceMode != DO_NOT_SHOW_CLEARANCE )
        DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS;

    // Values to Via circle
    int boardViaRadius = frame->GetBoard()->GetCurrentViaSize()/2;
    int viaRadiusWithClearence = boardViaRadius+netclass->GetClearance();
    EDA_RECT* panelClipBox=aPanel->GetClipBox();

#ifndef USE_WX_OVERLAY
    // Erase old track
    if( aErase )
@@ -685,11 +703,8 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
        if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS )
        {
            EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( g_CurrentTrackSegment->GetLayer() );

            GRCircle( aPanel->GetClipBox(), aDC, g_CurrentTrackSegment->m_End.x,
                      g_CurrentTrackSegment->m_End.y,
                      ( netclass->GetViaDiameter() / 2 ) + netclass->GetClearance(),
                      color );
            DrawViaCirclesWhenEditingNewTrack( panelClipBox, aDC, g_CurrentTrackSegment->m_End,
                                               boardViaRadius, viaRadiusWithClearence, color);
        }
    }
#endif
@@ -754,10 +769,10 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
    {
        EDA_COLOR_T color = g_ColorsSettings.GetLayerColor(g_CurrentTrackSegment->GetLayer());

        GRCircle( aPanel->GetClipBox(), aDC, g_CurrentTrackSegment->m_End.x,
                  g_CurrentTrackSegment->m_End.y,
                  ( netclass->GetViaDiameter() / 2 ) + netclass->GetClearance(),
                  color );
        //Via diameter must have taken what we are using, rather than netclass value.
        DrawViaCirclesWhenEditingNewTrack( panelClipBox, aDC, g_CurrentTrackSegment->m_End,
                                           boardViaRadius, viaRadiusWithClearence, color);

    }

    /* Display info about current segment and the full new track: