KiCad PCB EDA Suite
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 (C) 2020-2023 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>
30#include <wx/treebook.h>
31
32
34 PANEL_SETUP_FORMATTING_BASE( aParent->GetTreebook() ),
35 m_frame( aFrame )
36{
37 wxSize minSize = m_dashLengthCtrl->GetMinSize();
38 int minWidth = m_dashLengthCtrl->GetTextExtent( wxT( "XXX.XXX" ) ).GetWidth();
39
40 m_dashLengthCtrl->SetMinSize( wxSize( minWidth, minSize.GetHeight() ) );
41 m_gapLengthCtrl->SetMinSize( wxSize( minWidth, minSize.GetHeight() ) );
42
43 m_dashedLineHelp->SetFont( KIUI::GetInfoFont( this ).Italic() );
44}
45
46
48{
49 const PCB_PLOT_PARAMS& settings = m_frame->GetBoard()->GetPlotOptions();
50
52 settings.GetDashedLineDashRatio() ) );
53
55 settings.GetDashedLineGapRatio() ) );
56
57 return true;
58}
59
60
62{
63 PCB_PLOT_PARAMS settings = m_frame->GetBoard()->GetPlotOptions();
64
67
68 m_frame->GetBoard()->SetPlotOptions( settings );
69
71
74
76 {
77
78 const EDA_ITEM* item = dynamic_cast<const EDA_ITEM*>( aItem );
79
80 if( !item )
81 return false;
82
83 switch( item->Type() )
84 {
85 case PCB_SHAPE_T:
86 case PCB_FP_SHAPE_T:
87 return true;
88
89 default:
90 return false;
91 }
92
93 } );
95
96 return true;
97}
98
99
101{
102 const PCB_PLOT_PARAMS& importedSettings = aBoard->GetPlotOptions();
103
105 importedSettings.GetDashedLineDashRatio() ) );
106
108 importedSettings.GetDashedLineGapRatio() ) );
109}
constexpr EDA_IU_SCALE unityScale
Definition: base_units.h:112
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
const PCB_PLOT_PARAMS & GetPlotOptions() const
Definition: board.h:629
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
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)
An abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:77
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:213
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:1494
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
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
const int minSize
Push and Shove router track width and via size dialog.
wxString StringFromValue(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, double aValue, bool aAddUnitsText=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Returns the string from aValue according to aUnits (inch, mm ...) for display.
Definition: eda_units.cpp:236
double DoubleValueFromString(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Function DoubleValueFromString converts aTextValue to a double.
Definition: eda_units.cpp:456
@ REPAINT
Item needs to be redrawn.
Definition: view_item.h:52
wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:156
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:88
@ PCB_FP_SHAPE_T
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:94