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 
56 
57  std::vector<ROTATION_ANCHOR> m_menuIDs;
58 
59 public:
60  // Constructor and destructor
61  DIALOG_MOVE_EXACT(PCB_BASE_FRAME *aParent, wxPoint& aTranslate,
62  double& aRotate, ROTATION_ANCHOR& aAnchor );
64 
65 private:
66 
70  void OnTextFocusLost( wxFocusEvent& event ) override;
71 
72  void OnPolarChanged( wxCommandEvent& event ) override;
73  void OnClear( wxCommandEvent& event ) override;
74 
75  // Automatically called when clicking on the OK button
76  bool TransferDataFromWindow() override;
77 
84  void ToPolarDeg( double x, double y, double& r, double& q );
85 
92  bool GetTranslationInIU ( wxPoint& val, bool polar );
93 
95 
96  // Update controls and their labels after changing the coordinates type (polar/cartesian)
97  void updateDialogControls( bool aPolar );
98 
103  {
105  double entry1;
106  double entry2;
109 
111  polarCoords( false ),
112  entry1( 0 ),
113  entry2( 0 ),
114  entryRotation( 0 ),
116  {
117  }
118  };
119 
120  // persistent settings
122 };
123 
124 #endif // __DIALOG_MOVE_EXACT__
125 
ROTATION_ANCHOR & m_rotationAnchor
std::vector< ROTATION_ANCHOR > m_menuIDs
Class DIALOG_MOVE_EXACT_BASE.
void OnPolarChanged(wxCommandEvent &event) override
bool GetTranslationInIU(wxPoint &val, bool polar)
Get the (Cartesian) translation described by the text entries.
DIALOG_MOVE_EXACT(PCB_BASE_FRAME *aParent, wxPoint &aTranslate, double &aRotate, ROTATION_ANCHOR &aAnchor)
ROTATION_ANCHOR
void OnTextFocusLost(wxFocusEvent &event) override
void OnClear(wxCommandEvent &event) override
void updateDialogControls(bool aPolar)
bool TransferDataFromWindow() override
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.