KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 The 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, see <https://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22// Include the wxFormBuider header base:
23#include <vector>
25
26#include <tool/tool_manager.h>
27#include <widgets/unit_binder.h>
29
32{
33public:
34 // Constructor and destructor
37
38 // Implement the RECEIVER interface for the callback from the TOOL
39 void UpdatePickedItem( const EDA_ITEM* aItem ) override;
40 void UpdatePickedPoint( const std::optional<VECTOR2I>& aPoint ) override;
41
42private:
46 void OnTextFocusLost( wxFocusEvent& event ) override;
47
48 void OnPolarChanged( wxCommandEvent& event ) override;
49 void OnClear( wxCommandEvent& event ) override;
50
51 bool TransferDataToWindow() override;
52
53 void OnSelectItemClick( wxCommandEvent& event ) override;
54 void OnSelectPointClick( wxCommandEvent& event ) override;
55 void OnUseGridOriginClick( wxCommandEvent& event ) override;
56 void OnUseUserOriginClick( wxCommandEvent& event ) override;
57 void OnOkClick( wxCommandEvent& event ) override;
58
64 void ToPolarDeg( double x, double y, double& r, EDA_ANGLE& q );
65
73 bool getTranslationInIU( VECTOR2I& val, bool polar );
74
75 // Update controls and their labels after changing the coordinates type (polar/cartesian)
76 void updateDialogControls( bool aPolar );
77
78 // Update controls and labels after changing anchor type
79 void updateAnchorInfo( const BOARD_ITEM* aItem );
80
81 // Get the current anchor position.
83
84private:
95
97
98private:
101
104
105 double m_stateX;
106 double m_stateY;
109};
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:81
DIALOG_POSITION_RELATIVE_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Position Relative To Reference Item"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
bool getTranslationInIU(VECTOR2I &val, bool polar)
Get the (Cartesian) translation described by the text entries.
void OnUseGridOriginClick(wxCommandEvent &event) override
void OnPolarChanged(wxCommandEvent &event) override
void OnOkClick(wxCommandEvent &event) override
void OnClear(wxCommandEvent &event) override
~DIALOG_POSITION_RELATIVE()=default
void OnSelectItemClick(wxCommandEvent &event) override
void UpdatePickedPoint(const std::optional< VECTOR2I > &aPoint) override
void OnSelectPointClick(wxCommandEvent &event) override
void UpdatePickedItem(const EDA_ITEM *aItem) override
void OnTextFocusLost(wxFocusEvent &event) override
Reset a text field to be 0 if it was exited while blank.
void OnUseUserOriginClick(wxCommandEvent &event) override
ANCHOR_TYPE
Persistent dialog options.
void ToPolarDeg(double x, double y, double &r, EDA_ANGLE &q)
Convert a given Cartesian point into a polar representation.
void updateAnchorInfo(const BOARD_ITEM *aItem)
DIALOG_POSITION_RELATIVE(PCB_BASE_FRAME *aParent)
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:96
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
Interface class for something that receives picked points or items from this tool.
Master controller class:
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683