diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index c9b9087a4a..a4b9bdee09 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -718,6 +718,7 @@ set( PCB_COMMON_SRCS ${CMAKE_SOURCE_DIR}/pcbnew/netinfo_item.cpp ${CMAKE_SOURCE_DIR}/pcbnew/netinfo_list.cpp ${CMAKE_SOURCE_DIR}/pcbnew/pad.cpp + ${CMAKE_SOURCE_DIR}/pcbnew/padstack.cpp ${CMAKE_SOURCE_DIR}/pcbnew/pcb_target.cpp ${CMAKE_SOURCE_DIR}/pcbnew/pcb_reference_image.cpp ${CMAKE_SOURCE_DIR}/pcbnew/pcb_field.cpp diff --git a/pcbnew/api/api_pcb_enums.cpp b/pcbnew/api/api_pcb_enums.cpp index 5cf5182880..af7f3ec829 100644 --- a/pcbnew/api/api_pcb_enums.cpp +++ b/pcbnew/api/api_pcb_enums.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include using namespace kiapi::board; diff --git a/pcbnew/board_design_settings.cpp b/pcbnew/board_design_settings.cpp index 0ca3a552e0..eb4269fb48 100644 --- a/pcbnew/board_design_settings.cpp +++ b/pcbnew/board_design_settings.cpp @@ -1490,7 +1490,7 @@ void BOARD_DESIGN_SETTINGS::SetDefaultMasterPad() { m_Pad_Master.get()->SetSizeX( pcbIUScale.mmToIU( DEFAULT_PAD_WIDTH_MM ) ); m_Pad_Master.get()->SetSizeY( pcbIUScale.mmToIU( DEFAULT_PAD_HEIGTH_MM ) ); - m_Pad_Master.get()->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); + m_Pad_Master.get()->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE ); m_Pad_Master.get()->SetDrillSize( VECTOR2I( pcbIUScale.mmToIU( DEFAULT_PAD_DRILL_DIAMETER_MM ), 0 ) ); m_Pad_Master.get()->SetShape( PAD_SHAPE::ROUNDRECT ); diff --git a/pcbnew/dialogs/dialog_board_statistics.cpp b/pcbnew/dialogs/dialog_board_statistics.cpp index 4a22e564f7..241b7d8280 100644 --- a/pcbnew/dialogs/dialog_board_statistics.cpp +++ b/pcbnew/dialogs/dialog_board_statistics.cpp @@ -299,7 +299,7 @@ void DIALOG_BOARD_STATISTICS::getDataFromPCB() } DRILL_LINE_ITEM drill( via->GetDrillValue(), via->GetDrillValue(), - PAD_DRILL_SHAPE_CIRCLE, true, false, via->TopLayer(), + PAD_DRILL_SHAPE::CIRCLE, true, false, via->TopLayer(), via->BottomLayer() ); auto it = m_drillTypes.begin(); @@ -509,8 +509,8 @@ void DIALOG_BOARD_STATISTICS::updateDrillGrid() switch( line.shape ) { - case PAD_DRILL_SHAPE_CIRCLE: shapeStr = _( "Round" ); break; - case PAD_DRILL_SHAPE_OBLONG: shapeStr = _( "Slot" ); break; + case PAD_DRILL_SHAPE::CIRCLE: shapeStr = _( "Round" ); break; + case PAD_DRILL_SHAPE::OBLONG: shapeStr = _( "Slot" ); break; default: shapeStr = _( "???" ); break; } diff --git a/pcbnew/dialogs/dialog_board_statistics.h b/pcbnew/dialogs/dialog_board_statistics.h index 9226a087bd..3ca4337be8 100644 --- a/pcbnew/dialogs/dialog_board_statistics.h +++ b/pcbnew/dialogs/dialog_board_statistics.h @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include @@ -97,7 +97,7 @@ public: COL_STOP_LAYER }; - DRILL_LINE_ITEM( int aXSize, int aYSize, PAD_DRILL_SHAPE_T aShape, bool aIsPlated, + DRILL_LINE_ITEM( int aXSize, int aYSize, PAD_DRILL_SHAPE aShape, bool aIsPlated, bool aIsPad, PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aStopLayer ) : xSize( aXSize ), ySize( aYSize ), @@ -129,7 +129,8 @@ public: case COL_COUNT: return compareDrillParameters( aLeft.qty, aRight.qty ); case COL_SHAPE: - return compareDrillParameters( aLeft.shape, aRight.shape ); + return compareDrillParameters( static_cast( aLeft.shape ), + static_cast( aRight.shape ) ); case COL_X_SIZE: return compareDrillParameters( aLeft.xSize, aRight.xSize ); case COL_Y_SIZE: @@ -158,7 +159,7 @@ public: int xSize; int ySize; - PAD_DRILL_SHAPE_T shape; + PAD_DRILL_SHAPE shape; bool isPlated; bool isPad; PCB_LAYER_ID startLayer; diff --git a/pcbnew/dialogs/dialog_gendrill.cpp b/pcbnew/dialogs/dialog_gendrill.cpp index 97d885b0b5..bbc0bdf7b7 100644 --- a/pcbnew/dialogs/dialog_gendrill.cpp +++ b/pcbnew/dialogs/dialog_gendrill.cpp @@ -151,7 +151,7 @@ void DIALOG_GENDRILL::InitDisplayParams() { for( PAD* pad : footprint->Pads() ) { - if( pad->GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE ) + if( pad->GetDrillShape() == PAD_DRILL_SHAPE::CIRCLE ) { if( pad->GetDrillSize().x != 0 ) { diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index a18ad30fc5..7f6b59ec42 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -754,7 +754,7 @@ void DIALOG_PAD_PROPERTIES::initValues() m_choiceFabProperty->Enable( false ); } - if( m_previewPad->GetDrillShape() != PAD_DRILL_SHAPE_OBLONG ) + if( m_previewPad->GetDrillShape() != PAD_DRILL_SHAPE::OBLONG ) m_holeShapeCtrl->SetSelection( 0 ); else m_holeShapeCtrl->SetSelection( 1 ); @@ -1382,7 +1382,7 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK() case PAD_ATTRIB::NPTH: // Not plated, but through hole, a hole is expected case PAD_ATTRIB::PTH: // Pad through hole, a hole is also expected if( drill_size.x <= 0 - || ( drill_size.y <= 0 && m_previewPad->GetDrillShape() == PAD_DRILL_SHAPE_OBLONG ) ) + || ( drill_size.y <= 0 && m_previewPad->GetDrillShape() == PAD_DRILL_SHAPE::OBLONG ) ) { error_msgs.Add( _( "Error: Through hole pad has no hole." ) ); } @@ -1833,12 +1833,12 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( PAD* aPad ) if( m_holeShapeCtrl->GetSelection() == CHOICE_SHAPE_CIRCLE ) { - aPad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); + aPad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE ); aPad->SetDrillSize( VECTOR2I( m_holeX.GetIntValue(), m_holeX.GetIntValue() ) ); } else { - aPad->SetDrillShape( PAD_DRILL_SHAPE_OBLONG ); + aPad->SetDrillShape( PAD_DRILL_SHAPE::OBLONG ); aPad->SetDrillSize( VECTOR2I( m_holeX.GetIntValue(), m_holeY.GetIntValue() ) ); } diff --git a/pcbnew/dialogs/dialog_pad_properties.h b/pcbnew/dialogs/dialog_pad_properties.h index c85912bab5..f77c198546 100644 --- a/pcbnew/dialogs/dialog_pad_properties.h +++ b/pcbnew/dialogs/dialog_pad_properties.h @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/pcbnew/exporters/export_idf.cpp b/pcbnew/exporters/export_idf.cpp index a6cb6fc29c..21b2344eba 100644 --- a/pcbnew/exporters/export_idf.cpp +++ b/pcbnew/exporters/export_idf.cpp @@ -346,7 +346,7 @@ static void idf_export_footprint( BOARD* aPcb, FOOTPRINT* aFootprint, IDF3_BOARD if( tstr.empty() || !tstr.compare( "0" ) || !tstr.compare( "~" ) || ( kplate == IDF3::NPTH ) - || ( pad->GetDrillShape() == PAD_DRILL_SHAPE_OBLONG ) ) + || ( pad->GetDrillShape() == PAD_DRILL_SHAPE::OBLONG ) ) pintype = "MTG"; else pintype = "PIN"; @@ -359,7 +359,7 @@ static void idf_export_footprint( BOARD* aPcb, FOOTPRINT* aFootprint, IDF3_BOARD // 5. Assoc. part : BOARD | NOREFDES | PANEL | {"refdes"} // 6. type : PIN | VIA | MTG | TOOL | { "other" } // 7. owner : MCAD | ECAD | UNOWNED - if( ( pad->GetDrillShape() == PAD_DRILL_SHAPE_OBLONG ) + if( ( pad->GetDrillShape() == PAD_DRILL_SHAPE::OBLONG ) && ( pad->GetDrillSize().x != pad->GetDrillSize().y ) ) { // NOTE: IDF does not have direct support for slots; diff --git a/pcbnew/exporters/exporter_vrml.cpp b/pcbnew/exporters/exporter_vrml.cpp index 16440c907b..fdb50d8fd6 100644 --- a/pcbnew/exporters/exporter_vrml.cpp +++ b/pcbnew/exporters/exporter_vrml.cpp @@ -907,7 +907,7 @@ void EXPORTER_PCB_VRML::ExportVrmlPadHole( PAD* aPad ) if( ( aPad->GetAttribute() != PAD_ATTRIB::NPTH ) ) pth = true; - if( aPad->GetDrillShape() == PAD_DRILL_SHAPE_OBLONG ) + if( aPad->GetDrillShape() == PAD_DRILL_SHAPE::OBLONG ) { // Oblong hole (slot) diff --git a/pcbnew/exporters/gendrill_file_writer_base.cpp b/pcbnew/exporters/gendrill_file_writer_base.cpp index b3184e7183..3a190ce962 100644 --- a/pcbnew/exporters/gendrill_file_writer_base.cpp +++ b/pcbnew/exporters/gendrill_file_writer_base.cpp @@ -147,7 +147,7 @@ void GENDRILL_WRITER_BASE::buildHolesList( DRILL_LAYER_PAIR aLayerPair, new_hole.m_Hole_Size.x = new_hole.m_Hole_Size.y = new_hole.m_Hole_Diameter; // Convert oblong holes that are actually circular into drill hits - if( pad->GetDrillShape() != PAD_DRILL_SHAPE_CIRCLE && + if( pad->GetDrillShape() != PAD_DRILL_SHAPE::CIRCLE && pad->GetDrillSizeX() != pad->GetDrillSizeY() ) { new_hole.m_Hole_Shape = 1; // oval flag set diff --git a/pcbnew/pad.cpp b/pcbnew/pad.cpp index e82f479456..1f4ba44611 100644 --- a/pcbnew/pad.cpp +++ b/pcbnew/pad.cpp @@ -79,7 +79,7 @@ PAD::PAD( FOOTPRINT* parent ) : SetShape( PAD_SHAPE::CIRCLE ); // Default pad shape is PAD_CIRCLE. SetAnchorPadShape( PAD_SHAPE::CIRCLE ); // Default shape for custom shaped pads // is PAD_CIRCLE. - SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); // Default pad drill shape is a circle. + SetDrillShape( PAD_DRILL_SHAPE::CIRCLE ); // Default pad drill shape is a circle. m_attribute = PAD_ATTRIB::PTH; // Default pad type is plated through hole SetProperty( PAD_PROP::NONE ); // no special fabrication property @@ -427,12 +427,12 @@ bool PAD::FlashLayer( int aLayer, bool aOnlyCheckIfPermitted ) const if( GetAttribute() == PAD_ATTRIB::NPTH && IsCopperLayer( aLayer ) ) { - if( GetShape() == PAD_SHAPE::CIRCLE && GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE ) + if( GetShape() == PAD_SHAPE::CIRCLE && GetDrillShape() == PAD_DRILL_SHAPE::CIRCLE ) { if( GetOffset() == VECTOR2I( 0, 0 ) && GetDrillSize().x >= GetSize().x ) return false; } - else if( GetShape() == PAD_SHAPE::OVAL && GetDrillShape() == PAD_DRILL_SHAPE_OBLONG ) + else if( GetShape() == PAD_SHAPE::OVAL && GetDrillShape() == PAD_DRILL_SHAPE::OBLONG ) { if( GetOffset() == VECTOR2I( 0, 0 ) && GetDrillSize().x >= GetSize().x && GetDrillSize().y >= GetSize().y ) @@ -1264,7 +1264,7 @@ void PAD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& if( m_drill.x > 0 || m_drill.y > 0 ) { - if( GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE ) + if( GetDrillShape() == PAD_DRILL_SHAPE::CIRCLE ) { aList.emplace_back( _( "Hole" ), wxString::Format( wxT( "%s" ), @@ -1362,7 +1362,8 @@ int PAD::Compare( const PAD* aPadRef, const PAD* aPadCmp ) static_cast( aPadCmp->m_attribute ) ) != 0 ) return diff; - if( ( diff = aPadRef->m_drillShape - aPadCmp->m_drillShape ) != 0 ) + if( ( diff = static_cast( aPadRef->m_drillShape ) - + static_cast( aPadCmp->m_drillShape ) ) != 0 ) return diff; if( ( diff = aPadRef->m_drill.x - aPadCmp->m_drill.x ) != 0 ) diff --git a/pcbnew/pad.h b/pcbnew/pad.h index 3886739d42..83833212cc 100644 --- a/pcbnew/pad.h +++ b/pcbnew/pad.h @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include @@ -355,8 +355,8 @@ public: return m_orient.AsDegrees(); } - void SetDrillShape( PAD_DRILL_SHAPE_T aShape ) { m_drillShape = aShape; m_shapesDirty = true; } - PAD_DRILL_SHAPE_T GetDrillShape() const { return m_drillShape; } + void SetDrillShape( PAD_DRILL_SHAPE aShape ) { m_drillShape = aShape; m_shapesDirty = true; } + PAD_DRILL_SHAPE GetDrillShape() const { return m_drillShape; } bool IsDirty() const { @@ -789,7 +789,7 @@ private: VECTOR2I m_drill; // Drill diameter (x == y) or slot dimensions (x != y) VECTOR2I m_size; // X and Y size (relative to orient 0) - PAD_DRILL_SHAPE_T m_drillShape; // PAD_DRILL_SHAPE_CIRCLE, PAD_DRILL_SHAPE_OBLONG + PAD_DRILL_SHAPE m_drillShape; // PAD_DRILL_SHAPE::CIRCLE, PAD_DRILL_SHAPE::OBLONG double m_roundedCornerScale; // Scaling factor of min(width, height) to corner // radius, default 0.25 diff --git a/pcbnew/padstack.cpp b/pcbnew/padstack.cpp new file mode 100644 index 0000000000..a7664e0793 --- /dev/null +++ b/pcbnew/padstack.cpp @@ -0,0 +1,43 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2024 Jon Evans + * Copyright (C) 2024 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 3 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, see . + */ + +#include "padstack.h" + + +PADSTACK::PADSTACK() +{ +} + + +bool PADSTACK::Deserialize( const google::protobuf::Any& aContainer ) +{ + return false; +} + + +void PADSTACK::Serialize( google::protobuf::Any& aContainer ) const +{ +} + + +wxString PADSTACK::Name() const +{ + return wxEmptyString; +} diff --git a/include/pad_shapes.h b/pcbnew/padstack.h similarity index 51% rename from include/pad_shapes.h rename to pcbnew/padstack.h index 53f96315d4..9d50bf87f4 100644 --- a/include/pad_shapes.h +++ b/pcbnew/padstack.h @@ -1,30 +1,33 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.TXT for contributors. + * Copyright (C) 2024 Jon Evans + * Copyright (C) 2024 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 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 3 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. + * 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 + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . */ -#ifndef PAD_SHAPES_H_ -#define PAD_SHAPES_H_ +#ifndef KICAD_PADSTACK_H +#define KICAD_PADSTACK_H + +#include +#include +#include + +#include +#include -#include /** * The set of pad shapes, used with PAD::{Set,Get}Shape() @@ -45,17 +48,15 @@ enum class PAD_SHAPE : int // (thick segments, circles, arcs, polygons). }; - /** * The set of pad drill shapes, used with PAD::{Set,Get}DrillShape() */ -enum PAD_DRILL_SHAPE_T +enum class PAD_DRILL_SHAPE { - PAD_DRILL_SHAPE_CIRCLE, - PAD_DRILL_SHAPE_OBLONG, + CIRCLE, + OBLONG, }; - /** * The set of pad shapes, used with PAD::{Set,Get}Attribute(). * @@ -91,4 +92,54 @@ enum class PAD_PROP }; -#endif // PAD_SHAPES_H_ +class PADSTACK : public SERIALIZABLE +{ +public: + ///! Padstack type, mostly for IPC-7351 naming and attributes + ///! Note that TYPE::MOUNTING is probably not currently supported by KiCad + enum class TYPE + { + NORMAL, ///< Padstack for a footprint pad + VIA, ///< Padstack for a via + MOUNTING ///< A mounting hole (plated or unplated, not associated with a footprint) + }; + + enum class MODE + { + NORMAL, ///< Shape is the same on all layers + TOP_INNER_BOTTOM, ///< Up to three shapes can be defined (top, inner, bottom) + CUSTOM ///< Shapes can be defined on arbitrary layers + }; + + struct OUTER_LAYER_PROPS + { + std::optional solder_mask_margin; + std::optional solder_paste_margin; + std::optional solder_paste_margin_ratio; + ZONE_CONNECTION zone_connection; + }; + + struct INNER_LAYER_PROPS + { + ZONE_CONNECTION zone_connection; + }; + +public: + PADSTACK(); + + virtual ~PADSTACK() = default; + + void Serialize( google::protobuf::Any &aContainer ) const override; + bool Deserialize( const google::protobuf::Any &aContainer ) override; + + ///! Returns the name of this padstack in IPC-7351 format + wxString Name() const; + +private: + + ///! An override for the IPC-7351 padstack name + wxString m_customName; +}; + + +#endif //KICAD_PADSTACK_H diff --git a/pcbnew/pcb_io/altium/altium_pcb.cpp b/pcbnew/pcb_io/altium/altium_pcb.cpp index 8621ed3d23..1eda0ced2a 100644 --- a/pcbnew/pcb_io/altium/altium_pcb.cpp +++ b/pcbnew/pcb_io/altium/altium_pcb.cpp @@ -3065,7 +3065,7 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con if( !aElem.sizeAndShape || aElem.sizeAndShape->holeshape == ALTIUM_PAD_HOLE_SHAPE::ROUND ) { - pad->SetDrillShape( PAD_DRILL_SHAPE_T::PAD_DRILL_SHAPE_CIRCLE ); + pad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE ); pad->SetDrillSize( VECTOR2I( aElem.holesize, aElem.holesize ) ); } else @@ -3102,7 +3102,7 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con } } - pad->SetDrillShape( PAD_DRILL_SHAPE_T::PAD_DRILL_SHAPE_CIRCLE ); + pad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE ); pad->SetDrillSize( VECTOR2I( aElem.holesize, aElem.holesize ) ); // Workaround // TODO: elem.sizeAndShape->slotsize was 0 in testfile. Either use holesize in // this case or rect holes have a different id @@ -3110,7 +3110,7 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con case ALTIUM_PAD_HOLE_SHAPE::SLOT: { - pad->SetDrillShape( PAD_DRILL_SHAPE_T::PAD_DRILL_SHAPE_OBLONG ); + pad->SetDrillShape( PAD_DRILL_SHAPE::OBLONG ); EDA_ANGLE slotRotation( aElem.sizeAndShape->slotrotation, DEGREES_T ); slotRotation.Normalize(); @@ -3187,7 +3187,7 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con } } - pad->SetDrillShape( PAD_DRILL_SHAPE_T::PAD_DRILL_SHAPE_CIRCLE ); + pad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE ); pad->SetDrillSize( VECTOR2I( aElem.holesize, aElem.holesize ) ); // Workaround break; } @@ -3288,7 +3288,7 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con if( pad->GetAttribute() == PAD_ATTRIB::NPTH && pad->HasHole() ) { // KiCad likes NPTH pads to be the same size & shape as their holes - pad->SetShape( pad->GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE ? PAD_SHAPE::CIRCLE + pad->SetShape( pad->GetDrillShape() == PAD_DRILL_SHAPE::CIRCLE ? PAD_SHAPE::CIRCLE : PAD_SHAPE::OVAL ); pad->SetSize( pad->GetDrillSize() ); } diff --git a/pcbnew/pcb_io/cadstar/cadstar_pcb_archive_loader.cpp b/pcbnew/pcb_io/cadstar/cadstar_pcb_archive_loader.cpp index a905778c67..4c042da704 100644 --- a/pcbnew/pcb_io/cadstar/cadstar_pcb_archive_loader.cpp +++ b/pcbnew/pcb_io/cadstar/cadstar_pcb_archive_loader.cpp @@ -1238,14 +1238,14 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad, { if( csPadcode.SlotLength != UNDEFINED_VALUE ) { - pad->SetDrillShape( PAD_DRILL_SHAPE_T::PAD_DRILL_SHAPE_OBLONG ); + pad->SetDrillShape( PAD_DRILL_SHAPE::OBLONG ); pad->SetDrillSize( { getKiCadLength( (long long) csPadcode.SlotLength + (long long) csPadcode.DrillDiameter ), getKiCadLength( csPadcode.DrillDiameter ) } ); } else { - pad->SetDrillShape( PAD_DRILL_SHAPE_T::PAD_DRILL_SHAPE_CIRCLE ); + pad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE ); pad->SetDrillSize( { getKiCadLength( csPadcode.DrillDiameter ), getKiCadLength( csPadcode.DrillDiameter ) } ); } diff --git a/pcbnew/pcb_io/eagle/pcb_io_eagle.cpp b/pcbnew/pcb_io/eagle/pcb_io_eagle.cpp index fcbfa16ec2..be033970cb 100644 --- a/pcbnew/pcb_io/eagle/pcb_io_eagle.cpp +++ b/pcbnew/pcb_io/eagle/pcb_io_eagle.cpp @@ -74,7 +74,7 @@ Load() TODO's #include #include #include -#include +#include #include #include diff --git a/pcbnew/pcb_io/easyeda/pcb_io_easyeda_parser.cpp b/pcbnew/pcb_io/easyeda/pcb_io_easyeda_parser.cpp index d79b932589..d3fa0cea07 100644 --- a/pcbnew/pcb_io/easyeda/pcb_io_easyeda_parser.cpp +++ b/pcbnew/pcb_io/easyeda/pcb_io_easyeda_parser.cpp @@ -852,7 +852,7 @@ void PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer( pad->SetAttribute( PAD_ATTRIB::PTH ); pad->SetShape( PAD_SHAPE::CIRCLE ); pad->SetSize( VECTOR2I( kdia, kdia ) ); - pad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); + pad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE ); pad->SetDrillSize( VECTOR2I( kdrill, kdrill ) ); footprint->Add( pad.release(), ADD_MODE::APPEND ); @@ -911,7 +911,7 @@ void PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer( pad->SetAttribute( PAD_ATTRIB::NPTH ); pad->SetShape( PAD_SHAPE::CIRCLE ); pad->SetSize( VECTOR2I( kdia, kdia ) ); - pad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); + pad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE ); pad->SetDrillSize( VECTOR2I( kdia, kdia ) ); padContainer->Add( pad.release(), ADD_MODE::APPEND ); @@ -1039,7 +1039,7 @@ void PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer( if( holeL > 0 ) { - pad->SetDrillShape( PAD_DRILL_SHAPE_OBLONG ); + pad->SetDrillShape( PAD_DRILL_SHAPE::OBLONG ); if( size.x < size.y ) pad->SetDrillSize( VECTOR2I( holeD, holeL ) ); @@ -1048,7 +1048,7 @@ void PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer( } else { - pad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); + pad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE ); pad->SetDrillSize( VECTOR2I( holeD, holeD ) ); } } diff --git a/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro_parser.cpp b/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro_parser.cpp index 31f19b6df5..ed7e908371 100644 --- a/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro_parser.cpp +++ b/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro_parser.cpp @@ -640,7 +640,7 @@ std::unique_ptr PCB_IO_EASYEDAPRO_PARSER::createPAD( FOOTPRINT* if( holeShape == wxS( "SLOT" ) ) { - pad->SetDrillShape( PAD_DRILL_SHAPE_OBLONG ); + pad->SetDrillShape( PAD_DRILL_SHAPE::OBLONG ); } pad->SetDrillSize( ScaleSize( drill ) ); diff --git a/pcbnew/pcb_io/fabmaster/import_fabmaster.cpp b/pcbnew/pcb_io/fabmaster/import_fabmaster.cpp index c88296379c..769563f7b6 100644 --- a/pcbnew/pcb_io/fabmaster/import_fabmaster.cpp +++ b/pcbnew/pcb_io/fabmaster/import_fabmaster.cpp @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include #include @@ -2380,9 +2380,9 @@ bool FABMASTER::loadFootprints( BOARD* aBoard ) } if( pad.drill_size_x == pad.drill_size_y ) - newpad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); + newpad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE ); else - newpad->SetDrillShape( PAD_DRILL_SHAPE_OBLONG ); + newpad->SetDrillShape( PAD_DRILL_SHAPE::OBLONG ); newpad->SetDrillSize( VECTOR2I( pad.drill_size_x, pad.drill_size_y ) ); } diff --git a/pcbnew/pcb_io/fabmaster/import_fabmaster.h b/pcbnew/pcb_io/fabmaster/import_fabmaster.h index ad90b68b84..9faa9d7274 100644 --- a/pcbnew/pcb_io/fabmaster/import_fabmaster.h +++ b/pcbnew/pcb_io/fabmaster/import_fabmaster.h @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include diff --git a/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.cpp b/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.cpp index 1538e467cf..370b1af2d5 100644 --- a/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.cpp +++ b/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.cpp @@ -1449,7 +1449,7 @@ void PCB_IO_KICAD_LEGACY::loadPAD( FOOTPRINT* aFootprint ) BIU offs_x = biuParse( data, &data ); BIU offs_y = biuParse( data, &data ); - PAD_DRILL_SHAPE_T drShape = PAD_DRILL_SHAPE_CIRCLE; + PAD_DRILL_SHAPE drShape = PAD_DRILL_SHAPE::CIRCLE; data = strtok_r( (char*) data, delims, &saveptr ); @@ -1457,7 +1457,7 @@ void PCB_IO_KICAD_LEGACY::loadPAD( FOOTPRINT* aFootprint ) { if( data[0] == 'O' ) { - drShape = PAD_DRILL_SHAPE_OBLONG; + drShape = PAD_DRILL_SHAPE::OBLONG; data = strtok_r( nullptr, delims, &saveptr ); drill_x = biuParse( data ); diff --git a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp index 3ef0d32d7b..7559960668 100644 --- a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp +++ b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp @@ -1522,7 +1522,7 @@ void PCB_IO_KICAD_SEXPR::format( const PAD* aPad, int aNestLevel ) const { m_out->Print( 0, " (drill" ); - if( aPad->GetDrillShape() == PAD_DRILL_SHAPE_OBLONG ) + if( aPad->GetDrillShape() == PAD_DRILL_SHAPE::OBLONG ) m_out->Print( 0, " oval" ); if( sz.x > 0 ) diff --git a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp index 8e67ab1a9e..f0b0924ab2 100644 --- a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp +++ b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp @@ -4840,7 +4840,7 @@ PAD* PCB_IO_KICAD_SEXPR_PARSER::parsePAD( FOOTPRINT* aParent ) switch( token ) { - case T_oval: pad->SetDrillShape( PAD_DRILL_SHAPE_OBLONG ); break; + case T_oval: pad->SetDrillShape( PAD_DRILL_SHAPE::OBLONG ); break; case T_NUMBER: { diff --git a/pcbnew/pcb_io/pcad/pcad_pad.cpp b/pcbnew/pcb_io/pcad/pcad_pad.cpp index b752aa2e9a..b8456ca237 100644 --- a/pcbnew/pcb_io/pcad/pcad_pad.cpp +++ b/pcbnew/pcb_io/pcad/pcad_pad.cpp @@ -209,7 +209,7 @@ void PCAD_PAD::AddToFootprint( FOOTPRINT* aFootprint, const EDA_ANGLE& aRotation pad->SetShape( PAD_SHAPE::CIRCLE ); pad->SetAttribute( PAD_ATTRIB::NPTH ); - pad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); + pad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE ); pad->SetDrillSize( VECTOR2I( m_Hole, m_Hole ) ); pad->SetSize( VECTOR2I( m_Hole, m_Hole ) ); @@ -291,7 +291,7 @@ void PCAD_PAD::AddToFootprint( FOOTPRINT* aFootprint, const EDA_ANGLE& aRotation pad->SetDelta( VECTOR2I( 0, 0 ) ); pad->SetOrientation( m_Rotation + aRotation ); - pad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); + pad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE ); pad->SetOffset( VECTOR2I( 0, 0 ) ); pad->SetDrillSize( VECTOR2I( m_Hole, m_Hole ) ); diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index c91f7d8a57..eac8ab5622 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -514,7 +514,7 @@ int PCB_PAINTER::getLineThickness( int aActualThickness ) const } -int PCB_PAINTER::getDrillShape( const PAD* aPad ) const +PAD_DRILL_SHAPE PCB_PAINTER::getDrillShape( const PAD* aPad ) const { return aPad->GetDrillShape(); } diff --git a/pcbnew/pcb_painter.h b/pcbnew/pcb_painter.h index b5ebde2ccd..972cc598e6 100644 --- a/pcbnew/pcb_painter.h +++ b/pcbnew/pcb_painter.h @@ -30,6 +30,7 @@ #include #include +#include // PAD_DRILL_SHAPE #include #include #include @@ -205,7 +206,7 @@ protected: /** * Return drill shape of a pad. */ - virtual int getDrillShape( const PAD* aPad ) const; + virtual PAD_DRILL_SHAPE getDrillShape( const PAD* aPad ) const; /** * Return hole shape for a pad (internal units). diff --git a/pcbnew/pcbnew_printout.cpp b/pcbnew/pcbnew_printout.cpp index 25a2f10d6c..ba7222e3ec 100644 --- a/pcbnew/pcbnew_printout.cpp +++ b/pcbnew/pcbnew_printout.cpp @@ -308,9 +308,9 @@ KIGFX::PCB_PRINT_PAINTER::PCB_PRINT_PAINTER( GAL* aGal ) : { } -int KIGFX::PCB_PRINT_PAINTER::getDrillShape( const PAD* aPad ) const +PAD_DRILL_SHAPE KIGFX::PCB_PRINT_PAINTER::getDrillShape( const PAD* aPad ) const { - return m_drillMarkReal ? KIGFX::PCB_PAINTER::getDrillShape( aPad ) : PAD_DRILL_SHAPE_CIRCLE; + return m_drillMarkReal ? KIGFX::PCB_PAINTER::getDrillShape( aPad ) : PAD_DRILL_SHAPE::CIRCLE; } diff --git a/pcbnew/pcbnew_printout.h b/pcbnew/pcbnew_printout.h index 87bfbc68a2..a7dbd94393 100644 --- a/pcbnew/pcbnew_printout.h +++ b/pcbnew/pcbnew_printout.h @@ -97,7 +97,7 @@ public: } protected: - int getDrillShape( const PAD* aPad ) const override; + PAD_DRILL_SHAPE getDrillShape( const PAD* aPad ) const override; SHAPE_SEGMENT getPadHoleShape( const PAD* aPad ) const override; diff --git a/pcbnew/pcbplot.h b/pcbnew/pcbplot.h index bd01b7fa5f..ac29755b61 100644 --- a/pcbnew/pcbplot.h +++ b/pcbnew/pcbplot.h @@ -24,7 +24,7 @@ #ifndef PCBPLOT_H_ #define PCBPLOT_H_ -#include // for PAD_DRILL_SHAPE_T +#include // for PAD_DRILL_SHAPE #include #include #include @@ -131,7 +131,7 @@ private: * * It compensate and clamp the drill mark size depending on the current plot options. */ - void plotOneDrillMark( PAD_DRILL_SHAPE_T aDrillShape, const VECTOR2I& aDrillPos, + void plotOneDrillMark( PAD_DRILL_SHAPE aDrillShape, const VECTOR2I& aDrillPos, const VECTOR2I& aDrillSize, const VECTOR2I& aPadSize, const EDA_ANGLE& aOrientation, int aSmallDrill ); diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index 1591b60510..b9bf5278de 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -1014,21 +1014,21 @@ void BRDITEMS_PLOTTER::PlotTableBorders( const PCB_TABLE* aTable ) } -void BRDITEMS_PLOTTER::plotOneDrillMark( PAD_DRILL_SHAPE_T aDrillShape, const VECTOR2I& aDrillPos, +void BRDITEMS_PLOTTER::plotOneDrillMark( PAD_DRILL_SHAPE aDrillShape, const VECTOR2I& aDrillPos, const VECTOR2I& aDrillSize, const VECTOR2I& aPadSize, const EDA_ANGLE& aOrientation, int aSmallDrill ) { VECTOR2I drillSize = aDrillSize; // Small drill marks have no significance when applied to slots - if( aSmallDrill && aDrillShape == PAD_DRILL_SHAPE_CIRCLE ) + if( aSmallDrill && aDrillShape == PAD_DRILL_SHAPE::CIRCLE ) drillSize.x = std::min( aSmallDrill, drillSize.x ); // Round holes only have x diameter, slots have both drillSize.x -= getFineWidthAdj(); drillSize.x = Clamp( 1, drillSize.x, aPadSize.x - 1 ); - if( aDrillShape == PAD_DRILL_SHAPE_OBLONG ) + if( aDrillShape == PAD_DRILL_SHAPE::OBLONG ) { drillSize.y -= getFineWidthAdj(); drillSize.y = Clamp( 1, drillSize.y, aPadSize.y - 1 ); @@ -1073,7 +1073,7 @@ void BRDITEMS_PLOTTER::PlotDrillMarks() if( ( via->GetLayerSet() & m_layerMask ).none() ) continue; - plotOneDrillMark( PAD_DRILL_SHAPE_CIRCLE, via->GetStart(), + plotOneDrillMark( PAD_DRILL_SHAPE::CIRCLE, via->GetStart(), VECTOR2I( via->GetDrillValue(), 0 ), VECTOR2I( via->GetWidth(), 0 ), ANGLE_0, smallDrill ); } diff --git a/pcbnew/python/swig/pad.i b/pcbnew/python/swig/pad.i index a3f3c8020f..3b3a09292b 100644 --- a/pcbnew/python/swig/pad.i +++ b/pcbnew/python/swig/pad.i @@ -1,6 +1,6 @@ %rename(AddPrimitiveShape) PAD::AddPrimitive; -%include pad_shapes.h +%include padstack.h %include pad.h %rename(Get) operator PAD*; @@ -13,6 +13,8 @@ const int PAD_SHAPE_RECT = (const int)PAD_SHAPE::RECTANGLE; %{ const int PAD_SHAPE_RECT = (const int)PAD_SHAPE::RECTANGLE; +const int PAD_DRILL_SHAPE_CIRCLE = (const int)PAD_DRILL_SHAPE::CIRCLE; +const int PAD_DRILL_SHAPE_OBLONG = (const int)PAD_DRILL_SHAPE::OBLONG; %} %extend PAD diff --git a/pcbnew/tools/pad_tool.cpp b/pcbnew/tools/pad_tool.cpp index 07ff8a4e99..9e8a29bf83 100644 --- a/pcbnew/tools/pad_tool.cpp +++ b/pcbnew/tools/pad_tool.cpp @@ -591,7 +591,7 @@ int PAD_TOOL::PlacePad( const TOOL_EVENT& aEvent ) // Gives an acceptable drill size: it cannot be 0, but from pad master // it is currently 0, therefore change it: - pad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); + pad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE ); int hole_size = pad->GetSizeX() / 2; pad->SetDrillSize( VECTOR2I( hole_size, hole_size ) ); diff --git a/qa/tests/api/test_api_enums.cpp b/qa/tests/api/test_api_enums.cpp index fbf630cf30..07864f3658 100644 --- a/qa/tests/api/test_api_enums.cpp +++ b/qa/tests/api/test_api_enums.cpp @@ -33,7 +33,7 @@ #include // Board-specific -#include +#include #include using namespace kiapi::common;