KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_downgrade.cpp File Reference
#include <downgrade/sch_downgrade.h>
#include <downgrade_scan.h>
#include <cctype>
#include <climits>
#include <functional>
#include <iterator>
#include <map>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <vector>
#include <base_units.h>
#include <common.h>
#include <bus_alias.h>
#include <eda_text.h>
#include <project/net_settings.h>
#include <project.h>
#include <sch_file_versions.h>
#include <sch_io/kicad_sexpr/writers/sch_writer_v9.h>
#include <sch_io/kicad_sexpr/writers/sch_writer_v10.h>
#include <schematic.h>
#include <sch_screen.h>
#include <sch_line.h>
#include <sch_label.h>
#include <sch_shape.h>
#include <sch_sheet.h>
#include <sch_symbol.h>
#include <sch_group.h>
#include <sch_pin.h>
#include <sch_rule_area.h>
#include <sch_sheet_path.h>
#include <lib_symbol.h>
#include <pin_map.h>
#include <bitmap_base.h>
#include <sch_bitmap.h>
#include <string_utils.h>
#include <eda_shape.h>
#include <geometry/shape_ellipse.h>
#include <geometry/shape_poly_set.h>

Go to the source code of this file.

Classes

struct  TEXT_DOWNGRADE_PLAN
 
struct  FROZEN_BUS_VECTOR
 
struct  SCREEN_RULE
 
struct  SYMBOL_VARIANT_SNAPSHOT
 
struct  SHEET_VARIANT_SNAPSHOT
 

Functions

static bool isEllipse (const SCH_ITEM *aItem)
 
static bool isHatchedFillItem (const SCH_ITEM &aItem)
 
static void closePolyline (std::vector< VECTOR2I > &aPoints)
 
static void ellipseToPolygon (SCH_SHAPE *aShape)
 
static bool isRoundedRect (const SCH_ITEM *aItem)
 
static void roundedRectToPolygon (SCH_SHAPE *aShape)
 
static bool hasEscapedStackedPinNumber (const wxString &aNumber)
 
static bool usesPlainStackedPinNumber (const wxString &aNumber)
 
static int countSymbolEllipses (const LIB_SYMBOL *aSymbol)
 
static void lowerSymbolEllipses (LIB_SYMBOL *aSymbol)
 
static int countSymbolHatchedFills (const LIB_SYMBOL *aSymbol)
 
static void lowerSymbolHatchedFills (LIB_SYMBOL *aSymbol)
 
static int countSymbolPinMaps (const LIB_SYMBOL *aSymbol)
 
static void dropSymbolPinMaps (LIB_SYMBOL *aSymbol)
 
static int countSymbolRoundedRects (const LIB_SYMBOL *aSymbol)
 
static void lowerSymbolRoundedRects (LIB_SYMBOL *aSymbol)
 
static int countSymbolLocalPower (const LIB_SYMBOL *aSymbol)
 
static int countSymbolEscapedStackedPins (const LIB_SYMBOL *aSymbol)
 
static int countSymbolStackedPins (const LIB_SYMBOL *aSymbol)
 
static int countSymbolJumperPins (const LIB_SYMBOL *aSymbol)
 
static void dropSymbolJumperPins (LIB_SYMBOL *aSymbol)
 
static int countSymbolNamedBodyStyles (const LIB_SYMBOL *aSymbol)
 
static void dropSymbolBodyStyleNames (LIB_SYMBOL *aSymbol)
 
static int countSelectedCustomBodyStyles (const SCH_SCREEN *aScreen)
 
static int countUnresolvedCustomBodyStyles (const SCH_SCREEN *aScreen)
 
static void bakeSelectedCustomBodyStyles (SCH_SCREEN *aScreen)
 
static int countSymbolPositionExclusions (const LIB_SYMBOL *aSymbol)
 
static void dropSymbolPositionExclusions (LIB_SYMBOL *aSymbol)
 
static int countPositionExclusions (const SCH_SCREEN *aScreen)
 
static void dropPositionExclusions (SCH_SCREEN *aScreen)
 
static bool hasOwnLock (const SCH_ITEM *aItem)
 
static int countLockedItems (const SCH_SCREEN *aScreen)
 
static void unlockItems (SCH_SCREEN *aScreen)
 
static int countEllipses (const SCH_SCREEN *aScreen)
 
static void lowerEllipses (SCH_SCREEN *aScreen)
 
static int countHatchedFills (const SCH_SCREEN *aScreen)
 
static void lowerHatchedFills (SCH_SCREEN *aScreen)
 
static bool hasPinMaps (const SCH_SYMBOL *aSymbol)
 
static int countPinMaps (const SCH_SCREEN *aScreen)
 
static void dropPinMaps (SCH_SCREEN *aScreen)
 
static int countNamedBodyStyles (const SCH_SCREEN *aScreen)
 
static void dropNamedBodyStyles (SCH_SCREEN *aScreen)
 
static int countGroups (const SCH_SCREEN *aScreen)
 
static void ungroupAll (SCH_SCREEN *aScreen)
 
static int countJumperPinGroups (const SCH_SCREEN *aScreen)
 
static void dropJumperPinGroups (SCH_SCREEN *aScreen)
 
static int countRoundedRects (const SCH_SCREEN *aScreen)
 
static void lowerRoundedRects (SCH_SCREEN *aScreen)
 
static int countLocalPowerSymbols (const SCH_SCREEN *aScreen)
 
static bool hasRuleAreaFlags (const SCH_RULE_AREA *aArea)
 
static int countRuleAreaFlags (const SCH_SCREEN *aScreen)
 
static void dropRuleAreaFlags (SCH_SCREEN *aScreen)
 
static int countEscapedStackedPins (const SCH_SCREEN *aScreen)
 
static int countStackedPins (const SCH_SCREEN *aScreen)
 
static void omitSymbolGraphics (LIB_SYMBOL *aSymbol, const std::function< bool(const SCH_ITEM *)> &aMatches)
 
static void omitScreenItems (SCH_SCREEN *aScreen, const std::function< bool(const SCH_ITEM *)> &aMatches)
 
static void omitSelectedCustomBodyStyles (SCH_SCREEN *aScreen)
 
static void omitSymbolEllipses (LIB_SYMBOL *aSymbol)
 
static void omitSymbolRoundedRects (LIB_SYMBOL *aSymbol)
 
static void omitEllipses (SCH_SCREEN *aScreen)
 
static void omitRoundedRects (SCH_SCREEN *aScreen)
 
static void omitSymbolHatchedFills (LIB_SYMBOL *aSymbol)
 
static void omitHatchedFills (SCH_SCREEN *aScreen)
 
static void visitSymbolItems (const LIB_SYMBOL *aSymbol, const std::function< void(EDA_ITEM *)> &aVisit)
 
static void visitScreenItems (const SCH_SCREEN *aScreen, const std::function< void(EDA_ITEM *)> &aVisit)
 
static bool isPostTargetTextVar (const wxString &aToken)
 
static bool hasPostTargetTextVars (const wxString &aText)
 
static bool hasActiveExpression (const wxString &aText)
 
static bool hasEscapedTextControl (const wxString &aText)
 
static bool textNeedsDowngrade (const wxString &aText, const PROJECT *aProject, bool aLegacyExpressions, std::set< wxString > &aVisiting, const TITLE_BLOCK *aTitles=nullptr)
 
static wxString bakeLegacyExpressions (wxString aText, const SCH_ITEM *aItem, const SCH_SHEET_PATH *aPath, bool &aFailed)
 
static void planTextDowngrade (EDA_ITEM *aItem, const std::vector< SCH_SHEET_PATH > &aPaths, bool aLibrary, bool aLegacyExpressions, TEXT_DOWNGRADE_PLAN &aPlan, const TITLE_BLOCK *aTitles=nullptr)
 
static TEXT_DOWNGRADE_PLAN symbolTextPlan (const LIB_SYMBOL *aSymbol, bool aLegacyExpressions)
 
static TEXT_DOWNGRADE_PLAN screenTextPlan (const SCH_SCREEN *aScreen, bool aLegacyExpressions)
 
static void reportTextPlan (const TEXT_DOWNGRADE_PLAN &aPlan, COMPATIBILITY_REPORT &aReport)
 
static void applyTextPlan (const TEXT_DOWNGRADE_PLAN &aPlan)
 
static bool hasPaddedBusVector (const wxString &aText)
 
static FROZEN_BUS_VECTOR frozenBusVector (const wxString &aBus, bool aPreTen)
 
static bool hasIncompatibleBusVector (const wxString &aText, bool aPreTen)
 
static int countIncompatibleBusLabels (const SCH_SCREEN *aScreen, bool aPreTen)
 
static int countPaddedBusLabels (const SCH_SCREEN *aScreen)
 
static void reportPaddedBuses (int aCount, COMPATIBILITY_REPORT &aReport)
 
static void reportIncompatibleBuses (int aCount, COMPATIBILITY_REPORT &aReport)
 
static int countSymbolCustomProperties (const LIB_SYMBOL *aSymbol)
 
static int countCustomProperties (const SCH_SCREEN *aScreen)
 
static void dropSymbolCustomProperties (LIB_SYMBOL *aSymbol)
 
static void dropCustomProperties (SCH_SCREEN *aScreen)
 
static int countAlternateSymbols (const SCH_SCREEN *aScreen)
 
static void dropAlternateSymbols (SCH_SCREEN *aScreen)
 
static bool hasLineEndings (const SCH_ITEM *aItem)
 
static SCH_SHAPE lineEndingShape (const SCH_ITEM *aItem)
 
static bool canLowerLineEndings (const SCH_ITEM *aItem)
 
static void clearLineEndings (SCH_ITEM *aItem)
 
static int countSymbolLineEndings (const LIB_SYMBOL *aSymbol)
 
static int countLineEndings (const SCH_SCREEN *aScreen)
 
static std::vector< SCH_SHAPE * > lineEndingPolygons (SCH_ITEM *aItem)
 
static void lowerSymbolLineEndings (LIB_SYMBOL *aSymbol)
 
static void lowerLineEndings (SCH_SCREEN *aScreen)
 
static void dropSymbolLineEndings (LIB_SYMBOL *aSymbol)
 
static void dropLineEndings (SCH_SCREEN *aScreen)
 
static std::vector< SCREEN_RULE > screenRules ()
 
COMPATIBILITY_REPORT ClassifyScreenForDowngrade (const SCH_SCREEN *aScreen, const DOWNGRADE_TARGET &aTarget, bool aDropInsteadOfApproximate)
 Report what a schematic screen would lose if exported to an older KiCad.
 
static void compensateReferenceImageScales (SCH_SCREEN *aScreen)
 
COMPATIBILITY_REPORT ClassifySchematicStructureForDowngrade (const SCHEMATIC &aSchematic, const DOWNGRADE_TARGET &aTarget)
 Schematic-wide structure the per-screen rules cannot see. Does not modify it.
 
void DowngradeScreenInPlace (SCH_SCREEN *aScreen, const DOWNGRADE_TARGET &aTarget, bool aDropInsteadOfApproximate)
 Approximate or remove, in place, what the target cannot represent.
 
COMPATIBILITY_REPORT ClassifyLibSymbolForDowngrade (const LIB_SYMBOL *aSymbol, const DOWNGRADE_TARGET &aTarget, bool aDropInsteadOfApproximate)
 Report what a library symbol would lose if exported to an older KiCad. Does not modify it.
 
void DowngradeLibSymbolInPlace (LIB_SYMBOL *aSymbol, const DOWNGRADE_TARGET &aTarget, bool aDropInsteadOfApproximate)
 Symbol-scoped downgrade for standalone .kicad_sym files the screen pass never sees.
 
void SaveSchematicForTarget (SCH_SHEET *aSheet, SCHEMATIC *aSchematic, const wxString &aPath, const DOWNGRADE_TARGET &aTarget)
 Save a schematic sheet file stamped for the target, using the writer for that version.
 
void SaveSymbolLibraryForTarget (const std::vector< LIB_SYMBOL * > &aSymbols, const wxString &aPath, const DOWNGRADE_TARGET &aTarget)
 Save a .kicad_sym library stamped for the target.
 
int SymbolLibDowngradeCoveredVersion ()
 The symbol library format the denylist was generated against.
 
int SchDowngradeCoveredVersion ()
 The format the denylist was generated against. A format bump forces a review.
 
wxString FindUnsupportedSchToken (const wxString &aSerialized, const DOWNGRADE_TARGET &aTarget)
 Scan serialized schematic text for tokens the target cannot parse.
 
static SYMBOL_VARIANT_SNAPSHOT snapshotSymbol (const SCH_SYMBOL *aSymbol, const SCH_SHEET_PATH &aPath, const wxString &aVariantName)
 
static SHEET_VARIANT_SNAPSHOT snapshotSheet (const SCH_SHEET *aSheet, const SCH_SHEET_PATH &aPath, const wxString &aVariantName)
 
bool FlattenSchematicVariant (SCHEMATIC &aSchematic, const wxString &aVariantName, wxString *aConflict)
 Bake a variant into the base attributes of every symbol and sheet.
 

Variables

static constexpr int SCH_VER_SHAPE_HATCH = 20250222
 
static constexpr int SCH_VER_LOCAL_POWER = 20250227
 
static constexpr int SCH_VER_JUMPER_PINS = 20250324
 
static constexpr int SCH_VER_GROUPS = 20250513
 
static constexpr int SCH_VER_RULE_AREA_FLAGS = 20250610
 
static constexpr int SCH_VER_ROUNDED_RECT = 20250829
 
static constexpr int SCH_VER_LOCKING = 20260326
 
static constexpr int SCH_VER_ELLIPSE = 20260508
 
static constexpr int SCH_VER_STACKED_PINS = 20250901
 
static constexpr int SCH_VER_STACKED_PIN_ESCAPES = 20260622
 
static constexpr int SCH_VER_PIN_MAPS = 20260629
 
static constexpr int SCH_VER_BODY_STYLES = 20250827
 
static constexpr int SCH_VER_POSITION_EXCLUSIONS = 20260101
 
static constexpr int SCH_VER_IMAGE_PPI = 20260623
 
static constexpr int SCH_VER_LINE_ENDINGS = 20260818
 
static constexpr int SYMLIB_VER_LINE_ENDINGS = 20260710
 
static constexpr int SCH_VER_ALTERNATE_SYMBOLS = 20260722
 
static constexpr int SCH_VER_CUSTOM_PROPERTIES = 20260830
 
static constexpr int SCH_DOWNGRADE_COVERED = 20260830
 
static constexpr int SYMLIB_DOWNGRADE_COVERED = 20260830
 
static constexpr KICAD_T FILLABLE_TYPES [] = { SCH_SHAPE_T, SCH_TEXTBOX_T, SCH_RULE_AREA_T }
 
static constexpr DATED_TOKEN SCH_TOKENS []
 
static constexpr DATED_TOKEN SCH_VALUES []
 

Function Documentation

◆ applyTextPlan()

static void applyTextPlan ( const TEXT_DOWNGRADE_PLAN & aPlan)
static

◆ bakeLegacyExpressions()

static wxString bakeLegacyExpressions ( wxString aText,
const SCH_ITEM * aItem,
const SCH_SHEET_PATH * aPath,
bool & aFailed )
static

◆ bakeSelectedCustomBodyStyles()

◆ canLowerLineEndings()

◆ ClassifyLibSymbolForDowngrade()

◆ ClassifySchematicStructureForDowngrade()

◆ ClassifyScreenForDowngrade()

COMPATIBILITY_REPORT ClassifyScreenForDowngrade ( const SCH_SCREEN * aScreen,
const DOWNGRADE_TARGET & aTarget,
bool aDropInsteadOfApproximate = false )

Report what a schematic screen would lose if exported to an older KiCad.

Does not modify it. aDropInsteadOfApproximate reports LOWER features as DROP and selects their omission transforms.

Definition at line 2077 of file sch_downgrade.cpp.

References _, COMPATIBILITY_REPORT::Add(), BLOCK, canLowerLineEndings(), countIncompatibleBusLabels(), countPaddedBusLabels(), DROP, SCH_WRITER_V10::FORMAT_VERSION, hasLineEndings(), LOWER, DOWNGRADE_TARGET::m_schVersion, reportIncompatibleBuses(), reportPaddedBuses(), reportTextPlan(), SCH_DOWNGRADE_COVERED, SCH_VER_CUSTOM_PROPERTIES, SCH_VER_LINE_ENDINGS, screenRules(), screenTextPlan(), SEXPR_SCHEMATIC_FILE_VERSION, and visitScreenItems().

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), checkTransformedSchematicUsesOnlyKnownTokens(), and EESCHEMA_JOBS_HANDLER::JobDowngrade().

◆ clearLineEndings()

static void clearLineEndings ( SCH_ITEM * aItem)
static

◆ closePolyline()

static void closePolyline ( std::vector< VECTOR2I > & aPoints)
static

Definition at line 111 of file sch_downgrade.cpp.

Referenced by ellipseToPolygon(), and roundedRectToPolygon().

◆ compensateReferenceImageScales()

◆ countAlternateSymbols()

static int countAlternateSymbols ( const SCH_SCREEN * aScreen)
static

◆ countCustomProperties()

static int countCustomProperties ( const SCH_SCREEN * aScreen)
static

Definition at line 1656 of file sch_downgrade.cpp.

References EDA_ITEM::GetCustomProperties(), and visitScreenItems().

Referenced by boardRules(), and screenRules().

◆ countEllipses()

static int countEllipses ( const SCH_SCREEN * aScreen)
static

