KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 The 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, see <https://www.gnu.org/licenses/>.
19 */
20
21#include <pgm_base.h>
23#include <pcbnew_settings.h>
26
27
29 FRAME_T aFrameType ) :
31 m_cfg( aCfg ),
32 m_frameType( aFrameType )
33{
35}
36
37
39{
41 {
43
44 if( cfg && cfg->m_DisplayInvertXAxis )
45 m_xIncreasesLeft->SetValue( true );
46 else
47 m_xIncreasesRight->SetValue( true );
48
49 if( cfg && cfg->m_DisplayInvertYAxis )
50 m_yIncreasesUp->SetValue( true );
51 else
52 m_yIncreasesDown->SetValue( true );
53 }
54 else
55 {
57
59 m_pageOrigin->SetValue( true );
61 m_gridOrigin->SetValue( true );
62 else
63 m_drillPlaceOrigin->SetValue( true );
64
65 if( cfg &&cfg->m_Display.m_DisplayInvertXAxis )
66 m_xIncreasesLeft->SetValue( true );
67 else
68 m_xIncreasesRight->SetValue( true );
69
70 if( cfg && cfg->m_Display.m_DisplayInvertYAxis )
71 m_yIncreasesUp->SetValue( true );
72 else
73 m_yIncreasesDown->SetValue( true );
74 }
75}
76
77
84
85
87{
89 {
91 {
92 cfg->m_DisplayInvertXAxis = m_xIncreasesLeft->GetValue();
93 cfg->m_DisplayInvertYAxis = m_yIncreasesUp->GetValue();
94 }
95 }
96 else
97 {
99 {
100 if( m_pageOrigin->GetValue() )
101 cfg->m_Display.m_DisplayOrigin = PCB_DISPLAY_ORIGIN::PCB_ORIGIN_PAGE;
102 else if( m_gridOrigin->GetValue() )
103 cfg->m_Display.m_DisplayOrigin = PCB_DISPLAY_ORIGIN::PCB_ORIGIN_GRID;
104 else
105 cfg->m_Display.m_DisplayOrigin = PCB_DISPLAY_ORIGIN::PCB_ORIGIN_AUX;
106
107 cfg->m_Display.m_DisplayInvertXAxis = m_xIncreasesLeft->GetValue();
108 cfg->m_Display.m_DisplayInvertYAxis = m_yIncreasesUp->GetValue();
109 }
110 }
111
112 return true;
113}
114
115
117{
119 {
121 cfg.Load(); // Loading without a file will init to defaults
122
123 loadSettings( &cfg );
124 }
125 else
126 {
127 PCBNEW_SETTINGS cfg;
128 cfg.Load(); // Loading without a file will init to defaults
129
130 loadSettings( &cfg );
131 }
132}
133
134
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
virtual void Load()
Updates the parameters of this object based on the current JSON document contents.
PANEL_PCBNEW_DISPLAY_ORIGIN_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
void ResetPanel() override
Reset the contents of this panel.
PANEL_PCBNEW_DISPLAY_ORIGIN(wxWindow *aParent, APP_SETTINGS_BASE *aCfg, FRAME_T aFrameType)
void loadSettings(APP_SETTINGS_BASE *aCfg)
DISPLAY_OPTIONS m_Display
FRAME_T
The set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition frame_type.h:29
@ FRAME_PCB_EDITOR
Definition frame_type.h:38
@ FRAME_FOOTPRINT_EDITOR
Definition frame_type.h:39
@ PCB_ORIGIN_AUX
@ PCB_ORIGIN_GRID
@ PCB_ORIGIN_PAGE
see class PGM_BASE
T * GetAppSettings(const char *aFilename)