48 m_startX( aFrame, m_startXLabel, m_startXCtrl, m_startXUnits, true ),
49 m_startY( aFrame, m_startYLabel, m_startYCtrl, m_startYUnits, true ),
50 m_ctrl1X( aFrame, m_ctrl1XLabel, m_ctrl1XCtrl, m_ctrl1XUnits, true ),
51 m_ctrl1Y( aFrame, m_ctrl1YLabel, m_ctrl1YCtrl, m_ctrl1YUnits, true ),
52 m_ctrl2X( aFrame, m_ctrl2XLabel, m_ctrl2XCtrl, m_ctrl2XUnits, true ),
53 m_ctrl2Y( aFrame, m_ctrl2YLabel, m_ctrl2YCtrl, m_ctrl2YUnits, true ),
54 m_endX( aFrame, m_endXLabel, m_endXCtrl, m_endXUnits, true ),
55 m_endY( aFrame, m_endYLabel, m_endYCtrl, m_endYUnits, true ),
56 m_radius( aFrame, m_radiusLabel, m_radiusCtrl, m_radiusUnits, true ),
57 m_thickness( aFrame, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits, true )
79 SetTitle(
_(
"Segment" ) );
97 SetTitle(
_(
"Bezier" ) );
111 SetTitle(
_(
"Arc" ) );
133 SetTitle(
_(
"Ring" ) );
135 SetTitle(
_(
"Circle" ) );
163 SetTitle(
"Unknown basic shape" );
174 DisplayError(
this,
_(
"Line width may not be 0 for unfilled shapes." ) );
216 SetTitle(
"Unknown basic shape" );
229 m_thickness( aFrame, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits, true )
248 GetSizer()->SetSizeHints(
this );
278 else if( extra_rows < 0 )
280 extra_rows = -extra_rows;
286 for(
unsigned row = 0; row <
m_currPoints.size(); ++row )
289 msg.Printf(
"Corner %d", row+1 );
330 m_warningText->SetLabel(
_(
"Polygon must have at least 3 corners" ) );
345 m_warningText->SetLabel(
_(
"Polygon must have at least 3 corners after simplification" ) );
351 m_warningText->SetLabel(
_(
"Polygon can not be self-intersecting" ) );
358 if( aRemoveRedundantCorners )
369 m_warningText->SetLabel(
_(
"Note: redundant corners removed" ) );
388 else if( selections.size() > 0 )
389 row = selections[ selections.size() - 1 ] + 1;
395 wxMessageBox(
_(
"Select a corner to add the new corner after." ) );
427 if( selections.size() == 0 )
429 wxMessageBox(
_(
"Select a corner to delete." ) );
434 std::sort( selections.begin(), selections.end() );
436 for(
int ii = selections.size()-1; ii >= 0 ; --ii )
452 wxSize dc_size = dc.GetSize();
453 dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
460 minsize = std::max( minsize, std::abs(
m_currPoints[ii].x ) );
461 minsize = std::max( minsize, std::abs(
m_currPoints[ii].y ) );
470 double scale = std::min(
double( dc_size.x ) / minsize,
double( dc_size.y ) / minsize ) * 0.9;
494 unsigned jj = ii + 1;
518 int row =
event.GetRow();
519 int col =
event.GetCol();
520 wxString msg =
event.GetString();
540 std::vector<std::shared_ptr<PCB_SHAPE>>& aList,
541 bool aShowDuplicate ) :
544 m_vectorX( aFrame, m_xLabel, m_xCtrl, m_xUnits, true ),
545 m_vectorY( aFrame, m_yLabel, m_yCtrl, m_yUnits, true ),
546 m_rotation( aFrame, m_rotationLabel, m_rotationCtrl, m_rotationUnits )
550 if( !aShowDuplicate )
557 GetSizer()->SetSizeHints(
this );
562 inline void geom_transf( wxPoint& aCoord,
const wxPoint& aMove,
double aScale,
double aRotation )
564 aCoord.x =
KiROUND( aCoord.x * aScale );
565 aCoord.y =
KiROUND( aCoord.y * aScale );
572 int aDuplicateCount )
590 wxPoint currMoveVect = move_vect;
591 double curr_rotation = rotation;
594 for(
unsigned idx = 0; idx <
m_list.size(); ++idx )
596 std::shared_ptr<PCB_SHAPE> shape;
602 aList->emplace_back( std::make_shared<PCB_SHAPE>( *
m_list[idx] ) );
603 shape = aList->back();
607 shape->SetWidth(
KiROUND( shape->GetWidth() *
scale ) );
608 shape->Move( currMoveVect );
609 shape->Scale(
scale );
610 shape->Rotate( wxPoint( 0, 0 ), curr_rotation );
615 curr_rotation += rotation;
616 currMoveVect += move_vect;
617 }
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
SHAPE_POLY_SET & GetPolyShape()
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
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.
SHAPE_LINE_CHAIN & Simplify(bool aRemoveColinear=true)
Function Simplify()
void SetFilled(bool aFlag)
WX_GRID * m_gridCornersList
wxStaticText * m_warningText
int GetRadius() const
Function GetRadius returns the radius of this item Has meaning only for arc and circle.
polygon (not yet used for tracks, but could be in microwave apps)
void onCellChanging(wxGridEvent &event)
DIALOG_PAD_PRIMITIVE_POLY_PROPS(wxWindow *aParent, PCB_BASE_FRAME *aFrame, PCB_SHAPE *aShape)
usual segment : line with rounded ends
wxStaticText * m_staticTextPosEnd
TEXT_CTRL_EVAL * m_startXCtrl
void OnButtonDelete(wxCommandEvent &event) override
void RotatePoint(int *pX, int *pY, double angle)
int PointCount() const
Function PointCount()
const OPT< INTERSECTION > SelfIntersecting() const
Function SelfIntersecting()
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
~DIALOG_PAD_PRIMITIVE_POLY_PROPS()
bool TransferDataFromWindow() override
Function TransferDataFromWindow Transfer data out of the GUI.
Classes used in Pcbnew, CvPcb and GerbView.
EDA_UNITS GetUserUnits() const
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
bool TransferDataToWindow() override
Function TransferDataToWindow Transfer data into the GUI.
void Show(bool aShow, bool aResize=false)
Show/hide the label, widget and units label.
bool TransferDataToWindow() override
Function TransferDataToWindow 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
const BITMAP_OPAQUE dialog_warning_xpm[1]
SHAPE_LINE_CHAIN & Outline(int aIndex)
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
void onPolyPanelResize(wxSizeEvent &event) override
DIALOG_PAD_PRIMITIVES_PROPERTIES(wxWindow *aParent, PCB_BASE_FRAME *aFrame, PCB_SHAPE *aShape)
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
void SetBezControl1(const wxPoint &aPoint)
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color, wxPenStyle aStyle)
std::vector< wxPoint > m_currPoints
const BITMAP_OPAQUE small_trash_xpm[1]
wxCheckBox * m_filledCtrl
void onPaintPolyPanel(wxPaintEvent &event) override
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 SetStart(const wxPoint &aStart)
const wxPoint & GetBezControl2() const
virtual void SetValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
wxBitmapButton * m_deleteButton
void SetWidth(int aWidth)
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
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.
PCB_SHAPE_TYPE_T GetShape() const
bool doValidate(bool aRemoveRedundantCorners)
double DoubleValueFromString(EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType)
Function DoubleValueFromString converts aTextValue to a double.
virtual void SetAngle(double aAngle, bool aUpdateEnd=true)
Sets the angle for arcs, and normalizes it within the range 0 - 360 degrees.
static constexpr int Millimeter2iu(double mm)
const wxPoint & GetBezControl1() const
void SetPolyPoints(const std::vector< wxPoint > &aPoints)
const BITMAP_OPAQUE small_plus_xpm[1]
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
bool TransferDataFromWindow() override
Function TransferDataFromWindow Transfer data out of the GUI.
void SetEnd(const wxPoint &aEnd)
bool Validate() override
test for a valid polygon (a not self intersectiong polygon)
Class DIALOG_PAD_PRIMITIVES_PROPERTIES_BASE.