Pcbnew, legacy mode: fix ratsnest display artifacts when finishing or removing a track
This commit is contained in:
parent
d1ab62fb4d
commit
0f0d9afa66
|
@ -39,5 +39,6 @@
|
||||||
|
|
||||||
void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode )
|
void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode )
|
||||||
{
|
{
|
||||||
|
// Build and display new ratsnest
|
||||||
Compile_Ratsnest( aDC, false );
|
Compile_Ratsnest( aDC, false );
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,19 +120,25 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack )
|
||||||
|
|
||||||
int netcode = aTrack->GetNetCode();
|
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()->Remove( aTrack );
|
||||||
|
|
||||||
GetBoard()->GetConnectivity()->Remove( aTrack );
|
GetBoard()->GetConnectivity()->Remove( aTrack );
|
||||||
|
|
||||||
// redraw the area where the track was
|
|
||||||
m_canvas->RefreshDrawingRect( aTrack->GetBoundingBox() );
|
|
||||||
|
|
||||||
SaveCopyInUndoList( aTrack, UR_DELETED );
|
SaveCopyInUndoList( aTrack, UR_DELETED );
|
||||||
OnModify();
|
OnModify();
|
||||||
|
|
||||||
|
if( GetBoard()->IsElementVisible( LAYER_RATSNEST ) && DC )
|
||||||
|
{
|
||||||
|
GRSetDrawMode( DC, GR_XOR );
|
||||||
|
DrawGeneralRatsnest( DC, 0 );
|
||||||
|
}
|
||||||
|
// compute and display the new ratsnest
|
||||||
TestNetConnection( DC, netcode );
|
TestNetConnection( DC, netcode );
|
||||||
SetMsgPanel( GetBoard() );
|
SetMsgPanel( GetBoard() );
|
||||||
|
|
||||||
|
// redraw the area where the track was
|
||||||
|
m_canvas->RefreshDrawingRect( aTrack->GetBoundingBox() );
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,10 +147,8 @@ void PCB_EDIT_FRAME::Delete_Track( wxDC* DC, TRACK* aTrack )
|
||||||
{
|
{
|
||||||
if( aTrack != NULL )
|
if( aTrack != NULL )
|
||||||
{
|
{
|
||||||
int netcode = aTrack->GetNetCode();
|
|
||||||
Remove_One_Track( DC, aTrack );
|
Remove_One_Track( DC, aTrack );
|
||||||
OnModify();
|
OnModify();
|
||||||
TestNetConnection( DC, netcode );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,6 +188,14 @@ void PCB_EDIT_FRAME::Delete_net( wxDC* DC, TRACK* aTrack )
|
||||||
|
|
||||||
SaveCopyInUndoList( itemsList, UR_DELETED );
|
SaveCopyInUndoList( itemsList, UR_DELETED );
|
||||||
OnModify();
|
OnModify();
|
||||||
|
|
||||||
|
// Erase old ratsnest
|
||||||
|
if( GetBoard()->IsElementVisible( LAYER_RATSNEST ) )
|
||||||
|
{
|
||||||
|
GRSetDrawMode( DC, GR_XOR );
|
||||||
|
DrawGeneralRatsnest( DC, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
TestNetConnection( DC, netcode );
|
TestNetConnection( DC, netcode );
|
||||||
SetMsgPanel( GetBoard() );
|
SetMsgPanel( GetBoard() );
|
||||||
}
|
}
|
||||||
|
@ -231,5 +243,15 @@ void PCB_EDIT_FRAME::Remove_One_Track( wxDC* DC, TRACK* pt_segm )
|
||||||
SaveCopyInUndoList( itemsList, UR_DELETED );
|
SaveCopyInUndoList( itemsList, UR_DELETED );
|
||||||
|
|
||||||
if( net_code > 0 )
|
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 );
|
TestNetConnection( DC, net_code );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -425,21 +425,13 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC )
|
||||||
if( Begin_Route( aTrack, aDC ) == NULL )
|
if( Begin_Route( aTrack, aDC ) == NULL )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// Update last track position
|
||||||
ShowNewTrackWhenMovingCursor( m_canvas, aDC, wxDefaultPosition, true );
|
ShowNewTrackWhenMovingCursor( m_canvas, aDC, wxDefaultPosition, true );
|
||||||
|
// Erase the last drawings
|
||||||
ShowNewTrackWhenMovingCursor( m_canvas, aDC, wxDefaultPosition, false );
|
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(); );
|
DBG( g_CurrentTrackList.VerifyListIntegrity(); );
|
||||||
|
|
||||||
|
|
||||||
/* The track here is now chained to the list of track segments.
|
/* The track here is now chained to the list of track segments.
|
||||||
* It must be seen in the area of net
|
* It must be seen in the area of net
|
||||||
* As close as possible to the segment base (or end), because
|
* 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 );
|
GetBoard()->GetConnectivity()->Add( track );
|
||||||
}
|
}
|
||||||
|
|
||||||
TraceAirWiresToTargets( aDC );
|
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for( track = firstTrack; track && i < newCount; ++i, track = track->Next() )
|
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 );
|
SaveCopyInUndoList( s_ItemsListPicker, UR_UNSPECIFIED );
|
||||||
s_ItemsListPicker.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
|
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 );
|
TestNetConnection( aDC, netcode );
|
||||||
OnModify();
|
OnModify();
|
||||||
SetMsgPanel( GetBoard() );
|
SetMsgPanel( GetBoard() );
|
||||||
|
@ -530,8 +527,6 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC )
|
||||||
m_canvas->SetMouseCapture( NULL, NULL );
|
m_canvas->SetMouseCapture( NULL, NULL );
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
|
|
||||||
GetBoard()->GetConnectivity()->RecalculateRatsnest();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue