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 <pcb_base_frame.h>
31
32#include <wx/valnum.h>
33
34#include <board.h>
35#include <padstack.h>
36#include <pcb_shape.h>
37#include <origin_viewitem.h>
40#include <pcb_draw_panel_gal.h>
41#include <widgets/unit_binder.h>
43
44class PAD;
45
50// The wxWidgets window name. Used to retrieve the dialog by window name
51#define PAD_PROPERTIES_DLG_NAME wxT( "pad_properties_dlg_name" )
52
54{
55public:
56 DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, PAD* aPad );
58
59private:
60 void prepareCanvas(); // Initialize the canvases (legacy or gal) to display the pad
61 void initValues();
63 bool padValuesOK();
64 void redraw();
67
72 void updatePadLayersList( LSET layer_mask, bool remove_unconnected, bool keep_top_bottom );
73
75 bool transferDataToPad( PAD* aPad );
76
77 bool Show( bool aShow ) override;
78
79 // event handlers:
80 void OnInitDialog( wxInitDialogEvent& event ) override;
81 void OnResize( wxSizeEvent& event );
82 void OnCancel( wxCommandEvent& event ) override;
83 void OnUpdateUI( wxUpdateUIEvent& event ) override;
84 void onTeardropsUpdateUi( wxUpdateUIEvent& event ) override;
85 void OnPadstackModeChanged( wxCommandEvent& event ) override;
86 void OnEditLayerChanged( wxCommandEvent& event ) override;
87
88 void OnUpdateUINonCopperWarning( wxUpdateUIEvent& event ) override;
89
90 void onBackDrillChoice( wxCommandEvent& event ) override;
91 void onTopPostMachining( wxCommandEvent& event ) override;
92 void onBottomPostMachining( wxCommandEvent& event ) override;
93
94 void OnPadShapeSelection( wxCommandEvent& event ) override;
95 void OnDrillShapeSelected( wxCommandEvent& event ) override;
96 void onChangePadDrawMode( wxCommandEvent& event ) override;
97 void OnOffsetCheckbox( wxCommandEvent& event ) override;
98 void OnPadToDieCheckbox( wxCommandEvent& event ) override;
99 void OnPadToDieDelayCheckbox( wxCommandEvent& event ) override;
100
101 void PadOrientEvent( wxCommandEvent& event ) override;
102 void PadTypeSelected( wxCommandEvent& event ) override;
103
105 void OnSetCopperLayers( wxCommandEvent& event ) override;
106 void OnSetLayers( wxCommandEvent& event ) override;
107
108 // Called when corner setup value is changed for rounded rect pads
109 void onCornerSizePercentChange( wxCommandEvent& event ) override;
110 void onCornerRadiusChange( wxCommandEvent& event ) override;
111
114 void OnValuesChanged( wxCommandEvent& event ) override;
115
118
119 bool TransferDataFromWindow() override;
120 bool TransferDataToWindow() override;
121
124
125 // Show/hide the hole size Y widgets
126 // Setting the X/Diameter label according to the selected hole type
127 void updateHoleControls();
128
129 // Show/hide the pad size Y widgets
130 // Setting the X/Diameter label according to the selected hole type
132
133 void onModify( wxCommandEvent& aEvent ) override;
134 void onModify( wxSpinDoubleEvent& aEvent ) override;
135
136 // Return the largest chamfer ratio allowed by the current pad shape
137 double getMaxChamferRatio() const;
138
139 // Return the largest corner radius allowed by the current pad shape
140 double getMaxCornerRadius() const;
141
143
144 void onPadShapeSelection( bool aUpdateSpokeAngle );
145
146private:
148 PAD* m_currentPad; // pad currently being edited
149 PAD* m_previewPad; // a working copy used to show changes
150 PAD* m_masterPad; // pad used to create new pads in board or FP editor
151 BOARD* m_board; // the main board: this is the board handled by the PCB
152 // editor or the dummy board used by the FP editor
154 bool m_canEditNetName; // true only if the caller is the board editor
155 bool m_isFpEditor; // true if the caller is the footprint editor
156 PCB_LAYER_ID m_editLayer; // Which copper layer of the padstack is being edited
157 std::map<int, PCB_LAYER_ID> m_editLayerCtrlMap;
158
159 std::vector<std::shared_ptr<PCB_SHAPE>> m_primitives; // the custom shape primitives in
160 // local coords, orient 0
161 // must define a single copper area
162 COLOR4D m_selectedColor; // color used to draw selected primitives when
163 // editing a custom pad shape
164
165 std::vector<PCB_SHAPE*> m_highlight; // shapes highlighted in GAL mode
167 KIGFX::ORIGIN_VIEWITEM* m_axisOrigin; // origin of the preview canvas
168
169 static bool m_sketchPreview; // session storage
170 static int m_page; // remember the last open page during session
171
172
194
199
202};
203
204
205#endif // #ifndef _DIALOG_PAD_PROPERTIES_H_
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:322
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 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
void updatePadLayersList(LSET layer_mask, bool remove_unconnected, bool keep_top_bottom)
Updates the CheckBox states in pad layers list, based on the layer_mask (if non-empty) or the default...
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
LSET is a set of PCB_LAYER_IDs.
Definition lset.h:37
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