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, [email protected]
5  * Copyright (C) 2018-2021 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 public:
49  DIALOG_MOVE_EXACT( PCB_BASE_FRAME* aParent, wxPoint& aTranslate, double& aRotate,
50  ROTATION_ANCHOR& aAnchor, const EDA_RECT& aBbox );
52 
53 private:
54 
58  void OnTextFocusLost( wxFocusEvent& event ) override;
59 
60  void OnPolarChanged( wxCommandEvent& event ) override;
61  void OnClear( wxCommandEvent& event ) override;
62  void OnTextChanged( wxCommandEvent& event ) override;
63 
64  // Automatically called when clicking on the OK button
65  bool TransferDataFromWindow() override;
66 
73  void ToPolarDeg( double x, double y, double& r, double& q );
74 
82  bool GetTranslationInIU( wxRealPoint& val, bool polar );
83 
85 
86  // Update controls and their labels after changing the coordinates type (polar/cartesian)
87  void updateDialogControls( bool aPolar );
88 
93  {
95  wxString entry1;
96  wxString entry2;
97  wxString entryRotation;
99 
101  polarCoords( false ),
102  entry1( wxT( "0" ) ),
103  entry2( wxT( "0" ) ),
104  entryRotation( wxT( "0" ) ),
106  {
107  }
108  };
109 
110  // persistent settings
112 
113 private:
114  wxPoint& m_translation;
115  double& m_rotation;
117  const EDA_RECT& m_bbox;
118 
122 
123  std::vector<ROTATION_ANCHOR> m_menuIDs;
124 
125  double m_stateX;
126  double m_stateY;
128  double m_stateTheta;
129 };
130 
131 #endif // __DIALOG_MOVE_EXACT__
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
E_SERIE r
Definition: eserie.cpp:41
ROTATION_ANCHOR
void OnTextFocusLost(wxFocusEvent &event) override
Reset a text field to be 0 if it was exited while blank.
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
Handle the component boundary box.
Definition: eda_rect.h:42
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
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.