|
KiCad PCB EDA Suite
|
Go to the source code of this file.
Functions | |
| COMPATIBILITY_REPORT | ClassifyBoardForDowngrade (const BOARD *aBoard, const DOWNGRADE_TARGET &aTarget, bool aDropInsteadOfApproximate=false) |
| Report what a board would lose if exported to an older KiCad. | |
| void | DowngradeBoardInPlace (BOARD *aBoard, const DOWNGRADE_TARGET &aTarget, bool aDropInsteadOfApproximate=false) |
| Approximate or remove, in place, what the target cannot represent. | |
| void | DowngradeFootprintInPlace (FOOTPRINT *aFootprint, const DOWNGRADE_TARGET &aTarget, bool aDropInsteadOfApproximate=false) |
| Footprint-scoped downgrade for standalone .kicad_mod files the board pass never sees. | |
| bool | ExportBoardToOlderVersion (const wxString &aSrcFile, const wxString &aDestFile, const DOWNGRADE_TARGET &aTarget, COMPATIBILITY_REPORT &aReport, wxString *aUnsupportedToken=nullptr, const wxString &aVariant=wxEmptyString, bool aDropInsteadOfApproximate=false) |
| Load a board, downgrade the copy, and write it stamped for the target. | |
| void | FlattenBoardVariant (BOARD *aBoard, const wxString &aVariantName) |
| Bake a variant's overrides into the base footprint attributes. | |
| void | SaveBoardForTarget (BOARD *aBoard, const wxString &aPath, const DOWNGRADE_TARGET &aTarget) |
| Save a board stamped for the target, using the writer for that version. | |
| void | SaveFootprintForTarget (FOOTPRINT *aFootprint, const wxString &aPath, const DOWNGRADE_TARGET &aTarget) |
| Save a single .kicad_mod footprint file for the target. | |
| DOWNGRADE_FILE_RESULT | DowngradeFootprintFileToTemp (const wxString &aSrcFile, const wxString &aTmpFile, const DOWNGRADE_TARGET &aTarget, bool aDropInsteadOfApproximate=false) |
| Load one .kicad_mod, classify it against the rule table, and write the downgraded copy to aTmpFile. | |
| wxString | FindUnsupportedBoardToken (const wxString &aSerialized, const DOWNGRADE_TARGET &aTarget) |
| Scan serialized board text for tokens the target cannot parse. | |
| int | BoardDowngradeCoveredVersion () |
| The format the denylist was generated against. A format bump forces a review. | |
Variables | |
| constexpr int | FIRST_FP_CUSTOM_STACKUP = 20250818 |
| First board format that stores custom footprint stackups. | |
| constexpr int | FIRST_PCB_VARIANTS = 20260101 |
| First board format that stores variants. | |
| int BoardDowngradeCoveredVersion | ( | ) |
The format the denylist was generated against. A format bump forces a review.
Definition at line 2876 of file board_downgrade.cpp.
References BOARD_DOWNGRADE_COVERED.
Referenced by BOOST_AUTO_TEST_CASE().
| COMPATIBILITY_REPORT ClassifyBoardForDowngrade | ( | const BOARD * | aBoard, |
| const DOWNGRADE_TARGET & | aTarget, | ||
| bool | aDropInsteadOfApproximate = false ) |
Report what a board would lose if exported to an older KiCad.
Does not modify the board. aDropInsteadOfApproximate reports LOWER features as DROP and selects their omission transforms.
Definition at line 2641 of file board_downgrade.cpp.
References _, COMPATIBILITY_REPORT::Add(), BLOCK, BOARD_DOWNGRADE_COVERED, boardRules(), countLineEndings(), DROP, PCB_PLOT_PARAMS::GetFormat(), BOARD::GetPlotOptions(), LOWER, DOWNGRADE_TARGET::m_boardVersion, planBoardText(), PNG, SEXPR_BOARD_FILE_VERSION, text, VER_LINE_ENDINGS, and VER_PROPERTY_VARIABLES.
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(), 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(), checkTransformedBoardUsesOnlyKnownTokens(), classifyFootprintLibraries(), DowngradeFootprintFileToTemp(), ExportBoardToOlderVersion(), and PCBNEW_JOBS_HANDLER::JobDowngrade().
| void DowngradeBoardInPlace | ( | BOARD * | aBoard, |
| const DOWNGRADE_TARGET & | aTarget, | ||
| bool | aDropInsteadOfApproximate = false ) |
Approximate or remove, in place, what the target cannot represent.
When aDropInsteadOfApproximate is true, omit LOWER features without generating replacements.
Definition at line 2738 of file board_downgrade.cpp.
References applyTextPlan(), boardRules(), compensateReferenceImageScales(), GERBER, PCB_PLOT_PARAMS::GetFormat(), BOARD::GetPlotOptions(), LOWER, DOWNGRADE_TARGET::m_boardVersion, planBoardText(), PNG, PCB_PLOT_PARAMS::SetFormat(), BOARD::SetPlotOptions(), VER_IMAGE_PPI, and VER_PROPERTY_VARIABLES.
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(), 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(), and ExportBoardToOlderVersion().
| DOWNGRADE_FILE_RESULT DowngradeFootprintFileToTemp | ( | const wxString & | aSrcFile, |
| const wxString & | aTmpFile, | ||
| const DOWNGRADE_TARGET & | aTarget, | ||
| bool | aDropInsteadOfApproximate = false ) |
Load one .kicad_mod, classify it against the rule table, and write the downgraded copy to aTmpFile.
Refuses when a block rule fires.
Definition at line 2978 of file board_downgrade.cpp.
References BOARD::Add(), ClassifyBoardForDowngrade(), CONVERTED, DowngradeFootprintInPlace(), PCB_IO_KICAD_SEXPR::ImportFootprint(), REFUSED, BOARD::Remove(), SaveFootprintForTarget(), EDA_ITEM::SetParent(), and SKIPPED.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), checkNativeFootprintGolden(), and downgradeFootprintLibraries().
| void DowngradeFootprintInPlace | ( | FOOTPRINT * | aFootprint, |
| const DOWNGRADE_TARGET & | aTarget, | ||
| bool | aDropInsteadOfApproximate = false ) |
Footprint-scoped downgrade for standalone .kicad_mod files the board pass never sees.
Definition at line 2771 of file board_downgrade.cpp.
References applyTextPlan(), boardRules(), compensateReferenceImageScalesFp(), LOWER, DOWNGRADE_TARGET::m_boardVersion, planTextItem(), text, VER_IMAGE_PPI, VER_PROPERTY_VARIABLES, and visitFootprintItems().
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(), and DowngradeFootprintFileToTemp().
| bool ExportBoardToOlderVersion | ( | const wxString & | aSrcFile, |
| const wxString & | aDestFile, | ||
| const DOWNGRADE_TARGET & | aTarget, | ||
| COMPATIBILITY_REPORT & | aReport, | ||
| wxString * | aUnsupportedToken = nullptr, | ||
| const wxString & | aVariant = wxEmptyString, | ||
| bool | aDropInsteadOfApproximate = false ) |
Load a board, downgrade the copy, and write it stamped for the target.
Fails closed and removes the output if the result would not open there. aUnsupportedToken receives the offending token.
Definition at line 3010 of file board_downgrade.cpp.
References ClassifyBoardForDowngrade(), DowngradeBoardInPlace(), FlattenBoardVariant(), SETTINGS_MANAGER::GetProject(), COMPATIBILITY_REPORT::IsBlocked(), PCB_IO::LoadBoard(), SETTINGS_MANAGER::LoadProject(), DOWNGRADE_TARGET::m_boardVersion, FILEEXT::ProjectFileExtension, SaveBoardForTarget(), and VerifyDowngradedFile().
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(), checkCustomPadArcSurvives(), checkExportUsesOnlyKnownTokens(), checkNativeBoardGolden(), checkTransformedBoardUsesOnlyKnownTokens(), and PCBNEW_JOBS_HANDLER::JobDowngrade().
| wxString FindUnsupportedBoardToken | ( | const wxString & | aSerialized, |
| const DOWNGRADE_TARGET & | aTarget ) |
Scan serialized board 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 2944 of file board_downgrade.cpp.
References BOARD_TOKENS, BOARD_VALUES, containsGroupPlacementSource(), FindUnsupportedToken(), DOWNGRADE_TARGET::m_boardVersion, SEXPR_BOARD_FILE_VERSION, and VER_GROUP_PLACEMENT.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
| void FlattenBoardVariant | ( | BOARD * | aBoard, |
| const wxString & | aVariantName ) |
Bake a variant's overrides into the base footprint attributes.
Run before the variant registry is dropped, so the exported board matches the chosen variant.
Definition at line 2957 of file board_downgrade.cpp.
References BOARD::Footprints(), and name.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), ExportBoardToOlderVersion(), and PCBNEW_JOBS_HANDLER::JobDowngrade().
| void SaveBoardForTarget | ( | BOARD * | aBoard, |
| const wxString & | aPath, | ||
| const DOWNGRADE_TARGET & | aTarget ) |
Save a board stamped for the target, using the writer for that version.
Definition at line 2884 of file board_downgrade.cpp.
References PCB_WRITER_V10::FORMAT_VERSION, PCB_WRITER_V9::FORMAT_VERSION, DOWNGRADE_TARGET::m_boardVersion, PCB_WRITER_V10::SaveBoard(), and PCB_WRITER_V9::SaveBoard().
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(), and ExportBoardToOlderVersion().
| void SaveFootprintForTarget | ( | FOOTPRINT * | aFootprint, |
| const wxString & | aPath, | ||
| const DOWNGRADE_TARGET & | aTarget ) |
Save a single .kicad_mod footprint file for the target.
Definition at line 2895 of file board_downgrade.cpp.
References PCB_WRITER_V10::FORMAT_VERSION, PCB_WRITER_V9::FORMAT_VERSION, DOWNGRADE_TARGET::m_boardVersion, PCB_WRITER_V10::SaveFootprintFile(), and PCB_WRITER_V9::SaveFootprintFile().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and DowngradeFootprintFileToTemp().
|
constexpr |
First board format that stores custom footprint stackups.
Definition at line 72 of file board_downgrade.h.
Referenced by boardRules().
|
constexpr |
First board format that stores variants.
Definition at line 75 of file board_downgrade.h.
Referenced by boardRules(), and PCBNEW_JOBS_HANDLER::JobDowngrade().