KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcbnew/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, 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 */
23
24#include <pcb_edit_frame.h>
25#include <pcb_painter.h>
26#include <board.h>
29
30
32 PANEL_SETUP_FORMATTING_BASE( aParentWindow ),
33 m_frame( aFrame )
34{
35 wxSize minSize = m_dashLengthCtrl->GetMinSize();
36 int minWidth = m_dashLengthCtrl->GetTextExtent( wxT( "XXX.XXX" ) ).GetWidth();
37
38 m_dashLengthCtrl->SetMinSize( wxSize( minWidth, minSize.GetHeight() ) );
39 m_gapLengthCtrl->SetMinSize( wxSize( minWidth, minSize.GetHeight() ) );
40
41 m_dashedLineHelp->SetFont( KIUI::GetInfoFont( this ).Italic() );
42}
43
44
46{
47 const PCB_PLOT_PARAMS& settings = m_frame->GetBoard()->GetPlotOptions();
48
50 settings.GetDashedLineDashRatio() ) );
51
53 settings.GetDashedLineGapRatio() ) );
54
55 BOARD_DESIGN_SETTINGS& bds = m_frame->GetBoard()->GetDesignSettings();
56
57 m_styleFields->SetValue( bds.m_StyleFPFields );
58 m_styleText->SetValue( bds.m_StyleFPText );
59 m_styleShapes->SetValue( bds.m_StyleFPShapes );
60
61 return true;
62}
63
64
66{
67 PCB_PLOT_PARAMS settings = m_frame->GetBoard()->GetPlotOptions();
68
71
72 m_frame->GetBoard()->SetPlotOptions( settings );
73
74 BOARD_DESIGN_SETTINGS& bds = m_frame->GetBoard()->GetDesignSettings();
75
76 bds.m_StyleFPFields = m_styleFields->GetValue();
77 bds.m_StyleFPText = m_styleText->GetValue();
78 bds.m_StyleFPShapes = m_styleShapes->GetValue();
79
80 KIGFX::PCB_VIEW* view = m_frame->GetCanvas()->GetView();
81
84
86 [] ( KIGFX::VIEW_ITEM* aItem ) -> bool
87 {
88 const EDA_ITEM* item = dynamic_cast<const EDA_ITEM*>( aItem );
89 return item && item->Type() == PCB_SHAPE_T;
90 } );
91 m_frame->GetCanvas()->Refresh();
92
93 return true;
94}
95
96
98{
99 const PCB_PLOT_PARAMS& importedSettings = aBoard->GetPlotOptions();
100
102 importedSettings.GetDashedLineDashRatio() ) );
103
105 importedSettings.GetDashedLineGapRatio() ) );
106
107 m_styleFields->SetValue( aBoard->GetDesignSettings().m_StyleFPFields );
108 m_styleText->SetValue( aBoard->GetDesignSettings().m_StyleFPText );
109 m_styleShapes->SetValue( aBoard->GetDesignSettings().m_StyleFPShapes );
110}
constexpr EDA_IU_SCALE unityScale
Definition base_units.h:115
Container for design settings for a BOARD object.
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:317
const PCB_PLOT_PARAMS & GetPlotOptions() const
Definition board.h:744
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition board.cpp:1040
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
void SetGapLengthRatio(double aRatio)
void SetDashLengthRatio(double aRatio)
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition view.h:220
void UpdateAllItemsConditionally(int aUpdateFlags, std::function< bool(VIEW_ITEM *)> aCondition)
Update items in the view according to the given flags and condition.
Definition view.cpp:1571
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 ImportSettingsFrom(SCHEMATIC_SETTINGS &aSettings)
The main frame for Pcbnew.
Parameters and options when plotting/printing a board.
void SetDashedLineGapRatio(double aVal)
void SetDashedLineDashRatio(double aVal)
double GetDashedLineGapRatio() const
double GetDashedLineDashRatio() const
const int minSize
Push and Shove router track width and via size dialog.
KICOMMON_API wxString StringFromValue(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, double aValue, bool aAddUnitsText=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Return the string from aValue according to aUnits (inch, mm ...) for display.
KICOMMON_API double DoubleValueFromString(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Convert aTextValue to a double.
@ REPAINT
Item needs to be redrawn.
Definition view_item.h:58
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition typeinfo.h:88