7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-14 16:19:36 +00:00

further DLIST/Iterators cleanup, some code formatting

This commit is contained in:
Tomasz Włostowski 2017-04-25 11:06:24 +02:00
parent 63f4ab697b
commit 3b16d3cffe
72 changed files with 305 additions and 428 deletions

View File

@ -184,7 +184,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->GraphicalItems();
for( EDA_ITEM* item = aModule->GraphicalItemsList();
item != NULL;
item = item->Next() )
{
@ -607,7 +607,7 @@ void CINFO3D_VISU::AddPadsShapesWithClearanceToContainer( const MODULE* aModule,
int aInflateValue,
bool aSkipNPTHPadsWihNoCopper )
{
const D_PAD* pad = aModule->Pads();
const D_PAD* pad = aModule->PadsList();
wxSize margin;
@ -1518,7 +1518,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
// /////////////////////////////////////////////////////////////////////////
for( const MODULE* module = m_board->m_Modules; module; module = module->Next() )
{
const D_PAD* pad = module->Pads();
const D_PAD* pad = module->PadsList();
for( ; pad; pad = pad->Next() )
{
@ -1552,7 +1552,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
// /////////////////////////////////////////////////////////////////////////
for( const MODULE* module = m_board->m_Modules; module; module = module->Next() )
{
const D_PAD* pad = module->Pads();
const D_PAD* pad = module->PadsList();
for( ; pad; pad = pad->Next() )
{
@ -1652,7 +1652,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
// Note: NPTH pads are not drawn on copper layers when the pad
// has same shape as its hole
transformPadsShapesWithClearanceToPolygon( module->Pads(),
transformPadsShapesWithClearanceToPolygon( module->PadsList(),
curr_layer_id,
*layerPoly,
0,
@ -2058,7 +2058,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
{
if( (curr_layer_id == F_SilkS) || (curr_layer_id == B_SilkS) )
{
D_PAD* pad = module->Pads();
D_PAD* pad = module->PadsList();
int linewidth = g_DrawDefaultLineThickness;
for( ; pad; pad = pad->Next() )
@ -2093,7 +2093,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
{
if( (curr_layer_id == F_SilkS) || (curr_layer_id == B_SilkS) )
{
D_PAD* pad = module->Pads();
D_PAD* pad = module->PadsList();
const int linewidth = g_DrawDefaultLineThickness;
for( ; pad; pad = pad->Next() )
@ -2106,7 +2106,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
}
else
{
transformPadsShapesWithClearanceToPolygon( module->Pads(),
transformPadsShapesWithClearanceToPolygon( module->PadsList(),
curr_layer_id,
*layerPoly,
0,

View File

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

View File

@ -815,7 +815,7 @@ void C3D_RENDER_OGL_LEGACY::generate_3D_Vias_and_Pads()
module;
module = module->Next() )
{
for( const D_PAD* pad = module->Pads(); pad; pad = pad->Next() )
for( const D_PAD* pad = module->PadsList(); pad; pad = pad->Next() )
{
if( pad->GetAttribute() != PAD_ATTRIB_HOLE_NOT_PLATED )
{

View File

@ -1188,7 +1188,7 @@ void C3D_RENDER_RAYTRACING::add_3D_vias_and_pads_to_container()
module;
module = module->Next() )
{
for( const D_PAD* pad = module->Pads(); pad; pad = pad->Next() )
for( const D_PAD* pad = module->PadsList(); pad; pad = pad->Next() )
if( pad->GetAttribute () != PAD_ATTRIB_HOLE_NOT_PLATED )
{
insert3DPadHole( pad );

View File

@ -1138,7 +1138,6 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
gal->SetGridOrigin( VECTOR2D( GetGridOrigin() ) );
// Transfer EDA_DRAW_PANEL settings
GetGalCanvas()->GetViewControls()->EnableCursorWarping( !m_canvas->GetEnableZoomNoCenter() );
GetGalCanvas()->GetViewControls()->EnableMousewheelPan( m_canvas->GetEnableMousewheelPan() );
}
@ -1366,3 +1365,4 @@ void EDA_DRAW_FRAME::GeneralControlKeyMovement( int aHotKey, wxPoint *aPos,
break;
}
}

View File

@ -220,7 +220,7 @@ void ACTION_MANAGER::UpdateHotKeys()
++global_actions_cnt;
}
// assert( global_actions_cnt <= 1 );
assert( global_actions_cnt <= 1 );
}
#endif /* not NDEBUG */
}

View File

@ -27,40 +27,69 @@
#include <dlist.h>
#include <iterator>
template<class T>
class DLIST_ITERATOR: public std::iterator<std::bidirectional_iterator_tag, T>
template <class T>
class DLIST_ITERATOR : public std::iterator<std::bidirectional_iterator_tag, T>
{
private:
T m_obj;
using reference = typename DLIST_ITERATOR<T>::reference ;
using reference = typename DLIST_ITERATOR<T>::reference;
public:
explicit DLIST_ITERATOR<T>( T obj ) : m_obj(obj) {}
explicit DLIST_ITERATOR<T>( T obj ) :
m_obj(obj) {}
DLIST_ITERATOR<T>& operator++() { m_obj = m_obj->Next(); return *this; }
DLIST_ITERATOR<T>& operator--() { m_obj = m_obj->Prev(); return *this; }
DLIST_ITERATOR<T>& operator++()
{
m_obj = m_obj->Next(); return *this;
}
bool operator==(DLIST_ITERATOR<T> other) const {return m_obj == other.m_obj;}
bool operator!=(DLIST_ITERATOR<T> other) const {return !(*this == other);}
DLIST_ITERATOR<T>& operator--()
{
m_obj = m_obj->Prev(); return *this;
}
reference operator*() {return m_obj;}
bool operator==( DLIST_ITERATOR<T> other ) const
{
return m_obj == other.m_obj;
}
bool operator!=( DLIST_ITERATOR<T> other ) const
{
return !(*this == other);
}
reference operator*()
{
return m_obj;
}
};
// helper object, used to convert a DLIST<T> to an iterator
template<class T> class DLIST_ITERATOR_WRAPPER
template <class T>
class DLIST_ITERATOR_WRAPPER
{
public:
explicit DLIST_ITERATOR_WRAPPER<T> ( DLIST<T>& list ) : m_list(list) {};
public:
explicit DLIST_ITERATOR_WRAPPER<T> ( DLIST<T>& list ) :
m_list(list) {}
DLIST_ITERATOR<T*> begin() { return DLIST_ITERATOR<T*> ( m_list.GetFirst()); }
DLIST_ITERATOR<T*> end() { return DLIST_ITERATOR<T*> ( nullptr ); }
DLIST_ITERATOR<T*> begin()
{
return DLIST_ITERATOR<T*> ( m_list.GetFirst() );
}
unsigned int Size() const {
return m_list.GetCount();
}
DLIST_ITERATOR<T*> end()
{
return DLIST_ITERATOR<T*> ( nullptr );
}
private:
DLIST<T>& m_list;
unsigned int Size() const
{
return m_list.GetCount();
}
private:
DLIST<T>& m_list;
};
#endif

View File

@ -601,7 +601,6 @@ public:
}
const VECTOR2I PointAlong( int aPathLength ) const;
const SHAPE_LINE_CHAIN RemoveHoles( ) const;
private:
/// array of vertices

View File

@ -481,7 +481,7 @@ public:
* It shows the connections from a pad to the nearest connected pad
* @param aModule = module to consider.
*/
void build_ratsnest_module( MODULE *mod, wxPoint aMoveVector );
void build_ratsnest_module( MODULE *mod, wxPoint aMoveVector );
/**
* Function TraceModuleRatsNest
@ -527,7 +527,7 @@ public:
*/
void BuildAirWiresTargetsList( BOARD_CONNECTED_ITEM* aItemRef,
const wxPoint& aPosition,
int aNet );
int aNet );
/**
* Function TestForActiveLinksInRatsnest
@ -567,7 +567,7 @@ public:
* search connections between tracks and pads and propagate pad net codes to the track
* segments.
*/
void ComputeLegacyConnections ();
void ComputeLegacyConnections();
/* Functions relative to Undo/redo commands:
*/

View File

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

View File

@ -602,7 +602,6 @@ void PCB_EDIT_FRAME::Block_Rotate()
{
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
wxASSERT( item );
itemsList->SetPickedItemStatus( UR_CHANGED, ii );
switch( item->Type() )

View File

@ -394,7 +394,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
if( currentModule )
{
wxPoint move_offset = -block->GetMoveVector();
BOARD_ITEM* item = currentModule->GraphicalItems();
BOARD_ITEM* item = currentModule->GraphicalItemsList();
for( ; item != NULL; item = item->Next() )
{
@ -413,7 +413,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
}
}
D_PAD* pad = currentModule->Pads();
D_PAD* pad = currentModule->PadsList();
for( ; pad != NULL; pad = pad->Next() )
{
@ -432,7 +432,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
if( currentModule )
{
BOARD_ITEM* item = currentModule->GraphicalItems();
BOARD_ITEM* item = currentModule->GraphicalItemsList();
wxPoint move_offset = - block->GetMoveVector();
for( ; item != NULL; item = item->Next() )
@ -452,7 +452,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
}
}
D_PAD* pad = currentModule->Pads();
D_PAD* pad = currentModule->PadsList();
for( ; pad != NULL; pad = pad->Next() )
{
@ -477,7 +477,7 @@ void CopyMarkedItems( MODULE* module, wxPoint offset, bool aIncrement )
module->Reference().ClearFlags();
module->Value().ClearFlags();
for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() )
for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() )
{
if( !pad->IsSelected() )
continue;
@ -486,7 +486,7 @@ void CopyMarkedItems( MODULE* module, wxPoint offset, bool aIncrement )
D_PAD* NewPad = new D_PAD( *pad );
NewPad->SetParent( module );
NewPad->SetFlags( SELECTED );
module->Pads().PushFront( NewPad );
module->PadsList().PushFront( NewPad );
if( aIncrement )
NewPad->IncrementPadName( true, true );
@ -494,7 +494,7 @@ void CopyMarkedItems( MODULE* module, wxPoint offset, bool aIncrement )
BOARD_ITEM* newItem;
for( BOARD_ITEM* item = module->GraphicalItems(); item; item = item->Next() )
for( BOARD_ITEM* item = module->GraphicalItemsList(); item; item = item->Next() )
{
if( !item->IsSelected() )
continue;
@ -504,7 +504,7 @@ void CopyMarkedItems( MODULE* module, wxPoint offset, bool aIncrement )
newItem = (BOARD_ITEM*)item->Clone();
newItem->SetParent( module );
newItem->SetFlags( SELECTED );
module->GraphicalItems().PushFront( newItem );
module->GraphicalItemsList().PushFront( newItem );
}
MoveMarkedItems( module, offset );
@ -526,7 +526,7 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
if( module->Value().IsSelected() )
module->Value().Move( offset );
D_PAD* pad = module->Pads();
D_PAD* pad = module->PadsList();
for( ; pad != NULL; pad = pad->Next() )
{
@ -537,7 +537,7 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
pad->SetPos0( pad->GetPos0() + offset );
}
item = module->GraphicalItems();
item = module->GraphicalItemsList();
for( ; item != NULL; item = item->Next() )
{
@ -579,7 +579,7 @@ void DeleteMarkedItems( MODULE* module )
D_PAD* next_pad;
BOARD* board = module->GetBoard();
for( D_PAD* pad = module->Pads(); pad; pad = next_pad )
for( D_PAD* pad = module->PadsList(); pad; pad = next_pad )
{
next_pad = pad->Next();
@ -594,7 +594,7 @@ void DeleteMarkedItems( MODULE* module )
BOARD_ITEM* next_item;
for( BOARD_ITEM* item = module->GraphicalItems(); item; item = next_item )
for( BOARD_ITEM* item = module->GraphicalItemsList(); item; item = next_item )
{
next_item = item->Next();
@ -628,7 +628,7 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset, bool force_all )
if( module->Value().IsSelected() || force_all )
module->Value().Mirror( offset, false );
for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() )
for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() )
{
// Skip pads not selected, i.e. not inside the block to mirror:
if( !pad->IsSelected() && !force_all )
@ -651,7 +651,7 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset, bool force_all )
pad->SetOrientation( - pad->GetOrientation() );
}
for( EDA_ITEM* item = module->GraphicalItems(); item; item = item->Next() )
for( EDA_ITEM* item = module->GraphicalItemsList(); item; item = item->Next() )
{
// Skip items not selected, i.e. not inside the block to mirror:
if( !item->IsSelected() && !force_all )
@ -693,7 +693,7 @@ void RotateMarkedItems( MODULE* module, wxPoint offset, bool force_all )
if( module->Value().IsSelected() || force_all )
module->Value().Rotate( offset, 900 );
for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() )
for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() )
{
if( !pad->IsSelected() && !force_all )
continue;
@ -706,7 +706,7 @@ void RotateMarkedItems( MODULE* module, wxPoint offset, bool force_all )
pad->SetDrawCoord();
}
for( EDA_ITEM* item = module->GraphicalItems(); item; item = item->Next() )
for( EDA_ITEM* item = module->GraphicalItemsList(); item; item = item->Next() )
{
if( !item->IsSelected() && !force_all )
continue;
@ -738,14 +738,14 @@ void ClearMarkItems( MODULE* module )
module->Reference().ClearFlags();
module->Value().ClearFlags();
EDA_ITEM* item = module->GraphicalItems();
EDA_ITEM* item = module->GraphicalItemsList();
for( ; item != NULL; item = item->Next() )
{
item->ClearFlags();
}
item = module->Pads();
item = module->PadsList();
for( ; item != NULL; item = item->Next() )
{
@ -773,7 +773,7 @@ void MoveMarkedItemsExactly( MODULE* module, const wxPoint& centre,
module->Value().Move( translation );
}
D_PAD* pad = module->Pads();
D_PAD* pad = module->PadsList();
for( ; pad != NULL; pad = pad->Next() )
{
@ -793,7 +793,7 @@ void MoveMarkedItemsExactly( MODULE* module, const wxPoint& centre,
pad->Rotate( newPos, rotation );
}
EDA_ITEM* item = module->GraphicalItems();
EDA_ITEM* item = module->GraphicalItemsList();
for( ; item != NULL; item = item->Next() )
{
@ -857,7 +857,7 @@ int MarkItemsInBloc( MODULE* module, EDA_RECT& Rect )
ItemsCount++;
}
pad = module->Pads();
pad = module->PadsList();
for( ; pad != NULL; pad = pad->Next() )
{
@ -871,7 +871,7 @@ int MarkItemsInBloc( MODULE* module, EDA_RECT& Rect )
}
}
item = module->GraphicalItems();
item = module->GraphicalItemsList();
for( ; item != NULL; item = item->Next() )
{

View File

@ -133,7 +133,7 @@ void MODULE::TransformPadsShapesWithClearanceToPolygon( PCB_LAYER_ID aLayer,
double aCorrectionFactor,
bool aSkipNPTHPadsWihNoCopper ) const
{
D_PAD* pad = Pads();
D_PAD* pad = PadsList();
wxSize margin;
for( ; pad != NULL; pad = pad->Next() )
@ -211,7 +211,7 @@ void MODULE::TransformGraphicShapesWithClearanceToPolygonSet(
std::vector<TEXTE_MODULE *> texts; // List of TEXTE_MODULE to convert
EDGE_MODULE* outline;
for( EDA_ITEM* item = GraphicalItems(); item != NULL; item = item->Next() )
for( EDA_ITEM* item = GraphicalItemsList(); item != NULL; item = item->Next() )
{
switch( item->Type() )
{
@ -286,7 +286,7 @@ void MODULE::TransformGraphicTextWithClearanceToPolygonSet(
{
std::vector<TEXTE_MODULE *> texts; // List of TEXTE_MODULE to convert
for( EDA_ITEM* item = GraphicalItems(); item != NULL; item = item->Next() )
for( EDA_ITEM* item = GraphicalItemsList(); item != NULL; item = item->Next() )
{
switch( item->Type() )
{

View File

@ -318,7 +318,7 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( MODULE* aPcbComponent
MODULE* copy = (MODULE*) aPcbComponent->Clone();
// At this point, the component footprint is updated. Now update the nets.
for( D_PAD* pad = aPcbComponent->Pads(); pad; pad = pad->Next() )
for( D_PAD* pad = aPcbComponent->PadsList(); pad; pad = pad->Next() )
{
COMPONENT_NET net = aNewComponent->GetNet( pad->GetPadName() );

View File

@ -763,7 +763,7 @@ void BOARD::SetElementVisibility( GAL_LAYER_ID LAYER_aPCB, bool isEnabled )
for ( auto track : Tracks() )
track->SetLocalRatsnestVisible( isEnabled );
for( auto mod : Modules() )
for ( auto pad : mod->PadsIter() )
for ( auto pad : mod->Pads() )
pad->SetLocalRatsnestVisible( isEnabled );
for( int i = 0; i<GetAreaCount(); i++ )
{
@ -1617,7 +1617,7 @@ D_PAD* BOARD::GetPadFast( const wxPoint& aPosition, LSET aLayerSet )
{
for( auto mod : Modules() )
{
for ( auto pad : mod->PadsIter() )
for ( auto pad : mod->Pads() )
{
if( pad->GetPosition() != aPosition )
continue;
@ -1743,7 +1743,7 @@ void BOARD::GetSortedPadListByXthenYCoord( std::vector<D_PAD*>& aVector, int aNe
{
for ( auto mod : Modules() )
{
for ( auto pad : mod->PadsIter( ) )
for ( auto pad : mod->Pads( ) )
{
if( aNetCode < 0 || pad->GetNetCode() == aNetCode )
{
@ -2617,7 +2617,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
continue;
// At this point, the component footprint is updated. Now update the nets.
for( D_PAD* pad = footprint->Pads(); pad; pad = pad->Next() )
for( auto pad : footprint->Pads() )
{
COMPONENT_NET net = component->GetNet( pad->GetPadName() );
@ -2897,7 +2897,7 @@ const std::vector<D_PAD*> BOARD::GetPads()
std::vector<D_PAD*> rv;
for ( auto mod: Modules() )
{
for ( auto pad: mod->PadsIter() )
for ( auto pad: mod->Pads() )
rv.push_back ( pad );
}
@ -2919,7 +2919,7 @@ D_PAD* BOARD::GetPad( unsigned aIndex ) const
unsigned count = 0;
for ( MODULE *mod = m_Modules; mod ; mod = mod->Next() ) // FIXME: const DLIST_ITERATOR
{
for ( D_PAD *pad = mod->Pads(); pad; pad = pad->Next() )
for ( D_PAD *pad = mod->PadsList(); pad; pad = pad->Next() )
{
if ( count == aIndex )
return pad;

View File

@ -37,7 +37,6 @@
class NETCLASS;
class TRACK;
class D_PAD;
class CN_BOARD_ITEM_DATA;
/**
* Class BOARD_CONNECTED_ITEM

View File

@ -229,7 +229,7 @@ void MODULE::ClearAllNets()
{
// Force the ORPHANED dummy net info for all pads.
// ORPHANED dummy net does not depend on a board
for( D_PAD* pad = Pads(); pad; pad = pad->Next() )
for( D_PAD* pad = PadsList(); pad; pad = pad->Next() )
pad->SetNetCode( NETINFO_LIST::ORPHANED );
}
@ -364,7 +364,7 @@ void MODULE::CopyNetlistSettings( MODULE* aModule, bool aCopyLocalSettings )
aModule->SetThermalGap( GetThermalGap() );
}
for( D_PAD* pad = aModule->Pads(); pad; pad = pad->Next() )
for( D_PAD* pad = aModule->PadsList(); pad; pad = pad->Next() )
{
// Fix me: if aCopyLocalSettings == true, for "multiple" pads
// (set of pads having the same name/number) this is broken
@ -717,7 +717,7 @@ unsigned MODULE::GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH ) const
std::set<wxUint32> usedNames;
// Create a set of used pad numbers
for( D_PAD* pad = Pads(); pad; pad = pad->Next() )
for( D_PAD* pad = PadsList(); pad; pad = pad->Next() )
{
// Skip pads not on copper layers (used to build complex
// solder paste shapes for instance)
@ -1065,14 +1065,14 @@ void MODULE::MoveAnchorPosition( const wxPoint& aMoveVector )
m_Value->SetDrawCoord();
// Update the pad local coordinates.
for( D_PAD* pad = Pads(); pad; pad = pad->Next() )
for( D_PAD* pad = PadsList(); pad; pad = pad->Next() )
{
pad->SetPos0( pad->GetPos0() + moveVector );
pad->SetDrawCoord();
}
// Update the draw element coordinates.
for( EDA_ITEM* item = GraphicalItems(); item; item = item->Next() )
for( EDA_ITEM* item = GraphicalItemsList(); item; item = item->Next() )
{
switch( item->Type() )
{
@ -1150,7 +1150,7 @@ BOARD_ITEM* MODULE::Duplicate( const BOARD_ITEM* aItem,
new_pad = new D_PAD( *static_cast<const D_PAD*>( aItem ) );
if( aAddToModule )
Pads().PushBack( new_pad );
PadsList().PushBack( new_pad );
new_item = new_pad;
break;
@ -1167,7 +1167,7 @@ BOARD_ITEM* MODULE::Duplicate( const BOARD_ITEM* aItem,
TEXTE_MODULE* new_text = new TEXTE_MODULE( *old_text );
if( aAddToModule )
GraphicalItems().PushBack( new_text );
GraphicalItemsList().PushBack( new_text );
new_item = new_text;
}
@ -1180,7 +1180,7 @@ BOARD_ITEM* MODULE::Duplicate( const BOARD_ITEM* aItem,
*static_cast<const EDGE_MODULE*>(aItem) );
if( aAddToModule )
GraphicalItems().PushBack( new_edge );
GraphicalItemsList().PushBack( new_edge );
new_item = new_edge;
break;
@ -1211,7 +1211,7 @@ wxString MODULE::GetNextPadName( bool aFillSequenceGaps ) const
std::set<int> usedNumbers;
// Create a set of used pad numbers
for( D_PAD* pad = Pads(); pad; pad = pad->Next() )
for( D_PAD* pad = PadsList(); pad; pad = pad->Next() )
{
int padNumber = getTrailingInt( pad->GetPadName() );
usedNumbers.insert( padNumber );
@ -1276,7 +1276,7 @@ bool MODULE::BuildPolyCourtyard()
std::vector< DRAWSEGMENT* > list_front;
std::vector< DRAWSEGMENT* > list_back;
for( BOARD_ITEM* item = GraphicalItems(); item; item = item->Next() )
for( BOARD_ITEM* item = GraphicalItemsList(); item; item = item->Next() )
{
if( item->GetLayer() == B_CrtYd && item->Type() == PCB_MODULE_EDGE_T )
list_back.push_back( static_cast< DRAWSEGMENT* > ( item ) );

View File

@ -55,9 +55,8 @@ class D_PAD;
class BOARD;
class MSG_PANEL_ITEM;
namespace KIGFX
{
class VIEW;
namespace KIGFX {
class VIEW;
};
enum INCLUDE_NPTH_T
@ -132,26 +131,35 @@ public:
// Virtual function
const EDA_RECT GetBoundingBox() const override;
DLIST<D_PAD>& Pads() { return m_Pads; }
const DLIST<D_PAD>& Pads() const { return m_Pads; }
DLIST<D_PAD>& PadsList() { return m_Pads; }
const DLIST<D_PAD>& PadsList() const { return m_Pads; }
DLIST<BOARD_ITEM>& GraphicalItems() { return m_Drawings; }
const DLIST<BOARD_ITEM>& GraphicalItems() const { return m_Drawings; }
DLIST<BOARD_ITEM>& GraphicalItemsList() { return m_Drawings; }
const DLIST<BOARD_ITEM>& GraphicalItemsList() const { return m_Drawings; }
DLIST_ITERATOR_WRAPPER<D_PAD> PadsIter() { return DLIST_ITERATOR_WRAPPER<D_PAD>(m_Pads); }
DLIST_ITERATOR_WRAPPER<BOARD_ITEM> GraphicalItemsIter() { return DLIST_ITERATOR_WRAPPER<BOARD_ITEM>(m_Drawings); }
DLIST_ITERATOR_WRAPPER<D_PAD> Pads()
{
return DLIST_ITERATOR_WRAPPER<D_PAD>( m_Pads );
}
DLIST_ITERATOR_WRAPPER<BOARD_ITEM> GraphicalItems()
{
return DLIST_ITERATOR_WRAPPER<BOARD_ITEM>( m_Drawings );
}
std::list<S3D_INFO>& Models() { return m_3D_Drawings; }
const std::list<S3D_INFO>& Models() const { return m_3D_Drawings; }
void SetPosition( const wxPoint& aPos ) override;
const wxPoint& GetPosition() const override { return m_Pos; }
void SetOrientation( double newangle );
void SetOrientationDegrees( double aOrientation ) { SetOrientation( aOrientation*10.0 ); }
void SetOrientationDegrees( double aOrientation ) { SetOrientation( aOrientation * 10.0 ); }
double GetOrientation() const { return m_Orient; }
double GetOrientationDegrees() const { return m_Orient/10.0; }
double GetOrientationRadians() const { return m_Orient*M_PI/1800; }
double GetOrientationDegrees() const { return m_Orient / 10.0; }
double GetOrientationRadians() const { return m_Orient * M_PI / 1800; }
const LIB_ID& GetFPID() const { return m_fpid; }
void SetFPID( const LIB_ID& aFPID ) { m_fpid = aFPID; }
@ -216,7 +224,7 @@ public:
* function IsFlipped
* @return true if the module is flipped, i.e. on the back side of the board
*/
bool IsFlipped() const {return GetLayer() == B_Cu; }
bool IsFlipped() const { return GetLayer() == B_Cu; }
// m_ModuleStatus bits:
#define MODULE_is_LOCKED 0x01 ///< module LOCKED: no autoplace allowed
@ -243,7 +251,7 @@ public:
m_ModuleStatus &= ~MODULE_is_LOCKED;
}
bool IsPlaced() const { return (m_ModuleStatus & MODULE_is_PLACED); }
bool IsPlaced() const { return m_ModuleStatus & MODULE_is_PLACED; }
void SetIsPlaced( bool isPlaced )
{
if( isPlaced )
@ -252,7 +260,7 @@ public:
m_ModuleStatus &= ~MODULE_is_PLACED;
}
bool NeedsPlaced() const { return (m_ModuleStatus & MODULE_to_PLACE); }
bool NeedsPlaced() const { return m_ModuleStatus & MODULE_to_PLACE; }
void SetNeedsPlaced( bool needsPlaced )
{
if( needsPlaced )
@ -261,7 +269,7 @@ public:
m_ModuleStatus &= ~MODULE_to_PLACE;
}
bool PadsLocked() const { return ( m_ModuleStatus & MODULE_PADS_LOCKED ); }
bool PadsLocked() const { return m_ModuleStatus & MODULE_PADS_LOCKED; }
void SetPadsLocked( bool aPadsLocked )
{
@ -272,7 +280,7 @@ public:
}
void SetLastEditTime( time_t aTime ) { m_LastEditTime = aTime; }
void SetLastEditTime( ) { m_LastEditTime = time( NULL ); }
void SetLastEditTime() { m_LastEditTime = time( NULL ); }
time_t GetLastEditTime() const { return m_LastEditTime; }
/* drawing functions */
@ -286,9 +294,9 @@ public:
* @param aOffset = draw offset (usually wxPoint(0,0)
*/
void Draw( EDA_DRAW_PANEL* aPanel,
wxDC* aDC,
GR_DRAWMODE aDrawMode,
const wxPoint& aOffset = ZeroOffset ) override;
wxDC* aDC,
GR_DRAWMODE aDrawMode,
const wxPoint& aOffset = ZeroOffset ) override;
/**
* Function DrawOutlinesWhenMoving
@ -300,7 +308,7 @@ public:
* the draw position.
*/
void DrawOutlinesWhenMoving( EDA_DRAW_PANEL* aPanel,
wxDC* aDC, const wxPoint& aMoveVector );
wxDC* aDC, const wxPoint& aMoveVector );
/**
* function TransformPadsShapesWithClearanceToPolygon
@ -326,11 +334,11 @@ public:
* default = false
*/
void TransformPadsShapesWithClearanceToPolygon( PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aCornerBuffer,
int aInflateValue,
int aCircleToSegmentsCount,
double aCorrectionFactor,
bool aSkipNPTHPadsWihNoCopper = false ) const;
SHAPE_POLY_SET& aCornerBuffer,
int aInflateValue,
int aCircleToSegmentsCount,
double aCorrectionFactor,
bool aSkipNPTHPadsWihNoCopper = false ) const;
/**
* function TransformGraphicShapesWithClearanceToPolygonSet
@ -352,13 +360,12 @@ public:
* a circle when building the texts polygonal shapes of the stroke font
* if 0, use the aCircleToSegmentsCount value
*/
void TransformGraphicShapesWithClearanceToPolygonSet(
PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aCornerBuffer,
int aInflateValue,
int aCircleToSegmentsCount,
double aCorrectionFactor,
int aCircleToSegmentsCountForTexts = 0 ) const;
void TransformGraphicShapesWithClearanceToPolygonSet( PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aCornerBuffer,
int aInflateValue,
int aCircleToSegmentsCount,
double aCorrectionFactor,
int aCircleToSegmentsCountForTexts = 0 ) const;
/**
* @brief TransformGraphicTextWithClearanceToPolygonSet
@ -371,13 +378,12 @@ public:
* @param aCorrectionFactor
* @param aCircleToSegmentsCountForTexts
*/
void TransformGraphicTextWithClearanceToPolygonSet(
PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aCornerBuffer,
int aInflateValue,
int aCircleToSegmentsCount,
double aCorrectionFactor,
int aCircleToSegmentsCountForTexts = 0 ) const;
void TransformGraphicTextWithClearanceToPolygonSet( PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aCornerBuffer,
int aInflateValue,
int aCircleToSegmentsCount,
double aCorrectionFactor,
int aCircleToSegmentsCountForTexts = 0 ) const;
/**
* Function DrawEdgesOnly
@ -388,7 +394,7 @@ public:
* @param draw_mode = GR_OR, GR_XOR, GR_AND
*/
void DrawEdgesOnly( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
GR_DRAWMODE draw_mode );
GR_DRAWMODE draw_mode );
/**
* Function DrawAncre
@ -397,10 +403,10 @@ public:
* every thing already drawn.
*/
void DrawAncre( EDA_DRAW_PANEL* panel, wxDC* DC,
const wxPoint& offset, int dim_ancre, GR_DRAWMODE draw_mode );
const wxPoint& offset, int dim_ancre, GR_DRAWMODE draw_mode );
///> @copydoc EDA_ITEM::GetMsgPanelInfo
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
void GetMsgPanelInfo( std::vector<MSG_PANEL_ITEM>& aList ) override;
bool HitTest( const wxPoint& aPosition ) const override;
@ -457,8 +463,8 @@ public:
TEXTE_MODULE& Reference() { return *m_Reference; }
/// The const versions to keep the compiler happy.
TEXTE_MODULE& Value() const { return *m_Value; }
TEXTE_MODULE& Reference() const { return *m_Reference; }
TEXTE_MODULE& Value() const { return *m_Value; }
TEXTE_MODULE& Reference() const { return *m_Reference; }
/**
* Function FindPadByName
@ -490,7 +496,7 @@ public:
* non-plated through holes when false.
* @return the number of pads according to \a aIncludeNPTH.
*/
unsigned GetPadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T( INCLUDE_NPTH ) ) const;
unsigned GetPadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T(INCLUDE_NPTH) ) const;
/**
* GetUniquePadCount
@ -504,7 +510,7 @@ public:
* non-plated through holes when false.
* @return the number of unique pads according to \a aIncludeNPTH.
*/
unsigned GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T( INCLUDE_NPTH ) ) const;
unsigned GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T(INCLUDE_NPTH) ) const;
/**
* Function GetNextPadName
@ -516,15 +522,15 @@ public:
*/
wxString GetNextPadName( bool aFillSequenceGaps ) const;
double GetArea() const { return m_Surface; }
double GetArea() const { return m_Surface; }
time_t GetLink() const { return m_Link; }
time_t GetLink() const { return m_Link; }
void SetLink( time_t aLink ) { m_Link = aLink; }
int GetPlacementCost180() const { return m_CntRot180; }
int GetPlacementCost180() const { return m_CntRot180; }
void SetPlacementCost180( int aCost ) { m_CntRot180 = aCost; }
int GetPlacementCost90() const { return m_CntRot90; }
int GetPlacementCost90() const { return m_CntRot90; }
void SetPlacementCost90( int aCost ) { m_CntRot90 = aCost; }
/**
@ -533,8 +539,8 @@ public:
* @return the new item, or NULL if the item could not be duplicated
*/
BOARD_ITEM* Duplicate( const BOARD_ITEM* aItem,
bool aIncrementPadNumbers,
bool aAddToModule = false );
bool aIncrementPadNumbers,
bool aAddToModule = false );
/**
* Function Add3DModel
@ -544,7 +550,7 @@ public:
*/
void Add3DModel( S3D_INFO* a3DModel );
SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
wxString GetClass() const override
{
@ -597,7 +603,7 @@ public:
* @param aName = the name in library to validate
* @return true if the given name is valid
*/
static bool IsLibNameValid( const wxString & aName );
static bool IsLibNameValid( const wxString& aName );
/**
* static function StringLibNameInvalidChars
@ -661,42 +667,42 @@ public:
#endif
private:
DLIST<D_PAD> m_Pads; ///< Linked list of pads.
DLIST<D_PAD> m_Pads; ///< Linked list of pads.
DLIST<BOARD_ITEM> m_Drawings; ///< Linked list of graphical items.
std::list<S3D_INFO> m_3D_Drawings; ///< Linked list of 3D models.
double m_Orient; ///< Orientation in tenths of a degree, 900=90.0 degrees.
wxPoint m_Pos; ///< Position of module on the board in internal units.
TEXTE_MODULE* m_Reference; ///< Component reference designator value (U34, R18..)
TEXTE_MODULE* m_Value; ///< Component value (74LS00, 22K..)
LIB_ID m_fpid; ///< The #LIB_ID of the MODULE.
int m_Attributs; ///< Flag bits ( see Mod_Attribut )
int m_ModuleStatus; ///< For autoplace: flags (LOCKED, AUTOPLACED)
EDA_RECT m_BoundaryBox; ///< Bounding box : coordinates on board, real orientation.
double m_Orient; ///< Orientation in tenths of a degree, 900=90.0 degrees.
wxPoint m_Pos; ///< Position of module on the board in internal units.
TEXTE_MODULE* m_Reference; ///< Component reference designator value (U34, R18..)
TEXTE_MODULE* m_Value; ///< Component value (74LS00, 22K..)
LIB_ID m_fpid; ///< The #LIB_ID of the MODULE.
int m_Attributs; ///< Flag bits ( see Mod_Attribut )
int m_ModuleStatus; ///< For autoplace: flags (LOCKED, AUTOPLACED)
EDA_RECT m_BoundaryBox; ///< Bounding box : coordinates on board, real orientation.
// The final margin is the sum of these 2 values
int m_ThermalWidth;
int m_ThermalGap;
wxString m_Doc; ///< File name and path for documentation file.
wxString m_KeyWord; ///< Search keywords to find module in library.
wxString m_Path;
ZoneConnection m_ZoneConnection;
time_t m_LastEditTime;
int m_arflag; ///< Use to trace ratsnest and auto routing.
double m_Surface; ///< Bounding box area
time_t m_Link; ///< Temporary logical link used in edition
int m_CntRot90; ///< Horizontal automatic placement cost ( 0..10 ).
int m_CntRot180; ///< Vertical automatic placement cost ( 0..10 ).
int m_ThermalWidth;
int m_ThermalGap;
wxString m_Doc; ///< File name and path for documentation file.
wxString m_KeyWord; ///< Search keywords to find module in library.
wxString m_Path;
ZoneConnection m_ZoneConnection;
time_t m_LastEditTime;
int m_arflag; ///< Use to trace ratsnest and auto routing.
double m_Surface; ///< Bounding box area
time_t m_Link; ///< Temporary logical link used in edition
int m_CntRot90; ///< Horizontal automatic placement cost ( 0..10 ).
int m_CntRot180; ///< Vertical automatic placement cost ( 0..10 ).
// Local tolerances. When zero, this means the corresponding netclass value
// is used. Usually theses local tolerances zero, in deference to the
// corresponding netclass values.
int m_LocalClearance;
int m_LocalSolderMaskMargin; ///< Solder mask margin
int m_LocalSolderPasteMargin; ///< Solder paste margin absolute value
double m_LocalSolderPasteMarginRatio; ///< Solder mask margin ratio
///< value of pad size
int m_LocalClearance;
int m_LocalSolderMaskMargin; ///< Solder mask margin
int m_LocalSolderPasteMargin; ///< Solder paste margin absolute value
double m_LocalSolderPasteMarginRatio; ///< Solder mask margin ratio
///< value of pad size
wxArrayString* m_initial_comments; ///< leading s-expression comments in the module,
wxArrayString* m_initial_comments; ///< leading s-expression comments in the module,
///< lazily allocated only if needed for speed
/// Used in DRC to test the courtyard area (a polygon which can be not basic

View File

@ -94,9 +94,9 @@ void NETINFO_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
return;
int count = 0;
for( MODULE* module = board->m_Modules; module != NULL; module = module->Next() )
for( auto mod : board->Modules() )
{
for( D_PAD* pad = module->Pads(); pad != 0; pad = pad->Next() )
for( auto pad : mod->Pads() )
{
if( pad->GetNetCode() == GetNet() )
{
@ -140,4 +140,4 @@ void NETINFO_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
// Displays the net length of internal ICs connections (wires inside ICs):
txt = ::LengthDoubleToString( lengthPadToDie );
aList.push_back( MSG_PANEL_ITEM( _( "In Package" ), txt, RED ) );
}
}

View File

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

View File

@ -642,7 +642,6 @@ public:
return m_RawPolysList;
}
wxString GetSelectMenuText() const override;
BITMAP_DEF GetMenuImage() const override;
@ -787,7 +786,7 @@ private:
* described by m_Poly can have many filled areas
*/
SHAPE_POLY_SET m_FilledPolysList;
SHAPE_POLY_SET m_RawPolysList;
SHAPE_POLY_SET m_RawPolysList;
HATCH_STYLE m_hatchStyle; // hatch style, see enum above
int m_hatchPitch; // for DIAGONAL_EDGE, distance between 2 hatch lines

View File

@ -35,10 +35,7 @@
#include <view/view.h>
#include <pcbnew.h>
// Helper classes to handle connection points
#include <connect.h>
#include <class_board.h>
/*
* Function SortTracksByNetCode used in RebuildTrackChain()
* to sort track segments by net code.

View File

@ -1,38 +0,0 @@
/**
* @file connect.h
* @brief helper classes to find track to track and track to pad connections.
*/
#ifndef CONNECT_H
#define CONNECT_H
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <class_track.h>
#include <class_board.h>
#endif // ifndef CONNECT_H

View File

@ -189,7 +189,7 @@ void CONNECTIVITY_DATA::BlockRatsnestItems( const std::vector<BOARD_ITEM*>& aIte
{
if( item->Type() == PCB_MODULE_T )
{
for( auto pad : static_cast<MODULE*>(item)->PadsIter() )
for( auto pad : static_cast<MODULE*>(item)->Pads() )
citems.push_back( pad );
}
else

View File

@ -140,7 +140,7 @@ bool CN_CONNECTIVITY_ALGO::Remove( BOARD_ITEM* aItem )
switch( aItem->Type() )
{
case PCB_MODULE_T:
for ( auto pad : static_cast<MODULE *> (aItem ) -> PadsIter() )
for ( auto pad : static_cast<MODULE *> (aItem ) -> Pads() )
{
m_itemMap[ static_cast<BOARD_CONNECTED_ITEM*>( pad ) ].MarkItemsAsInvalid();
m_itemMap.erase ( static_cast<BOARD_CONNECTED_ITEM*>( pad ) );
@ -195,7 +195,7 @@ void CN_CONNECTIVITY_ALGO::markItemNetAsDirty( const BOARD_ITEM *aItem )
if ( aItem->Type() == PCB_MODULE_T )
{
auto mod = static_cast <const MODULE *> ( aItem );
for( D_PAD* pad = mod->Pads(); pad; pad = pad->Next() )
for( D_PAD* pad = mod->PadsList(); pad; pad = pad->Next() )
markNetAsDirty ( pad->GetNetCode() );
}
}
@ -209,7 +209,7 @@ bool CN_CONNECTIVITY_ALGO::Add( BOARD_ITEM* aItem )
switch( aItem->Type() )
{
case PCB_MODULE_T:
for ( auto pad : static_cast<MODULE *> (aItem ) -> PadsIter() )
for ( auto pad : static_cast<MODULE *> (aItem ) -> Pads() )
{
if ( m_itemMap.find ( pad ) != m_itemMap.end() )
return false;
@ -678,7 +678,7 @@ void CN_CONNECTIVITY_ALGO::Build( BOARD* aBoard )
Add( tv );
for( auto mod : aBoard->Modules() )
for( auto pad : mod->PadsIter() )
for( auto pad : mod->Pads() )
Add( pad );
/*wxLogTrace( "CN", "zones : %lu, pads : %lu vias : %lu tracks : %lu\n",
@ -701,7 +701,7 @@ void CN_CONNECTIVITY_ALGO::Build( const std::vector<BOARD_ITEM *> &aItems )
case PCB_MODULE_T:
{
for( auto pad : static_cast<MODULE*>(item)->PadsIter() )
for( auto pad : static_cast<MODULE*>(item)->Pads() )
{
Add( pad );
}

Some files were not shown because too many files have changed in this diff Show More