KiCad PCB EDA Suite
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{
42 GERBVIEW_SETTINGS* config = Pgm().GetSettingsManager().GetAppSettings<GERBVIEW_SETTINGS>();
43 EXCELLON_DEFAULTS curr_settings;
44 config->GetExcellonDefaults( curr_settings );
45
46 applySettingsToPanel( curr_settings );
47
48 return true;
49}
50
51
53{
54 GERBVIEW_SETTINGS* config = Pgm().GetSettingsManager().GetAppSettings<GERBVIEW_SETTINGS>();
55
56 config->m_ExcellonDefaults.m_UnitsMM = m_rbUnits->GetSelection() != 0;
57 config->m_ExcellonDefaults.m_LeadingZero = m_rbZeroFormat->GetSelection();
58 // The first value of these param is 2, not 0
59 #define FIRST_VALUE 2
60 config->m_ExcellonDefaults.m_MmIntegerLen = m_choiceIntegerMM->GetSelection()+FIRST_VALUE;
61 config->m_ExcellonDefaults.m_MmMantissaLen = m_choiceMantissaMM->GetSelection()+FIRST_VALUE;
62 config->m_ExcellonDefaults.m_InchIntegerLen = m_choiceIntegerInch->GetSelection()+FIRST_VALUE;
63 config->m_ExcellonDefaults.m_InchMantissaLen = m_choiceMantissaInch->GetSelection()+FIRST_VALUE;
64
65 return true;
66}
67
68
70{
71 EXCELLON_DEFAULTS defaults;
72 applySettingsToPanel( defaults );
73}
74
75
77{
78 m_rbUnits->SetSelection( aSettings.m_UnitsMM ? 1 : 0 );
79 m_rbZeroFormat->SetSelection( aSettings.m_LeadingZero );
80
81 // The first value of these param is 2, not 0
82 #define FIRST_VALUE 2
83 m_choiceIntegerMM->SetSelection( aSettings.m_MmIntegerLen-FIRST_VALUE );
84 m_choiceMantissaMM->SetSelection( aSettings.m_MmMantissaLen-FIRST_VALUE );
85 m_choiceIntegerInch->SetSelection( aSettings.m_InchIntegerLen-FIRST_VALUE );
86 m_choiceMantissaInch->SetSelection( aSettings.m_InchMantissaLen-FIRST_VALUE );
87}
88
Class PANEL_GERBVIEW_EXCELLON_SETTINGS_BASE.
void ResetPanel() override
Reset the contents of this panel.
void applySettingsToPanel(const EXCELLON_DEFAULTS &aSettings)
wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:156
#define FIRST_VALUE
see class PGM_BASE
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111
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.