KiCad PCB EDA Suite
Loading...
Searching...
No Matches
vertex_editor_pane.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 modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include <memory>
23#include <vector>
24
25#include <wx/panel.h>
26#include <wx/string.h>
27
29#include <origin_transforms.h>
30#include <board_commit.h>
31
32class BOARD_ITEM;
34class PCB_SHAPE;
35class ZONE;
36class wxGrid;
37class wxGridEvent;
38class wxSizeEvent;
39
40class PCB_VERTEX_EDITOR_PANE : public wxPanel
41{
42public:
44 ~PCB_VERTEX_EDITOR_PANE() override;
45
46 void SetItem( BOARD_ITEM* aItem );
47 void ClearItem();
48
52 bool IsEditingItem( BOARD_ITEM* aItem ) const { return m_item == aItem; }
53
58 void OnSelectionChanged( BOARD_ITEM* aNewItem );
59
60private:
61 void refreshGrid();
62 void updateRow( int aRow );
63 void updateHighlight( int aRow );
64 void resizeColumns();
65 void onPolygonModified();
66
67 bool parseCellValue( const wxString& aText, ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType,
68 int& aResult ) const;
69 wxString formatCoord( int aValue, ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType ) const;
70
72 const SHAPE_POLY_SET* getPoly() const;
73
74 void OnGridCellChange( wxGridEvent& aEvent );
75 void OnGridSelectCell( wxGridEvent& aEvent );
76 void OnSize( wxSizeEvent& aEvent );
77
78private:
83
84 wxGrid* m_grid;
85
86 std::vector<SHAPE_POLY_SET::VERTEX_INDEX> m_rows;
87
89};
90
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:79
COORD_TYPES_T
The supported Display Origin Transform types.
Common, abstract interface for edit frames.
void SetItem(BOARD_ITEM *aItem)
PCB_BASE_EDIT_FRAME * m_frame
bool IsEditingItem(BOARD_ITEM *aItem) const
Check if the pane is currently editing the given item.
void OnGridSelectCell(wxGridEvent &aEvent)
void OnSize(wxSizeEvent &aEvent)
std::vector< SHAPE_POLY_SET::VERTEX_INDEX > m_rows
wxString formatCoord(int aValue, ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType) const
void OnSelectionChanged(BOARD_ITEM *aNewItem)
Update the pane in response to external selection changes.
PCB_VERTEX_EDITOR_PANE(PCB_BASE_EDIT_FRAME *aFrame)
bool parseCellValue(const wxString &aText, ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType, int &aResult) const
void OnGridCellChange(wxGridEvent &aEvent)
Represent a set of closed polygons.
Handle a list of polygons defining a copper zone.
Definition zone.h:74