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, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
27#ifndef _DIALOG_PAD_PROPERTIES_H_
28#define _DIALOG_PAD_PROPERTIES_H_
29
30#include <optional>
31
32#include <pcb_base_frame.h>
33
34#include <wx/valnum.h>
35
36#include <board.h>
37#include <padstack.h>
38#include <pcb_shape.h>
39#include <origin_viewitem.h>
42#include <pcb_draw_panel_gal.h>
43#include <widgets/unit_binder.h>
45
46class PAD;
47
52// The wxWidgets window name. Used to retrieve the dialog by window name
53#define PAD_PROPERTIES_DLG_NAME wxT( "pad_properties_dlg_name" )
54
56{
57public:
58 DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, PAD* aPad );
60
61private:
62 void prepareCanvas(); // Initialize the canvases (legacy or gal) to display the pad
63 void initValues();
65 bool padValuesOK();
66 void redraw();
69
78 void updatePadLayersList( std::optional<LSET> layer_mask, bool remove_unconnected,
79 bool keep_top_bottom );
80
82 bool transferDataToPad( PAD* aPad );
83
84 bool Show( bool aShow ) override;
85
86 // event handlers:
87 void OnInitDialog( wxInitDialogEvent& event ) override;
88 void OnResize( wxSizeEvent& event );
89 void OnCancel( wxCommandEvent& event ) override;
90 void OnUpdateUI( wxUpdateUIEvent& event ) override;
91 void onTeardropsUpdateUi( wxUpdateUIEvent& event ) override;
92 void OnPadstackModeChanged( wxCommandEvent& event ) override;
93 void OnEditLayerChanged( wxCommandEvent& event ) override;
94
95 void OnUpdateUINonCopperWarning( wxUpdateUIEvent& event ) override;
96
97 void onBackDrillChoice( wxCommandEvent& event ) override;
98 void onTopPostMachining( wxCommandEvent& event ) override;
99 void onBottomPostMachining( wxCommandEvent& event ) override;
100
101 void OnPadShapeSelection( wxCommandEvent& event ) override;
102 void OnDrillShapeSelected( wxCommandEvent& event ) override;
103 void onChangePadDrawMode( wxCommandEvent& event ) override;
104 void OnOffsetCheckbox( wxCommandEvent& event ) override;
105 void OnPadToDieCheckbox( wxCommandEvent& event ) override;
106 void OnPadToDieDelayCheckbox( wxCommandEvent& event ) override;
107
108 void PadOrientEvent( wxCommandEvent& event ) override;
109 void PadTypeSelected( wxCommandEvent& event ) override;
110
112 void OnSetCopperLayers( wxCommandEvent& event ) override;
113 void OnSetLayers( wxCommandEvent& event ) override;
114
115 // Called when corner setup value is changed for rounded rect pads
116 void onCornerSizePercentChange( wxCommandEvent& event ) override;
117 void onCornerRadiusChange( wxCommandEvent& event ) override;
118
121 void OnValuesChanged( wxCommandEvent& event ) override;
122
125
126 bool TransferDataFromWindow() override;
127 bool TransferDataToWindow() override;
128
131
132 // Show/hide the hole size Y widgets
133 // Setting the X/Diameter label according to the selected hole type
134 void updateHoleControls();
135
136 // Show/hide the pad size Y widgets
137 // Setting the X/Diameter label according to the selected hole type
139
140 void onModify( wxCommandEvent& aEvent ) override;
141 void onModify( wxSpinDoubleEvent& aEvent ) override;
142
143 // Return the largest chamfer ratio allowed by the current pad shape
144 double getMaxChamferRatio() const;
145
146 // Return the largest corner radius allowed by the current pad shape
147 double getMaxCornerRadius() const;
148
150
151 void onPadShapeSelection( bool aUpdateSpokeAngle );
152
153private:
155 PAD* m_currentPad; // pad currently being edited
156 PAD* m_previewPad; // a working copy used to show changes
157 PAD* m_masterPad; // pad used to create new pads in board or FP editor
158 BOARD* m_board; // the main board: this is the board handled by the PCB
159 // editor or the dummy board used by the FP editor
161 bool m_canEditNetName; // true only if the caller is the board editor
162 bool m_isFpEditor; // true if the caller is the footprint editor
163 PCB_LAYER_ID m_editLayer; // Which copper layer of the padstack is being edited
164 std::map<int, PCB_LAYER_ID> m_editLayerCtrlMap;
165
166 std::vector<std::shared_ptr<PCB_SHAPE>> m_primitives; // the custom shape primitives in
167 // local coords, orient 0
168 // must define a single copper area
169 COLOR4D m_selectedColor; // color used to draw selected primitives when
170 // editing a custom pad shape
171
172 std::vector<PCB_SHAPE*> m_highlight; // shapes highlighted in GAL mode
174 KIGFX::ORIGIN_VIEWITEM* m_axisOrigin; // origin of the preview canvas
175
176 static bool m_sketchPreview; // session storage
177 static int m_page; // remember the last open page during session
178
179
201
206
209};
210
211
212#endif // #ifndef _DIALOG_PAD_PROPERTIES_H_
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:323
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 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 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.
DIALOG_PAD_PROPERTIES(PCB_BASE_FRAME *aParent, PAD *aPad)
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
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
void OnUpdateUI(wxUpdateUIEvent &event) override
void onModify(wxCommandEvent &aEvent) override
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:105
A specialized binder for combined margin/ratio input fields.
Definition pad.h:55
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:60
PAD_PROP
The set of pad properties used in Gerber files (Draw files, and P&P files) to define some properties ...
Definition padstack.h:114