24#include <wx/aui/aui.h>
26#include <wx/settings.h>
28#include <wx/translation.h>
52 wxBoxSizer* topSizer =
new wxBoxSizer( wxVERTICAL );
53 m_grid =
new wxGrid(
this, wxID_ANY );
54 m_grid->CreateGrid( 0, 2 );
55 m_grid->SetRowLabelSize( 0 );
56 m_grid->SetColLabelValue( 0,
_(
"X coord" ) );
57 m_grid->SetColLabelValue( 1,
_(
"Y coord" ) );
58 m_grid->EnableDragGridSize(
false );
59 m_grid->EnableDragRowSize(
false );
60 m_grid->EnableDragColSize(
false );
61 m_grid->SetSelectionMode( wxGrid::wxGridSelectRows );
62 m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_CENTER );
63 m_grid->ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_ALWAYS );
64 m_grid->EnableScrolling(
false,
true );
65 m_grid->SetColMinimalWidth( 0, FromDIP( 120 ) );
66 m_grid->SetColMinimalWidth( 1, FromDIP( 120 ) );
68 topSizer->Add(
m_grid, 1, wxEXPAND | wxALL, FromDIP( 5 ) );
83 m_frame->OnVertexEditorPaneClosed(
this );
95 if(
m_grid->GetNumberRows() > 0 )
97 m_grid->SetGridCursor( 0, 0 );
113 if(
m_grid->GetNumberRows() > 0 )
125 ZONE* zone =
dynamic_cast<ZONE*
>( aNewItem );
152 if(
m_grid->GetNumberRows() > 0 )
163 m_rows.push_back( it.GetIndex() );
174 if( aRow < 0 || aRow >=
m_grid->GetNumberRows() )
179 if( !poly || aRow >= (
int)
m_rows.size() )
198 m_frame->GetCanvas()->Refresh();
208 m_zone->SetNeedRefill(
true );
215 m_frame->GetCanvas()->Refresh();
228 long long internal =
m_frame->GetOriginTransforms().FromDisplay( displayValue, aCoordType );
230 if( internal < std::numeric_limits<int>::min() || internal > std::numeric_limits<int>::max() )
233 aResult =
static_cast<int>( internal );
240 int displayValue =
m_frame->GetOriginTransforms().ToDisplay( aValue, aCoordType );
241 return m_frame->MessageTextFromValue( displayValue );
250 return &
m_shape->GetPolyShape();
261 return &
m_shape->GetPolyShape();
272 int row = aEvent.GetRow();
273 int col = aEvent.GetCol();
275 if( row < 0 || row >= (
int)
m_rows.size() )
299 int& target = ( col == 0 ) ? vertex.
x : vertex.
y;
301 if( target == newValue )
317 m_zone->SetNeedRefill(
true );
321 commit.
Push(
_(
"Edit Vertex" ) );
327 m_frame->GetCanvas()->Refresh();
347 int width =
m_grid->GetClientSize().GetWidth() -
m_grid->GetRowLabelSize();
350 if(
m_grid->GetScrollRange( wxVERTICAL ) > 0 )
351 width -= wxSystemSettings::GetMetric( wxSYS_VSCROLL_X );
354 int colWidth = width / 2;
356 if( colWidth >
m_grid->GetColMinimalAcceptableWidth() )
358 m_grid->SetColSize( 0, colWidth );
359 m_grid->SetColSize( 1, colWidth );
constexpr EDA_IU_SCALE pcbIUScale
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
Common, abstract interface for edit frames.
void SetItem(BOARD_ITEM *aItem)
PCB_BASE_EDIT_FRAME * m_frame
SHAPE_POLY_SET * getPoly()
void OnGridSelectCell(wxGridEvent &aEvent)
void OnSize(wxSizeEvent &aEvent)
std::vector< SHAPE_POLY_SET::VERTEX_INDEX > m_rows
~PCB_VERTEX_EDITOR_PANE() override
void updateHighlight(int aRow)
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.
void SetVertex(const VERTEX_INDEX &aIndex, const VECTOR2I &aPos)
Accessor function to set the position of a specific point.
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the index-th vertex in a given hole outline within a given outline.
CONST_ITERATOR CIterateWithHoles(int aOutline) const
Handle a list of polygons defining a copper zone.
KICOMMON_API long long int ValueFromString(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Convert aTextValue in aUnits to internal units used by the application.
Structure to hold the necessary information in order to index a vertex on a SHAPE_POLY_SET object: th...
VECTOR2< int32_t > VECTOR2I