From 1f30d0c803f5b86b3e492ebfaaf0f2216ce01a6e Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Sun, 2 Jun 2019 19:50:26 -0700 Subject: [PATCH] pcbnew: remove the last dlist components from pcbnew --- common/swig/dlist.i | 77 --------------------------------- common/swig/kicad.i | 2 - include/class_board_item.h | 2 - pcbnew/swig/board_item.i | 5 +-- pcbnew/swig/footprint.i | 1 - pcbnew/swig/pad.i | 1 - pcbnew/swig/track.i | 1 - pcbnew/tools/pcbnew_control.cpp | 15 ------- pcbnew/undo_redo.cpp | 6 --- 9 files changed, 1 insertion(+), 109 deletions(-) delete mode 100644 common/swig/dlist.i diff --git a/common/swig/dlist.i b/common/swig/dlist.i deleted file mode 100644 index fc39ce956d..0000000000 --- a/common/swig/dlist.i +++ /dev/null @@ -1,77 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2012 NBEE Embedded Systems, Miguel Angel Ajo - * Copyright (C) 1992-2012 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 - */ - -/* DLIST python iteration code, to allow standard iteration over DLIST */ - -%include - -%{ -#include -%} - - -%extend DLIST -{ - %pythoncode - %{ - class DLISTIter: - def __init__(self,aList): - self.last = aList # last item is the start of list - - def next(self): # get the next item, Python 2 way to implement an iterator - return self.__next__() - - def __next__(self): # get the next item - - item = self.last - try: - item = item.Get() - except: - pass - - if item is None: # if the item is None, then finish the iteration - raise StopIteration - else: - ret = None - - # first item in list has "Get" as a DLIST - try: - ret = self.last.Get() - except: - ret = self.last # next items do not.. - - self.last = self.last.Next() - - # when the iterated object can be casted down in inheritance, just do it.. - - if 'Cast' in dir(ret): - ret = ret.Cast() - - return ret - - def __iter__(self): - return self.DLISTIter(self) - - %} -} diff --git a/common/swig/kicad.i b/common/swig/kicad.i index 30e9439613..a17cb0c8ad 100644 --- a/common/swig/kicad.i +++ b/common/swig/kicad.i @@ -76,8 +76,6 @@ principle should be easily implemented by adapting the current STL containers. %ignore operator <<; %ignore operator=; -%include dlist.i - // headers/imports that must be included in the _wrapper.cpp at top %{ diff --git a/include/class_board_item.h b/include/class_board_item.h index 53faa61e4c..6290d006ca 100644 --- a/include/class_board_item.h +++ b/include/class_board_item.h @@ -114,8 +114,6 @@ public: */ static wxPoint ZeroOffset; - BOARD_ITEM* Next() const { return static_cast( Pnext ); } - BOARD_ITEM* Back() const { return static_cast( Pback ); } BOARD_ITEM_CONTAINER* GetParent() const { return (BOARD_ITEM_CONTAINER*) m_Parent; } /** diff --git a/pcbnew/swig/board_item.i b/pcbnew/swig/board_item.i index 8439222452..e27d4ba30a 100644 --- a/pcbnew/swig/board_item.i +++ b/pcbnew/swig/board_item.i @@ -32,10 +32,7 @@ %include class_board_item.h // generate code for this interface -// this is to help python with the * accessor of DLIST templates %rename(Get) operator BOARD_ITEM*; -%template(BOARD_ITEM_List) DLIST; - %{ #include @@ -138,7 +135,7 @@ static PCB_TARGET* Cast_to_PCB_TARGET( BOARD_ITEM* ); elif ct=="ZONE_CONTAINER": return Cast_to_ZONE_CONTAINER(self) else: - return None + return none def Duplicate(self): ct = self.GetClass() diff --git a/pcbnew/swig/footprint.i b/pcbnew/swig/footprint.i index cb703b7a2c..2c3108b17e 100644 --- a/pcbnew/swig/footprint.i +++ b/pcbnew/swig/footprint.i @@ -35,7 +35,6 @@ %feature("flatnested", ""); %rename(Get) operator MODULE*; -%template(MODULE_List) DLIST; %{ #include %} diff --git a/pcbnew/swig/pad.i b/pcbnew/swig/pad.i index 516b007740..f0b3e8dc07 100644 --- a/pcbnew/swig/pad.i +++ b/pcbnew/swig/pad.i @@ -3,7 +3,6 @@ %include class_pad.h %rename(Get) operator D_PAD*; -%template(PAD_List) DLIST; %{ #include %} diff --git a/pcbnew/swig/track.i b/pcbnew/swig/track.i index b49bd8c032..0899586ba5 100644 --- a/pcbnew/swig/track.i +++ b/pcbnew/swig/track.i @@ -2,7 +2,6 @@ %include class_track.h %rename(Get) operator TRACK*; -%template(TRACK_List) DLIST; %{ #include %} diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index 5784949d3c..c07c817cda 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -764,21 +764,6 @@ int PCBNEW_CONTROL::AppendBoardFromFile( const TOOL_EVENT& aEvent ) } -// Helper function for PCBNEW_CONTROL::placeBoardItems() -template -static void moveNoFlagToVector( DLIST& aList, std::vector& aTarget, bool aIsNew ) -{ - for( auto obj = aIsNew ? aList.PopFront() : aList.GetFirst(); obj; - obj = aIsNew ? aList.PopFront() : obj->Next() ) - { - if( obj->GetFlags() & FLAG0 ) - obj->ClearFlags( FLAG0 ); - else - aTarget.push_back( obj ); - } -} - - // Helper function for PCBNEW_CONTROL::placeBoardItems() template static void moveNoFlagToVector( std::deque& aList, std::vector& aTarget, bool aIsNew ) diff --git a/pcbnew/undo_redo.cpp b/pcbnew/undo_redo.cpp index b6268044ab..88aa8b8491 100644 --- a/pcbnew/undo_redo.cpp +++ b/pcbnew/undo_redo.cpp @@ -169,18 +169,12 @@ static void SwapItemData( BOARD_ITEM* aItem, BOARD_ITEM* aImage ) // mainly pointers in chain and time stamp, which is set to new, unique value. // So we have to use the current values of these parameters. - EDA_ITEM* pnext = aItem->Next(); - EDA_ITEM* pback = aItem->Back(); - DHEAD* mylist = aItem->GetList(); timestamp_t timestamp = aItem->GetTimeStamp(); EDA_ITEM* parent = aItem->GetParent(); aItem->SwapData( aImage ); // Restore pointers and time stamp, to be sure they are not broken - aItem->SetNext( pnext ); - aItem->SetBack( pback ); - aItem->SetList( mylist ); aItem->SetTimeStamp( timestamp ); aItem->SetParent( parent ); }