KiCad PCB EDA Suite
Loading...
Searching...
No Matches
doc_property_helpers.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
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 3
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU 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, you may find one here:
18 * http://www.gnu.org/licenses/gpl-3.0.html
19 * or you may search the http://www.gnu.org website for the version 3 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#ifndef KICAD_DIFF_DOC_PROPERTY_HELPERS_H
25#define KICAD_DIFF_DOC_PROPERTY_HELPERS_H
26
28
29#include <page_info.h>
30
31#include <utility>
32#include <vector>
33
34
35namespace KICAD_DIFF
36{
37
51inline void AppendPaperDeltas( std::vector<PROPERTY_DELTA>& aDeltas, const PAGE_INFO& aBefore,
52 const PAGE_INFO& aAfter )
53{
54 if( aBefore.GetType() != aAfter.GetType() )
55 {
58 d.before = DIFF_VALUE::FromEnum( static_cast<int>( aBefore.GetType() ),
59 aBefore.GetTypeAsString().ToStdString() );
60 d.after = DIFF_VALUE::FromEnum( static_cast<int>( aAfter.GetType() ),
61 aAfter.GetTypeAsString().ToStdString() );
62 aDeltas.push_back( std::move( d ) );
63 }
64
65 if( aBefore.IsPortrait() != aAfter.IsPortrait() )
66 {
69 d.before = DIFF_VALUE::FromBool( aBefore.IsPortrait() );
71 aDeltas.push_back( std::move( d ) );
72 }
73}
74
75} // namespace KICAD_DIFF
76
77#endif // KICAD_DIFF_DOC_PROPERTY_HELPERS_H
static DIFF_VALUE FromEnum(int aValue, const std::string &aLabel)
static DIFF_VALUE FromBool(bool aValue)
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition page_info.h:75
wxString GetTypeAsString() const
bool IsPortrait() const
Definition page_info.h:124
const PAGE_SIZE_TYPE & GetType() const
Definition page_info.h:98
const wxString DOC_PROP_PAGE_FORMAT
Property-name keys for the synthetic document-level ITEM_CHANGE (empty KIID_PATH).
const wxString DOC_PROP_PAGE_ORIENTATION
void AppendPaperDeltas(std::vector< PROPERTY_DELTA > &aDeltas, const PAGE_INFO &aBefore, const PAGE_INFO &aAfter)
Append DOC_PROP_PAGE_FORMAT and/or DOC_PROP_PAGE_ORIENTATION deltas to aDeltas when the two PAGE_INFO...
Single (name, before, after) triple for one mutated property on an item.