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();
58 bool padValuesOK();
59 void redraw();
61
66 void updatePadLayersList( LSET layer_mask, bool remove_unconnected, bool keep_top_bottom );
67
69 bool transferDataToPad( PAD* aPad );
70
71 bool Show( bool aShow ) override;
72
73 // event handlers:
74 void OnInitDialog( wxInitDialogEvent& event ) override;
75 void OnResize( wxSizeEvent& event );
76 void OnCancel( wxCommandEvent& event ) override;
77 void OnUpdateUI( wxUpdateUIEvent& event ) override;
78 void onTeardropsUpdateUi( wxUpdateUIEvent& event ) override;
79 void onTeardropCurvePointsUpdateUi( wxUpdateUIEvent& event ) override;
80
81 void OnUpdateUINonCopperWarning( wxUpdateUIEvent& event ) override;
82
83 void OnPadShapeSelection( wxCommandEvent& event ) override;
84 void OnDrillShapeSelected( wxCommandEvent& event ) override;
85 void onChangePadMode( wxCommandEvent& event ) override;
86 void OnOffsetCheckbox( wxCommandEvent& event ) override;
87 void OnPadToDieCheckbox( wxCommandEvent& event ) override;
88
89 void PadOrientEvent( wxCommandEvent& event ) override;
90 void PadTypeSelected( wxCommandEvent& event ) override;
91
93 void OnSetCopperLayers( wxCommandEvent& event ) override;
94 void OnSetLayers( wxCommandEvent& event ) override;
95
96 // Called when corner setup value is changed for rounded rect pads
97 void onCornerSizePercentChange( wxCommandEvent& event ) override;
98 void onCornerRadiusChange( wxCommandEvent& event ) override;
99
102 void OnValuesChanged( wxCommandEvent& event ) override;
103
106
107 bool TransferDataFromWindow() override;
108 bool TransferDataToWindow() override;
109
112
113 // Show/hide the hole size Y widgets
114 // Setting the X/Diameter label according to the selected hole type
115 void updateHoleControls();
116
117 // Show/hide the pad size Y widgets
118 // Setting the X/Diameter label according to the selected hole type
120
121private:
123 PAD* m_currentPad; // pad currently being edited
124 PAD* m_previewPad; // a working copy used to show changes
125 PAD* m_masterPad; // pad used to create new pads in board or FP editor
126 BOARD* m_board; // the main board: this is the board handled by the PCB
127 // editor or the dummy board used by the FP editor
129 bool m_canEditNetName; // true only if the caller is the board editor
130 bool m_isFpEditor; // true if the caller is the footprint editor
131
132 std::vector<std::shared_ptr<PCB_SHAPE>> m_primitives; // the custom shape primitives in
133 // local coords, orient 0
134 // must define a single copper area
135 COLOR4D m_selectedColor; // color used to draw selected primitives when
136 // editing a custom pad shape
137
138 std::vector<PCB_SHAPE*> m_highlight; // shapes highlighted in GAL mode
140 KIGFX::ORIGIN_VIEWITEM* m_axisOrigin; // origin of the preview canvas
141
142 static bool m_sketchPreview; // session storage
143 static int m_page; // remember the last open page during session
144
145
167};
168
169
170#endif // #ifndef _DIALOG_PAD_PROPERTIES_H_
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:282
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.
bool Show(bool aShow) 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
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
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:575
Definition: pad.h:53
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
PAD_PROP
The set of pad properties used in Gerber files (Draw files, and P&P files) to define some properties ...
Definition: padstack.h:89