◆ countEscapedStackedPins()

static int countEscapedStackedPins ( const SCH_SCREEN * aScreen)
static

Definition at line 883 of file sch_downgrade.cpp.

References countSymbolEscapedStackedPins(), SCH_SCREEN::GetLibSymbols(), and name.

Referenced by screenRules().

◆ countGroups()

static int countGroups ( const SCH_SCREEN * aScreen)
static

Definition at line 741 of file sch_downgrade.cpp.

References SCH_SCREEN::Items(), EE_RTREE::OfType(), and SCH_GROUP_T.

Referenced by screenRules().

◆ countHatchedFills()

static int countHatchedFills ( const SCH_SCREEN * aScreen)
static

◆ countIncompatibleBusLabels()

◆ countJumperPinGroups()

static int countJumperPinGroups ( const SCH_SCREEN * aScreen)
static

Definition at line 768 of file sch_downgrade.cpp.

References countSymbolJumperPins(), SCH_SCREEN::GetLibSymbols(), and name.

Referenced by screenRules().

◆ countLineEndings()

static int countLineEndings ( const SCH_SCREEN * aScreen)
static

Definition at line 1825 of file sch_downgrade.cpp.

References hasLineEndings(), and visitScreenItems().

Referenced by screenRules().

◆ countLocalPowerSymbols()

static int countLocalPowerSymbols ( const SCH_SCREEN * aScreen)
static

Definition at line 834 of file sch_downgrade.cpp.

References countSymbolLocalPower(), SCH_SCREEN::GetLibSymbols(), and name.

Referenced by screenRules().

◆ countLockedItems()

static int countLockedItems ( const SCH_SCREEN * aScreen)
static

Definition at line 542 of file sch_downgrade.cpp.

References hasOwnLock(), and SCH_SCREEN::Items().

Referenced by screenRules().

◆ countNamedBodyStyles()

static int countNamedBodyStyles ( const SCH_SCREEN * aScreen)
static

Definition at line 717 of file sch_downgrade.cpp.

References countSymbolNamedBodyStyles(), SCH_SCREEN::GetLibSymbols(), and name.

Referenced by screenRules().

◆ countPaddedBusLabels()

static int countPaddedBusLabels ( const SCH_SCREEN * aScreen)
static

◆ countPinMaps()

static int countPinMaps ( const SCH_SCREEN * aScreen)
static

◆ countPositionExclusions()

static int countPositionExclusions ( const SCH_SCREEN * aScreen)
static

◆ countRoundedRects()

static int countRoundedRects ( const SCH_SCREEN * aScreen)
static

◆ countRuleAreaFlags()

static int countRuleAreaFlags ( const SCH_SCREEN * aScreen)
static

Definition at line 855 of file sch_downgrade.cpp.

References hasRuleAreaFlags(), SCH_SCREEN::Items(), EE_RTREE::OfType(), and SCH_RULE_AREA_T.

Referenced by screenRules().

◆ countSelectedCustomBodyStyles()

static int countSelectedCustomBodyStyles ( const SCH_SCREEN * aScreen)
static

Definition at line 380 of file sch_downgrade.cpp.

References DEMORGAN, SCH_SCREEN::Items(), EE_RTREE::OfType(), and SCH_SYMBOL_T.

Referenced by screenRules().

◆ countStackedPins()

static int countStackedPins ( const SCH_SCREEN * aScreen)
static

Definition at line 897 of file sch_downgrade.cpp.

References countSymbolStackedPins(), SCH_SCREEN::GetLibSymbols(), and name.

Referenced by screenRules().

◆ countSymbolCustomProperties()

static int countSymbolCustomProperties ( const LIB_SYMBOL * aSymbol)
static

Definition at line 1644 of file sch_downgrade.cpp.

References EDA_ITEM::GetCustomProperties(), and visitSymbolItems().

Referenced by screenRules().

◆ countSymbolEllipses()

static int countSymbolEllipses ( const LIB_SYMBOL * aSymbol)
static

Definition at line 224 of file sch_downgrade.cpp.

References LIB_SYMBOL::GetDrawItems(), and isEllipse().

Referenced by countEllipses(), and screenRules().

◆ countSymbolEscapedStackedPins()

static int countSymbolEscapedStackedPins ( const LIB_SYMBOL * aSymbol)
static

◆ countSymbolHatchedFills()

static int countSymbolHatchedFills ( const LIB_SYMBOL * aSymbol)
static

Definition at line 253 of file sch_downgrade.cpp.

References LIB_SYMBOL::GetDrawItems(), and isHatchedFillItem().

Referenced by countHatchedFills(), and screenRules().

◆ countSymbolJumperPins()

static int countSymbolJumperPins ( const LIB_SYMBOL * aSymbol)
static

◆ countSymbolLineEndings()

static int countSymbolLineEndings ( const LIB_SYMBOL * aSymbol)
static

Definition at line 1814 of file sch_downgrade.cpp.

References LIB_SYMBOL::GetDrawItems(), and hasLineEndings().

Referenced by screenRules().

◆ countSymbolLocalPower()

static int countSymbolLocalPower ( const LIB_SYMBOL * aSymbol)
static

Definition at line 319 of file sch_downgrade.cpp.

References LIB_SYMBOL::IsLocalPower().

Referenced by countLocalPowerSymbols(), and screenRules().

◆ countSymbolNamedBodyStyles()

static int countSymbolNamedBodyStyles ( const LIB_SYMBOL * aSymbol)
static

◆ countSymbolPinMaps()

static int countSymbolPinMaps ( const LIB_SYMBOL * aSymbol)
static

Definition at line 277 of file sch_downgrade.cpp.

References LIB_SYMBOL::GetAssociatedFootprints(), and LIB_SYMBOL::GetPinMaps().

Referenced by countPinMaps(), and screenRules().

◆ countSymbolPositionExclusions()

static int countSymbolPositionExclusions ( const LIB_SYMBOL * aSymbol)
static

