From cc850d0da0967b5173ce211f863225875691880f Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Mon, 8 Jul 2024 20:58:47 -0700 Subject: [PATCH] Split out LSEQ/LSET from LAYER_ID Separate the layer grouping classes for easier modification --- 3d-viewer/3d_canvas/board_adapter.cpp | 1 + 3d-viewer/3d_canvas/create_layer_items.cpp | 1 + .../3d_rendering/opengl/create_scene.cpp | 1 + .../3d_rendering/opengl/render_3d_opengl.cpp | 1 + 3d-viewer/dialogs/panel_preview_3d_model.cpp | 1 + common/CMakeLists.txt | 1 + common/board_printout.cpp | 1 + common/jobs/job_export_pcb_dxf.h | 1 + common/jobs/job_export_pcb_gerber.h | 1 + common/jobs/job_export_pcb_gerbers.h | 1 + common/jobs/job_export_pcb_pdf.h | 1 + common/jobs/job_export_pcb_svg.h | 1 + common/jobs/job_fp_export_svg.h | 1 + common/layer_id.cpp | 166 +++++--- common/lseq.cpp | 23 ++ common/lset.cpp | 141 +++---- common/project/board_project_settings.cpp | 2 + common/project/project_local_settings.cpp | 1 + gerbview/files.cpp | 1 + gerbview/gerbview_frame.cpp | 1 + gerbview/gerbview_frame.h | 1 + gerbview/gerbview_printout.cpp | 3 + gerbview/gerbview_printout.h | 1 + gerbview/widgets/gerbview_layer_widget.cpp | 1 + include/board_design_settings.h | 1 + include/board_item.h | 2 + include/board_printout.h | 1 + include/layer_ids.h | 370 ------------------ include/lseq.h | 86 ++++ include/lset.h | 332 ++++++++++++++++ include/pcb_base_frame.h | 1 + include/project/board_project_settings.h | 1 + include/render_settings.h | 1 + kicad/cli/command_pcb_export_base.cpp | 2 + kicad/cli/command_pcb_export_base.h | 2 + pcbnew/api/api_pcb_utils.cpp | 1 + pcbnew/api/api_pcb_utils.h | 1 + pcbnew/autorouter/ar_autoplacer.cpp | 1 + pcbnew/autorouter/ar_autoplacer.h | 1 + pcbnew/autorouter/ar_matrix.cpp | 1 + pcbnew/autorouter/ar_matrix.h | 1 + pcbnew/board.cpp | 1 + pcbnew/board.h | 1 + pcbnew/board_commit.cpp | 1 + pcbnew/board_connected_item.cpp | 1 + pcbnew/board_design_settings.cpp | 1 + pcbnew/board_item.cpp | 1 + pcbnew/board_stackup_manager/board_stackup.h | 1 + pcbnew/collectors.h | 1 + pcbnew/dialogs/dialog_map_layers.cpp | 1 + pcbnew/drc/drc_engine.h | 2 +- pcbnew/drc/drc_rule.h | 1 + pcbnew/exporters/step/exporter_step.h | 1 + pcbnew/footprint.cpp | 1 + pcbnew/footprint.h | 1 + pcbnew/footprint_chooser_frame.cpp | 1 + pcbnew/footprint_editor_settings.cpp | 1 + pcbnew/grid_layer_box_helpers.cpp | 1 + pcbnew/grid_layer_box_helpers.h | 1 + pcbnew/initpcb.cpp | 1 + pcbnew/pad.cpp | 4 +- pcbnew/pad.h | 1 + pcbnew/padstack.h | 1 + pcbnew/pcb_base_frame.cpp | 1 + pcbnew/pcb_edit_frame.cpp | 1 + pcbnew/pcb_generator.h | 1 + pcbnew/pcb_group.h | 1 + pcbnew/pcb_io/altium/altium_pcb.cpp | 2 +- .../common/plugin_common_layer_mapping.h | 1 + pcbnew/pcb_io/eagle/pcb_io_eagle.h | 1 + .../pcb_io/easyeda/pcb_io_easyeda_parser.cpp | 2 +- .../easyedapro/pcb_io_easyedapro_parser.cpp | 2 +- pcbnew/pcb_io/fabmaster/import_fabmaster.cpp | 2 +- .../pcb_io/kicad_legacy/pcb_io_kicad_legacy.h | 1 + .../pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h | 1 + pcbnew/pcb_layer_box_selector.h | 1 + pcbnew/pcb_painter.cpp | 1 + pcbnew/pcb_plot_params.cpp | 1 + pcbnew/pcb_shape.cpp | 1 + pcbnew/pcb_track.cpp | 1 + pcbnew/pcb_track.h | 1 + pcbnew/pcbexpr_evaluator.cpp | 1 + pcbnew/pcbexpr_functions.cpp | 1 + pcbnew/pcbnew_jobs_handler.cpp | 1 + pcbnew/pcbnew_printout.cpp | 1 + pcbnew/pcbnew_printout.h | 1 + pcbnew/pcbnew_settings.cpp | 3 +- pcbnew/pcbplot.cpp | 1 + pcbnew/pcbplot.h | 1 + pcbnew/plot_board_layers.cpp | 1 + pcbnew/plot_brditems_plotter.cpp | 1 + pcbnew/plotcontroller.h | 1 + pcbnew/sel_layer.cpp | 1 + pcbnew/toolbars_footprint_editor.cpp | 1 + pcbnew/tools/pcb_grid_helper.h | 2 + pcbnew/tracks_cleaner.cpp | 1 + pcbnew/undo_redo.cpp | 1 + pcbnew/zone.cpp | 3 +- pcbnew/zone.h | 1 + pcbnew/zone_settings.cpp | 1 + pcbnew/zone_settings.h | 1 + qa/tests/common/test_layer_ids.cpp | 2 + qa/tests/pcbnew/test_lset.cpp | 2 + 103 files changed, 701 insertions(+), 535 deletions(-) create mode 100644 common/lseq.cpp create mode 100644 include/lseq.h create mode 100644 include/lset.h diff --git a/3d-viewer/3d_canvas/board_adapter.cpp b/3d-viewer/3d_canvas/board_adapter.cpp index 4d76ae16b5..a87c2ac1b7 100644 --- a/3d-viewer/3d_canvas/board_adapter.cpp +++ b/3d-viewer/3d_canvas/board_adapter.cpp @@ -34,6 +34,7 @@ #include <3d_math.h> #include "3d_fastmath.h" #include +#include #include #include #include diff --git a/3d-viewer/3d_canvas/create_layer_items.cpp b/3d-viewer/3d_canvas/create_layer_items.cpp index 01bd914e20..20b43a26a4 100644 --- a/3d-viewer/3d_canvas/create_layer_items.cpp +++ b/3d-viewer/3d_canvas/create_layer_items.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include diff --git a/3d-viewer/3d_rendering/opengl/create_scene.cpp b/3d-viewer/3d_rendering/opengl/create_scene.cpp index 6901bf8c26..f2faab5c69 100644 --- a/3d-viewer/3d_rendering/opengl/create_scene.cpp +++ b/3d-viewer/3d_rendering/opengl/create_scene.cpp @@ -28,6 +28,7 @@ #include #include "../../3d_math.h" #include "convert_basic_shapes_to_polygon.h" +#include #include #include #include // To use GetRunningMicroSecs or another profiling utility diff --git a/3d-viewer/3d_rendering/opengl/render_3d_opengl.cpp b/3d-viewer/3d_rendering/opengl/render_3d_opengl.cpp index 8a82b631cf..a8c55f8cbc 100644 --- a/3d-viewer/3d_rendering/opengl/render_3d_opengl.cpp +++ b/3d-viewer/3d_rendering/opengl/render_3d_opengl.cpp @@ -34,6 +34,7 @@ #include #include <3d_math.h> #include +#include #include // for KiROUND #include #include diff --git a/3d-viewer/dialogs/panel_preview_3d_model.cpp b/3d-viewer/dialogs/panel_preview_3d_model.cpp index 0c3389e0b6..d6e1458457 100644 --- a/3d-viewer/dialogs/panel_preview_3d_model.cpp +++ b/3d-viewer/dialogs/panel_preview_3d_model.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 196902c9cc..bc0ec154f7 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -143,6 +143,7 @@ set( KICOMMON_SRCS layer_id.cpp lib_id.cpp locale_io.cpp + lseq.cpp lset.cpp markup_parser.cpp netclass.cpp diff --git a/common/board_printout.cpp b/common/board_printout.cpp index 50ed827697..fcaff5154c 100644 --- a/common/board_printout.cpp +++ b/common/board_printout.cpp @@ -26,6 +26,7 @@ #include +#include #include #include #include diff --git a/common/jobs/job_export_pcb_dxf.h b/common/jobs/job_export_pcb_dxf.h index 13a95cd543..17547d913a 100644 --- a/common/jobs/job_export_pcb_dxf.h +++ b/common/jobs/job_export_pcb_dxf.h @@ -23,6 +23,7 @@ #include #include +#include #include #include "job.h" diff --git a/common/jobs/job_export_pcb_gerber.h b/common/jobs/job_export_pcb_gerber.h index 8fbb777294..669f6583e3 100644 --- a/common/jobs/job_export_pcb_gerber.h +++ b/common/jobs/job_export_pcb_gerber.h @@ -23,6 +23,7 @@ #include #include +#include #include #include "job.h" diff --git a/common/jobs/job_export_pcb_gerbers.h b/common/jobs/job_export_pcb_gerbers.h index 8365e28027..3312e1aa09 100644 --- a/common/jobs/job_export_pcb_gerbers.h +++ b/common/jobs/job_export_pcb_gerbers.h @@ -24,6 +24,7 @@ #include #include "job_export_pcb_gerber.h" #include +#include #include #include "job.h" diff --git a/common/jobs/job_export_pcb_pdf.h b/common/jobs/job_export_pcb_pdf.h index 72314368ef..92a96d3c37 100644 --- a/common/jobs/job_export_pcb_pdf.h +++ b/common/jobs/job_export_pcb_pdf.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "job.h" diff --git a/common/jobs/job_export_pcb_svg.h b/common/jobs/job_export_pcb_svg.h index 96821ab4ce..3f4dcf0384 100644 --- a/common/jobs/job_export_pcb_svg.h +++ b/common/jobs/job_export_pcb_svg.h @@ -23,6 +23,7 @@ #include #include +#include #include #include "job.h" diff --git a/common/jobs/job_fp_export_svg.h b/common/jobs/job_fp_export_svg.h index 5c8da5d15d..6694342210 100644 --- a/common/jobs/job_fp_export_svg.h +++ b/common/jobs/job_fp_export_svg.h @@ -23,6 +23,7 @@ #include #include +#include #include #include "job.h" diff --git a/common/layer_id.cpp b/common/layer_id.cpp index 71127c62b8..1eb55c9aac 100644 --- a/common/layer_id.cpp +++ b/common/layer_id.cpp @@ -35,76 +35,76 @@ wxString LayerName( int aLayer ) case UNDEFINED_LAYER: return _( "undefined" ); // Copper - case F_Cu: return wxT( "F.Cu" ); - case In1_Cu: return wxT( "In1.Cu" ); - case In2_Cu: return wxT( "In2.Cu" ); - case In3_Cu: return wxT( "In3.Cu" ); - case In4_Cu: return wxT( "In4.Cu" ); - case In5_Cu: return wxT( "In5.Cu" ); - case In6_Cu: return wxT( "In6.Cu" ); - case In7_Cu: return wxT( "In7.Cu" ); - case In8_Cu: return wxT( "In8.Cu" ); - case In9_Cu: return wxT( "In9.Cu" ); - case In10_Cu: return wxT( "In10.Cu" ); - case In11_Cu: return wxT( "In11.Cu" ); - case In12_Cu: return wxT( "In12.Cu" ); - case In13_Cu: return wxT( "In13.Cu" ); - case In14_Cu: return wxT( "In14.Cu" ); - case In15_Cu: return wxT( "In15.Cu" ); - case In16_Cu: return wxT( "In16.Cu" ); - case In17_Cu: return wxT( "In17.Cu" ); - case In18_Cu: return wxT( "In18.Cu" ); - case In19_Cu: return wxT( "In19.Cu" ); - case In20_Cu: return wxT( "In20.Cu" ); - case In21_Cu: return wxT( "In21.Cu" ); - case In22_Cu: return wxT( "In22.Cu" ); - case In23_Cu: return wxT( "In23.Cu" ); - case In24_Cu: return wxT( "In24.Cu" ); - case In25_Cu: return wxT( "In25.Cu" ); - case In26_Cu: return wxT( "In26.Cu" ); - case In27_Cu: return wxT( "In27.Cu" ); - case In28_Cu: return wxT( "In28.Cu" ); - case In29_Cu: return wxT( "In29.Cu" ); - case In30_Cu: return wxT( "In30.Cu" ); - case B_Cu: return wxT( "B.Cu" ); + case PCB_LAYER_ID::F_Cu: return wxT( "F.Cu" ); + case PCB_LAYER_ID::In1_Cu: return wxT( "In1.Cu" ); + case PCB_LAYER_ID::In2_Cu: return wxT( "In2.Cu" ); + case PCB_LAYER_ID::In3_Cu: return wxT( "In3.Cu" ); + case PCB_LAYER_ID::In4_Cu: return wxT( "In4.Cu" ); + case PCB_LAYER_ID::In5_Cu: return wxT( "In5.Cu" ); + case PCB_LAYER_ID::In6_Cu: return wxT( "In6.Cu" ); + case PCB_LAYER_ID::In7_Cu: return wxT( "In7.Cu" ); + case PCB_LAYER_ID::In8_Cu: return wxT( "In8.Cu" ); + case PCB_LAYER_ID::In9_Cu: return wxT( "In9.Cu" ); + case PCB_LAYER_ID::In10_Cu: return wxT( "In10.Cu" ); + case PCB_LAYER_ID::In11_Cu: return wxT( "In11.Cu" ); + case PCB_LAYER_ID::In12_Cu: return wxT( "In12.Cu" ); + case PCB_LAYER_ID::In13_Cu: return wxT( "In13.Cu" ); + case PCB_LAYER_ID::In14_Cu: return wxT( "In14.Cu" ); + case PCB_LAYER_ID::In15_Cu: return wxT( "In15.Cu" ); + case PCB_LAYER_ID::In16_Cu: return wxT( "In16.Cu" ); + case PCB_LAYER_ID::In17_Cu: return wxT( "In17.Cu" ); + case PCB_LAYER_ID::In18_Cu: return wxT( "In18.Cu" ); + case PCB_LAYER_ID::In19_Cu: return wxT( "In19.Cu" ); + case PCB_LAYER_ID::In20_Cu: return wxT( "In20.Cu" ); + case PCB_LAYER_ID::In21_Cu: return wxT( "In21.Cu" ); + case PCB_LAYER_ID::In22_Cu: return wxT( "In22.Cu" ); + case PCB_LAYER_ID::In23_Cu: return wxT( "In23.Cu" ); + case PCB_LAYER_ID::In24_Cu: return wxT( "In24.Cu" ); + case PCB_LAYER_ID::In25_Cu: return wxT( "In25.Cu" ); + case PCB_LAYER_ID::In26_Cu: return wxT( "In26.Cu" ); + case PCB_LAYER_ID::In27_Cu: return wxT( "In27.Cu" ); + case PCB_LAYER_ID::In28_Cu: return wxT( "In28.Cu" ); + case PCB_LAYER_ID::In29_Cu: return wxT( "In29.Cu" ); + case PCB_LAYER_ID::In30_Cu: return wxT( "In30.Cu" ); + case PCB_LAYER_ID::B_Cu: return wxT( "B.Cu" ); // Technicals - case B_Adhes: return wxT( "B.Adhesive" ); - case F_Adhes: return wxT( "F.Adhesive" ); - case B_Paste: return wxT( "B.Paste" ); - case F_Paste: return wxT( "F.Paste" ); - case B_SilkS: return wxT( "B.Silkscreen" ); - case F_SilkS: return wxT( "F.Silkscreen" ); - case B_Mask: return wxT( "B.Mask" ); - case F_Mask: return wxT( "F.Mask" ); + case PCB_LAYER_ID::B_Adhes: return wxT( "B.Adhesive" ); + case PCB_LAYER_ID::F_Adhes: return wxT( "F.Adhesive" ); + case PCB_LAYER_ID::B_Paste: return wxT( "B.Paste" ); + case PCB_LAYER_ID::F_Paste: return wxT( "F.Paste" ); + case PCB_LAYER_ID::B_SilkS: return wxT( "B.Silkscreen" ); + case PCB_LAYER_ID::F_SilkS: return wxT( "F.Silkscreen" ); + case PCB_LAYER_ID::B_Mask: return wxT( "B.Mask" ); + case PCB_LAYER_ID::F_Mask: return wxT( "F.Mask" ); // Users - case Dwgs_User: return wxT( "User.Drawings" ); - case Cmts_User: return wxT( "User.Comments" ); - case Eco1_User: return wxT( "User.Eco1" ); - case Eco2_User: return wxT( "User.Eco2" ); - case Edge_Cuts: return wxT( "Edge.Cuts" ); - case Margin: return wxT( "Margin" ); + case PCB_LAYER_ID::Dwgs_User: return wxT( "User.Drawings" ); + case PCB_LAYER_ID::Cmts_User: return wxT( "User.Comments" ); + case PCB_LAYER_ID::Eco1_User: return wxT( "User.Eco1" ); + case PCB_LAYER_ID::Eco2_User: return wxT( "User.Eco2" ); + case PCB_LAYER_ID::Edge_Cuts: return wxT( "Edge.Cuts" ); + case PCB_LAYER_ID::Margin: return wxT( "PCB_LAYER_ID::Margin" ); // Footprint - case F_CrtYd: return wxT( "F.Courtyard" ); - case B_CrtYd: return wxT( "B.Courtyard" ); - case F_Fab: return wxT( "F.Fab" ); - case B_Fab: return wxT( "B.Fab" ); + case PCB_LAYER_ID::F_CrtYd: return wxT( "F.Courtyard" ); + case PCB_LAYER_ID::B_CrtYd: return wxT( "B.Courtyard" ); + case PCB_LAYER_ID::F_Fab: return wxT( "F.Fab" ); + case PCB_LAYER_ID::B_Fab: return wxT( "B.Fab" ); // User definable layers. - case User_1: return wxT( "User.1" ); - case User_2: return wxT( "User.2" ); - case User_3: return wxT( "User.3" ); - case User_4: return wxT( "User.4" ); - case User_5: return wxT( "User.5" ); - case User_6: return wxT( "User.6" ); - case User_7: return wxT( "User.7" ); - case User_8: return wxT( "User.8" ); - case User_9: return wxT( "User.9" ); + case PCB_LAYER_ID::User_1: return wxT( "User.1" ); + case PCB_LAYER_ID::User_2: return wxT( "User.2" ); + case PCB_LAYER_ID::User_3: return wxT( "User.3" ); + case PCB_LAYER_ID::User_4: return wxT( "User.4" ); + case PCB_LAYER_ID::User_5: return wxT( "User.5" ); + case PCB_LAYER_ID::User_6: return wxT( "User.6" ); + case PCB_LAYER_ID::User_7: return wxT( "User.7" ); + case PCB_LAYER_ID::User_8: return wxT( "User.8" ); + case PCB_LAYER_ID::User_9: return wxT( "User.9" ); // Rescue - case Rescue: return _( "Rescue" ); + case PCB_LAYER_ID::Rescue: return _( "Rescue" ); // SCH_LAYER_ID @@ -197,3 +197,49 @@ wxString LayerName( int aLayer ) wxCHECK_MSG( false, wxEmptyString, wxString::Format( "Unknown layer ID %d", aLayer ) ); } } + + +PCB_LAYER_ID FlipLayer( PCB_LAYER_ID aLayerId, int aCopperLayersCount ) +{ + switch( aLayerId ) + { + case B_Cu: return F_Cu; + case F_Cu: return B_Cu; + + case B_SilkS: return F_SilkS; + case F_SilkS: return B_SilkS; + + case B_Adhes: return F_Adhes; + case F_Adhes: return B_Adhes; + + case B_Mask: return F_Mask; + case F_Mask: return B_Mask; + + case B_Paste: return F_Paste; + case F_Paste: return B_Paste; + + case B_CrtYd: return F_CrtYd; + case F_CrtYd: return B_CrtYd; + + case B_Fab: return F_Fab; + case F_Fab: return B_Fab; + + default: // change internal layer if aCopperLayersCount is >= 4 + if( IsCopperLayer( aLayerId ) && aCopperLayersCount >= 4 ) + { + // internal copper layers count is aCopperLayersCount-2 + PCB_LAYER_ID fliplayer = PCB_LAYER_ID(aCopperLayersCount - 2 - ( aLayerId - In1_Cu ) ); + // Ensure fliplayer has a value which does not crash Pcbnew: + if( fliplayer < F_Cu ) + fliplayer = F_Cu; + + if( fliplayer > B_Cu ) + fliplayer = B_Cu; + + return fliplayer; + } + + // No change for the other layers + return aLayerId; + } +} \ No newline at end of file diff --git a/common/lseq.cpp b/common/lseq.cpp new file mode 100644 index 0000000000..372035be44 --- /dev/null +++ b/common/lseq.cpp @@ -0,0 +1,23 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * 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 +#include + +#include diff --git a/common/lset.cpp b/common/lset.cpp index c6e7c72079..7a60bf2087 100644 --- a/common/lset.cpp +++ b/common/lset.cpp @@ -30,11 +30,14 @@ #include #include // for Clamp -#include // for LSET, PCB_LAYER_ID, LSEQ +#include // for PCB_LAYER_ID +#include #include // for arrayDim #include // for wxASSERT, wxASSERT_MSG #include +#include + LSET::LSET( const PCB_LAYER_ID* aArray, unsigned aCount ) : BASE_SET() @@ -631,121 +634,65 @@ LSEQ LSET::SeqStackupForPlotting() const } -PCB_LAYER_ID FlipLayer( PCB_LAYER_ID aLayerId, int aCopperLayersCount ) +LSET& LSET::Flip( int aCopperLayersCount ) { - switch( aLayerId ) - { - case B_Cu: return F_Cu; - case F_Cu: return B_Cu; + LSET oldMask = *this; - case B_SilkS: return F_SilkS; - case F_SilkS: return B_SilkS; + reset(); - case B_Adhes: return F_Adhes; - case F_Adhes: return B_Adhes; + if( oldMask.test( B_Cu ) ) + set( F_Cu ); - case B_Mask: return F_Mask; - case F_Mask: return B_Mask; + if( oldMask.test( F_Cu ) ) + set( B_Cu ); - case B_Paste: return F_Paste; - case F_Paste: return B_Paste; + if( oldMask.test( B_SilkS ) ) + set( F_SilkS ); - case B_CrtYd: return F_CrtYd; - case F_CrtYd: return B_CrtYd; + if( oldMask.test( F_SilkS ) ) + set( B_SilkS ); - case B_Fab: return F_Fab; - case F_Fab: return B_Fab; + if( oldMask.test( B_Adhes ) ) + set( F_Adhes ); - default: // change internal layer if aCopperLayersCount is >= 4 - if( IsCopperLayer( aLayerId ) && aCopperLayersCount >= 4 ) - { - // internal copper layers count is aCopperLayersCount-2 - PCB_LAYER_ID fliplayer = PCB_LAYER_ID(aCopperLayersCount - 2 - ( aLayerId - In1_Cu ) ); - // Ensure fliplayer has a value which does not crash Pcbnew: - if( fliplayer < F_Cu ) - fliplayer = F_Cu; + if( oldMask.test( F_Adhes ) ) + set( B_Adhes ); - if( fliplayer > B_Cu ) - fliplayer = B_Cu; + if( oldMask.test( B_Mask ) ) + set( F_Mask ); - return fliplayer; - } + if( oldMask.test( F_Mask ) ) + set( B_Mask ); - // No change for the other layers - return aLayerId; - } -} + if( oldMask.test( B_Paste ) ) + set( F_Paste ); + if( oldMask.test( F_Paste ) ) + set( B_Paste ); -LSET FlipLayerMask( LSET aMask, int aCopperLayersCount ) -{ - // layers on physical outside of a board: - const static LSET and_mask( 16, // !! update count - B_Cu, F_Cu, - B_SilkS, F_SilkS, - B_Adhes, F_Adhes, - B_Mask, F_Mask, - B_Paste, F_Paste, - B_Adhes, F_Adhes, - B_CrtYd, F_CrtYd, - B_Fab, F_Fab - ); + if( oldMask.test( B_Adhes ) ) + set( F_Adhes ); - LSET newMask = aMask & ~and_mask; + if( oldMask.test( F_Adhes ) ) + set( B_Adhes ); - if( aMask[B_Cu] ) - newMask.set( F_Cu ); + if( oldMask.test( B_CrtYd ) ) + set( F_CrtYd ); - if( aMask[F_Cu] ) - newMask.set( B_Cu ); + if( oldMask.test( F_CrtYd ) ) + set( B_CrtYd ); - if( aMask[B_SilkS] ) - newMask.set( F_SilkS ); + if( oldMask.test( B_Fab ) ) + set( F_Fab ); - if( aMask[F_SilkS] ) - newMask.set( B_SilkS ); - - if( aMask[B_Adhes] ) - newMask.set( F_Adhes ); - - if( aMask[F_Adhes] ) - newMask.set( B_Adhes ); - - if( aMask[B_Mask] ) - newMask.set( F_Mask ); - - if( aMask[F_Mask] ) - newMask.set( B_Mask ); - - if( aMask[B_Paste] ) - newMask.set( F_Paste ); - - if( aMask[F_Paste] ) - newMask.set( B_Paste ); - - if( aMask[B_Adhes] ) - newMask.set( F_Adhes ); - - if( aMask[F_Adhes] ) - newMask.set( B_Adhes ); - - if( aMask[B_CrtYd] ) - newMask.set( F_CrtYd ); - - if( aMask[F_CrtYd] ) - newMask.set( B_CrtYd ); - - if( aMask[B_Fab] ) - newMask.set( F_Fab ); - - if( aMask[F_Fab] ) - newMask.set( B_Fab ); + if( oldMask.test( F_Fab ) ) + set( B_Fab ); if( aCopperLayersCount >= 4 ) // Internal layers exist { - LSET internalMask = aMask & LSET::InternalCuMask(); + LSET internalMask = *this & InternalCuMask(); - if( internalMask != LSET::InternalCuMask() ) + if( internalMask != InternalCuMask() ) { // the mask does not include all internal layers. Therefore // the flipped mask for internal copper layers must be built @@ -757,17 +704,17 @@ LSET FlipLayerMask( LSET aMask, int aCopperLayersCount ) { if( internalMask[innerLayerCnt - ii] ) { - newMask.set( ii + In1_Cu ); + set( ii + In1_Cu ); } else { - newMask.reset( ii + In1_Cu ); + reset( ii + In1_Cu ); } } } } - return newMask; + return *this; } diff --git a/common/project/board_project_settings.cpp b/common/project/board_project_settings.cpp index 6158a6f634..2355988fc6 100644 --- a/common/project/board_project_settings.cpp +++ b/common/project/board_project_settings.cpp @@ -19,6 +19,8 @@ */ #include +#include +#include #include using namespace std::placeholders; diff --git a/common/project/project_local_settings.cpp b/common/project/project_local_settings.cpp index c7a0379de0..b006d4ce85 100644 --- a/common/project/project_local_settings.cpp +++ b/common/project/project_local_settings.cpp @@ -19,6 +19,7 @@ * with this program. If not, see . */ +#include #include #include #include diff --git a/gerbview/files.cpp b/gerbview/files.cpp index a9be129e15..93eec6e937 100644 --- a/gerbview/files.cpp +++ b/gerbview/files.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 114c278d36..e9caff4df1 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h index 8cdd152648..57eee5f549 100644 --- a/gerbview/gerbview_frame.h +++ b/gerbview/gerbview_frame.h @@ -24,6 +24,7 @@ #include #include +#include #include #include #include diff --git a/gerbview/gerbview_printout.cpp b/gerbview/gerbview_printout.cpp index 3dde2fa5dc..ebebc5514c 100644 --- a/gerbview/gerbview_printout.cpp +++ b/gerbview/gerbview_printout.cpp @@ -29,6 +29,9 @@ #include #include #include "gerbview_printout.h" + +#include +#include #include #include #include // for KiROUND diff --git a/gerbview/gerbview_printout.h b/gerbview/gerbview_printout.h index b283eae347..3d5f3edbb7 100644 --- a/gerbview/gerbview_printout.h +++ b/gerbview/gerbview_printout.h @@ -20,6 +20,7 @@ #ifndef GERBVIEW_PRINTOUT_H #define GERBVIEW_PRINTOUT_H +#include #include class GBR_LAYOUT; diff --git a/gerbview/widgets/gerbview_layer_widget.cpp b/gerbview/widgets/gerbview_layer_widget.cpp index b8ec42f572..67fb02c938 100644 --- a/gerbview/widgets/gerbview_layer_widget.cpp +++ b/gerbview/widgets/gerbview_layer_widget.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include diff --git a/include/board_design_settings.h b/include/board_design_settings.h index dc1b40a253..e77c76c636 100644 --- a/include/board_design_settings.h +++ b/include/board_design_settings.h @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include diff --git a/include/board_item.h b/include/board_item.h index 72fc1b6562..9b298d1670 100644 --- a/include/board_item.h +++ b/include/board_item.h @@ -28,6 +28,8 @@ #include #include +#include +#include #include #include #include diff --git a/include/board_printout.h b/include/board_printout.h index 7de963cb1a..8767cd3bee 100644 --- a/include/board_printout.h +++ b/include/board_printout.h @@ -30,6 +30,7 @@ #include #include +#include #include #include diff --git a/include/layer_ids.h b/include/layer_ids.h index 9df2c96d0b..2ed76d02f6 100644 --- a/include/layer_ids.h +++ b/include/layer_ids.h @@ -499,365 +499,6 @@ KICOMMON_API wxString LayerName( int aLayer ); ( 1 << GAL_LAYER_INDEX( LAYER_RATSNEST ) ) ) -/// A sequence of layers, a sequence provides a certain order. -typedef std::vector BASE_SEQ; - - -/** - * LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs. A sequence provides - * a certain order. - *

