KiCad PCB EDA Suite
Loading...
Searching...
No Matches
eeschema/dialogs/panel_setup_formatting.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 The 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, see <https://www.gnu.org/licenses/>.
18 */
19
20#include <sch_edit_frame.h>
21#include <sch_painter.h>
22#include <kiface_base.h>
24#include <sch_junction.h>
25#include <schematic.h>
26#include <schematic_settings.h>
29
30
33 m_frame( aFrame ),
39{
40 wxSize minSize = m_dashLengthCtrl->GetMinSize();
41 int minWidth = m_dashLengthCtrl->GetTextExtent( wxT( "XXX.XXX" ) ).GetWidth();
42
43 m_dashLengthCtrl->SetMinSize( wxSize( minWidth, minSize.GetHeight() ) );
44 m_gapLengthCtrl->SetMinSize( wxSize( minWidth, minSize.GetHeight() ) );
45
46 m_dashedLineHelp->SetFont( KIUI::GetSmallInfoFont( this ).Italic() );
47}
48
49
50void PANEL_SETUP_FORMATTING::onCheckBoxIref( wxCommandEvent& event )
51{
52 bool enabled = m_showIntersheetsReferences->GetValue();
53
54 m_radioFormatStandard->Enable( enabled );
55 m_radioFormatAbbreviated->Enable( enabled );
56 m_prefixLabel->Enable( enabled );
57 m_prefixCtrl->Enable( enabled );
58 m_suffixLabel->Enable( enabled );
59 m_suffixCtrl->Enable( enabled );
60 m_listOwnPage->Enable( enabled );
61}
62
63
65{
66 SCHEMATIC_SETTINGS& settings = m_frame->Schematic().Settings();
67
68 m_textSize.SetUnits( EDA_UNITS::MILS );
69 m_lineWidth.SetUnits( EDA_UNITS::MILS );
72
73 m_textSize.SetValue( settings.m_DefaultTextSize );
74 m_lineWidth.SetValue( settings.m_DefaultLineWidth );
75 m_pinSymbolSize.SetValue( settings.m_PinSymbolSize );
76 m_showDNPMarkers->SetValue( settings.m_ShowDNPMarkers );
77 m_choiceJunctionDotSize->SetSelection( settings.m_JunctionSizeChoice );
78 m_choiceHopOverSize->SetSelection( settings.m_HopOverSizeChoice );
79 m_connectionGridSize.SetValue( settings.m_ConnectionGridSize );
80
82
85 m_prefixLabel->Enable( settings.m_IntersheetRefsShow );
86 m_prefixCtrl->Enable( settings.m_IntersheetRefsShow );
87 m_suffixLabel->Enable( settings.m_IntersheetRefsShow );
88 m_suffixCtrl->Enable( settings.m_IntersheetRefsShow );
89 m_listOwnPage->Enable( settings.m_IntersheetRefsShow );
90
93 m_prefixCtrl->ChangeValue( settings.m_IntersheetRefsPrefix );
94 m_suffixCtrl->ChangeValue( settings.m_IntersheetRefsSuffix );
95 m_listOwnPage->SetValue( settings.m_IntersheetRefsListOwnPage );
96
97#define SET_VALUE( ctrl, units, value ) \
98 ctrl->SetValue( EDA_UNIT_UTILS::UI::StringFromValue( unityScale, units, value ) )
99
102 settings.m_FontMetrics.m_OverbarHeight * 100.0 );
106
107#undef SET_VALUE
108
109 m_vPrecisionCtrl->SetValue( settings.m_OPO_VPrecision );
110 m_vRangeCtrl->SetStringSelection( settings.m_OPO_VRange );
111 m_iPrecisionCtrl->SetValue( settings.m_OPO_IPrecision );
112 m_iRangeCtrl->SetStringSelection( settings.m_OPO_IRange );
113
114 return true;
115}
116
117
119{
121 return false;
122
123 SCHEMATIC_SETTINGS& settings = m_frame->Schematic().Settings();
124
125 settings.m_DefaultTextSize = m_textSize.GetIntValue();
126 settings.m_DefaultLineWidth = m_lineWidth.GetIntValue();
127 settings.m_PinSymbolSize = m_pinSymbolSize.GetIntValue();
128 settings.m_ShowDNPMarkers = m_showDNPMarkers->GetValue();
129 settings.m_ConnectionGridSize = m_connectionGridSize.GetIntValue();
130
131 if( m_choiceJunctionDotSize->GetSelection() != wxNOT_FOUND )
132 settings.m_JunctionSizeChoice = m_choiceJunctionDotSize->GetSelection();
133
134 if( m_choiceHopOverSize->GetSelection() != wxNOT_FOUND )
135 settings.m_HopOverSizeChoice = m_choiceHopOverSize->GetSelection();
136
139 settings.m_IntersheetRefsPrefix = m_prefixCtrl->GetValue();
140 settings.m_IntersheetRefsSuffix = m_suffixCtrl->GetValue();
141 settings.m_IntersheetRefsListOwnPage = m_listOwnPage->GetValue();
142
143#define GET_VALUE( units, str ) EDA_UNIT_UTILS::UI::DoubleValueFromString( unityScale, units, str )
144
146 m_textOffsetRatioCtrl->GetValue() ) / 100.0;
148 m_overbarHeightCtrl->GetValue() ) / 100.0;
152 m_labelSizeRatioCtrl->GetValue() ) / 100.0;
153
154#undef GET_VALUE
155
156 settings.m_OPO_VPrecision = m_vPrecisionCtrl->GetValue();
157
158 if( m_vRangeCtrl->GetSelection() == 0 )
159 settings.m_OPO_VRange = wxS( "~V" );
160 else
161 settings.m_OPO_VRange = m_vRangeCtrl->GetStringSelection();
162
163 settings.m_OPO_IPrecision = m_iPrecisionCtrl->GetValue();
164
165 if( m_iRangeCtrl->GetSelection() == 0 )
166 settings.m_OPO_IRange = wxS( "~A" );
167 else
168 settings.m_OPO_IRange = m_iRangeCtrl->GetStringSelection();
169
170 return true;
171}
172
173
175{
176 m_textSize.SetValue( aSettings.m_DefaultTextSize );
177 m_lineWidth.SetValue( aSettings.m_DefaultLineWidth );
178 m_pinSymbolSize.SetValue( aSettings.m_PinSymbolSize );
179 m_showDNPMarkers->SetValue( aSettings.m_ShowDNPMarkers );
180 m_connectionGridSize.SetValue( aSettings.m_ConnectionGridSize );
181
185 m_prefixCtrl->ChangeValue( aSettings.m_IntersheetRefsPrefix );
186 m_suffixCtrl->ChangeValue( aSettings.m_IntersheetRefsSuffix );
187 m_listOwnPage->SetValue( aSettings.m_IntersheetRefsListOwnPage );
188
189#define SET_VALUE( ctrl, units, value ) \
190 ctrl->SetValue( EDA_UNIT_UTILS::UI::StringFromValue( unityScale, units, value ) )
191
196
197#undef SET_VALUE
198}
double m_OverbarHeight
PANEL_SETUP_FORMATTING_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
PANEL_SETUP_FORMATTING(wxWindow *aWindow, SCH_EDIT_FRAME *aFrame)
void onCheckBoxIref(wxCommandEvent &event) override
void ImportSettingsFrom(SCHEMATIC_SETTINGS &aSettings)
These are loaded from Eeschema settings but then overwritten by the project settings.
KIFONT::METRICS m_FontMetrics
Schematic editor (Eeschema) main window.
const int minSize
Push and Shove router track width and via size dialog.
#define SET_VALUE(ctrl, units, value)
#define GET_VALUE(units, str)
KICOMMON_API wxFont GetSmallInfoFont(wxWindow *aWindow)
#define MIN_CONNECTION_GRID_MILS