KiCad PCB EDA Suite
dialog_move_exact.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) 2014 John Beard, john.j.beard@gmail.com
5  * Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #ifndef __DIALOG_MOVE_EXACT__
26 #define __DIALOG_MOVE_EXACT__
27 
28 #include <vector>
29 #include <widgets/unit_binder.h>
30 
32 
33 
34 class PCB_BASE_FRAME;
35 
36 
38 {
43 };
44 
45 
47 {
48 private:
49  wxPoint& m_translation;
50  double& m_rotation;
52  const EDA_RECT& m_bbox;
53 
57 
58  std::vector<ROTATION_ANCHOR> m_menuIDs;
59 
60 public:
61  // Constructor and destructor
62  DIALOG_MOVE_EXACT(PCB_BASE_FRAME *aParent, wxPoint& aTranslate,
63  double& aRotate, ROTATION_ANCHOR& aAnchor,
64  const EDA_RECT& aBbox);
66 
67 private:
68 
72  void OnTextFocusLost( wxFocusEvent& event ) override;
73 
74  void OnPolarChanged( wxCommandEvent& event ) override;
75  void OnClear( wxCommandEvent& event ) override;
76  void OnTextChanged( wxCommandEvent& event ) override;
77 
78  // Automatically called when clicking on the OK button
79  bool TransferDataFromWindow() override;
80 
87  void ToPolarDeg( double x, double y, double& r, double& q );
88 
95  bool GetTranslationInIU ( wxPoint& val, bool polar );
96 
98 
99  // Update controls and their labels after changing the coordinates type (polar/cartesian)
100  void updateDialogControls( bool aPolar );
101 
106  {
108  double entry1;
109  double entry2;
112 
114  polarCoords( false ),
115  entry1( 0 ),
116  entry2( 0 ),
117  entryRotation( 0 ),
119  {
120  }
121  };
122 
123  // persistent settings
125 };
126 
127 #endif // __DIALOG_MOVE_EXACT__
128 
void OnTextChanged(wxCommandEvent &event) override
ROTATION_ANCHOR & m_rotationAnchor
std::vector< ROTATION_ANCHOR > m_menuIDs
Class DIALOG_MOVE_EXACT_BASE.
void OnPolarChanged(wxCommandEvent &event) override
const EDA_RECT & m_bbox
bool GetTranslationInIU(wxPoint &val, bool polar)
Get the (Cartesian) translation described by the text entries.
ROTATION_ANCHOR
void OnTextFocusLost(wxFocusEvent &event) override
void OnClear(wxCommandEvent &event) override
void updateDialogControls(bool aPolar)
DIALOG_MOVE_EXACT(PCB_BASE_FRAME *aParent, wxPoint &aTranslate, double &aRotate, ROTATION_ANCHOR &aAnchor, const EDA_RECT &aBbox)
bool TransferDataFromWindow() override
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
void ToPolarDeg(double x, double y, double &r, double &q)
Convert a given Cartesian point into a polar representation.
static MOVE_EXACT_OPTIONS m_options
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.