KiCad PCB EDA Suite
Loading...
Searching...
No Matches
panel_gerbview_excellon_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) 2021 Jean-Pierre Charras jp.charras at wanadoo.fr
5 * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include <pgm_base.h>
22#include <widgets/ui_common.h>
24#include <gerbview_settings.h>
25
27
28
30 PANEL_GERBVIEW_EXCELLON_SETTINGS_BASE( aParent, wxID_ANY )
31{
32 wxFont helpFont = KIUI::GetInfoFont( this ).Italic();
33 m_fileFormatHelp->SetFont( helpFont );
34 m_coordsFormatHelp->SetFont( helpFont );
35 m_hint1->SetFont( helpFont );
36 m_hint2->SetFont( helpFont );
37}
38
39
41{
43 GERBVIEW_SETTINGS* cfg = mgr.GetAppSettings<GERBVIEW_SETTINGS>( "gerbview" );
44 EXCELLON_DEFAULTS curr_settings;
45
46 cfg->GetExcellonDefaults( curr_settings );
47
48 applySettingsToPanel( curr_settings );
49
50 return true;
51}
52
53
55{
57 GERBVIEW_SETTINGS* cfg = mgr.GetAppSettings<GERBVIEW_SETTINGS>( "gerbview" );
58
59 cfg->m_ExcellonDefaults.m_UnitsMM = m_rbUnits->GetSelection() != 0;
60 cfg->m_ExcellonDefaults.m_LeadingZero = m_rbZeroFormat->GetSelection();
61 // The first value of these param is 2, not 0
62 #define FIRST_VALUE 2
67
68 return true;
69}
70
71
73{
74 EXCELLON_DEFAULTS defaults;
75 applySettingsToPanel( defaults );
76}
77
78
80{
81 m_rbUnits->SetSelection( aSettings.m_UnitsMM ? 1 : 0 );
82 m_rbZeroFormat->SetSelection( aSettings.m_LeadingZero );
83
84 // The first value of these param is 2, not 0
85 #define FIRST_VALUE 2
86 m_choiceIntegerMM->SetSelection( aSettings.m_MmIntegerLen-FIRST_VALUE );
87 m_choiceMantissaMM->SetSelection( aSettings.m_MmMantissaLen-FIRST_VALUE );
88 m_choiceIntegerInch->SetSelection( aSettings.m_InchIntegerLen-FIRST_VALUE );
89 m_choiceMantissaInch->SetSelection( aSettings.m_InchMantissaLen-FIRST_VALUE );
90}
91
EXCELLON_DEFAULTS m_ExcellonDefaults
void GetExcellonDefaults(EXCELLON_DEFAULTS &aNCDefaults)
return the Excellon default values to read a drill file
Class PANEL_GERBVIEW_EXCELLON_SETTINGS_BASE.
void ResetPanel() override
Reset the contents of this panel.
void applySettingsToPanel(const EXCELLON_DEFAULTS &aSettings)
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:142
T * GetAppSettings(const wxString &aFilename)
Returns a handle to the a given settings by type If the settings have already been loaded,...
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:154
#define FIRST_VALUE
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1060
see class PGM_BASE
management of default values used to read a Excellon (.nc) drill file Some important parameters are n...
Functions to provide common constants and other functions to assist in making a consistent UI.