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 
55 
56  return true;
57 }
58 
59 
61 {
62  m_frame->SetUserUnits( m_choiceUnits->GetSelection() == 0 ? INCHES : MILLIMETRES );
63 
64  int textSize = ValueFromString( INCHES, m_textSizeCtrl->GetValue(), true );
65 
66  if( textSize != GetDefaultTextSize() )
67  {
68  SetDefaultTextSize( textSize );
69  m_frame->SaveProjectSettings( false );
70  }
71 
72  m_frame->SetRepeatStep( wxPoint( ValueFromString( INCHES, m_hPitchCtrl->GetValue(), true ),
73  ValueFromString( INCHES, m_vPitchCtrl->GetValue(), true ) ) );
75 
78 
82 
84 
85  return true;
86 }
87 
88 
bool GetAutoplaceJustify() const
void SetUserUnits(EDA_UNITS_T aUnits)
void SetForceHVLines(bool aForceHVdirection)
void SetRepeatDeltaLabel(int aDelta)
Sets the repeat delta label value for repeat command.
void SetAutoplaceAlign(bool aEnable)
bool GetShowFootprintPreviews() const
Schematic editor (Eeschema) main window.
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:414
bool GetAutoplaceFields() const
void SetAutoplaceJustify(bool aEnable)
void SetDragActionIsMove(bool aValue)
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)
bool GetForceHVLines() const
bool GetDragActionIsMove() const
PANEL_EESCHEMA_SETTINGS(SCH_EDIT_FRAME *aFrame, wxWindow *aWindow)
Definition: common.h:155
const wxPoint GetRepeatStep() const
void SetShowFootprintPreviews(bool aEnable)
EDA_UNITS_T GetUserUnits() const
Return the user units currently in use.
void SetAutoplaceFields(bool aEnable)
int GetRepeatDeltaLabel() const
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 GetAutoplaceAlign() const
BASE_SCREEN class implementation.
int GetDefaultTextSize()
Default size for text in general.