Definition at line 479 of file sch_downgrade.cpp.

References SYMBOL::GetExcludedFromPosFiles().

Referenced by countPositionExclusions(), and screenRules().

◆ countSymbolRoundedRects()

static int countSymbolRoundedRects ( const LIB_SYMBOL * aSymbol)
static

Definition at line 290 of file sch_downgrade.cpp.

References LIB_SYMBOL::GetDrawItems(), and isRoundedRect().

Referenced by countRoundedRects(), and screenRules().

◆ countSymbolStackedPins()

static int countSymbolStackedPins ( const LIB_SYMBOL * aSymbol)
static

Definition at line 339 of file sch_downgrade.cpp.

References LIB_SYMBOL::GetGraphicalPins(), pin, and usesPlainStackedPinNumber().

Referenced by countStackedPins(), and screenRules().

◆ countUnresolvedCustomBodyStyles()

static int countUnresolvedCustomBodyStyles ( const SCH_SCREEN * aScreen)
static

◆ DowngradeLibSymbolInPlace()

◆ DowngradeScreenInPlace()

◆ dropAlternateSymbols()

static void dropAlternateSymbols ( SCH_SCREEN * aScreen)
static

◆ dropCustomProperties()

static void dropCustomProperties ( SCH_SCREEN * aScreen)
static

◆ dropJumperPinGroups()

static void dropJumperPinGroups ( SCH_SCREEN * aScreen)
static

Definition at line 782 of file sch_downgrade.cpp.

References dropSymbolJumperPins(), SCH_SCREEN::GetLibSymbols(), and name.

Referenced by screenRules().

◆ dropLineEndings()

static void dropLineEndings ( SCH_SCREEN * aScreen)
static

Definition at line 1963 of file sch_downgrade.cpp.

References clearLineEndings(), and visitScreenItems().

Referenced by screenRules().

◆ dropNamedBodyStyles()

static void dropNamedBodyStyles ( SCH_SCREEN * aScreen)
static

Definition at line 731 of file sch_downgrade.cpp.

References dropSymbolBodyStyleNames(), SCH_SCREEN::GetLibSymbols(), and name.

Referenced by screenRules().

◆ dropPinMaps()

◆ dropPositionExclusions()

static void dropPositionExclusions ( SCH_SCREEN * aScreen)
static

◆ dropRuleAreaFlags()

◆ dropSymbolBodyStyleNames()

static void dropSymbolBodyStyleNames ( LIB_SYMBOL * aSymbol)
static

Definition at line 374 of file sch_downgrade.cpp.

References LIB_SYMBOL::SetBodyStyleNames().

Referenced by dropNamedBodyStyles(), and screenRules().

◆ dropSymbolCustomProperties()

static void dropSymbolCustomProperties ( LIB_SYMBOL * aSymbol)
static

Definition at line 1668 of file sch_downgrade.cpp.

References EDA_ITEM::ClearCustomProperties(), and visitSymbolItems().

Referenced by dropCustomProperties(), and screenRules().

◆ dropSymbolJumperPins()

static void dropSymbolJumperPins ( LIB_SYMBOL * aSymbol)
static

◆ dropSymbolLineEndings()

static void dropSymbolLineEndings ( LIB_SYMBOL * aSymbol)
static

Definition at line 1956 of file sch_downgrade.cpp.

References clearLineEndings(), and LIB_SYMBOL::GetDrawItems().

Referenced by screenRules().

◆ dropSymbolPinMaps()

static void dropSymbolPinMaps ( LIB_SYMBOL * aSymbol)
static

Definition at line 283 of file sch_downgrade.cpp.

References LIB_SYMBOL::SetAssociatedFootprints(), and LIB_SYMBOL::SetPinMaps().

Referenced by dropPinMaps(), and screenRules().

◆ dropSymbolPositionExclusions()

static void dropSymbolPositionExclusions ( LIB_SYMBOL * aSymbol)
static

Definition at line 485 of file sch_downgrade.cpp.

References SYMBOL::SetExcludedFromPosFiles().

Referenced by dropPositionExclusions(), and screenRules().

◆ ellipseToPolygon()

◆ FindUnsupportedSchToken()

wxString FindUnsupportedSchToken ( const wxString & aSerialized,
const DOWNGRADE_TARGET & aTarget )

Scan serialized schematic text for tokens the target cannot parse.

Returns the first such token, or empty if the output is safe. Non-empty means refuse the export.

Definition at line 2370 of file sch_downgrade.cpp.

References FindUnsupportedToken(), DOWNGRADE_TARGET::m_schVersion, SCH_TOKENS, SCH_VALUES, and SEXPR_SCHEMATIC_FILE_VERSION.

Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ FlattenSchematicVariant()

bool FlattenSchematicVariant ( SCHEMATIC & aSchematic,
const wxString & aVariantName,
wxString * aConflict )

◆ frozenBusVector()

static FROZEN_BUS_VECTOR frozenBusVector ( const wxString & aBus,
bool aPreTen )
static

Definition at line 1429 of file sch_downgrade.cpp.

References result.

Referenced by hasIncompatibleBusVector().

◆ hasActiveExpression()

static bool hasActiveExpression ( const wxString & aText)
static

Definition at line 1082 of file sch_downgrade.cpp.

References ExpandTextVars(), and INTERNAL.

Referenced by bakeLegacyExpressions(), and textNeedsDowngrade().

◆ hasEscapedStackedPinNumber()

static bool hasEscapedStackedPinNumber ( const wxString & aNumber)
static

◆ hasEscapedTextControl()

static bool hasEscapedTextControl ( const wxString & aText)
static

Definition at line 1092 of file sch_downgrade.cpp.

Referenced by planTextDowngrade(), and textNeedsDowngrade().

◆ hasIncompatibleBusVector()

◆ hasLineEndings()

static bool hasLineEndings ( const SCH_ITEM * aItem)
static

◆ hasOwnLock()

static bool hasOwnLock ( const SCH_ITEM * aItem)
static

