KiCad PCB EDA Suite
dialog_pad_basicshapes_properties.cpp
Go to the documentation of this file.
1 
6 /*
7  * This program source code file is part of KiCad, a free EDA CAD application.
8  *
9  * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
10  * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, you may find one here:
24  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
25  * or you may search the http://www.gnu.org website for the version 2 license,
26  * or you may write to the Free Software Foundation, Inc.,
27  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
28  */
29 
30 #include <algorithm>
31 
32 #include <fctsys.h>
33 #include <common.h>
34 #include <confirm.h>
35 #include <pcbnew.h>
36 #include <trigo.h>
37 #include <macros.h>
38 #include <pcb_base_frame.h>
39 #include <base_units.h>
40 #include <widgets/wx_grid.h>
41 #include <class_board.h>
42 #include <class_module.h>
43 
44 #include <dialog_pad_properties.h>
45 #include <bitmaps.h>
46 
48  PCB_BASE_FRAME* aFrame,
49  PAD_CS_PRIMITIVE * aShape ) :
51  m_shape( aShape ),
52  m_startX( aFrame, m_startXLabel, m_startXCtrl, m_startXUnits, true ),
53  m_startY( aFrame, m_startYLabel, m_startYCtrl, m_startYUnits, true ),
54  m_ctrl1X( aFrame, m_ctrl1XLabel, m_ctrl1XCtrl, m_ctrl1XUnits, true ),
55  m_ctrl1Y( aFrame, m_ctrl1YLabel, m_ctrl1YCtrl, m_ctrl1YUnits, true ),
56  m_ctrl2X( aFrame, m_ctrl2XLabel, m_ctrl2XCtrl, m_ctrl2XUnits, true ),
57  m_ctrl2Y( aFrame, m_ctrl2YLabel, m_ctrl2YCtrl, m_ctrl2YUnits, true ),
58  m_endX( aFrame, m_endXLabel, m_endXCtrl, m_endXUnits, true ),
59  m_endY( aFrame, m_endYLabel, m_endYCtrl, m_endYUnits, true ),
60  m_radius( aFrame, m_radiusLabel, m_radiusCtrl, m_radiusUnits, true ),
61  m_thickness( aFrame, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits, true )
62 {
64 
66 
67  m_sdbSizerOK->SetDefault();
68 
70 }
71 
73 {
74  if( m_shape == NULL )
75  return false;
76 
77  // Shows the text info about circle or ring only for S_CIRCLE shape
78  if( m_shape->m_Shape != S_CIRCLE )
79  m_staticTextInfo->Show( false );
80 
82 
83  switch( m_shape->m_Shape )
84  {
85  case S_SEGMENT: // Segment with rounded ends
86  SetTitle( _( "Segment" ) );
91  m_ctrl1X.Show( false, true );
92  m_ctrl1Y.Show( false, true );
93  m_ctrl2X.Show( false, true );
94  m_ctrl2Y.Show( false, true );
95  m_staticTextPosCtrl1->Show( false );
96  m_staticTextPosCtrl1->SetSize( 0, 0 );
97  m_staticTextPosCtrl2->Show( false );
98  m_staticTextPosCtrl2->SetSize( 0, 0 );
99  m_radius.Show( false );
100  break;
101 
102  case S_CURVE: // Bezier line
103  SetTitle( _( "Bezier" ) );
112  m_radius.Show( false );
113  break;
114 
115  case S_ARC: // Arc with rounded ends
116  SetTitle( _( "Arc" ) );
117  m_staticTextPosEnd->SetLabel( _( "Center" ) );
118  m_startX.SetValue( m_shape->m_Start.x ); // Start point of arc
120  m_endX.SetValue( m_shape->m_End.x ); // arc center
122  m_radiusLabel->SetLabel( _( "Angle:" ) );
125  m_ctrl1X.Show( false, true );
126  m_ctrl1Y.Show( false, true );
127  m_ctrl2X.Show( false, true );
128  m_ctrl2Y.Show( false, true );
129  m_staticTextPosCtrl1->Show( false );
130  m_staticTextPosCtrl1->SetSize( 0, 0 );
131  m_staticTextPosCtrl2->Show( false );
132  m_staticTextPosCtrl2->SetSize( 0, 0 );
133  break;
134 
135  case S_CIRCLE: // ring or circle
136  if( m_shape->m_Thickness )
137  SetTitle( _( "Ring" ) );
138  else
139  SetTitle( _( "Circle" ) );
140 
141  // End point does not exist for a circle or ring:
142  m_staticTextPosEnd->Show( false );
143  m_endX.Show( false );
144  m_endY.Show( false );
145 
146  // Circle center uses position controls:
147  m_staticTextPosStart->SetLabel( _( "Center:" ) );
151  m_ctrl1X.Show( false, true );
152  m_ctrl1Y.Show( false, true );
153  m_ctrl2X.Show( false, true );
154  m_ctrl2Y.Show( false, true );
155  m_staticTextPosCtrl1->Show( false );
156  m_staticTextPosCtrl1->SetSize( 0, 0 );
157  m_staticTextPosCtrl2->Show( false );
158  m_staticTextPosCtrl2->SetSize( 0, 0 );
159  break;
160 
161  case S_POLYGON: // polygon
162  // polygon has a specific dialog editor. So nothing here
163  break;
164 
165  default:
166  SetTitle( "Unknown basic shape" );
167  break;
168  }
169 
170  return true;
171 }
172 
174 {
175  // Transfer data out of the GUI.
177 
178  switch( m_shape->m_Shape )
179  {
180  case S_SEGMENT: // Segment with rounded ends
183  m_shape->m_End.x = m_endX.GetValue();
184  m_shape->m_End.y = m_endY.GetValue();
185  break;
186 
187  case S_CURVE: // Segment with rounded ends
190  m_shape->m_End.x = m_endX.GetValue();
191  m_shape->m_End.y = m_endY.GetValue();
196  break;
197 
198  case S_ARC: // Arc with rounded ends
199  // Start point of arc
202  // arc center
203  m_shape->m_End.x = m_endX.GetValue();
204  m_shape->m_End.y = m_endY.GetValue();
205  // arc angle
207  break;
208 
209  case S_CIRCLE: // ring or circle
213  break;
214 
215  case S_POLYGON: // polygon
216  // polygon has a specific dialog editor. So nothing here
217  break;
218 
219  default:
220  SetTitle( "Unknown basic shape" );
221  break;
222  }
223 
224  return true;
225 }
226 
227 
229  PCB_BASE_FRAME* aFrame,
230  PAD_CS_PRIMITIVE * aShape ) :
232  m_shape( aShape ),
233  m_currshape( *m_shape ),
234  m_thickness( aFrame, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits, true )
235 {
236  m_addButton->SetBitmap( KiBitmap( small_plus_xpm ) );
237  m_deleteButton->SetBitmap( KiBitmap( trash_xpm ) );
238  m_warningIcon->SetBitmap( KiBitmap( dialog_warning_xpm ) );
239 
240  // Test for acceptable polygon (more than 2 corners, and not self-intersecting) and
241  // remove any redundant corners. A warning message is displayed if not OK.
242  doValidate( true );
243 
245 
246  m_sdbSizerOK->SetDefault();
247  GetSizer()->SetSizeHints( this );
248 
249  // TODO: move wxEVT_GRID_CELL_CHANGING in wxFormbuilder, when it support it
250  m_gridCornersList->Connect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_PAD_PRIMITIVE_POLY_PROPS::onCellChanging ), NULL, this );
251 
252  // Now all widgets have the size fixed, call FinishDialogSettings
254 }
255 
256 
258 {
259  m_gridCornersList->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_PAD_PRIMITIVE_POLY_PROPS::onCellChanging ), NULL, this );
260 }
261 
262 
264 {
265  if( m_shape == NULL )
266  return false;
267 
269 
270  // Populates the list of corners
271  int extra_rows = m_currshape.m_Poly.size() - m_gridCornersList->GetNumberRows();
272 
273  if( extra_rows > 0 )
274  {
275  m_gridCornersList->AppendRows( extra_rows );
276  }
277  else if( extra_rows < 0 )
278  {
279  extra_rows = -extra_rows;
280  m_gridCornersList->DeleteRows( 0, extra_rows );
281  }
282 
283  // enter others corner coordinates
284  wxString msg;
285  for( unsigned row = 0; row < m_currshape.m_Poly.size(); ++row )
286  {
287  // Row label is "Corner x"
288  msg.Printf( "Corner %d", row+1 );
289  m_gridCornersList->SetRowLabelValue( row, msg );
290 
291  msg = StringFromValue( GetUserUnits(), m_currshape.m_Poly[row].x, true, true );
292  m_gridCornersList->SetCellValue( row, 0, msg );
293 
294  msg = StringFromValue( GetUserUnits(), m_currshape.m_Poly[row].y, true, true );
295  m_gridCornersList->SetCellValue( row, 1, msg );
296  }
297 
298  return true;
299 }
300 
302 {
303  if( !Validate() )
304  return false;
305 
307 
308  *m_shape = m_currshape;
309 
310  return true;
311 }
312 
313 
315 {
316  // Don't remove redundant corners while user is editing corner list
317  return doValidate( false );
318 }
319 
320 
321 // test for a valid polygon (a not self intersectiong polygon)
322 bool DIALOG_PAD_PRIMITIVE_POLY_PROPS::doValidate( bool aRemoveRedundantCorners )
323 {
325  return false;
326 
327  if( m_currshape.m_Poly.size() < 3 )
328  {
329  m_warningText->SetLabel( _("Polygon must have at least 3 corners" ) );
330  m_warningText->Show( true );
331  m_warningIcon->Show( true );
332  return false;
333  }
334 
335  bool valid = true;
336 
337  SHAPE_LINE_CHAIN polyline;
338 
339  for( unsigned ii = 0; ii < m_currshape.m_Poly.size(); ++ii )
340  polyline.Append( m_currshape.m_Poly[ii].x, m_currshape.m_Poly[ii].y );
341 
342  // The polyline describes a polygon: close it.
343  polyline.SetClosed( true );
344 
345  // Remove redundant corners:
346  polyline.Simplify();
347 
348  if( polyline.PointCount() < 3 )
349  {
350  m_warningText->SetLabel( _("Polygon must have at least 3 corners after simplification" ) );
351  valid = false;
352  }
353 
354  if( valid && polyline.SelfIntersecting() )
355  {
356  m_warningText->SetLabel( _("Polygon may not be self-intersecting" ) );
357  valid = false;
358  }
359 
360  m_warningIcon->Show( !valid );
361  m_warningText->Show( !valid );
362 
363  if( aRemoveRedundantCorners )
364  {
365  if( polyline.PointCount() != (int)m_currshape.m_Poly.size() )
366  { // Happens after simplification
367  m_currshape.m_Poly.clear();
368 
369  for( int ii = 0; ii < polyline.PointCount(); ++ii )
370  m_currshape.m_Poly.push_back( wxPoint( polyline.CPoint( ii ).x, polyline.CPoint( ii ).y ) );
371 
372  m_warningIcon->Show( true );
373  m_warningText->Show( true );
374  m_warningText->SetLabel( _("Note: redundant corners removed" ) );
375  }
376  }
377 
378  return valid;
379 }
380 
381 
382 void DIALOG_PAD_PRIMITIVE_POLY_PROPS::OnButtonAdd( wxCommandEvent& event )
383 {
385  return;
386 
387  // Insert a new corner after the currently selected:
388  wxArrayInt selections = m_gridCornersList->GetSelectedRows();
389  int row = -1;
390 
391  if( m_gridCornersList->GetNumberRows() == 0 )
392  row = 0;
393  else if( selections.size() > 0 )
394  row = selections[ selections.size() - 1 ] + 1;
395  else
396  row = m_gridCornersList->GetGridCursorRow() + 1;
397 
398  if( row < 0 )
399  {
400  wxMessageBox( _( "Select a corner to add the new corner after." ) );
401  return;
402  }
403 
404  if( m_currshape.m_Poly.size() == 0 || row >= (int) m_currshape.m_Poly.size() )
405  m_currshape.m_Poly.push_back( wxPoint( 0, 0 ) );
406  else
407  m_currshape.m_Poly.insert( m_currshape.m_Poly.begin() + row, wxPoint( 0, 0 ) );
408 
409  Validate();
411 
412  m_gridCornersList->ForceRefresh();
413  // Select the new row
414  m_gridCornersList->SelectRow( row, false );
415 
416  m_panelPoly->Refresh();
417 }
418 
420 {
422  return;
423 
424  wxArrayInt selections = m_gridCornersList->GetSelectedRows();
425 
426  if( m_gridCornersList->GetNumberRows() == 0 )
427  return;
428 
429  if( selections.size() == 0 && m_gridCornersList->GetGridCursorRow() >= 0 )
430  selections.push_back( m_gridCornersList->GetGridCursorRow() );
431 
432  if( selections.size() == 0 )
433  {
434  wxMessageBox( _( "Select a corner to delete." ) );
435  return;
436  }
437 
438  // remove corners:
439  std::sort( selections.begin(), selections.end() );
440 
441  for( int ii = selections.size()-1; ii >= 0 ; --ii )
442  m_currshape.m_Poly.erase( m_currshape.m_Poly.begin() + selections[ii] );
443 
444  Validate();
446 
447  m_gridCornersList->ForceRefresh();
448  // select the row previous to the last deleted row
449  m_gridCornersList->SelectRow( std::max( 0, selections[ 0 ] - 1 ) );
450 
451  m_panelPoly->Refresh();
452 }
453 
455 {
456  wxPaintDC dc( m_panelPoly );
457  wxSize dc_size = dc.GetSize();
458  dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
459 
460  // Calculate a suitable scale to fit the available draw area
461  wxSize minsize;
462 
463  for( unsigned ii = 0; ii < m_currshape.m_Poly.size(); ++ii )
464  {
465  minsize.x = std::max( minsize.x, std::abs( m_currshape.m_Poly[ii].x ) );
466  minsize.y = std::max( minsize.y, std::abs( m_currshape.m_Poly[ii].y ) );
467  }
468 
469  // The draw origin is the center of the window.
470  // Therefore the window size is twice the minsize just calculated
471  minsize.x *= 2;
472  minsize.y *= 2;
473  minsize.x += m_currshape.m_Thickness;
474  minsize.y += m_currshape.m_Thickness;
475 
476  // Avoid null or too small size:
477  int mindim = Millimeter2iu( 0.5 );
478 
479  if( minsize.x < mindim )
480  minsize.x = mindim;
481 
482  if( minsize.y < mindim )
483  minsize.y = mindim;
484 
485  double scale = std::min( (double) dc_size.x / minsize.x, (double) dc_size.y / minsize.y );
486 
487  // Give a margin
488  scale *= 0.9;
489  dc.SetUserScale( scale, scale );
490 
491  GRResetPenAndBrush( &dc );
492 
493  // Draw X and Y axis. This is particularly useful to show the
494  // reference position of basic shape
495  // Axis are drawn before the polygon to avoid masking segments on axis
496  GRLine( NULL, &dc, -int( dc_size.x/scale ), 0, int( dc_size.x/scale ), 0, 0, LIGHTBLUE ); // X axis
497  GRLine( NULL, &dc, 0, -int( dc_size.y/scale ), 0, int( dc_size.y/scale ), 0, LIGHTBLUE ); // Y axis
498 
499  // Draw polygon.
500  // The selected edge(s) are shown in selectcolor, the others in normalcolor.
501  EDA_COLOR_T normalcolor = WHITE;
502  EDA_COLOR_T selectcolor = RED;
503 
504  for( unsigned ii = 0; ii < m_currshape.m_Poly.size(); ++ii )
505  {
506  EDA_COLOR_T color = normalcolor;
507 
508  if( m_gridCornersList->IsInSelection (ii, 0) ||
509  m_gridCornersList->IsInSelection (ii, 1) ||
510  m_gridCornersList->GetGridCursorRow() == (int)ii )
511  color = selectcolor;
512 
513  unsigned jj = ii + 1;
514 
515  if( jj >= m_currshape.m_Poly.size() )
516  jj = 0;
517 
519  }
520 
521  event.Skip();
522 }
523 
525 {
526  m_panelPoly->Refresh();
527  event.Skip();
528 }
529 
530 void DIALOG_PAD_PRIMITIVE_POLY_PROPS::onGridSelect( wxGridRangeSelectEvent& event )
531 {
532  m_panelPoly->Refresh();
533 }
534 
536 {
537  int row = event.GetRow();
538  int col = event.GetCol();
539  wxString msg = event.GetString();
540 
541  if( msg.IsEmpty() )
542  return;
543 
544  if( col == 0 ) // Set the X value
545  m_currshape.m_Poly[row].x = ValueFromString( GetUserUnits(), msg, true );
546  else // Set the Y value
547  m_currshape.m_Poly[row].y = ValueFromString( GetUserUnits(), msg, true );
548 
550 
551  Validate();
552 
553  m_panelPoly->Refresh();
554 }
555 
556 
557 // A dialog to apply geometry transforms to a shape or set of shapes
558 // (move, rotate around origin, scaling factor, duplication).
560  PCB_BASE_FRAME* aFrame,
561  std::vector<PAD_CS_PRIMITIVE*>& aList,
562  bool aShowDuplicate ) :
564  m_list( aList ),
565  m_vectorX( aFrame, m_xLabel, m_xCtrl, m_xUnits, true ),
566  m_vectorY( aFrame, m_yLabel, m_yCtrl, m_yUnits, true ),
567  m_rotation( aFrame, m_rotationLabel, m_rotationCtrl, m_rotationUnits )
568 {
570 
571  if( !aShowDuplicate ) // means no duplicate transform
572  {
573  m_staticTextDupCnt->Show( false );
574  m_spinCtrlDuplicateCount->Show( false );
575  }
576 
577  m_sdbSizerOK->SetDefault();
578  GetSizer()->SetSizeHints( this );
579 }
580 
581 
582 // A helper function in geometry transform
583 inline void geom_transf( wxPoint& aCoord, wxPoint& aMove, double aScale, double aRotation )
584 {
585  aCoord.x = KiROUND( aCoord.x * aScale );
586  aCoord.y = KiROUND( aCoord.y * aScale );
587  aCoord += aMove;
588  RotatePoint( &aCoord, aRotation );
589 }
590 
591 
592 void DIALOG_PAD_PRIMITIVES_TRANSFORM::Transform( std::vector<PAD_CS_PRIMITIVE>* aList, int aDuplicateCount )
593 {
594  wxPoint move_vect( m_vectorX.GetValue(), m_vectorY.GetValue() );
595  double rotation = m_rotation.GetValue();
596  double scale = DoubleValueFromString( UNSCALED_UNITS, m_scaleCtrl->GetValue() );
597 
598  // Avoid too small / too large scale, which could create issues:
599  if( scale < 0.01 )
600  scale = 0.01;
601 
602  if( scale > 100.0 )
603  scale = 100.0;
604 
605  // Transform shapes
606  // shapes are scaled, then moved then rotated.
607  // if aList != NULL, the initial shape will be duplicated, and transform
608  // applied to the duplicated shape
609 
610  wxPoint currMoveVect = move_vect;
611  double curr_rotation = rotation;
612 
613  do {
614  for( unsigned idx = 0; idx < m_list.size(); ++idx )
615  {
616  PAD_CS_PRIMITIVE* shape;
617 
618  if( aList == NULL )
619  shape = m_list[idx];
620  else
621  {
622  PAD_CS_PRIMITIVE new_shape( *m_list[idx] );
623  aList->push_back( new_shape );
624  shape = &aList->back();
625  }
626 
627  // Transform parameters common to all shape types (some can be unused)
628  shape->m_Thickness = KiROUND( shape->m_Thickness * scale );
629  geom_transf( shape->m_Start, currMoveVect, scale, curr_rotation );
630  geom_transf( shape->m_End, currMoveVect, scale, curr_rotation );
631 
632  // specific parameters:
633  switch( shape->m_Shape )
634  {
635  case S_SEGMENT: // Segment with rounded ends
636  break;
637 
638  case S_ARC: // Arc with rounded ends
639  break;
640 
641  case S_CURVE: // Bezier with rounded ends
642  geom_transf( shape->m_Ctrl1, currMoveVect, scale, curr_rotation );
643  geom_transf( shape->m_Ctrl2, currMoveVect, scale, curr_rotation );
644  break;
645 
646  case S_CIRCLE: // ring or circle
647  shape->m_Radius = KiROUND( shape->m_Radius * scale );
648  break;
649 
650  case S_POLYGON: // polygon
651  for( unsigned ii = 0; ii < shape->m_Poly.size(); ++ii )
652  geom_transf( shape->m_Poly[ii], currMoveVect, scale, curr_rotation );
653  break;
654 
655  default:
656  break;
657  }
658  }
659 
660  // Prepare new transform on duplication:
661  // Each new item is rotated (or moved) by the transform from the last duplication
662  curr_rotation += rotation;
663  currMoveVect += move_vect;
664  } while( aList && --aDuplicateCount > 0 );
665 }
666 
DIALOG_PAD_PRIMITIVES_PROPERTIES(wxWindow *aParent, PCB_BASE_FRAME *aFrame, PAD_CS_PRIMITIVE *aShape)
void GRResetPenAndBrush(wxDC *DC)
Definition: gr_basic.cpp:123
EDA_COLOR_T
NOTE: EDA_COLOR_T is deprecated and is kept around for compatibility with legacy canvas.
Definition: colors.h:42
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:118
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.
Class BOARD to handle a board.
wxPoint m_Start
angle of an arc, from its starting point, in 0.1 deg
Definition: class_pad.h:100
int color
Definition: DXF_plotter.cpp:62
polygon (not yet used for tracks, but could be in microwave apps)
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
usual segment : line with rounded ends
void OnButtonDelete(wxCommandEvent &event) override
virtual void SetUnits(EDA_UNITS_T aUnits, bool aUseMils=false)
Function SetUnits Normally not needed (as the UNIT_BINDER inherits from the parent frame),...
Definition: unit_binder.cpp:65
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
int ValueFromString(EDA_UNITS_T aUnits, const wxString &aTextValue, bool aUseMils)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application.
Definition: base_units.cpp:409
void Transform(std::vector< PAD_CS_PRIMITIVE > *aList=NULL, int aDuplicateCount=0)
Apply geometric transform (rotation, move, scale) defined in dialog aDuplicate = 1 .
int PointCount() const
Function PointCount()
#define abs(a)
Definition: auxiliary.h:84
DIALOG_PAD_PRIMITIVES_TRANSFORM(wxWindow *aParent, PCB_BASE_FRAME *aFrame, std::vector< PAD_CS_PRIMITIVE * > &aList, bool aShowDuplicate)
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.
Definition: dialog_shim.h:116
wxPoint m_Ctrl1
is also the start point of the arc
Definition: class_pad.h:102
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
This file contains miscellaneous commonly used macros and functions.
bool TransferDataFromWindow() override
Function TransferDataFromWindow Transfer data out of the GUI.
Classes used in Pcbnew, CvPcb and GerbView.
Class DIALOG_PAD_PRIMITIVES_TRANSFORM_BASE.
virtual int GetValue()
Function GetValue Returns the current value in Internal Units.
dialog pad properties editor.
SHAPE_LINE_CHAIN & Simplify()
Function Simplify()
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
const VECTOR2I & CPoint(int aIndex) const
Function CPoint()
void SetClosed(bool aClosed)
Function SetClosed()
bool TransferDataToWindow() override
Function TransferDataToWindow Transfer data into the GUI.
void geom_transf(wxPoint &aCoord, wxPoint &aMove, double aScale, double aRotation)
void Show(bool aShow, bool aResize=false)
Function Show Shows/hides the label, widget and units label.
bool TransferDataToWindow() override
Function TransferDataToWindow Transfer data into the GUI.
int m_Radius
thickness of segment or outline For filled S_CIRCLE shape, thickness = 0.
Definition: class_pad.h:98
std::vector< wxPoint > m_Poly
Bezier Control point 2.
Definition: class_pad.h:104
void onGridSelect(wxGridRangeSelectEvent &event) override
double DoubleValueFromString(EDA_UNITS_T aUnits, const wxString &aTextValue, bool aUseMils)
Function DoubleValueFromString converts aTextValue to a double.
Definition: base_units.cpp:302
Arcs (with rounded ends)
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:91
DIALOG_PAD_PRIMITIVE_POLY_PROPS(wxWindow *aParent, PCB_BASE_FRAME *aFrame, PAD_CS_PRIMITIVE *aShape)
void onPolyPanelResize(wxSizeEvent &event) override
Definition: colors.h:60
Bezier Curve.
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:167
wxPoint m_End
is also the center of the circle and arc
Definition: class_pad.h:101
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:285
STROKE_T m_Shape
Definition: class_pad.h:94
void onPaintPolyPanel(wxPaintEvent &event) override
wxPoint m_Ctrl2
Bezier Control point 1.
Definition: class_pad.h:103
void OnButtonAdd(wxCommandEvent &event) override
int m_Thickness
S_SEGMENT, S_ARC, S_CIRCLE, S_POLYGON only (same as DRAWSEGMENT)
Definition: class_pad.h:95
const int scale
#define max(a, b)
Definition: auxiliary.h:86
Class SHAPE_LINE_CHAIN.
virtual void SetValue(int aValue)
Function SetValue Sets new value (in Internal Units) for the text field, taking care of units convers...
std::vector< PAD_CS_PRIMITIVE * > & m_list
The common library.
Definition: colors.h:49
wxString StringFromValue(EDA_UNITS_T aUnits, int aValue, bool aAddUnitSymbol, bool aUseMils)
Function StringFromValue returns the string from aValue according to units (inch, mm ....
Definition: base_units.cpp:210
Module description (excepted pads)
bool doValidate(bool aRemoveRedundantCorners)
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
double m_ArcAngle
radius of a circle
Definition: class_pad.h:99
bool TransferDataFromWindow() override
Function TransferDataFromWindow Transfer data out of the GUI.
#define min(a, b)
Definition: auxiliary.h:85
bool Validate() override
test for a valid polygon (a not self intersectiong polygon)
Class DIALOG_PAD_PRIMITIVES_PROPERTIES_BASE.
EDA_UNITS_T GetUserUnits() const override
Definition: dialog_shim.h:133