KiCad PCB EDA Suite
panel_eeschema_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) 2009 Wayne Stambaugh <stambaughw@verizon.net>
5  * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #include <fctsys.h>
26 #include <base_screen.h>
27 #include <sch_edit_frame.h>
28 
30 
31 
34  m_frame( aFrame )
35 {}
36 
37 
39 {
40  m_choiceUnits->SetSelection( m_frame->GetUserUnits() == INCHES ? 0 : 1 );
41 
42  m_textSizeCtrl->SetValue( StringFromValue( INCHES, GetDefaultTextSize(), false, true ) );
43  m_hPitchCtrl->SetValue( StringFromValue( INCHES, m_frame->GetRepeatStep().x, false, true ) );
44  m_vPitchCtrl->SetValue( StringFromValue( INCHES, m_frame->GetRepeatStep().y, false, true ) );
46 
49 
53 
54  return true;
55 }
56 
57 
59 {
60  m_frame->SetUserUnits( m_choiceUnits->GetSelection() == 0 ? INCHES : MILLIMETRES );
61 
62  int textSize = ValueFromString( INCHES, m_textSizeCtrl->GetValue(), true );
63 
64  if( textSize != GetDefaultTextSize() )
65  {
66  SetDefaultTextSize( textSize );
67  m_frame->SaveProjectSettings( false );
68  }
69 
71  ValueFromString( INCHES, m_vPitchCtrl->GetValue(), true ) ) );
73 
76 
80 
81  return true;
82 }
83 
84 
void SetForceHVLines(bool aForceHVdirection)
bool GetForceHVLines() const
void SetRepeatDeltaLabel(int aDelta)
Sets the repeat delta label value for repeat command.
bool GetAutoplaceAlign() const
const wxPoint GetRepeatStep() const
void SetAutoplaceAlign(bool aEnable)
Schematic editor (Eeschema) main window.
int GetRepeatDeltaLabel() const
int ValueFromString(EDA_UNITS_T aUnits, const wxString &aTextValue, bool aUseMils)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application...
Definition: base_units.cpp:409
void SetAutoplaceJustify(bool aEnable)
Class PANEL_EESCHEMA_SETTINGS_BASE.
void SaveProjectSettings(bool aAskForSave) override
Save changes to the project settings to the project (.pro) file.
void SetDefaultTextSize(int aTextSize)
PANEL_EESCHEMA_SETTINGS(SCH_EDIT_FRAME *aFrame, wxWindow *aWindow)
EDA_UNITS_T GetUserUnits() const override
Return the user units currently in use.
Definition: draw_frame.h:284
Definition: common.h:160
bool GetAutoplaceJustify() const
bool GetFootprintPreview() const
void SetAutoplaceFields(bool aEnable)
wxString StringFromValue(EDA_UNITS_T aUnits, int aValue, bool aAddUnitSymbol, bool aUseMils)
Function StringFromValue returns the string from aValue according to units (inch, mm ...
Definition: base_units.cpp:210
void SetRepeatStep(const wxPoint &aStep)
Sets the repeat step value for repeat command.
bool GetAutoplaceFields() const
void SetFootprintPreview(bool aEnable)
BASE_SCREEN class implementation.
void SetUserUnits(EDA_UNITS_T aUnits)
Definition: draw_frame.h:285
int GetDefaultTextSize()
Default size for text in general.