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-2022 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 <confirm.h>
33#include <trigo.h>
34#include <pcb_base_frame.h>
35#include <base_units.h>
36#include <widgets/wx_grid.h>
37#include <footprint.h>
38#include <math/util.h> // for KiROUND
39
41#include <bitmaps.h>
42#include <wx/dcclient.h>
43
44
46 PCB_BASE_FRAME* aFrame,
47 PCB_SHAPE* aShape ) :
49 m_shape( aShape ),
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 )
60{
62
64
66
68}
69
70
72{
73 if( m_shape == nullptr )
74 return false;
75
77 m_filledCtrl->SetValue( m_shape->IsFilled() );
78
79 switch( m_shape->GetShape() )
80 {
82 SetTitle( _( "Segment" ) );
87 m_ctrl1X.Show( false, true );
88 m_ctrl1Y.Show( false, true );
89 m_ctrl2X.Show( false, true );
90 m_ctrl2Y.Show( false, true );
91 m_staticTextPosCtrl1->Show( false );
92 m_staticTextPosCtrl1->SetSize( 0, 0 );
93 m_staticTextPosCtrl2->Show( false );
94 m_staticTextPosCtrl2->SetSize( 0, 0 );
95 m_radius.Show( false );
96 m_filledCtrl->Show( false );
97 break;
98
99 case SHAPE_T::BEZIER:
100 SetTitle( _( "Bezier" ) );
109 m_radius.Show( false );
110 m_filledCtrl->Show( false );
111 break;
112
113 case SHAPE_T::ARC:
114 SetTitle( _( "Arc" ) );
117 m_staticTextPosEnd->SetLabel( _( "Center" ) );
120 m_radiusLabel->SetLabel( _( "Angle:" ) );
123 m_ctrl1X.Show( false, true );
124 m_ctrl1Y.Show( false, true );
125 m_ctrl2X.Show( false, true );
126 m_ctrl2Y.Show( false, true );
127 m_staticTextPosCtrl1->Show( false );
128 m_staticTextPosCtrl1->SetSize( 0, 0 );
129 m_staticTextPosCtrl2->Show( false );
130 m_staticTextPosCtrl2->SetSize( 0, 0 );
131 m_filledCtrl->Show( false );
132 break;
133
134 case SHAPE_T::CIRCLE:
135 if( m_shape->GetWidth() )
136 SetTitle( _( "Ring" ) );
137 else
138 SetTitle( _( "Circle" ) );
139
140 // End point does not exist for a circle or ring:
141 m_staticTextPosEnd->Show( false );
142 m_endX.Show( false );
143 m_endY.Show( false );
144
145 // Circle center uses position controls:
146 m_staticTextPosStart->SetLabel( _( "Center:" ) );
150 m_ctrl1X.Show( false, true );
151 m_ctrl1Y.Show( false, true );
152 m_ctrl2X.Show( false, true );
153 m_ctrl2Y.Show( false, true );
154 m_staticTextPosCtrl1->Show( false );
155 m_staticTextPosCtrl1->SetSize( 0, 0 );
156 m_staticTextPosCtrl2->Show( false );
157 m_staticTextPosCtrl2->SetSize( 0, 0 );
158 m_filledCtrl->Show( true );
159 break;
160
161 case SHAPE_T::RECT:
163 SetTitle( _( "Number Box" ) );
164 else
165 SetTitle( _( "Rectangle" ) );
166
171 m_ctrl1X.Show( false, true );
172 m_ctrl1Y.Show( false, true );
173 m_ctrl2X.Show( false, true );
174 m_ctrl2Y.Show( false, true );
175 m_staticTextPosCtrl1->Show( false );
176 m_staticTextPosCtrl1->SetSize( 0, 0 );
177 m_staticTextPosCtrl2->Show( false );
178 m_staticTextPosCtrl2->SetSize( 0, 0 );
179 m_radius.Show( false );
180 m_filledCtrl->Show( false );
181 break;
182
183 case SHAPE_T::POLY:
184 // polygon has a specific dialog editor. So nothing here
185 break;
186
187 default:
188 SetTitle( "Unknown Basic Shape" );
189 break;
190 }
191
192 return true;
193}
194
195
197{
198 if( m_thickness.GetValue() == 0 && !m_filledCtrl->GetValue() )
199 {
200 DisplayError( this, _( "Line width may not be 0 for unfilled shapes." ) );
201 m_thicknessCtrl->SetFocus();
202 return false;
203 }
204
205 // Transfer data out of the GUI.
206 STROKE_PARAMS stroke = m_shape->GetStroke();
207 stroke.SetWidth( m_thickness.GetValue() );
208 m_shape->SetStroke( stroke );
209
210 m_shape->SetFilled( m_filledCtrl->GetValue() );
211
212 switch( m_shape->GetShape() )
213 {
214 case SHAPE_T::SEGMENT:
215 case SHAPE_T::RECT:
218 break;
219
220 case SHAPE_T::BEZIER:
225 break;
226
227 case SHAPE_T::ARC:
231 break;
232
233 case SHAPE_T::CIRCLE:
236 break;
237
238 case SHAPE_T::POLY:
239 // polygon has a specific dialog editor. So nothing here
240 break;
241
242 default:
243 break;
244 }
245
246 return true;
247}
248
249
251 PCB_BASE_FRAME* aFrame,
252 PCB_SHAPE* aShape ) :
254 m_frame( aFrame ),
255 m_shape( aShape ),
256 m_thickness( aFrame, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits )
257{
258 if( !m_shape->GetPolyShape().IsEmpty() )
259 {
260 for( const VECTOR2I& pt : m_shape->GetPolyShape().Outline( 0 ).CPoints() )
261 m_currPoints.emplace_back( pt );
262 }
263
267
268 // Test for acceptable polygon (more than 2 corners, and not self-intersecting) and
269 // remove any redundant corners. A warning message is displayed if not OK.
270 doValidate( true );
271
273
275
276 m_gridCornersList->Connect( wxEVT_GRID_CELL_CHANGING,
278 nullptr, this );
279
280 // Now all widgets have the size fixed, call FinishDialogSettings
282}
283
284
286{
287 m_gridCornersList->Disconnect( wxEVT_GRID_CELL_CHANGING,
289 nullptr, this );
290}
291
292
294{
295 if( m_shape == nullptr )
296 return false;
297
299 m_filledCtrl->SetValue( m_shape->IsFilled() );
300
301 // Populates the list of corners
302 int extra_rows = m_currPoints.size() - m_gridCornersList->GetNumberRows();
303
304 if( extra_rows > 0 )
305 {
306 m_gridCornersList->AppendRows( extra_rows );
307 }
308 else if( extra_rows < 0 )
309 {
310 extra_rows = -extra_rows;
311 m_gridCornersList->DeleteRows( 0, extra_rows );
312 }
313
314 // enter others corner coordinates
315 wxString msg;
316
317 for( unsigned row = 0; row < m_currPoints.size(); ++row )
318 {
319 // Row label is "Corner x"
320 msg.Printf( _( "Corner %d" ), row+1 );
321 m_gridCornersList->SetRowLabelValue( row, msg );
322
323 msg = m_frame->StringFromValue( m_currPoints[row].x, true );
324 m_gridCornersList->SetCellValue( row, 0, msg );
325
326 msg = m_frame->StringFromValue( m_currPoints[row].y, true );
327 m_gridCornersList->SetCellValue( row, 1, msg );
328 }
329
330 return true;
331}
332
334{
335 if( !Validate() )
336 return false;
337
339
340 STROKE_PARAMS stroke = m_shape->GetStroke();
341 stroke.SetWidth( m_thickness.GetValue() );
342 m_shape->SetStroke( stroke );
343
344 m_shape->SetFilled( m_filledCtrl->GetValue() );
345
346 return true;
347}
348
349
351{
352 // Don't remove redundant corners while user is editing corner list
353 return doValidate( false );
354}
355
356
357bool DIALOG_PAD_PRIMITIVE_POLY_PROPS::doValidate( bool aRemoveRedundantCorners )
358{
360 return false;
361
362 if( m_currPoints.size() < 3 )
363 {
364 m_warningText->SetLabel( _("Polygon must have at least 3 corners" ) );
365 m_warningText->Show( true );
366 m_warningIcon->Show( true );
367 return false;
368 }
369
370 bool valid = true;
371
372 SHAPE_LINE_CHAIN polyline( m_currPoints, true );
373
374 // Remove redundant corners:
375 polyline.Simplify();
376
377 if( polyline.PointCount() < 3 )
378 {
379 m_warningText->SetLabel( _( "Polygon must have at least 3 corners after simplification" ) );
380 valid = false;
381 }
382
383 if( valid && polyline.SelfIntersecting() )
384 {
385 m_warningText->SetLabel( _( "Polygon can not be self-intersecting" ) );
386 valid = false;
387 }
388
389 m_warningIcon->Show( !valid );
390 m_warningText->Show( !valid );
391
392 if( aRemoveRedundantCorners )
393 {
394 if( polyline.PointCount() != (int) m_currPoints.size() )
395 { // Happens after simplification
396 m_currPoints.clear();
397
398 for( const VECTOR2I& pt : polyline.CPoints() )
399 m_currPoints.emplace_back( pt );
400
401 m_warningIcon->Show( true );
402 m_warningText->Show( true );
403 m_warningText->SetLabel( _( "Note: redundant corners removed" ) );
404 }
405 }
406
407 return valid;
408}
409
410
412{
414 return;
415
416 // Insert a new corner after the currently selected:
417 wxArrayInt selections = m_gridCornersList->GetSelectedRows();
418 int row = -1;
419
420 if( m_gridCornersList->GetNumberRows() == 0 )
421 row = 0;
422 else if( selections.size() > 0 )
423 row = selections[ selections.size() - 1 ] + 1;
424 else
425 row = m_gridCornersList->GetGridCursorRow() + 1;
426
427 if( row < 0 )
428 {
429 wxMessageBox( _( "Select a corner to add the new corner after." ) );
430 return;
431 }
432
433 if( m_currPoints.size() == 0 || row >= (int) m_currPoints.size() )
434 m_currPoints.emplace_back( 0, 0 );
435 else
436 m_currPoints.insert( m_currPoints.begin() + row, wxPoint( 0, 0 ) );
437
438 Validate();
440
441 m_gridCornersList->ForceRefresh();
442 // Select the new row
443 m_gridCornersList->SelectRow( row, false );
444
445 m_panelPoly->Refresh();
446}
447
448
450{
452 return;
453
454 wxArrayInt selections = m_gridCornersList->GetSelectedRows();
455
456 if( m_gridCornersList->GetNumberRows() == 0 )
457 return;
458
459 if( selections.size() == 0 && m_gridCornersList->GetGridCursorRow() >= 0 )
460 selections.push_back( m_gridCornersList->GetGridCursorRow() );
461
462 if( selections.size() == 0 )
463 {
464 wxMessageBox( _( "Select a corner to delete." ) );
465 return;
466 }
467
468 // remove corners:
469 std::sort( selections.begin(), selections.end() );
470
471 for( int ii = selections.size()-1; ii >= 0 ; --ii )
472 m_currPoints.erase( m_currPoints.begin() + selections[ii] );
473
474 Validate();
476
477 m_gridCornersList->ForceRefresh();
478
479 // select the row previous to the last deleted row
480 m_gridCornersList->SelectRow( std::max( 0, selections[ 0 ] - 1 ) );
481
482 m_panelPoly->Refresh();
483}
484
485
487{
488 wxPaintDC dc( m_panelPoly );
489 wxSize dc_size = dc.GetSize();
490 dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
491
492 // Calculate a suitable scale to fit the available draw area
493 int minsize( pcbIUScale.mmToIU( 0.5 ) );
494
495 for( unsigned ii = 0; ii < m_currPoints.size(); ++ii )
496 {
497 minsize = std::max( minsize, std::abs( m_currPoints[ii].x ) );
498 minsize = std::max( minsize, std::abs( m_currPoints[ii].y ) );
499 }
500
501 // The draw origin is the center of the window.
502 // Therefore the window size is twice the minsize just calculated
503 minsize *= 2;
504 minsize += m_thickness.GetValue();
505
506 // Give a margin
507 double scale = std::min( double( dc_size.x ) / minsize, double( dc_size.y ) / minsize ) * 0.9;
508
509 GRResetPenAndBrush( &dc );
510
511 // Draw X and Y axis. This is particularly useful to show the
512 // reference position of basic shape
513 // Axis are drawn before the polygon to avoid masking segments on axis
514 GRLine( &dc, -dc_size.x, 0, dc_size.x, 0, 0, LIGHTBLUE ); // X axis
515 GRLine( &dc, 0, -dc_size.y, 0, dc_size.y, 0, LIGHTBLUE ); // Y axis
516
517 // Draw polygon.
518 // The selected edge(s) are shown in selectcolor, the others in normalcolor.
519 EDA_COLOR_T normalcolor = WHITE;
520 EDA_COLOR_T selectcolor = RED;
521
522 for( unsigned ii = 0; ii < m_currPoints.size(); ++ii )
523 {
524 EDA_COLOR_T color = normalcolor;
525
526 if( m_gridCornersList->IsInSelection (ii, 0) ||
527 m_gridCornersList->IsInSelection (ii, 1) ||
528 m_gridCornersList->GetGridCursorRow() == (int)ii )
529 color = selectcolor;
530
531 unsigned jj = ii + 1;
532
533 if( jj >= m_currPoints.size() )
534 jj = 0;
535
536 GRLine( &dc, m_currPoints[ii] * scale, m_currPoints[jj] * scale,
538 }
539
540 event.Skip();
541}
542
543
545{
546 m_panelPoly->Refresh();
547 event.Skip();
548}
549
550
551void DIALOG_PAD_PRIMITIVE_POLY_PROPS::onGridSelect( wxGridRangeSelectEvent& event )
552{
553 m_panelPoly->Refresh();
554}
555
556
558{
559 int row = event.GetRow();
560 int col = event.GetCol();
561 wxString msg = event.GetString();
562
563 if( msg.IsEmpty() )
564 return;
565
566 if( col == 0 ) // Set the X value
568 else // Set the Y value
570
571 Validate();
572
573 m_panelPoly->Refresh();
574}
575
576
578 PCB_BASE_FRAME* aFrame,
579 std::vector<std::shared_ptr<PCB_SHAPE>>& aList,
580 bool aShowDuplicate ) :
582 m_list( aList ),
583 m_vectorX( aFrame, m_xLabel, m_xCtrl, m_xUnits ),
584 m_vectorY( aFrame, m_yLabel, m_yCtrl, m_yUnits ),
585 m_rotation( aFrame, m_rotationLabel, m_rotationCtrl, m_rotationUnits )
586{
588
589 if( !aShowDuplicate ) // means no duplicate transform
590 {
591 m_staticTextDupCnt->Show( false );
592 m_spinCtrlDuplicateCount->Show( false );
593 }
594
596
597 GetSizer()->SetSizeHints( this );
598}
599
600
601void DIALOG_PAD_PRIMITIVES_TRANSFORM::Transform( std::vector<std::shared_ptr<PCB_SHAPE>>* aList,
602 int aDuplicateCount )
603{
604 VECTOR2I move_vect( m_vectorX.GetValue(), m_vectorY.GetValue() );
607
608 // Avoid too small / too large scale, which could create issues:
609 if( scale < 0.01 )
610 scale = 0.01;
611
612 if( scale > 100.0 )
613 scale = 100.0;
614
615 // Transform shapes
616 // shapes are scaled, then moved then rotated.
617 // if aList != NULL, the initial shape will be duplicated, and transform
618 // applied to the duplicated shape
619
620 VECTOR2I currMoveVect = move_vect;
621 EDA_ANGLE curr_rotation = rotation;
622
623 do {
624 for( unsigned idx = 0; idx < m_list.size(); ++idx )
625 {
626 std::shared_ptr<PCB_SHAPE> shape;
627
628 if( aList == nullptr )
629 {
630 shape = m_list[idx];
631 }
632 else
633 {
634 aList->emplace_back( std::make_shared<PCB_SHAPE>( *m_list[idx] ) );
635 shape = aList->back();
636 }
637
638 // Transform parameters common to all shape types (some can be unused)
639 STROKE_PARAMS stroke = shape->GetStroke();
640 stroke.SetWidth( KiROUND( shape->GetWidth() * scale ) );
641 shape->SetStroke( stroke );
642
643 shape->Move( currMoveVect );
644 shape->Scale( scale );
645 shape->Rotate( VECTOR2I( 0, 0 ), curr_rotation );
646 }
647
648 // Prepare new transform on duplication:
649 // Each new item is rotated (or moved) by the transform from the last duplication
650 curr_rotation += rotation;
651 currMoveVect += move_vect;
652 } while( aList && --aDuplicateCount > 0 );
653}
654
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:105
@ dialog_warning
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).
std::vector< VECTOR2I > m_currPoints
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_UNITS GetUserUnits() const
Definition: dialog_shim.h:121
EDA_ANGLE GetArcAngle() const
Definition: eda_shape.cpp:538
const VECTOR2I & GetBezierC2() const
Definition: eda_shape.h:175
void SetBezierC2(const VECTOR2I &aPt)
Definition: eda_shape.h:174
void SetCenter(const VECTOR2I &aCenter)
Definition: eda_shape.cpp:423
SHAPE_POLY_SET & GetPolyShape()
Definition: eda_shape.h:243
bool IsFilled() const
Definition: eda_shape.h:90
void SetFilled(bool aFlag)
Definition: eda_shape.h:95
int GetRadius() const
Definition: eda_shape.cpp:476
SHAPE_T GetShape() const
Definition: eda_shape.h:111
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition: eda_shape.h:141
void SetStart(const VECTOR2I &aStart)
Definition: eda_shape.h:120
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
Definition: eda_shape.h:116
int GetWidth() const
Definition: eda_shape.h:107
void SetEnd(const VECTOR2I &aEnd)
Definition: eda_shape.h:145
void SetBezierC1(const VECTOR2I &aPt)
Definition: eda_shape.h:171
const VECTOR2I & GetBezierC1() const
Definition: eda_shape.h:172
void SetArcAngleAndEnd(const EDA_ANGLE &aAngle, bool aCheckNegativeAngle=false)
Set the end point from the angle center and start.
Definition: eda_shape.cpp:549
bool IsAnnotationProxy() const
Definition: eda_shape.h:87
void SetPolyPoints(const std::vector< VECTOR2I > &aPoints)
Definition: eda_shape.cpp:1069
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:65
STROKE_PARAMS GetStroke() const override
Definition: pcb_shape.h:69
void SetStroke(const STROKE_PARAMS &aStroke) override
Definition: pcb_shape.h:70
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
SHAPE_LINE_CHAIN & Outline(int aIndex)
Simple container to manage line stroke parameters.
Definition: stroke_params.h:88
void SetWidth(int aWidth)
Definition: stroke_params.h:99
wxString StringFromValue(double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Converts aValue in internal units into a united string.
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.
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:226
EDA_COLOR_T
Legacy color enumeration.
Definition: color4d.h:42
@ LIGHTBLUE
Definition: color4d.h:62
@ WHITE
Definition: color4d.h:48
@ RED
Definition: color4d.h:59
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:280
This file is part of the common library.
#define _(s)
void GRResetPenAndBrush(wxDC *DC)
Definition: gr_basic.cpp:72
void GRLine(wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:162
long long int ValueFromString(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application.
Definition: eda_units.cpp:530
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:451
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:401
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:80
VECTOR2< int > VECTOR2I
Definition: vector2d.h:618