Code clean-up and formatting

This commit is contained in:
Maciej Suminski 2017-07-17 10:21:36 +02:00
parent 8dd36b4d2b
commit 10c5297f2e
2 changed files with 12 additions and 9 deletions

View File

@ -578,15 +578,18 @@ const std::vector<BOARD_CONNECTED_ITEM*> CONNECTIVITY_DATA::GetConnectedItems(
return rv; return rv;
} }
RN_NET* CONNECTIVITY_DATA::GetRatsnestForNet( int aNet ) RN_NET* CONNECTIVITY_DATA::GetRatsnestForNet( int aNet )
{ {
if ( aNet < 0 || aNet >= (int)m_nets.size() ) if ( aNet < 0 || aNet >= (int) m_nets.size() )
{ {
return nullptr; return nullptr;
} }
return m_nets[ aNet ]; return m_nets[ aNet ];
} }
void CONNECTIVITY_DATA::MarkItemNetAsDirty( BOARD_ITEM *aItem ) void CONNECTIVITY_DATA::MarkItemNetAsDirty( BOARD_ITEM *aItem )
{ {
if (aItem->Type() == PCB_MODULE_T) if (aItem->Type() == PCB_MODULE_T)

View File

@ -916,19 +916,17 @@ void SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetpath )
// then we need to determine if these modules are in the list of modules // then we need to determine if these modules are in the list of modules
// belonging to this sheet ( modList ) // belonging to this sheet ( modList )
std::list<int> removeCodeList; std::list<int> removeCodeList;
constexpr KICAD_T padType[] = { PCB_PAD_T, EOT };
KICAD_T padType[] = { PCB_PAD_T };
for( int netCode : netcodeList ) for( int netCode : netcodeList )
{ {
for( BOARD_CONNECTED_ITEM* mitem : board()->GetConnectivity()->GetNetItems( netCode, padType ) ) for( BOARD_CONNECTED_ITEM* mitem : board()->GetConnectivity()->GetNetItems( netCode, padType ) )
{ {
if( mitem->Type() == PCB_PAD_T) if( mitem->Type() == PCB_PAD_T)
{ {
bool found = ( std::find( modList.begin(), modList.end(),
mitem->GetParent() ) != modList.end() );
/* std::cout << "Checking net " << netCode << "of type " << mitem->Type() << ": "; */
bool found = ( std::find( modList.begin(), modList.end(), mitem->GetParent() ) != modList.end() );
if( !found ) if( !found )
{ {
// if we cannot find the module of the pad in the modList // if we cannot find the module of the pad in the modList
@ -951,13 +949,13 @@ void SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetpath )
} }
std::list<BOARD_CONNECTED_ITEM*> localConnectionList; std::list<BOARD_CONNECTED_ITEM*> localConnectionList;
constexpr KICAD_T trackViaType[] = { PCB_TRACE_T, PCB_VIA_T, EOT };
for( int netCode : netcodeList ) for( int netCode : netcodeList )
{ {
KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, EOT }; for( BOARD_CONNECTED_ITEM* item : board()->GetConnectivity()->GetNetItems( netCode, trackViaType ) )
for( BOARD_CONNECTED_ITEM* item : board()->GetConnectivity()->GetNetItems( netCode, types ) )
{ {
localConnectionList.push_back( item ); localConnectionList.push_back( item );
std::cout << netCode << std::endl;
} }
} }
@ -966,6 +964,7 @@ void SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetpath )
if( i != NULL ) if( i != NULL )
select( i ); select( i );
} }
for( BOARD_CONNECTED_ITEM* i : localConnectionList ) for( BOARD_CONNECTED_ITEM* i : localConnectionList )
{ {
if( i != NULL ) if( i != NULL )
@ -973,6 +972,7 @@ void SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetpath )
} }
} }
void SELECTION_TOOL::zoomFitSelection( void ) void SELECTION_TOOL::zoomFitSelection( void )
{ {
//Should recalculate the view to zoom in on the selection //Should recalculate the view to zoom in on the selection