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 <widgets/unit_binder.h>
30
32
33
34class PCB_BASE_FRAME;
35
36
38{
43};
44
45
47{
48public:
49 DIALOG_MOVE_EXACT( PCB_BASE_FRAME* aParent, VECTOR2I& aTranslate, EDA_ANGLE& aRotate,
50 ROTATION_ANCHOR& aAnchor, const BOX2I& aBbox );
52
53private:
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
72 void ToPolarDeg( double x, double y, double& r, EDA_ANGLE& q );
73
81 bool GetTranslationInIU( wxRealPoint& val, bool polar );
82
84
85 // Update controls and their labels after changing the coordinates type (polar/cartesian)
86 void updateDialogControls( bool aPolar );
87
92 {
94 wxString entry1;
95 wxString entry2;
96 wxString entryRotation;
98
100 polarCoords( false ),
101 entry1( wxT( "0" ) ),
102 entry2( wxT( "0" ) ),
103 entryRotation( wxT( "0" ) ),
105 {
106 }
107 };
108
109 // persistent settings
111
112private:
116 const BOX2I& m_bbox;
117
121
122 std::vector<ROTATION_ANCHOR> m_menuIDs;
123
124 double m_stateX;
125 double m_stateY;
128};
129
130#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