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 
31 #include <dialog_move_exact_base.h>
32 
33 
35 {
40 };
41 
42 
44 {
45 private:
47  double& m_rotation;
49 
53 
54  std::vector<ROTATION_ANCHOR> m_menuIDs;
55 
56 public:
57  // Constructor and destructor
58  DIALOG_MOVE_EXACT(PCB_BASE_FRAME *aParent, wxPoint& aTranslate,
59  double& aRotate, ROTATION_ANCHOR& aAnchor );
61 
62 private:
63 
67  void OnTextFocusLost( wxFocusEvent& event ) override;
68 
69  void OnPolarChanged( wxCommandEvent& event ) override;
70  void OnClear( wxCommandEvent& event ) override;
71 
72  // Automatically called when clicking on the OK button
73  bool TransferDataFromWindow() override;
74 
81  void ToPolarDeg( double x, double y, double& r, double& q );
82 
89  bool GetTranslationInIU ( wxPoint& val, bool polar );
90 
92 
93  // Update controls and their labels after changing the coordinates type (polar/cartesian)
94  void updateDialogControls( bool aPolar );
95 
100  {
102  double entry1;
103  double entry2;
106 
108  polarCoords( false ),
109  entry1( 0 ),
110  entry2( 0 ),
111  entryRotation( 0 ),
112  entryAnchorSelection( 0 )
113  {
114  }
115  };
116 
117  // persistent settings
119 };
120 
121 #endif // __DIALOG_MOVE_EXACT__
122 
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...