- * It can also be used as an iterator: - * - * - * for( LSEQ cu_stack = aSet.CuStack(); cu_stack; ++cu_stack ) - * { - * layer_id = *cu_stack; - * : - * things to do with layer_id; - * } - * - * - */ -class KICOMMON_API LSEQ : public BASE_SEQ -{ - unsigned m_index; - -public: - - LSEQ() : - m_index( 0 ) - {} - - template - LSEQ( InputIterator aStart, InputIterator aEnd ) : - BASE_SEQ( aStart, aEnd ), m_index( 0 ) - {} - - LSEQ( std::initializer_list aLayers ) : - BASE_SEQ( aLayers ), m_index( 0 ) - {} - - - operator bool () { return m_index < size(); } - - PCB_LAYER_ID operator * () const - { - return at( m_index ); // throws std::out_of_range - } - - int TestLayers( PCB_LAYER_ID aRhs, PCB_LAYER_ID aLhs ) const - { - if( aRhs == aLhs ) - return 0; - - auto itRhs = std::find( begin(), end(), aRhs ); - auto itLhs = std::find( begin(), end(), aLhs ); - - return std::distance( itRhs, itLhs ); - } -}; - - -typedef std::bitset BASE_SET; - - -/** - * LSET is a set of PCB_LAYER_IDs. It can be converted to numerous purpose LSEQs using - * the various member functions, most of which are based on Seq(). The advantage - * of converting to LSEQ using purposeful code, is it removes any dependency - * on order/sequence inherent in this set. - */ -class KICOMMON_API LSET : public BASE_SET -{ -public: - - // The constructor flavors are carefully chosen to prevent LSET( int ) from compiling. - // That excludes "LSET s = 0;" and excludes "LSET s = -1;", etc. - // LSET s = 0; needs to be removed from the code, this accomplishes that. - // Remember LSET( PCB_LAYER_ID(0) ) sets bit 0, so "LSET s = 0;" is illegal - // to prevent that surprise. Therefore LSET's constructor suite is significantly - // different than the base class from which it is derived. - - // Other member functions (non-constructor functions) are identical to the base - // class's and therefore are re-used from the base class. - - /** - * Create an empty (cleared) set. - */ - LSET() : - BASE_SET() // all bits are set to zero in BASE_SET() - { - } - - LSET( const BASE_SET& aOther ) : - BASE_SET( aOther ) - { - } - - /** - * Take a PCB_LAYER_ID and sets that bit. This makes the following code into - * a bug: - * - * LSET s = 0; - * - * Instead use: - * - * - * LSET s; - * - * - * for an empty set. - */ - LSET( PCB_LAYER_ID aLayer ) : // PCB_LAYER_ID deliberately excludes int and relatives - BASE_SET() - { - set( aLayer ); - } - - /** - * Create an array or LSEQ. - */ - LSET( const PCB_LAYER_ID* aArray, unsigned aCount ); - - /** - * Take one or more PCB_LAYER_IDs in the argument list to construct the set. Typically - * only used in static construction. - * - * @param aIdCount is the number of PCB_LAYER_IDs which follow. - * @param aFirst is the first included in @a aIdCount and must always be present, and can - * be followed by any number of additional PCB_LAYER_IDs so long as @a aIdCount accurately - * reflects the count. - * - * Parameter is 'int' to avoid va_start undefined behavior. - */ - LSET( unsigned aIdCount, int aFirst, ... ); // args chosen to prevent LSET( int ) from compiling - - LSET( const LSEQ& aSeq ); - - /** - * See if the layer set contains a PCB layer. - * - * @param aLayer is the layer to check - * @return true if the layer is included - */ - bool Contains( PCB_LAYER_ID aLayer ) - { - try - { - return test( aLayer ); - } - catch( std::out_of_range& ) - { - return false; - } - } - - /** - * Return the fixed name association with aLayerId. - */ - static const wxChar* Name( PCB_LAYER_ID aLayerId ); - - /** - * Return a complete set of internal copper layers which is all Cu layers - * except F_Cu and B_Cu. - */ - static LSET InternalCuMask(); - - /** - * Return a complete set of all top assembly layers which is all F_SilkS and F_Mask - */ - static LSET FrontAssembly(); - - /** - * Return a complete set of all bottom assembly layers which is all B_SilkS and B_Mask - */ - static LSET BackAssembly(); - - /** - * Return a mask holding the requested number of Cu PCB_LAYER_IDs. - */ - static LSET AllCuMask( int aCuLayerCount = MAX_CU_LAYERS ); - - /** - * Return a mask holding the Front and Bottom layers. - */ - static LSET ExternalCuMask(); - - /** - * Return a mask holding all layer minus CU layers. - */ - static LSET AllNonCuMask(); - - static LSET AllLayersMask(); - - /** - * Return a mask holding all technical layers (no CU layer) on front side. - */ - static LSET FrontTechMask(); - - /** - * Return a mask holding technical layers used in a board fabrication - * (no CU layer) on front side. - */ - static LSET FrontBoardTechMask(); - - /** - * Return a mask holding all technical layers (no CU layer) on back side. - */ - static LSET BackTechMask(); - - /** - * Return a mask holding technical layers used in a board fabrication - * (no CU layer) on Back side. - */ - static LSET BackBoardTechMask(); - - /** - * Return a mask holding all technical layers (no CU layer) on both side. - */ - static LSET AllTechMask(); - - /** - * Return a mask holding board technical layers (no CU layer) on both side. - */ - static LSET AllBoardTechMask(); - - /** - * Return a mask holding all technical layers and the external CU layer on front side. - */ - static LSET FrontMask(); - - /** - * Return a mask holding all technical layers and the external CU layer on back side. - */ - static LSET BackMask(); - - static LSET SideSpecificMask(); - - static LSET UserMask(); - - /** - * Return a mask holding all layers which are physically realized. Equivalent to the copper - * layers + the board tech mask. - */ - static LSET PhysicalLayersMask(); - - /** - * Return a mask with all of the allowable user defined layers. - */ - static LSET UserDefinedLayers(); - - /** - * Layers which are not allowed within footprint definitions. Currently internal - * copper layers and Margin. - */ - - static LSET ForbiddenFootprintLayers(); - - /** - * Return a sequence of copper layers in starting from the front/top - * and extending to the back/bottom. This specific sequence is depended upon - * in numerous places. - */ - LSEQ CuStack() const; - - /** - * Return a sequence of technical layers. A sequence provides a certain order. - * - * @param aSubToOmit is the subset of the technical layers to omit, defaults to none. - */ - LSEQ Technicals( LSET aSubToOmit = LSET() ) const; - - /// *_User layers. - LSEQ Users() const; - - /// Returns the technical and user layers in the order shown in layer widget - LSEQ TechAndUserUIOrder() const; - - LSEQ UIOrder() const; - - /** - * Return an LSEQ from the union of this LSET and a desired sequence. The LSEQ - * element will be in the same sequence as aWishListSequence if they are present. - * @param aWishListSequence establishes the order of the returned LSEQ, and the LSEQ will only - * contain PCB_LAYER_IDs which are present in this set. - * @param aCount is the length of aWishListSequence array. - */ - LSEQ Seq( const PCB_LAYER_ID* aWishListSequence, unsigned aCount ) const; - - LSEQ Seq( const LSEQ& aSequence ) const; - - /** - * Return a LSEQ from this LSET in ascending PCB_LAYER_ID order. Each LSEQ - * element will be in the same sequence as in PCB_LAYER_ID and only present - * in the resultant LSEQ if present in this set. Therefore the sequence is - * subject to change, use it only when enumeration and not order is important. - */ - LSEQ Seq() const; - - /** - * Generate a sequence of layers that represent a top to bottom stack of this set of layers. - * - * @param aSelectedLayer is the layer to put at the top of stack when defined. - * - * @return the top to bottom layer sequence. - */ - LSEQ SeqStackupTop2Bottom( PCB_LAYER_ID aSelectedLayer = UNDEFINED_LAYER ) const; - - /** - * Return the sequence that is typical for a bottom-to-top stack-up. - * For instance, to plot multiple layers in a single image, the top layers output last. - */ - LSEQ SeqStackupForPlotting() const; - - /** - * Execute a function on each layer of the LSET. - */ - void RunOnLayers( const std::function& aFunction ) const - { - for( size_t ii = 0; ii < size(); ++ii ) - { - if( test( ii ) ) - aFunction( PCB_LAYER_ID( ii ) ); - } - } - - /** - * Return a hex string showing contents of this LSEQ. - */ - std::string FmtHex() const; - - /** - * Convert the output of FmtHex() and replaces this set's values - * with those given in the input string. Parsing stops at the first - * non hex ASCII byte, except that marker bytes output from FmtHex are - * not terminators. - * @return int - number of bytes consumed - */ - int ParseHex( const char* aStart, int aCount ); - - /** - * Return a binary string showing contents of this LSEQ. - */ - std::string FmtBin() const; - - /** - * Find the first set PCB_LAYER_ID. Returns UNDEFINED_LAYER if more - * than one is set or UNSELECTED_LAYER if none is set. - */ - PCB_LAYER_ID ExtractLayer() const; - -private: - - /// Take this off the market, it may not be used because of LSET( PCB_LAYER_ID ). - LSET( unsigned long __val ) - { - // not usable, it's private. - } -}; - - /** * Test whether a given integer is a valid layer index, i.e. can * be safely put in a PCB_LAYER_ID @@ -1013,17 +654,6 @@ inline bool IsBackLayer( PCB_LAYER_ID aLayerId ) */ KICOMMON_API PCB_LAYER_ID FlipLayer( PCB_LAYER_ID aLayerId, int aCopperLayersCount = 0 ); -/** - * Calculate the mask layer when flipping a footprint. - * - * BACK and FRONT copper layers, mask, paste, solder layers are swapped - * internal layers are flipped only if the copper layers count is known - * @param aMask = the LSET to flip - * @param aCopperLayersCount = the number of copper layers. if 0 (in fact if < 4 ) - * internal layers will be not flipped because the layer count is not known - */ -KICOMMON_API LSET FlipLayerMask( LSET aMask, int aCopperLayersCount = 0 ); - /** * Returns a netname layer corresponding to the given layer. diff --git a/include/lseq.h b/include/lseq.h new file mode 100644 index 0000000000..6e0763059b --- /dev/null +++ b/include/lseq.h @@ -0,0 +1,86 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * 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 . + */ + +#ifndef LSEQ_H +#define LSEQ_H + +#include +#include + +/// A sequence of layers, a sequence provides a certain order. +typedef std::vector BASE_SEQ; + + +/** + * LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs. A sequence provides + * a certain order. + *

+ * It can also be used as an iterator: + * + * + * for( LSEQ cu_stack = aSet.CuStack(); cu_stack; ++cu_stack ) + * { + * layer_id = *cu_stack; + * : + * things to do with layer_id; + * } + * + * + */ +class KICOMMON_API LSEQ : public BASE_SEQ +{ + unsigned m_index; + +public: + + LSEQ() : + m_index( 0 ) + {} + + template + LSEQ( InputIterator aStart, InputIterator aEnd ) : + BASE_SEQ( aStart, aEnd ), m_index( 0 ) + {} + + LSEQ( std::initializer_list aLayers ) : + BASE_SEQ( aLayers ), m_index( 0 ) + {} + + + operator bool () { return m_index < size(); } + + PCB_LAYER_ID operator * () const + { + return at( m_index ); // throws std::out_of_range + } + + int TestLayers( PCB_LAYER_ID aRhs, PCB_LAYER_ID aLhs ) const + { + if( aRhs == aLhs ) + return 0; + + auto itRhs = std::find( begin(), end(), aRhs ); + auto itLhs = std::find( begin(), end(), aLhs ); + + return std::distance( itRhs, itLhs ); + } +}; + + +#endif // LSEQ_H diff --git a/include/lset.h b/include/lset.h new file mode 100644 index 0000000000..dadb2b1b91 --- /dev/null +++ b/include/lset.h @@ -0,0 +1,332 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * 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 . + */ + +#ifndef LSET_H +#define LSET_H + +#include + +#include + +class LSEQ; +typedef std::bitset BASE_SET; + + +/** + * LSET is a set of PCB_LAYER_IDs. It can be converted to numerous purpose LSEQs using + * the various member functions, most of which are based on Seq(). The advantage + * of converting to LSEQ using purposeful code, is it removes any dependency + * on order/sequence inherent in this set. + */ +class KICOMMON_API LSET : public BASE_SET +{ +public: + + // The constructor flavors are carefully chosen to prevent LSET( int ) from compiling. + // That excludes "LSET s = 0;" and excludes "LSET s = -1;", etc. + // LSET s = 0; needs to be removed from the code, this accomplishes that. + // Remember LSET( PCB_LAYER_ID(0) ) sets bit 0, so "LSET s = 0;" is illegal + // to prevent that surprise. Therefore LSET's constructor suite is significantly + // different than the base class from which it is derived. + + // Other member functions (non-constructor functions) are identical to the base + // class's and therefore are re-used from the base class. + + /** + * Create an empty (cleared) set. + */ + LSET() : + BASE_SET() // all bits are set to zero in BASE_SET() + { + } + + LSET( const BASE_SET& aOther ) : + BASE_SET( aOther ) + { + } + + /** + * Take a PCB_LAYER_ID and sets that bit. This makes the following code into + * a bug: + * + * LSET s = 0; + * + * Instead use: + * + * + * LSET s; + * + * + * for an empty set. + */ + LSET( PCB_LAYER_ID aLayer ) : // PCB_LAYER_ID deliberately excludes int and relatives + BASE_SET() + { + set( aLayer ); + } + + /** + * Create an array or LSEQ. + */ + LSET( const PCB_LAYER_ID* aArray, unsigned aCount ); + + /** + * Take one or more PCB_LAYER_IDs in the argument list to construct the set. Typically + * only used in static construction. + * + * @param aIdCount is the number of PCB_LAYER_IDs which follow. + * @param aFirst is the first included in @a aIdCount and must always be present, and can + * be followed by any number of additional PCB_LAYER_IDs so long as @a aIdCount accurately + * reflects the count. + * + * Parameter is 'int' to avoid va_start undefined behavior. + */ + LSET( unsigned aIdCount, int aFirst, ... ); // args chosen to prevent LSET( int ) from compiling + + LSET( const LSEQ& aSeq ); + + LSET( unsigned long __val ) = delete; + + /** + * See if the layer set contains a PCB layer. + * + * @param aLayer is the layer to check + * @return true if the layer is included + */ + bool Contains( PCB_LAYER_ID aLayer ) + { + try + { + return test( aLayer ); + } + catch( std::out_of_range& ) + { + return false; + } + } + + /** + * Return the fixed name association with aLayerId. + */ + static const wxChar* Name( PCB_LAYER_ID aLayerId ); + + /** + * Return a complete set of internal copper layers which is all Cu layers + * except F_Cu and B_Cu. + */ + static LSET InternalCuMask(); + + /** + * Return a complete set of all top assembly layers which is all F_SilkS and F_Mask + */ + static LSET FrontAssembly(); + + /** + * Return a complete set of all bottom assembly layers which is all B_SilkS and B_Mask + */ + static LSET BackAssembly(); + + /** + * Return a mask holding the requested number of Cu PCB_LAYER_IDs. + */ + static LSET AllCuMask( int aCuLayerCount = MAX_CU_LAYERS ); + + /** + * Return a mask holding the Front and Bottom layers. + */ + static LSET ExternalCuMask(); + + /** + * Return a mask holding all layer minus CU layers. + */ + static LSET AllNonCuMask(); + + static LSET AllLayersMask(); + + /** + * Return a mask holding all technical layers (no CU layer) on front side. + */ + static LSET FrontTechMask(); + + /** + * Return a mask holding technical layers used in a board fabrication + * (no CU layer) on front side. + */ + static LSET FrontBoardTechMask(); + + /** + * Return a mask holding all technical layers (no CU layer) on back side. + */ + static LSET BackTechMask(); + + /** + * Return a mask holding technical layers used in a board fabrication + * (no CU layer) on Back side. + */ + static LSET BackBoardTechMask(); + + /** + * Return a mask holding all technical layers (no CU layer) on both side. + */ + static LSET AllTechMask(); + + /** + * Return a mask holding board technical layers (no CU layer) on both side. + */ + static LSET AllBoardTechMask(); + + /** + * Return a mask holding all technical layers and the external CU layer on front side. + */ + static LSET FrontMask(); + + /** + * Return a mask holding all technical layers and the external CU layer on back side. + */ + static LSET BackMask(); + + static LSET SideSpecificMask(); + + static LSET UserMask(); + + /** + * Return a mask holding all layers which are physically realized. Equivalent to the copper + * layers + the board tech mask. + */ + static LSET PhysicalLayersMask(); + + /** + * Return a mask with all of the allowable user defined layers. + */ + static LSET UserDefinedLayers(); + + /** + * Layers which are not allowed within footprint definitions. Currently internal + * copper layers and Margin. + */ + + static LSET ForbiddenFootprintLayers(); + + /** + * Return a sequence of copper layers in starting from the front/top + * and extending to the back/bottom. This specific sequence is depended upon + * in numerous places. + */ + LSEQ CuStack() const; + + /** + * Return a sequence of technical layers. A sequence provides a certain order. + * + * @param aSubToOmit is the subset of the technical layers to omit, defaults to none. + */ + LSEQ Technicals( LSET aSubToOmit = LSET() ) const; + + /// *_User layers. + LSEQ Users() const; + + /// Returns the technical and user layers in the order shown in layer widget + LSEQ TechAndUserUIOrder() const; + + LSEQ UIOrder() const; + + /** + * Return an LSEQ from the union of this LSET and a desired sequence. The LSEQ + * element will be in the same sequence as aWishListSequence if they are present. + * @param aWishListSequence establishes the order of the returned LSEQ, and the LSEQ will only + * contain PCB_LAYER_IDs which are present in this set. + * @param aCount is the length of aWishListSequence array. + */ + LSEQ Seq( const PCB_LAYER_ID* aWishListSequence, unsigned aCount ) const; + + LSEQ Seq( const LSEQ& aSequence ) const; + + /** + * Return a LSEQ from this LSET in ascending PCB_LAYER_ID order. Each LSEQ + * element will be in the same sequence as in PCB_LAYER_ID and only present + * in the resultant LSEQ if present in this set. Therefore the sequence is + * subject to change, use it only when enumeration and not order is important. + */ + LSEQ Seq() const; + + /** + * Generate a sequence of layers that represent a top to bottom stack of this set of layers. + * + * @param aSelectedLayer is the layer to put at the top of stack when defined. + * + * @return the top to bottom layer sequence. + */ + LSEQ SeqStackupTop2Bottom( PCB_LAYER_ID aSelectedLayer = UNDEFINED_LAYER ) const; + + /** + * Return the sequence that is typical for a bottom-to-top stack-up. + * For instance, to plot multiple layers in a single image, the top layers output last. + */ + LSEQ SeqStackupForPlotting() const; + + /** + * Execute a function on each layer of the LSET. + */ + void RunOnLayers( const std::function& aFunction ) const + { + for( size_t ii = 0; ii < size(); ++ii ) + { + if( test( ii ) ) + aFunction( PCB_LAYER_ID( ii ) ); + } + } + + /** + * Return a hex string showing contents of this LSEQ. + */ + std::string FmtHex() const; + + /** + * Convert the output of FmtHex() and replaces this set's values + * with those given in the input string. Parsing stops at the first + * non hex ASCII byte, except that marker bytes output from FmtHex are + * not terminators. + * @return int - number of bytes consumed + */ + int ParseHex( const char* aStart, int aCount ); + + /** + * Return a binary string showing contents of this LSEQ. + */ + std::string FmtBin() const; + + /** + * Find the first set PCB_LAYER_ID. Returns UNDEFINED_LAYER if more + * than one is set or UNSELECTED_LAYER if none is set. + */ + PCB_LAYER_ID ExtractLayer() const; + + + /** + * Flip the layers in this set. + * + * BACK and FRONT copper layers, mask, paste, solder layers are swapped + * internal layers are flipped only if the copper layers count is known + * @param aMask = the LSET to flip + * @param aCopperLayersCount = the number of copper layers. if 0 (in fact if < 4 ) + * internal layers will be not flipped because the layer count is not known + */ + LSET& Flip( int aCopperLayersCount = 0 ); + +}; +#endif // LSET_H diff --git a/include/pcb_base_frame.h b/include/pcb_base_frame.h index f36a8d1b5d..85dc5b2f18 100644 --- a/include/pcb_base_frame.h +++ b/include/pcb_base_frame.h @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include diff --git a/include/project/board_project_settings.h b/include/project/board_project_settings.h index 889d4d6ba8..b51fadd0eb 100644 --- a/include/project/board_project_settings.h +++ b/include/project/board_project_settings.h @@ -22,6 +22,7 @@ #define KICAD_BOARD_PROJECT_SETTINGS_H #include +#include #include // Can be removed by refactoring PARAM_LAYER_PRESET diff --git a/include/render_settings.h b/include/render_settings.h index c9a7fa3f9c..4a67e9d1c2 100644 --- a/include/render_settings.h +++ b/include/render_settings.h @@ -29,6 +29,7 @@ #include #include +#include #include #include diff --git a/kicad/cli/command_pcb_export_base.cpp b/kicad/cli/command_pcb_export_base.cpp index 2bf8e7dc7d..54d0e58d87 100644 --- a/kicad/cli/command_pcb_export_base.cpp +++ b/kicad/cli/command_pcb_export_base.cpp @@ -23,6 +23,8 @@ #include #include #include +#include +#include #include #include diff --git a/kicad/cli/command_pcb_export_base.h b/kicad/cli/command_pcb_export_base.h index 3c05c900e2..4726548429 100644 --- a/kicad/cli/command_pcb_export_base.h +++ b/kicad/cli/command_pcb_export_base.h @@ -23,6 +23,8 @@ #include "command.h" #include +#include +#include namespace CLI { diff --git a/pcbnew/api/api_pcb_utils.cpp b/pcbnew/api/api_pcb_utils.cpp index e6da507630..23ef2eba50 100644 --- a/pcbnew/api/api_pcb_utils.cpp +++ b/pcbnew/api/api_pcb_utils.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/api/api_pcb_utils.h b/pcbnew/api/api_pcb_utils.h index 953dcac420..92063e96ea 100644 --- a/pcbnew/api/api_pcb_utils.h +++ b/pcbnew/api/api_pcb_utils.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include diff --git a/pcbnew/autorouter/ar_autoplacer.cpp b/pcbnew/autorouter/ar_autoplacer.cpp index d68de7343a..cf8f21576b 100644 --- a/pcbnew/autorouter/ar_autoplacer.cpp +++ b/pcbnew/autorouter/ar_autoplacer.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/autorouter/ar_autoplacer.h b/pcbnew/autorouter/ar_autoplacer.h index 4fbe81d81b..cdf9b05c47 100644 --- a/pcbnew/autorouter/ar_autoplacer.h +++ b/pcbnew/autorouter/ar_autoplacer.h @@ -33,6 +33,7 @@ #include #include +#include #include diff --git a/pcbnew/autorouter/ar_matrix.cpp b/pcbnew/autorouter/ar_matrix.cpp index 35cf8a9c07..4c22cd5f50 100644 --- a/pcbnew/autorouter/ar_matrix.cpp +++ b/pcbnew/autorouter/ar_matrix.cpp @@ -26,6 +26,7 @@ */ #include "ar_matrix.h" +#include #include // for KiROUND #include #include diff --git a/pcbnew/autorouter/ar_matrix.h b/pcbnew/autorouter/ar_matrix.h index 342077b455..dc0a0dde66 100644 --- a/pcbnew/autorouter/ar_matrix.h +++ b/pcbnew/autorouter/ar_matrix.h @@ -30,6 +30,7 @@ #define __AR_MATRIX_H #include +#include #include class PCB_SHAPE; diff --git a/pcbnew/board.cpp b/pcbnew/board.cpp index bb231ac49b..a97bc24d8d 100644 --- a/pcbnew/board.cpp +++ b/pcbnew/board.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/board.h b/pcbnew/board.h index f267bee561..2d81ab2814 100644 --- a/pcbnew/board.h +++ b/pcbnew/board.h @@ -31,6 +31,7 @@ #include // for OUTLINE_ERROR_HANDLER #include #include +#include #include #include #include diff --git a/pcbnew/board_commit.cpp b/pcbnew/board_commit.cpp index 628398886b..cc0a6bcfa0 100644 --- a/pcbnew/board_commit.cpp +++ b/pcbnew/board_commit.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/board_connected_item.cpp b/pcbnew/board_connected_item.cpp index 1a08d445a3..1dbbf97829 100644 --- a/pcbnew/board_connected_item.cpp +++ b/pcbnew/board_connected_item.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/board_design_settings.cpp b/pcbnew/board_design_settings.cpp index 507ff765e0..7f6ef201d2 100644 --- a/pcbnew/board_design_settings.cpp +++ b/pcbnew/board_design_settings.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/board_item.cpp b/pcbnew/board_item.cpp index 97e67cfb0b..dddaedd156 100644 --- a/pcbnew/board_item.cpp +++ b/pcbnew/board_item.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/board_stackup_manager/board_stackup.h b/pcbnew/board_stackup_manager/board_stackup.h index dd062b1cfb..dcfca399c3 100644 --- a/pcbnew/board_stackup_manager/board_stackup.h +++ b/pcbnew/board_stackup_manager/board_stackup.h @@ -29,6 +29,7 @@ #include #include #include +#include #include class BOARD; diff --git a/pcbnew/collectors.h b/pcbnew/collectors.h index 24a31a72f2..4ed6d08867 100644 --- a/pcbnew/collectors.h +++ b/pcbnew/collectors.h @@ -32,6 +32,7 @@ #include #include // LAYER_COUNT, layer defs +#include #include #include diff --git a/pcbnew/dialogs/dialog_map_layers.cpp b/pcbnew/dialogs/dialog_map_layers.cpp index 8811a7b41d..b12f6900ec 100644 --- a/pcbnew/dialogs/dialog_map_layers.cpp +++ b/pcbnew/dialogs/dialog_map_layers.cpp @@ -20,6 +20,7 @@ #include +#include #include #include diff --git a/pcbnew/drc/drc_engine.h b/pcbnew/drc/drc_engine.h index 82fd9130ff..708be67882 100644 --- a/pcbnew/drc/drc_engine.h +++ b/pcbnew/drc/drc_engine.h @@ -30,7 +30,7 @@ #include #include - +#include #include diff --git a/pcbnew/drc/drc_rule.h b/pcbnew/drc/drc_rule.h index a3ea2955fb..d38c1a9ce5 100644 --- a/pcbnew/drc/drc_rule.h +++ b/pcbnew/drc/drc_rule.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/exporters/step/exporter_step.h b/pcbnew/exporters/step/exporter_step.h index 39fee17110..8e72b9f3ed 100644 --- a/pcbnew/exporters/step/exporter_step.h +++ b/pcbnew/exporters/step/exporter_step.h @@ -29,6 +29,7 @@ #include #include #include +#include // Default value to chain 2 shapes when creating the board outlines // from shapes on Edges.Cut layer diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index 613f19ebd4..c3579abc4d 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/footprint.h b/pcbnew/footprint.h index 894e038b77..6331c90585 100644 --- a/pcbnew/footprint.h +++ b/pcbnew/footprint.h @@ -33,6 +33,7 @@ #include #include #include // ALL_LAYERS definition. +#include #include #include diff --git a/pcbnew/footprint_chooser_frame.cpp b/pcbnew/footprint_chooser_frame.cpp index f3122e98e7..20f541a273 100644 --- a/pcbnew/footprint_chooser_frame.cpp +++ b/pcbnew/footprint_chooser_frame.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/footprint_editor_settings.cpp b/pcbnew/footprint_editor_settings.cpp index cb5176050e..f30fa74c08 100644 --- a/pcbnew/footprint_editor_settings.cpp +++ b/pcbnew/footprint_editor_settings.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/grid_layer_box_helpers.cpp b/pcbnew/grid_layer_box_helpers.cpp index 82e44f19f5..57cfd5c278 100644 --- a/pcbnew/grid_layer_box_helpers.cpp +++ b/pcbnew/grid_layer_box_helpers.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/grid_layer_box_helpers.h b/pcbnew/grid_layer_box_helpers.h index edd837d1cd..5c453ceeae 100644 --- a/pcbnew/grid_layer_box_helpers.h +++ b/pcbnew/grid_layer_box_helpers.h @@ -27,6 +27,7 @@ #include #include #include "pcb_layer_box_selector.h" +#include class wxGrid; class PCB_LAYER_BOX_SELECTOR; diff --git a/pcbnew/initpcb.cpp b/pcbnew/initpcb.cpp index 69bac58806..e1fc4402ac 100644 --- a/pcbnew/initpcb.cpp +++ b/pcbnew/initpcb.cpp @@ -23,6 +23,7 @@ */ #include +#include #include #include #include diff --git a/pcbnew/pad.cpp b/pcbnew/pad.cpp index aea99890a8..2c3256d453 100644 --- a/pcbnew/pad.cpp +++ b/pcbnew/pad.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -873,7 +874,8 @@ void PAD::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) // PADS items are currently on all copper layers, or // currently, only on Front or Back layers. // So the copper layers count is not taken in account - SetLayerSet( FlipLayerMask( m_padStack.LayerSet() ) ); + LSET layerSet = m_padStack.LayerSet(); + SetLayerSet( layerSet.Flip() ); // Flip the basic shapes, in custom pads FlipPrimitives( aFlipLeftRight ); diff --git a/pcbnew/pad.h b/pcbnew/pad.h index d1d97bd1d3..5163a2c69a 100644 --- a/pcbnew/pad.h +++ b/pcbnew/pad.h @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/padstack.h b/pcbnew/padstack.h index 9610d316a4..9faad36a01 100644 --- a/pcbnew/padstack.h +++ b/pcbnew/padstack.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/pcb_base_frame.cpp b/pcbnew/pcb_base_frame.cpp index be0698ca26..c8847981c3 100644 --- a/pcbnew/pcb_base_frame.cpp +++ b/pcbnew/pcb_base_frame.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 01c2b12906..f071df267e 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/pcb_generator.h b/pcbnew/pcb_generator.h index dc2b901487..8fd86ee71f 100644 --- a/pcbnew/pcb_generator.h +++ b/pcbnew/pcb_generator.h @@ -29,6 +29,7 @@ #include #include +#include #include class EDIT_POINTS; diff --git a/pcbnew/pcb_group.h b/pcbnew/pcb_group.h index 5433547bb8..6e5fdedae9 100644 --- a/pcbnew/pcb_group.h +++ b/pcbnew/pcb_group.h @@ -32,6 +32,7 @@ #include #include +#include #include namespace KIGFX diff --git a/pcbnew/pcb_io/altium/altium_pcb.cpp b/pcbnew/pcb_io/altium/altium_pcb.cpp index ff882ad194..dfdaa5dfba 100644 --- a/pcbnew/pcb_io/altium/altium_pcb.cpp +++ b/pcbnew/pcb_io/altium/altium_pcb.cpp @@ -3423,7 +3423,7 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con case ALTIUM_LAYER::BOTTOM_LAYER: pad->SetLayer( B_Cu ); - pad->SetLayerSet( FlipLayerMask( PAD::SMDMask() ) ); + pad->SetLayerSet( PAD::SMDMask().Flip() ); break; case ALTIUM_LAYER::MULTI_LAYER: diff --git a/pcbnew/pcb_io/common/plugin_common_layer_mapping.h b/pcbnew/pcb_io/common/plugin_common_layer_mapping.h index fd123a81df..3dd0c05685 100644 --- a/pcbnew/pcb_io/common/plugin_common_layer_mapping.h +++ b/pcbnew/pcb_io/common/plugin_common_layer_mapping.h @@ -27,6 +27,7 @@ #include #include // PCB_LAYER_ID +#include /** * @brief Describes an imported layer and how it could be mapped to KiCad Layers diff --git a/pcbnew/pcb_io/eagle/pcb_io_eagle.h b/pcbnew/pcb_io/eagle/pcb_io_eagle.h index e97a9d45d4..94024b87c9 100644 --- a/pcbnew/pcb_io/eagle/pcb_io_eagle.h +++ b/pcbnew/pcb_io/eagle/pcb_io_eagle.h @@ -32,6 +32,7 @@ #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 d3fa0cea07..430ae31dbf 100644 --- a/pcbnew/pcb_io/easyeda/pcb_io_easyeda_parser.cpp +++ b/pcbnew/pcb_io/easyeda/pcb_io_easyeda_parser.cpp @@ -973,7 +973,7 @@ void PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer( else if( klayer == B_Cu ) { pad->SetLayer( B_Cu ); - pad->SetLayerSet( FlipLayerMask( PAD::SMDMask() ) ); + pad->SetLayerSet( PAD::SMDMask().Flip() ); pad->SetAttribute( PAD_ATTRIB::SMD ); } else if( elayer == wxS( "11" ) ) diff --git a/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro_parser.cpp b/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro_parser.cpp index 56e9432404..b4e8aa333e 100644 --- a/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro_parser.cpp +++ b/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro_parser.cpp @@ -654,7 +654,7 @@ std::unique_ptr PCB_IO_EASYEDAPRO_PARSER::createPAD( FOOTPRINT* } else if( klayer == B_Cu ) { - pad->SetLayerSet( FlipLayerMask( PAD::SMDMask() ) ); + pad->SetLayerSet( PAD::SMDMask().Flip() ); } pad->SetAttribute( PAD_ATTRIB::SMD ); diff --git a/pcbnew/pcb_io/fabmaster/import_fabmaster.cpp b/pcbnew/pcb_io/fabmaster/import_fabmaster.cpp index d66d6e2f5e..951f8f94c3 100644 --- a/pcbnew/pcb_io/fabmaster/import_fabmaster.cpp +++ b/pcbnew/pcb_io/fabmaster/import_fabmaster.cpp @@ -2432,7 +2432,7 @@ bool FABMASTER::loadFootprints( BOARD* aBoard ) if( pad.top ) newpad->SetLayerSet( PAD::SMDMask() ); else if( pad.bottom ) - newpad->SetLayerSet( FlipLayerMask( PAD::SMDMask() ) ); + newpad->SetLayerSet( PAD::SMDMask().Flip() ); } } diff --git a/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.h b/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.h index b2e676f26e..36bc51be00 100644 --- a/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.h +++ b/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.h @@ -31,6 +31,7 @@ #include #include #include +#include #include #include diff --git a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h index 9b8700b715..ccbc26bcc7 100644 --- a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h +++ b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include "widgets/report_severity.h" diff --git a/pcbnew/pcb_layer_box_selector.h b/pcbnew/pcb_layer_box_selector.h index e7b7508dc8..e9ce2c9b7c 100644 --- a/pcbnew/pcb_layer_box_selector.h +++ b/pcbnew/pcb_layer_box_selector.h @@ -25,6 +25,7 @@ #ifndef PCB_LAYER_BOX_SELECTOR_H #define PCB_LAYER_BOX_SELECTOR_H +#include #include class PCB_BASE_FRAME; diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 91acd48334..6bd4a260a0 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -44,6 +44,7 @@ #include #include +#include #include #include #include diff --git a/pcbnew/pcb_plot_params.cpp b/pcbnew/pcb_plot_params.cpp index ee55951745..a3432d0e2d 100644 --- a/pcbnew/pcb_plot_params.cpp +++ b/pcbnew/pcb_plot_params.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include // for KiROUND #include diff --git a/pcbnew/pcb_shape.cpp b/pcbnew/pcb_shape.cpp index 41fc4d0c29..7ce2ddf7a2 100644 --- a/pcbnew/pcb_shape.cpp +++ b/pcbnew/pcb_shape.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/pcb_track.cpp b/pcbnew/pcb_track.cpp index e01a4e2434..03d9af4c18 100644 --- a/pcbnew/pcb_track.cpp +++ b/pcbnew/pcb_track.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/pcb_track.h b/pcbnew/pcb_track.h index 7d17962471..214544a266 100644 --- a/pcbnew/pcb_track.h +++ b/pcbnew/pcb_track.h @@ -43,6 +43,7 @@ #include #include #include +#include #include class PCB_TRACK; diff --git a/pcbnew/pcbexpr_evaluator.cpp b/pcbnew/pcbexpr_evaluator.cpp index 647d63c984..9cd7c79ff4 100644 --- a/pcbnew/pcbexpr_evaluator.cpp +++ b/pcbnew/pcbexpr_evaluator.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/pcbexpr_functions.cpp b/pcbnew/pcbexpr_functions.cpp index 438a1bc4a1..87bccc220d 100644 --- a/pcbnew/pcbexpr_functions.cpp +++ b/pcbnew/pcbexpr_functions.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/pcbnew_jobs_handler.cpp b/pcbnew/pcbnew_jobs_handler.cpp index 4d5190ebfc..6b215a2321 100644 --- a/pcbnew/pcbnew_jobs_handler.cpp +++ b/pcbnew/pcbnew_jobs_handler.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/pcbnew_printout.cpp b/pcbnew/pcbnew_printout.cpp index 0010c3d92c..a1e3f15162 100644 --- a/pcbnew/pcbnew_printout.cpp +++ b/pcbnew/pcbnew_printout.cpp @@ -29,6 +29,7 @@ #include #include // for KiROUND #include +#include #include #include #include diff --git a/pcbnew/pcbnew_printout.h b/pcbnew/pcbnew_printout.h index a7dbd94393..49ef4fab9b 100644 --- a/pcbnew/pcbnew_printout.h +++ b/pcbnew/pcbnew_printout.h @@ -22,6 +22,7 @@ #define PCBNEW_PRINTOUT_H #include +#include #include #include diff --git a/pcbnew/pcbnew_settings.cpp b/pcbnew/pcbnew_settings.cpp index 1374fe97f9..89075ae255 100644 --- a/pcbnew/pcbnew_settings.cpp +++ b/pcbnew/pcbnew_settings.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -129,7 +130,7 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS() &m_AuiPanels.show_search, false ) ); m_params.emplace_back( new PARAM( "aui.show_net_inspector", - &m_AuiPanels.show_net_inspector, false ) ); + &m_AuiPanels.show_net_inspector, false ) ); m_params.emplace_back( new PARAM( "footprint_chooser.width", &m_FootprintChooser.width, -1 ) ); diff --git a/pcbnew/pcbplot.cpp b/pcbnew/pcbplot.cpp index da62aad193..477f2d320a 100644 --- a/pcbnew/pcbplot.cpp +++ b/pcbnew/pcbplot.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/pcbplot.h b/pcbnew/pcbplot.h index c32d3ae939..9ba0c72fa0 100644 --- a/pcbnew/pcbplot.h +++ b/pcbnew/pcbplot.h @@ -24,6 +24,7 @@ #ifndef PCBPLOT_H_ #define PCBPLOT_H_ +#include #include // for PAD_DRILL_SHAPE #include #include diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index 3265ff5282..34bf34430d 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index 7acdcba493..724dd51829 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -41,6 +41,7 @@ #include #include // for GBR_NETLIST_METADATA #include // for LSET, IsCopperLayer +#include #include #include // for PCB_PLOT_PARAMS, PCB_PL... #include diff --git a/pcbnew/plotcontroller.h b/pcbnew/plotcontroller.h index c2754507bf..51e06fbba8 100644 --- a/pcbnew/plotcontroller.h +++ b/pcbnew/plotcontroller.h @@ -32,6 +32,7 @@ #include #include +#include class PLOTTER; class BOARD; diff --git a/pcbnew/sel_layer.cpp b/pcbnew/sel_layer.cpp index 14c472a1ff..48ca2e1774 100644 --- a/pcbnew/sel_layer.cpp +++ b/pcbnew/sel_layer.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include #include diff --git a/pcbnew/toolbars_footprint_editor.cpp b/pcbnew/toolbars_footprint_editor.cpp index 50f4404ca4..fa60e17b76 100644 --- a/pcbnew/toolbars_footprint_editor.cpp +++ b/pcbnew/toolbars_footprint_editor.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/tools/pcb_grid_helper.h b/pcbnew/tools/pcb_grid_helper.h index 186c02869b..64ef88f81a 100644 --- a/pcbnew/tools/pcb_grid_helper.h +++ b/pcbnew/tools/pcb_grid_helper.h @@ -27,6 +27,8 @@ #define PCB_GRID_HELPER_H #include + +#include #include #include diff --git a/pcbnew/tracks_cleaner.cpp b/pcbnew/tracks_cleaner.cpp index c1d4306e41..e661fd082e 100644 --- a/pcbnew/tracks_cleaner.cpp +++ b/pcbnew/tracks_cleaner.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/undo_redo.cpp b/pcbnew/undo_redo.cpp index 1758a3bb63..78cbb3b474 100644 --- a/pcbnew/undo_redo.cpp +++ b/pcbnew/undo_redo.cpp @@ -34,6 +34,7 @@ using namespace std::placeholders; #include #include #include +#include #include #include #include diff --git a/pcbnew/zone.cpp b/pcbnew/zone.cpp index e7be6c9cf9..da0316049a 100644 --- a/pcbnew/zone.cpp +++ b/pcbnew/zone.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -733,7 +734,7 @@ void ZONE::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) fillsCopy[oldLayer] = *shapePtr; } - SetLayerSet( FlipLayerMask( GetLayerSet(), GetBoard()->GetCopperLayerCount() ) ); + SetLayerSet( GetLayerSet().Flip( GetBoard()->GetCopperLayerCount() ) ); for( auto& [oldLayer, shape] : fillsCopy ) { diff --git a/pcbnew/zone.h b/pcbnew/zone.h index 0fb908d7bf..27f7310be7 100644 --- a/pcbnew/zone.h +++ b/pcbnew/zone.h @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/zone_settings.cpp b/pcbnew/zone_settings.cpp index 458e0b5307..2b8ea9b6e6 100644 --- a/pcbnew/zone_settings.cpp +++ b/pcbnew/zone_settings.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include diff --git a/pcbnew/zone_settings.h b/pcbnew/zone_settings.h index 2085732986..aabc1df095 100644 --- a/pcbnew/zone_settings.h +++ b/pcbnew/zone_settings.h @@ -31,6 +31,7 @@ #define ZONE_SETTINGS_H_ #include +#include #include #include #include diff --git a/qa/tests/common/test_layer_ids.cpp b/qa/tests/common/test_layer_ids.cpp index 0a6aa73874..97ddc1de64 100644 --- a/qa/tests/common/test_layer_ids.cpp +++ b/qa/tests/common/test_layer_ids.cpp @@ -20,6 +20,8 @@ #include #include +#include +#include BOOST_AUTO_TEST_SUITE( LayerIds ) diff --git a/qa/tests/pcbnew/test_lset.cpp b/qa/tests/pcbnew/test_lset.cpp index 0aae7a9879..2d95415df1 100644 --- a/qa/tests/pcbnew/test_lset.cpp +++ b/qa/tests/pcbnew/test_lset.cpp @@ -24,6 +24,8 @@ #include #include +#include + BOOST_AUTO_TEST_SUITE( LSet )