KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 <math/box2.h>
30#include <geometry/eda_angle.h>
31#include <widgets/unit_binder.h>
32
34
35
36class PCB_BASE_FRAME;
37
38
40{
45};
46
47
49{
50public:
51 DIALOG_MOVE_EXACT( PCB_BASE_FRAME* aParent, VECTOR2I& aTranslate, EDA_ANGLE& aRotate,
52 ROTATION_ANCHOR& aAnchor, const BOX2I& aBbox );
54
55private:
56
60 void OnTextFocusLost( wxFocusEvent& event ) override;
61
62 void OnPolarChanged( wxCommandEvent& event ) override;
63 void OnClear( wxCommandEvent& event ) override;
64 void OnTextChanged( wxCommandEvent& event ) override;
65
66 // Automatically called when clicking on the OK button
67 bool TransferDataFromWindow() override;
68
74 void ToPolarDeg( double x, double y, double& r, EDA_ANGLE& q );
75
83 bool GetTranslationInIU( wxRealPoint& val, bool polar );
84
86
87 // Update controls and their labels after changing the coordinates type (polar/cartesian)
88 void updateDialogControls( bool aPolar );
89
94 {
96 wxString entry1;
97 wxString entry2;
98 wxString entryRotation;
100
102 polarCoords( false ),
103 entry1( wxT( "0" ) ),
104 entry2( wxT( "0" ) ),
105 entryRotation( wxT( "0" ) ),
107 {
108 }
109 };
110
111 // persistent settings
113
114private:
118 const BOX2I& m_bbox;
119
123
124 std::vector<ROTATION_ANCHOR> m_menuIDs;
125
126 double m_stateX;
127 double m_stateY;
130};
131
132#endif // __DIALOG_MOVE_EXACT__
Class DIALOG_MOVE_EXACT_BASE.
static MOVE_EXACT_OPTIONS m_options
bool TransferDataFromWindow() override
ROTATION_ANCHOR & m_rotationAnchor
void ToPolarDeg(double x, double y, double &r, EDA_ANGLE &q)
Convert a given Cartesian point into a polar representation.
const BOX2I & m_bbox
void updateDialogControls(bool aPolar)
void OnClear(wxCommandEvent &event) override
void OnTextFocusLost(wxFocusEvent &event) override
Reset a text field to be 0 if it was exited while blank.
void OnPolarChanged(wxCommandEvent &event) override
void OnTextChanged(wxCommandEvent &event) override
bool GetTranslationInIU(wxRealPoint &val, bool polar)
Get the (Cartesian) translation described by the text entries.
std::vector< ROTATION_ANCHOR > m_menuIDs
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
ROTATION_ANCHOR
@ ROTATE_AROUND_USER_ORIGIN
@ ROTATE_AROUND_SEL_CENTER
@ ROTATE_AROUND_AUX_ORIGIN
@ ROTATE_AROUND_ITEM_ANCHOR