◆ hasPaddedBusVector()

static bool hasPaddedBusVector ( const wxString & aText)
static

◆ hasPinMaps()

static bool hasPinMaps ( const SCH_SYMBOL * aSymbol)
static

◆ hasPostTargetTextVars()

static bool hasPostTargetTextVars ( const wxString & aText)
static

Definition at line 1069 of file sch_downgrade.cpp.

References ExpandTextVars(), INTERNAL, and isPostTargetTextVar().

Referenced by bakeLegacyExpressions(), and planTextDowngrade().

◆ hasRuleAreaFlags()

static bool hasRuleAreaFlags ( const SCH_RULE_AREA * aArea)
static

◆ isEllipse()

◆ isHatchedFillItem()

static bool isHatchedFillItem ( const SCH_ITEM & aItem)
static

◆ isPostTargetTextVar()

static bool isPostTargetTextVar ( const wxString & aToken)
static

Definition at line 1061 of file sch_downgrade.cpp.

Referenced by hasPostTargetTextVars(), and textNeedsDowngrade().

◆ isRoundedRect()

◆ lineEndingPolygons()

◆ lineEndingShape()

◆ lowerEllipses()

static void lowerEllipses ( SCH_SCREEN * aScreen)
static

◆ lowerHatchedFills()

◆ lowerLineEndings()

◆ lowerRoundedRects()

static void lowerRoundedRects ( SCH_SCREEN * aScreen)
static

◆ lowerSymbolEllipses()

static void lowerSymbolEllipses ( LIB_SYMBOL * aSymbol)
static

Definition at line 238 of file sch_downgrade.cpp.

References ellipseToPolygon(), LIB_SYMBOL::GetDrawItems(), and isEllipse().

Referenced by lowerEllipses(), and screenRules().

◆ lowerSymbolHatchedFills()

static void lowerSymbolHatchedFills ( LIB_SYMBOL * aSymbol)
static

Definition at line 267 of file sch_downgrade.cpp.

References FILLED_SHAPE, LIB_SYMBOL::GetDrawItems(), and isHatchedFillItem().

Referenced by lowerHatchedFills(), and screenRules().

◆ lowerSymbolLineEndings()

◆ lowerSymbolRoundedRects()

static void lowerSymbolRoundedRects ( LIB_SYMBOL * aSymbol)
static

◆ omitEllipses()

static void omitEllipses ( SCH_SCREEN * aScreen)
static

◆ omitHatchedFills()

◆ omitRoundedRects()

static void omitRoundedRects ( SCH_SCREEN * aScreen)
static

◆ omitScreenItems()

static void omitScreenItems ( SCH_SCREEN * aScreen,
const std::function< bool(const SCH_ITEM *)> & aMatches )
static

◆ omitSelectedCustomBodyStyles()

static void omitSelectedCustomBodyStyles ( SCH_SCREEN * aScreen)
static

◆ omitSymbolEllipses()

static void omitSymbolEllipses ( LIB_SYMBOL * aSymbol)
static

Definition at line 959 of file sch_downgrade.cpp.

References isEllipse(), and omitSymbolGraphics().

Referenced by omitEllipses(), and screenRules().

◆ omitSymbolGraphics()

static void omitSymbolGraphics ( LIB_SYMBOL * aSymbol,
const std::function< bool(const SCH_ITEM *)> & aMatches )
static

◆ omitSymbolHatchedFills()

static void omitSymbolHatchedFills ( LIB_SYMBOL * aSymbol)
static

Definition at line 993 of file sch_downgrade.cpp.

References LIB_SYMBOL::GetDrawItems(), isHatchedFillItem(), and NO_FILL.

Referenced by omitHatchedFills(), and screenRules().

◆ omitSymbolRoundedRects()

static void omitSymbolRoundedRects ( LIB_SYMBOL * aSymbol)
static

Definition at line 963 of file sch_downgrade.cpp.

References isRoundedRect(), and omitSymbolGraphics().

Referenced by omitRoundedRects(), and screenRules().

◆ planTextDowngrade()

◆ reportIncompatibleBuses()

static void reportIncompatibleBuses ( int aCount,
COMPATIBILITY_REPORT & aReport )
static

◆ reportPaddedBuses()

static void reportPaddedBuses ( int aCount,
COMPATIBILITY_REPORT & aReport )
static

◆ reportTextPlan()

◆ roundedRectToPolygon()

◆ SaveSchematicForTarget()

void SaveSchematicForTarget ( SCH_SHEET * aSheet,
SCHEMATIC * aSchematic,
const wxString & aPath,
const DOWNGRADE_TARGET & aTarget )

◆ SaveSymbolLibraryForTarget()

void SaveSymbolLibraryForTarget ( const std::vector< LIB_SYMBOL * > & aSymbols,
const wxString & aPath,
const DOWNGRADE_TARGET & aTarget )

◆ SchDowngradeCoveredVersion()

int SchDowngradeCoveredVersion ( )

The format the denylist was generated against. A format bump forces a review.

Definition at line 2364 of file sch_downgrade.cpp.

References SCH_DOWNGRADE_COVERED.

Referenced by BOOST_AUTO_TEST_CASE().

◆ screenRules()

static std::vector< SCREEN_RULE > screenRules ( )
static

Definition at line 1991 of file sch_downgrade.cpp.

