Split out arrayDim and MIRROR templates from macros.h
These were not macros
This commit is contained in:
parent
024812e5dd
commit
16e3e59495
|
@ -45,6 +45,7 @@
|
|||
#include <trigo.h>
|
||||
#include <vector>
|
||||
#include <thread>
|
||||
#include <core/arraydim.h>
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <board_stackup_manager/class_board_stackup.h>
|
||||
#include <board_stackup_manager/stackup_predefined_prms.h>
|
||||
#include <board.h>
|
||||
#include <core/arraydim.h>
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
#include <gal/dpi_scaling.h>
|
||||
#include <pgm_base.h>
|
||||
|
|
|
@ -28,9 +28,9 @@
|
|||
*/
|
||||
|
||||
#include "cogl_att_list.h"
|
||||
#include <macros.h>
|
||||
#include <wx/glcanvas.h>
|
||||
#include <wx/debug.h>
|
||||
#include <core/arraydim.h>
|
||||
|
||||
/**
|
||||
* Attributes list to be passed to a wxGLCanvas creation.
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <base_screen.h>
|
||||
#include <confirm.h>
|
||||
#include <core/arraydim.h>
|
||||
#include <dialog_page_settings.h>
|
||||
#include <eda_draw_frame.h>
|
||||
#include <eda_item.h>
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <base_screen.h>
|
||||
#include <bitmaps.h>
|
||||
#include <confirm.h>
|
||||
#include <core/arraydim.h>
|
||||
#include <dialog_shim.h>
|
||||
#include <eda_draw_frame.h>
|
||||
#include <filehistory.h>
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <pgm_base.h>
|
||||
#include <common.h>
|
||||
#include <confirm.h>
|
||||
#include <core/arraydim.h>
|
||||
#include <gestfich.h>
|
||||
|
||||
void AddDelimiterString( wxString& string )
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <kiway_express.h>
|
||||
#include <pgm_base.h>
|
||||
#include <config.h>
|
||||
#include <core/arraydim.h>
|
||||
#include <id.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <logging.h>
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <iostream> // for string, endl, basic_ost...
|
||||
#include <stddef.h> // for size_t
|
||||
|
||||
#include <core/arraydim.h>
|
||||
#include <math/util.h> // for Clamp
|
||||
#include <layers_id_colors_and_visibility.h> // for LSET, PCB_LAYER_ID, LSEQ
|
||||
#include <macros.h> // for arrayDim
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include "base_screen.h"
|
||||
#include "marker_base.h"
|
||||
#include <core/arraydim.h>
|
||||
#include <geometry/shape_line_chain.h>
|
||||
#include <render_settings.h>
|
||||
#include "dialog_display_info_HTML_base.h"
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include <build_version.h>
|
||||
#include <config_params.h>
|
||||
#include <confirm.h>
|
||||
#include <core/arraydim.h>
|
||||
#include <dialogs/dialog_configure_paths.h>
|
||||
#include <eda_base_frame.h>
|
||||
#include <eda_draw_frame.h>
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include <config_params.h>
|
||||
#include <confirm.h>
|
||||
#include <core/arraydim.h>
|
||||
#include <fp_lib_table.h>
|
||||
#include <kicad_string.h>
|
||||
#include <kiface_ids.h>
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <wx/wfstream.h>
|
||||
#include <wx/zipstrm.h>
|
||||
|
||||
#include <core/arraydim.h>
|
||||
#include <macros.h>
|
||||
#include <project/project_archiver.h>
|
||||
#include <reporter.h>
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <class_draw_panel_gal.h>
|
||||
#include <eda_draw_frame.h>
|
||||
|
||||
#include <core/arraydim.h>
|
||||
#include <core/optional.h>
|
||||
#include <wx/stc/stc.h>
|
||||
#include <kiplatform/app.h>
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
#include <tool/tool_manager.h>
|
||||
#include <tools/ee_selection_tool.h>
|
||||
#include <eeschema_settings.h>
|
||||
#include <core/arraydim.h>
|
||||
|
||||
#define FIELD_PADDING Mils2iu( 10 ) // arbitrarily chosen for aesthetics
|
||||
#define FIELD_PADDING_ALIGNED Mils2iu( 18 ) // aligns 50 mil text to a 100 mil grid
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <pin_type.h>
|
||||
#include <lib_pin.h>
|
||||
#include <base_units.h>
|
||||
#include <macros.h>
|
||||
#include <core/arraydim.h>
|
||||
|
||||
|
||||
// These are true singletons so it's OK for them to be globals.
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <base_units.h>
|
||||
#include <common.h>
|
||||
#include <eda_draw_frame.h>
|
||||
#include <macros.h>
|
||||
#include <core/mirror.h>
|
||||
#include <sch_bitmap.h>
|
||||
#include <trigo.h>
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include <sch_draw_panel.h>
|
||||
#include <bitmaps.h>
|
||||
#include <core/mirror.h>
|
||||
#include <schematic.h>
|
||||
#include <sch_bus_entry.h>
|
||||
#include <sch_edit_frame.h>
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <sch_edit_frame.h>
|
||||
#include <widgets/msgpanel.h>
|
||||
#include <bitmaps.h>
|
||||
#include <core/mirror.h>
|
||||
#include <lib_rectangle.h>
|
||||
#include <lib_pin.h>
|
||||
#include <lib_text.h>
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <sch_edit_frame.h>
|
||||
#include <plotter.h>
|
||||
#include <bitmaps.h>
|
||||
#include <core/mirror.h>
|
||||
#include <kiway.h>
|
||||
#include <general.h>
|
||||
#include <class_library.h>
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <common.h>
|
||||
#include <plotter.h>
|
||||
#include <bitmaps.h>
|
||||
#include <macros.h>
|
||||
#include <core/mirror.h>
|
||||
#include <geometry/shape_rect.h>
|
||||
#include <sch_painter.h>
|
||||
#include <sch_junction.h>
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <core/mirror.h>
|
||||
#include <sch_painter.h>
|
||||
#include <plotter.h>
|
||||
#include <sch_line.h>
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <sch_no_connect.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <default_values.h> // For some default values
|
||||
#include <macros.h>
|
||||
#include <core/mirror.h>
|
||||
#include <trigo.h>
|
||||
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include <sch_plugins/cadstar/cadstar_sch_archive_loader.h>
|
||||
|
||||
#include <core/mirror.h>
|
||||
#include <eda_text.h>
|
||||
#include <lib_arc.h>
|
||||
#include <lib_polyline.h>
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <core/mirror.h>
|
||||
#include <sch_draw_panel.h>
|
||||
#include <gr_text.h>
|
||||
#include <trigo.h>
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include <dialogs/html_messagebox.h>
|
||||
#include <project/project_file.h>
|
||||
#include <project/net_settings.h>
|
||||
#include <core/mirror.h>
|
||||
#include <dialog_helpers.h>
|
||||
#include <trigo.h>
|
||||
|
||||
|
|
|
@ -18,10 +18,9 @@
|
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <macros.h>
|
||||
#include <core/arraydim.h>
|
||||
|
||||
#include "panel_gerbview_settings.h"
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <X2_gerber_attributes.h>
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <core/arraydim.h>
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <gerber_file_image_list.h>
|
||||
#include <core/arraydim.h>
|
||||
#include <view/view.h>
|
||||
#include <gerbview_painter.h>
|
||||
#include <gal/graphics_abstraction_layer.h>
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 KiCad Developers, see CHANGELOG.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, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-3.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 3 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef ARRAYDIM_H
|
||||
#define ARRAYDIM_H
|
||||
|
||||
/// # of elements in an array. This implements type-safe compile time checking
|
||||
template <typename T, std::size_t N>
|
||||
constexpr std::size_t arrayDim( T const ( & )[N] ) noexcept
|
||||
{
|
||||
return N;
|
||||
}
|
||||
|
||||
#endif /* ARRAYDIM_H */
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 KiCad Developers, see CHANGELOG.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, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-3.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 3 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef MIRROR_H
|
||||
#define MIRROR_H
|
||||
|
||||
/**
|
||||
* Function MIRRORVAL
|
||||
* Mirror @a aPoint in @a aMirrorRef.
|
||||
*/
|
||||
template <typename T>
|
||||
T MIRRORVAL( T aPoint, T aMirrorRef )
|
||||
{
|
||||
return -( aPoint - aMirrorRef ) + aMirrorRef;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function MIRROR
|
||||
* Mirror @a aPoint in @a aMirrorRef.
|
||||
*/
|
||||
template <typename T>
|
||||
void MIRROR( T& aPoint, const T& aMirrorRef )
|
||||
{
|
||||
aPoint = MIRRORVAL( aPoint, aMirrorRef );
|
||||
}
|
||||
|
||||
#endif /* MIRROR_H */
|
|
@ -116,26 +116,4 @@ static inline wxString FROM_UTF8( const char* cstring )
|
|||
return line;
|
||||
}
|
||||
|
||||
/// # of elements in an array. This implements type-safe compile time checking
|
||||
template <typename T, std::size_t N>
|
||||
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
|
||||
{
|
||||
return N;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function MIRROR
|
||||
* Mirror @a aPoint in @a aMirrorRef.
|
||||
*/
|
||||
template<typename T>
|
||||
T MIRRORVAL( T aPoint, T aMirrorRef )
|
||||
{
|
||||
return -( aPoint - aMirrorRef ) + aMirrorRef;
|
||||
}
|
||||
template<typename T>
|
||||
void MIRROR( T& aPoint, const T& aMirrorRef )
|
||||
{
|
||||
aPoint = MIRRORVAL( aPoint, aMirrorRef );
|
||||
}
|
||||
|
||||
#endif // MACROS_H
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <kiface_i.h>
|
||||
#include <pgm_base.h>
|
||||
#include <bitmaps.h>
|
||||
#include <core/arraydim.h>
|
||||
#include <eda_item.h>
|
||||
#include <page_layout/ws_data_item.h>
|
||||
#include <page_layout/ws_data_model.h>
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <zone.h>
|
||||
#include <pcb_marker.h>
|
||||
#include <pcb_target.h>
|
||||
#include <core/arraydim.h>
|
||||
#include <core/kicad_algo.h>
|
||||
#include <connectivity/connectivity_data.h>
|
||||
#include <kicad_string.h>
|
||||
|
|
|
@ -27,9 +27,9 @@
|
|||
* @file dielectric_material.cpp
|
||||
*/
|
||||
|
||||
#include <macros.h>
|
||||
#include "stackup_predefined_prms.h"
|
||||
#include "dielectric_material.h"
|
||||
#include <core/arraydim.h>
|
||||
|
||||
|
||||
// A list of available substrate material
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include "class_board_stackup.h"
|
||||
#include <convert_to_biu.h>
|
||||
#include <core/arraydim.h>
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
#include <board_design_settings.h>
|
||||
#include <i18n_utility.h> // _HKI definition
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <wildcards_and_files_ext.h>
|
||||
#include <reporter.h>
|
||||
#include <confirm.h>
|
||||
#include <core/arraydim.h>
|
||||
#include <core/kicad_algo.h>
|
||||
#include <pcbplot.h>
|
||||
#include <locale_io.h>
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
|
||||
#include <confirm.h>
|
||||
#include <core/arraydim.h>
|
||||
#include <pcb_edit_frame.h>
|
||||
#include <pcbnew_settings.h>
|
||||
#include <pcbplot.h>
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <board.h>
|
||||
#include <footprint.h>
|
||||
#include <confirm.h>
|
||||
#include <core/arraydim.h>
|
||||
#include <convert_basic_shapes_to_polygon.h> // for enum RECT_CHAMFER_POSITIONS definition
|
||||
#include <geometry/shape_segment.h>
|
||||
#include <dialog_pad_properties.h>
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <kiface_i.h>
|
||||
#include <confirm.h>
|
||||
#include <core/arraydim.h>
|
||||
#include <base_units.h>
|
||||
#include <pcbnew_settings.h>
|
||||
#include <pcbplot.h>
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
|
||||
#include <confirm.h>
|
||||
#include <core/arraydim.h>
|
||||
#include <core/kicad_algo.h>
|
||||
#include <pcbnew.h>
|
||||
#include <pcb_edit_frame.h>
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <footprint.h>
|
||||
#include <track.h>
|
||||
#include <confirm.h>
|
||||
#include <core/arraydim.h>
|
||||
#include <dialogs/dialog_gencad_export_options.h>
|
||||
#include <locale_io.h>
|
||||
#include <hash_eda.h>
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "track.h"
|
||||
#include "zone.h"
|
||||
#include "convert_to_biu.h"
|
||||
#include <core/arraydim.h>
|
||||
#include <filename_resolver.h>
|
||||
#include "plugins/3dapi/ifsg_all.h"
|
||||
#include "streamwrapper.h"
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
|
||||
#include <confirm.h>
|
||||
#include <core/arraydim.h>
|
||||
#include <kicad_string.h>
|
||||
#include <gestfich.h>
|
||||
#include <pcb_edit_frame.h>
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <core/mirror.h>
|
||||
#include <confirm.h>
|
||||
#include <refdes_utils.h>
|
||||
#include <bitmaps.h>
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
#include <bitmaps.h>
|
||||
#include <core/mirror.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
#include <settings/color_settings.h>
|
||||
#include <settings/settings_manager.h>
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <base_units.h>
|
||||
#include <bitmaps.h>
|
||||
#include <board.h>
|
||||
#include <core/mirror.h>
|
||||
#include <footprint.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <trigo.h>
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include <base_units.h>
|
||||
#include <bitmaps.h>
|
||||
#include <core/mirror.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
#include <eda_draw_frame.h>
|
||||
#include <geometry/shape_circle.h>
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <pcb_marker.h>
|
||||
#include <dimension.h>
|
||||
#include <pcb_target.h>
|
||||
#include <core/arraydim.h>
|
||||
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
#include <pcb_painter.h>
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <base_units.h>
|
||||
#include <bitmaps.h>
|
||||
#include <board.h>
|
||||
#include <core/mirror.h>
|
||||
#include <pcb_text.h>
|
||||
#include <pcb_painter.h>
|
||||
#include <trigo.h>
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <math/util.h> // for KiROUND
|
||||
|
||||
#include <board.h>
|
||||
#include <core/arraydim.h>
|
||||
#include <footprint.h>
|
||||
#include <track.h>
|
||||
#include <fp_shape.h>
|
||||
|
|
|
@ -57,6 +57,7 @@ Load() TODO's
|
|||
#include <wx/filename.h>
|
||||
|
||||
#include <convert_basic_shapes_to_polygon.h>
|
||||
#include <core/arraydim.h>
|
||||
#include <geometry/geometry_utils.h>
|
||||
#include <kicad_string.h>
|
||||
#include <locale_io.h>
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <pcb_target.h>
|
||||
#include <fp_shape.h>
|
||||
#include <confirm.h>
|
||||
#include <core/arraydim.h>
|
||||
#include <locale_io.h>
|
||||
#include <zones.h>
|
||||
#include <plugins/kicad/kicad_plugin.h>
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <bitmaps.h>
|
||||
#include <geometry/geometry_utils.h>
|
||||
#include <geometry/shape_null.h>
|
||||
#include <core/mirror.h>
|
||||
#include <advanced_config.h>
|
||||
#include <pcb_edit_frame.h>
|
||||
#include <pcb_screen.h>
|
||||
|
|
Loading…
Reference in New Issue