37#include <wx/dcclient.h>
47 m_startX( aFrame, m_startXLabel, m_startXCtrl, m_startXUnits ),
48 m_startY( aFrame, m_startYLabel, m_startYCtrl, m_startYUnits ),
49 m_ctrl1X( aFrame, m_ctrl1XLabel, m_ctrl1XCtrl, m_ctrl1XUnits ),
50 m_ctrl1Y( aFrame, m_ctrl1YLabel, m_ctrl1YCtrl, m_ctrl1YUnits ),
51 m_ctrl2X( aFrame, m_ctrl2XLabel, m_ctrl2XCtrl, m_ctrl2XUnits ),
52 m_ctrl2Y( aFrame, m_ctrl2YLabel, m_ctrl2YCtrl, m_ctrl2YUnits ),
53 m_endX( aFrame, m_endXLabel, m_endXCtrl, m_endXUnits ),
54 m_endY( aFrame, m_endYLabel, m_endYCtrl, m_endYUnits ),
55 m_radius( aFrame, m_radiusLabel, m_radiusCtrl, m_radiusUnits ),
56 m_thickness( aFrame, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits )
78 case SHAPE_T::SEGMENT:
79 SetTitle(
_(
"Segment" ) );
97 SetTitle(
_(
"Bezier" ) );
111 SetTitle(
_(
"Arc" ) );
131 case SHAPE_T::CIRCLE:
133 SetTitle(
_(
"Ring" ) );
135 SetTitle(
_(
"Circle" ) );
160 SetTitle(
_(
"Number Box" ) );
162 SetTitle(
_(
"Rectangle" ) );
185 SetTitle(
"Unknown Basic Shape" );
197 DisplayError(
this,
_(
"Line width may not be 0 for unfilled shapes." ) );
211 case SHAPE_T::SEGMENT:
217 case SHAPE_T::BEZIER:
230 case SHAPE_T::CIRCLE:
252 m_thickness( aFrame, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits )
309 else if( extra_rows < 0 )
311 extra_rows = -extra_rows;
316 for(
unsigned row = 0; row <
m_currPoints.size(); ++row )
319 m_gridCornersList->SetRowLabelValue( row, wxString::Format(
_(
"Corner %d" ), row+1 ) );
359 m_warningText->SetLabel(
_(
"Polygon must have at least 3 corners" ) );
374 m_warningText->SetLabel(
_(
"Polygon must have at least 3 corners after simplification" ) );
380 m_warningText->SetLabel(
_(
"Polygon can not be self-intersecting" ) );
387 if( aRemoveRedundantCorners )
398 m_warningText->SetLabel(
_(
"Note: redundant corners removed" ) );
417 else if( selections.size() > 0 )
418 row = selections[ selections.size() - 1 ] + 1;
424 wxMessageBox(
_(
"Select a corner to add the new corner after." ) );
457 if( selections.size() == 0 )
459 wxMessageBox(
_(
"Select a corner to delete." ) );
464 std::sort( selections.begin(), selections.end() );
466 for(
int ii = selections.size()-1; ii >= 0 ; --ii )
484 wxSize dc_size = dc.GetSize();
485 dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
502 double scale = std::min(
double( dc_size.x ) / minsize,
double( dc_size.y ) / minsize ) * 0.9;
526 unsigned jj = ii + 1;
555 int row =
event.GetRow();
556 int col =
event.GetCol();
575 std::vector<std::shared_ptr<PCB_SHAPE>>& aList,
576 bool aShowDuplicate ) :
579 m_vectorX( aFrame, m_xLabel, m_xCtrl, m_xUnits ),
580 m_vectorY( aFrame, m_yLabel, m_yCtrl, m_yUnits ),
581 m_rotation( aFrame, m_rotationLabel, m_rotationCtrl, m_rotationUnits )
585 if( !aShowDuplicate )
593 GetSizer()->SetSizeHints(
this );
598 int aDuplicateCount )
620 for(
unsigned idx = 0; idx <
m_list.size(); ++idx )
622 std::shared_ptr<PCB_SHAPE> shape;
624 if( aList ==
nullptr )
630 aList->emplace_back( std::make_shared<PCB_SHAPE>( *
m_list[idx] ) );
631 shape = aList->back();
637 shape->SetStroke( stroke );
639 shape->Move( currMoveVect );
640 shape->Scale(
scale );
641 shape->Rotate(
VECTOR2I( 0, 0 ), curr_rotation );
646 curr_rotation += rotation;
647 currMoveVect += move_vect;
648 }
while( aList && --aDuplicateCount > 0 );
constexpr EDA_IU_SCALE pcbIUScale
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Class DIALOG_PAD_PRIMITIVES_PROPERTIES_BASE.
wxCheckBox * m_filledCtrl
wxStaticText * m_staticTextPosStart
wxStaticText * m_radiusLabel
wxStaticText * m_staticTextPosCtrl1
wxTextCtrl * m_thicknessCtrl
wxStaticText * m_staticTextPosEnd
wxStaticText * m_staticTextPosCtrl2
TEXT_CTRL_EVAL * m_startXCtrl
DIALOG_PAD_PRIMITIVES_PROPERTIES(wxWindow *aParent, PCB_BASE_FRAME *aFrame, PCB_SHAPE *aShape)
bool TransferDataToWindow() override
Function TransferDataToWindow Transfer data into the GUI.
bool TransferDataFromWindow() override
Transfer data out of the GUI.
Class DIALOG_PAD_PRIMITIVE_POLY_PROPS_BASE.
STD_BITMAP_BUTTON * m_deleteButton
wxStaticBitmap * m_warningIcon
WX_GRID * m_gridCornersList
wxCheckBox * m_filledCtrl
STD_BITMAP_BUTTON * m_addButton
wxStaticText * m_warningText
void onPolyPanelResize(wxSizeEvent &event) override
bool TransferDataFromWindow() override
Transfer data out of the GUI.
bool Validate() override
Test for a valid polygon (a not self intersectiong polygon).
std::vector< VECTOR2I > m_currPoints
void onCellChanging(wxGridEvent &event)
void onGridSelect(wxGridRangeSelectEvent &event) override
void OnButtonAdd(wxCommandEvent &event) override
void onPaintPolyPanel(wxPaintEvent &event) override
void OnButtonDelete(wxCommandEvent &event) override
bool TransferDataToWindow() override
Transfer data into the GUI.
DIALOG_PAD_PRIMITIVE_POLY_PROPS(wxWindow *aParent, PCB_BASE_FRAME *aFrame, PCB_SHAPE *aShape)
~DIALOG_PAD_PRIMITIVE_POLY_PROPS()
bool doValidate(bool aRemoveRedundantCorners)
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
EDA_ANGLE GetArcAngle() const
const VECTOR2I & GetBezierC2() const
void SetBezierC2(const VECTOR2I &aPt)
void SetCenter(const VECTOR2I &aCenter)
SHAPE_POLY_SET & GetPolyShape()
void SetFilled(bool aFlag)
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
void SetStart(const VECTOR2I &aStart)
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
void SetEnd(const VECTOR2I &aEnd)
void SetBezierC1(const VECTOR2I &aPt)
const VECTOR2I & GetBezierC1() const
void SetArcAngleAndEnd(const EDA_ANGLE &aAngle, bool aCheckNegativeAngle=false)
Set the end point from the angle center and start.
bool IsAnnotationProxy() const
void SetPolyPoints(const std::vector< VECTOR2I > &aPoints)
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
STROKE_PARAMS GetStroke() const override
void SetStroke(const STROKE_PARAMS &aStroke) override
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
const std::optional< INTERSECTION > SelfIntersecting() const
Check if the line chain is self-intersecting.
SHAPE_LINE_CHAIN & Simplify(bool aRemoveColinear=true)
Simplify the line chain by removing colinear adjacent segments and duplicate vertices.
int PointCount() const
Return the number of points (vertices) in this line chain.
const std::vector< VECTOR2I > & CPoints() const
bool IsEmpty() const
Return true if the set is empty (no polygons at all)
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
Simple container to manage line stroke parameters.
void SetWidth(int aWidth)
virtual long long int GetValue()
Return the current value in Internal Units.
virtual void SetUnits(EDA_UNITS aUnits)
Normally not needed (as the UNIT_BINDER inherits from the parent frame), but can be used to set to DE...
virtual EDA_ANGLE GetAngleValue()
virtual void SetAngleValue(const EDA_ANGLE &aValue)
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
void Show(bool aShow, bool aResize=false)
Show/hide the label, widget and units label.
void SetUnitValue(int aRow, int aCol, int aValue)
Set a unitized cell's value.
int GetUnitValue(int aRow, int aCol)
Apply standard KiCad unit and eval services to a numeric cell.
void SetAutoEvalCols(const std::vector< int > &aCols)
void SetUnitsProvider(UNITS_PROVIDER *aProvider, int aCol=0)
Set a UNITS_PROVIDER to enable use of unit- and eval-based Getters.
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
EDA_COLOR_T
Legacy color enumeration.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
This file is part of the common library.
void GRResetPenAndBrush(wxDC *DC)
void GRLine(wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color, wxPenStyle aStyle)
double DoubleValueFromString(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Function DoubleValueFromString converts aTextValue to a double.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
constexpr int mmToIU(double mm) const
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".