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 The 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 if( GERBVIEW_SETTINGS* cfg = GetAppSettings<GERBVIEW_SETTINGS>( "gerbview" ) )
43 {
44 EXCELLON_DEFAULTS curr_settings;
45
46 cfg->GetExcellonDefaults( curr_settings );
47 applySettingsToPanel( curr_settings );
48 }
49
50 return true;
51}
52
53
55{
56 if( GERBVIEW_SETTINGS* cfg = GetAppSettings<GERBVIEW_SETTINGS>( "gerbview" ) )
57 {
58 cfg->m_ExcellonDefaults.m_UnitsMM = m_rbMM->GetValue();
59 cfg->m_ExcellonDefaults.m_LeadingZero = m_rbLZ->GetValue();
60 // The first value of these param is 2, not 0
61 #define FIRST_VALUE 2
62 cfg->m_ExcellonDefaults.m_MmIntegerLen = m_choiceIntegerMM->GetSelection()+FIRST_VALUE;
63 cfg->m_ExcellonDefaults.m_MmMantissaLen = m_choiceMantissaMM->GetSelection()+FIRST_VALUE;
64 cfg->m_ExcellonDefaults.m_InchIntegerLen = m_choiceIntegerInch->GetSelection()+FIRST_VALUE;
65 cfg->m_ExcellonDefaults.m_InchMantissaLen = m_choiceMantissaInch->GetSelection()+FIRST_VALUE;
66 }
67
68 return true;
69}
70
71
73{
74 EXCELLON_DEFAULTS defaults;
75 applySettingsToPanel( defaults );
76}
77
78
80{
81 if( aSettings.m_UnitsMM )
82 m_rbMM->SetValue( true );
83 else
84 m_rbInches->SetValue( true );
85
86 if( aSettings.m_LeadingZero )
87 m_rbLZ->SetValue( true );
88 else
89 m_rbTZ->SetValue( true );
90
91 // The first value of these param is 2, not 0
92 #define FIRST_VALUE 2
93 m_choiceIntegerMM->SetSelection( aSettings.m_MmIntegerLen-FIRST_VALUE );
94 m_choiceMantissaMM->SetSelection( aSettings.m_MmMantissaLen-FIRST_VALUE );
95 m_choiceIntegerInch->SetSelection( aSettings.m_InchIntegerLen-FIRST_VALUE );
96 m_choiceMantissaInch->SetSelection( aSettings.m_InchMantissaLen-FIRST_VALUE );
97}
98
Class PANEL_GERBVIEW_EXCELLON_SETTINGS_BASE.
void ResetPanel() override
Reset the contents of this panel.
void applySettingsToPanel(const EXCELLON_DEFAULTS &aSettings)
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:156
#define FIRST_VALUE
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.