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 (C) 1992-2023 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#include <wx/valnum.h>
32#include <board.h>
33#include <footprint.h>
34#include <padstack.h>
35#include <pcb_shape.h>
36#include <origin_viewitem.h>
39#include <pcb_draw_panel_gal.h>
40#include <widgets/unit_binder.h>
41
46// The wxWidgets window name. Used to retrieve the dialog by window name
47#define PAD_PROPERTIES_DLG_NAME wxT( "pad_properties_dlg_name" )
48
50{
51public:
52 DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, PAD* aPad );
54
55private:
56 void prepareCanvas(); // Initialize the canvases (legacy or gal) to display the pad
57 void initValues();
59 bool padValuesOK();
60 void redraw();
63
68 void updatePadLayersList( LSET layer_mask, bool remove_unconnected, bool keep_top_bottom );
69
71 bool transferDataToPad( PAD* aPad );
72
73 bool Show( bool aShow ) override;
74
75 // event handlers:
76 void OnInitDialog( wxInitDialogEvent& event ) override;
77 void OnResize( wxSizeEvent& event );
78 void OnCancel( wxCommandEvent& event ) override;
79 void OnUpdateUI( wxUpdateUIEvent& event ) override;
80 void onTeardropsUpdateUi( wxUpdateUIEvent& event ) override;
81 void onTeardropCurvePointsUpdateUi( wxUpdateUIEvent& event ) override;
82 void OnPadstackModeChanged( wxCommandEvent& event ) override;
83 void OnEditLayerChanged( wxCommandEvent& event ) override;
84
85 void OnUpdateUINonCopperWarning( wxUpdateUIEvent& event ) override;
86
87 void OnPadShapeSelection( wxCommandEvent& event ) override;
88 void OnDrillShapeSelected( wxCommandEvent& event ) override;
89 void onChangePadMode( wxCommandEvent& event ) override;
90 void OnOffsetCheckbox( wxCommandEvent& event ) override;
91 void OnPadToDieCheckbox( wxCommandEvent& event ) override;
92
93 void PadOrientEvent( wxCommandEvent& event ) override;
94 void PadTypeSelected( wxCommandEvent& event ) override;
95
97 void OnSetCopperLayers( wxCommandEvent& event ) override;
98 void OnSetLayers( wxCommandEvent& event ) override;
99
100 // Called when corner setup value is changed for rounded rect pads
101 void onCornerSizePercentChange( wxCommandEvent& event ) override;
102 void onCornerRadiusChange( wxCommandEvent& event ) override;
103
106 void OnValuesChanged( wxCommandEvent& event ) override;
107
110
111 bool TransferDataFromWindow() override;
112 bool TransferDataToWindow() override;
113
116
117 // Show/hide the hole size Y widgets
118 // Setting the X/Diameter label according to the selected hole type
119 void updateHoleControls();
120
121 // Show/hide the pad size Y widgets
122 // Setting the X/Diameter label according to the selected hole type
124
125 void onModify( wxCommandEvent& aEvent ) override;
126 void onModify( wxSpinDoubleEvent& aEvent ) override;
127
128private:
130 PAD* m_currentPad; // pad currently being edited
131 PAD* m_previewPad; // a working copy used to show changes
132 PAD* m_masterPad; // pad used to create new pads in board or FP editor
133 BOARD* m_board; // the main board: this is the board handled by the PCB
134 // editor or the dummy board used by the FP editor
136 bool m_canEditNetName; // true only if the caller is the board editor
137 bool m_isFpEditor; // true if the caller is the footprint editor
138 PCB_LAYER_ID m_editLayer; // Which copper layer of the padstack is being edited
139 std::map<int, PCB_LAYER_ID> m_editLayerCtrlMap;
140
141 std::vector<std::shared_ptr<PCB_SHAPE>> m_primitives; // the custom shape primitives in
142 // local coords, orient 0
143 // must define a single copper area
144 COLOR4D m_selectedColor; // color used to draw selected primitives when
145 // editing a custom pad shape
146
147 std::vector<PCB_SHAPE*> m_highlight; // shapes highlighted in GAL mode
149 KIGFX::ORIGIN_VIEWITEM* m_axisOrigin; // origin of the preview canvas
150
151 static bool m_sketchPreview; // session storage
152 static int m_page; // remember the last open page during session
153
154
176};
177
178
179#endif // #ifndef _DIALOG_PAD_PROPERTIES_H_
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:290
Class DIALOG_PAD_PROPERTIES_BASE.
void OnUpdateUINonCopperWarning(wxUpdateUIEvent &event) override
void OnInitDialog(wxInitDialogEvent &event) override
void PadTypeSelected(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 OnOffsetCheckbox(wxCommandEvent &event) override
PCB_DRAW_PANEL_GAL * m_padPreviewGAL
void OnValuesChanged(wxCommandEvent &event) override
Called when a dimension has changed.
void onTeardropsUpdateUi(wxUpdateUIEvent &event) override
void onChangePadMode(wxCommandEvent &event) override
std::vector< PCB_SHAPE * > m_highlight
void OnPadstackModeChanged(wxCommandEvent &event) override
KIGFX::ORIGIN_VIEWITEM * m_axisOrigin
void OnSetCopperLayers(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
void OnPadToDieCheckbox(wxCommandEvent &event) override
void onTeardropCurvePointsUpdateUi(wxUpdateUIEvent &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:104
LSET is a set of PCB_LAYER_IDs.
Definition: lset.h:36
Definition: pad.h:54
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:98