Pcbnew: fix bug #142348 (airwire does not always appear after deleting a track). Very minor other fixes.

This commit is contained in:
jean-pierre charras 2015-02-20 20:04:32 +01:00
parent 590d9b3b18
commit bd5d468251
8 changed files with 32 additions and 42 deletions

View File

@ -67,7 +67,7 @@ void KIWAY::player_destroy_handler( wxWindowDestroyEvent& event )
// if destroying one of our flock, then mark it as deceased.
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() ) );)
m_player[i] = 0;

View File

@ -203,7 +203,7 @@ void SEARCH_STACK::Show( const char* aPrefix ) const
printf( "%s SEARCH_STACK:\n", aPrefix );
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

View File

@ -282,9 +282,9 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event
}
#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].GetText() ) );
}
@ -488,7 +488,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers()
#if defined(DEBUG)
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

View File

@ -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
// component has multiple parts, we don't want the part suffix added to the field.
wxString newtext = aField->GetText();
m_canvas->SetIgnoreMouseEvents( true );
wxString title;
@ -91,7 +90,7 @@ void SCH_EDIT_FRAME::EditComponentFieldText( SCH_FIELD* aField )
m_canvas->MoveCursorToCrossHair();
m_canvas->SetIgnoreMouseEvents( false );
newtext = dlg.GetTextField( );
wxString newtext = dlg.GetTextField( );
if ( response != wxID_OK )
return; // canceled by user

View File

@ -42,9 +42,7 @@
#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_entryName;

View File

@ -780,27 +780,21 @@ void PCB_BASE_FRAME::TestConnections()
void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode )
{
wxString msg;
if( aNetCode <= 0 ) // -1 = not existing net, 0 = dummy net
// Skip dummy net -1, and "not connected" net 0 (grouping all not connected pads)
if( aNetCode <= 0 )
return;
if( (m_Pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
Compile_Ratsnest( aDC, true );
// 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 )
{
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;
pad->SetSubNet( 0 );
if( m_Pcb->GetPad(i)->GetNetCode() == aNetCode )
pad->SetSubNet( 0 );
}
m_Pcb->Test_Connections_To_Copper_Areas( aNetCode );
@ -810,16 +804,15 @@ void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode )
{
CONNECTIONS connections( m_Pcb );
TRACK* firstTrack;
TRACK* lastTrack = NULL;
firstTrack = m_Pcb->m_Track.GetFirst()->GetStartNetCode( aNetCode );
TRACK* firstTrack = m_Pcb->m_Track.GetFirst()->GetStartNetCode( aNetCode );
if( firstTrack )
lastTrack = firstTrack->GetEndNetCode( aNetCode );
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 );
// Display results
wxString msg;
int net_notconnected_count = 0;
NETINFO_ITEM* net = m_Pcb->FindNet( aNetCode );
@ -842,14 +836,15 @@ void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode )
net_notconnected_count++;
}
msg.Printf( wxT( "links %d nc %d net:nc %d" ),
m_Pcb->GetRatsnestsCount(), m_Pcb->GetUnconnectedNetCount(),
msg.Printf( wxT( "links %d nc %d net %d: not conn %d" ),
m_Pcb->GetRatsnestsCount(), m_Pcb->GetUnconnectedNetCount(), aNetCode,
net_notconnected_count );
}
else
msg.Printf( wxT( "net not found: netcode %d" ),aNetCode );
msg.Printf( wxT( "net not found: netcode %d" ), aNetCode );
SetStatusText( msg );
return;
}

View File

@ -44,8 +44,6 @@
TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack )
{
int current_net_code;
if( aTrack == NULL )
return NULL;
@ -120,20 +118,20 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack )
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 );
aTrack->ViewRelease();
container->Remove( aTrack );
// redraw the area where the track was
m_canvas->RefreshDrawingRect( aTrack->GetBoundingBox() );
SaveCopyInUndoList( aTrack, UR_DELETED );
OnModify();
TestNetConnection( DC, current_net_code );
TestNetConnection( DC, netcode );
SetMsgPanel( GetBoard() );
return NULL;
@ -144,10 +142,10 @@ void PCB_EDIT_FRAME::Delete_Track( wxDC* DC, TRACK* aTrack )
{
if( aTrack != NULL )
{
int current_net_code = aTrack->GetNetCode();
int netcode = aTrack->GetNetCode();
Remove_One_Track( DC, aTrack );
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;
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 */
TRACK* trackList = GetBoard()->m_Track->GetStartNetCode( net_code_delete );
TRACK* trackList = GetBoard()->m_Track->GetStartNetCode( netcode );
/* Remove all segments having the given net code */
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 )
{
next_track = segm->Next();
if( segm->GetNetCode() != net_code_delete )
if( segm->GetNetCode() != netcode )
break;
GetBoard()->GetRatsnest()->Remove( segm );
@ -188,7 +186,7 @@ void PCB_EDIT_FRAME::Delete_net( wxDC* DC, TRACK* aTrack )
SaveCopyInUndoList( itemsList, UR_DELETED );
OnModify();
TestNetConnection( DC, net_code_delete );
TestNetConnection( DC, netcode );
SetMsgPanel( GetBoard() );
}

View File

@ -204,7 +204,7 @@ void DIALOG_MOVE_EXACT::OnTextFocusLost( wxFocusEvent& event )
wxTextCtrl* obj = static_cast<wxTextCtrl*>( event.GetEventObject() );
if( obj->GetValue().IsEmpty() )
{
obj->SetValue("0");
}
event.Skip();
}