KiCad PCB EDA Suite
dialog_position_relative.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) 2017 KiCad Developers, see AUTHORS.txt for contributors.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
24 #ifndef __DIALOG_POSITION_RELATIVE__
25 #define __DIALOG_POSITION_RELATIVE__
26 
27 // Include the wxFormBuider header base:
28 #include <vector>
30 
31 #include <tool/tool_manager.h>
32 #include <widgets/unit_binder.h>
34 
36 {
37 private:
38 
42 
45 
46  double m_stateX;
47  double m_stateY;
48  double m_stateRadius;
49  double m_stateTheta;
50 
51 
52 public:
53  // Constructor and destructor
54  DIALOG_POSITION_RELATIVE( PCB_BASE_FRAME* aParent, wxPoint& translation, wxPoint& anchor );
56 
57  void UpdateAnchor( EDA_ITEM* aItem );
58 
59 private:
60 
64  void OnTextFocusLost( wxFocusEvent& event ) override;
65 
66  void OnPolarChanged( wxCommandEvent& event ) override;
67  void OnClear( wxCommandEvent& event ) override;
68 
69  void OnSelectItemClick( wxCommandEvent& event ) override;
70  void OnUseGridOriginClick( wxCommandEvent& event ) override;
71  void OnUseUserOriginClick( wxCommandEvent& event ) override;
72  void OnOkClick( wxCommandEvent& event ) override;
73 
80  void ToPolarDeg( double x, double y, double& r, double& q );
81 
88  bool GetTranslationInIU( wxRealPoint& val, bool polar );
89 
90  // Update controls and their labels after changing the coordinates type (polar/cartesian)
91  void updateDialogControls( bool aPolar );
92 
97  {
99  double entry1;
100  double entry2;
101 
103  polarCoords( false ),
104  entry1( 0 ),
105  entry2( 0 )
106  {
107  }
108  };
109 
110  // persistent settings
112 };
113 
114 #endif // __DIALOG_POSITION_RELATIVE__
void OnUseGridOriginClick(wxCommandEvent &event) override
void OnOkClick(wxCommandEvent &event) override
DIALOG_POSITION_RELATIVE(PCB_BASE_FRAME *aParent, wxPoint &translation, wxPoint &anchor)
void OnTextFocusLost(wxFocusEvent &event) override
void OnClear(wxCommandEvent &event) override
TOOL_MANAGER.
Definition: tool_manager.h:51
void OnUseUserOriginClick(wxCommandEvent &event) override
void OnSelectItemClick(wxCommandEvent &event) override
bool GetTranslationInIU(wxRealPoint &val, bool polar)
Get the (Cartesian) translation described by the text entries.
Class DIALOG_POSITION_RELATIVE_BASE.
void OnPolarChanged(wxCommandEvent &event) override
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
void ToPolarDeg(double x, double y, double &r, double &q)
Convert a given Cartesian point into a polar representation.
PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
static POSITION_RELATIVE_OPTIONS m_options