diff --git a/common/eda_text.cpp b/common/eda_text.cpp index 9cb3cfbfe6..cb8c84892d 100644 --- a/common/eda_text.cpp +++ b/common/eda_text.cpp @@ -48,6 +48,7 @@ #include <font/outline_font.h> #include <geometry/shape_poly_set.h> #include <properties/property_validators.h> +#include <ctl_flags.h> // for CTL_OMIT_HIDE definition #include <wx/debug.h> // for wxASSERT #include <wx/string.h> diff --git a/include/ctl_flags.h b/include/ctl_flags.h new file mode 100644 index 0000000000..df1e373d94 --- /dev/null +++ b/include/ctl_flags.h @@ -0,0 +1,44 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2024 Jean-Pierre Charras. + * 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 <http://www.gnu.org/licenses/>. + */ + +#pragma once + +// These flags are used to control the data items that must be disabled when creating +// mainly a netlist but also some other kicad files. +// They allow skipping specified data in these files. + +#define CTL_OMIT_EXTRA (1 << 0) +#define CTL_OMIT_NETS (1 << 1) +#define CTL_OMIT_PAD_NETS (1 << 1) ///< Omit pads net names (useless in library) +#define CTL_OMIT_FILTERS (1 << 2) +#define CTL_OMIT_UUIDS (1 << 2) ///< Omit component unique ids (useless in library) +#define CTL_OMIT_FP_UUID (1 << 3) ///< Don't prefix the footprint UUID to the sheet path. +#define CTL_OMIT_INITIAL_COMMENTS (1 << 3) ///< omit FOOTPRINT initial comments +#define CTL_OMIT_PATH (1 << 4) ///< Omit component sheet time stamp (useless in library) +#define CTL_OMIT_AT (1 << 5) ///< Omit position and rotation. (always saved + ///< with position 0,0 and rotation = 0 in library). + +// If set, when calling EDA_TEXT::Format, disable writing the "hide" keyword in save file +#define CTL_OMIT_HIDE (1 << 6) + +#define CTL_OMIT_LIBNAME (1 << 7) ///< Omit lib alias when saving (used for + ///< board/not library). +#define CTL_OMIT_FOOTPRINT_VERSION (1 << 8) ///< Omit the version string from the (footprint) + ///< sexpr group diff --git a/include/eda_text.h b/include/eda_text.h index c625a2fc81..ba2262212a 100644 --- a/include/eda_text.h +++ b/include/eda_text.h @@ -33,6 +33,7 @@ #include <font/glyph.h> #include <font/text_attributes.h> + class OUTPUTFORMATTER; class SHAPE_COMPOUND; class SHAPE_POLY_SET; @@ -60,11 +61,6 @@ namespace KIFONT using KIGFX::RENDER_SETTINGS; using KIGFX::COLOR4D; -// part of the kicad_plugin.h family of defines. -// See kicad_plugin.h for the choice of the value -// When set when calling EDA_TEXT::Format, disable writing the "hide" keyword in save file -#define CTL_OMIT_HIDE (1 << 6) - /** * This is the "default-of-the-default" hardcoded text size; individual application define their diff --git a/pcbnew/netlist_reader/pcb_netlist.h b/pcbnew/netlist_reader/pcb_netlist.h index f3300fe66b..4e406ffd6e 100644 --- a/pcbnew/netlist_reader/pcb_netlist.h +++ b/pcbnew/netlist_reader/pcb_netlist.h @@ -32,6 +32,7 @@ #include <lib_id.h> #include <footprint.h> +#include <ctl_flags.h> class REPORTER; @@ -293,11 +294,6 @@ public: void Format( const char* aDocName, OUTPUTFORMATTER* aOut, int aNestLevel, int aCtl = 0 ); -#define CTL_OMIT_EXTRA (1<<0) -#define CTL_OMIT_NETS (1<<1) -#define CTL_OMIT_FILTERS (1<<2) -#define CTL_OMIT_FP_UUID (1<<3) ///< Don't prefix the footprint UUID to the sheet path. - #define CTL_FOR_CVPCB (CTL_OMIT_NETS | CTL_OMIT_FILTERS | CTL_OMIT_EXTRA) void FormatCvpcbNetlist( OUTPUTFORMATTER* aOut ) 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 64f38714f5..c90d1ad7ce 100644 --- a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp +++ b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp @@ -69,6 +69,7 @@ #include <build_version.h> #include <filter_reader.h> +#include <ctl_flags.h> using namespace PCB_KEYS_T; 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 d81e0e578a..dbde711094 100644 --- a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h +++ b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h @@ -27,6 +27,7 @@ #include <pcb_io/pcb_io.h> #include <pcb_io/pcb_io_mgr.h> +#include <ctl_flags.h> #include <richio.h> #include <string> @@ -165,17 +166,6 @@ class PCB_IO_KICAD_SEXPR; // forward decl ///< to indicate a net-tie. #define FIRST_NORMALIZED_VERISON 20230924 ///< Earlier files did not have normalized bools -#define CTL_OMIT_PAD_NETS (1 << 1) ///< Omit pads net names (useless in library) -#define CTL_OMIT_UUIDS (1 << 2) ///< Omit component unique ids (useless in library) -#define CTL_OMIT_INITIAL_COMMENTS (1 << 3) ///< omit FOOTPRINT initial comments -#define CTL_OMIT_PATH (1 << 4) ///< Omit component sheet time stamp (useless in library) -#define CTL_OMIT_AT (1 << 5) ///< Omit position and rotation. (always saved - ///< with position 0,0 and rotation = 0 in library). -//#define CTL_OMIT_HIDE (1 << 6) // found and defined in eda_text.h -#define CTL_OMIT_LIBNAME (1 << 7) ///< Omit lib alias when saving (used for - ///< board/not library). -#define CTL_OMIT_FOOTPRINT_VERSION (1 << 8) ///< Omit the version string from the (footprint) - ///<sexpr group // common combinations of the above: @@ -183,7 +173,7 @@ class PCB_IO_KICAD_SEXPR; // forward decl #define CTL_FOR_CLIPBOARD (CTL_OMIT_INITIAL_COMMENTS) // (CTL_OMIT_NETS) /// Format output for a footprint library instead of clipboard or BOARD -#define CTL_FOR_LIBRARY \ +#define CTL_FOR_LIBRARY \ ( CTL_OMIT_PAD_NETS | CTL_OMIT_UUIDS | CTL_OMIT_PATH | CTL_OMIT_AT | CTL_OMIT_LIBNAME ) /// The zero arg constructor when PCB_PLUGIN is used for PLUGIN::Load() and PLUGIN::Save()ing