diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index af7cc3e4f0..416044cc5d 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -1529,7 +1529,7 @@ int BOARD::SetAreasNetCodesFromNetNames( void ) { if( !GetArea( ii )->IsOnCopperLayer() ) { - GetArea( ii )->SetNet( 0 ); + GetArea( ii )->SetNet( NETINFO_LIST::UNCONNECTED ); continue; } @@ -2546,7 +2546,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets, } if( !aNetlist.IsDryRun() ) - pad->SetNet( 0 ); + pad->SetNet( NETINFO_LIST::UNCONNECTED ); } } else // Footprint pad has a net. @@ -2649,7 +2649,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets, aReporter->Report( msg ); } - previouspad->SetNet( 0 ); + previouspad->SetNet( NETINFO_LIST::UNCONNECTED ); } netname = pad->GetNetname(); count = 1; @@ -2662,7 +2662,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets, // Examine last pad if( pad && count == 1 ) - pad->SetNet( 0 ); + pad->SetNet( NETINFO_LIST::UNCONNECTED ); } // Last step: Some tests: diff --git a/pcbnew/class_netinfo.h b/pcbnew/class_netinfo.h index c0e81a684e..8ea47c3676 100644 --- a/pcbnew/class_netinfo.h +++ b/pcbnew/class_netinfo.h @@ -199,6 +199,9 @@ public: return NULL; } + ///> Constant that holds the unconnected net number + static const int UNCONNECTED; + #if defined(DEBUG) void Show() const; #endif diff --git a/pcbnew/class_netinfolist.cpp b/pcbnew/class_netinfolist.cpp index 561e845e21..590cd352ce 100644 --- a/pcbnew/class_netinfolist.cpp +++ b/pcbnew/class_netinfolist.cpp @@ -162,3 +162,6 @@ void NETINFO_LIST::buildPadsFullList() m_Parent->m_Status_Pcb = LISTE_PAD_OK; } + + +const int NETINFO_LIST::UNCONNECTED = 0; diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 21cca65517..89c52bb9f9 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -690,7 +690,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, if( aDC->LogicalToDeviceXRel( m_Width ) < MIN_TEXT_SIZE ) return; - if( GetNet() == 0 ) + if( GetNet() == NETINFO_LIST::UNCONNECTED ) return; NETINFO_ITEM* net = ( (BOARD*) GetParent() )->FindNet( GetNet() ); @@ -952,7 +952,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, } // Display the short netname: - if( GetNet() == 0 ) + if( GetNet() == NETINFO_LIST::UNCONNECTED ) return; if( DisplayOpt.DisplayNetNamesMode == 0 || DisplayOpt.DisplayNetNamesMode == 1 ) diff --git a/pcbnew/connect.cpp b/pcbnew/connect.cpp index aa8d4867e6..1833bd0d65 100644 --- a/pcbnew/connect.cpp +++ b/pcbnew/connect.cpp @@ -842,7 +842,7 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode() curr_track->end = NULL; curr_track->SetState( BUSY | IN_EDIT | BEGIN_ONPAD | END_ONPAD, false ); curr_track->SetZoneSubNet( 0 ); - curr_track->SetNet( 0 ); // net code = 0 means not connected + curr_track->SetNet( NETINFO_LIST::UNCONNECTED ); } // If no pad, reset pointers and netcode, and do nothing else diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index 14405e9753..cc60db125f 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -1493,7 +1493,7 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics ) zone->SetTimeStamp( timeStamp( gr->second ) ); zone->SetLayer( layer ); - zone->SetNet( 0 ); + zone->SetNet( NETINFO_LIST::UNCONNECTED ); CPolyLine::HATCH_STYLE outline_hatch = CPolyLine::DIAGONAL_EDGE; @@ -2550,7 +2550,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals ) // KiCad does not support an unconnected zone with its own non-zero netcode, // but only when assigned netcode = 0 w/o a name... for( ZONES::iterator it = zones.begin(); it != zones.end(); ++it ) - (*it)->SetNet( 0 ); + (*it)->SetNet( NETINFO_LIST::UNCONNECTED ); // therefore omit this signal/net. } diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index ade83543f1..8b09403302 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -2421,7 +2421,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() // Ensure keepout does not have a net // (which have no sense for a keepout zone) if( zc->GetIsKeepout() ) - zc->SetNet( 0 ); + zc->SetNet( NETINFO_LIST::UNCONNECTED ); // should always occur, but who knows, a zone without two corners // is no zone at all, it's a spot? @@ -2431,7 +2431,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() if( !zc->IsOnCopperLayer() ) { zc->SetFillMode( 0 ); - zc->SetNet( 0 ); + zc->SetNet( NETINFO_LIST::UNCONNECTED ); } // Hatch here, after outlines corners are read diff --git a/pcbnew/pad_edition_functions.cpp b/pcbnew/pad_edition_functions.cpp index 839d1f39fc..e73e8d829a 100644 --- a/pcbnew/pad_edition_functions.cpp +++ b/pcbnew/pad_edition_functions.cpp @@ -141,7 +141,7 @@ void PCB_BASE_FRAME::AddPad( MODULE* aModule, bool draw ) // Update the pad properties. Import_Pad_Settings( pad, false ); - pad->SetNet( 0 ); + pad->SetNet( NETINFO_LIST::UNCONNECTED ); pad->SetPosition( GetCrossHairPosition() ); diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index 0fd7f55b64..b05ce179f2 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -2687,7 +2687,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR ) if( !zone->IsOnCopperLayer() ) { zone->SetFillMode( 0 ); - zone->SetNet( 0 ); + zone->SetNet( NETINFO_LIST::UNCONNECTED ); } // Set hatch here, after outlines corners are read @@ -2699,7 +2699,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR ) // Ensure keepout does not have a net (which have no sense for a keepout zone) if( zone->GetIsKeepout() ) - zone->SetNet( 0 ); + zone->SetNet( NETINFO_LIST::UNCONNECTED ); return zone.release(); } diff --git a/pcbnew/ratsnest.cpp b/pcbnew/ratsnest.cpp index b5347d3e85..32dba7213d 100644 --- a/pcbnew/ratsnest.cpp +++ b/pcbnew/ratsnest.cpp @@ -540,7 +540,7 @@ void PCB_BASE_FRAME::build_ratsnest_module( MODULE* aModule ) // collect active pads of the module: for( pad_ref = aModule->Pads(); pad_ref != NULL; pad_ref = pad_ref->Next() ) { - if( pad_ref->GetNet() == 0 ) + if( pad_ref->GetNet() == NETINFO_LIST::UNCONNECTED ) continue; localPadList.push_back( pad_ref ); diff --git a/pcbnew/xchgmod.cpp b/pcbnew/xchgmod.cpp index e983a0d6ee..af46b91592 100644 --- a/pcbnew/xchgmod.cpp +++ b/pcbnew/xchgmod.cpp @@ -455,7 +455,7 @@ void PCB_EDIT_FRAME::Exchange_Module( MODULE* aOldModule, // Update pad netnames ( when possible) for( D_PAD* pad = aNewModule->Pads(); pad != NULL; pad = pad->Next() ) { - pad->SetNet( 0 ); + pad->SetNet( NETINFO_LIST::UNCONNECTED ); D_PAD* old_pad = aOldModule->Pads(); for( ; old_pad != NULL; old_pad = old_pad->Next() ) diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp index 977fef6e29..9eddd5f7bb 100644 --- a/pcbnew/zones_by_polygon.cpp +++ b/pcbnew/zones_by_polygon.cpp @@ -577,7 +577,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) zoneInfo.SetIsKeepout( true ); // Netcode and netname are irrelevant, // so ensure they are cleared - zone->SetNet( 0 ); + zone->SetNet( NETINFO_LIST::UNCONNECTED ); edited = InvokeKeepoutAreaEditor( this, &zoneInfo ); } else