KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_pad_properties.h
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) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2013 Dick Hollenbeck, [email protected]
6 * Copyright (C) 2008-2013 Wayne Stambaugh <[email protected]>
7 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifndef _DIALOG_PAD_PROPERTIES_H_
24#define _DIALOG_PAD_PROPERTIES_H_
25
26#include <optional>
27
28#include <pcb_base_frame.h>
29
30#include <wx/valnum.h>
31
32#include <board.h>
33#include <padstack.h>
34#include <pcb_shape.h>
35#include <origin_viewitem.h>
38#include <pcb_draw_panel_gal.h>
39#include <widgets/unit_binder.h>
41
42class PAD;
43
48// The wxWidgets window name. Used to retrieve the dialog by window name
49#define PAD_PROPERTIES_DLG_NAME wxT( "pad_properties_dlg_name" )
50
52{
53public:
58 DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, PAD& aPad );
59 ~DIALOG_PAD_PROPERTIES() override;
60
63
64 bool TransferDataFromWindow() override;
65 bool TransferDataToWindow() override;
66
67 bool Show( bool aShow ) override;
68
69private:
70 void prepareCanvas(); // Initialize the canvases (legacy or gal) to display the pad
71 void initValues();
73 bool padValuesOK();
74 void redraw();
77
86 void updatePadLayersList( std::optional<LSET> layer_mask, bool remove_unconnected, bool keep_top_bottom );
87
89 bool transferDataToPad( PAD* aPad );
90
91 void syncBackdrillControls( bool aFromUserEvent );
92
93 // event handlers:
94 void OnInitDialog( wxInitDialogEvent& event ) override;
95 void OnResize( wxSizeEvent& event );
96 void OnCancel( wxCommandEvent& event ) override;
97 void OnUpdateUI( wxUpdateUIEvent& event ) override;
98 void onTeardropsUpdateUi( wxUpdateUIEvent& event ) override;
99 void OnPadstackModeChanged( wxCommandEvent& event ) override;
100 void OnEditLayerChanged( wxCommandEvent& event ) override;
101 void OnElectricalTypeChaged( wxCommandEvent& event ) override;
102
103 void OnUpdateUINonCopperWarning( wxUpdateUIEvent& event ) override;
104
105 void onBackDrillChoice( wxCommandEvent& event ) override;
106 void onTopPostMachining( wxCommandEvent& event ) override;
107 void onBottomPostMachining( wxCommandEvent& event ) override;
108
109 void OnPadShapeSelection( wxCommandEvent& event ) override;
110 void OnDrillShapeSelected( wxCommandEvent& event ) override;
111 void OnHoleSizeCalculator( wxCommandEvent& event ) override;
112 void onChangePadDrawMode( wxCommandEvent& event ) override;
113 void OnOffsetCheckbox( wxCommandEvent& event ) override;
114 void OnPadToDieCheckbox( wxCommandEvent& event ) override;
115 void OnPadToDieDelayCheckbox( wxCommandEvent& event ) override;
116
117 void PadOrientEvent( wxCommandEvent& event ) override;
118 void PadTypeSelected( wxCommandEvent& event ) override;
119
121 void OnSetCopperLayers( wxCommandEvent& event ) override;
122 void OnSetLayers( wxCommandEvent& event ) override;
123
124 // Called when corner setup value is changed for rounded rect pads
125 void onCornerSizePercentChange( wxCommandEvent& event ) override;
126 void onCornerRadiusChange( wxCommandEvent& event ) override;
127
130 void OnValuesChanged( wxCommandEvent& event ) override;
131
134
135 // Show/hide the hole size Y widgets
136 // Setting the X/Diameter label according to the selected hole type
137 void updateHoleControls();
138
139 // Show/hide the pad size Y widgets
140 // Setting the X/Diameter label according to the selected hole type
142
143 void onModify( wxCommandEvent& aEvent ) override;
144 void onModify( wxSpinDoubleEvent& aEvent ) override;
145
146 // Return the largest chamfer ratio allowed by the current pad shape
147 double getMaxChamferRatio() const;
148
149 // Return the largest corner radius allowed by the current pad shape
150 double getMaxCornerRadius() const;
151
153
154 void onPadShapeSelection( bool aUpdateSpokeAngle );
155
156private:
158 PAD* m_currentPad; // pad currently being edited
159 PAD* m_previewPad; // a working copy used to show changes
160 BOARD* m_board; // the main board: this is the board handled by the PCB
161 // editor or the dummy board used by the FP editor
163 bool m_canEditNetName; // true only if the caller is the board editor
164 bool m_isFpEditor; // true if the caller is the footprint editor
165 PCB_LAYER_ID m_editLayer; // Which copper layer of the padstack is being edited
166 std::map<int, PCB_LAYER_ID> m_editLayerCtrlMap;
168 std::vector<PCB_LAYER_ID> m_nonComponentLayers;
169
170 std::vector<std::shared_ptr<PCB_SHAPE>> m_primitives; // the custom shape primitives in
171 // local coords, orient 0
172 // must define a single copper area
173 COLOR4D m_selectedColor; // color used to draw selected primitives when
174 // editing a custom pad shape
175
176 std::vector<PCB_SHAPE*> m_highlight; // shapes highlighted in GAL mode
178 KIGFX::ORIGIN_VIEWITEM* m_axisOrigin; // origin of the preview canvas
179
180 static bool m_sketchPreview; // session storage
181 static int m_page; // remember the last open page during session
182
183
205
210
213};
214
215
216#endif // #ifndef _DIALOG_PAD_PROPERTIES_H_
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:411
DIALOG_PAD_PROPERTIES_BASE(wxWindow *parent, wxWindowID id=wxID_DIALOG_EDIT_PAD, const wxString &title=_("Pad Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
void OnUpdateUINonCopperWarning(wxUpdateUIEvent &event) override
void OnInitDialog(wxInitDialogEvent &event) override
void PadTypeSelected(wxCommandEvent &event) override
void OnPadToDieDelayCheckbox(wxCommandEvent &event) override
void OnPadShapeSelection(wxCommandEvent &event) override
bool transferDataToPad(PAD *aPad)
Copy values from dialog field to aPad's members.
bool TransferDataFromWindow() override
Updates the different parameters for the component being edited.
std::map< int, PCB_LAYER_ID > m_editLayerCtrlMap
bool Show(bool aShow) override
void OnHoleSizeCalculator(wxCommandEvent &event) override
void OnEditLayerChanged(wxCommandEvent &event) override
std::vector< std::shared_ptr< PCB_SHAPE > > m_primitives
bool padValuesOK()
test if all values are acceptable for the pad
void PadOrientEvent(wxCommandEvent &event) override
void OnResize(wxSizeEvent &event)
void OnElectricalTypeChaged(wxCommandEvent &event) override
void onPadShapeSelection(bool aUpdateSpokeAngle)
void OnOffsetCheckbox(wxCommandEvent &event) override
PCB_DRAW_PANEL_GAL * m_padPreviewGAL
void OnValuesChanged(wxCommandEvent &event) override
Called when a dimension has changed.
void updatePadLayersList(std::optional< LSET > layer_mask, bool remove_unconnected, bool keep_top_bottom)
Updates the CheckBox states in pad layers list.
void onBottomPostMachining(wxCommandEvent &event) override
void onTeardropsUpdateUi(wxUpdateUIEvent &event) override
std::vector< PCB_SHAPE * > m_highlight
std::vector< PCB_LAYER_ID > m_nonComponentLayers
Enabled copper layers offered for NON_COMPONENT pads.
void syncBackdrillControls(bool aFromUserEvent)
void OnPadstackModeChanged(wxCommandEvent &event) override
void onChangePadDrawMode(wxCommandEvent &event) override
KIGFX::ORIGIN_VIEWITEM * m_axisOrigin
void OnSetCopperLayers(wxCommandEvent &event) override
void onBackDrillChoice(wxCommandEvent &event) override
void OnCancel(wxCommandEvent &event) override
void onCornerRadiusChange(wxCommandEvent &event) override
PAD_PROP getSelectedProperty()
Return the pad property currently selected.
void OnSetLayers(wxCommandEvent &event) override
void onCornerSizePercentChange(wxCommandEvent &event) override
MARGIN_OFFSET_BINDER m_pasteMargin
void OnPadToDieCheckbox(wxCommandEvent &event) override
void onTopPostMachining(wxCommandEvent &event) override
void OnDrillShapeSelected(wxCommandEvent &event) override
DIALOG_PAD_PROPERTIES(PCB_BASE_FRAME *aParent, PAD &aPad)
void OnUpdateUI(wxUpdateUIEvent &event) override
void onModify(wxCommandEvent &aEvent) override
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
A specialized binder for combined margin/ratio input fields.
Definition pad.h:61
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
PAD_PROP
The set of pad properties used in Gerber files (Draw files, and P&P files) to define some properties ...
Definition padstack.h:118