pcbnew: Remove the last dlist from modules/pcbnew

This commit is contained in:
Seth Hillbrand 2019-06-01 20:55:32 -07:00
parent b244a940ef
commit 6a45446496
33 changed files with 80 additions and 182 deletions

View File

@ -179,9 +179,7 @@ void CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer( const MODULE* aMod
std::vector<TEXTE_MODULE *> texts; // List of TEXTE_MODULE to convert
EDGE_MODULE* outline;
for( EDA_ITEM* item = aModule->GraphicalItemsList();
item != NULL;
item = item->Next() )
for( auto item : aModule->GraphicalItems() )
{
switch( item->Type() )
{

View File

@ -202,9 +202,7 @@ void CINFO3D_VISU::transformGraphicModuleEdgeToPolygonSet( const MODULE *aModule
PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aCornerBuffer ) const
{
for( const EDA_ITEM* item = aModule->GraphicalItemsList();
item != NULL;
item = item->Next() )
for( auto item : aModule->GraphicalItems() )
{
switch( item->Type() )
{

View File

@ -66,7 +66,7 @@ size_t hash_eda( const EDA_ITEM* aItem, int aFlags )
if( aFlags & ROTATION )
ret ^= hash<double>{}( module->GetOrientation() );
for( const BOARD_ITEM* i = module->GraphicalItemsList(); i; i = i->Next() )
for( auto i : module->GraphicalItems() )
ret ^= hash_eda( i, aFlags );
for( auto i : module->Pads() )

View File

@ -462,7 +462,6 @@ if( KICAD_SCRIPTING ) # Generate pcbnew.py and pcbnew_wrap.cxx using swig
DEPENDS swig/zone.i
DEPENDS swig/zone_settings.i
DEPENDS ../common/swig/dlist.i
DEPENDS ../common/swig/kicad.i
DEPENDS ../common/swig/wx.i
DEPENDS ../common/swig/ki_exception.i

View File

@ -199,7 +199,7 @@ void MODULE::TransformGraphicShapesWithClearanceToPolygonSet( PCB_LAYER_ID aLaye
std::vector<TEXTE_MODULE *> texts; // List of TEXTE_MODULE to convert
EDGE_MODULE* outline;
for( EDA_ITEM* item = GraphicalItemsList(); item != NULL; item = item->Next() )
for( auto item : GraphicalItems() )
{
switch( item->Type() )
{
@ -265,7 +265,7 @@ void MODULE::TransformGraphicTextWithClearanceToPolygonSet(
{
std::vector<TEXTE_MODULE *> texts; // List of TEXTE_MODULE to convert
for( EDA_ITEM* item = GraphicalItemsList(); item != NULL; item = item->Next() )
for( auto item : GraphicalItems() )
{
switch( item->Type() )
{

View File

@ -109,7 +109,7 @@ MODULE::MODULE( const MODULE& aModule ) :
}
// Copy auxiliary data: Drawings
for( BOARD_ITEM* item = aModule.m_Drawings; item; item = item->Next() )
for( auto item : aModule.GraphicalItems() )
{
switch( item->Type() )
{
@ -187,9 +187,9 @@ MODULE& MODULE::operator=( const MODULE& aOther )
}
// Copy auxiliary data: Drawings
m_Drawings.DeleteAll();
m_drawings.clear();
for( BOARD_ITEM* item = aOther.m_Drawings; item; item = item->Next() )
for( auto item : aOther.GraphicalItems() )
{
switch( item->Type() )
{
@ -238,9 +238,9 @@ void MODULE::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode )
case PCB_MODULE_EDGE_T:
if( aMode == ADD_APPEND )
m_Drawings.PushBack( aBoardItem );
m_drawings.push_back( aBoardItem );
else
m_Drawings.PushFront( aBoardItem );
m_drawings.push_front( aBoardItem );
break;
case PCB_PAD_T:
@ -276,7 +276,8 @@ void MODULE::Remove( BOARD_ITEM* aBoardItem )
// no break
case PCB_MODULE_EDGE_T:
m_Drawings.Remove( aBoardItem );
m_drawings.erase( std::remove_if( m_drawings.begin(), m_drawings.end(),
[aBoardItem]( BOARD_ITEM* aItem ) { return aItem == aBoardItem; } ) );
break;
case PCB_PAD_T:
@ -322,7 +323,7 @@ void MODULE::CopyNetlistSettings( MODULE* aModule, bool aCopyLocalSettings )
aModule->SetThermalGap( GetThermalGap() );
}
for( auto pad : m_pads )
for( auto pad : aModule->Pads() )
{
// Fix me: if aCopyLocalSettings == true, for "multiple" pads
// (set of pads having the same name/number) this is broken
@ -356,7 +357,7 @@ void MODULE::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset )
if( brd->IsElementVisible( LAYER_MOD_VALUES ) )
m_Value->Print( aFrame, aDC, aOffset );
for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
for( auto item : m_drawings )
{
switch( item->Type() )
{
@ -394,7 +395,7 @@ EDA_RECT MODULE::GetFootprintRect() const
area.SetEnd( m_Pos );
area.Inflate( Millimeter2iu( 0.25 ) ); // Give a min size to the area
for( const BOARD_ITEM* item = m_Drawings.GetFirst(); item; item = item->Next() )
for( auto item : m_drawings )
{
if( item->Type() == PCB_MODULE_EDGE_T )
area.Merge( item->GetBoundingBox() );
@ -412,7 +413,7 @@ const EDA_RECT MODULE::GetBoundingBox() const
EDA_RECT area = GetFootprintRect();
// Add in items not collected by GetFootprintRect():
for( const BOARD_ITEM* item = m_Drawings.GetFirst(); item; item = item->Next() )
for( auto item : m_drawings )
{
if( item->Type() != PCB_MODULE_EDGE_T )
area.Merge( item->GetBoundingBox() );
@ -590,7 +591,7 @@ bool MODULE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) co
return true;
}
for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
for( auto item : m_drawings )
{
if( item->HitTest( arect, false, 0 ) )
return true;
@ -756,7 +757,7 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR inspector, void* testData, const KICAD_T
// m_Drawings can hold TYPETEXTMODULE also, so fall thru
case PCB_MODULE_EDGE_T:
result = IterateForward( m_Drawings, inspector, testData, p );
result = IterateForward<BOARD_ITEM*>( m_drawings, inspector, testData, p );
// skip over any types handled in the above call.
for( ; ; )
@ -819,8 +820,8 @@ void MODULE::RunOnChildren( const std::function<void (BOARD_ITEM*)>& aFunction )
for( auto pad : m_pads )
aFunction( static_cast<BOARD_ITEM*>( pad ) );
for( BOARD_ITEM* drawing = m_Drawings; drawing; drawing = drawing->Next() )
aFunction( drawing );
for( auto drawing : m_drawings )
aFunction( static_cast<BOARD_ITEM*>( drawing ) );
aFunction( static_cast<BOARD_ITEM*>( m_Reference ) );
aFunction( static_cast<BOARD_ITEM*>( m_Value ) );
@ -836,7 +837,7 @@ void MODULE::GetAllDrawingLayers( int aLayers[], int& aCount, bool aIncludePads
{
std::unordered_set<int> layers;
for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
for( auto item : m_drawings )
{
layers.insert( static_cast<int>( item->GetLayer() ) );
}
@ -886,7 +887,7 @@ void MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
// with the silkscreen layer
bool f_silk = false, b_silk = false, non_silk = false;
for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
for( auto item : m_drawings )
{
if( item->GetLayer() == F_SilkS )
f_silk = true;
@ -984,7 +985,7 @@ void MODULE::Rotate( const wxPoint& aRotCentre, double aAngle )
m_Reference->KeepUpright( orientation, newOrientation );
m_Value->KeepUpright( orientation, newOrientation );
for( EDA_ITEM* item = m_Drawings; item; item = item->Next() )
for( auto item : m_drawings )
{
if( item->Type() == PCB_MODULE_TEXT_T )
static_cast<TEXTE_MODULE*>( item )->KeepUpright( orientation, newOrientation );
@ -1015,7 +1016,7 @@ void MODULE::Flip( const wxPoint& aCentre )
m_Value->Flip( m_Pos );
// Reverse mirror module graphics and texts.
for( EDA_ITEM* item = m_Drawings; item; item = item->Next() )
for( auto item : m_drawings )
{
switch( item->Type() )
{
@ -1051,7 +1052,7 @@ void MODULE::SetPosition( const wxPoint& newpos )
pad->SetPosition( pad->GetPosition() + delta );
}
for( EDA_ITEM* item = m_Drawings; item; item = item->Next() )
for( auto item : m_drawings )
{
switch( item->Type() )
{
@ -1108,7 +1109,7 @@ void MODULE::MoveAnchorPosition( const wxPoint& aMoveVector )
}
// Update the draw element coordinates.
for( EDA_ITEM* item = GraphicalItemsList(); item; item = item->Next() )
for( auto item : GraphicalItems() )
{
switch( item->Type() )
{
@ -1155,7 +1156,7 @@ void MODULE::SetOrientation( double newangle )
m_Value->SetDrawCoord();
// Displace contours and text of the footprint.
for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
for( auto item : m_drawings )
{
if( item->Type() == PCB_MODULE_EDGE_T )
{
@ -1201,7 +1202,7 @@ BOARD_ITEM* MODULE::Duplicate( const BOARD_ITEM* aItem,
TEXTE_MODULE* new_text = new TEXTE_MODULE( *old_text );
if( aAddToModule )
GraphicalItemsList().PushBack( new_text );
Add( new_text );
new_item = new_text;
}
@ -1214,7 +1215,7 @@ BOARD_ITEM* MODULE::Duplicate( const BOARD_ITEM* aItem,
*static_cast<const EDGE_MODULE*>(aItem) );
if( aAddToModule )
GraphicalItemsList().PushBack( new_edge );
Add( new_edge );
new_item = new_edge;
break;
@ -1352,7 +1353,7 @@ bool MODULE::BuildPolyCourtyard()
std::vector< DRAWSEGMENT* > list_front;
std::vector< DRAWSEGMENT* > list_back;
for( BOARD_ITEM* item = GraphicalItemsList(); item; item = item->Next() )
for( auto item : GraphicalItems() )
{
if( item->GetLayer() == B_CrtYd && item->Type() == PCB_MODULE_EDGE_T )
list_back.push_back( static_cast< DRAWSEGMENT* > ( item ) );

View File

@ -37,7 +37,6 @@
#include <class_board_item.h>
#include <collectors.h>
#include <convert_to_biu.h>
#include <dlist.h>
#include <layers_id_colors_and_visibility.h> // ALL_LAYERS definition.
#include <lib_id.h>
#include <list>
@ -161,9 +160,6 @@ public:
// Virtual function
const EDA_RECT GetBoundingBox() const override;
DLIST<BOARD_ITEM>& GraphicalItemsList() { return m_Drawings; }
const DLIST<BOARD_ITEM>& GraphicalItemsList() const { return m_Drawings; }
PADS& Pads()
{
return m_pads;
@ -174,9 +170,14 @@ public:
return m_pads;
}
DLIST_ITERATOR_WRAPPER<BOARD_ITEM> GraphicalItems()
DRAWINGS& GraphicalItems()
{
return DLIST_ITERATOR_WRAPPER<BOARD_ITEM>( m_Drawings );
return m_drawings;
}
const DRAWINGS& GraphicalItems() const
{
return m_drawings;
}
std::list<MODULE_3D_SETTINGS>& Models() { return m_3D_Drawings; }
@ -670,10 +671,6 @@ public:
private:
DLIST<BOARD_ITEM> m_Drawings; ///< Linked list of graphical items.
/// BOARD_ITEMs for drawings on the board, owned by pointer.
DRAWINGS m_drawings;

View File

@ -248,7 +248,7 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow()
m_texts->push_back( m_footprint->Reference() );
m_texts->push_back( m_footprint->Value() );
for( BOARD_ITEM* item = m_footprint->GraphicalItemsList().GetFirst(); item; item = item->Next() )
for( auto item : m_footprint->GraphicalItems() )
{
auto textModule = dyn_cast<TEXTE_MODULE*>( item );
@ -628,11 +628,9 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow()
m_footprint->Value() = m_texts->at( 1 );
size_t i = 2;
BOARD_ITEM* next;
for( BOARD_ITEM* item = m_footprint->GraphicalItemsList().GetFirst(); item; item = next )
for( auto item : m_footprint->GraphicalItems() )
{
next = item->Next();
TEXTE_MODULE* textModule = dyn_cast<TEXTE_MODULE*>( item );
if( textModule )

View File

@ -204,7 +204,7 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow()
m_texts->push_back( m_footprint->Reference() );
m_texts->push_back( m_footprint->Value() );
for( BOARD_ITEM* item = m_footprint->GraphicalItemsList().GetFirst(); item; item = item->Next() )
for( auto item : m_footprint->GraphicalItems() )
{
auto textModule = dyn_cast<TEXTE_MODULE*>( item );
@ -580,7 +580,7 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow()
m_footprint->Value() = m_texts->at( 1 );
size_t i = 2;
for( BOARD_ITEM* item = m_footprint->GraphicalItemsList().GetFirst(); item; item = item->Next() )
for( auto item : m_footprint->GraphicalItems() )
{
TEXTE_MODULE* textModule = dyn_cast<TEXTE_MODULE*>( item );

View File

@ -382,9 +382,9 @@ void processTextItem( const TEXTE_MODULE& aSrc, TEXTE_MODULE& aDest,
TEXTE_MODULE* getMatchingTextItem( TEXTE_MODULE* aRefItem, MODULE* aModule )
{
for( auto iItem = aModule->GraphicalItemsList().GetFirst(); iItem; iItem = iItem->Next() )
for( auto item : aModule->GraphicalItems() )
{
TEXTE_MODULE* candidate = dyn_cast<TEXTE_MODULE*>( iItem );
TEXTE_MODULE* candidate = dyn_cast<TEXTE_MODULE*>( item );
if( candidate && candidate->GetText() == aRefItem->GetText() )
return candidate;
@ -422,7 +422,7 @@ void PCB_EDIT_FRAME::Exchange_Module( MODULE* aSrc, MODULE* aDest, BOARD_COMMIT&
resetTextLayers, resetTextEffects );
// Copy fields in accordance with the reset* flags
for( BOARD_ITEM* item = aSrc->GraphicalItemsList().GetFirst(); item; item = item->Next() )
for( auto item : aSrc->GraphicalItems() )
{
TEXTE_MODULE* srcItem = dyn_cast<TEXTE_MODULE*>( item );
@ -433,7 +433,7 @@ void PCB_EDIT_FRAME::Exchange_Module( MODULE* aSrc, MODULE* aDest, BOARD_COMMIT&
if( destItem )
processTextItem( *srcItem, *destItem, false, resetTextLayers, resetTextEffects );
else if( !deleteExtraTexts )
aDest->GraphicalItemsList().Append( new TEXTE_MODULE( *srcItem ) );
aDest->Add( new TEXTE_MODULE( *srcItem ) );
}
}

View File

@ -1031,7 +1031,7 @@ void DRC::testCopperTextAndGraphics()
if( module->IsNetTie() )
continue;
for( BOARD_ITEM* item = module->GraphicalItemsList(); item; item = item->Next() )
for( auto item : module->GraphicalItems() )
{
if( IsCopperLayer( item->GetLayer() ) )
{

View File

@ -1504,7 +1504,7 @@ void EAGLE_PLUGIN::packageWire( MODULE* aModule, wxXmlNode* aTree ) const
dwg->SetWidth( width );
dwg->SetDrawCoord();
aModule->GraphicalItemsList().PushBack( dwg );
aModule->Add( dwg );
}
@ -1622,7 +1622,7 @@ void EAGLE_PLUGIN::packageText( MODULE* aModule, wxXmlNode* aTree ) const
{
// FIXME: graphical text items are rotated for some reason.
txt = new TEXTE_MODULE( aModule );
aModule->GraphicalItemsList().PushBack( txt );
aModule->Add( txt );
}
txt->SetTimeStamp( EagleTimeStamp( aTree ) );
@ -1714,7 +1714,7 @@ void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, wxXmlNode* aTree ) const
PCB_LAYER_ID layer = kicad_layer( r.layer );
EDGE_MODULE* dwg = new EDGE_MODULE( aModule, S_POLYGON );
aModule->GraphicalItemsList().PushBack( dwg );
aModule->Add( dwg );
dwg->SetLayer( layer );
dwg->SetWidth( 0 );
@ -1749,7 +1749,7 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, wxXmlNode* aTree ) const
PCB_LAYER_ID layer = kicad_layer( p.layer );
EDGE_MODULE* dwg = new EDGE_MODULE( aModule, S_POLYGON );
aModule->GraphicalItemsList().PushBack( dwg );
aModule->Add( dwg );
dwg->SetWidth( 0 ); // it's filled, no need for boundary width
dwg->SetLayer( layer );
@ -1832,7 +1832,7 @@ void EAGLE_PLUGIN::packageCircle( MODULE* aModule, wxXmlNode* aTree ) const
radius = radius / 2;
}
aModule->GraphicalItemsList().PushBack( gr );
aModule->Add( gr );
gr->SetWidth( width );
switch ( (int) layer )

View File

@ -704,7 +704,8 @@ static size_t hashModule( const MODULE* aModule )
constexpr int flags = HASH_FLAGS::POSITION | HASH_FLAGS::REL_COORD
| HASH_FLAGS::ROTATION | HASH_FLAGS::LAYER;
for( const BOARD_ITEM* i = aModule->GraphicalItemsList(); i; i = i->Next() )
for( auto i : aModule->GraphicalItems() )
ret ^= hash_eda( i, flags );
for( auto i : aModule->Pads() )
@ -1200,7 +1201,6 @@ static void CreateTracksInfoData( FILE* aFile, BOARD* aPcb )
static void FootprintWriteShape( FILE* aFile, MODULE* module, const wxString& aShapeName )
{
EDGE_MODULE* PtEdge;
EDA_ITEM* PtStruct;
/* creates header: */
fprintf( aFile, "\nSHAPE \"%s\"\n", TO_UTF8( escapeString( aShapeName ) ) );
@ -1242,7 +1242,7 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module, const wxString& aS
// CAM350 read it right but only closed shapes
// ProntoPlace double-flip it (at least the pads are correct)
// GerberTool usually get it right...
for( PtStruct = module->GraphicalItemsList(); PtStruct; PtStruct = PtStruct->Next() )
for( auto PtStruct : module->GraphicalItems() )
{
switch( PtStruct->Type() )
{

View File

@ -1338,7 +1338,8 @@ static void export_vrml_module( MODEL_VRML& aModel, BOARD* aPcb,
export_vrml_text_module( &aModule->Value() );
// Export module edges
for( EDA_ITEM* item = aModule->GraphicalItemsList(); item; item = item->Next() )
for( auto item : aModule->GraphicalItems() )
{
switch( item->Type() )
{

View File

@ -474,7 +474,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader )
parseInt( parameters[5], conv_unit ) ) );
drawSeg->SetWidth( parseInt( parameters[6], conv_unit ) );
drawSeg->SetDrawCoord();
module->GraphicalItemsList().PushBack( drawSeg );
module->Add( drawSeg );
continue;
}
@ -492,7 +492,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader )
EDGE_MODULE* drawSeg = new EDGE_MODULE( module.get() );
drawSeg->SetLayer( F_SilkS );
drawSeg->SetShape( S_ARC );
module->GraphicalItemsList().PushBack( drawSeg );
module->Add( drawSeg );
// for and arc: ibuf[3] = ibuf[4]. Pcbnew does not know ellipses
int radius = ( parseInt( parameters[4], conv_unit ) +

View File

@ -1090,7 +1090,7 @@ void PCB_IO::format( MODULE* aModule, int aNestLevel ) const
Format( (BOARD_ITEM*) &aModule->Value(), aNestLevel+1 );
// Save drawing elements.
for( BOARD_ITEM* gr = aModule->GraphicalItemsList(); gr; gr = gr->Next() )
for( auto gr : aModule->GraphicalItems() )
Format( gr, aNestLevel+1 );
// Save pads.

View File

@ -1206,7 +1206,7 @@ void LEGACY_PLUGIN::loadMODULE( MODULE* aModule )
// All other fields greater than 1.
default:
textm = new TEXTE_MODULE( aModule );
aModule->GraphicalItemsList().PushBack( textm );
aModule->Add( textm );
}
loadMODULE_TEXT( textm );
@ -1765,7 +1765,7 @@ void LEGACY_PLUGIN::loadMODULE_EDGE( MODULE* aModule )
EDGE_MODULE* em = dwg.release();
aModule->GraphicalItemsList().PushBack( em );
aModule->Add( em );
// this had been done at the MODULE level before, presumably because the
// EDGE_MODULE needs to be already added to a module before this function will work.

View File

@ -495,7 +495,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
edge->SetShape( S_POLYGON );
edge->SetLayer( F_Cu );
module->GraphicalItemsList().PushFront( edge );
module->Add( edge, ADD_INSERT );
// Get the corner buffer of the polygonal edge
std::vector<wxPoint> polyPoints;

View File

@ -398,7 +398,7 @@ MODULE* MWAVE::CreateMicrowaveInductor( INDUCTOR_PATTERN& inductorPattern,
PtSegm->SetShape( S_SEGMENT );
PtSegm->SetStart0( PtSegm->GetStart() - module->GetPosition() );
PtSegm->SetEnd0( PtSegm->GetEnd() - module->GetPosition() );
module->GraphicalItemsList().PushBack( PtSegm );
module->Add( PtSegm );
}
// Place a pad on each end of coil.

View File

@ -161,7 +161,7 @@ void PCB_ARC::AddToModule( MODULE* aModule )
if( IsNonCopperLayer( m_KiCadLayer ) )
{
EDGE_MODULE* arc = new EDGE_MODULE( aModule, ( IsCircle() ? S_CIRCLE : S_ARC ) );
aModule->GraphicalItemsList().PushBack( arc );
aModule->Add( arc );
arc->SetAngle( -m_angle );
arc->m_Start0 = wxPoint( m_positionX, m_positionY );

View File

@ -120,7 +120,7 @@ void PCB_LINE::AddToModule( MODULE* aModule )
if( IsNonCopperLayer( m_KiCadLayer ) )
{
EDGE_MODULE* segment = new EDGE_MODULE( aModule, S_SEGMENT );
aModule->GraphicalItemsList().PushBack( segment );
aModule->Add( segment );
segment->m_Start0 = wxPoint( m_positionX, m_positionY );
segment->m_End0 = wxPoint( m_toX, m_toY );

View File

@ -161,7 +161,7 @@ void PCB_POLYGON::AddToModule( MODULE* aModule )
if( IsNonCopperLayer( m_KiCadLayer ) )
{
EDGE_MODULE* dwg = new EDGE_MODULE( aModule, S_POLYGON );
aModule->GraphicalItemsList().PushBack( dwg );
aModule->Add( dwg );
dwg->SetWidth( 0 );
dwg->SetLayer( m_KiCadLayer );

View File

@ -2140,7 +2140,7 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments )
break;
default:
module->GraphicalItemsList().PushBack( text );
module->Add( text );
}
}
break;
@ -2154,7 +2154,7 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments )
EDGE_MODULE* em = parseEDGE_MODULE();
em->SetParent( module.get() );
em->SetDrawCoord();
module->GraphicalItemsList().PushBack( em );
module->Add( em );
}
break;

View File

@ -63,32 +63,6 @@
extern bool IsWxPythonLoaded();
// Colors for layers and items
PCB_LAYER_ID g_Route_Layer_TOP;
PCB_LAYER_ID g_Route_Layer_BOTTOM;
bool g_Alternate_Track_Posture = false;
bool g_Raccord_45_Auto = true;
wxPoint g_Offset_Module; // module offset used when moving a footprint
/* Name of the document footprint list
* usually located in share/modules/footprints_doc
* this is of the responsibility to users to create this file
* if they want to have a list of footprints
*/
wxString g_DocModulesFileName = wxT( "footprints_doc/footprints.pdf" );
/*
* Used in track creation, a list of track segments currently being created,
* with the newest track at the end of the list, sorted by new-ness. e.g. use
* TRACK->Back() to get the next older track, TRACK->Next() to get the next
* newer track.
*/
DLIST<TRACK> g_CurrentTrackList;
namespace PCB {
static struct IFACE : public KIFACE_I

View File

@ -29,25 +29,11 @@
#ifndef PCBNEW_H
#define PCBNEW_H
#include <fctsys.h> // wxWidgets include.
#include <base_struct.h> // IS_DRAGGED and IN_EDIT definitions.
#include <dlist.h>
#include <convert_to_biu.h> // to define Mils2iu() conversion function
#include <layers_id_colors_and_visibility.h>
/* Flag used in locate functions. The locate ref point is the on grid cursor or the off
* grid mouse cursor. */
#define CURSEUR_ON_GRILLE (0 << 0)
#define CURSEUR_OFF_GRILLE (1 << 0)
#define IGNORE_LOCKED (1 << 1) ///< if module is locked, do not select for single module operation
#define MATCH_LAYER (1 << 2) ///< if module not on current layer, do not select
#define VISIBLE_ONLY (1 << 3) ///< if module not on a visible layer, do not select
#define DIM_ANCRE_MODULE 3 // Anchor size (footprint center)
// These are only here for algorithmic safety, not to tell the user what to do
#define TEXTS_MIN_SIZE Mils2iu( 1 ) ///< Minimum text size in internal units (1 mil)
#define TEXTS_MAX_SIZE Mils2iu( 10000 ) ///< Maximum text size in internal units (10 inches)
@ -57,30 +43,9 @@
// Flag to force the SKETCH mode to display items (.m_Flags member)
#define FORCE_SKETCH ( IS_DRAGGED | IN_EDIT )
/* Name of the document footprint list
* usually located in share/modules/footprints_doc
* this is of the responsibility to users to create this file
* if they want to have a list of footprints
* default is "footprints_doc/footprints.pdf"
*/
extern wxString g_DocModulesFileName;
// variables
extern bool g_Raccord_45_Auto;
extern bool g_Alternate_Track_Posture;
// Layer pair for auto routing and switch layers by hotkey
extern PCB_LAYER_ID g_Route_Layer_TOP;
extern PCB_LAYER_ID g_Route_Layer_BOTTOM;
extern wxPoint g_Offset_Module; // Offset trace when moving footprint.
/// List of segments of the trace currently being drawn.
class TRACK;
extern DLIST<TRACK> g_CurrentTrackList;
#define g_CurrentTrackSegment g_CurrentTrackList.GetLast() ///< most recently created segment
#define g_FirstTrackSegment g_CurrentTrackList.GetFirst() ///< first segment created
/**
* Helper function PythonPluginsReloadBase

View File

@ -310,7 +310,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
for( auto module : aBoard->Modules() )
{
for( BOARD_ITEM* item = module->GraphicalItemsList(); item; item = item->Next() )
for( auto item : module->GraphicalItems() )
{
if( !aLayerMask[ item->GetLayer() ] )
continue;
@ -775,7 +775,7 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter,
for( auto module : aBoard->Modules() )
{
for( BOARD_ITEM* item = module->GraphicalItemsList(); item; item = item->Next() )
for( auto item : module->GraphicalItems() )
{
if( layer != item->GetLayer() )
continue;

View File

@ -239,7 +239,7 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule )
PlotTextModule( textModule, getColor( textLayer ) );
}
for( BOARD_ITEM* item = aModule->GraphicalItemsList().GetFirst(); item; item = item->Next() )
for( auto item : aModule->GraphicalItems() )
{
textModule = dyn_cast<TEXTE_MODULE*>( item );
@ -432,7 +432,7 @@ void BRDITEMS_PLOTTER::Plot_Edges_Modules()
{
for( auto module : m_board->Modules() )
{
for( BOARD_ITEM* item = module->GraphicalItemsList().GetFirst(); item; item = item->Next() )
for( auto item : module->GraphicalItems() )
{
EDGE_MODULE* edge = dyn_cast<EDGE_MODULE*>( item );

View File

@ -42,8 +42,6 @@ file near the top; only class BOARD functions go in board.i.
HANDLE_EXCEPTIONS(BOARD::TracksInNetBetweenPoints)
//%import dlist.h // comes in from kicad.i which wraps & includes board.i
%include board_item.i
%include board_item_container.i
%include board_connected_item.i

View File

@ -51,8 +51,8 @@
%pythoncode
%{
def Pads(self): return self.PadsList()
def GraphicalItems(self): return self.GraphicalItemsList()
def Pads(self): return self.Pads()
def GraphicalItems(self): return self.GraphicalItems()
#def SaveToLibrary(self,filename):
# return SaveModuleToLibrary(filename,self)

View File

@ -715,10 +715,10 @@ int PCBNEW_CONTROL::Paste( const TOOL_EVENT& aEvent )
items.push_back( pad );
}
for( BOARD_ITEM* item = oldModule->GraphicalItemsList(), *next = nullptr;
item; item = next )
for( auto it = oldModule->GraphicalItems().begin();
it != oldModule->GraphicalItems().end(); it++ )
{
next = item->Next();
auto item = *it;
oldModule->Remove( item );
item->SetParent( newModule );
items.push_back( item );

View File

@ -243,7 +243,7 @@ void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsLis
clone->SetParent( GetBoard() );
// Clear current flags (which can be temporary set by a current edit command)
for( EDA_ITEM* child = clone->GraphicalItemsList(); child; child = child->Next() )
for( auto child : clone->GraphicalItems() )
child->ClearEditFlags();
for( auto pad : clone->Pads() )

View File

@ -44,7 +44,7 @@ void DrawSegment( MODULE& aMod, const SEG& aSeg, int aWidth, PCB_LAYER_ID aLayer
seg->SetWidth( aWidth );
seg->SetLayer( aLayer );
aMod.GraphicalItemsList().PushBack( seg.release() );
aMod.Add( seg.release() );
}
@ -70,7 +70,7 @@ void DrawArc( MODULE& aMod, const VECTOR2I& aCentre, const VECTOR2I& aStart, dou
seg->SetWidth( aWidth );
seg->SetLayer( aLayer );
aMod.GraphicalItemsList().PushBack( seg.release() );
aMod.Add( seg.release() );
}

View File

@ -66,37 +66,6 @@
#include <dialog_find.h>
#include <dialog_block_options.h>
bool g_Drc_On = true;
bool g_AutoDeleteOldTrack = true;
bool g_Raccord_45_Auto = true;
bool g_Alternate_Track_Posture = false;
bool g_Track_45_Only_Allowed = true; // True to allow horiz, vert. and 45deg only tracks
bool g_Segments_45_Only; // True to allow horiz, vert. and 45deg only graphic segments
bool g_TwoSegmentTrackBuild = true;
PCB_LAYER_ID g_Route_Layer_TOP;
PCB_LAYER_ID g_Route_Layer_BOTTOM;
int g_MagneticPadOption;
int g_MagneticTrackOption;
wxPoint g_Offset_Module; // module offset used when moving a footprint
/* Name of the document footprint list
* usually located in share/modules/footprints_doc
* this is of the responsibility to users to create this file
* if they want to have a list of footprints
*/
wxString g_DocModulesFileName = wxT( "footprints_doc/footprints.pdf" );
/*
* Used in track creation, a list of track segments currently being created,
* with the newest track at the end of the list, sorted by new-ness. e.g. use
* TRACK->Back() to get the next older track, TRACK->Next() to get the next
* newer track.
*/
DLIST<TRACK> g_CurrentTrackList;
bool g_DumpZonesWhenFilling = false;
static struct IFACE : public KIFACE_I
{