Code cleanup: remove dead code, add comment.

This commit is contained in:
Simon Richter 2016-06-08 08:32:01 +02:00 committed by jean-pierre charras
parent 080d7f1024
commit 715eddf68b
6 changed files with 12 additions and 101 deletions

View File

@ -672,15 +672,7 @@ static struct IFACE : public KIFACE_I
wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 )
{
switch( aClassId )
{
default:
{
KIWAY_PLAYER* frame = new BM2CMP_FRAME( aKiway, aParent );
return frame;
}
}
return new BM2CMP_FRAME( aKiway, aParent );
}
/**

View File

@ -156,7 +156,7 @@ public:
m_ConnectionType = aFlg;
}
NET_CONNECTION_T GetConnectionType()
NET_CONNECTION_T GetConnectionType() const
{
return m_ConnectionType;
}

View File

@ -496,6 +496,15 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
unsigned nextNet = lastNet = 0;
int MinConn = NOC;
/* The netlist generated by SCH_EDIT_FRAME::BuildNetListBase is sorted
* by net number, which means we can group netlist items into ranges
* that live in the same net. The range from nextItem to the current
* item (exclusive) needs to be checked against the current item. The
* lastItem variable is used as a helper to pass the last item's number
* from one loop iteration to the next, which simplifies the initial
* pass.
*/
for( unsigned net = 0; net < objectsConnectedList->size(); net++ )
{
if( objectsConnectedList->GetItemNet( lastNet ) !=

View File

@ -489,79 +489,6 @@ XNODE* NETLIST_EXPORTER_GENERIC::makeListOfNets()
}
bool NETLIST_EXPORTER_GENERIC::writeListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
{
int ret = 0;
int netCode;
int lastNetCode = -1;
int sameNetcodeCount = 0;
wxString netName;
wxString ref;
wxString netcodeName;
char firstItemInNet[256];
for( unsigned ii = 0; ii < aObjectsList.size(); ii++ )
{
SCH_COMPONENT* comp;
NETLIST_OBJECT* nitem = aObjectsList[ii];
// New net found, write net id;
if( ( netCode = nitem->GetNet() ) != lastNetCode )
{
sameNetcodeCount = 0; // Items count for this net
netName = nitem->GetNetName();
netcodeName.Printf( wxT( "Net %d " ), netCode );
netcodeName << wxT( "\"" ) << netName << wxT( "\"" );
// Add the netname without prefix, in cases we need only the
// "short" netname
netcodeName += wxT( " \"" ) + nitem->GetShortNetName() + wxT( "\"" );
lastNetCode = netCode;
}
if( nitem->m_Type != NET_PIN )
continue;
if( nitem->m_Flag != 0 ) // Redundant pin, skip it
continue;
comp = nitem->GetComponentParent();
// Get the reference for the net name and the main parent component
ref = comp->GetRef( &nitem->m_SheetPath );
if( ref[0] == wxChar( '#' ) )
continue; // Pseudo component (Like Power symbol)
// Print the pin list for this net, use special handling if
// 2 or more items are connected:
// if first item for this net found, defer printing this connection
// until a second item will is found
if( ++sameNetcodeCount == 1 )
{
snprintf( firstItemInNet, sizeof(firstItemInNet), " %s %.4s\n",
TO_UTF8( ref ),
(const char*) &aObjectsList[ii]->m_PinNum );
}
// Second item for this net found, print the Net name, and the
// first item
if( sameNetcodeCount == 2 )
{
ret |= fprintf( f, "%s\n", TO_UTF8( netcodeName ) );
ret |= fputs( firstItemInNet, f );
}
if( sameNetcodeCount >= 2 )
ret |= fprintf( f, " %s %.4s\n", TO_UTF8( ref ),
(const char*) &nitem->m_PinNum );
}
return ret >= 0;
}
XNODE* NETLIST_EXPORTER_GENERIC::node( const wxString& aName, const wxString& aTextualContent /* = wxEmptyString*/ )
{
XNODE* n = new XNODE( wxXML_ELEMENT_NODE, aName );

View File

@ -79,13 +79,6 @@ protected:
*/
XNODE* node( const wxString& aName, const wxString& aTextualContent = wxEmptyString );
/**
* Function writeGENERICListOfNets
* writes out nets (ranked by Netcode), and elements that are
* connected as part of that net.
*/
bool writeListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjectsList );
/**
* Function makeGenericRoot
* builds the entire document tree for the generic export. This is factored

View File

@ -61,17 +61,7 @@ static struct IFACE : public KIFACE_I
wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 )
{
switch( aClassId )
{
default:
{
PCB_CALCULATOR_FRAME* frame = new PCB_CALCULATOR_FRAME( aKiway, aParent );
return frame;
}
break;
}
return NULL;
return new PCB_CALCULATOR_FRAME( aKiway, aParent );
}
/**