KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pl_editor_settings.cpp
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 (C) 2020 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 2
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/old-licenses/gpl-2.0.html
19* or you may search the http://www.gnu.org website for the version 2 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#include <settings/parameters.h>
25#include <wx/config.h>
26
27#include "pl_editor_settings.h"
28
31
32
35{
36 // Make Coverity happy:
39 m_LastCustomWidth = 17000;
40 m_LastCustomHeight = 11000;
41 m_LastWasPortrait = false;
42 m_BlackBackground = false;
43
44 // Build settings:
45 m_params.emplace_back(
46 new PARAM<int>( "properties_frame_width", &m_PropertiesFrameWidth, 150 ) );
47
48 m_params.emplace_back( new PARAM<int>( "corner_origin", &m_CornerOrigin, 0 ) );
49
50 m_params.emplace_back( new PARAM<bool>( "black_background", &m_BlackBackground, false ) );
51
52 m_params.emplace_back( new PARAM<wxString>( "last_paper_size", &m_LastPaperSize, "A3" ) );
53
54 m_params.emplace_back( new PARAM<int>( "last_custom_width", &m_LastCustomWidth, 17000 ) );
55
56 m_params.emplace_back( new PARAM<int>( "last_custom_height", &m_LastCustomHeight, 11000 ) );
57
58 m_params.emplace_back( new PARAM<bool>( "last_was_portrait", &m_LastWasPortrait, false ) );
59}
60
61
62bool PL_EDITOR_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
63{
64 bool ret = APP_SETTINGS_BASE::MigrateFromLegacy( aCfg );
65
66 ret &= fromLegacy<int>( aCfg, "PropertiesFrameWidth", "properties_frame_width" );
67 ret &= fromLegacy<int>( aCfg, "CornerOriginChoice", "corner_origin" );
68 ret &= fromLegacy<bool>( aCfg, "BlackBgColor", "black_background" );
69 ret &= fromLegacy<int>( aCfg, "LastUsedPaperSize", "last_paper_size" );
70 ret &= fromLegacy<int>( aCfg, "LastUsedCustomWidth", "last_custom_width" );
71 ret &= fromLegacy<int>( aCfg, "LastUsedCustomHeight", "last_custom_height" );
72 ret &= fromLegacy<bool>( aCfg, "LastUsedWasPortrait", "last_was_portrait" );
73
74 return ret;
75}
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:92
virtual bool MigrateFromLegacy(wxConfigBase *aCfg) override
Migrates from wxConfig to JSON-based configuration.
std::vector< PARAM_BASE * > m_params
The list of parameters (owned by this object)
virtual bool MigrateFromLegacy(wxConfigBase *aLegacyConfig) override
Migrates from wxConfig to JSON-based configuration.
const int plEditorSchemaVersion
! Update the schema version whenever a migration is required