Pcbnew, legacy mode: fix ratsnest display artifacts when finishing or removing a track

This commit is contained in:
jean-pierre charras 2018-03-28 18:06:03 +02:00
parent d1ab62fb4d
commit 0f0d9afa66
3 changed files with 40 additions and 22 deletions

View File

@ -39,5 +39,6 @@
void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode )
{
// Build and display new ratsnest
Compile_Ratsnest( aDC, false );
}

View File

@ -120,19 +120,25 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack )
int netcode = aTrack->GetNetCode();
// Remove the segment from list, but do not delete it (it will be stored i n undo list)
// Remove the segment from list, but do not delete it (it will be stored in undo list)
GetBoard()->Remove( aTrack );
GetBoard()->GetConnectivity()->Remove( aTrack );
// redraw the area where the track was
m_canvas->RefreshDrawingRect( aTrack->GetBoundingBox() );
SaveCopyInUndoList( aTrack, UR_DELETED );
OnModify();
if( GetBoard()->IsElementVisible( LAYER_RATSNEST ) && DC )
{
GRSetDrawMode( DC, GR_XOR );
DrawGeneralRatsnest( DC, 0 );
}
// compute and display the new ratsnest
TestNetConnection( DC, netcode );
SetMsgPanel( GetBoard() );
// redraw the area where the track was
m_canvas->RefreshDrawingRect( aTrack->GetBoundingBox() );
return NULL;
}
@ -141,10 +147,8 @@ void PCB_EDIT_FRAME::Delete_Track( wxDC* DC, TRACK* aTrack )
{
if( aTrack != NULL )
{
int netcode = aTrack->GetNetCode();
Remove_One_Track( DC, aTrack );
OnModify();
TestNetConnection( DC, netcode );
}
}
@ -184,6 +188,14 @@ void PCB_EDIT_FRAME::Delete_net( wxDC* DC, TRACK* aTrack )
SaveCopyInUndoList( itemsList, UR_DELETED );
OnModify();
// Erase old ratsnest
if( GetBoard()->IsElementVisible( LAYER_RATSNEST ) )
{
GRSetDrawMode( DC, GR_XOR );
DrawGeneralRatsnest( DC, 0 );
}
TestNetConnection( DC, netcode );
SetMsgPanel( GetBoard() );
}
@ -231,5 +243,15 @@ void PCB_EDIT_FRAME::Remove_One_Track( wxDC* DC, TRACK* pt_segm )
SaveCopyInUndoList( itemsList, UR_DELETED );
if( net_code > 0 )
{
// Erase old ratsnest
if( GetBoard()->IsElementVisible( LAYER_RATSNEST ) )
{
GRSetDrawMode( DC, GR_XOR );
DrawGeneralRatsnest( DC, 0 );
}
// Build and draw the new ratsnest
TestNetConnection( DC, net_code );
}
}

View File

@ -425,21 +425,13 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC )
if( Begin_Route( aTrack, aDC ) == NULL )
return false;
// Update last track position
ShowNewTrackWhenMovingCursor( m_canvas, aDC, wxDefaultPosition, true );
// Erase the last drawings
ShowNewTrackWhenMovingCursor( m_canvas, aDC, wxDefaultPosition, false );
TraceAirWiresToTargets( aDC );
/* cleanup
* if( g_CurrentTrackSegment->Next() != NULL )
* {
* delete g_CurrentTrackSegment->Next();
* g_CurrentTrackSegment->SetNext( NULL );
* }
*/
DBG( g_CurrentTrackList.VerifyListIntegrity(); );
/* The track here is now chained to the list of track segments.
* It must be seen in the area of net
* As close as possible to the segment base (or end), because
@ -487,8 +479,6 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC )
GetBoard()->GetConnectivity()->Add( track );
}
TraceAirWiresToTargets( aDC );
int i = 0;
for( track = firstTrack; track && i < newCount; ++i, track = track->Next() )
@ -506,7 +496,14 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC )
SaveCopyInUndoList( s_ItemsListPicker, UR_UNSPECIFIED );
s_ItemsListPicker.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
// compute the new ratsnest
// Erase old ratsnest
if( GetBoard()->IsElementVisible( LAYER_RATSNEST ) && aDC )
{
GRSetDrawMode( aDC, GR_XOR );
DrawGeneralRatsnest( aDC, 0 );
}
// compute and display the new ratsnest
TestNetConnection( aDC, netcode );
OnModify();
SetMsgPanel( GetBoard() );
@ -530,8 +527,6 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC )
m_canvas->SetMouseCapture( NULL, NULL );
SetCurItem( NULL );
GetBoard()->GetConnectivity()->RecalculateRatsnest();
return true;
}