KiCad PCB EDA Suite
dialog_pad_properties.h
Go to the documentation of this file.
1 
6 /*
7  * This program source code file is part of KiCad, a free EDA CAD application.
8  *
9  * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
10  * Copyright (C) 2013 Dick Hollenbeck, dick@softplc.com
11  * Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net>
12  * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
13  *
14  * This program is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU General Public License
16  * as published by the Free Software Foundation; either version 2
17  * of the License, or (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, you may find one here:
26  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
27  * or you may search the http://www.gnu.org website for the version 2 license,
28  * or you may write to the Free Software Foundation, Inc.,
29  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
30  */
31 
32 #ifndef _DIALOG_PAD_PROPERTIES_H_
33 #define _DIALOG_PAD_PROPERTIES_H_
34 
35 #include <class_drawpanel.h>
36 #include <pcbnew.h>
37 #include <wxBasePcbFrame.h>
38 #include <base_units.h>
39 #include <wx/valnum.h>
40 
41 #include <class_board.h>
42 #include <class_module.h>
43 #include <class_drawsegment.h>
44 
45 #include <origin_viewitem.h>
46 
48 #include <pcb_draw_panel_gal.h>
49 
50 
51 
57 {
58 public:
59  DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aPad );
61  {
62  delete m_dummyPad;
63  delete m_axisOrigin;
64  }
65 
66 private:
69  D_PAD* m_currentPad; // pad currently being edited
70  D_PAD* m_dummyPad; // a working copy used to show changes
71  D_PAD* m_padMaster; // The pad used to create new pads in board or
72  // footprint editor
73  BOARD* m_board; // the main board: this is the board handled by
74  // the PCB editor, if running or the dummy
75  // board used by the footprint editor
76  // (could happen when the Footprint editor will be run
77  // alone, outside the board editor
78  bool m_isFlipped; // true if the parent footprint (therefore pads) is flipped (mirrored)
79  // in this case, some Y coordinates values must be negated
81  bool m_canEditNetName; // true only if the caller is the board editor
82 
83  // for free shape pads: the list of primitives (basic shapes),
84  // in local coordinates, orient 0, coordinates relative to m_Pos
85  // They are expected to define only one copper area.
86  std::vector<PAD_CS_PRIMITIVE> m_primitives;
87 
88  std::vector<DRAWSEGMENT*> m_highligth; // shapes highlighted in GAL mode
89 
90  wxFloatingPointValidator<double> m_OrientValidator;
91  double m_OrientValue;
92 
93 private:
94  void prepareCanvas(); // Initialize the canvases (legacy or gal) to display the pad
95  void initValues();
96  void displayPrimitivesList();
97  bool padValuesOK();
98  void redraw();
99  void editPrimitive();
101  void enablePrimitivePage( bool aEnable );
102 
108  void setPadLayersList( LSET layer_mask );
109 
111  bool transferDataToPad( D_PAD* aPad );
112 
113  // event handlers:
114  void OnInitDialog( wxInitDialogEvent& event ) override;
115  void OnResize( wxSizeEvent& event );
116 
117  void OnPadShapeSelection( wxCommandEvent& event ) override;
118  void OnDrillShapeSelected( wxCommandEvent& event ) override;
119 
120  void PadOrientEvent( wxCommandEvent& event ) override;
121  void PadTypeSelected( wxCommandEvent& event ) override;
122 
123  void OnSetLayers( wxCommandEvent& event ) override;
124  void OnPaintShowPanel( wxPaintEvent& event ) override;
125 
126  // Called when corner setup value is changed for rounded rect pads
127  void onCornerSizePercentChange( wxCommandEvent& event ) override;
128 
131  void OnValuesChanged( wxCommandEvent& event ) override;
132 
135 
136  bool TransferDataFromWindow() override;
137  bool TransferDataToWindow() override;
138 
140  void onDeletePrimitive( wxCommandEvent& event ) override;
141  void onEditPrimitive( wxCommandEvent& event ) override;
142  void onAddPrimitive( wxCommandEvent& event ) override;
143  void onImportPrimitives( wxCommandEvent& event ) override;
144  void onGeometryTransform( wxCommandEvent& event ) override;
145  void onDuplicatePrimitive( wxCommandEvent& event ) override;
146 
148  void onPrimitiveDClick( wxMouseEvent& event ) override;
150  void OnPrimitiveSelection( wxListEvent& event ) override;
151 };
152 
158 {
159 public:
160  DIALOG_PAD_PRIMITIVES_PROPERTIES( wxWindow* aParent, PAD_CS_PRIMITIVE * aShape );
161 
166  bool TransferDataFromWindow() override;
167 
168 private:
173  bool TransferDataToWindow() override;
174 
175  // The basic shape currently edited
177 };
178 
179 
184 {
185  // The basic shape currently edited
187 
188  // The working copy of the basic shape currently edited
190 
191 public:
192  DIALOG_PAD_PRIMITIVE_POLY_PROPS( wxWindow* aParent, PAD_CS_PRIMITIVE * aShape );
194 
199  bool TransferDataFromWindow() override;
200 
201 private:
206  bool TransferDataToWindow() override;
207 
211  bool Validate() override;
212 
213  // Events handlers:
214  void OnValidateButton( wxCommandEvent& event );
215  void onButtonAdd( wxCommandEvent& event ) override;
216  void OnButtonDelete( wxCommandEvent& event ) override;
217  void onPaintPolyPanel( wxPaintEvent& event ) override;
218  void onPolyPanelResize( wxSizeEvent& event ) override;
219  void onGridSelect( wxGridRangeSelectEvent& event ) override;
220  void onCellChanging( wxGridEvent& event );
221  void onCellSelect( wxGridEvent& event ) override
222  {
223  event.Skip();
224  }
225 };
226 
227 
236 {
237 public:
238  DIALOG_PAD_PRIMITIVES_TRANSFORM( wxWindow* aParent,
239  std::vector<PAD_CS_PRIMITIVE*>& aList, bool aShowDuplicate );
240 
248  void Transform( std::vector<PAD_CS_PRIMITIVE>* aList = NULL, int aDuplicateCount = 0 );
249 
253  int GetDuplicateCount() { return m_spinCtrlDuplicateCount->GetValue(); }
254 
255 private:
256  std::vector<PAD_CS_PRIMITIVE*>& m_list;
257 };
258 
259 #endif // #ifndef _DIALOG_PAD_PROPERTIES_H_
void OnInitDialog(wxInitDialogEvent &event) override
void OnValuesChanged(wxCommandEvent &event) override
Called when a dimension has changed.
DIALOG_PAD_PROPERTIES(PCB_BASE_FRAME *aParent, D_PAD *aPad)
void enablePrimitivePage(bool aEnable)
enable (or disable) the primitive page editor
DIALOG_PAD_PRIMITIVES_PROPERTIES(wxWindow *aParent, PAD_CS_PRIMITIVE *aShape)
Implementation of conversion functions that require both schematic and board internal units...
Class DIALOG_PAD_PRIMITIVE_POLY_PROPS_BASE.
void onCellSelect(wxGridEvent &event) override
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
Class BOARD to handle a board.
void setPadLayersList(LSET layer_mask)
Function setPadLayersList updates the CheckBox states in pad layers list,.
wxFloatingPointValidator< double > m_OrientValidator
void onButtonAdd(wxCommandEvent &event) override
void OnButtonDelete(wxCommandEvent &event) override
DIALOG_PAD_PRIMITIVE_POLY_PROPS(wxWindow *aParent, PAD_CS_PRIMITIVE *aShape)
void Transform(std::vector< PAD_CS_PRIMITIVE > *aList=NULL, int aDuplicateCount=0)
Apply geometric transform (rotation, move, scale) defined in dialog aDuplicate = 1 ...
void onCornerSizePercentChange(wxCommandEvent &event) override
bool TransferDataFromWindow() override
Function TransferDataFromWindow Transfer data out of the GUI.
class DIALOG_PAD_PROPERTIES, derived from DIALOG_PAD_PROPERTIES_BASE, created by wxFormBuilder ...
Class DIALOG_PAD_PRIMITIVES_TRANSFORM_BASE.
KIGFX::ORIGIN_VIEWITEM * m_axisOrigin
void onAddPrimitive(wxCommandEvent &event) override
bool TransferDataToWindow() override
Function TransferDataToWindow Transfer data into the GUI.
bool TransferDataToWindow() override
Function TransferDataToWindow Transfer data into the GUI.
Class LSET is a set of PCB_LAYER_IDs.
Classes used in Pcbnew, CvPcb and GerbView.
void onGridSelect(wxGridRangeSelectEvent &event) override
void OnSetLayers(wxCommandEvent &event) override
void OnValidateButton(wxCommandEvent &event)
void OnPaintShowPanel(wxPaintEvent &event) override
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:90
Class DIALOG_PAD_PROPERTIES_BASE.
void OnResize(wxSizeEvent &event)
void OnPadShapeSelection(wxCommandEvent &event) override
void PadTypeSelected(wxCommandEvent &event) override
void onPrimitiveDClick(wxMouseEvent &event) override
Called on a double click on the basic shapes list.
void onPolyPanelResize(wxSizeEvent &event) override
void OnDrillShapeSelected(wxCommandEvent &event) override
void onGeometryTransform(wxCommandEvent &event) override
void onImportPrimitives(wxCommandEvent &event) override
void onPaintPolyPanel(wxPaintEvent &event) override
a dialog to edit basic polygonal shape parameters
void OnPrimitiveSelection(wxListEvent &event) override
Called on selection/deselection of a basic shape.
void onEditPrimitive(wxCommandEvent &event) override
bool TransferDataFromWindow() override
Updates the different parameters for the component being edited.
void PadOrientEvent(wxCommandEvent &event) override
std::vector< PAD_CS_PRIMITIVE > m_primitives
Class to handle a graphic segment.
void onDeletePrimitive(wxCommandEvent &event) override
Event handlers of basic shapes list panel.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
void onDuplicatePrimitive(wxCommandEvent &event) override
DIALOG_PAD_PRIMITIVES_TRANSFORM(wxWindow *aParent, std::vector< PAD_CS_PRIMITIVE * > &aList, bool aShowDuplicate)
std::vector< PAD_CS_PRIMITIVE * > & m_list
std::vector< DRAWSEGMENT * > m_highligth
bool padValuesOK()
test if all values are acceptable for the pad
Module description (excepted pads)
A dialog to apply geometry transforms to a shape or set of shapes (move, rotate around origin...
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
a dialog to edit basics shapes parameters.
bool TransferDataFromWindow() override
Function TransferDataFromWindow Transfer data out of the GUI.
bool Validate() override
test for a valid polygon (a not self intersectiong polygon)
Class DIALOG_PAD_PRIMITIVES_PROPERTIES_BASE.