KiCad PCB EDA Suite
panel_pcbnew_display_origin.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) 2009 Jean-Pierre Charras, [email protected]
5 * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#include <pgm_base.h>
27#include <pcbnew_settings.h>
29
30
33{
34}
35
36
38{
39 int origin = 0;
40
41 switch( aCfg->m_Display.m_DisplayOrigin )
42 {
43 case PCB_DISPLAY_ORIGIN::PCB_ORIGIN_PAGE: origin = 0; break;
44 case PCB_DISPLAY_ORIGIN::PCB_ORIGIN_AUX: origin = 1; break;
45 case PCB_DISPLAY_ORIGIN::PCB_ORIGIN_GRID: origin = 2; break;
46 }
47
48 m_DisplayOrigin->SetSelection( origin );
49 m_XAxisDirection->SetSelection( aCfg->m_Display.m_DisplayInvertXAxis ? 1 : 0 );
50 m_YAxisDirection->SetSelection( aCfg->m_Display.m_DisplayInvertYAxis ? 0 : 1 );
51}
52
53
55{
56 PCBNEW_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
57
58 loadPCBSettings( cfg );
59
60 return true;
61}
62
63
65{
66 PCBNEW_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
67
68 switch( m_DisplayOrigin->GetSelection() )
69 {
73 }
74
75 cfg->m_Display.m_DisplayInvertXAxis = m_XAxisDirection->GetSelection() != 0;
76 cfg->m_Display.m_DisplayInvertYAxis = m_YAxisDirection->GetSelection() == 0;
77
78 return true;
79}
80
81
83{
85 cfg.Load(); // Loading without a file will init to defaults
86
87 loadPCBSettings( &cfg );
88}
89
90
virtual void Load()
Updates the parameters of this object based on the current JSON document contents.
Class PANEL_PCBNEW_DISPLAY_ORIGIN_BASE.
void ResetPanel() override
Reset the contents of this panel.
void loadPCBSettings(PCBNEW_SETTINGS *aCfg)
DISPLAY_OPTIONS m_Display
@ PCB_ORIGIN_AUX
@ PCB_ORIGIN_GRID
@ PCB_ORIGIN_PAGE
see class PGM_BASE
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111