Moving modules from DLIST to std::deque

This commit is contained in:
Seth Hillbrand 2019-05-30 17:15:57 -07:00
parent 961b22d603
commit d1877d7c1b
58 changed files with 292 additions and 274 deletions

View File

@ -488,7 +488,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
// Add holes of modules
// /////////////////////////////////////////////////////////////////////////
for( const MODULE* module = m_board->m_Modules; module; module = module->Next() )
for( auto module : m_board->Modules() )
{
const D_PAD* pad = module->PadsList();
@ -522,7 +522,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
// Add contours of the pad holes (pads can be Circle or Segment holes)
// /////////////////////////////////////////////////////////////////////////
for( const MODULE* module = m_board->m_Modules; module; module = module->Next() )
for( auto module : m_board->Modules() )
{
const D_PAD* pad = module->PadsList();
@ -566,7 +566,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
CBVHCONTAINER2D *layerContainer = m_layers_container2D[curr_layer_id];
// ADD PADS
for( const MODULE* module = m_board->m_Modules; module; module = module->Next() )
for( auto module : m_board->Modules() )
{
// Note: NPTH pads are not drawn on copper layers when the pad
// has same shape as its hole
@ -603,7 +603,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
SHAPE_POLY_SET *layerPoly = m_layers_poly[curr_layer_id];
// ADD PADS
for( const MODULE* module = m_board->m_Modules; module; module = module->Next() )
for( auto module : m_board->Modules() )
{
// Construct polys
// /////////////////////////////////////////////////////////////
@ -993,7 +993,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
// Add modules tech layers - objects
// /////////////////////////////////////////////////////////////////////
for( MODULE* module = m_board->m_Modules; module; module = module->Next() )
for( auto module : m_board->Modules() )
{
if( (curr_layer_id == F_SilkS) || (curr_layer_id == B_SilkS) )
{
@ -1020,7 +1020,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
// Add modules tech layers - contours
// /////////////////////////////////////////////////////////////////////
for( MODULE* module = m_board->m_Modules; module; module = module->Next() )
for( auto module : m_board->Modules() )
{
if( (curr_layer_id == F_SilkS) || (curr_layer_id == B_SilkS) )
{

View File

@ -800,9 +800,7 @@ void C3D_RENDER_OGL_LEGACY::generate_3D_Vias_and_Pads()
tht_inner_holes_poly.RemoveAllContours();
// Insert pads holes (vertical cylinders)
for( const MODULE* module = m_settings.GetBoard()->m_Modules;
module;
module = module->Next() )
for( const auto module : m_settings.GetBoard()->Modules() )
{
for( const D_PAD* pad = module->PadsList(); pad; pad = pad->Next() )
{
@ -907,8 +905,7 @@ void C3D_RENDER_OGL_LEGACY::load_3D_models( REPORTER *aStatusTextReporter )
return;
// Go for all modules
for( const MODULE* module = m_settings.GetBoard()->m_Modules;
module; module = module->Next() )
for( auto module : m_settings.GetBoard()->Modules() )
{
if( !module->Models().empty() )
{

View File

@ -980,18 +980,13 @@ void C3D_RENDER_OGL_LEGACY::render_3D_models( bool aRenderTopOrBot,
bool aRenderTransparentOnly )
{
// Go for all modules
if( m_settings.GetBoard()->m_Modules.GetCount() )
for( auto module : m_settings.GetBoard()->Modules() )
{
for( const MODULE* module = m_settings.GetBoard()->m_Modules;
module;
module = module->Next() )
{
if( !module->Models().empty() )
if( m_settings.ShouldModuleBeDisplayed( (MODULE_ATTR_T)module->GetAttributes() ) )
if( ( aRenderTopOrBot && !module->IsFlipped()) ||
(!aRenderTopOrBot && module->IsFlipped()) )
render_3D_module( module, aRenderTransparentOnly );
}
if( !module->Models().empty() )
if( m_settings.ShouldModuleBeDisplayed( (MODULE_ATTR_T) module->GetAttributes() ) )
if( ( aRenderTopOrBot && !module->IsFlipped() )
|| ( !aRenderTopOrBot && module->IsFlipped() ) )
render_3D_module( module, aRenderTransparentOnly );
}
}

View File

@ -1183,9 +1183,7 @@ void C3D_RENDER_RAYTRACING::add_3D_vias_and_pads_to_container()
}
// Insert pads holes (vertical cylinders)
for( const MODULE* module = m_settings.GetBoard()->m_Modules;
module;
module = module->Next() )
for( auto module : m_settings.GetBoard()->Modules() )
{
for( const D_PAD* pad = module->PadsList(); pad; pad = pad->Next() )
if( pad->GetAttribute () != PAD_ATTRIB_HOLE_NOT_PLATED )
@ -1199,9 +1197,7 @@ void C3D_RENDER_RAYTRACING::add_3D_vias_and_pads_to_container()
void C3D_RENDER_RAYTRACING::load_3D_models()
{
// Go for all modules
for( const MODULE* module = m_settings.GetBoard()->m_Modules;
module;
module = module->Next() )
for( auto module : m_settings.GetBoard()->Modules() )
{
if( (!module->Models().empty() ) &&
m_settings.ShouldModuleBeDisplayed( (MODULE_ATTR_T)module->GetAttributes() ) )

View File

@ -413,8 +413,10 @@ void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
MODULE* module = nullptr;
const FOOTPRINT_INFO* module_info = nullptr;
if( GetBoard()->m_Modules.GetCount() )
GetBoard()->m_Modules.DeleteAll();
for( auto it = GetBoard()->Modules().begin(); it != GetBoard()->Modules().end(); it++ )
delete *it;
GetBoard()->Modules().clear();
wxString footprintName = parentframe->GetSelectedFootprint();
@ -436,7 +438,7 @@ void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
}
if( module )
GetBoard()->m_Modules.PushBack( module );
GetBoard()->Modules().push_back( module );
if( module_info )
SetStatusText( wxString::Format( _( "Lib: %s" ), module_info->GetLibNickname() ), 0 );
@ -471,7 +473,7 @@ void DISPLAY_FOOTPRINTS_FRAME::updateView()
void DISPLAY_FOOTPRINTS_FRAME::UpdateMsgPanel()
{
MODULE* footprint = GetBoard()->m_Modules;
MODULE* footprint = GetBoard()->GetFirstModule();
MSG_PANEL_ITEMS items;
if( footprint )
@ -515,7 +517,9 @@ void DISPLAY_FOOTPRINTS_FRAME::SyncMenusAndToolbars()
*/
void BOARD::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset )
{
if( m_Modules )
m_Modules->Print( aFrame, aDC );
if( !m_modules.empty() )
{
GetFirstModule()->Print( aFrame, aDC );
}
}

View File

@ -129,10 +129,10 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
// modules inside modules are not supported yet
wxASSERT( boardItem->Type() != PCB_MODULE_T );
boardItem->SetParent( board->m_Modules.GetFirst() );
boardItem->SetParent( board->Modules().front() );
if( !( changeFlags & CHT_DONE ) )
board->m_Modules->Add( boardItem );
board->Modules().front()->Add( boardItem );
}
view->Add( boardItem );

View File

@ -83,7 +83,7 @@ void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_
}
// convert pads
for( MODULE* module = m_Modules; module != NULL; module = module->Next() )
for( auto module : m_modules )
{
module->TransformPadsShapesWithClearanceToPolygon( aLayer, aOutlines, 0 );

View File

@ -530,12 +530,10 @@ bool BOARD_NETLIST_UPDATER::updateCopperZoneNets( NETLIST& aNetlist )
bool BOARD_NETLIST_UPDATER::deleteUnusedComponents( NETLIST& aNetlist )
{
wxString msg;
MODULE* nextModule;
const COMPONENT* component;
for( MODULE* module = m_board->m_Modules; module != NULL; module = nextModule )
for( auto module : m_board->Modules() )
{
nextModule = module->Next();
if( m_lookupByTimestamp )
component = aNetlist.GetComponentByTimeStamp( module->GetPath() );
@ -691,7 +689,7 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist )
m_errorCount = 0;
m_warningCount = 0;
m_newFootprintsCount = 0;
MODULE* lastPreexistingFootprint = m_board->m_Modules.GetLast();
MODULE* lastPreexistingFootprint = m_board->Modules().back();
cacheCopperZoneConnections();
@ -717,7 +715,7 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist )
component->GetFPID().Format().wx_str() );
m_reporter->Report( msg, REPORTER::RPT_INFO );
for( MODULE* footprint = m_board->m_Modules; footprint; footprint = footprint->Next() )
for( auto footprint : m_board->Modules() )
{
bool match = false;

View File

@ -77,10 +77,9 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
{
wxFileName fn;
FILE* fp_bom;
MODULE* module = GetBoard()->m_Modules;
wxString msg;
if( module == NULL )
if( GetBoard()->Modules().empty() )
{
DisplayError( this, _( "Cannot export BOM: there are no footprints in the PCB" ) );
return;
@ -126,7 +125,7 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
CmpList::iterator iter;
int i = 1;
while( module != NULL )
for( auto module : GetBoard()->Modules() )
{
bool valExist = false;
@ -157,9 +156,6 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
comp->m_CmpCount = 1;
list.Append( comp );
}
// increment module
module = module->Next();
}
// Print list. Also delete temporary created objects.

View File

@ -902,9 +902,9 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode )
case PCB_MODULE_T:
if( aMode == ADD_APPEND )
m_Modules.PushBack( (MODULE*) aBoardItem );
m_modules.push_back( (MODULE*) aBoardItem );
else
m_Modules.PushFront( (MODULE*) aBoardItem );
m_modules.push_front( (MODULE*) aBoardItem );
break;
@ -977,7 +977,8 @@ void BOARD::Remove( BOARD_ITEM* aBoardItem )
break;
case PCB_MODULE_T:
m_Modules.Remove( (MODULE*) aBoardItem );
m_modules.erase( std::remove_if( m_modules.begin(), m_modules.end(),
[aBoardItem]( BOARD_ITEM* aItem ) { return aItem == aBoardItem; } ) );
break;
case PCB_TRACE_T:
@ -1123,7 +1124,7 @@ EDA_RECT BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) const
if( !aBoardEdgesOnly )
{
// Check modules
for( MODULE* module = m_Modules; module; module = module->Next() )
for( auto module : m_modules )
{
if( !( module->GetLayerSet() & visible ).any() )
continue;
@ -1240,7 +1241,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s
case PCB_MODULE_EDGE_T:
// this calls MODULE::Visit() on each module.
result = IterateForward( m_Modules, inspector, testData, p );
result = IterateForward<MODULE*>( m_modules, inspector, testData, p );
// skip over any types handled in the above call.
for( ; ; )
@ -1434,7 +1435,7 @@ MODULE* BOARD::FindModule( const wxString& aRefOrTimeStamp, bool aSearchByTimeSt
{
if( aSearchByTimeStamp )
{
for( MODULE* module = m_Modules; module; module = module->Next() )
for( auto module : m_modules )
{
if( aRefOrTimeStamp.CmpNoCase( module->GetPath() ) == 0 )
return module;
@ -1605,7 +1606,7 @@ D_PAD* BOARD::GetPad( const wxPoint& aPosition, LSET aLayerSet )
if( !aLayerSet.any() )
aLayerSet = LSET::AllCuMask();
for( MODULE* module = m_Modules; module; module = module->Next() )
for( auto module : m_modules )
{
D_PAD* pad = NULL;
@ -2137,14 +2138,13 @@ TRACK* BOARD::MarkTrace( TRACK* aTrackList, TRACK* aTrace, int* aCount,
MODULE* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer,
bool aVisibleOnly, bool aIgnoreLocked )
{
MODULE* pt_module;
MODULE* module = NULL;
MODULE* alt_module = NULL;
int min_dim = 0x7FFFFFFF;
int alt_min_dim = 0x7FFFFFFF;
bool current_layer_back = IsBackLayer( aActiveLayer );
for( pt_module = m_Modules; pt_module; pt_module = pt_module->Next() )
for( auto pt_module : m_modules )
{
// is the ref point within the module's bounds?
if( !pt_module->HitTest( aPosition ) )
@ -2205,7 +2205,7 @@ MODULE* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer
BOARD_CONNECTED_ITEM* BOARD::GetLockPoint( const wxPoint& aPosition, LSET aLayerSet )
{
for( MODULE* module = m_Modules; module; module = module->Next() )
for( auto module : m_modules )
{
D_PAD* pad = module->GetPad( aPosition, aLayerSet );
@ -2497,9 +2497,9 @@ D_PAD* BOARD::GetPad( unsigned aIndex ) const
{
unsigned count = 0;
for( MODULE* mod = m_Modules; mod ; mod = mod->Next() ) // FIXME: const DLIST_ITERATOR
for( auto mod : m_modules )
{
for( D_PAD* pad = mod->PadsList(); pad; pad = pad->Next() )
for( auto pad : mod->Pads() )
{
if( count == aIndex )
return pad;

View File

@ -34,17 +34,18 @@
#include <dlist.h>
#include <core/iterators.h>
#include <common.h> // PAGE_INFO
#include <layers_id_colors_and_visibility.h>
#include <netinfo.h>
#include <board_design_settings.h>
#include <board_item_container.h>
#include <class_module.h>
#include <class_pad.h>
#include <colors_design_settings.h>
#include <board_design_settings.h>
#include <common.h> // PAGE_INFO
#include <eda_rect.h>
#include <layers_id_colors_and_visibility.h>
#include <netinfo.h>
#include <pcb_plot_params.h>
#include <title_block.h>
#include <zone_settings.h>
#include <pcb_plot_params.h>
#include <board_item_container.h>
#include <eda_rect.h>
#include <memory>
@ -158,10 +159,11 @@ protected:
};
DECL_VEC_FOR_SWIG(MARKERS, MARKER_PCB*)
DECL_VEC_FOR_SWIG(ZONE_CONTAINERS, ZONE_CONTAINER*)
DECL_VEC_FOR_SWIG(TRACKS, TRACK*)
DECL_DEQ_FOR_SWIG(DRAWINGS, BOARD_ITEM*)
DECL_VEC_FOR_SWIG( MARKERS, MARKER_PCB* )
DECL_VEC_FOR_SWIG( ZONE_CONTAINERS, ZONE_CONTAINER* )
DECL_VEC_FOR_SWIG( TRACKS, TRACK* )
DECL_DEQ_FOR_SWIG( DRAWINGS, BOARD_ITEM* )
DECL_DEQ_FOR_SWIG( MODULES, MODULE* )
/**
@ -182,6 +184,9 @@ private:
/// BOARD_ITEMs for drawings on the board, owned by pointer.
DRAWINGS m_drawings;
/// MODULES for components on the board, owned by pointer.
MODULES m_modules;
/// edge zone descriptors, owned by pointer.
ZONE_CONTAINERS m_ZoneDescriptorList;
@ -245,11 +250,17 @@ public:
public:
DLIST<MODULE> m_Modules; // linked list of MODULEs
DLIST<TRACK> m_Track; // linked list of TRACKs and VIAs
DLIST_ITERATOR_WRAPPER<TRACK> Tracks() { return DLIST_ITERATOR_WRAPPER<TRACK>(m_Track); }
DLIST_ITERATOR_WRAPPER<MODULE> Modules() { return DLIST_ITERATOR_WRAPPER<MODULE>(m_Modules); }
MODULES& Modules()
{
return m_modules;
}
const MODULES& Modules() const
{
return m_modules;
}
DRAWINGS& Drawings() { return m_drawings; }
ZONE_CONTAINERS& Zones() { return m_ZoneDescriptorList; }
const std::vector<BOARD_CONNECTED_ITEM*> AllConnectedItems();
@ -265,7 +276,7 @@ public:
bool IsEmpty() const
{
return m_drawings.empty() && m_Modules.GetCount() == 0 && m_Track.GetCount() == 0;
return m_drawings.empty() && m_modules.empty() && m_Track.GetCount() == 0;
}
void Move( const wxPoint& aMoveVector ) override;
@ -277,6 +288,26 @@ public:
void Remove( BOARD_ITEM* aBoardItem ) override;
/**
* Gets the first module in the list (used in footprint viewer/editor) or NULL if none
* @return first module or null pointer
*/
MODULE* GetFirstModule() const
{
return m_modules.empty() ? nullptr : m_modules.front();
}
/**
* Removes all modules from the deque and frees the memory associated with them
*/
void DeleteAllModules()
{
for( MODULE* mod : m_modules )
delete mod;
m_modules.clear();
}
BOARD_ITEM* GetItem( void* aWeakReference );
BOARD_ITEM* Duplicate( const BOARD_ITEM* aItem, bool aAddToBoard = false );

View File

@ -119,9 +119,6 @@ public:
return aItem && PCB_MODULE_T == aItem->Type();
}
MODULE* Next() const { return static_cast<MODULE*>( Pnext ); }
MODULE* Back() const { return static_cast<MODULE*>( Pback ); }
///> @copydoc BOARD_ITEM_CONTAINER::Add()
void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_INSERT ) override;

View File

@ -284,13 +284,11 @@ void DIALOG_EXCHANGE_FOOTPRINTS::OnApplyClicked( wxCommandEvent& event )
bool DIALOG_EXCHANGE_FOOTPRINTS::processMatchingModules()
{
MODULE* Module;
MODULE* PtBack;
bool change = false;
LIB_ID newFPID;
wxString value;
if( !m_parent->GetBoard()->m_Modules )
if( m_parent->GetBoard()->Modules().empty() )
return false;
if( !m_updateMode )
@ -303,26 +301,23 @@ bool DIALOG_EXCHANGE_FOOTPRINTS::processMatchingModules()
/* The change is done from the last module because processModule() modifies the last item
* in the list.
* Note: for the first module in chain (the last here), Module->Back() points to the board
* or is NULL.
*/
Module = m_parent->GetBoard()->m_Modules.GetLast();
for( ; Module && Module->Type() == PCB_MODULE_T; Module = PtBack )
for( auto it = m_parent->GetBoard()->Modules().rbegin();
it != m_parent->GetBoard()->Modules().rend(); it++ )
{
PtBack = Module->Back();
auto mod = *it;
if( !isMatch( Module ) )
if( !isMatch( mod ) )
continue;
if( m_updateMode )
{
if( processModule( Module, Module->GetFPID()) )
if( processModule( mod, mod->GetFPID() ) )
change = true;
}
else
{
if( processModule( Module, newFPID ) )
if( processModule( mod, newFPID ) )
change = true;
}
}

View File

@ -99,7 +99,7 @@ void DIALOG_FIND::onButtonFindItemClick( wxCommandEvent& aEvent )
int count = 0;
for( MODULE* module = parent->GetBoard()->m_Modules; module; module = module->Next() )
for( auto module : parent->GetBoard()->Modules() )
{
if( WildCompareString( searchString, module->GetReference().GetData(), false ) )
{

View File

@ -153,7 +153,7 @@ void DIALOG_GENDRILL::InitDisplayParams()
m_microViasCount = 0;
m_blindOrBuriedViasCount = 0;
for( MODULE* module = m_board->m_Modules; module; module = module->Next() )
for( auto module : m_board->Modules() )
{
for( D_PAD* pad = module->PadsList(); pad != NULL; pad = pad->Next() )
{

View File

@ -110,7 +110,6 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete()
BOARD* pcb = m_Parent->GetBoard();
BOARD_COMMIT commit( m_Parent );
BOARD_ITEM* item;
LSET layers_filter = LSET().set();
@ -120,7 +119,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete()
if( delAll || m_DelZones->GetValue() )
{
int area_index = 0;
item = pcb->GetArea( area_index );
auto item = pcb->GetArea( area_index );
while( item )
{
@ -170,7 +169,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete()
if( delAll || m_DelModules->GetValue() )
{
for( item = pcb->m_Modules; item; item = item->Next() )
for( auto item : pcb->Modules() )
{
bool del_fp = delAll;

View File

@ -178,7 +178,7 @@ void DIALOG_NETLIST::OnUpdatePCB( wxCommandEvent& event )
void DIALOG_NETLIST::OnTestFootprintsClick( wxCommandEvent& event )
{
if( m_parent->GetBoard()->m_Modules == nullptr )
if( m_parent->GetBoard()->GetFirstModule() == nullptr )
{
DisplayInfoMessage( this, _( "No footprints." ) );
return;

View File

@ -1478,23 +1478,25 @@ void DRC::doFootprintOverlappingDrc()
void DRC::TestFootprints( NETLIST& aNetlist, BOARD* aPCB, EDA_UNITS_T aUnits,
DRC_LIST& aDRCList )
{
MODULE* module;
MODULE* nextModule;
auto mods = aPCB->Modules();
std::sort( mods.begin(), mods.end(), []( const MODULE* a, const MODULE* b ) {
return a->GetReference().CmpNoCase( b->GetReference() );
} );
// Search for duplicate footprints.
for( module = aPCB->m_Modules; module != NULL; module = module->Next() )
for( auto it = mods.begin(); it != mods.end(); it++ )
{
nextModule = module->Next();
auto next_it = it + 1;
for( ; nextModule != NULL; nextModule = nextModule->Next() )
if( next_it == mods.end() )
break;
if( ( *it )->GetReference().CmpNoCase( ( *next_it )->GetReference() ) == 0 )
{
if( module->GetReference().CmpNoCase( nextModule->GetReference() ) == 0 )
{
aDRCList.emplace_back( new DRC_ITEM( aUnits, DRCE_DUPLICATE_FOOTPRINT,
module, module->GetPosition(),
nextModule, nextModule->GetPosition() ) );
break;
}
aDRCList.emplace_back( new DRC_ITEM( aUnits, DRCE_DUPLICATE_FOOTPRINT, *it,
( *it )->GetPosition(), *next_it, ( *next_it )->GetPosition() ) );
break;
}
}
@ -1503,7 +1505,7 @@ void DRC::TestFootprints( NETLIST& aNetlist, BOARD* aPCB, EDA_UNITS_T aUnits,
{
COMPONENT* component = aNetlist.GetComponent( ii );
module = aPCB->FindModuleByReference( component->GetReference() );
auto module = aPCB->FindModuleByReference( component->GetReference() );
if( module == NULL )
{
@ -1516,9 +1518,8 @@ void DRC::TestFootprints( NETLIST& aNetlist, BOARD* aPCB, EDA_UNITS_T aUnits,
}
// Search for component footprints found on board but not in netlist.
for( module = aPCB->m_Modules; module != NULL; module = module->Next() )
for( auto module : mods )
{
COMPONENT* component = aNetlist.GetComponentByReference( module->GetReference() );
if( component == NULL )

View File

@ -65,7 +65,7 @@ bool DRC_COURTYARD_OVERLAP::RunDRC( BOARD& aBoard ) const
const DRC_MARKER_FACTORY& marker_factory = GetMarkerFactory();
// Update courtyard polygons, and test for missing courtyard definition:
for( MODULE* footprint = aBoard.m_Modules; footprint; footprint = footprint->Next() )
for( auto footprint : aBoard.Modules() )
{
wxPoint pos = footprint->GetPosition();
bool is_ok = footprint->BuildPolyCourtyard();
@ -99,13 +99,17 @@ bool DRC_COURTYARD_OVERLAP::RunDRC( BOARD& aBoard ) const
// Now test for overlapping on top layer:
SHAPE_POLY_SET courtyard; // temporary storage of the courtyard of current footprint
for( MODULE* footprint = aBoard.m_Modules; footprint; footprint = footprint->Next() )
for( auto it1 = aBoard.Modules().begin(); it1 != aBoard.Modules().end(); it1++ )
{
auto footprint = *it1;
if( footprint->GetPolyCourtyardFront().OutlineCount() == 0 )
continue; // No courtyard defined
for( MODULE* candidate = footprint->Next(); candidate; candidate = candidate->Next() )
for( auto it2 = it1 + 1; it2 != aBoard.Modules().end(); it2++ )
{
auto candidate = *it2;
if( candidate->GetPolyCourtyardFront().OutlineCount() == 0 )
continue; // No courtyard defined
@ -132,13 +136,17 @@ bool DRC_COURTYARD_OVERLAP::RunDRC( BOARD& aBoard ) const
}
// Test for overlapping on bottom layer:
for( MODULE* footprint = aBoard.m_Modules; footprint; footprint = footprint->Next() )
for( auto it1 = aBoard.Modules().begin(); it1 != aBoard.Modules().end(); it1++ )
{
auto footprint = *it1;
if( footprint->GetPolyCourtyardBack().OutlineCount() == 0 )
continue; // No courtyard defined
for( MODULE* candidate = footprint->Next(); candidate; candidate = candidate->Next() )
for( auto it2 = it1 + 1; it2 != aBoard.Modules().end(); it2++ )
{
auto candidate = *it2;
if( candidate->GetPolyCourtyardBack().OutlineCount() == 0 )
continue; // No courtyard defined

View File

@ -114,8 +114,7 @@ static void build_pad_testpoints( BOARD *aPcb,
{
wxPoint origin = aPcb->GetAuxOrigin();
for( MODULE* module = aPcb->m_Modules;
module; module = module->Next() )
for( auto module : aPcb->Modules() )
{
for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() )
{

View File

@ -40,7 +40,7 @@ bool RecreateCmpFile( BOARD * aBrd, const wxString& aFullCmpFileName )
fprintf( cmpFile, "Cmp-Mod V01 Created by PcbNew date = %s\n", TO_UTF8( DateAndTime() ) );
for( MODULE* module = aBrd->m_Modules; module != NULL; module = module->Next() )
for( auto module : aBrd->Modules() )
{
fprintf( cmpFile, "\nBeginCmp\n" );
fprintf( cmpFile, "TimeStamp = %8.8lX\n", (unsigned long)module->GetTimeStamp() );

View File

@ -311,9 +311,8 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent )
* these changes will be undone later
*/
BOARD* pcb = GetBoard();
MODULE* module;
for( module = pcb->m_Modules; module; module = module->Next() )
for( auto module : pcb->Modules() )
{
module->SetFlag( 0 );
@ -349,7 +348,7 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent )
fclose( file );
// Undo the footprints modifications (flipped footprints)
for( module = pcb->m_Modules; module; module = module->Next() )
for( auto module : pcb->Modules() )
{
if( module->GetFlag() )
{
@ -732,7 +731,6 @@ static size_t hashModule( const MODULE* aModule )
*/
static void CreateShapesSection( FILE* aFile, BOARD* aPcb )
{
MODULE* module;
D_PAD* pad;
const char* layer;
wxString pinname;
@ -741,7 +739,7 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb )
fputs( "$SHAPES\n", aFile );
for( module = aPcb->m_Modules; module; module = module->Next() )
for( auto module : aPcb->Modules() )
{
if( !individualShapes )
{
@ -854,7 +852,7 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb )
int cu_count = aPcb->GetCopperLayerCount();
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
for( auto module : aPcb->Modules() )
{
const char* mirror;
const char* flip;
@ -929,7 +927,6 @@ static void CreateSignalsSection( FILE* aFile, BOARD* aPcb )
wxString msg;
NETINFO_ITEM* net;
D_PAD* pad;
MODULE* module;
int NbNoConn = 1;
fputs( "$SIGNALS\n", aFile );
@ -951,7 +948,7 @@ static void CreateSignalsSection( FILE* aFile, BOARD* aPcb )
fputs( TO_UTF8( msg ), aFile );
fputs( "\n", aFile );
for( module = aPcb->m_Modules; module; module = module->Next() )
for( auto module : aPcb->Modules() )
{
for( pad = module->PadsList(); pad; pad = pad->Next() )
{

View File

@ -596,7 +596,7 @@ bool PCB_EDIT_FRAME::Export_IDF3( BOARD* aPcb, const wxString& aFullFileName,
idf_export_outline( aPcb, idfBoard );
// Output the drill holes and module (library) data.
for( MODULE* module = aPcb->m_Modules; module != 0; module = module->Next() )
for( auto module : aPcb->Modules() )
idf_export_module( aPcb, module, idfBoard );
if( !idfBoard.WriteFile( aFullFileName, idfUnit, false ) )

View File

@ -1622,7 +1622,7 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString& aFullFileName, double aMMt
output_file << " children [\n";
// Export footprints
for( MODULE* module = pcb->m_Modules; module != 0; module = module->Next() )
for( auto module : pcb->Modules() )
export_vrml_module( model3d, pcb, module, &output_file );
// write out the board and all layers
@ -1636,7 +1636,7 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString& aFullFileName, double aMMt
else
{
// Export footprints
for( MODULE* module = pcb->m_Modules; module != 0; module = module->Next() )
for( auto module : pcb->Modules() )
export_vrml_module( model3d, pcb, module, NULL );
// write out the board and all layers

View File

@ -431,8 +431,6 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName,
bool aForceSmdItems, int aSide,
bool aFormatCSV )
{
MODULE* footprint;
// Minimal text lengths:
int lenRefText = 8;
int lenValText = 8;
@ -451,7 +449,7 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName,
std::vector<LIST_MOD> list;
list.reserve( footprintCount );
for( footprint = GetBoard()->m_Modules; footprint; footprint = footprint->Next() )
for( auto footprint : GetBoard()->Modules() )
{
if( aSide != PCB_BOTH_SIDES )
{
@ -696,7 +694,7 @@ bool PCB_EDIT_FRAME::DoGenFootprintsReport( const wxString& aFullFilename, bool
fputs( "$EndBOARD\n\n", rptfile );
for( MODULE* Module = GetBoard()->m_Modules; Module; Module = Module->Next() )
for( auto Module : GetBoard()->Modules() )
{
fprintf( rptfile, "$MODULE %s\n", EscapedUTF8( Module->GetReference() ).c_str() );

View File

@ -115,7 +115,7 @@ void GENDRILL_WRITER_BASE::buildHolesList( DRILL_LAYER_PAIR aLayerPair,
if( aLayerPair == DRILL_LAYER_PAIR( F_Cu, B_Cu ) )
{
// add holes for thru hole pads
for( MODULE* module = m_pcb->m_Modules; module; module = module->Next() )
for( auto module : m_pcb->Modules() )
{
for( auto& pad : module->Pads() )
{

View File

@ -327,7 +327,7 @@ bool FOOTPRINT_EDIT_FRAME::IsSearchTreeShown()
BOARD_ITEM_CONTAINER* FOOTPRINT_EDIT_FRAME::GetModel() const
{
return GetBoard()->m_Modules;
return GetBoard()->GetFirstModule();
}
@ -345,7 +345,7 @@ LIB_ID FOOTPRINT_EDIT_FRAME::getTargetFPID() const
LIB_ID FOOTPRINT_EDIT_FRAME::GetLoadedFPID() const
{
MODULE* module = GetBoard()->m_Modules;
MODULE* module = GetBoard()->GetFirstModule();
if( module )
return LIB_ID( module->GetFPID().GetLibNickname(), m_footprintNameWhenLoaded );
@ -356,7 +356,7 @@ LIB_ID FOOTPRINT_EDIT_FRAME::GetLoadedFPID() const
bool FOOTPRINT_EDIT_FRAME::IsCurrentFPFromBoard() const
{
MODULE* module = GetBoard()->m_Modules;
MODULE* module = GetBoard()->GetFirstModule();
return ( module && module->GetLink() > 0 );
}
@ -498,10 +498,10 @@ double FOOTPRINT_EDIT_FRAME::BestZoom()
void FOOTPRINT_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
{
if( GetScreen()->IsModify() && GetBoard()->m_Modules )
if( GetScreen()->IsModify() && GetBoard()->GetFirstModule() )
{
if( !HandleUnsavedChanges( this, _( "Save changes to footprint before closing?" ),
[&]()->bool { return SaveFootprint( GetBoard()->m_Modules ); } ) )
[&]() -> bool { return SaveFootprint( GetBoard()->GetFirstModule() ); } ) )
{
Event.Veto();
return;
@ -531,7 +531,7 @@ void FOOTPRINT_EDIT_FRAME::CloseModuleEditor( wxCommandEvent& Event )
void FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( GetBoard()->m_Modules != NULL );
aEvent.Enable( GetBoard()->GetFirstModule() != NULL );
if( aEvent.GetEventObject() == m_drawToolBar )
aEvent.Check( GetToolId() == aEvent.GetId() );
@ -540,7 +540,7 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent )
void FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( GetBoard()->m_Modules != NULL );
aEvent.Enable( GetBoard()->GetFirstModule() != NULL );
}
@ -554,7 +554,7 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard( wxUpdateUIEvent& aEvent
{
PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB, false );
aEvent.Enable( frame && frame->GetBoard()->m_Modules != NULL );
aEvent.Enable( frame && frame->GetBoard()->GetFirstModule() != NULL );
}
@ -562,23 +562,24 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard( wxUpdateUIEvent& aEvent
{
PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB, false );
MODULE* module_in_edit = GetBoard()->m_Modules;
MODULE* module_in_edit = GetBoard()->GetFirstModule();
bool canInsert = frame && module_in_edit && !module_in_edit->GetLink();
// If the source was deleted, the module can inserted but not updated in the board.
if( frame && module_in_edit && module_in_edit->GetLink() ) // this is not a new module
{
BOARD* mainpcb = frame->GetBoard();
MODULE* source_module = mainpcb->m_Modules;
canInsert = true;
// search if the source module was not deleted:
for( ; source_module != NULL; source_module = source_module->Next() )
for( auto source_module : mainpcb->Modules() )
{
if( module_in_edit->GetLink() == source_module->GetTimeStamp() )
{
canInsert = false;
break;
}
}
canInsert = ( source_module == NULL );
}
aEvent.Enable( canInsert );
@ -658,8 +659,8 @@ void FOOTPRINT_EDIT_FRAME::updateTitle()
if( IsCurrentFPFromBoard() )
{
title += wxString::Format( wxT( " \u2014 %s [from %s.%s]" ),
GetBoard()->m_Modules->GetReference(),
Prj().GetProjectName(), PcbFileExtension );
GetBoard()->GetFirstModule()->GetReference(), Prj().GetProjectName(),
PcbFileExtension );
}
else if( fpid.IsValid() )
{
@ -674,15 +675,15 @@ void FOOTPRINT_EDIT_FRAME::updateTitle()
// Note: don't used GetLoadedFPID(); footprint name may have been edited
title += wxString::Format( wxT( " \u2014 %s %s" ),
FROM_UTF8( GetBoard()->m_Modules->GetFPID().Format().c_str() ),
writable ? wxString( wxEmptyString ) : _( "[Read Only]" ) );
FROM_UTF8( GetBoard()->GetFirstModule()->GetFPID().Format().c_str() ),
writable ? wxString( wxEmptyString ) : _( "[Read Only]" ) );
}
else if( !fpid.GetLibItemName().empty() )
{
// Note: don't used GetLoadedFPID(); footprint name may have been edited
title += wxString::Format( wxT( " \u2014 %s %s" ),
FROM_UTF8( GetBoard()->m_Modules->GetFPID().GetLibItemName().c_str() ),
_( "[Unsaved]" ) );
FROM_UTF8( GetBoard()->GetFirstModule()->GetFPID().GetLibItemName().c_str() ),
_( "[Unsaved]" ) );
}
SetTitle( title );

View File

@ -89,14 +89,16 @@ void FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary( LIB_ID aFPID)
SetCrossHairPosition( wxPoint( 0, 0 ) );
AddModuleToBoard( module );
if( GetBoard()->m_Modules )
auto fp = GetBoard()->GetFirstModule();
if( fp )
{
GetBoard()->m_Modules->ClearFlags();
fp->ClearFlags();
// if either m_Reference or m_Value are gone, reinstall them -
// otherwise you cannot see what you are doing on board
TEXTE_MODULE* ref = &GetBoard()->m_Modules->Reference();
TEXTE_MODULE* val = &GetBoard()->m_Modules->Value();
TEXTE_MODULE* ref = &fp->Reference();
TEXTE_MODULE* val = &fp->Value();
if( val && ref )
{
@ -210,8 +212,8 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
GetBoard()->BuildListOfNets();
module->SetPosition( wxPoint( 0, 0 ) );
if( GetBoard()->m_Modules )
GetBoard()->m_Modules->ClearFlags();
if( GetBoard()->GetFirstModule() )
GetBoard()->GetFirstModule()->ClearFlags();
Zoom_Automatique( false );
GetScreen()->SetModify();
@ -240,8 +242,11 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( GetScreen()->IsModify() && !GetBoard()->IsEmpty() )
{
if( !HandleUnsavedChanges( this, _( "The current footprint has been modified. Save changes?" ),
[&]()->bool { return SaveFootprint( GetBoard()->m_Modules ); } ) )
if( !HandleUnsavedChanges( this,
_( "The current footprint has been modified. Save changes?" ),
[&]() -> bool {
return SaveFootprint( GetBoard()->GetFirstModule() );
} ) )
{
break;
}
@ -299,9 +304,9 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_MODEDIT_SAVE:
if( getTargetFPID() == GetLoadedFPID() )
{
if( SaveFootprint( GetBoard()->m_Modules ) )
if( SaveFootprint( GetBoard()->GetFirstModule() ) )
{
m_toolManager->GetView()->Update( GetBoard()->m_Modules );
m_toolManager->GetView()->Update( GetBoard()->GetFirstModule() );
GetGalCanvas()->ForceRefresh();
GetScreen()->ClrModify();
@ -324,12 +329,12 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
else if( getTargetFPID() == GetLoadedFPID() )
{
// Save Board Footprint As
MODULE* footprint = GetBoard()->m_Modules;
MODULE* footprint = GetBoard()->GetFirstModule();
if( footprint && SaveFootprintAs( footprint ) )
{
m_footprintNameWhenLoaded = footprint->GetFPID().GetLibItemName();
m_toolManager->GetView()->Update( GetBoard()->m_Modules );
m_toolManager->GetView()->Update( footprint );
GetScreen()->ClrModify();
GetGalCanvas()->ForceRefresh();
@ -359,7 +364,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
LIB_ID fpID = getTargetFPID();
if( fpID == GetLoadedFPID() )
m_copiedModule.reset( new MODULE( *GetBoard()->m_Modules.GetFirst() ) );
m_copiedModule.reset( new MODULE( *GetBoard()->GetFirstModule() ) );
else
m_copiedModule.reset( LoadFootprint( fpID ) );
@ -404,8 +409,8 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
SetCrossHairPosition( wxPoint( 0, 0 ) );
Import_Module();
if( GetBoard()->m_Modules )
GetBoard()->m_Modules->ClearFlags();
if( GetBoard()->GetFirstModule() )
GetBoard()->GetFirstModule()->ClearFlags();
GetScreen()->SetModify();
Zoom_Automatique( false );
@ -416,7 +421,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_MODEDIT_EXPORT_PART:
if( getTargetFPID() == GetLoadedFPID() )
Export_Module( GetBoard()->m_Modules );
Export_Module( GetBoard()->GetFirstModule() );
else
Export_Module( LoadFootprint( getTargetFPID() ) );
break;
@ -453,9 +458,9 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_MODEDIT_EDIT_MODULE_PROPERTIES:
if( GetBoard()->m_Modules )
if( GetBoard()->GetFirstModule() )
{
editFootprintProperties( GetBoard()->m_Modules );
editFootprintProperties( GetBoard()->GetFirstModule() );
GetGalCanvas()->Refresh();
}
break;
@ -530,8 +535,8 @@ bool FOOTPRINT_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileS
SetCrossHairPosition( wxPoint( 0, 0 ) );
Import_Module( aFileSet[0] );
if( GetBoard()->m_Modules )
GetBoard()->m_Modules->ClearFlags();
if( GetBoard()->GetFirstModule() )
GetBoard()->GetFirstModule()->ClearFlags();
GetScreen()->ClrModify();
Zoom_Automatique( false );

View File

@ -634,7 +634,7 @@ bool FOOTPRINT_EDIT_FRAME::DeleteModuleFromLibrary( const LIB_ID& aFPID, bool aC
void PCB_EDIT_FRAME::ArchiveModulesOnBoard( bool aStoreInNewLib, const wxString& aLibName,
wxString* aLibPath )
{
if( GetBoard()->m_Modules == NULL )
if( GetBoard()->GetFirstModule() == NULL )
{
DisplayInfoMessage( this, _( "No footprints to archive!" ) );
return;
@ -658,7 +658,7 @@ void PCB_EDIT_FRAME::ArchiveModulesOnBoard( bool aStoreInNewLib, const wxString&
{
FP_LIB_TABLE* tbl = prj.PcbFootprintLibs();
for( MODULE* curr_fp = GetBoard()->m_Modules; curr_fp; curr_fp = curr_fp->Next() )
for( auto curr_fp : GetBoard()->Modules() )
{
if( !curr_fp->GetFPID().GetLibItemName().empty() ) // Can happen with old boards.
tbl->FootprintSave( nickname, curr_fp, false );
@ -684,7 +684,7 @@ void PCB_EDIT_FRAME::ArchiveModulesOnBoard( bool aStoreInNewLib, const wxString&
IO_MGR::PCB_FILE_T piType = IO_MGR::KICAD_SEXP;
PLUGIN::RELEASER pi( IO_MGR::PluginFind( piType ) );
for( MODULE* curr_fp = GetBoard()->m_Modules; curr_fp; curr_fp = curr_fp->Next() )
for( auto curr_fp : GetBoard()->Modules() )
{
try
{
@ -794,18 +794,21 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew )
BOARD* mainpcb = pcbframe->GetBoard();
MODULE* source_module = NULL;
MODULE* module_in_edit = GetBoard()->m_Modules;
MODULE* module_in_edit = GetBoard()->GetFirstModule();
// Search the old module (source) if exists
// Because this source could be deleted when editing the main board...
if( module_in_edit->GetLink() ) // this is not a new module ...
{
source_module = mainpcb->m_Modules;
source_module = nullptr;
for( ; source_module != NULL; source_module = source_module->Next() )
for( auto mod : mainpcb->Modules() )
{
if( module_in_edit->GetLink() == source_module->GetTimeStamp() )
{
source_module = mod;
break;
}
}
}

View File

@ -406,7 +406,8 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event )
// Delete the current footprint (MUST reset tools first)
GetToolManager()->ResetTools( TOOL_BASE::MODEL_RELOAD );
GetBoard()->m_Modules.DeleteAll();
GetBoard()->DeleteAllModules();
LIB_ID id;
id.SetLibNickname( getCurNickname() );
@ -459,7 +460,7 @@ void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB( wxCommandEvent& event )
Close( true );
}
else if( GetBoard()->m_Modules )
else if( GetBoard()->GetFirstModule() )
{
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB, false );
@ -473,7 +474,7 @@ void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB( wxCommandEvent& event )
BOARD_COMMIT commit( pcbframe );
// Create the "new" module
MODULE* newmodule = new MODULE( *GetBoard()->m_Modules );
MODULE* newmodule = new MODULE( *GetBoard()->GetFirstModule() );
newmodule->SetParent( pcbframe->GetBoard() );
newmodule->SetLink( 0 );
@ -584,7 +585,7 @@ void FOOTPRINT_VIEWER_FRAME::OnActivate( wxActivateEvent& event )
void FOOTPRINT_VIEWER_FRAME::OnUpdateFootprintButton( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( GetBoard()->m_Modules != nullptr );
aEvent.Enable( GetBoard()->GetFirstModule() != nullptr );
}
@ -765,7 +766,7 @@ void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode )
setCurFootprintName( m_footprintList->GetString( (unsigned) selection ) );
// Delete the current footprint
GetBoard()->m_Modules.DeleteAll();
GetBoard()->DeleteAllModules();
MODULE* footprint = Prj().PcbFootprintLibs()->FootprintLoad( getCurNickname(),
getCurFootprintName() );

View File

@ -324,7 +324,7 @@ void FOOTPRINT_WIZARD_FRAME::updateView()
void FOOTPRINT_WIZARD_FRAME::UpdateMsgPanel()
{
BOARD_ITEM* footprint = GetBoard()->m_Modules;
BOARD_ITEM* footprint = GetBoard()->GetFirstModule();
if( footprint )
{

View File

@ -100,7 +100,7 @@ void FOOTPRINT_WIZARD_FRAME::ReloadFootprint()
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
// Delete the current footprint
GetBoard()->m_Modules.DeleteAll();
GetBoard()->DeleteAllModules();
// Creates the module
wxString msg;
@ -254,4 +254,3 @@ void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event )
}
}

View File

@ -162,7 +162,11 @@ void FP_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataViewIte
case 0:
if( node->LibId == m_frame->GetLoadedFPID() && !m_frame->IsCurrentFPFromBoard() )
{
wxString currentFPName = m_frame->GetBoard()->m_Modules->GetFPID().GetLibItemName();
auto mod = m_frame->GetBoard()->GetFirstModule();
wxASSERT( mod );
wxString currentFPName = mod->GetFPID().GetLibItemName();
// mark modified part with an asterix
if( m_frame->GetScreen()->IsModify() )
@ -176,7 +180,11 @@ void FP_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataViewIte
case 1:
if( node->LibId == m_frame->GetLoadedFPID() && !m_frame->IsCurrentFPFromBoard() )
aVariant = m_frame->GetBoard()->m_Modules->GetDescription();
{
auto mod = m_frame->GetBoard()->GetFirstModule();
wxASSERT( mod );
aVariant = mod->GetDescription();
}
else
aVariant = node->Desc;
break;

View File

@ -70,7 +70,7 @@ DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX( PCB_BASE_FRAME* aParent, bool aImportAsFoo
m_parent = aParent;
if( aImportAsFootprintGraphic )
m_importer.reset( new GRAPHICS_IMPORTER_MODULE( m_parent->GetBoard()->m_Modules ) );
m_importer.reset( new GRAPHICS_IMPORTER_MODULE( m_parent->GetBoard()->GetFirstModule() ) );
else
m_importer.reset( new GRAPHICS_IMPORTER_BOARD( m_parent->GetBoard() ) );

View File

@ -101,8 +101,9 @@ bool FOOTPRINT_EDIT_FRAME::Clear_Pcb( bool aQuery )
{
wxSafeYield( this, true ); // Allow frame to come to front before showing warning.
if( !HandleUnsavedChanges( this, _( "The current footprint has been modified. Save changes?" ),
[&]()->bool { return SaveFootprint( GetBoard()->m_Modules ); } ) )
if( !HandleUnsavedChanges( this,
_( "The current footprint has been modified. Save changes?" ),
[&]() -> bool { return SaveFootprint( GetBoard()->Modules().front() ); } ) )
{
return false;
}

View File

@ -135,7 +135,7 @@ void CLIPBOARD_IO::SaveSelection( const SELECTION& aSelected )
}
// Set the new relative internal local coordinates of copied items
MODULE* editedModule = m_board->m_Modules;
MODULE* editedModule = m_board->Modules().front();
wxPoint moveVector = partialModule.GetPosition() + editedModule->GetPosition();
partialModule.MoveAnchorPosition( moveVector );

View File

@ -603,7 +603,7 @@ void PCB_IO::formatGeneral( BOARD* aBoard, int aNestLevel ) const
m_out->Print( aNestLevel+1, "(drawings %zu)\n", aBoard->Drawings().size() );
m_out->Print( aNestLevel+1, "(tracks %d)\n", aBoard->GetNumSegmTrack() );
m_out->Print( aNestLevel+1, "(modules %d)\n", aBoard->m_Modules.GetCount() );
m_out->Print( aNestLevel + 1, "(modules %zu)\n", aBoard->Modules().size() );
m_out->Print( aNestLevel+1, "(nets %d)\n", m_mapping->GetSize() );
m_out->Print( aNestLevel, ")\n\n" );
@ -717,7 +717,7 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
formatHeader( aBoard, aNestLevel );
// Save the modules.
for( MODULE* module = aBoard->m_Modules; module; module = module->Next() )
for( auto module : aBoard->Modules() )
{
Format( module, aNestLevel );
m_out->Print( 0, "\n" );

View File

@ -98,7 +98,7 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule )
if( aModule == NULL )
{
if( ! frame->GetBoard() || ! frame->GetBoard()->m_Modules )
if( !frame->GetBoard() || !frame->GetBoard()->GetFirstModule() )
return false;
aModule = SelectFootprintFromBoard( frame->GetBoard() );
@ -336,9 +336,8 @@ MODULE* FOOTPRINT_EDIT_FRAME::SelectFootprintFromBoard( BOARD* aPcb )
wxString fpname;
wxString msg;
wxArrayString listnames;
MODULE* module = aPcb->m_Modules;
for( ; module; module = module->Next() )
for( auto module : aPcb->Modules() )
listnames.Add( module->GetReference() );
msg.Printf( _( "Footprints [%u items]" ), (unsigned) listnames.GetCount() );
@ -367,15 +366,13 @@ MODULE* FOOTPRINT_EDIT_FRAME::SelectFootprintFromBoard( BOARD* aPcb )
oldName = fpname;
module = aPcb->m_Modules;
for( ; module; module = module->Next() )
for( auto mod : aPcb->Modules() )
{
if( fpname == module->GetReference() )
break;
if( fpname == mod->GetReference() )
return mod;
}
return module;
return nullptr;
}
@ -437,11 +434,10 @@ static PICKED_ITEMS_LIST s_PickedList; // a pick-list to save in
MODULE* PCB_BASE_FRAME::GetFootprintFromBoardByReference()
{
wxString moduleName;
MODULE* module = NULL;
wxArrayString fplist;
// Build list of available fp references, to display them in dialog
for( MODULE* fp = GetBoard()->m_Modules; fp; fp = fp->Next() )
for( auto fp : GetBoard()->Modules() )
fplist.Add( fp->GetReference() + wxT(" ( ") + fp->GetValue() + wxT(" )") );
fplist.Sort();
@ -457,18 +453,14 @@ MODULE* PCB_BASE_FRAME::GetFootprintFromBoardByReference()
if( !moduleName.IsEmpty() )
{
module = GetBoard()->m_Modules;
while( module )
for( auto mod : GetBoard()->Modules() )
{
if( module->GetReference().CmpNoCase( moduleName ) == 0 )
break;
module = module->Next();
if( mod->GetReference().CmpNoCase( moduleName ) == 0 )
return mod;
}
}
return module;
return nullptr;
}

View File

@ -48,8 +48,8 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
wxMenuBar* oldMenuBar = GetMenuBar();
wxMenuBar* menuBar = new wxMenuBar();
auto modifiedDocumentCondition = [ this ] ( const SELECTION& sel ) {
return GetBoard()->m_Modules && GetScreen()->IsModify();
auto modifiedDocumentCondition = [this]( const SELECTION& sel ) {
return !GetBoard()->Modules().empty() && GetScreen()->IsModify();
};
auto libraryPartCondition = [ this ] ( const SELECTION& sel ) {
LIB_ID libId = getTargetFPID();

View File

@ -212,7 +212,7 @@ void NETINFO_MAPPING::Update()
nets.insert( track->GetNetCode() );
// Modules/pads
for( MODULE* module = m_board->m_Modules; module; module = module->Next() )
for( auto module : m_board->Modules() )
{
for( D_PAD* pad = module->PadsList().GetFirst(); pad; pad = pad->Next() )
{

View File

@ -135,7 +135,7 @@ void PCB_EDIT_FRAME::OnNetlistChanged( BOARD_NETLIST_UPDATER& aUpdater,
MODULE* PCB_EDIT_FRAME::ListAndSelectModuleName()
{
if( GetBoard()->m_Modules == NULL )
if( GetBoard()->Modules().empty() )
{
DisplayError( this, _( "No footprints" ) );
return 0;
@ -143,9 +143,7 @@ MODULE* PCB_EDIT_FRAME::ListAndSelectModuleName()
wxArrayString listnames;
MODULE* module;
for( module = GetBoard()->m_Modules; module; module = module->Next() )
for( auto module : GetBoard()->Modules() )
listnames.Add( module->GetReference() );
wxArrayString headers;
@ -163,17 +161,17 @@ MODULE* PCB_EDIT_FRAME::ListAndSelectModuleName()
EDA_LIST_DIALOG dlg( this, _( "Components" ), headers, itemsToDisplay, wxEmptyString );
if( dlg.ShowModal() != wxID_OK )
return NULL;
return nullptr;
wxString ref = dlg.GetTextSelection();
for( module = GetBoard()->m_Modules; module; module = module->Next() )
for( auto module : GetBoard()->Modules() )
{
if( module->GetReference() == ref )
break;
return module;
}
return module;
return nullptr;
}

View File

@ -511,7 +511,7 @@ void PCB_BASE_FRAME::OnTogglePadDrawMode( wxCommandEvent& aEvent )
// Update pads
BOARD* board = GetBoard();
for( MODULE* module = board->m_Modules; module; module = module->Next() )
for( auto module : board->Modules() )
{
for( auto pad : module->Pads() )
view->Update( pad, KIGFX::GEOMETRY );

View File

@ -174,7 +174,7 @@ void PCB_DRAW_PANEL_GAL::DisplayBoard( BOARD* aBoard )
m_view->Add( track );
// Load modules and its additional elements
for( MODULE* module = aBoard->m_Modules; module; module = module->Next() )
for( auto module : aBoard->Modules() )
m_view->Add( module );
// DRC markers

View File

@ -639,7 +639,7 @@ void PCB_EDIT_FRAME::DoShowBoardSetupDialog( const wxString& aInitialPage,
UpdateUserInterface();
ReCreateAuxiliaryToolbar();
for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() )
for( auto module : GetBoard()->Modules() )
GetGalCanvas()->GetView()->Update( module );
GetGalCanvas()->Refresh();
@ -1303,11 +1303,11 @@ void PCB_EDIT_FRAME::LockModule( MODULE* aModule, bool aLocked )
}
else
{
for( aModule = GetBoard()->m_Modules; aModule != NULL; aModule = aModule->Next() )
for( auto mod : GetBoard()->Modules() )
{
if( WildCompareString( ModulesMaskSelection, aModule->GetReference() ) )
if( WildCompareString( ModulesMaskSelection, mod->GetReference() ) )
{
aModule->SetLocked( aLocked );
mod->SetLocked( aLocked );
OnModify();
}
}

View File

@ -110,7 +110,7 @@ void BOARD::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset )
LSET all_cu = LSET::AllCuMask();
for( MODULE* module = m_Modules; module; module = module->Next() )
for( auto module : m_modules )
{
bool display = true;
LSET layerMask = all_cu;

View File

@ -88,7 +88,7 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
if( layersmask_plotpads.any() )
{
for( MODULE* Module = aBoard->m_Modules; Module; Module = Module->Next() )
for( auto Module : aBoard->Modules() )
{
aPlotter->StartBlock( NULL );
@ -115,7 +115,7 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
}
// Plot footprints fields (ref, value ...)
for( MODULE* module = aBoard->m_Modules; module; module = module->Next() )
for( auto module : aBoard->Modules() )
{
if( ! itemplotter.PlotAllTextsModule( module ) )
{
@ -299,7 +299,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
// We plot here module texts, but they are usually on silkscreen layer,
// so they are not plot here but plot by PlotSilkScreen()
// Plot footprints fields (ref, value ...)
for( MODULE* module = aBoard->m_Modules; module; module = module->Next() )
for( auto module : aBoard->Modules() )
{
if( ! itemplotter.PlotAllTextsModule( module ) )
{
@ -308,7 +308,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
}
}
for( MODULE* module = aBoard->m_Modules; module; module = module->Next() )
for( auto module : aBoard->Modules() )
{
for( BOARD_ITEM* item = module->GraphicalItemsList(); item; item = item->Next() )
{
@ -328,7 +328,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
}
// Plot footprint pads
for( MODULE* module = aBoard->m_Modules; module; module = module->Next() )
for( auto module : aBoard->Modules() )
{
aPlotter->StartBlock( NULL );
@ -695,7 +695,7 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter,
int smallDrill = (aPlotOpt.GetDrillMarksType() == PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE)
? SMALL_DRILL : INT_MAX;
for( MODULE* module = aBoard->m_Modules; module; module = module->Next() )
for( auto module : aBoard->Modules() )
{
for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() )
{
@ -773,7 +773,7 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter,
// on this layer (like logos), not actually areas around pads.
itemplotter.PlotBoardGraphicItems();
for( MODULE* module = aBoard->m_Modules; module; module = module->Next() )
for( auto module : aBoard->Modules() )
{
for( BOARD_ITEM* item = module->GraphicalItemsList(); item; item = item->Next() )
{
@ -804,7 +804,7 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter,
SHAPE_POLY_SET initialPolys; // Contains exact shapes to plot
// Plot pads
for( MODULE* module = aBoard->m_Modules; module; module = module->Next() )
for( auto module : aBoard->Modules() )
{
// add shapes with exact size
module->TransformPadsShapesWithClearanceToPolygon( layer, initialPolys, 0 );

View File

@ -430,7 +430,7 @@ void BRDITEMS_PLOTTER::PlotPcbTarget( PCB_TARGET* aMire )
// Plot footprints graphic items (outlines)
void BRDITEMS_PLOTTER::Plot_Edges_Modules()
{
for( MODULE* module = m_board->m_Modules; module; module = module->Next() )
for( auto module : m_board->Modules() )
{
for( BOARD_ITEM* item = module->GraphicalItemsList().GetFirst(); item; item = item->Next() )
{
@ -843,7 +843,7 @@ void BRDITEMS_PLOTTER::PlotDrillMarks()
}
}
for( MODULE* Module = m_board->m_Modules; Module != NULL; Module = Module->Next() )
for( auto Module : m_board->Modules() )
{
for( D_PAD* pad = Module->PadsList(); pad != NULL; pad = pad->Next() )
{

View File

@ -132,7 +132,7 @@ PNS_PCBNEW_RULE_RESOLVER::PNS_PCBNEW_RULE_RESOLVER( BOARD* aBoard, PNS::ROUTER*
}
// Build clearance cache for pads
for( MODULE* mod = m_board->m_Modules; mod ; mod = mod->Next() )
for( auto mod : m_board->Modules() )
{
auto moduleClearance = mod->GetLocalClearance();

View File

@ -1758,7 +1758,7 @@ void SPECCTRA_DB::exportNETCLASS( const NETCLASSPTR& aNetClass, BOARD* aBoard )
void SPECCTRA_DB::FlipMODULEs( BOARD* aBoard )
{
for( MODULE* module = aBoard->m_Modules; module; module = module->Next() )
for( auto module : aBoard->Modules() )
{
module->SetFlag( 0 );
if( module->GetLayer() == B_Cu )
@ -1779,7 +1779,7 @@ void SPECCTRA_DB::RevertMODULEs( BOARD* aBoard )
// DSN Images (=KiCad MODULES and pads) must be presented from the
// top view. Restore those that were flipped.
for( MODULE* module = aBoard->m_Modules; module; module = module->Next() )
for( auto module : aBoard->Modules() )
{
if( module->GetFlag() )
{

View File

@ -225,7 +225,7 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin )
}
// Append modules:
for( BOARD_ITEM* item = currentPcb->m_Modules; item != NULL; item = item->Next() )
for( auto item : currentPcb->Modules() )
{
ITEM_PICKER picker( item, UR_CHANGED );
itemsList.PushItem( picker );
@ -336,7 +336,7 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin )
}
// Find new modules
for( BOARD_ITEM* item = currentPcb->m_Modules; item != NULL; item = item->Next() )
for( auto item : currentPcb->Modules() )
{
if( !oldBuffer->ContainsItem( item ) )
{

View File

@ -1085,7 +1085,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
if( m_editModules )
{
dupe_item = editFrame->GetBoard()->m_Modules->Duplicate( orig_item, increment );
dupe_item = editFrame->GetBoard()->GetFirstModule()->Duplicate( orig_item, increment );
}
else
{

View File

@ -104,7 +104,7 @@ int MODULE_EDITOR_TOOLS::PlacePad( const TOOL_EVENT& aEvent )
{
std::unique_ptr<BOARD_ITEM> CreateItem() override
{
D_PAD* pad = new D_PAD ( m_board->m_Modules );
D_PAD* pad = new D_PAD( m_board->GetFirstModule() );
m_frame->Import_Pad_Settings( pad, false ); // use the global settings for pad
pad->IncrementPadName( true, true );
return std::unique_ptr<BOARD_ITEM>( pad );
@ -130,7 +130,7 @@ int MODULE_EDITOR_TOOLS::PlacePad( const TOOL_EVENT& aEvent )
frame()->SetToolID( ID_MODEDIT_PAD_TOOL, wxCURSOR_PENCIL, _( "Add pads" ) );
wxASSERT( board()->m_Modules );
wxASSERT( board()->GetFirstModule() );
doInteractiveItemPlacement( &placer, _( "Place pad" ), IPO_REPEAT | IPO_SINGLE_CLICK | IPO_ROTATE | IPO_FLIP );
@ -142,7 +142,7 @@ int MODULE_EDITOR_TOOLS::PlacePad( const TOOL_EVENT& aEvent )
int MODULE_EDITOR_TOOLS::EnumeratePads( const TOOL_EVENT& aEvent )
{
if( !board()->m_Modules || !board()->m_Modules->PadsList() )
if( !board()->GetFirstModule() || !board()->GetFirstModule()->PadsList() )
return 0;
DIALOG_ENUM_PADS settingsDlg( frame() );
@ -318,7 +318,7 @@ int MODULE_EDITOR_TOOLS::EnumeratePads( const TOOL_EVENT& aEvent )
statusPopup.Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
}
for( auto p : board()->m_Modules->Pads() )
for( auto p : board()->GetFirstModule()->Pads() )
{
p->ClearSelected();
view->Update( p );
@ -354,7 +354,7 @@ int MODULE_EDITOR_TOOLS::ExplodePadToShapes( const TOOL_EVENT& aEvent )
for( auto prim : pad->GetPrimitives() )
{
auto ds = new EDGE_MODULE( board()->m_Modules );
auto ds = new EDGE_MODULE( board()->GetFirstModule() );
prim.ExportTo( ds ); // ExportTo exports to a DRAWSEGMENT
// Fix an arbitray draw layer for this EDGE_MODULE
@ -385,7 +385,7 @@ int MODULE_EDITOR_TOOLS::CreatePadFromShapes( const TOOL_EVENT& aEvent )
{
SELECTION& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
std::unique_ptr<D_PAD> pad ( new D_PAD ( board()->m_Modules ) );
std::unique_ptr<D_PAD> pad( new D_PAD( board()->GetFirstModule() ) );
D_PAD *refPad = nullptr;
bool multipleRefPadsFound = false;
bool illegalItemsFound = false;

View File

@ -161,7 +161,7 @@ void PAD_TOOL::Reset( RESET_REASON aReason )
bool PAD_TOOL::haveFootprints()
{
auto& board = *getModel<BOARD>();
return board.m_Modules.GetCount() > 0;
return board.Modules().size() > 0;
}
@ -267,7 +267,7 @@ static void doPushPadProperties( BOARD& board, const D_PAD& aSrcPad, BOARD_COMMI
double pad_orient = aSrcPad.GetOrientation() - moduleRef->GetOrientation();
for( const MODULE* module = board.m_Modules; module; module = module->Next() )
for( auto module : board.Modules() )
{
if( !aSameFootprints && ( module != moduleRef ) )
continue;

View File

@ -138,7 +138,10 @@ protected:
KIGFX::VIEW_CONTROLS* controls() const { return getViewControls(); }
PCB_EDIT_FRAME* frame() const { return getEditFrame<PCB_EDIT_FRAME>(); }
BOARD* board() const { return getModel<BOARD>(); }
MODULE* module() const { return board()->m_Modules; }
MODULE* module() const
{
return board()->Modules().front();
}
PCB_DISPLAY_OPTIONS* displayOptions() const;
PCB_DRAW_PANEL_GAL* canvas() const;
const SELECTION& selection() const;

View File

@ -705,7 +705,7 @@ int PCBNEW_CONTROL::Paste( const TOOL_EVENT& aEvent )
if( editModules )
{
auto oldModule = static_cast<MODULE*>( clipItem );
auto newModule = board()->m_Modules.GetFirst();
auto newModule = board()->GetFirstModule();
for( D_PAD* pad = oldModule->PadsList(), *next = nullptr; pad; pad = next )
{
@ -839,7 +839,7 @@ int PCBNEW_CONTROL::placeBoardItems( BOARD* aBoard )
std::vector<BOARD_ITEM*> items;
moveNoFlagToVector( aBoard->m_Track, items, isNew );
moveNoFlagToVector( aBoard->m_Modules, items, isNew );
moveNoFlagToVector( aBoard->Modules(), items, isNew );
moveNoFlagToVector( aBoard->Drawings(), items, isNew );
moveNoFlagToVector( aBoard->Zones(), items, isNew );

View File

@ -992,11 +992,10 @@ int SELECTION_TOOL::selectNet( const TOOL_EVENT& aEvent )
void SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetpath )
{
auto modules = board()->m_Modules.GetFirst();
std::list<MODULE*> modList;
// store all modules that are on that sheet
for( MODULE* mitem = modules; mitem; mitem = mitem->Next() )
for( auto mitem : board()->Modules() )
{
if( mitem != NULL && mitem->GetPath().Contains( aSheetpath ) )
{

View File

@ -119,7 +119,7 @@ using namespace std::placeholders;
static bool TestForExistingItem( BOARD* aPcb, BOARD_ITEM* aItem )
{
static std::list<BOARD_ITEM*> itemsList;
static std::set<BOARD_ITEM*> itemsList;
if( aItem == NULL ) // Build list
{
@ -130,33 +130,30 @@ static bool TestForExistingItem( BOARD* aPcb, BOARD_ITEM* aItem )
// Store items in list:
// Append tracks:
for( item = aPcb->m_Track; item != NULL; item = item->Next() )
itemsList.push_back( item );
itemsList.insert( item );
// Append modules:
for( item = aPcb->m_Modules; item != NULL; item = item->Next() )
itemsList.push_back( item );
std::copy( aPcb->Modules().begin(), aPcb->Modules().end(),
std::inserter( itemsList, itemsList.end() ) );
// Append drawings
for( auto ditem : aPcb->Drawings() )
itemsList.push_back( ditem );
itemsList.insert( ditem );
// Append zones outlines
for( int ii = 0; ii < aPcb->GetAreaCount(); ii++ )
itemsList.push_back( aPcb->GetArea( ii ) );
itemsList.insert( aPcb->GetArea( ii ) );
NETINFO_LIST& netInfo = aPcb->GetNetInfo();
for( NETINFO_LIST::iterator i = netInfo.begin(); i != netInfo.end(); ++i )
itemsList.push_back( *i );
// Sort list
itemsList.sort();
itemsList.insert( *i );
return false;
}
// search in list:
return std::binary_search( itemsList.begin(), itemsList.end(), aItem );
return itemsList.count( aItem );
}
static void SwapItemData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
@ -625,4 +622,4 @@ void PCB_BASE_EDIT_FRAME::RollbackFromUndo()
delete undo;
GetGalCanvas()->Refresh();
}
}

View File

@ -377,7 +377,7 @@ void ZONE_FILLER::buildZoneFeatureHoleList( const ZONE_CONTAINER* aZone,
MODULE dummymodule( m_board ); // Creates a dummy parent
D_PAD dummypad( &dummymodule );
for( MODULE* module = m_board->m_Modules; module; module = module->Next() )
for( auto module : m_board->Modules() )
{
D_PAD* nextpad;