KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_pad_basicshapes_properties.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#include <algorithm>
26
27#include <confirm.h>
28#include <trigo.h>
29#include <pcb_base_frame.h>
30#include <base_units.h>
31#include <widgets/wx_grid.h>
33#include <footprint.h>
34#include <math/util.h> // for KiROUND
35
36#include <bitmaps.h>
37#include <wx/dcclient.h>
38
41
43 PCB_BASE_FRAME* aFrame,
44 PCB_SHAPE* aShape ) :
46 m_shape( aShape ),
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 )
57{
59
61
63
65}
66
67
69{
70 if( m_shape == nullptr )
71 return false;
72
74 m_filledCtrl->SetValue( m_shape->IsFilled() );
75
76 switch( m_shape->GetShape() )
77 {
78 case SHAPE_T::SEGMENT:
79 SetTitle( _( "Segment" ) );
84 m_ctrl1X.Show( false, true );
85 m_ctrl1Y.Show( false, true );
86 m_ctrl2X.Show( false, true );
87 m_ctrl2Y.Show( false, true );
88 m_staticTextPosCtrl1->Show( false );
89 m_staticTextPosCtrl1->SetSize( 0, 0 );
90 m_staticTextPosCtrl2->Show( false );
91 m_staticTextPosCtrl2->SetSize( 0, 0 );
92 m_radius.Show( false );
93 m_filledCtrl->Show( false );
94 break;
95
96 case SHAPE_T::BEZIER:
97 SetTitle( _( "Bezier" ) );
106 m_radius.Show( false );
107 m_filledCtrl->Show( false );
108 break;
109
110 case SHAPE_T::ARC:
111 SetTitle( _( "Arc" ) );
114 m_staticTextPosEnd->SetLabel( _( "Center Point:" ) );
117 m_radiusLabel->SetLabel( _( "Angle:" ) );
118 m_radius.SetUnits( EDA_UNITS::DEGREES );
120 m_ctrl1X.Show( false, true );
121 m_ctrl1Y.Show( false, true );
122 m_ctrl2X.Show( false, true );
123 m_ctrl2Y.Show( false, true );
124 m_staticTextPosCtrl1->Show( false );
125 m_staticTextPosCtrl1->SetSize( 0, 0 );
126 m_staticTextPosCtrl2->Show( false );
127 m_staticTextPosCtrl2->SetSize( 0, 0 );
128 m_filledCtrl->Show( false );
129 break;
130
131 case SHAPE_T::CIRCLE:
132 if( m_shape->GetWidth() )
133 SetTitle( _( "Ring" ) );
134 else
135 SetTitle( _( "Circle" ) );
136
137 // End point does not exist for a circle or ring:
138 m_staticTextPosEnd->Show( false );
139 m_endX.Show( false );
140 m_endY.Show( false );
141
142 // Circle center uses position controls:
143 m_staticTextPosStart->SetLabel( _( "Center Point:" ) );
147 m_ctrl1X.Show( false, true );
148 m_ctrl1Y.Show( false, true );
149 m_ctrl2X.Show( false, true );
150 m_ctrl2Y.Show( false, true );
151 m_staticTextPosCtrl1->Show( false );
152 m_staticTextPosCtrl1->SetSize( 0, 0 );
153 m_staticTextPosCtrl2->Show( false );
154 m_staticTextPosCtrl2->SetSize( 0, 0 );
155 m_filledCtrl->Show( true );
156 break;
157
158 case SHAPE_T::RECT:
160 SetTitle( _( "Number Box" ) );
161 else
162 SetTitle( _( "Rectangle" ) );
163
168 m_ctrl1X.Show( false, true );
169 m_ctrl1Y.Show( false, true );
170 m_ctrl2X.Show( false, true );
171 m_ctrl2Y.Show( false, true );
172 m_staticTextPosCtrl1->Show( false );
173 m_staticTextPosCtrl1->SetSize( 0, 0 );
174 m_staticTextPosCtrl2->Show( false );
175 m_staticTextPosCtrl2->SetSize( 0, 0 );
176 m_radius.Show( false );
177 m_filledCtrl->Show( false );
178 break;
179
180 case SHAPE_T::POLY:
181 // polygon has a specific dialog editor. So nothing here
182 break;
183
184 default:
185 SetTitle( "Unknown Basic Shape" );
186 break;
187 }
188
189 return true;
190}
191
192
194{
195 if( m_thickness.GetValue() == 0 && !m_filledCtrl->GetValue() )
196 {
197 DisplayError( this, _( "Line width may not be 0 for unfilled shapes." ) );
198 m_thicknessCtrl->SetFocus();
199 return false;
200 }
201
202 // Transfer data out of the GUI.
203 STROKE_PARAMS stroke = m_shape->GetStroke();
204 stroke.SetWidth( m_thickness.GetIntValue() );
205 m_shape->SetStroke( stroke );
206
207 m_shape->SetFilled( m_filledCtrl->GetValue() );
208
209 switch( m_shape->GetShape() )
210 {
211 case SHAPE_T::SEGMENT:
212 case SHAPE_T::RECT:
215 break;
216
217 case SHAPE_T::BEZIER:
222 break;
223
224 case SHAPE_T::ARC:
228 break;
229
230 case SHAPE_T::CIRCLE:
233 break;
234
235 case SHAPE_T::POLY:
236 // polygon has a specific dialog editor. So nothing here
237 break;
238
239 default:
240 break;
241 }
242
243 return true;
244}
245
246
248 PCB_BASE_FRAME* aFrame,
249 PCB_SHAPE* aShape ) :
251 m_shape( aShape ),
252 m_thickness( aFrame, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits )
253{
254 if( !m_shape->GetPolyShape().IsEmpty() )
255 {
256 for( const VECTOR2I& pt : m_shape->GetPolyShape().Outline( 0 ).CPoints() )
257 m_currPoints.emplace_back( pt );
258 }
259
260 m_addButton->SetBitmap( KiBitmap( BITMAPS::small_plus ) );
261 m_deleteButton->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
262 m_warningIcon->SetBitmap( KiBitmap( BITMAPS::dialog_warning ) );
263
266
267 m_gridCornersList->SetDefaultRowSize( m_gridCornersList->GetDefaultRowSize() + 4 );
268
269 // Test for acceptable polygon (more than 2 corners, and not self-intersecting) and
270 // remove any redundant corners. A warning message is displayed if not OK.
271 doValidate( true );
272
274
276
277 m_gridCornersList->Connect( wxEVT_GRID_CELL_CHANGING,
279 nullptr, this );
280
281 // Now all widgets have the size fixed, call FinishDialogSettings
283}
284
285
287{
288 m_gridCornersList->Disconnect( wxEVT_GRID_CELL_CHANGING,
290 nullptr, this );
291}
292
293
295{
296 if( m_shape == nullptr )
297 return false;
298
300 m_filledCtrl->SetValue( m_shape->IsFilled() );
301
302 // Populates the list of corners
303 int extra_rows = m_currPoints.size() - m_gridCornersList->GetNumberRows();
304
305 if( extra_rows > 0 )
306 {
307 m_gridCornersList->AppendRows( extra_rows );
308 }
309 else if( extra_rows < 0 )
310 {
311 extra_rows = -extra_rows;
312 m_gridCornersList->DeleteRows( 0, extra_rows );
313 }
314
315 // enter others corner coordinates
316 for( unsigned row = 0; row < m_currPoints.size(); ++row )
317 {
318 // Row label is "Corner x"
319 m_gridCornersList->SetRowLabelValue( row, wxString::Format( _( "Corner %d" ), row+1 ) );
320
323 }
324
325 return true;
326}
327
329{
330 if( !Validate() )
331 return false;
332
334
335 STROKE_PARAMS stroke = m_shape->GetStroke();
336 stroke.SetWidth( m_thickness.GetIntValue() );
337 m_shape->SetStroke( stroke );
338
339 m_shape->SetFilled( m_filledCtrl->GetValue() );
340
341 return true;
342}
343
344
346{
347 // Don't remove redundant corners while user is editing corner list
348 return doValidate( false );
349}
350
351
352bool DIALOG_PAD_PRIMITIVE_POLY_PROPS::doValidate( bool aRemoveRedundantCorners )
353{
355 return false;
356
357 if( m_currPoints.size() < 3 )
358 {
359 m_warningText->SetLabel( _("Polygon must have at least 3 corners" ) );
360 m_warningText->Show( true );
361 m_warningIcon->Show( true );
362 return false;
363 }
364
365 bool valid = true;
366
367 SHAPE_LINE_CHAIN polyline( m_currPoints, true );
368
369 // Remove redundant corners:
370 polyline.Simplify();
371
372 if( polyline.PointCount() < 3 )
373 {
374 m_warningText->SetLabel( _( "Polygon must have at least 3 corners after simplification" ) );
375 valid = false;
376 }
377
378 if( valid && polyline.SelfIntersecting() )
379 {
380 m_warningText->SetLabel( _( "Polygon can not be self-intersecting" ) );
381 valid = false;
382 }
383
384 m_warningIcon->Show( !valid );
385 m_warningText->Show( !valid );
386
387 if( aRemoveRedundantCorners )
388 {
389 if( polyline.PointCount() != (int) m_currPoints.size() )
390 { // Happens after simplification
391 m_currPoints.clear();
392
393 for( const VECTOR2I& pt : polyline.CPoints() )
394 m_currPoints.emplace_back( pt );
395
396 m_warningIcon->Show( true );
397 m_warningText->Show( true );
398 m_warningText->SetLabel( _( "Note: redundant corners removed" ) );
399 }
400 }
401
402 return valid;
403}
404
405
407{
409 return;
410
411 // Insert a new corner after the currently selected:
412 wxArrayInt selections = m_gridCornersList->GetSelectedRows();
413 int row = -1;
414
415 if( m_gridCornersList->GetNumberRows() == 0 )
416 row = 0;
417 else if( selections.size() > 0 )
418 row = selections[ selections.size() - 1 ] + 1;
419 else
420 row = m_gridCornersList->GetGridCursorRow() + 1;
421
422 if( row < 0 )
423 {
424 wxMessageBox( _( "Select a corner to add the new corner after." ) );
425 return;
426 }
427
428 if( m_currPoints.size() == 0 || row >= (int) m_currPoints.size() )
429 m_currPoints.emplace_back( 0, 0 );
430 else
431 m_currPoints.insert( m_currPoints.begin() + row, VECTOR2I( 0, 0 ) );
432
433 Validate();
435
436 m_gridCornersList->ForceRefresh();
437 // Select the new row
438 m_gridCornersList->SelectRow( row, false );
439
440 m_panelPoly->Refresh();
441}
442
443
445{
447 return;
448
449 wxArrayInt selections = m_gridCornersList->GetSelectedRows();
450
451 if( m_gridCornersList->GetNumberRows() == 0 )
452 return;
453
454 if( selections.size() == 0 && m_gridCornersList->GetGridCursorRow() >= 0 )
455 selections.push_back( m_gridCornersList->GetGridCursorRow() );
456
457 if( selections.size() == 0 )
458 {
459 wxMessageBox( _( "Select a corner to delete." ) );
460 return;
461 }
462
463 // remove corners:
464 std::sort( selections.begin(), selections.end() );
465
466 for( int ii = selections.size()-1; ii >= 0 ; --ii )
467 m_currPoints.erase( m_currPoints.begin() + selections[ii] );
468
469 Validate();
471
472 m_gridCornersList->ForceRefresh();
473
474 // select the row previous to the last deleted row
475 m_gridCornersList->SelectRow( std::max( 0, selections[ 0 ] - 1 ) );
476
477 m_panelPoly->Refresh();
478}
479
480
482{
483 wxPaintDC dc( m_panelPoly );
484 wxSize dc_size = dc.GetSize();
485 dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
486
487 // Calculate a suitable scale to fit the available draw area
488 int minsize( pcbIUScale.mmToIU( 0.5 ) );
489
490 for( unsigned ii = 0; ii < m_currPoints.size(); ++ii )
491 {
492 minsize = std::max( minsize, std::abs( m_currPoints[ii].x ) );
493 minsize = std::max( minsize, std::abs( m_currPoints[ii].y ) );
494 }
495
496 // The draw origin is the center of the window.
497 // Therefore the window size is twice the minsize just calculated
498 minsize *= 2;
499 minsize += m_thickness.GetIntValue();
500
501 // Give a margin
502 double scale = std::min( double( dc_size.x ) / minsize, double( dc_size.y ) / minsize ) * 0.9;
503
504 GRResetPenAndBrush( &dc );
505
506 // Draw X and Y axis. This is particularly useful to show the
507 // reference position of basic shape
508 // Axis are drawn before the polygon to avoid masking segments on axis
509 GRLine( &dc, -dc_size.x, 0, dc_size.x, 0, 0, LIGHTBLUE ); // X axis
510 GRLine( &dc, 0, -dc_size.y, 0, dc_size.y, 0, LIGHTBLUE ); // Y axis
511
512 // Draw polygon.
513 // The selected edge(s) are shown in selectcolor, the others in normalcolor.
514 EDA_COLOR_T normalcolor = WHITE;
515 EDA_COLOR_T selectcolor = RED;
516
517 for( unsigned ii = 0; ii < m_currPoints.size(); ++ii )
518 {
519 EDA_COLOR_T color = normalcolor;
520
521 if( m_gridCornersList->IsInSelection (ii, 0) ||
522 m_gridCornersList->IsInSelection (ii, 1) ||
523 m_gridCornersList->GetGridCursorRow() == (int)ii )
524 color = selectcolor;
525
526 unsigned jj = ii + 1;
527
528 if( jj >= m_currPoints.size() )
529 jj = 0;
530
531 GRLine( &dc, m_currPoints[ii].x * scale, m_currPoints[ii].y * scale,
532 m_currPoints[jj].x * scale, m_currPoints[jj].y * scale,
534 }
535
536 event.Skip();
537}
538
539
541{
542 m_panelPoly->Refresh();
543 event.Skip();
544}
545
546
547void DIALOG_PAD_PRIMITIVE_POLY_PROPS::onGridSelect( wxGridRangeSelectEvent& event )
548{
549 m_panelPoly->Refresh();
550}
551
552
554{
555 int row = event.GetRow();
556 int col = event.GetCol();
557
558 CallAfter(
559 [this, row, col]()
560 {
561 if( col == 0 ) // Set the X value
562 m_currPoints[row].x = m_gridCornersList->GetUnitValue( row, col );
563 else // Set the Y value
564 m_currPoints[row].y = m_gridCornersList->GetUnitValue( row, col );
565
566 Validate();
567
568 m_panelPoly->Refresh();
569 } );
570}
571
572
574 PCB_BASE_FRAME* aFrame,
575 std::vector<std::shared_ptr<PCB_SHAPE>>& aList,
576 bool aShowDuplicate ) :
578 m_list( aList ),
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 )
582{
583 m_rotation.SetUnits( EDA_UNITS::DEGREES );
584
585 if( !aShowDuplicate ) // means no duplicate transform
586 {
587 m_staticTextDupCnt->Show( false );
588 m_spinCtrlDuplicateCount->Show( false );
589 }
590
592
593 GetSizer()->SetSizeHints( this );
594}
595
596
597void DIALOG_PAD_PRIMITIVES_TRANSFORM::Transform( std::vector<std::shared_ptr<PCB_SHAPE>>* aList,
598 int aDuplicateCount )
599{
600 VECTOR2I move_vect( m_vectorX.GetValue(), m_vectorY.GetValue() );
603
604 // Avoid too small / too large scale, which could create issues:
605 if( scale < 0.01 )
606 scale = 0.01;
607
608 if( scale > 100.0 )
609 scale = 100.0;
610
611 // Transform shapes
612 // shapes are scaled, then moved then rotated.
613 // if aList != NULL, the initial shape will be duplicated, and transform
614 // applied to the duplicated shape
615
616 VECTOR2I currMoveVect = move_vect;
617 EDA_ANGLE curr_rotation = rotation;
618
619 do {
620 for( unsigned idx = 0; idx < m_list.size(); ++idx )
621 {
622 std::shared_ptr<PCB_SHAPE> shape;
623
624 if( aList == nullptr )
625 {
626 shape = m_list[idx];
627 }
628 else
629 {
630 aList->emplace_back( std::make_shared<PCB_SHAPE>( *m_list[idx] ) );
631 shape = aList->back();
632 }
633
634 // Transform parameters common to all shape types (some can be unused)
635 STROKE_PARAMS stroke = shape->GetStroke();
636 stroke.SetWidth( KiROUND( shape->GetWidth() * scale ) );
637 shape->SetStroke( stroke );
638
639 shape->Move( currMoveVect );
640 shape->Scale( scale );
641 shape->Rotate( VECTOR2I( 0, 0 ), curr_rotation );
642 }
643
644 // Prepare new transform on duplication:
645 // Each new item is rotated (or moved) by the transform from the last duplication
646 curr_rotation += rotation;
647 currMoveVect += move_vect;
648 } while( aList && --aDuplicateCount > 0 );
649}
650
int color
Definition: DXF_plotter.cpp:57
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:109
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:106
Class DIALOG_PAD_PRIMITIVES_PROPERTIES_BASE.
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_PRIMITIVES_TRANSFORM_BASE.
DIALOG_PAD_PRIMITIVES_TRANSFORM(wxWindow *aParent, PCB_BASE_FRAME *aFrame, std::vector< std::shared_ptr< PCB_SHAPE > > &aList, bool aShowDuplicate)
void Transform(std::vector< std::shared_ptr< PCB_SHAPE > > *aList=nullptr, int aDuplicateCount=0)
Apply geometric transform (rotation, move, scale) defined in dialog aDuplicate = 1 .
std::vector< std::shared_ptr< PCB_SHAPE > > & m_list
Class DIALOG_PAD_PRIMITIVE_POLY_PROPS_BASE.
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).
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)
bool doValidate(bool aRemoveRedundantCorners)
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:97
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
Definition: eda_shape.cpp:585
const VECTOR2I & GetBezierC2() const
Definition: eda_shape.h:179
void SetBezierC2(const VECTOR2I &aPt)
Definition: eda_shape.h:178
void SetCenter(const VECTOR2I &aCenter)
Definition: eda_shape.cpp:470
SHAPE_POLY_SET & GetPolyShape()
Definition: eda_shape.h:247
bool IsFilled() const
Definition: eda_shape.h:90
void SetFilled(bool aFlag)
Definition: eda_shape.h:95
int GetRadius() const
Definition: eda_shape.cpp:523
SHAPE_T GetShape() const
Definition: eda_shape.h:113
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition: eda_shape.h:145
void SetStart(const VECTOR2I &aStart)
Definition: eda_shape.h:124
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
Definition: eda_shape.h:120
int GetWidth() const
Definition: eda_shape.h:109
void SetEnd(const VECTOR2I &aEnd)
Definition: eda_shape.h:149
void SetBezierC1(const VECTOR2I &aPt)
Definition: eda_shape.h:175
const VECTOR2I & GetBezierC1() const
Definition: eda_shape.h:176
void SetArcAngleAndEnd(const EDA_ANGLE &aAngle, bool aCheckNegativeAngle=false)
Set the end point from the angle center and start.
Definition: eda_shape.cpp:596
bool IsAnnotationProxy() const
Definition: eda_shape.h:87
void SetPolyPoints(const std::vector< VECTOR2I > &aPoints)
Definition: eda_shape.cpp:1085
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.
Definition: pcb_shape.h:67
STROKE_PARAMS GetStroke() const override
Definition: pcb_shape.h:71
void SetStroke(const STROKE_PARAMS &aStroke) override
Definition: pcb_shape.h:72
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.
void SetBitmap(const wxBitmapBundle &aBmp)
Simple container to manage line stroke parameters.
Definition: stroke_params.h:88
void SetWidth(int aWidth)
Definition: stroke_params.h:99
int GetIntValue()
Definition: unit_binder.h:127
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.
Definition: wx_grid.cpp:553
int GetUnitValue(int aRow, int aCol)
Apply standard KiCad unit and eval services to a numeric cell.
Definition: wx_grid.cpp:532
void SetAutoEvalCols(const std::vector< int > &aCols)
Definition: wx_grid.h:104
void SetUnitsProvider(UNITS_PROVIDER *aProvider, int aCol=0)
Set a UNITS_PROVIDER to enable use of unit- and eval-based Getters.
Definition: wx_grid.cpp:523
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:474
EDA_COLOR_T
Legacy color enumeration.
Definition: color4d.h:41
@ LIGHTBLUE
Definition: color4d.h:61
@ WHITE
Definition: color4d.h:47
@ RED
Definition: color4d.h:58
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:283
This file is part of the common library.
#define _(s)
void GRResetPenAndBrush(wxDC *DC)
Definition: gr_basic.cpp:73
void GRLine(wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:171
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.
Definition: eda_units.cpp:445
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:418
const int scale
constexpr int mmToIU(double mm) const
Definition: base_units.h:89
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:85
VECTOR2< int > VECTOR2I
Definition: vector2d.h:588