Pcbnew: fix bug #142348 (airwire does not always appear after deleting a track). Very minor other fixes.
This commit is contained in:
parent
590d9b3b18
commit
bd5d468251
|
@ -67,7 +67,7 @@ void KIWAY::player_destroy_handler( wxWindowDestroyEvent& event )
|
||||||
// if destroying one of our flock, then mark it as deceased.
|
// if destroying one of our flock, then mark it as deceased.
|
||||||
if( (wxWindow*) m_player[i] == w )
|
if( (wxWindow*) m_player[i] == w )
|
||||||
{
|
{
|
||||||
DBG(printf( "%s: m_player[%d] destroyed: %s\n",
|
DBG(printf( "%s: m_player[%u] destroyed: %s\n",
|
||||||
__func__, i, TO_UTF8( m_player[i]->GetName() ) );)
|
__func__, i, TO_UTF8( m_player[i]->GetName() ) );)
|
||||||
|
|
||||||
m_player[i] = 0;
|
m_player[i] = 0;
|
||||||
|
|
|
@ -203,7 +203,7 @@ void SEARCH_STACK::Show( const char* aPrefix ) const
|
||||||
printf( "%s SEARCH_STACK:\n", aPrefix );
|
printf( "%s SEARCH_STACK:\n", aPrefix );
|
||||||
for( unsigned i=0; i<GetCount(); ++i )
|
for( unsigned i=0; i<GetCount(); ++i )
|
||||||
{
|
{
|
||||||
printf( " [%2i]:%s\n", i, TO_UTF8( (*this)[i] ) );
|
printf( " [%2u]:%s\n", i, TO_UTF8( (*this)[i] ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -282,9 +282,9 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
for( unsigned i=0; i<m_FieldsBuf.size(); ++i )
|
for( unsigned i = 0; i<m_FieldsBuf.size(); ++i )
|
||||||
{
|
{
|
||||||
printf( "save[%d].name:'%s' value:'%s'\n", i,
|
printf( "save[%u].name:'%s' value:'%s'\n", i,
|
||||||
TO_UTF8( m_FieldsBuf[i].GetName() ),
|
TO_UTF8( m_FieldsBuf[i].GetName() ),
|
||||||
TO_UTF8( m_FieldsBuf[i].GetText() ) );
|
TO_UTF8( m_FieldsBuf[i].GetText() ) );
|
||||||
}
|
}
|
||||||
|
@ -488,7 +488,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers()
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
for( unsigned i=0; i<cmpFields.size(); ++i )
|
for( unsigned i=0; i<cmpFields.size(); ++i )
|
||||||
{
|
{
|
||||||
printf( "cmpFields[%d].name:%s\n", i, TO_UTF8( cmpFields[i].GetName() ) );
|
printf( "cmpFields[%u].name:%s\n", i, TO_UTF8( cmpFields[i].GetName() ) );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,6 @@ void SCH_EDIT_FRAME::EditComponentFieldText( SCH_FIELD* aField )
|
||||||
|
|
||||||
// Don't use GetText() here. If the field is the reference designator and it's parent
|
// Don't use GetText() here. If the field is the reference designator and it's parent
|
||||||
// component has multiple parts, we don't want the part suffix added to the field.
|
// component has multiple parts, we don't want the part suffix added to the field.
|
||||||
wxString newtext = aField->GetText();
|
|
||||||
m_canvas->SetIgnoreMouseEvents( true );
|
m_canvas->SetIgnoreMouseEvents( true );
|
||||||
|
|
||||||
wxString title;
|
wxString title;
|
||||||
|
@ -91,7 +90,7 @@ void SCH_EDIT_FRAME::EditComponentFieldText( SCH_FIELD* aField )
|
||||||
|
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
m_canvas->SetIgnoreMouseEvents( false );
|
m_canvas->SetIgnoreMouseEvents( false );
|
||||||
newtext = dlg.GetTextField( );
|
wxString newtext = dlg.GetTextField( );
|
||||||
|
|
||||||
if ( response != wxID_OK )
|
if ( response != wxID_OK )
|
||||||
return; // canceled by user
|
return; // canceled by user
|
||||||
|
|
|
@ -42,9 +42,7 @@
|
||||||
#include <dialog_helpers.h>
|
#include <dialog_helpers.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
// Save previous component library viewer state.
|
||||||
* Save previous component library viewer state.
|
|
||||||
*/
|
|
||||||
wxString LIB_VIEW_FRAME::m_libraryName;
|
wxString LIB_VIEW_FRAME::m_libraryName;
|
||||||
wxString LIB_VIEW_FRAME::m_entryName;
|
wxString LIB_VIEW_FRAME::m_entryName;
|
||||||
|
|
||||||
|
|
|
@ -780,26 +780,20 @@ void PCB_BASE_FRAME::TestConnections()
|
||||||
|
|
||||||
void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode )
|
void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode )
|
||||||
{
|
{
|
||||||
wxString msg;
|
// Skip dummy net -1, and "not connected" net 0 (grouping all not connected pads)
|
||||||
|
if( aNetCode <= 0 )
|
||||||
if( aNetCode <= 0 ) // -1 = not existing net, 0 = dummy net
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( (m_Pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
|
if( (m_Pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
|
||||||
Compile_Ratsnest( aDC, true );
|
Compile_Ratsnest( aDC, true );
|
||||||
|
|
||||||
// Clear the cluster identifier (subnet) of pads for this net
|
// Clear the cluster identifier (subnet) of pads for this net
|
||||||
|
// Pads are grouped by netcode (and in netname alphabetic order)
|
||||||
for( unsigned i = 0; i < m_Pcb->GetPadCount(); ++i )
|
for( unsigned i = 0; i < m_Pcb->GetPadCount(); ++i )
|
||||||
{
|
{
|
||||||
D_PAD* pad = m_Pcb->GetPad(i);
|
D_PAD* pad = m_Pcb->GetPad(i);
|
||||||
int pad_net_code = pad->GetNetCode();
|
|
||||||
|
|
||||||
if( pad_net_code < aNetCode )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if( pad_net_code > aNetCode )
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
if( m_Pcb->GetPad(i)->GetNetCode() == aNetCode )
|
||||||
pad->SetSubNet( 0 );
|
pad->SetSubNet( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -810,16 +804,15 @@ void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode )
|
||||||
{
|
{
|
||||||
CONNECTIONS connections( m_Pcb );
|
CONNECTIONS connections( m_Pcb );
|
||||||
|
|
||||||
TRACK* firstTrack;
|
|
||||||
TRACK* lastTrack = NULL;
|
TRACK* lastTrack = NULL;
|
||||||
firstTrack = m_Pcb->m_Track.GetFirst()->GetStartNetCode( aNetCode );
|
TRACK* firstTrack = m_Pcb->m_Track.GetFirst()->GetStartNetCode( aNetCode );
|
||||||
|
|
||||||
if( firstTrack )
|
if( firstTrack )
|
||||||
lastTrack = firstTrack->GetEndNetCode( aNetCode );
|
lastTrack = firstTrack->GetEndNetCode( aNetCode );
|
||||||
|
|
||||||
if( firstTrack && lastTrack ) // i.e. if there are segments
|
if( firstTrack && lastTrack ) // i.e. if there are segments
|
||||||
{
|
{
|
||||||
connections.Build_CurrNet_SubNets_Connections( firstTrack, lastTrack, firstTrack->GetNetCode() );
|
connections.Build_CurrNet_SubNets_Connections( firstTrack, lastTrack, aNetCode );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -831,6 +824,7 @@ void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode )
|
||||||
DrawGeneralRatsnest( aDC, aNetCode );
|
DrawGeneralRatsnest( aDC, aNetCode );
|
||||||
|
|
||||||
// Display results
|
// Display results
|
||||||
|
wxString msg;
|
||||||
int net_notconnected_count = 0;
|
int net_notconnected_count = 0;
|
||||||
NETINFO_ITEM* net = m_Pcb->FindNet( aNetCode );
|
NETINFO_ITEM* net = m_Pcb->FindNet( aNetCode );
|
||||||
|
|
||||||
|
@ -842,14 +836,15 @@ void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode )
|
||||||
net_notconnected_count++;
|
net_notconnected_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.Printf( wxT( "links %d nc %d net:nc %d" ),
|
msg.Printf( wxT( "links %d nc %d net %d: not conn %d" ),
|
||||||
m_Pcb->GetRatsnestsCount(), m_Pcb->GetUnconnectedNetCount(),
|
m_Pcb->GetRatsnestsCount(), m_Pcb->GetUnconnectedNetCount(), aNetCode,
|
||||||
net_notconnected_count );
|
net_notconnected_count );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
msg.Printf( wxT( "net not found: netcode %d" ),aNetCode );
|
msg.Printf( wxT( "net not found: netcode %d" ), aNetCode );
|
||||||
|
|
||||||
SetStatusText( msg );
|
SetStatusText( msg );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,6 @@
|
||||||
|
|
||||||
TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack )
|
TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack )
|
||||||
{
|
{
|
||||||
int current_net_code;
|
|
||||||
|
|
||||||
if( aTrack == NULL )
|
if( aTrack == NULL )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -120,20 +118,20 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack )
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
current_net_code = aTrack->GetNetCode();
|
int netcode = aTrack->GetNetCode();
|
||||||
|
|
||||||
|
// Remove the segment from list, but do not delete it (it will be stored i n undo list)
|
||||||
|
GetBoard()->Remove( aTrack );
|
||||||
|
|
||||||
DLIST<TRACK>* container = (DLIST<TRACK>*)aTrack->GetList();
|
|
||||||
wxASSERT( container );
|
|
||||||
GetBoard()->GetRatsnest()->Remove( aTrack );
|
GetBoard()->GetRatsnest()->Remove( aTrack );
|
||||||
aTrack->ViewRelease();
|
aTrack->ViewRelease();
|
||||||
container->Remove( aTrack );
|
|
||||||
|
|
||||||
// redraw the area where the track was
|
// redraw the area where the track was
|
||||||
m_canvas->RefreshDrawingRect( aTrack->GetBoundingBox() );
|
m_canvas->RefreshDrawingRect( aTrack->GetBoundingBox() );
|
||||||
|
|
||||||
SaveCopyInUndoList( aTrack, UR_DELETED );
|
SaveCopyInUndoList( aTrack, UR_DELETED );
|
||||||
OnModify();
|
OnModify();
|
||||||
TestNetConnection( DC, current_net_code );
|
TestNetConnection( DC, netcode );
|
||||||
SetMsgPanel( GetBoard() );
|
SetMsgPanel( GetBoard() );
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -144,10 +142,10 @@ void PCB_EDIT_FRAME::Delete_Track( wxDC* DC, TRACK* aTrack )
|
||||||
{
|
{
|
||||||
if( aTrack != NULL )
|
if( aTrack != NULL )
|
||||||
{
|
{
|
||||||
int current_net_code = aTrack->GetNetCode();
|
int netcode = aTrack->GetNetCode();
|
||||||
Remove_One_Track( DC, aTrack );
|
Remove_One_Track( DC, aTrack );
|
||||||
OnModify();
|
OnModify();
|
||||||
TestNetConnection( DC, current_net_code );
|
TestNetConnection( DC, netcode );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,10 +160,10 @@ void PCB_EDIT_FRAME::Delete_net( wxDC* DC, TRACK* aTrack )
|
||||||
|
|
||||||
PICKED_ITEMS_LIST itemsList;
|
PICKED_ITEMS_LIST itemsList;
|
||||||
ITEM_PICKER picker( NULL, UR_DELETED );
|
ITEM_PICKER picker( NULL, UR_DELETED );
|
||||||
int net_code_delete = aTrack->GetNetCode();
|
int netcode = aTrack->GetNetCode();
|
||||||
|
|
||||||
/* Search the first item for the given net code */
|
/* Search the first item for the given net code */
|
||||||
TRACK* trackList = GetBoard()->m_Track->GetStartNetCode( net_code_delete );
|
TRACK* trackList = GetBoard()->m_Track->GetStartNetCode( netcode );
|
||||||
|
|
||||||
/* Remove all segments having the given net code */
|
/* Remove all segments having the given net code */
|
||||||
int ii = 0;
|
int ii = 0;
|
||||||
|
@ -173,7 +171,7 @@ void PCB_EDIT_FRAME::Delete_net( wxDC* DC, TRACK* aTrack )
|
||||||
for( TRACK* segm = trackList; segm; segm = next_track, ++ii )
|
for( TRACK* segm = trackList; segm; segm = next_track, ++ii )
|
||||||
{
|
{
|
||||||
next_track = segm->Next();
|
next_track = segm->Next();
|
||||||
if( segm->GetNetCode() != net_code_delete )
|
if( segm->GetNetCode() != netcode )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
GetBoard()->GetRatsnest()->Remove( segm );
|
GetBoard()->GetRatsnest()->Remove( segm );
|
||||||
|
@ -188,7 +186,7 @@ void PCB_EDIT_FRAME::Delete_net( wxDC* DC, TRACK* aTrack )
|
||||||
|
|
||||||
SaveCopyInUndoList( itemsList, UR_DELETED );
|
SaveCopyInUndoList( itemsList, UR_DELETED );
|
||||||
OnModify();
|
OnModify();
|
||||||
TestNetConnection( DC, net_code_delete );
|
TestNetConnection( DC, netcode );
|
||||||
SetMsgPanel( GetBoard() );
|
SetMsgPanel( GetBoard() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -204,7 +204,7 @@ void DIALOG_MOVE_EXACT::OnTextFocusLost( wxFocusEvent& event )
|
||||||
wxTextCtrl* obj = static_cast<wxTextCtrl*>( event.GetEventObject() );
|
wxTextCtrl* obj = static_cast<wxTextCtrl*>( event.GetEventObject() );
|
||||||
|
|
||||||
if( obj->GetValue().IsEmpty() )
|
if( obj->GetValue().IsEmpty() )
|
||||||
{
|
|
||||||
obj->SetValue("0");
|
obj->SetValue("0");
|
||||||
}
|
|
||||||
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue