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

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
...@@ -652,12 +652,25 @@ static void PushTrack( EDA_DRAW_PANEL* panel ) ...@@ -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 /* Redraw the current track being created when the mouse cursor is moved
*/ */
void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase ) bool aErase )
{ {
D( g_CurrentTrackList.VerifyListIntegrity(); ); // D( g_CurrentTrackList.VerifyListIntegrity(); );
PCB_SCREEN* screen = (PCB_SCREEN*) aPanel->GetScreen(); PCB_SCREEN* screen = (PCB_SCREEN*) aPanel->GetScreen();
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) aPanel->GetParent(); PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) aPanel->GetParent();
...@@ -674,6 +687,11 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo ...@@ -674,6 +687,11 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
if( showTrackClearanceMode != DO_NOT_SHOW_CLEARANCE ) if( showTrackClearanceMode != DO_NOT_SHOW_CLEARANCE )
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS; 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 #ifndef USE_WX_OVERLAY
// Erase old track // Erase old track
if( aErase ) if( aErase )
...@@ -685,11 +703,8 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo ...@@ -685,11 +703,8 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS )
{ {
EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( g_CurrentTrackSegment->GetLayer() ); EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( g_CurrentTrackSegment->GetLayer() );
DrawViaCirclesWhenEditingNewTrack( panelClipBox, aDC, g_CurrentTrackSegment->m_End,
GRCircle( aPanel->GetClipBox(), aDC, g_CurrentTrackSegment->m_End.x, boardViaRadius, viaRadiusWithClearence, color);
g_CurrentTrackSegment->m_End.y,
( netclass->GetViaDiameter() / 2 ) + netclass->GetClearance(),
color );
} }
} }
#endif #endif
...@@ -754,10 +769,10 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo ...@@ -754,10 +769,10 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
{ {
EDA_COLOR_T color = g_ColorsSettings.GetLayerColor(g_CurrentTrackSegment->GetLayer()); EDA_COLOR_T color = g_ColorsSettings.GetLayerColor(g_CurrentTrackSegment->GetLayer());
GRCircle( aPanel->GetClipBox(), aDC, g_CurrentTrackSegment->m_End.x, //Via diameter must have taken what we are using, rather than netclass value.
g_CurrentTrackSegment->m_End.y, DrawViaCirclesWhenEditingNewTrack( panelClipBox, aDC, g_CurrentTrackSegment->m_End,
( netclass->GetViaDiameter() / 2 ) + netclass->GetClearance(), boardViaRadius, viaRadiusWithClearence, color);
color );
} }
/* Display info about current segment and the full new track: /* Display info about current segment and the full new track:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment