From 3b16d3cffe683ef556556c9242db6ccafc8ce65a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20W=C5=82ostowski?= Date: Tue, 25 Apr 2017 11:06:24 +0200 Subject: [PATCH] further DLIST/Iterators cleanup, some code formatting --- 3d-viewer/3d_canvas/create_layer_items.cpp | 16 +- 3d-viewer/3d_canvas/create_layer_poly.cpp | 2 +- .../c3d_render_createscene_ogl_legacy.cpp | 2 +- .../c3d_render_createscene.cpp | 2 +- common/draw_frame.cpp | 2 +- common/tool/action_manager.cpp | 2 +- include/core/iterators.h | 67 +++++-- include/geometry/shape_line_chain.h | 1 - include/wxBasePcbFrame.h | 6 +- pcbnew/basepcbframe.cpp | 2 +- pcbnew/block.cpp | 1 - pcbnew/block_module_editor.cpp | 44 ++--- ...board_items_to_polygon_shape_transform.cpp | 6 +- pcbnew/board_netlist_updater.cpp | 2 +- pcbnew/class_board.cpp | 12 +- pcbnew/class_board_connected_item.h | 1 - pcbnew/class_module.cpp | 20 +-- pcbnew/class_module.h | 170 +++++++++--------- pcbnew/class_netinfo_item.cpp | 6 +- pcbnew/class_netinfolist.cpp | 2 +- pcbnew/class_zone.h | 3 +- pcbnew/connect.cpp | 5 +- pcbnew/connect.h | 38 ---- pcbnew/connectivity.cpp | 2 +- pcbnew/connectivity_algo.cpp | 10 +- pcbnew/dialogs/dialog_gendrill.cpp | 2 +- pcbnew/dialogs/dialog_global_deletion.cpp | 2 +- .../dialog_global_modules_fields_edition.cpp | 2 +- pcbnew/dialogs/dialog_netlist.cpp | 4 +- pcbnew/dragsegm.cpp | 5 +- pcbnew/drc.cpp | 4 +- pcbnew/eagle_plugin.cpp | 20 +-- pcbnew/edgemod.cpp | 10 +- pcbnew/edit.cpp | 1 + pcbnew/editrack.cpp | 2 +- pcbnew/edtxtmod.cpp | 2 +- pcbnew/exporters/export_d356.cpp | 3 +- pcbnew/exporters/export_gencad.cpp | 6 +- pcbnew/exporters/export_idf.cpp | 2 +- pcbnew/exporters/export_vrml.cpp | 4 +- pcbnew/exporters/gen_modules_placefile.cpp | 5 +- pcbnew/files.cpp | 2 +- pcbnew/globaleditpad.cpp | 4 +- pcbnew/gpcb_plugin.cpp | 4 +- pcbnew/kicad_plugin.cpp | 4 +- pcbnew/legacy_plugin.cpp | 6 +- pcbnew/microwave/microwave_inductor.cpp | 6 +- pcbnew/muonde.cpp | 12 +- pcbnew/netlist.cpp | 3 +- pcbnew/pad_edition_functions.cpp | 2 +- pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp | 2 +- pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp | 2 +- pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp | 2 +- pcbnew/pcb_parser.cpp | 4 +- pcbnew/pcbframe.cpp | 2 +- pcbnew/plot_board_layers.cpp | 10 +- pcbnew/plot_brditems_plotter.cpp | 6 +- pcbnew/print_board_functions.cpp | 4 +- pcbnew/ratsnest.cpp | 4 +- pcbnew/ratsnest_data.h | 110 ------------ pcbnew/router/pns_kicad_iface.cpp | 4 +- pcbnew/tools/drawing_tool.cpp | 2 +- pcbnew/tools/grid_helper.cpp | 2 +- pcbnew/tools/module_editor_tools.cpp | 13 +- pcbnew/tools/pad_tool.cpp | 2 +- pcbnew/tools/pcb_editor_control.cpp | 2 +- pcbnew/tools/pcbnew_control.cpp | 2 +- pcbnew/tools/selection_tool.cpp | 3 +- pcbnew/tracepcb.cpp | 4 +- pcbnew/undo_redo.cpp | 4 +- ...nvert_brd_items_to_polygons_with_Boost.cpp | 6 +- ...ones_convert_to_polygons_aux_functions.cpp | 2 +- 72 files changed, 305 insertions(+), 428 deletions(-) delete mode 100644 pcbnew/connect.h diff --git a/3d-viewer/3d_canvas/create_layer_items.cpp b/3d-viewer/3d_canvas/create_layer_items.cpp index 230851c16d..cdfefb278d 100644 --- a/3d-viewer/3d_canvas/create_layer_items.cpp +++ b/3d-viewer/3d_canvas/create_layer_items.cpp @@ -184,7 +184,7 @@ void CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer( const MODULE* aMod std::vector 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, diff --git a/3d-viewer/3d_canvas/create_layer_poly.cpp b/3d-viewer/3d_canvas/create_layer_poly.cpp index 8cfbba4c5c..bd3cc8754c 100644 --- a/3d-viewer/3d_canvas/create_layer_poly.cpp +++ b/3d-viewer/3d_canvas/create_layer_poly.cpp @@ -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() ) { diff --git a/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp b/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp index c3fe81263a..689b8c0356 100644 --- a/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp +++ b/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp @@ -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 ) { diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp index 84769600fc..88a3990ece 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp @@ -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 ); diff --git a/common/draw_frame.cpp b/common/draw_frame.cpp index b14d385cca..42d99c7586 100644 --- a/common/draw_frame.cpp +++ b/common/draw_frame.cpp @@ -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; } } + diff --git a/common/tool/action_manager.cpp b/common/tool/action_manager.cpp index 40642d603a..e1cbb0b2aa 100644 --- a/common/tool/action_manager.cpp +++ b/common/tool/action_manager.cpp @@ -220,7 +220,7 @@ void ACTION_MANAGER::UpdateHotKeys() ++global_actions_cnt; } - // assert( global_actions_cnt <= 1 ); + assert( global_actions_cnt <= 1 ); } #endif /* not NDEBUG */ } diff --git a/include/core/iterators.h b/include/core/iterators.h index 6ef497ca44..298bd3361a 100644 --- a/include/core/iterators.h +++ b/include/core/iterators.h @@ -27,40 +27,69 @@ #include #include -template -class DLIST_ITERATOR: public std::iterator +template +class DLIST_ITERATOR : public std::iterator { private: T m_obj; - using reference = typename DLIST_ITERATOR::reference ; + using reference = typename DLIST_ITERATOR::reference; + public: - explicit DLIST_ITERATOR( T obj ) : m_obj(obj) {} + explicit DLIST_ITERATOR( T obj ) : + m_obj(obj) {} - DLIST_ITERATOR& operator++() { m_obj = m_obj->Next(); return *this; } - DLIST_ITERATOR& operator--() { m_obj = m_obj->Prev(); return *this; } + DLIST_ITERATOR& operator++() + { + m_obj = m_obj->Next(); return *this; + } - bool operator==(DLIST_ITERATOR other) const {return m_obj == other.m_obj;} - bool operator!=(DLIST_ITERATOR other) const {return !(*this == other);} + DLIST_ITERATOR& operator--() + { + m_obj = m_obj->Prev(); return *this; + } - reference operator*() {return m_obj;} + bool operator==( DLIST_ITERATOR other ) const + { + return m_obj == other.m_obj; + } + + bool operator!=( DLIST_ITERATOR other ) const + { + return !(*this == other); + } + + reference operator*() + { + return m_obj; + } }; // helper object, used to convert a DLIST to an iterator -template class DLIST_ITERATOR_WRAPPER +template +class DLIST_ITERATOR_WRAPPER { - public: - explicit DLIST_ITERATOR_WRAPPER ( DLIST& list ) : m_list(list) {}; +public: + explicit DLIST_ITERATOR_WRAPPER ( DLIST& list ) : + m_list(list) {} - DLIST_ITERATOR begin() { return DLIST_ITERATOR ( m_list.GetFirst()); } - DLIST_ITERATOR end() { return DLIST_ITERATOR ( nullptr ); } + DLIST_ITERATOR begin() + { + return DLIST_ITERATOR ( m_list.GetFirst() ); + } - unsigned int Size() const { - return m_list.GetCount(); - } + DLIST_ITERATOR end() + { + return DLIST_ITERATOR ( nullptr ); + } - private: - DLIST& m_list; + unsigned int Size() const + { + return m_list.GetCount(); + } + +private: + DLIST& m_list; }; #endif diff --git a/include/geometry/shape_line_chain.h b/include/geometry/shape_line_chain.h index 89e54d9b6e..3b875c45a1 100644 --- a/include/geometry/shape_line_chain.h +++ b/include/geometry/shape_line_chain.h @@ -601,7 +601,6 @@ public: } const VECTOR2I PointAlong( int aPathLength ) const; - const SHAPE_LINE_CHAIN RemoveHoles( ) const; private: /// array of vertices diff --git a/include/wxBasePcbFrame.h b/include/wxBasePcbFrame.h index b3de745d21..f7fa6c1799 100644 --- a/include/wxBasePcbFrame.h +++ b/include/wxBasePcbFrame.h @@ -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: */ diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index 10c6dce667..2e7de03b72 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -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 ); } } diff --git a/pcbnew/block.cpp b/pcbnew/block.cpp index a0ff5ab0a6..4b808099dd 100644 --- a/pcbnew/block.cpp +++ b/pcbnew/block.cpp @@ -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() ) diff --git a/pcbnew/block_module_editor.cpp b/pcbnew/block_module_editor.cpp index 32405e8705..4ee4f80a51 100644 --- a/pcbnew/block_module_editor.cpp +++ b/pcbnew/block_module_editor.cpp @@ -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() ) { diff --git a/pcbnew/board_items_to_polygon_shape_transform.cpp b/pcbnew/board_items_to_polygon_shape_transform.cpp index 47a91d006f..97814f8dbc 100644 --- a/pcbnew/board_items_to_polygon_shape_transform.cpp +++ b/pcbnew/board_items_to_polygon_shape_transform.cpp @@ -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 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 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() ) { diff --git a/pcbnew/board_netlist_updater.cpp b/pcbnew/board_netlist_updater.cpp index e327c9309a..665544e256 100644 --- a/pcbnew/board_netlist_updater.cpp +++ b/pcbnew/board_netlist_updater.cpp @@ -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() ); diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index cece55cfbd..6b5ecf6d5b 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -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; iPadsIter() ) + for ( auto pad : mod->Pads() ) { if( pad->GetPosition() != aPosition ) continue; @@ -1743,7 +1743,7 @@ void BOARD::GetSortedPadListByXthenYCoord( std::vector& 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 BOARD::GetPads() std::vector 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; diff --git a/pcbnew/class_board_connected_item.h b/pcbnew/class_board_connected_item.h index c3edfee71a..8b487c5afa 100644 --- a/pcbnew/class_board_connected_item.h +++ b/pcbnew/class_board_connected_item.h @@ -37,7 +37,6 @@ class NETCLASS; class TRACK; class D_PAD; -class CN_BOARD_ITEM_DATA; /** * Class BOARD_CONNECTED_ITEM diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index b79ae81acd..035fbe31a4 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -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 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( 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(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 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 ) ); diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index 7005fc2214..79431d458e 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -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& Pads() { return m_Pads; } - const DLIST& Pads() const { return m_Pads; } + DLIST& PadsList() { return m_Pads; } + const DLIST& PadsList() const { return m_Pads; } - DLIST& GraphicalItems() { return m_Drawings; } - const DLIST& GraphicalItems() const { return m_Drawings; } + DLIST& GraphicalItemsList() { return m_Drawings; } + const DLIST& GraphicalItemsList() const { return m_Drawings; } - DLIST_ITERATOR_WRAPPER PadsIter() { return DLIST_ITERATOR_WRAPPER(m_Pads); } - DLIST_ITERATOR_WRAPPER GraphicalItemsIter() { return DLIST_ITERATOR_WRAPPER(m_Drawings); } + DLIST_ITERATOR_WRAPPER Pads() + { + return DLIST_ITERATOR_WRAPPER( m_Pads ); + } + + DLIST_ITERATOR_WRAPPER GraphicalItems() + { + return DLIST_ITERATOR_WRAPPER( m_Drawings ); + } std::list& Models() { return m_3D_Drawings; } const std::list& 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& 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 m_Pads; ///< Linked list of pads. + DLIST m_Pads; ///< Linked list of pads. DLIST m_Drawings; ///< Linked list of graphical items. std::list 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 diff --git a/pcbnew/class_netinfo_item.cpp b/pcbnew/class_netinfo_item.cpp index 42b1ff8c86..3e4547f253 100644 --- a/pcbnew/class_netinfo_item.cpp +++ b/pcbnew/class_netinfo_item.cpp @@ -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 ) ); -} \ No newline at end of file +} diff --git a/pcbnew/class_netinfolist.cpp b/pcbnew/class_netinfolist.cpp index 04a9647240..c03f7dbc88 100644 --- a/pcbnew/class_netinfolist.cpp +++ b/pcbnew/class_netinfolist.cpp @@ -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() ); } diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h index ad9ed1d847..b388db293b 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/class_zone.h @@ -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 diff --git a/pcbnew/connect.cpp b/pcbnew/connect.cpp index 7000dca240..8aea71b3ff 100644 --- a/pcbnew/connect.cpp +++ b/pcbnew/connect.cpp @@ -35,10 +35,7 @@ #include #include - -// Helper classes to handle connection points -#include - +#include /* * Function SortTracksByNetCode used in RebuildTrackChain() * to sort track segments by net code. diff --git a/pcbnew/connect.h b/pcbnew/connect.h deleted file mode 100644 index 48f36f7338..0000000000 --- a/pcbnew/connect.h +++ /dev/null @@ -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 - * 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 -#include - - - -#endif // ifndef CONNECT_H diff --git a/pcbnew/connectivity.cpp b/pcbnew/connectivity.cpp index 7b1bf7911f..4c75386f30 100644 --- a/pcbnew/connectivity.cpp +++ b/pcbnew/connectivity.cpp @@ -189,7 +189,7 @@ void CONNECTIVITY_DATA::BlockRatsnestItems( const std::vector& aIte { if( item->Type() == PCB_MODULE_T ) { - for( auto pad : static_cast(item)->PadsIter() ) + for( auto pad : static_cast(item)->Pads() ) citems.push_back( pad ); } else diff --git a/pcbnew/connectivity_algo.cpp b/pcbnew/connectivity_algo.cpp index 5959059d2a..42a4908f08 100644 --- a/pcbnew/connectivity_algo.cpp +++ b/pcbnew/connectivity_algo.cpp @@ -140,7 +140,7 @@ bool CN_CONNECTIVITY_ALGO::Remove( BOARD_ITEM* aItem ) switch( aItem->Type() ) { case PCB_MODULE_T: - for ( auto pad : static_cast (aItem ) -> PadsIter() ) + for ( auto pad : static_cast (aItem ) -> Pads() ) { m_itemMap[ static_cast( pad ) ].MarkItemsAsInvalid(); m_itemMap.erase ( static_cast( pad ) ); @@ -195,7 +195,7 @@ void CN_CONNECTIVITY_ALGO::markItemNetAsDirty( const BOARD_ITEM *aItem ) if ( aItem->Type() == PCB_MODULE_T ) { auto mod = static_cast ( 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 (aItem ) -> PadsIter() ) + for ( auto pad : static_cast (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 &aItems ) case PCB_MODULE_T: { - for( auto pad : static_cast(item)->PadsIter() ) + for( auto pad : static_cast(item)->Pads() ) { Add( pad ); } diff --git a/pcbnew/dialogs/dialog_gendrill.cpp b/pcbnew/dialogs/dialog_gendrill.cpp index e5abf7a504..e15585301a 100644 --- a/pcbnew/dialogs/dialog_gendrill.cpp +++ b/pcbnew/dialogs/dialog_gendrill.cpp @@ -177,7 +177,7 @@ void DIALOG_GENDRILL::InitDisplayParams() for( MODULE* module = m_parent->GetBoard()->m_Modules; module; module = module->Next() ) { - for( D_PAD* pad = module->Pads(); pad != NULL; pad = pad->Next() ) + for( D_PAD* pad = module->PadsList(); pad != NULL; pad = pad->Next() ) { if( pad->GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE ) { diff --git a/pcbnew/dialogs/dialog_global_deletion.cpp b/pcbnew/dialogs/dialog_global_deletion.cpp index 80a66a6b30..649b7b82e9 100644 --- a/pcbnew/dialogs/dialog_global_deletion.cpp +++ b/pcbnew/dialogs/dialog_global_deletion.cpp @@ -160,7 +160,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete() masque_layer &= layers_filter; - for( item = pcb->DrawingsList(); item; item = item->Next() ) + for( auto item : pcb->Drawings() ) { KICAD_T type = item->Type(); LAYER_NUM layer = item->GetLayer(); diff --git a/pcbnew/dialogs/dialog_global_modules_fields_edition.cpp b/pcbnew/dialogs/dialog_global_modules_fields_edition.cpp index 72fbbefade..087555941b 100644 --- a/pcbnew/dialogs/dialog_global_modules_fields_edition.cpp +++ b/pcbnew/dialogs/dialog_global_modules_fields_edition.cpp @@ -185,7 +185,7 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( const wxString & aFilter, bool aRef, if( aOthers ) { // Go through all other module text fields - for( BOARD_ITEM* boardItem = module->GraphicalItems(); boardItem; boardItem = boardItem->Next() ) + for( BOARD_ITEM* boardItem = module->GraphicalItemsList(); boardItem; boardItem = boardItem->Next() ) { if( boardItem->Type() == PCB_MODULE_TEXT_T ) { diff --git a/pcbnew/dialogs/dialog_netlist.cpp b/pcbnew/dialogs/dialog_netlist.cpp index 4ab271245c..75aa82c608 100644 --- a/pcbnew/dialogs/dialog_netlist.cpp +++ b/pcbnew/dialogs/dialog_netlist.cpp @@ -331,9 +331,7 @@ void DIALOG_NETLIST::OnCompileRatsnestClick( wxCommandEvent& event ) { // Rebuild the board connectivity: auto board = m_parent->GetBoard(); - //board->GetConnectivity()->Build( board ); - board->GetConnectivity()->PropagateNets(); - m_parent->Compile_Ratsnest( m_dc, true ); + board->GetConnectivity()->RecalculateRatsnest(); } diff --git a/pcbnew/dragsegm.cpp b/pcbnew/dragsegm.cpp index 2b5b480689..37a6be91ae 100644 --- a/pcbnew/dragsegm.cpp +++ b/pcbnew/dragsegm.cpp @@ -60,6 +60,7 @@ DRAG_SEGM_PICKER::DRAG_SEGM_PICKER( TRACK* aTrack ) m_Flipped = false; } + void DRAG_SEGM_PICKER::SetAuxParameters() { MODULE* module = NULL; @@ -155,7 +156,7 @@ void DRAG_LIST::BuildDragListe( MODULE* aModule ) std::vector padList; - for ( auto pad : aModule->PadsIter() ) + for ( auto pad : aModule->Pads() ) padList.push_back( pad ); sort( padList.begin(), padList.end(), sortPadsByXthenYCoord ); @@ -185,8 +186,6 @@ bool sort_tracklist( const DRAG_SEGM_PICKER& ref, const DRAG_SEGM_PICKER& tst ) void DRAG_LIST::fillList( std::vector& aList ) { - -printf("FillList!\n"); // clear flags and variables of selected tracks for( auto pad : aList ) { diff --git a/pcbnew/drc.cpp b/pcbnew/drc.cpp index 434c143e66..6213be96ac 100644 --- a/pcbnew/drc.cpp +++ b/pcbnew/drc.cpp @@ -568,7 +568,7 @@ void DRC::testUnconnected() DRC_ITEM* uncItem = new DRC_ITEM( DRCE_UNCONNECTED_ITEMS, t_src, t_dst, - wxPoint( src.x, src.y ), wxPoint(dst.x, dst.y) ); + wxPoint( src.x, src.y ), wxPoint( dst.x, dst.y ) ); m_unconnected.push_back( uncItem ); } @@ -661,6 +661,7 @@ void DRC::testKeepoutAreas() } } + void DRC::testTexts() { std::vector textShape; // a buffer to store the text shape (set of segments) @@ -1085,3 +1086,4 @@ bool DRC::doFootprintOverlappingDrc() return success; } + diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index 5d3dfeb515..999d41d9d2 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -655,7 +655,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics ) // Add a PAD_ATTRIB_HOLE_NOT_PLATED pad to this module. D_PAD* pad = new D_PAD( module ); - module->Pads().PushBack( pad ); + module->PadsList().PushBack( pad ); pad->SetShape( PAD_SHAPE_CIRCLE ); pad->SetAttribute( PAD_ATTRIB_HOLE_NOT_PLATED ); @@ -851,7 +851,7 @@ void EAGLE_PLUGIN::loadElements( wxXmlNode* aElements ) m_board->Add( m, ADD_APPEND ); // update the nets within the pads of the clone - for( D_PAD* pad = m->Pads(); pad; pad = pad->Next() ) + for( D_PAD* pad = m->PadsList(); pad; pad = pad->Next() ) { string pn_key = makeKey( e.name, TO_UTF8( pad->GetPadName() ) ); @@ -1233,7 +1233,7 @@ void EAGLE_PLUGIN::packageWire( MODULE* aModule, wxXmlNode* aTree ) const dwg->SetLayer( layer ); dwg->SetWidth( width ); - aModule->GraphicalItems().PushBack( dwg ); + aModule->GraphicalItemsList().PushBack( dwg ); } } @@ -1244,7 +1244,7 @@ void EAGLE_PLUGIN::packagePad( MODULE* aModule, wxXmlNode* aTree ) const EPAD e( aTree ); D_PAD* pad = new D_PAD( aModule ); - aModule->Pads().PushBack( pad ); + aModule->PadsList().PushBack( pad ); pad->SetPadName( FROM_UTF8( e.name.c_str() ) ); @@ -1346,7 +1346,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->GraphicalItems().PushBack( txt ); + aModule->GraphicalItemsList().PushBack( txt ); } txt->SetTimeStamp( timeStamp( aTree ) ); @@ -1440,7 +1440,7 @@ void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, wxXmlNode* aTree ) const if( IsNonCopperLayer( layer ) ) // skip copper "package.rectangle"s { EDGE_MODULE* dwg = new EDGE_MODULE( aModule, S_POLYGON ); - aModule->GraphicalItems().PushBack( dwg ); + aModule->GraphicalItemsList().PushBack( dwg ); dwg->SetLayer( layer ); dwg->SetWidth( 0 ); @@ -1473,7 +1473,7 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, wxXmlNode* aTree ) const if( IsNonCopperLayer( layer ) ) // skip copper "package.rectangle"s { EDGE_MODULE* dwg = new EDGE_MODULE( aModule, S_POLYGON ); - aModule->GraphicalItems().PushBack( dwg ); + aModule->GraphicalItemsList().PushBack( dwg ); dwg->SetWidth( 0 ); // it's filled, no need for boundary width @@ -1526,7 +1526,7 @@ void EAGLE_PLUGIN::packageCircle( MODULE* aModule, wxXmlNode* aTree ) const PCB_LAYER_ID layer = kicad_layer( e.layer ); EDGE_MODULE* gr = new EDGE_MODULE( aModule, S_CIRCLE ); - aModule->GraphicalItems().PushBack( gr ); + aModule->GraphicalItemsList().PushBack( gr ); gr->SetWidth( kicad( e.width ) ); @@ -1555,7 +1555,7 @@ void EAGLE_PLUGIN::packageHole( MODULE* aModule, wxXmlNode* aTree ) const // we add a PAD_ATTRIB_HOLE_NOT_PLATED pad to this module. D_PAD* pad = new D_PAD( aModule ); - aModule->Pads().PushBack( pad ); + aModule->PadsList().PushBack( pad ); pad->SetShape( PAD_SHAPE_CIRCLE ); pad->SetAttribute( PAD_ATTRIB_HOLE_NOT_PLATED ); @@ -1590,7 +1590,7 @@ void EAGLE_PLUGIN::packageSMD( MODULE* aModule, wxXmlNode* aTree ) const } D_PAD* pad = new D_PAD( aModule ); - aModule->Pads().PushBack( pad ); + aModule->PadsList().PushBack( pad ); pad->SetPadName( FROM_UTF8( e.name.c_str() ) ); pad->SetShape( PAD_SHAPE_RECT ); diff --git a/pcbnew/edgemod.cpp b/pcbnew/edgemod.cpp index dd0c494f0e..b061d750fe 100644 --- a/pcbnew/edgemod.cpp +++ b/pcbnew/edgemod.cpp @@ -167,9 +167,9 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Width( EDGE_MODULE* aEdge ) if( aEdge == NULL ) { - aEdge = (EDGE_MODULE*) (BOARD_ITEM*) module->GraphicalItems(); + aEdge = (EDGE_MODULE*) (BOARD_ITEM*) module->GraphicalItemsList(); - for( BOARD_ITEM *item = module->GraphicalItems(); item; item = item->Next() ) + for( BOARD_ITEM *item = module->GraphicalItemsList(); item; item = item->Next() ) { aEdge = dyn_cast( item ); @@ -217,7 +217,7 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* aEdge ) if( !aEdge ) { - for( BOARD_ITEM *item = module->GraphicalItems() ; item != NULL; + for( BOARD_ITEM *item = module->GraphicalItemsList() ; item != NULL; item = item->Next() ) { aEdge = dyn_cast( item ); @@ -336,7 +336,7 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* aEdge, MoveVector.x = MoveVector.y = 0; // Add the new item to the Drawings list head - module->GraphicalItems().PushFront( aEdge ); + module->GraphicalItemsList().PushFront( aEdge ); // Update characteristics of the segment or arc. aEdge->SetFlags( IS_NEW ); @@ -380,7 +380,7 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* aEdge, EDGE_MODULE* newedge = new EDGE_MODULE( *aEdge ); // insert _after_ aEdge, which is the same as inserting before aEdge->Next() - module->GraphicalItems().Insert( newedge, aEdge->Next() ); + module->GraphicalItemsList().Insert( newedge, aEdge->Next() ); aEdge->ClearFlags(); aEdge = newedge; // point now new item diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index b4c3f68fac..e7e01a6d2f 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -663,6 +663,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) } SetCurItem( NULL ); // CurItem might be deleted by this command, clear the pointer + // fixme OnModify(); SetMsgPanel( GetBoard() ); m_canvas->Refresh(); diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp index f00725d6ae..7edfeb6636 100644 --- a/pcbnew/editrack.cpp +++ b/pcbnew/editrack.cpp @@ -160,7 +160,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) DBG( g_CurrentTrackList.VerifyListIntegrity() ); int net = -1; - if (lockPoint) + if( lockPoint ) net = lockPoint->GetNetCode(); BuildAirWiresTargetsList( lockPoint, wxPoint( 0, 0 ), net ); diff --git a/pcbnew/edtxtmod.cpp b/pcbnew/edtxtmod.cpp index 3437c26538..0409277039 100644 --- a/pcbnew/edtxtmod.cpp +++ b/pcbnew/edtxtmod.cpp @@ -90,7 +90,7 @@ TEXTE_MODULE* FOOTPRINT_EDIT_FRAME::CreateTextModule( MODULE* aModule, wxDC* aDC // Add the new text object to the beginning of the footprint draw list. if( aModule ) - aModule->GraphicalItems().PushFront( text ); + aModule->GraphicalItemsList().PushFront( text ); text->ClearFlags(); diff --git a/pcbnew/exporters/export_d356.cpp b/pcbnew/exporters/export_d356.cpp index 13c80231ce..d899061cf0 100644 --- a/pcbnew/exporters/export_d356.cpp +++ b/pcbnew/exporters/export_d356.cpp @@ -119,7 +119,7 @@ static void build_pad_testpoints( BOARD *aPcb, for( MODULE *module = aPcb->m_Modules; module; module = module->Next() ) { - for( D_PAD *pad = module->Pads(); pad; pad = pad->Next() ) + for( D_PAD *pad = module->PadsList(); pad; pad = pad->Next() ) { D356_RECORD rk; rk.access = compute_pad_access_code( aPcb, pad->GetLayerSet() ); @@ -394,4 +394,3 @@ void PCB_EDIT_FRAME::GenD356File( wxCommandEvent& aEvent ) fclose( file ); } - diff --git a/pcbnew/exporters/export_gencad.cpp b/pcbnew/exporters/export_gencad.cpp index ad344c310e..5cb567e50b 100644 --- a/pcbnew/exporters/export_gencad.cpp +++ b/pcbnew/exporters/export_gencad.cpp @@ -642,7 +642,7 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb ) { FootprintWriteShape( aFile, module ); - for( pad = module->Pads(); pad; pad = pad->Next() ) + for( pad = module->PadsList(); pad; pad = pad->Next() ) { /* Funny thing: GenCAD requires the pad side even if you use * padstacks (which are theorically optional but gerbtools @@ -794,7 +794,7 @@ static void CreateSignalsSection( FILE* aFile, BOARD* aPcb ) for( module = aPcb->m_Modules; module; module = module->Next() ) { - for( pad = module->Pads(); pad; pad = pad->Next() ) + for( pad = module->PadsList(); pad; pad = pad->Next() ) { wxString padname; @@ -1174,7 +1174,7 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module ) // 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->GraphicalItems(); PtStruct; PtStruct = PtStruct->Next() ) + for( PtStruct = module->GraphicalItemsList(); PtStruct; PtStruct = PtStruct->Next() ) { switch( PtStruct->Type() ) { diff --git a/pcbnew/exporters/export_idf.cpp b/pcbnew/exporters/export_idf.cpp index 5c3b6c8144..4a8ee898cf 100644 --- a/pcbnew/exporters/export_idf.cpp +++ b/pcbnew/exporters/export_idf.cpp @@ -287,7 +287,7 @@ static void idf_export_module( BOARD* aPcb, MODULE* aModule, aIDFBoard.GetUserOffset( dx, dy ); - for( D_PAD* pad = aModule->Pads(); pad; pad = pad->Next() ) + for( D_PAD* pad = aModule->PadsList(); pad; pad = pad->Next() ) { drill = (double) pad->GetDrillSize().x * scale; x = pad->GetPosition().x * scale + dx; diff --git a/pcbnew/exporters/export_vrml.cpp b/pcbnew/exporters/export_vrml.cpp index 11a2fc932e..3c0613d463 100644 --- a/pcbnew/exporters/export_vrml.cpp +++ b/pcbnew/exporters/export_vrml.cpp @@ -1278,7 +1278,7 @@ static void export_vrml_module( MODEL_VRML& aModel, BOARD* aPcb, export_vrml_text_module( &aModule->Value() ); // Export module edges - for( EDA_ITEM* item = aModule->GraphicalItems(); item; item = item->Next() ) + for( EDA_ITEM* item = aModule->GraphicalItemsList(); item; item = item->Next() ) { switch( item->Type() ) { @@ -1298,7 +1298,7 @@ static void export_vrml_module( MODEL_VRML& aModel, BOARD* aPcb, } // Export pads - for( D_PAD* pad = aModule->Pads(); pad; pad = pad->Next() ) + for( D_PAD* pad = aModule->PadsList(); pad; pad = pad->Next() ) export_vrml_pad( aModel, aPcb, pad ); bool isFlipped = aModule->GetLayer() == B_Cu; diff --git a/pcbnew/exporters/gen_modules_placefile.cpp b/pcbnew/exporters/gen_modules_placefile.cpp index b146989475..2f6a61831f 100644 --- a/pcbnew/exporters/gen_modules_placefile.cpp +++ b/pcbnew/exporters/gen_modules_placefile.cpp @@ -390,7 +390,7 @@ static bool HasNonSMDPins( MODULE* aModule ) { D_PAD* pad; - for( pad = aModule->Pads(); pad; pad = pad->Next() ) + for( pad = aModule->PadsList(); pad; pad = pad->Next() ) { if( pad->GetAttribute() != PAD_ATTRIB_SMD ) return true; @@ -717,7 +717,7 @@ bool PCB_EDIT_FRAME::DoGenFootprintsReport( const wxString& aFullFilename, bool else fputs( "layer other\n", rptfile ); - for( D_PAD* pad = Module->Pads(); pad != NULL; pad = pad->Next() ) + for( D_PAD* pad = Module->PadsList(); pad != NULL; pad = pad->Next() ) { fprintf( rptfile, "$PAD \"%s\"\n", TO_UTF8( pad->GetPadName() ) ); int layer = 0; @@ -754,4 +754,3 @@ bool PCB_EDIT_FRAME::DoGenFootprintsReport( const wxString& aFullFilename, bool return true; } - diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index af5eb5cdb8..229e3adfa6 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -584,7 +584,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in { wxBusyCursor dummy; // Displays an Hourglass while building connectivity Compile_Ratsnest( NULL, true ); - //GetBoard()->GetRatsnest()->ProcessBoard(); + GetBoard()->GetConnectivity()->Build( GetBoard() ); } // Update info shown by the horizontal toolbars diff --git a/pcbnew/globaleditpad.cpp b/pcbnew/globaleditpad.cpp index f7c609ba45..5d109fde1a 100644 --- a/pcbnew/globaleditpad.cpp +++ b/pcbnew/globaleditpad.cpp @@ -180,7 +180,7 @@ void PCB_BASE_FRAME::GlobalChange_PadSettings( D_PAD* aPad, bool saveMe = false; - for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() ) + for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() ) { // Filters changes prohibited. if( aPadShapeFilter && ( pad->GetShape() != aPad->GetShape() ) ) @@ -225,7 +225,7 @@ void PCB_BASE_FRAME::GlobalChange_PadSettings( D_PAD* aPad, module->ClearFlags( DO_NOT_DRAW ); } - for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() ) + for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() ) { // Filters changes prohibited. if( aPadShapeFilter && ( pad->GetShape() != aPad->GetShape() ) ) diff --git a/pcbnew/gpcb_plugin.cpp b/pcbnew/gpcb_plugin.cpp index a4a7f5a196..b40ab4877c 100644 --- a/pcbnew/gpcb_plugin.cpp +++ b/pcbnew/gpcb_plugin.cpp @@ -581,7 +581,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader ) parseInt( parameters[5], conv_unit ) ) ); drawSeg->SetWidth( parseInt( parameters[6], conv_unit ) ); drawSeg->SetDrawCoord(); - module->GraphicalItems().PushBack( drawSeg ); + module->GraphicalItemsList().PushBack( drawSeg ); continue; } @@ -599,7 +599,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->GraphicalItems().PushBack( drawSeg ); + module->GraphicalItemsList().PushBack( drawSeg ); // for and arc: ibuf[3] = ibuf[4]. Pcbnew does not know ellipses int radius = ( parseInt( parameters[4], conv_unit ) + diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index a8c5888a78..67763ff156 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -1099,11 +1099,11 @@ void PCB_IO::format( MODULE* aModule, int aNestLevel ) const Format( (BOARD_ITEM*) &aModule->Value(), aNestLevel+1 ); // Save drawing elements. - for( BOARD_ITEM* gr = aModule->GraphicalItems(); gr; gr = gr->Next() ) + for( BOARD_ITEM* gr = aModule->GraphicalItemsList(); gr; gr = gr->Next() ) Format( gr, aNestLevel+1 ); // Save pads. - for( D_PAD* pad = aModule->Pads(); pad; pad = pad->Next() ) + for( D_PAD* pad = aModule->PadsList(); pad; pad = pad->Next() ) format( pad, aNestLevel+1 ); // Save 3D info. diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index 73f9b26f41..f4c4f9cec1 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -1198,7 +1198,7 @@ void LEGACY_PLUGIN::loadMODULE( MODULE* aModule ) // All other fields greater than 1. default: textm = new TEXTE_MODULE( aModule ); - aModule->GraphicalItems().PushBack( textm ); + aModule->GraphicalItemsList().PushBack( textm ); } loadMODULE_TEXT( textm ); @@ -1609,7 +1609,7 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule ) pad->SetPosition( padpos + aModule->GetPosition() ); - aModule->Pads().PushBack( pad.release() ); + aModule->PadsList().PushBack( pad.release() ); return; // preferred exit } } @@ -1757,7 +1757,7 @@ void LEGACY_PLUGIN::loadMODULE_EDGE( MODULE* aModule ) EDGE_MODULE* em = dwg.release(); - aModule->GraphicalItems().PushBack( em ); + aModule->GraphicalItemsList().PushBack( 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. diff --git a/pcbnew/microwave/microwave_inductor.cpp b/pcbnew/microwave/microwave_inductor.cpp index b0394a2ec2..edef5ca598 100644 --- a/pcbnew/microwave/microwave_inductor.cpp +++ b/pcbnew/microwave/microwave_inductor.cpp @@ -362,13 +362,13 @@ MODULE* MWAVE::CreateMicrowaveInductor( INDUCTOR_PATTERN& inductorPattern, PtSegm->SetShape( S_SEGMENT ); PtSegm->SetStart0( PtSegm->GetStart() - module->GetPosition() ); PtSegm->SetEnd0( PtSegm->GetEnd() - module->GetPosition() ); - module->GraphicalItems().PushBack( PtSegm ); + module->GraphicalItemsList().PushBack( PtSegm ); } // Place a pad on each end of coil. pad = new D_PAD( module ); - module->Pads().PushFront( pad ); + module->PadsList().PushFront( pad ); pad->SetPadName( "1" ); pad->SetPosition( inductorPattern.m_End ); @@ -382,7 +382,7 @@ MODULE* MWAVE::CreateMicrowaveInductor( INDUCTOR_PATTERN& inductorPattern, D_PAD* newpad = new D_PAD( *pad ); - module->Pads().Insert( newpad, pad->Next() ); + module->PadsList().Insert( newpad, pad->Next() ); pad = newpad; pad->SetPadName( "2" ); diff --git a/pcbnew/muonde.cpp b/pcbnew/muonde.cpp index d49014d93b..c183555fc2 100644 --- a/pcbnew/muonde.cpp +++ b/pcbnew/muonde.cpp @@ -204,7 +204,7 @@ MODULE* PCB_EDIT_FRAME::CreateMuWaveBaseFootprint( const wxString& aValue, { D_PAD* pad = new D_PAD( module ); - module->Pads().PushFront( pad ); + module->PadsList().PushFront( pad ); int tw = GetDesignSettings().GetCurrentTrackWidth(); pad->SetSize( wxSize( tw, tw ) ); @@ -312,7 +312,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type ) } module = CreateMuWaveBaseFootprint( cmp_name, text_size, pad_count ); - pad = module->Pads(); + pad = module->PadsList(); switch( shape_type ) { @@ -339,7 +339,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type ) case 2: // Arc Stub created by a polygonal approach: { EDGE_MODULE* edge = new EDGE_MODULE( module ); - module->GraphicalItems().PushFront( edge ); + module->GraphicalItemsList().PushFront( edge ); edge->SetShape( S_POLYGON ); edge->SetLayer( F_Cu ); @@ -623,7 +623,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape() wxPoint offset; offset.x = -ShapeSize.x / 2; - pad1 = module->Pads(); + pad1 = module->PadsList(); pad1->SetX0( offset.x ); pad1->SetX( pad1->GetPos0().x ); @@ -636,7 +636,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape() edge->SetShape( S_POLYGON ); edge->SetLayer( F_Cu ); - module->GraphicalItems().PushFront( edge ); + module->GraphicalItemsList().PushFront( edge ); // Get the corner buffer of the polygonal edge std::vector& polyPoints = edge->GetPolyPoints(); @@ -698,7 +698,7 @@ void PCB_EDIT_FRAME::Edit_Gap( wxDC* DC, MODULE* aModule ) if( msg != wxT( "GAP" ) ) return; - pad = aModule->Pads(); + pad = aModule->PadsList(); if( pad == NULL ) { diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index 1d013425f3..f914d496f8 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -169,8 +169,7 @@ void PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFileName, } // Rebuild the board connectivity: - Compile_Ratsnest( NULL, true ); - //board->GetRatsnest()->ProcessBoard(); + board->GetConnectivity()->Build( board ); SetMsgPanel( board ); m_canvas->Refresh(); diff --git a/pcbnew/pad_edition_functions.cpp b/pcbnew/pad_edition_functions.cpp index 65cbb5699c..47038369b7 100644 --- a/pcbnew/pad_edition_functions.cpp +++ b/pcbnew/pad_edition_functions.cpp @@ -115,7 +115,7 @@ void PCB_BASE_FRAME::AddPad( MODULE* aModule, bool draw ) D_PAD* pad = new D_PAD( aModule ); // Add the new pad to end of the module pad list. - aModule->Pads().PushBack( pad ); + aModule->PadsList().PushBack( pad ); // Update the pad properties, // and keep NETINFO_LIST::ORPHANED as net info diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp index d4395ad924..97ca994fab 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp @@ -161,7 +161,7 @@ void PCB_ARC::AddToModule( MODULE* aModule ) if( IsNonCopperLayer( m_KiCadLayer ) ) { EDGE_MODULE* arc = new EDGE_MODULE( aModule, S_ARC ); - aModule->GraphicalItems().PushBack( arc ); + aModule->GraphicalItemsList().PushBack( arc ); arc->SetAngle( -m_angle ); arc->m_Start0 = wxPoint( m_positionX, m_positionY ); diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp index 019029d01c..bc24d297cd 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp @@ -120,7 +120,7 @@ void PCB_LINE::AddToModule( MODULE* aModule ) if( IsNonCopperLayer( m_KiCadLayer ) ) { EDGE_MODULE* segment = new EDGE_MODULE( aModule, S_SEGMENT ); - aModule->GraphicalItems().PushBack( segment ); + aModule->GraphicalItemsList().PushBack( segment ); segment->m_Start0 = wxPoint( m_positionX, m_positionY ); segment->m_End0 = wxPoint( m_toX, m_toY ); diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp index 716a7cf9bb..72476251b2 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp @@ -294,7 +294,7 @@ void PCB_PAD::AddToModule( MODULE* aModule, int aRotation, bool aEncapsulatedPad pad->SetPosition( padpos + aModule->GetPosition() ); } - aModule->Pads().PushBack( pad ); + aModule->PadsList().PushBack( pad ); } diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index e0dff88231..1437badad1 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -1932,7 +1932,7 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments ) break; default: - module->GraphicalItems().PushBack( text ); + module->GraphicalItemsList().PushBack( text ); } } break; @@ -1946,7 +1946,7 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments ) EDGE_MODULE* em = parseEDGE_MODULE(); em->SetParent( module.get() ); em->SetDrawCoord(); - module->GraphicalItems().PushBack( em ); + module->GraphicalItemsList().PushBack( em ); } break; diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index bcdf552c6e..24c176dcca 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -506,7 +506,7 @@ void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard ) if( IsGalCanvasActive() ) { - aBoard->GetConnectivity()->Build ( aBoard ); + aBoard->GetConnectivity()->Build( aBoard ); // reload the worksheet SetPageSettings( aBoard->GetPageSettings() ); diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index c1cb28560a..e2598dc6e0 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -91,7 +91,7 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask, { aPlotter->StartBlock( NULL ); - for( D_PAD * pad = Module->Pads(); pad; pad = pad->Next() ) + for( D_PAD * pad = Module->PadsList(); pad; pad = pad->Next() ) { // See if the pad is on this layer LSET masklayer = pad->GetLayerSet(); @@ -314,7 +314,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, for( MODULE* module = aBoard->m_Modules; module; module = module->Next() ) { - for( BOARD_ITEM* item = module->GraphicalItems(); item; item = item->Next() ) + for( BOARD_ITEM* item = module->GraphicalItemsList(); item; item = item->Next() ) { if( !aLayerMask[ item->GetLayer() ] ) continue; @@ -336,7 +336,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, { aPlotter->StartBlock( NULL ); - for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() ) + for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() ) { if( (pad->GetLayerSet() & aLayerMask) == 0 ) continue; @@ -676,7 +676,7 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, { for( MODULE* module = aBoard->m_Modules; module; module = module->Next() ) { - for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() ) + for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() ) { wxSize hole = pad->GetDrillSize(); @@ -746,7 +746,7 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, for( MODULE* module = aBoard->m_Modules; module; module = module->Next() ) { - for( BOARD_ITEM* item = module->GraphicalItems(); item; item = item->Next() ) + for( BOARD_ITEM* item = module->GraphicalItemsList(); item; item = item->Next() ) { if( layer != item->GetLayer() ) continue; diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index 8a7b0c5bcd..8d8e1d687f 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -238,7 +238,7 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule ) PlotTextModule( &aModule->Value(), GetValueColor() ); } - for( BOARD_ITEM *item = aModule->GraphicalItems().GetFirst(); item; item = item->Next() ) + for( BOARD_ITEM *item = aModule->GraphicalItemsList().GetFirst(); item; item = item->Next() ) { textModule = dyn_cast( item ); @@ -441,7 +441,7 @@ void BRDITEMS_PLOTTER::Plot_Edges_Modules() { for( MODULE* module = m_board->m_Modules; module; module = module->Next() ) { - for( BOARD_ITEM* item = module->GraphicalItems().GetFirst(); item; item = item->Next() ) + for( BOARD_ITEM* item = module->GraphicalItemsList().GetFirst(); item; item = item->Next() ) { EDGE_MODULE* edge = dyn_cast( item ); @@ -822,7 +822,7 @@ void BRDITEMS_PLOTTER::PlotDrillMarks() for( MODULE *Module = m_board->m_Modules; Module != NULL; Module = Module->Next() ) { - for( D_PAD *pad = Module->Pads(); pad != NULL; pad = pad->Next() ) + for( D_PAD *pad = Module->PadsList(); pad != NULL; pad = pad->Next() ) { if( pad->GetDrillSize().x == 0 ) continue; diff --git a/pcbnew/print_board_functions.cpp b/pcbnew/print_board_functions.cpp index c7031c6de7..8fb90d7a1c 100644 --- a/pcbnew/print_board_functions.cpp +++ b/pcbnew/print_board_functions.cpp @@ -318,7 +318,7 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule, PRINT_PARAMETERS::DrillShapeOptT aDrillShapeOpt ) { // Print pads - for( D_PAD* pad = aModule->Pads(); pad; pad = pad->Next() ) + for( D_PAD* pad = aModule->PadsList(); pad; pad = pad->Next() ) { if( !( pad->GetLayerSet() & aMask ).any() ) continue; @@ -356,7 +356,7 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule, if( aModule->Value().IsVisible() && aMask[aModule->Value().GetLayer()] ) aModule->Value().Draw( aPanel, aDC, aDraw_mode ); - for( EDA_ITEM* item = aModule->GraphicalItems(); item; item = item->Next() ) + for( EDA_ITEM* item = aModule->GraphicalItemsList(); item; item = item->Next() ) { switch( item->Type() ) { diff --git a/pcbnew/ratsnest.cpp b/pcbnew/ratsnest.cpp index 3089a62dd2..aca7eee00e 100644 --- a/pcbnew/ratsnest.cpp +++ b/pcbnew/ratsnest.cpp @@ -225,7 +225,7 @@ void MODULE::DrawOutlinesWhenMoving( EDA_DRAW_PANEL* panel, wxDC* DC, pad_fill_tmp = displ_opts->m_DisplayPadFill; displ_opts->m_DisplayPadFill = true; - pt_pad = Pads(); + pt_pad = PadsList(); for( ; pt_pad != NULL; pt_pad = pt_pad->Next() ) pt_pad->Draw( panel, DC, GR_XOR, aMoveVector ); @@ -247,7 +247,7 @@ void PCB_EDIT_FRAME::Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC ) { auto mod = static_cast (item); - for( auto pad : mod->PadsIter() ) + for( auto pad : mod->Pads() ) { pad->SetLocalRatsnestVisible( true ); } diff --git a/pcbnew/ratsnest_data.h b/pcbnew/ratsnest_data.h index 896313f6f7..bcebd52836 100644 --- a/pcbnew/ratsnest_data.h +++ b/pcbnew/ratsnest_data.h @@ -51,116 +51,6 @@ class CN_CONNECTIVITY_ALGO; struct RN_NODE_OR_FILTER; struct RN_NODE_AND_FILTER; -#if 0 -///> General interface for filtering out nodes in search functions. -struct RN_NODE_FILTER : public std::unary_function -{ - virtual ~RN_NODE_FILTER() {} - - virtual bool operator()( const RN_NODE_PTR& aNode ) const - { - return true; // By default everything passes - } - - friend RN_NODE_AND_FILTER operator&&( const RN_NODE_FILTER& aFilter1, const RN_NODE_FILTER& aFilter2 ); - friend RN_NODE_OR_FILTER operator||( const RN_NODE_FILTER& aFilter1, const RN_NODE_FILTER& aFilter2 ); -}; - -RN_NODE_AND_FILTER operator&&( const RN_NODE_FILTER& aFilter1, const RN_NODE_FILTER& aFilter2 ); -RN_NODE_OR_FILTER operator||( const RN_NODE_FILTER& aFilter1, const RN_NODE_FILTER& aFilter2 ); - -///> Leaves nodes that can be a ratsnest line target -struct LINE_TARGET : public RN_NODE_FILTER -{ - bool operator()( const RN_NODE_PTR& aNode ) const override - { - return true; - } -}; - -///> Leaves nodes that can be a ratsnest line target and have a specific tag -struct LINE_TARGET_SAME_TAG : public RN_NODE_FILTER -{ - LINE_TARGET_SAME_TAG( int aTag ) : - m_tag( aTag ) - {} - - bool operator()( const RN_NODE_PTR& aNode ) const override - { - return aNode->GetTag() == m_tag; - } - -private: - int m_tag; -}; - -struct LINE_TARGET_DIFF_TAG : public RN_NODE_FILTER -{ - LINE_TARGET_DIFF_TAG( int aTag ) : - m_tag( aTag ) - {} - - bool operator()( const RN_NODE_PTR& aNode ) const override - { - return aNode->GetTag() != m_tag; - } - -private: - int m_tag; -}; - -struct RN_NODE_AND_FILTER : public RN_NODE_FILTER -{ - RN_NODE_AND_FILTER( const RN_NODE_FILTER& aFilter1, const RN_NODE_FILTER& aFilter2 ) : - m_filter1( aFilter1 ), m_filter2( aFilter2 ) - {} - - bool operator()( const RN_NODE_PTR& aNode ) const override - { - return m_filter1( aNode ) && m_filter2( aNode ); - } - - private: - const RN_NODE_FILTER& m_filter1; - const RN_NODE_FILTER& m_filter2; -}; - -struct RN_NODE_OR_FILTER : public RN_NODE_FILTER -{ - RN_NODE_OR_FILTER( const RN_NODE_FILTER& aFilter1, const RN_NODE_FILTER& aFilter2 ) : - m_filter1( aFilter1 ), m_filter2( aFilter2 ) - {} - - bool operator()( const RN_NODE_PTR& aNode ) const override - { - return m_filter1( aNode ) || m_filter2( aNode ); - } - - private: - const RN_NODE_FILTER& m_filter1; - const RN_NODE_FILTER& m_filter2; -}; - -///> Functor comparing if two nodes are equal by their coordinates. It is required to make set of -///> shared pointers work properly. -struct RN_NODE_COMPARE : std::binary_function -{ - bool operator()( const CN_ANCHOR_PTR& aNode1, const CN_ANCHOR_PTR& aNode2 ) const - { - if ( aNode1->GetY() < aNode2->GetY() ) - return true; - else if ( aNode1->GetY() == aNode2->GetY() ) - { - if ( aNode1->GetX() == aNode2->GetX() ) - return aNode1->GetCluster() < aNode2->GetCluster(); - else - return aNode1->GetX() < aNode2->GetX(); - } - return false; - } -}; - -#endif /** * Class RN_NET diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index 52cc4be308..2960f41e20 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -133,7 +133,7 @@ PNS_PCBNEW_RULE_RESOLVER::PNS_PCBNEW_RULE_RESOLVER( BOARD* aBoard, PNS::ROUTER* { auto moduleClearance = mod->GetLocalClearance(); - for( D_PAD* pad = mod->Pads(); pad; pad = pad->Next() ) + for( D_PAD* pad = mod->PadsList(); pad; pad = pad->Next() ) { int padClearance = pad->GetLocalClearance(); @@ -765,7 +765,7 @@ void PNS_KICAD_IFACE::SyncWorld( PNS::NODE *aWorld ) for( MODULE* module = m_board->m_Modules; module; module = module->Next() ) { - for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() ) + for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() ) { std::unique_ptr< PNS::SOLID > solid = syncPad( pad ); diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index a92dd608a7..3d7b4a3251 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -1411,7 +1411,7 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent ) return -1; for ( auto mod : m_board->Modules() ) - for ( auto pad : mod->PadsIter() ) + for ( auto pad : mod->Pads() ) if( pad->HitTest(pos) && (pad->GetLayerSet() & lset ).any() ) return -1; diff --git a/pcbnew/tools/grid_helper.cpp b/pcbnew/tools/grid_helper.cpp index 360898fd35..8bc41fa962 100644 --- a/pcbnew/tools/grid_helper.cpp +++ b/pcbnew/tools/grid_helper.cpp @@ -256,7 +256,7 @@ void GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos ) MODULE* mod = static_cast( aItem ); addAnchor( mod->GetPosition(), ORIGIN | SNAPPABLE, mod ); - for( D_PAD* pad = mod->Pads(); pad; pad = pad->Next() ) + for( auto pad : mod->Pads() ) addAnchor( pad->GetPosition(), CORNER | SNAPPABLE, pad ); break; diff --git a/pcbnew/tools/module_editor_tools.cpp b/pcbnew/tools/module_editor_tools.cpp index 7100454475..c5a9f15541 100644 --- a/pcbnew/tools/module_editor_tools.cpp +++ b/pcbnew/tools/module_editor_tools.cpp @@ -125,7 +125,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->Pads() ) + if( !board()->m_Modules || !board()->m_Modules->PadsList() ) return 0; Activate(); @@ -254,7 +254,7 @@ int MODULE_EDITOR_TOOLS::EnumeratePads( const TOOL_EVENT& aEvent ) } } - for( D_PAD* p = board()->m_Modules->Pads(); p; p = p->Next() ) + for( auto p : board()->m_Modules->Pads() ) { p->ClearSelected(); view->Update( p ); @@ -411,14 +411,13 @@ int MODULE_EDITOR_TOOLS::PasteItems( const TOOL_EVENT& aEvent ) // MODULE::RunOnChildren is infeasible here: we need to create copies of items, do not // directly modify them - for( D_PAD* pad = pastedModule->Pads(); pad; pad = pad->Next() ) + for( auto pad : pastedModule->Pads() ) { D_PAD* clone = static_cast( pad->Clone() ); commit.Add( clone ); } - for( BOARD_ITEM* drawing = pastedModule->GraphicalItems(); - drawing; drawing = drawing->Next() ) + for( auto drawing : pastedModule->GraphicalItems() ) { BOARD_ITEM* clone = static_cast( drawing->Clone() ); @@ -469,7 +468,7 @@ int MODULE_EDITOR_TOOLS::ModuleTextOutlines( const TOOL_EVENT& aEvent ) for( auto module : board()->Modules() ) { - for( auto item : module->GraphicalItemsIter() ) + for( auto item : module->GraphicalItems() ) { if( item->Type() == PCB_MODULE_TEXT_T ) view->Update( item, KIGFX::GEOMETRY ); @@ -502,7 +501,7 @@ int MODULE_EDITOR_TOOLS::ModuleEdgeOutlines( const TOOL_EVENT& aEvent ) for( auto module : board()->Modules() ) { - for( auto item : module->GraphicalItemsIter() ) + for( auto item : module->GraphicalItems() ) { if( item->Type() == PCB_MODULE_EDGE_T ) view->Update( item, KIGFX::GEOMETRY ); diff --git a/pcbnew/tools/pad_tool.cpp b/pcbnew/tools/pad_tool.cpp index 80220ea450..efb88a9476 100644 --- a/pcbnew/tools/pad_tool.cpp +++ b/pcbnew/tools/pad_tool.cpp @@ -285,7 +285,7 @@ static void globalChangePadSettings( BOARD& board, if( module->GetFPID() != moduleRef->GetFPID() ) continue; - for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() ) + for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() ) { // Filters changes prohibited. if( aPadShapeFilter && ( pad->GetShape() != aSrcPad.GetShape() ) ) diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index 2f0aebb8b0..7998577254 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -1078,7 +1078,7 @@ static bool showLocalRatsnest( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition { if ( item->Type() == PCB_MODULE_T ) { - for ( auto pad : static_cast (item)->PadsIter() ) + for ( auto pad : static_cast (item)->Pads() ) { pad->SetLocalRatsnestVisible( true ); } diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index eef9d8c7ed..76a859fadd 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -286,7 +286,7 @@ int PCBNEW_CONTROL::PadDisplayMode( const TOOL_EVENT& aEvent ) for( MODULE* module = getModel()->m_Modules; module; module = module->Next() ) { - for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() ) + for( auto pad : module->Pads() ) getView()->Update( pad, KIGFX::GEOMETRY ); } diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 071dd492a1..16083a5524 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -897,7 +897,7 @@ void SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetpath ) std::list netcodeList; for( MODULE* mmod : modList ) { - for( D_PAD* pad = mmod->Pads().GetFirst(); pad; pad = pad->Next() ) + for( auto pad : mmod->Pads() ) { if( pad->IsConnected() ) { @@ -918,6 +918,7 @@ void SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetpath ) for( int netCode : netcodeList ) { std::list netPads; +// fixme // ratsnest->GetNetItems( netCode, netPads, (RN_ITEM_TYPE)( RN_PADS ) ); for( BOARD_CONNECTED_ITEM* mitem : netPads ) { diff --git a/pcbnew/tracepcb.cpp b/pcbnew/tracepcb.cpp index dc110797ad..0838e160ab 100644 --- a/pcbnew/tracepcb.cpp +++ b/pcbnew/tracepcb.cpp @@ -267,7 +267,7 @@ void BOARD::DrawHighLight( EDA_DRAW_PANEL* am_canvas, wxDC* DC, int aNetCode ) // Redraw any pads that have aNetCode for( MODULE* module = m_Modules; module; module = module->Next() ) { - for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() ) + for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() ) { if( pad->GetNetCode() == aNetCode ) { @@ -302,7 +302,7 @@ static void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* aModule, displ_opts->m_DisplayPadFill = false; // Draw pads. - for( D_PAD* pad = aModule->Pads(); pad; pad = pad->Next() ) + for( D_PAD* pad = aModule->PadsList(); pad; pad = pad->Next() ) { if( (pad->GetLayerSet() & aLayerMask) == 0 ) continue; diff --git a/pcbnew/undo_redo.cpp b/pcbnew/undo_redo.cpp index aca49c392a..0e90ef5bb0 100644 --- a/pcbnew/undo_redo.cpp +++ b/pcbnew/undo_redo.cpp @@ -224,11 +224,11 @@ 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* loc_item = clone->GraphicalItems(); loc_item; + for( EDA_ITEM* loc_item = clone->GraphicalItemsList(); loc_item; loc_item = loc_item->Next() ) loc_item->ClearFlags(); - for( D_PAD* pad = clone->Pads(); pad; pad = pad->Next() ) + for( D_PAD* pad = clone->PadsList(); pad; pad = pad->Next() ) pad->ClearFlags(); clone->Reference().ClearFlags(); diff --git a/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp b/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp index 66a12e72e7..2d2df3c21d 100644 --- a/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp +++ b/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp @@ -154,7 +154,7 @@ void ZONE_CONTAINER::buildFeatureHoleList( BOARD* aPcb, SHAPE_POLY_SET& aFeature { D_PAD* nextpad; - for( D_PAD* pad = module->Pads(); pad != NULL; pad = nextpad ) + for( D_PAD* pad = module->PadsList(); pad != NULL; pad = nextpad ) { nextpad = pad->Next(); // pad pointer can be modified by next code, so // calculate the next pad here @@ -249,7 +249,7 @@ void ZONE_CONTAINER::buildFeatureHoleList( BOARD* aPcb, SHAPE_POLY_SET& aFeature */ for( MODULE* module = aPcb->m_Modules; module; module = module->Next() ) { - for( BOARD_ITEM* item = module->GraphicalItems(); item; item = item->Next() ) + for( BOARD_ITEM* item = module->GraphicalItemsList(); item; item = item->Next() ) { if( !item->IsOnLayer( GetLayer() ) && !item->IsOnLayer( Edge_Cuts ) ) continue; @@ -342,7 +342,7 @@ void ZONE_CONTAINER::buildFeatureHoleList( BOARD* aPcb, SHAPE_POLY_SET& aFeature // Remove thermal symbols for( MODULE* module = aPcb->m_Modules; module; module = module->Next() ) { - for( D_PAD* pad = module->Pads(); pad != NULL; pad = pad->Next() ) + for( D_PAD* pad = module->PadsList(); pad != NULL; pad = pad->Next() ) { // Rejects non-standard pads with tht-only thermal reliefs if( GetPadConnection( pad ) == PAD_ZONE_CONN_THT_THERMAL diff --git a/pcbnew/zones_convert_to_polygons_aux_functions.cpp b/pcbnew/zones_convert_to_polygons_aux_functions.cpp index 50d0a0c6df..bddd1e766e 100644 --- a/pcbnew/zones_convert_to_polygons_aux_functions.cpp +++ b/pcbnew/zones_convert_to_polygons_aux_functions.cpp @@ -108,7 +108,7 @@ void BuildUnconnectedThermalStubsPolygonList( SHAPE_POLY_SET& aCornerBuffer, for( MODULE* module = aPcb->m_Modules; module; module = module->Next() ) { - for( D_PAD* pad = module->Pads(); pad != NULL; pad = pad->Next() ) + for( D_PAD* pad = module->PadsList(); pad != NULL; pad = pad->Next() ) { // Rejects non-standard pads with tht-only thermal reliefs if( aZone->GetPadConnection( pad ) == PAD_ZONE_CONN_THT_THERMAL