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 <pcb_edit_frame.h>
30 #include <board_design_settings.h>
31 #include <base_units.h>
32 #include <widgets/text_ctrl_eval.h>
33 
34 #include <footprint_edit_frame.h>
35 
37 
38 
40 {
43 
44 public:
46 
47 private:
48  void OnCancelClick( wxCommandEvent& event ) override { EndModal( wxID_CANCEL ); }
49  void OnOkClick( wxCommandEvent& event ) override;
50 
51  void initValues( );
52 };
53 
54 
57 {
58  m_parent = aParent;
60  initValues();
61 
62  m_sdbSizer1OK->SetDefault();
63  GetSizer()->SetSizeHints( this );
64 
65  Centre();
66 }
67 
68 
70 {
71  DIALOG_MODEDIT_OPTIONS dlg( aCaller );
72 
73  int ret = dlg.ShowModal();
74 
75  return ret == wxID_OK;
76 }
77 
78 
80 {
81  EDA_UNITS_T units = g_UserUnit;
82 
83  // Modules: graphic lines width:
86 
87  // Modules: Texts: Size & width:
90 
93 
96 
97  // Ref: default values
99  int sel = m_brdSettings.m_RefDefaultlayer == F_SilkS ? 0 : 1;
100  m_choiceLayerReference->SetSelection( sel );
102  m_choiceVisibleReference->SetSelection( sel );
103 
104  // Value: default values
106  sel = m_brdSettings.m_ValueDefaultlayer == F_SilkS ? 0 : 1;
107  m_choiceLayerValue->SetSelection( sel );
109  m_choiceVisibleValue->SetSelection( sel );
110 }
111 
112 
113 void DIALOG_MODEDIT_OPTIONS::OnOkClick( wxCommandEvent& event )
114 {
119 
120  // Ref: default values
122  int sel = m_choiceLayerReference->GetSelection();
124  sel = m_choiceVisibleReference->GetSelection();
126 
127  // Value: default values
129  sel = m_choiceLayerValue->GetSelection();
131  sel = m_choiceVisibleValue->GetSelection();
133 
135  m_parent->OnModify();
136 
137  EndModal( wxID_OK );
138 }
wxString m_RefDefaultText
Default ref text on fp creation.
DIALOG_MODEDIT_OPTIONS(FOOTPRINT_EDIT_FRAME *aParent)
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
Definition of class FOOTPRINT_EDIT_FRAME.
bool InvokeFPEditorPrefsDlg(FOOTPRINT_EDIT_FRAME *aCaller)
Function InvokeSVGPrint shows the SVG print dialog.
virtual void OnModify() override
Virtual Function OnModify() Must be called after a footprint change in order to set the "modify" flag...
wxString GetAbbreviatedUnitsLabel(EDA_UNITS_T aUnit)
Definition: base_units.cpp:484
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:385
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:266
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:144
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.