KiCad PCB EDA Suite
Loading...
Searching...
No Matches
board_downgrade.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
23#include <downgrade_scan.h>
24#include <downgrade_target.h>
25
26class BOARD;
27class FOOTPRINT;
28
32 bool aDropInsteadOfApproximate = false );
33
36void DowngradeBoardInPlace( BOARD* aBoard, const DOWNGRADE_TARGET& aTarget, bool aDropInsteadOfApproximate = false );
37
39void DowngradeFootprintInPlace( FOOTPRINT* aFootprint, const DOWNGRADE_TARGET& aTarget,
40 bool aDropInsteadOfApproximate = false );
41
44bool ExportBoardToOlderVersion( const wxString& aSrcFile, const wxString& aDestFile, const DOWNGRADE_TARGET& aTarget,
45 COMPATIBILITY_REPORT& aReport, wxString* aUnsupportedToken = nullptr,
46 const wxString& aVariant = wxEmptyString, bool aDropInsteadOfApproximate = false );
47
50void FlattenBoardVariant( BOARD* aBoard, const wxString& aVariantName );
51
53void SaveBoardForTarget( BOARD* aBoard, const wxString& aPath, const DOWNGRADE_TARGET& aTarget );
54
56void SaveFootprintForTarget( FOOTPRINT* aFootprint, const wxString& aPath, const DOWNGRADE_TARGET& aTarget );
57
60DOWNGRADE_FILE_RESULT DowngradeFootprintFileToTemp( const wxString& aSrcFile, const wxString& aTmpFile,
61 const DOWNGRADE_TARGET& aTarget,
62 bool aDropInsteadOfApproximate = false );
63
66wxString FindUnsupportedBoardToken( const wxString& aSerialized, const DOWNGRADE_TARGET& aTarget );
67
70
72constexpr int FIRST_FP_CUSTOM_STACKUP = 20250818;
73
75constexpr int FIRST_PCB_VARIANTS = 20260101;
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 SaveFootprintForTarget(FOOTPRINT *aFootprint, const wxString &aPath, const DOWNGRADE_TARGET &aTarget)
Save a single .kicad_mod footprint file for the target.
void DowngradeFootprintInPlace(FOOTPRINT *aFootprint, const DOWNGRADE_TARGET &aTarget, bool aDropInsteadOfApproximate=false)
Footprint-scoped downgrade for standalone .kicad_mod files the board pass never sees.
int BoardDowngradeCoveredVersion()
The format the denylist was generated against. A format bump forces a review.
constexpr int FIRST_FP_CUSTOM_STACKUP
First board format that stores custom footprint stackups.
void DowngradeBoardInPlace(BOARD *aBoard, const DOWNGRADE_TARGET &aTarget, bool aDropInsteadOfApproximate=false)
Approximate or remove, in place, what the target cannot represent.
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 SaveBoardForTarget(BOARD *aBoard, const wxString &aPath, const DOWNGRADE_TARGET &aTarget)
Save a board stamped for the target, using the writer for that version.
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.
void FlattenBoardVariant(BOARD *aBoard, const wxString &aVariantName)
Bake a variant's overrides into the base footprint attributes.
constexpr int FIRST_PCB_VARIANTS
First board format that stores variants.
wxString FindUnsupportedBoardToken(const wxString &aSerialized, const DOWNGRADE_TARGET &aTarget)
Scan serialized board text for tokens the target cannot parse.
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:410
What an export to a given target will keep, approximate, drop, or block.
DOWNGRADE_FILE_RESULT
What a per-file converter did with one library file.
An older KiCad release we can export a project back to.