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 );
61 m_styleBarcodes->SetValue( bds.m_StyleFPBarcodes );
62
63 return true;
64}
65
66
68{
69 PCB_PLOT_PARAMS settings = m_frame->GetBoard()->GetPlotOptions();
70
73
74 m_frame->GetBoard()->SetPlotOptions( settings );
75
76 BOARD_DESIGN_SETTINGS& bds = m_frame->GetBoard()->GetDesignSettings();
77
78 bds.m_StyleFPFields = m_styleFields->GetValue();
79 bds.m_StyleFPText = m_styleText->GetValue();
80 bds.m_StyleFPShapes = m_styleShapes->GetValue();
81 bds.m_StyleFPDimensions = m_styleDimensions->GetValue();
82 bds.m_StyleFPBarcodes = m_styleBarcodes->GetValue();
83
84 KIGFX::PCB_VIEW* view = m_frame->GetCanvas()->GetView();
85
88
90 [] ( KIGFX::VIEW_ITEM* aItem ) -> bool
91 {
92 const EDA_ITEM* item = dynamic_cast<const EDA_ITEM*>( aItem );
93 return item && item->Type() == PCB_SHAPE_T;
94 } );
95 m_frame->GetCanvas()->Refresh();
96
97 return true;
98}
99
100
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:322
const PCB_PLOT_PARAMS & GetPlotOptions() const
Definition board.h:761
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition board.cpp:1041
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