KiCad PCB EDA Suite
dialog_modedit_options.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) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
27 #include <fctsys.h>
28 #include <pcbnew.h>
29 #include <wxPcbStruct.h>
31 #include <base_units.h>
32 
33 #include <module_editor_frame.h>
34 
36 
37 
39 {
42 
43 public:
45 
46 private:
47  void OnCancelClick( wxCommandEvent& event ) override { EndModal( wxID_CANCEL ); }
48  void OnOkClick( wxCommandEvent& event ) override;
49 
50  void initValues( );
51 };
52 
53 
56 {
57  m_parent = aParent;
59  initValues();
60 
61  m_sdbSizer1OK->SetDefault();
62  GetSizer()->SetSizeHints( this );
63 
64  Centre();
65 }
66 
67 
69 {
70  DIALOG_MODEDIT_OPTIONS dlg( aCaller );
71 
72  int ret = dlg.ShowModal();
73 
74  return ret == wxID_OK;
75 }
76 
77 
79 {
80  EDA_UNITS_T units = g_UserUnit;
81 
82  // Modules: graphic lines width:
85 
86  // Modules: Texts: Size & width:
89 
92 
95 
96  // Ref: default values
98  int sel = m_brdSettings.m_RefDefaultlayer == F_SilkS ? 0 : 1;
99  m_choiceLayerReference->SetSelection( sel );
101  m_choiceVisibleReference->SetSelection( sel );
102 
103  // Value: default values
105  sel = m_brdSettings.m_ValueDefaultlayer == F_SilkS ? 0 : 1;
106  m_choiceLayerValue->SetSelection( sel );
108  m_choiceVisibleValue->SetSelection( sel );
109 }
110 
111 
112 void DIALOG_MODEDIT_OPTIONS::OnOkClick( wxCommandEvent& event )
113 {
118 
119  // Ref: default values
121  int sel = m_choiceLayerReference->GetSelection();
123  sel = m_choiceVisibleReference->GetSelection();
125 
126  // Value: default values
128  sel = m_choiceLayerValue->GetSelection();
130  sel = m_choiceVisibleValue->GetSelection();
132 
134 
135  EndModal( wxID_OK );
136 }
wxString m_RefDefaultText
Default ref text on fp creation.
DIALOG_MODEDIT_OPTIONS(FOOTPRINT_EDIT_FRAME *aParent)
Definition of class FOOTPRINT_EDIT_FRAME.
bool m_ValueDefaultVisibility
Default value text visibility on fp creation.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const override
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
Implementation of conversion functions that require both schematic and board internal units...
int m_ModuleTextWidth
Default footprint texts thickness.
int m_ModuleSegmentWidth
Default width for all graphic lines.
Class DIALOG_MODEDIT_OPTIONS_BASE.
int m_ValueDefaultlayer
Default value text layer on fp creation.
wxSize m_ModuleTextSize
Default footprint texts size.
void OnCancelClick(wxCommandEvent &event) override
bool InvokeFPEditorPrefsDlg(FOOTPRINT_EDIT_FRAME *aCaller)
Function InvokeSVGPrint shows the SVG print dialog.
wxString GetAbbreviatedUnitsLabel(EDA_UNITS_T aUnit)
Definition: base_units.cpp:479
FOOTPRINT_EDIT_FRAME * m_parent
void OnOkClick(wxCommandEvent &event) override
wxString m_ValueDefaultText
Default value text on fp creation.
int ValueFromTextCtrl(const wxTextCtrl &aTextCtr)
Convert the number Value in a string according to the internal units and the selected unit (g_UserUni...
Definition: base_units.cpp:384
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
void SetDesignSettings(const BOARD_DESIGN_SETTINGS &aSettings) override
void PutValueInLocalUnits(wxTextCtrl &aTextCtr, int aValue)
Function PutValueInLocalUnits converts aValue from internal units to user units and append the units ...
Definition: base_units.cpp:265
BOARD_DESIGN_SETTINGS m_brdSettings
int m_RefDefaultlayer
Default ref text layer on fp creation.
bool m_RefDefaultVisibility
Default ref text visibility on fp creation.
EDA_UNITS_T
Definition: common.h:143
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.