From 1718ac108320ab406764ef9a52d42c1c53f099e1 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Tue, 20 Sep 2016 20:07:41 -0500 Subject: [PATCH] More SWIG improvements. SWIG support for BOARD_ITEM_CONTAINER. Split board.i into smaller included *.i files. Add depencies on these smaller *.i files to CMakeLists.txt --- common/swig/kiway_player.i | 1 - pcbnew/CMakeLists.txt | 34 +++++- pcbnew/swig/board.i | 169 +++++++---------------------- pcbnew/swig/board_item.i | 150 +++++++++++++++++++------ pcbnew/swig/board_item_container.i | 47 ++++++++ pcbnew/swig/dimension.i | 6 + pcbnew/swig/drawsegment.i | 14 +++ pcbnew/swig/edge_mod.i | 5 + pcbnew/swig/marker_pcb.i | 6 + pcbnew/swig/mire.i | 6 + pcbnew/swig/module.i | 26 +++-- pcbnew/swig/netclass.i | 5 + pcbnew/swig/netinfo.i | 5 + pcbnew/swig/pad.i | 10 ++ pcbnew/swig/pcb_text.i | 7 ++ pcbnew/swig/pcbnew.i | 35 ------ pcbnew/swig/text_mod.i | 6 + pcbnew/swig/track.i | 9 ++ pcbnew/swig/zone.i | 9 ++ 19 files changed, 344 insertions(+), 206 deletions(-) create mode 100644 pcbnew/swig/board_item_container.i create mode 100644 pcbnew/swig/dimension.i create mode 100644 pcbnew/swig/drawsegment.i create mode 100644 pcbnew/swig/edge_mod.i create mode 100644 pcbnew/swig/marker_pcb.i create mode 100644 pcbnew/swig/mire.i create mode 100644 pcbnew/swig/netclass.i create mode 100644 pcbnew/swig/netinfo.i create mode 100644 pcbnew/swig/pad.i create mode 100644 pcbnew/swig/pcb_text.i create mode 100644 pcbnew/swig/text_mod.i create mode 100644 pcbnew/swig/track.i create mode 100644 pcbnew/swig/zone.i diff --git a/common/swig/kiway_player.i b/common/swig/kiway_player.i index ac646a9e44..a25871b416 100644 --- a/common/swig/kiway_player.i +++ b/common/swig/kiway_player.i @@ -3,7 +3,6 @@ %include kiway_player.h - %{ #include %} diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 337732a048..c85369a40b 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -371,9 +371,23 @@ if( KICAD_SCRIPTING ) DEPENDS swig/pcbnew.i DEPENDS swig/board.i DEPENDS swig/board_item.i + DEPENDS swig/board_item_container.i + DEPENDS swig/dimension.i + DEPENDS swig/drawsegment.i + DEPENDS swig/edge_mod.i + DEPENDS swig/marker_pcb.i + DEPENDS swig/mire.i DEPENDS swig/module.i + DEPENDS swig/netclass.i + DEPENDS swig/netinfo.i + DEPENDS swig/pad.i + DEPENDS swig/pcb_text.i DEPENDS swig/plugins.i + DEPENDS swig/text_mod.i + DEPENDS swig/track.i DEPENDS swig/units.i + DEPENDS swig/zone.i + DEPENDS ../common/swig/dlist.i DEPENDS ../common/swig/kicad.i DEPENDS ../common/swig/wx.i @@ -412,10 +426,28 @@ if( KICAD_SCRIPTING_MODULES ) set( SWIG_MODULE_pcbnew_EXTRA_DEPS swig/board.i swig/board_item.i + swig/board_item_container.i + swig/dimension.i + swig/drawsegment.i + swig/edge_mod.i + swig/marker_pcb.i + swig/mire.i + swig/module.i + swig/netclass.i + swig/netinfo.i + swig/pad.i + swig/pcb_text.i swig/plugins.i + swig/text_mod.i + swig/track.i swig/units.i - ../common/swig/ki_exception.i + swig/zone.i + + ../common/swig/dlist.i ../common/swig/kicad.i + ../common/swig/wx.i + ../common/swig/ki_exception.i + ../scripting/kicadplugins.i ) swig_add_module( pcbnew diff --git a/pcbnew/swig/board.i b/pcbnew/swig/board.i index 0d16e46163..1d40891dcb 100644 --- a/pcbnew/swig/board.i +++ b/pcbnew/swig/board.i @@ -2,6 +2,7 @@ * 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) 2016 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or @@ -33,132 +34,82 @@ By default we do not translate exceptions for EVERY C++ function since not every C++ function throws, and that would be unused and very bulky mapping code. Therefore please help gather the subset of C++ functions for this class that do -throw and add them here, before the class declarations. +throw and add them here, each before its respective class declaration. */ HANDLE_EXCEPTIONS(BOARD::TracksInNetBetweenPoints) -%include -%{ -#include -%} - - - %{ #include -#include +#include %} %import dlist.h + // Organize the two forms of include side by side so that it is easier to // migrate each grouping into a separate *.i file later. -%include class_board_item.h -%{ -#include -%} +%include board_item.i + +%include board_item_container.i %include class_board_connected_item.h -%{ -#include -%} -%include pad_shapes.h -%include class_pad.h -%{ -#include -%} - -%include class_module.h -%{ -#include -%} - -%include class_track.h -%{ -#include -%} - -%include class_zone.h -%include zones.h -%{ -#include -#include -%} +%include pad.i +%include track.i +%include zone.i %include layers_id_colors_and_visibility.h +// Extend LSET by 2 methods to add or remove layers from the layer list +// Mainly used to add or remove layers of a pad layer list +%extend LSET +{ + LSET addLayer( LAYER_ID aLayer) { return self->set(aLayer); } + LSET removeLayer( LAYER_ID aLayer) { return self->reset(aLayer); } + LSET addLayerSet( LSET aLayerSet) { return *self |= aLayerSet; } + LSET removeLayerSet( LSET aLayerSet) { return *self &= ~aLayerSet; } -%include class_pcb_text.h -%{ -#include -%} + %pythoncode + %{ + def AddLayer(self, layer): + return self.addLayer( layer ) -%include class_dimension.h + def AddLayerSet(self, layers): + return self.addLayerSet( layers ) + + def RemoveLayer(self, layer): + return self.removeLayer( layer ) + + def RemoveLayerSet(self, layers): + return self.removeLayerSet( layers ) + %} +} %{ -#include +#include %} -%include class_drawsegment.h -%{ -#include -%} +%include pcb_text.i +%include dimension.i +%include drawsegment.i +%include marker_pcb.i +%include mire.i +%include text_mod.i +%include edge_mod.i -%include class_marker_pcb.h -%{ -#include -%} - - -%include class_mire.h -%{ -#include -%} - - -%include class_text_mod.h -%{ -#include -%} - -%include class_edge_mod.h -%{ -#include -%} %include class_zone_settings.h -%{ -#include -%} -%include class_netinfo.h -%include class_netclass.h -%{ -#include -#include -%} +%include netinfo.i +%include netclass.i -// this is to help python with the * accessor of DLIST templates -%rename(Get) operator BOARD_ITEM*; -%rename(Get) operator TRACK*; -%rename(Get) operator D_PAD*; -%rename(Get) operator MODULE*; - -// we must translate C++ templates to scripting languages - -%template(BOARD_ITEM_List) DLIST; -%template(MODULE_List) DLIST; -%template(TRACK_List) DLIST; -%template(PAD_List) DLIST; - // std::vector templates %template(VIA_DIMENSION_Vector) std::vector; @@ -166,8 +117,6 @@ HANDLE_EXCEPTIONS(BOARD::TracksInNetBetweenPoints) %include class_board.h - - %extend BOARD { %pythoncode @@ -181,14 +130,6 @@ HANDLE_EXCEPTIONS(BOARD::TracksInNetBetweenPoints) def Save(self,filename): return SaveBoard(filename,self,IO_MGR.KICAD) - # - # add function, clears the thisown to avoid python from deleting - # the object in the garbage collector - # - def Add(self,item): - item.thisown=0 - self.AddNative(item) - def GetNetClasses(self): return self.GetDesignSettings().m_NetClasses @@ -234,32 +175,6 @@ HANDLE_EXCEPTIONS(BOARD::TracksInNetBetweenPoints) } -%extend DRAWSEGMENT -{ - %pythoncode - %{ - def GetShapeStr(self): - return self.ShowShape(self.GetShape()) - %} -} - -%extend BOARD_ITEM -{ - %pythoncode - %{ - def SetPos(self,p): - self.SetPosition(p) - self.SetPos0(p) - - def SetStartEnd(self,start,end): - self.SetStart(start) - self.SetStart0(start) - self.SetEnd(end) - self.SetEnd0(end) - %} -} - - %feature("notabstract") NETINFO_ITEM; // http://swig.10945.n7.nabble.com/std-containers-and-pointers-td3728.html diff --git a/pcbnew/swig/board_item.i b/pcbnew/swig/board_item.i index 93f3026491..7f0d7a0feb 100644 --- a/pcbnew/swig/board_item.i +++ b/pcbnew/swig/board_item.i @@ -24,75 +24,157 @@ /** * @file board_item.i - * @brief board_item helpers, mainly for casting down to all child classes + * @brief board_item helpers, mainly for casting down to all derived classes */ -/* Cast downs from EDA_ITEM/BOARD_ITEM to childs */ + + +%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 +%} + %inline { + /// Cast down from EDA_ITEM/BOARD_ITEM to child BOARD_ITEM* Cast_to_BOARD_ITEM(EDA_ITEM* base) { return dynamic_cast(base); } } + +%{ +class TEXTE_PCB; +class DIMENSION; +class MODULE; +class TEXTE_MODULE; +class DRAWSEGMENT; +class MARKER_PCB; +class BOARD; +class EDGE_MODULE; +class D_PAD; +class TRACK; +class VIA; +class ZONE_CONTAINER; +class PCB_TARGET; + +#ifdef __cplusplus +extern "C" { +#endif + +static TEXTE_PCB* Cast_to_TEXTE_PCB( BOARD_ITEM* ); +static DIMENSION* Cast_to_DIMENSION( BOARD_ITEM* ); +static MODULE* Cast_to_MODULE( BOARD_ITEM* ); +static TEXTE_MODULE* Cast_to_TEXTE_MODULE( BOARD_ITEM* ); +static DRAWSEGMENT* Cast_to_DRAWSEGMENT( BOARD_ITEM* ); +static MARKER_PCB* Cast_to_MARKER_PCB( BOARD_ITEM* ); +static BOARD* Cast_to_BOARD( BOARD_ITEM* ); +static EDGE_MODULE* Cast_to_EDGE_MODULE( BOARD_ITEM* ); +static D_PAD* Cast_to_D_PAD( BOARD_ITEM* ); +static TRACK* Cast_to_TRACK( BOARD_ITEM* ); +static VIA* Cast_to_VIA( BOARD_ITEM* ); +static ZONE_CONTAINER* Cast_to_ZONE_CONTAINER( BOARD_ITEM* ); +static PCB_TARGET* Cast_to_PCB_TARGET( BOARD_ITEM* ); + +#ifdef __cplusplus +} // extern "C" +#endif +%} + + +static TEXTE_PCB* Cast_to_TEXTE_PCB( BOARD_ITEM* ); +static DIMENSION* Cast_to_DIMENSION( BOARD_ITEM* ); +static MODULE* Cast_to_MODULE( BOARD_ITEM* ); +static TEXTE_MODULE* Cast_to_TEXTE_MODULE( BOARD_ITEM* ); +static DRAWSEGMENT* Cast_to_DRAWSEGMENT( BOARD_ITEM* ); +static MARKER_PCB* Cast_to_MARKER_PCB( BOARD_ITEM* ); +static BOARD* Cast_to_BOARD( BOARD_ITEM* ); +static EDGE_MODULE* Cast_to_EDGE_MODULE( BOARD_ITEM* ); +static D_PAD* Cast_to_D_PAD( BOARD_ITEM* ); +static TRACK* Cast_to_TRACK( BOARD_ITEM* ); +static VIA* Cast_to_VIA( BOARD_ITEM* ); +static ZONE_CONTAINER* Cast_to_ZONE_CONTAINER( BOARD_ITEM* ); +static PCB_TARGET* Cast_to_PCB_TARGET( BOARD_ITEM* ); + + %extend BOARD_ITEM { - TEXTE_PCB* Cast_to_TEXTE_PCB() { return dynamic_cast(self); } - DIMENSION* Cast_to_DIMENSION() { return dynamic_cast(self); } - MODULE* Cast_to_MODULE() { return dynamic_cast(self); } - TEXTE_MODULE* Cast_to_TEXTE_MODULE() { return dynamic_cast(self); } - DRAWSEGMENT* Cast_to_DRAWSEGMENT() { return dynamic_cast(self); } - MARKER_PCB* Cast_to_MARKER_PCB() { return dynamic_cast(self); } - BOARD* Cast_to_BOARD() { return dynamic_cast(self); } - EDGE_MODULE* Cast_to_EDGE_MODULE() { return dynamic_cast(self); } - D_PAD* Cast_to_D_PAD() { return dynamic_cast(self); } - TRACK* Cast_to_TRACK() { return dynamic_cast(self); } - VIA* Cast_to_VIA() { return dynamic_cast(self); } - ZONE_CONTAINER* Cast_to_ZONE_CONTAINER() { return dynamic_cast(self);} - PCB_TARGET* Cast_to_PCB_TARGET() { return dynamic_cast(self); } - - %pythoncode - { + %{ def Cast(self): ct = self.GetClass() if ct=="PTEXT": - return self.Cast_to_TEXTE_PCB() + return Cast_to_TEXTE_PCB(self) elif ct=="BOARD": - return self.Cast_to_BOARD() + return Cast_to_BOARD(self) elif ct=="DIMENSION": - return self.Cast_to_DIMENSION() + return Cast_to_DIMENSION(self) elif ct=="DRAWSEGMENT": - return self.Cast_to_DRAWSEGMENT() + return Cast_to_DRAWSEGMENT(self) elif ct=="MGRAPHIC": - return self.Cast_to_EDGE_MODULE() + return Cast_to_EDGE_MODULE(self) elif ct=="MODULE": - return self.Cast_to_MODULE() + return Cast_to_MODULE(self) elif ct=="PAD": - return self.Cast_to_D_PAD() + return Cast_to_D_PAD(self) elif ct=="MTEXT": - return self.Cast_to_TEXTE_MODULE() + return Cast_to_TEXTE_MODULE(self) elif ct=="VIA": - return self.Cast_to_VIA() + return Cast_to_VIA(self) elif ct=="TRACK": - return self.Cast_to_TRACK() + return Cast_to_TRACK(self) elif ct=="PCB_TARGET": - return self.Cast_to_PCB_TARGET() + return Cast_to_PCB_TARGET(self) elif ct=="ZONE_CONTAINER": - return self.Cast_to_ZONE_CONTAINER() + return Cast_to_ZONE_CONTAINER(self) else: return None - def Duplicate(self): - ct = self.GetClass() - if ct=="BOARD": return None else: return Cast_to_BOARD_ITEM(self.Clone()).Cast() - } + + def SetPos(self,p): + self.SetPosition(p) + self.SetPos0(p) + + def SetStartEnd(self,start,end): + self.SetStart(start) + self.SetStart0(start) + self.SetEnd(end) + self.SetEnd0(end) + %} } + + + +// Use %wrapper code generation section so that this block of C++ comes after all referenced +// classes and therefore will C++ compile due to the respective headers which will go into +// the %header section. See section 5.6.2 of SWIG 3.0 documentation. +%wrapper %{ +static TEXTE_PCB* Cast_to_TEXTE_PCB( BOARD_ITEM* self ) { return dynamic_cast(self); } +static DIMENSION* Cast_to_DIMENSION( BOARD_ITEM* self ) { return dynamic_cast(self); } +static MODULE* Cast_to_MODULE( BOARD_ITEM* self ) { return dynamic_cast(self); } +static TEXTE_MODULE* Cast_to_TEXTE_MODULE( BOARD_ITEM* self ) { return dynamic_cast(self); } +static DRAWSEGMENT* Cast_to_DRAWSEGMENT( BOARD_ITEM* self ) { return dynamic_cast(self); } +static MARKER_PCB* Cast_to_MARKER_PCB( BOARD_ITEM* self ) { return dynamic_cast(self); } +static BOARD* Cast_to_BOARD( BOARD_ITEM* self ) { return dynamic_cast(self); } +static EDGE_MODULE* Cast_to_EDGE_MODULE( BOARD_ITEM* self ) { return dynamic_cast(self); } +static D_PAD* Cast_to_D_PAD( BOARD_ITEM* self ) { return dynamic_cast(self); } +static TRACK* Cast_to_TRACK( BOARD_ITEM* self ) { return dynamic_cast(self); } +static VIA* Cast_to_VIA( BOARD_ITEM* self ) { return dynamic_cast(self); } +static ZONE_CONTAINER* Cast_to_ZONE_CONTAINER( BOARD_ITEM* self ) { return dynamic_cast(self); } +static PCB_TARGET* Cast_to_PCB_TARGET( BOARD_ITEM* self ) { return dynamic_cast(self); } +%} + diff --git a/pcbnew/swig/board_item_container.i b/pcbnew/swig/board_item_container.i new file mode 100644 index 0000000000..aadc06915c --- /dev/null +++ b/pcbnew/swig/board_item_container.i @@ -0,0 +1,47 @@ + +// Rename Add(), Remove() and Delete() to {Add,Remove,Delete}Native() and +// then implement Add() Remove() and Delete() in python so we can manage +// the ownership flag: thisown. +%rename(AddNative) BOARD_ITEM_CONTAINER::Add; +%rename(RemoveNative) BOARD_ITEM_CONTAINER::Remove; +%rename(DeleteNative) BOARD_ITEM_CONTAINER::Delete; + +%include board_item_container.h +%{ +#include +%} + +%extend BOARD_ITEM_CONTAINER +{ + %pythoncode + %{ + def Add(self,item): + """ + Add a BOARD_ITEM to this BOARD_ITEM_CONTAINER, clear the thisown to prevent + python from deleting the object in the garbage collector + Add(BOARD_ITEM_CONTAINER self, BOARD_ITEM aItem, ADD_MODE aMode=ADD_INSERT) + Add(BOARD_ITEM_CONTAINER self, BOARD_ITEM aItem) + """ + item.thisown=0 + self.AddNative(item) + + def Remove(self,item): + """ + Remove a BOARD_ITEM from this BOARD_ITEM_CONTAINER, set the thisdown flag so that + the python wrapper owns the C++ BOARD_ITEM + Remove(self, BOARD_ITEM) + """ + self.RemoveNative(item) + item.thisown=1 + + def Delete(self,item): + """ + Remove a BOARD_ITEM from this BOARD_ITEM_CONTAINER, set the thisdown flag so that + the python wrapper does not owns the C++ BOARD_ITEM + Delete(self, BOARD_ITEM) + """ + item.thisown=0 # C++'s BOARD_ITEM_CONTAINER::Delete() will delete + self.DeleteNative(item) + item.this = None + %} +} diff --git a/pcbnew/swig/dimension.i b/pcbnew/swig/dimension.i new file mode 100644 index 0000000000..db69726065 --- /dev/null +++ b/pcbnew/swig/dimension.i @@ -0,0 +1,6 @@ + +%include class_dimension.h +%{ +#include +%} + diff --git a/pcbnew/swig/drawsegment.i b/pcbnew/swig/drawsegment.i new file mode 100644 index 0000000000..3dd908755a --- /dev/null +++ b/pcbnew/swig/drawsegment.i @@ -0,0 +1,14 @@ + +%include class_drawsegment.h +%extend DRAWSEGMENT +{ + %pythoncode + %{ + def GetShapeStr(self): + return self.ShowShape(self.GetShape()) + %} +} +%{ +#include +%} + diff --git a/pcbnew/swig/edge_mod.i b/pcbnew/swig/edge_mod.i new file mode 100644 index 0000000000..74dbfb43b8 --- /dev/null +++ b/pcbnew/swig/edge_mod.i @@ -0,0 +1,5 @@ + +%include class_edge_mod.h +%{ +#include +%} diff --git a/pcbnew/swig/marker_pcb.i b/pcbnew/swig/marker_pcb.i new file mode 100644 index 0000000000..5f96d32057 --- /dev/null +++ b/pcbnew/swig/marker_pcb.i @@ -0,0 +1,6 @@ + +%include class_marker_pcb.h +%{ +#include +%} + diff --git a/pcbnew/swig/mire.i b/pcbnew/swig/mire.i new file mode 100644 index 0000000000..361cfccfa2 --- /dev/null +++ b/pcbnew/swig/mire.i @@ -0,0 +1,6 @@ + +%include class_mire.h +%{ +#include +%} + diff --git a/pcbnew/swig/module.i b/pcbnew/swig/module.i index 21902bfe0e..2c54c0f7c8 100644 --- a/pcbnew/swig/module.i +++ b/pcbnew/swig/module.i @@ -27,11 +27,23 @@ * @brief Specific BOARD extensions and templates */ +%import dlist.i + + + +%include class_module.h + +%rename(Get) operator MODULE*; +%template(MODULE_List) DLIST; +%{ +#include +%} + %extend MODULE { - %pythoncode - %{ + %pythoncode + %{ #def SaveToLibrary(self,filename): # return SaveModuleToLibrary(filename,self) @@ -51,13 +63,12 @@ elif type(itemC) in [ TEXTE_PCB, DIMENSION, TEXTE_MODULE, DRAWSEGMENT,EDGE_MODULE]: item.thisown = 0 self.GraphicalItems().PushBack(item) - %} - + %} } -%pythoncode -{ +%pythoncode +%{ def GetPluginForPath(lpath): return IO_MGR.PluginFind(IO_MGR.LEGACY) @@ -88,7 +99,7 @@ def FootprintIsWritable(lpath): plug = GetPluginForPath(lpath) plug.FootprintLibIsWritable(lpath) -} +%} %{ MODULE *PyModule_to_MODULE(PyObject *obj0) @@ -106,5 +117,4 @@ return NULL; } - %} diff --git a/pcbnew/swig/netclass.i b/pcbnew/swig/netclass.i new file mode 100644 index 0000000000..5e3a60a687 --- /dev/null +++ b/pcbnew/swig/netclass.i @@ -0,0 +1,5 @@ + +%include class_netclass.h +%{ +#include +%} diff --git a/pcbnew/swig/netinfo.i b/pcbnew/swig/netinfo.i new file mode 100644 index 0000000000..74353a1cbe --- /dev/null +++ b/pcbnew/swig/netinfo.i @@ -0,0 +1,5 @@ + +%include class_netinfo.h +%{ +#include +%} diff --git a/pcbnew/swig/pad.i b/pcbnew/swig/pad.i new file mode 100644 index 0000000000..4b54e8c72e --- /dev/null +++ b/pcbnew/swig/pad.i @@ -0,0 +1,10 @@ + +%include pad_shapes.h +%include class_pad.h + +%rename(Get) operator D_PAD*; +%template(PAD_List) DLIST; +%{ +#include +%} + diff --git a/pcbnew/swig/pcb_text.i b/pcbnew/swig/pcb_text.i new file mode 100644 index 0000000000..adbd72b9d7 --- /dev/null +++ b/pcbnew/swig/pcb_text.i @@ -0,0 +1,7 @@ + + +%include class_pcb_text.h +%{ +#include +%} + diff --git a/pcbnew/swig/pcbnew.i b/pcbnew/swig/pcbnew.i index ec490e50e0..eae03a0e54 100644 --- a/pcbnew/swig/pcbnew.i +++ b/pcbnew/swig/pcbnew.i @@ -54,15 +54,6 @@ class BASE_SET {}; %ignore BASE_SET; -// rename the Add method of classes to Add native, so we will handle -// the Add method in python -%rename(AddNative) *::Add; - -// fix method names conflicts -%rename(AddChild) MODULE::Add; -%rename(RemoveChild) MODULE::Remove; -%rename(DeleteChild) MODULE::Delete; - // this is what it must be included in the wrapper .cxx code to compile @@ -124,29 +115,3 @@ HANDLE_EXCEPTIONS(PLUGIN::FootprintDelete) %include units.i - -// Extend LSET by 2 methods to add or remove layers from the layer list -// Mainly used to add or remove layers of a pad layer list -%extend LSET -{ - LSET addLayer( LAYER_ID aLayer) { return self->set(aLayer); } - LSET removeLayer( LAYER_ID aLayer) { return self->reset(aLayer); } - LSET addLayerSet( LSET aLayerSet) { return *self |= aLayerSet; } - LSET removeLayerSet( LSET aLayerSet) { return *self &= ~aLayerSet; } - - %pythoncode - %{ - def AddLayer(self, layer): - return self.addLayer( layer ) - - def AddLayerSet(self, layers): - return self.addLayerSet( layers ) - - def RemoveLayer(self, layer): - return self.removeLayer( layer ) - - def RemoveLayerSet(self, layers): - return self.removeLayerSet( layers ) - %} -} - diff --git a/pcbnew/swig/text_mod.i b/pcbnew/swig/text_mod.i new file mode 100644 index 0000000000..3a354b3a07 --- /dev/null +++ b/pcbnew/swig/text_mod.i @@ -0,0 +1,6 @@ + +%include class_text_mod.h +%{ +#include +%} + diff --git a/pcbnew/swig/track.i b/pcbnew/swig/track.i new file mode 100644 index 0000000000..b49bd8c032 --- /dev/null +++ b/pcbnew/swig/track.i @@ -0,0 +1,9 @@ + + +%include class_track.h +%rename(Get) operator TRACK*; +%template(TRACK_List) DLIST; +%{ +#include +%} + diff --git a/pcbnew/swig/zone.i b/pcbnew/swig/zone.i new file mode 100644 index 0000000000..5b0d472b66 --- /dev/null +++ b/pcbnew/swig/zone.i @@ -0,0 +1,9 @@ + + +%include class_zone.h +%include zones.h +%{ +#include +#include +%} +