42 #include <wx/dcclient.h> 50 m_startX( aFrame, m_startXLabel, m_startXCtrl, m_startXUnits ),
51 m_startY( aFrame, m_startYLabel, m_startYCtrl, m_startYUnits ),
52 m_ctrl1X( aFrame, m_ctrl1XLabel, m_ctrl1XCtrl, m_ctrl1XUnits ),
53 m_ctrl1Y( aFrame, m_ctrl1YLabel, m_ctrl1YCtrl, m_ctrl1YUnits ),
54 m_ctrl2X( aFrame, m_ctrl2XLabel, m_ctrl2XCtrl, m_ctrl2XUnits ),
55 m_ctrl2Y( aFrame, m_ctrl2YLabel, m_ctrl2YCtrl, m_ctrl2YUnits ),
56 m_endX( aFrame, m_endXLabel, m_endXCtrl, m_endXUnits ),
57 m_endY( aFrame, m_endYLabel, m_endYCtrl, m_endYUnits ),
58 m_radius( aFrame, m_radiusLabel, m_radiusCtrl, m_radiusUnits ),
59 m_thickness( aFrame, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits )
82 SetTitle(
_(
"Segment" ) );
100 SetTitle(
_(
"Bezier" ) );
114 SetTitle(
_(
"Arc" ) );
136 SetTitle(
_(
"Ring" ) );
138 SetTitle(
_(
"Circle" ) );
166 SetTitle(
"Unknown basic shape" );
178 DisplayError(
this,
_(
"Line width may not be 0 for unfilled shapes." ) );
217 SetTitle(
"Unknown basic shape" );
230 m_thickness( aFrame, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits )
282 else if( extra_rows < 0 )
284 extra_rows = -extra_rows;
291 for(
unsigned row = 0; row <
m_currPoints.size(); ++row )
294 msg.Printf(
_(
"Corner %d" ), row+1 );
334 m_warningText->SetLabel(
_(
"Polygon must have at least 3 corners" ) );
349 m_warningText->SetLabel(
_(
"Polygon must have at least 3 corners after simplification" ) );
355 m_warningText->SetLabel(
_(
"Polygon can not be self-intersecting" ) );
362 if( aRemoveRedundantCorners )
373 m_warningText->SetLabel(
_(
"Note: redundant corners removed" ) );
392 else if( selections.size() > 0 )
393 row = selections[ selections.size() - 1 ] + 1;
399 wxMessageBox(
_(
"Select a corner to add the new corner after." ) );
432 if( selections.size() == 0 )
434 wxMessageBox(
_(
"Select a corner to delete." ) );
439 std::sort( selections.begin(), selections.end() );
441 for(
int ii = selections.size()-1; ii >= 0 ; --ii )
459 wxSize dc_size = dc.GetSize();
460 dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
467 minsize = std::max( minsize, std::abs(
m_currPoints[ii].x ) );
468 minsize = std::max( minsize, std::abs(
m_currPoints[ii].y ) );
477 double scale = std::min(
double( dc_size.x ) / minsize,
double( dc_size.y ) / minsize ) * 0.9;
501 unsigned jj = ii + 1;
529 int row =
event.GetRow();
530 int col =
event.GetCol();
531 wxString msg =
event.GetString();
549 std::vector<std::shared_ptr<PCB_SHAPE>>& aList,
550 bool aShowDuplicate ) :
553 m_vectorX( aFrame, m_xLabel, m_xCtrl, m_xUnits ),
554 m_vectorY( aFrame, m_yLabel, m_yCtrl, m_yUnits ),
555 m_rotation( aFrame, m_rotationLabel, m_rotationCtrl, m_rotationUnits )
559 if( !aShowDuplicate )
566 GetSizer()->SetSizeHints(
this );
571 inline void geom_transf( wxPoint& aCoord,
const wxPoint& aMove,
double aScale,
double aRotation )
573 aCoord.x =
KiROUND( aCoord.x * aScale );
574 aCoord.y =
KiROUND( aCoord.y * aScale );
581 int aDuplicateCount )
599 wxPoint currMoveVect = move_vect;
600 double curr_rotation = rotation;
603 for(
unsigned idx = 0; idx <
m_list.size(); ++idx )
605 std::shared_ptr<PCB_SHAPE> shape;
607 if( aList ==
nullptr )
613 aList->emplace_back( std::make_shared<PCB_SHAPE>( *
m_list[idx] ) );
614 shape = aList->back();
618 shape->SetWidth(
KiROUND( shape->GetWidth() *
scale ) );
619 shape->Move( currMoveVect );
620 shape->Scale(
scale );
621 shape->Rotate( wxPoint( 0, 0 ), curr_rotation );
626 curr_rotation += rotation;
627 currMoveVect += move_vect;
628 }
while( aList && --aDuplicateCount > 0 );
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
wxStaticBitmap * m_warningIcon
void GRResetPenAndBrush(wxDC *DC)
wxStaticText * m_staticTextPosCtrl2
void SetFilled(bool aFlag)
void SetEnd(const wxPoint &aEnd)
Implementation of conversion functions that require both schematic and board internal units.
This file is part of the common library.
Class DIALOG_PAD_PRIMITIVE_POLY_PROPS_BASE.
const wxPoint & GetStart() const
Return the starting point of the graphic.
SHAPE_LINE_CHAIN & Simplify(bool aRemoveColinear=true)
Simplify the line chain by removing colinear adjacent segments and duplicate vertices.
WX_GRID * m_gridCornersList
wxStaticText * m_warningText
double GetArcAngle() const
void onCellChanging(wxGridEvent &event)
DIALOG_PAD_PRIMITIVE_POLY_PROPS(wxWindow *aParent, PCB_BASE_FRAME *aFrame, PCB_SHAPE *aShape)
wxStaticText * m_staticTextPosEnd
TEXT_CTRL_EVAL * m_startXCtrl
void SetArcAngleAndEnd(double aAngle, bool aCheckNegativeAngle=false)
Set the end point from the angle center and start.
void OnButtonDelete(wxCommandEvent &event) override
void RotatePoint(int *pX, int *pY, double angle)
int PointCount() const
Return the number of points (vertices) in this line chain.
const OPT< INTERSECTION > SelfIntersecting() const
Check if the line chain is self-intersecting.
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
~DIALOG_PAD_PRIMITIVE_POLY_PROPS()
void SetBezierC1(const wxPoint &aPt)
bool TransferDataFromWindow() override
Transfer data out of the GUI.
Classes used in Pcbnew, CvPcb and GerbView.
EDA_UNITS GetUserUnits() const
void SetStart(const wxPoint &aStart)
const wxPoint & GetBezierC1() const
bool TransferDataToWindow() override
Function TransferDataToWindow Transfer data into the GUI.
const wxPoint & GetEnd() const
Return the ending point of the graphic.
void Show(bool aShow, bool aResize=false)
Show/hide the label, widget and units label.
bool TransferDataToWindow() override
Transfer data into the GUI.
void onGridSelect(wxGridRangeSelectEvent &event) override
const std::vector< VECTOR2I > & CPoints() const
wxBitmapButton * m_addButton
wxStaticText * m_staticTextPosCtrl1
long long int ValueFromString(EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application.
wxStaticText * m_staticTextPosStart
SHAPE_LINE_CHAIN & Outline(int aIndex)
wxPoint GetCenter() const override
This defaults to the center of the bounding box if not overridden.
const wxPoint & GetBezierC2() const
void onPolyPanelResize(wxSizeEvent &event) override
DIALOG_PAD_PRIMITIVES_PROPERTIES(wxWindow *aParent, PCB_BASE_FRAME *aFrame, PCB_SHAPE *aShape)
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color, wxPenStyle aStyle)
void SetWidth(int aWidth)
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
void SetCenter(const wxPoint &aCenter)
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
std::vector< wxPoint > m_currPoints
wxCheckBox * m_filledCtrl
void onPaintPolyPanel(wxPaintEvent &event) override
SHAPE_POLY_SET & GetPolyShape()
void geom_transf(wxPoint &aCoord, const wxPoint &aMove, double aScale, double aRotation)
wxStaticText * m_radiusLabel
EDA_COLOR_T
Legacy color enumeration.
wxCheckBox * m_filledCtrl
void OnButtonAdd(wxCommandEvent &event) override
wxTextCtrl * m_thicknessCtrl
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
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...
void SetPolyPoints(const std::vector< wxPoint > &aPoints)
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
virtual void SetValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
wxBitmapButton * m_deleteButton
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
void SetBezierC2(const wxPoint &aPt)
virtual long long int GetValue()
Return the current value in Internal Units.
wxString StringFromValue(EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
bool doValidate(bool aRemoveRedundantCorners)
double DoubleValueFromString(EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType)
Function DoubleValueFromString converts aTextValue to a double.
static constexpr int Millimeter2iu(double mm)
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
bool TransferDataFromWindow() override
Transfer data out of the GUI.
bool Validate() override
Test for a valid polygon (a not self intersectiong polygon).
Class DIALOG_PAD_PRIMITIVES_PROPERTIES_BASE.