References _, bakeSelectedCustomBodyStyles(), BLOCK, countAlternateSymbols(), countCustomProperties(), countEllipses(), countEscapedStackedPins(), countGroups(), countHatchedFills(), countJumperPinGroups(), countLineEndings(), countLocalPowerSymbols(), countLockedItems(), countNamedBodyStyles(), countPinMaps(), countPositionExclusions(), countRoundedRects(), countRuleAreaFlags(), countSelectedCustomBodyStyles(), countStackedPins(), countSymbolCustomProperties(), countSymbolEllipses(), countSymbolEscapedStackedPins(), countSymbolHatchedFills(), countSymbolJumperPins(), countSymbolLineEndings(), countSymbolLocalPower(), countSymbolNamedBodyStyles(), countSymbolPinMaps(), countSymbolPositionExclusions(), countSymbolRoundedRects(), countSymbolStackedPins(), countUnresolvedCustomBodyStyles(), DROP, dropAlternateSymbols(), dropCustomProperties(), dropJumperPinGroups(), dropLineEndings(), dropNamedBodyStyles(), dropPinMaps(), dropPositionExclusions(), dropRuleAreaFlags(), dropSymbolBodyStyleNames(), dropSymbolCustomProperties(), dropSymbolJumperPins(), dropSymbolLineEndings(), dropSymbolPinMaps(), dropSymbolPositionExclusions(), LOWER, lowerEllipses(), lowerHatchedFills(), lowerLineEndings(), lowerRoundedRects(), lowerSymbolEllipses(), lowerSymbolHatchedFills(), lowerSymbolLineEndings(), lowerSymbolRoundedRects(), omitEllipses(), omitHatchedFills(), omitRoundedRects(), omitSelectedCustomBodyStyles(), omitSymbolEllipses(), omitSymbolHatchedFills(), omitSymbolRoundedRects(), SCH_VER_ALTERNATE_SYMBOLS, SCH_VER_BODY_STYLES, SCH_VER_CUSTOM_PROPERTIES, SCH_VER_ELLIPSE, SCH_VER_GROUPS, SCH_VER_JUMPER_PINS, SCH_VER_LINE_ENDINGS, SCH_VER_LOCAL_POWER, SCH_VER_LOCKING, SCH_VER_PIN_MAPS, SCH_VER_POSITION_EXCLUSIONS, SCH_VER_ROUNDED_RECT, SCH_VER_RULE_AREA_FLAGS, SCH_VER_SHAPE_HATCH, SCH_VER_STACKED_PIN_ESCAPES, SCH_VER_STACKED_PINS, ungroupAll(), and unlockItems().

Referenced by ClassifyLibSymbolForDowngrade(), ClassifyScreenForDowngrade(), DowngradeLibSymbolInPlace(), and DowngradeScreenInPlace().

◆ screenTextPlan()

◆ snapshotSheet()

◆ snapshotSymbol()

◆ SymbolLibDowngradeCoveredVersion()

int SymbolLibDowngradeCoveredVersion ( )

The symbol library format the denylist was generated against.

Definition at line 2358 of file sch_downgrade.cpp.

References SYMLIB_DOWNGRADE_COVERED.

Referenced by BOOST_AUTO_TEST_CASE().

◆ symbolTextPlan()

static TEXT_DOWNGRADE_PLAN symbolTextPlan ( const LIB_SYMBOL * aSymbol,
bool aLegacyExpressions )
static

◆ textNeedsDowngrade()

static bool textNeedsDowngrade ( const wxString & aText,
const PROJECT * aProject,
bool aLegacyExpressions,
std::set< wxString > & aVisiting,
const TITLE_BLOCK * aTitles = nullptr )
static

◆ ungroupAll()

static void ungroupAll ( SCH_SCREEN * aScreen)
static

Definition at line 748 of file sch_downgrade.cpp.

References group, SCH_SCREEN::Items(), EE_RTREE::OfType(), SCH_SCREEN::Remove(), and SCH_GROUP_T.

Referenced by screenRules().

◆ unlockItems()

static void unlockItems ( SCH_SCREEN * aScreen)
static

Definition at line 556 of file sch_downgrade.cpp.

References hasOwnLock(), and SCH_SCREEN::Items().

Referenced by screenRules().

◆ usesPlainStackedPinNumber()

static bool usesPlainStackedPinNumber ( const wxString & aNumber)
static

Definition at line 210 of file sch_downgrade.cpp.

References ExpandStackedPinNotation(), and hasEscapedStackedPinNumber().

Referenced by countSymbolStackedPins().

◆ visitScreenItems()

static void visitScreenItems ( const SCH_SCREEN * aScreen,
const std::function< void(EDA_ITEM *)> & aVisit )
static

◆ visitSymbolItems()

static void visitSymbolItems ( const LIB_SYMBOL * aSymbol,
const std::function< void(EDA_ITEM *)> & aVisit )
static

Variable Documentation

◆ FILLABLE_TYPES

KICAD_T FILLABLE_TYPES[] = { SCH_SHAPE_T, SCH_TEXTBOX_T, SCH_RULE_AREA_T }
staticconstexpr

Definition at line 610 of file sch_downgrade.cpp.

Referenced by countHatchedFills(), lowerHatchedFills(), and omitHatchedFills().

◆ SCH_DOWNGRADE_COVERED

int SCH_DOWNGRADE_COVERED = 20260830
staticconstexpr

Definition at line 87 of file sch_downgrade.cpp.

Referenced by ClassifyScreenForDowngrade(), and SchDowngradeCoveredVersion().

◆ SCH_TOKENS

