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-2020 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:
50  double& m_rotation;
52  const EDA_RECT& m_bbox;
53 
57 
58  std::vector<ROTATION_ANCHOR> m_menuIDs;
59 
60  double m_stateX;
61  double m_stateY;
62  double m_stateRadius;
63  double m_stateTheta;
64 
65 
66 public:
67  // Constructor and destructor
68  DIALOG_MOVE_EXACT( PCB_BASE_FRAME *aParent, wxPoint& aTranslate, double& aRotate,
69  ROTATION_ANCHOR& aAnchor, const EDA_RECT& aBbox );
71 
72 private:
73 
77  void OnTextFocusLost( wxFocusEvent& event ) override;
78 
79  void OnPolarChanged( wxCommandEvent& event ) override;
80  void OnClear( wxCommandEvent& event ) override;
81  void OnTextChanged( wxCommandEvent& event ) override;
82 
83  // Automatically called when clicking on the OK button
84  bool TransferDataFromWindow() override;
85 
92  void ToPolarDeg( double x, double y, double& r, double& q );
93 
100  bool GetTranslationInIU( wxRealPoint& val, bool polar );
101 
103 
104  // Update controls and their labels after changing the coordinates type (polar/cartesian)
105  void updateDialogControls( bool aPolar );
106 
111  {
113  wxString entry1;
114  wxString entry2;
115  wxString entryRotation;
117 
119  polarCoords( false ),
120  entry1( wxT( "0" ) ),
121  entry2( wxT( "0" ) ),
122  entryRotation( wxT( "0" ) ),
124  {
125  }
126  };
127 
128  // persistent settings
130 };
131 
132 #endif // __DIALOG_MOVE_EXACT__
133 
void OnTextChanged(wxCommandEvent &event) override
ROTATION_ANCHOR & m_rotationAnchor
std::vector< ROTATION_ANCHOR > m_menuIDs
Class DIALOG_MOVE_EXACT_BASE.
bool GetTranslationInIU(wxRealPoint &val, bool polar)
Get the (Cartesian) translation described by the text entries.
void OnPolarChanged(wxCommandEvent &event) override
const EDA_RECT & m_bbox
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
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
PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.