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 The 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, see <https://www.gnu.org/licenses/>.
19 */
20
21#pragma once
22
23#include <vector>
24#include <math/box2.h>
25#include <geometry/eda_angle.h>
26#include <widgets/unit_binder.h>
27
29
30
31class PCB_BASE_FRAME;
32
33
41
42
44{
45public:
46 DIALOG_MOVE_EXACT( PCB_BASE_FRAME* aParent, VECTOR2I& aTranslate, EDA_ANGLE& aRotate,
47 ROTATION_ANCHOR& aAnchor, const BOX2I& aBbox );
49
50private:
51
55 void OnTextFocusLost( wxFocusEvent& event ) override;
56
57 void OnPolarChanged( wxCommandEvent& event ) override;
58 void OnClear( wxCommandEvent& event ) override;
59 void OnTextChanged( wxCommandEvent& event ) override;
60
61 bool TransferDataToWindow() override;
62 bool TransferDataFromWindow() override;
63
69 void ToPolarDeg( double x, double y, double& r, EDA_ANGLE& q );
70
78 bool GetTranslationInIU( wxRealPoint& val, bool polar );
79
81
82 // Update controls and their labels after changing the coordinates type (polar/cartesian)
83 void updateDialogControls( bool aPolar );
84
85private:
89 const BOX2I& m_bbox;
90
94
95 std::vector<ROTATION_ANCHOR> m_menuIDs;
96
97 double m_stateX;
98 double m_stateY;
101};
BOX2< VECTOR2I > BOX2I
Definition box2.h:918
DIALOG_MOVE_EXACT_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Move Item"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
bool TransferDataToWindow() override
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.
void updateDialogControls(bool aPolar)
void OnClear(wxCommandEvent &event) override
DIALOG_MOVE_EXACT(PCB_BASE_FRAME *aParent, VECTOR2I &aTranslate, EDA_ANGLE &aRotate, ROTATION_ANCHOR &aAnchor, const BOX2I &aBbox)
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
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683