DATED_TOKEN SCH_TOKENS[]
staticconstexpr
Initial value:
= {
{ "symbol_override", SCH_VER_ALTERNATE_SYMBOLS },
{ "start_shape", SYMLIB_VER_LINE_ENDINGS },
{ "end_shape", SYMLIB_VER_LINE_ENDINGS },
{ "custom_property", SCH_VER_CUSTOM_PROPERTIES },
{ "jumper_pin_groups", SCH_VER_JUMPER_PINS },
{ "group", SCH_VER_GROUPS },
{ "body_style", SCH_VER_BODY_STYLES },
{ "body_styles", SCH_VER_BODY_STYLES },
{ "variant", SCH_VER_VARIANTS },
{ "field", SCH_VER_VARIANTS },
{ "locked", SCH_VER_GROUPS },
{ "ellipse", SCH_VER_ELLIPSE },
{ "ellipse_arc", SCH_VER_ELLIPSE },
{ "rotation_angle", SCH_VER_ELLIPSE },
{ "net_chain", SCH_VER_NET_CHAINS },
{ "net_class", SCH_VER_NET_CHAINS },
{ "nets", SCH_VER_NET_CHAINS },
{ "passthrough", SCH_VER_NET_CHAINS },
{ "pin_map", SCH_VER_PIN_MAPS },
{ "pin_maps", SCH_VER_PIN_MAPS },
{ "pin_map_override", SCH_VER_PIN_MAPS },
{ "named_map", SCH_VER_PIN_MAPS },
{ "associated_footprints", SCH_VER_PIN_MAPS },
{ "entry", SCH_VER_PIN_MAPS },
{ "map", SCH_VER_PIN_MAPS },
{ "edit", SCH_VER_PIN_MAPS },
}
static constexpr int SCH_VER_PIN_MAPS
static constexpr int SCH_VER_ELLIPSE
static constexpr int SCH_VER_GROUPS
static constexpr int SYMLIB_VER_LINE_ENDINGS
static constexpr int SCH_VER_ALTERNATE_SYMBOLS
static constexpr int SCH_VER_JUMPER_PINS
static constexpr int SCH_VER_CUSTOM_PROPERTIES
static constexpr int SCH_VER_BODY_STYLES
constexpr int SCH_VER_VARIANTS
Format dates for rules the jobs handler applies at schematic scope.
constexpr int SCH_VER_NET_CHAINS

Definition at line 2294 of file sch_downgrade.cpp.

Referenced by FindUnsupportedSchToken().

◆ SCH_VALUES

DATED_TOKEN SCH_VALUES[]
staticconstexpr
Initial value:
= {
{ "hatch", SCH_VER_SHAPE_HATCH },
{ "reverse_hatch", SCH_VER_SHAPE_HATCH },
{ "cross_hatch", SCH_VER_SHAPE_HATCH },
}
static constexpr int SCH_VER_SHAPE_HATCH

Definition at line 2325 of file sch_downgrade.cpp.

Referenced by FindUnsupportedSchToken().

◆ SCH_VER_ALTERNATE_SYMBOLS

int SCH_VER_ALTERNATE_SYMBOLS = 20260722
staticconstexpr

Definition at line 82 of file sch_downgrade.cpp.

Referenced by ClassifySchematicStructureForDowngrade(), and screenRules().

◆ SCH_VER_BODY_STYLES

int SCH_VER_BODY_STYLES = 20250827
staticconstexpr

Definition at line 77 of file sch_downgrade.cpp.

Referenced by screenRules().

◆ SCH_VER_CUSTOM_PROPERTIES

◆ SCH_VER_ELLIPSE

int SCH_VER_ELLIPSE = 20260508
staticconstexpr

Definition at line 73 of file sch_downgrade.cpp.

Referenced by screenRules().

◆ SCH_VER_GROUPS

int SCH_VER_GROUPS = 20250513
staticconstexpr

Definition at line 69 of file sch_downgrade.cpp.

Referenced by screenRules().

◆ SCH_VER_IMAGE_PPI

int SCH_VER_IMAGE_PPI = 20260623
staticconstexpr

Definition at line 79 of file sch_downgrade.cpp.

Referenced by DowngradeScreenInPlace().

◆ SCH_VER_JUMPER_PINS

int SCH_VER_JUMPER_PINS = 20250324
staticconstexpr

Definition at line 68 of file sch_downgrade.cpp.

Referenced by screenRules().

◆ SCH_VER_LINE_ENDINGS

int SCH_VER_LINE_ENDINGS = 20260818
staticconstexpr

Definition at line 80 of file sch_downgrade.cpp.

Referenced by ClassifyScreenForDowngrade(), and screenRules().

◆ SCH_VER_LOCAL_POWER

int SCH_VER_LOCAL_POWER = 20250227
staticconstexpr

Definition at line 67 of file sch_downgrade.cpp.

Referenced by screenRules().

◆ SCH_VER_LOCKING

int SCH_VER_LOCKING = 20260326
staticconstexpr

Definition at line 72 of file sch_downgrade.cpp.

Referenced by screenRules().

◆ SCH_VER_PIN_MAPS

int SCH_VER_PIN_MAPS = 20260629
staticconstexpr

Definition at line 76 of file sch_downgrade.cpp.

Referenced by screenRules().

◆ SCH_VER_POSITION_EXCLUSIONS

int SCH_VER_POSITION_EXCLUSIONS = 20260101
staticconstexpr

Definition at line 78 of file sch_downgrade.cpp.

Referenced by screenRules().

◆ SCH_VER_ROUNDED_RECT

int SCH_VER_ROUNDED_RECT = 20250829
staticconstexpr

Definition at line 71 of file sch_downgrade.cpp.

Referenced by screenRules().

◆ SCH_VER_RULE_AREA_FLAGS

int SCH_VER_RULE_AREA_FLAGS = 20250610
staticconstexpr

Definition at line 70 of file sch_downgrade.cpp.

Referenced by screenRules().

◆ SCH_VER_SHAPE_HATCH

int SCH_VER_SHAPE_HATCH = 20250222
staticconstexpr

Definition at line 66 of file sch_downgrade.cpp.

Referenced by screenRules().

◆ SCH_VER_STACKED_PIN_ESCAPES

int SCH_VER_STACKED_PIN_ESCAPES = 20260622
staticconstexpr

Definition at line 75 of file sch_downgrade.cpp.

Referenced by screenRules().

◆ SCH_VER_STACKED_PINS

int SCH_VER_STACKED_PINS = 20250901
staticconstexpr

Definition at line 74 of file sch_downgrade.cpp.

Referenced by screenRules().

◆ SYMLIB_DOWNGRADE_COVERED

int SYMLIB_DOWNGRADE_COVERED = 20260830
staticconstexpr

◆ SYMLIB_VER_LINE_ENDINGS

int SYMLIB_VER_LINE_ENDINGS = 20260710
staticconstexpr

Definition at line 81 of file sch_downgrade.cpp.

Referenced by ClassifyLibSymbolForDowngrade().