KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcbnew/dialogs/dialog_shape_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) 2019 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 modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * 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/*
26 * Edit properties of Lines, Circles, Arcs and Polygons for PCBNew and Footprint Editor
27 */
28
29#include <pcb_base_edit_frame.h>
30#include <pcb_edit_frame.h>
31#include <wx/valnum.h>
32#include <board_commit.h>
35#include <tool/tool_manager.h>
36#include <tool/actions.h>
37#include <pcb_shape.h>
38#include <macros.h>
39#include <widgets/unit_binder.h>
40
42#include <tools/drawing_tool.h>
43
44
46{
47public:
50
51private:
52 bool TransferDataToWindow() override;
53 bool TransferDataFromWindow() override;
54
55 void onFilledCheckbox( wxCommandEvent& event ) override;
56
57 void onLayerSelection( wxCommandEvent& event ) override;
58
59 bool Validate() override;
60
61 // Show/hide the widgets used in net selection (shown only for copper layers)
63 {
65
66 m_netSelector->Show( isCopper );
67 m_netLabel->Show( isCopper );
68 }
69
70
71private:
74
85
87};
88
91 m_parent( aParent ),
92 m_item( aShape ),
93 m_startX( aParent, m_startXLabel, m_startXCtrl, m_startXUnits ),
94 m_startY( aParent, m_startYLabel, m_startYCtrl, m_startYUnits ),
95 m_endX( aParent, m_endXLabel, m_endXCtrl, m_endXUnits ),
96 m_endY( aParent, m_endYLabel, m_endYCtrl, m_endYUnits ),
97 m_thickness( aParent, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits ),
98 m_segmentLength( aParent, m_segmentLengthLabel, m_segmentLengthCtrl, m_segmentLengthUnits ),
99 m_segmentAngle( aParent, m_segmentAngleLabel, m_segmentAngleCtrl, m_segmentAngleUnits ),
100 m_angle( aParent, m_angleLabel, m_angleCtrl, m_angleUnits ),
101 m_rectangleHeight( aParent, m_rectangleHeightLabel, m_rectangleHeightCtrl, m_rectangleHeightUnits ),
102 m_rectangleWidth( aParent, m_rectangleWidthLabel, m_rectangleWidthCtrl, m_rectangleWidthUnits ),
103 m_bezierCtrl1X( aParent, m_BezierPointC1XLabel, m_BezierC1X_Ctrl, m_BezierPointC1XUnit ),
104 m_bezierCtrl1Y( aParent, m_BezierPointC1YLabel, m_BezierC1Y_Ctrl, m_BezierPointC1YUnit ),
105 m_bezierCtrl2X( aParent, m_BezierPointC2XLabel, m_BezierC2X_Ctrl, m_BezierPointC2XUnit ),
106 m_bezierCtrl2Y( aParent, m_BezierPointC2YLabel, m_BezierC2Y_Ctrl, m_BezierPointC2YUnit ),
107 m_flipStartEnd( false )
108{
109 SetTitle( wxString::Format( GetTitle(), m_item->GetFriendlyName() ) );
110 m_hash_key = TO_UTF8( GetTitle() );
111
112 // Configure display origin transforms
121
122 m_segmentAngle.SetUnits( EDA_UNITS::DEGREES );
124
125 m_angle.SetUnits( EDA_UNITS::DEGREES );
126
127 // Do not allow locking items in the footprint editor
128 m_locked->Show( dynamic_cast<PCB_EDIT_FRAME*>( aParent ) != nullptr );
129
130 // Configure the layers list selector
132 {
133 LSET forbiddenLayers = LSET::ForbiddenFootprintLayers();
134
135 // If someone went to the trouble of setting the layer in a text editor, then there's
136 // very little sense in nagging them about it.
137 forbiddenLayers.set( m_item->GetLayer(), false );
138
140 }
141
142 for( const auto& [ lineStyle, lineStyleDesc ] : lineTypeNames )
143 m_lineStyleCombo->Append( lineStyleDesc.name, KiBitmapBundle( lineStyleDesc.bitmap ) );
144
146
150
151 m_netSelector->SetBoard( aParent->GetBoard() );
152 m_netSelector->SetNetInfo( &aParent->GetBoard()->GetNetInfo() );
153
155 {
156 m_netLabel->Hide();
157 m_netSelector->Hide();
158 }
159 else
160 {
161 int net = aShape->GetNetCode();
162
163 if( net >= 0 )
164 {
166 }
167 else
168 {
171 }
172 }
173
174 if( m_item->GetShape() == SHAPE_T::POLY )
175 m_sizerStartEnd->Show( false );
176
177 // Only a Bezeier curve has control points. So do not show these parameters for other shapes
178 if( m_item->GetShape() != SHAPE_T::BEZIER )
179 m_sizerBezier->Show( false );
180
181 // Only a segment has this format
182 if( m_item->GetShape() != SHAPE_T::SEGMENT )
183 {
184 m_segmentLength.Show( false );
185 m_segmentAngle.Show( false );
186 }
187
188 if( m_item->GetShape() != SHAPE_T::RECTANGLE )
189 {
190 m_rectangleHeight.Show( false );
191 m_rectangleWidth.Show( false );
192 }
193
194 // Only an arc has a angle parameter. So do not show this parameter for other shapes
195 if( m_item->GetShape() != SHAPE_T::ARC )
196 m_angle.Show( false );
197
198 if( m_item->GetShape() == SHAPE_T::ARC || m_item->GetShape() == SHAPE_T::SEGMENT )
199 m_filledCtrl->Show( false );
200
201 // Change texts for circles:
202 if( m_item->GetShape() == SHAPE_T::CIRCLE )
203 {
204 m_startPointLabel->SetLabel( _( "Center Point" ) );
205 m_endPointLabel->SetLabel( _( "Radius" ) );
206
207 m_endXLabel->Show( false );
209 m_endY.Show( false );
210 }
211
214
215 // Now all widgets have the size fixed, call FinishDialogSettings
217}
218
219
221{
222 wxCHECK_RET( aShape, wxT( "ShowGraphicItemPropertiesDialog() error: NULL item" ) );
223
224 DIALOG_SHAPE_PROPERTIES dlg( this, aShape );
225
226 if( dlg.ShowQuasiModal() == wxID_OK )
227 {
228 if( aShape->IsOnLayer( GetActiveLayer() ) )
229 {
231 drawingTool->SetStroke( aShape->GetStroke(), GetActiveLayer() );
232 }
233 }
234}
235
236
237void DIALOG_SHAPE_PROPERTIES::onLayerSelection( wxCommandEvent& event )
238{
240 {
242 }
243}
244
245
246void DIALOG_SHAPE_PROPERTIES::onFilledCheckbox( wxCommandEvent& event )
247{
248 if( m_filledCtrl->GetValue() )
249 {
250 m_lineStyleCombo->SetSelection( 0 );
251 m_lineStyleLabel->Enable( false );
252 m_lineStyleCombo->Enable( false );
253 }
254 else
255 {
257
258 if( style == LINE_STYLE::DEFAULT )
259 style = LINE_STYLE::SOLID;
260
261 if( (int) style < (int) lineTypeNames.size() )
262 m_lineStyleCombo->SetSelection( (int) style );
263
264 m_lineStyleLabel->Enable( true );
265 m_lineStyleCombo->Enable( true );
266 }
267}
268
270{
271 if( !m_item )
272 return false;
273
274 if( m_item->GetShape() == SHAPE_T::ARC )
276
277 if( m_item->GetShape() == SHAPE_T::RECTANGLE )
278 {
281 }
282
283 if( m_item->GetShape() == SHAPE_T::SEGMENT )
284 {
285 if( m_item->GetStart().x == m_item->GetEnd().x )
287 else
289
292 }
293
294 if( m_flipStartEnd && m_item->GetShape() != SHAPE_T::ARC )
295 {
298 }
299 else
300 {
303 }
304
305 if( m_item->GetShape() == SHAPE_T::CIRCLE )
306 {
308 }
309 else if( m_flipStartEnd && m_item->GetShape() != SHAPE_T::ARC )
310 {
313 }
314 else
315 {
318 }
319
320 if( m_item->GetShape() == SHAPE_T::BEZIER )
321 {
326 }
327
328 m_filledCtrl->SetValue( m_item->IsFilled() );
329 m_locked->SetValue( m_item->IsLocked() );
330
332
333 int style = static_cast<int>( m_item->GetStroke().GetLineStyle() );
334
335 if( style == -1 )
336 m_lineStyleCombo->SetStringSelection( DEFAULT_STYLE );
337 else if( style < (int) lineTypeNames.size() )
338 m_lineStyleCombo->SetSelection( style );
339 else
340 wxFAIL_MSG( "Line type not found in the type lookup map" );
341
344
345 return DIALOG_SHAPE_PROPERTIES_BASE::TransferDataToWindow();
346}
347
348
350{
351 if( !DIALOG_SHAPE_PROPERTIES_BASE::TransferDataFromWindow() )
352 return false;
353
354 if( !m_item )
355 return true;
356
358 VECTOR2I begin_point = m_item->GetStart();
359 VECTOR2I end_point = m_item->GetEnd();
360 int segment_length = 0;
361 EDA_ANGLE segment_angle = EDA_ANGLE( 0, RADIANS_T );
362 int rectangle_height = 0;
363 int rectangle_width = 0;
364
365 BOARD_COMMIT commit( m_parent );
366
367 commit.Modify( m_item );
368
369 if( m_item->GetShape() == SHAPE_T::SEGMENT )
370 {
371 segment_length = KiROUND( m_item->GetLength() );
372 segment_angle = m_item->GetSegmentAngle().Round( 3 );
373 }
374
375 if( m_item->GetShape() == SHAPE_T::RECTANGLE )
376 {
377 rectangle_height = m_item->GetRectangleHeight();
378 rectangle_width = m_item->GetRectangleWidth();
379 }
380
381 if( m_flipStartEnd && m_item->GetShape() != SHAPE_T::ARC )
382 {
385 }
386 else
387 {
390 }
391
392 if( m_item->GetShape() == SHAPE_T::CIRCLE )
393 {
395 }
396 else if( m_flipStartEnd && m_item->GetShape() != SHAPE_T::ARC )
397 {
400 }
401 else
402 {
405 }
406
407 if( m_item->GetShape() == SHAPE_T::SEGMENT )
408 {
409 bool change_begin = ( begin_point != m_item->GetStart() );
410 bool change_end = ( end_point != m_item->GetEnd() );
411 bool change_length = ( segment_length != m_segmentLength.GetValue() );
412 EDA_ANGLE difference = std::abs( segment_angle - m_segmentAngle.GetAngleValue() );
413 bool change_angle = ( difference >= EDA_ANGLE( 0.00049, DEGREES_T ) );
414
415 if( !( change_begin && change_end ) )
416 {
417 segment_length = m_segmentLength.GetIntValue();
418 segment_angle = m_segmentAngle.GetAngleValue().Round( 3 );
419
420 if( change_length || change_angle )
421 {
422 if( change_end )
423 {
425 - KiROUND( segment_length * segment_angle.Cos() ) );
427 + KiROUND( segment_length * segment_angle.Sin() ) );
428 }
429 else
430 {
432 + KiROUND( segment_length * segment_angle.Cos() ) );
434 - KiROUND( segment_length * segment_angle.Sin() ) );
435 }
436 }
437 }
438
439 if( change_length )
441 else
443
444 if( change_angle )
446 else
448 }
449
450 if( m_item->GetShape() == SHAPE_T::RECTANGLE )
451 {
452 bool change_begin = ( begin_point != m_item->GetStart() );
453 bool change_end = ( end_point != m_item->GetEnd() );
454 bool change_height = ( rectangle_height != m_rectangleHeight.GetValue() );
455 bool change_width = ( rectangle_width != m_rectangleWidth.GetValue() );
456
457 if( !( change_begin && change_end ) )
458 {
459 rectangle_height = m_rectangleHeight.GetIntValue();
460 rectangle_width = m_rectangleWidth.GetIntValue();
461
462 if( change_height || change_width )
463 {
464 if( change_end )
465 {
466 m_item->SetStartX( m_item->GetEndX() - rectangle_width );
467 m_item->SetStartY( m_item->GetEndY() - rectangle_height );
468 }
469 else
470 {
471 m_item->SetEndX( m_item->GetStartX() + rectangle_width );
472 m_item->SetEndY( m_item->GetStartY() + rectangle_height );
473 }
474 }
475 }
476
478 }
479
480
481 // For Bezier curve: Set the two control points
482 if( m_item->GetShape() == SHAPE_T::BEZIER )
483 {
486 }
487
488 if( m_item->GetShape() == SHAPE_T::ARC )
489 {
491
492 m_item->SetCenter( c );
493 }
494
495 bool wasLocked = m_item->IsLocked();
496
497 m_item->SetFilled( m_filledCtrl->GetValue() );
498 m_item->SetLocked( m_locked->GetValue() );
499
500 STROKE_PARAMS stroke = m_item->GetStroke();
501
502 stroke.SetWidth( m_thickness.GetIntValue() );
503
504 auto it = lineTypeNames.begin();
505 std::advance( it, m_lineStyleCombo->GetSelection() );
506
507 if( it == lineTypeNames.end() )
508 stroke.SetLineStyle( LINE_STYLE::DEFAULT );
509 else
510 stroke.SetLineStyle( it->first );
511
512 m_item->SetStroke( stroke );
513
514 m_item->SetLayer( ToLAYER_ID( layer ) );
515
517
518 if( m_item->IsOnCopperLayer() )
520 else
521 m_item->SetNetCode( -1 );
522
523 commit.Push( _( "Edit Shape Properties" ) );
524
525 // Notify clients which treat locked and unlocked items differently (ie: POINT_EDITOR)
526 if( wasLocked != m_item->IsLocked() )
528
529 return true;
530}
531
532
534{
535 wxArrayString errors;
536
537 if( !DIALOG_SHAPE_PROPERTIES_BASE::Validate() )
538 return false;
539
540 // Type specific checks.
541 switch( m_item->GetShape() )
542 {
543 case SHAPE_T::ARC:
544 // Check angle of arc.
545 if( m_angle.GetAngleValue() == ANGLE_0 )
546 errors.Add( _( "Arc angle cannot be zero." ) );
547
549 {
550 errors.Add( wxString::Format( _( "Invalid Arc with radius %f and angle %f." ),
551 0.0, m_angle.GetDoubleValue() ) );
552 }
553 else
554 {
557 VECTOR2D center = CalcArcCenter( start, end, m_angle.GetAngleValue() );
558
559 double radius = ( center - start ).EuclideanNorm();
560 double max_offset = std::max( std::abs( center.x ) + radius,
561 std::abs( center.y ) + radius );
562
563 if( max_offset >= ( std::numeric_limits<VECTOR2I::coord_type>::max() / 2.0 )
564 || center == start || center == end )
565 {
566 errors.Add( wxString::Format( _( "Invalid Arc with radius %f and angle %f." ),
567 radius, m_angle.GetDoubleValue() ) );
568 }
569 }
570
571 if( m_thickness.GetValue() <= 0 )
572 errors.Add( _( "Line width must be greater than zero." ) );
573
574 break;
575
576 case SHAPE_T::CIRCLE:
577 // Check radius.
578 if( m_endX.GetValue() <= 0 )
579 errors.Add( _( "Radius must be greater than zero." ) );
580
581 if( !m_filledCtrl->GetValue() && m_thickness.GetValue() <= 0 )
582 errors.Add( _( "Line width must be greater than zero for an unfilled circle." ) );
583
584 break;
585
586 case SHAPE_T::RECTANGLE:
587 // Check for null rect.
589 errors.Add( _( "Rectangle cannot be empty." ) );
590
591 if( !m_filledCtrl->GetValue() && m_thickness.GetValue() <= 0 )
592 errors.Add( _( "Line width must be greater than zero for an unfilled rectangle." ) );
593
594 break;
595
596 case SHAPE_T::POLY:
597 if( !m_filledCtrl->GetValue() && m_thickness.GetValue() <= 0 )
598 errors.Add( _( "Line width must be greater than zero for an unfilled polygon." ) );
599
600 break;
601
602 case SHAPE_T::SEGMENT:
603 if( m_thickness.GetValue() <= 0 )
604 errors.Add( _( "Line width must be greater than zero." ) );
605
606 break;
607
608 case SHAPE_T::BEZIER:
609 if( !m_filledCtrl->GetValue() && m_thickness.GetValue() <= 0 )
610 errors.Add( _( "Line width must be greater than zero for an unfilled curve." ) );
611
612 break;
613
614 default:
616 break;
617 }
618
619 if( errors.GetCount() )
620 {
621 HTML_MESSAGE_BOX dlg( this, _( "Error List" ) );
622 dlg.ListSet( errors );
623 dlg.ShowModal();
624 }
625
626 return errors.GetCount() == 0;
627}
constexpr int ARC_HIGH_DEF
Definition: base_units.h:120
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
Definition: bitmap.cpp:110
BASE_SET & set(size_t pos=std::numeric_limits< size_t >::max(), bool value=true)
Definition: base_set.h:61
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
virtual void SetLocked(bool aLocked)
Definition: board_item.h:316
virtual bool IsOnLayer(PCB_LAYER_ID aLayer) const
Test to see if this object is on the given layer.
Definition: board_item.h:307
virtual bool IsLocked() const
Definition: board_item.cpp:75
virtual bool IsOnCopperLayer() const
Definition: board_item.h:153
const NETINFO_LIST & GetNetInfo() const
Definition: board.h:864
DIALOG_SHAPE_PROPERTIES(SCH_BASE_FRAME *aParent, SCH_SHAPE *aShape)
bool TransferDataToWindow() override
void onLayerSelection(wxCommandEvent &event) override
void onFilledCheckbox(wxCommandEvent &event) override
bool TransferDataFromWindow() override
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:102
void SetupStandardButtons(std::map< int, wxString > aLabels={})
int ShowQuasiModal()
std::string m_hash_key
Definition: dialog_shim.h:210
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
Tool responsible for drawing graphical elements like lines, arcs, circles, etc.
Definition: drawing_tool.h:55
void SetStroke(const STROKE_PARAMS &aStroke, PCB_LAYER_ID aLayer)
Definition: drawing_tool.h:226
double Sin() const
Definition: eda_angle.h:170
EDA_ANGLE Round(int digits) const
Definition: eda_angle.h:284
double Cos() const
Definition: eda_angle.h:189
FRAME_T GetFrameType() const
EDA_ANGLE GetArcAngle() const
Definition: eda_shape.cpp:682
void SetStartX(int x)
Definition: eda_shape.h:146
const VECTOR2I & GetBezierC2() const
Definition: eda_shape.h:206
void SetBezierC2(const VECTOR2I &aPt)
Definition: eda_shape.h:205
void SetCenter(const VECTOR2I &aCenter)
Definition: eda_shape.cpp:564
int GetStartY() const
Definition: eda_shape.h:131
void SetLength(const double &aLength)
Definition: eda_shape.cpp:179
void SetEndY(int aY)
Definition: eda_shape.h:177
int GetEndX() const
Definition: eda_shape.h:169
int GetRectangleWidth() const
Definition: eda_shape.cpp:166
void SetStartY(int y)
Definition: eda_shape.h:140
bool IsFilled() const
Definition: eda_shape.h:91
void SetFilled(bool aFlag)
Definition: eda_shape.h:101
int GetRadius() const
Definition: eda_shape.cpp:612
SHAPE_T GetShape() const
Definition: eda_shape.h:125
int GetEndY() const
Definition: eda_shape.h:168
void SetEndX(int aX)
Definition: eda_shape.h:183
void RebuildBezierToSegmentsPointsList(int aMaxError)
Rebuild the m_bezierPoints vertex list that approximate the Bezier curve by a list of segments.
Definition: eda_shape.cpp:511
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition: eda_shape.h:167
void SetRadius(int aX)
Definition: eda_shape.h:189
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
Definition: eda_shape.h:130
void SetRectangle(const long long int &aHeight, const long long int &aWidth)
Definition: eda_shape.cpp:219
void SetSegmentAngle(const EDA_ANGLE &aAngle)
Definition: eda_shape.cpp:234
void SetBezierC1(const VECTOR2I &aPt)
Definition: eda_shape.h:202
double GetLength() const
Definition: eda_shape.cpp:123
wxString SHAPE_T_asString() const
Definition: eda_shape.cpp:89
int GetStartX() const
Definition: eda_shape.h:132
const VECTOR2I & GetBezierC1() const
Definition: eda_shape.h:203
int GetRectangleHeight() const
Definition: eda_shape.cpp:153
EDA_ANGLE GetSegmentAngle() const
Definition: eda_shape.cpp:673
static const TOOL_EVENT SelectedEvent
Definition: actions.h:270
void ListSet(const wxString &aList)
Add a list of items.
int SetLayerSelection(int layer)
bool SetLayersHotkeys(bool value)
LSET is a set of PCB_LAYER_IDs.
Definition: lset.h:35
static LSET ForbiddenFootprintLayers()
Layers which are not allowed within footprint definitions.
Definition: lset.cpp:858
void SetNetInfo(const NETINFO_LIST *aNetInfoList)
void SetBoard(BOARD *aBoard)
int GetSelectedNetcode()
void SetIndeterminateString(const wxString &aString)
void SetSelectedNetcode(int aNetcode)
void SetIndeterminate()
Common, abstract interface for edit frames.
void ShowGraphicItemPropertiesDialog(PCB_SHAPE *aShape)
virtual PCB_LAYER_ID GetActiveLayer() const
BOARD * GetBoard() const
The main frame for Pcbnew.
void SetBoardFrame(PCB_BASE_FRAME *aFrame)
void SetNotAllowedLayerSet(LSET aMask)
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Definition: pcb_shape.cpp:317
wxString GetFriendlyName() const override
Definition: pcb_shape.h:65
STROKE_PARAMS GetStroke() const override
Definition: pcb_shape.h:85
void SetStroke(const STROKE_PARAMS &aStroke) override
Definition: pcb_shape.h:86
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: pcb_shape.h:70
Simple container to manage line stroke parameters.
Definition: stroke_params.h:81
int GetWidth() const
Definition: stroke_params.h:91
void SetLineStyle(LINE_STYLE aLineStyle)
Definition: stroke_params.h:95
void SetWidth(int aWidth)
Definition: stroke_params.h:92
LINE_STYLE GetLineStyle() const
Definition: stroke_params.h:94
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:167
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:55
void PostEvent(const TOOL_EVENT &aEvent)
Put an event to the event queue to be processed at the end of event processing cycle.
int GetIntValue()
Definition: unit_binder.h:127
virtual long long int GetValue()
Return the current value in Internal Units.
virtual void SetPrecision(int aLength)
Normally not needed, but can be used to set the precision when using internal units that are floats (...
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 double GetDoubleValue()
Return the current value in Internal Units.
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 SetCoordType(ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType)
Set the current origin transform mode.
Definition: unit_binder.h:188
#define _(s)
static constexpr EDA_ANGLE ANGLE_0
Definition: eda_angle.h:401
@ RADIANS_T
Definition: eda_angle.h:32
@ DEGREES_T
Definition: eda_angle.h:31
@ FRAME_FOOTPRINT_EDITOR
Definition: frame_type.h:43
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:531
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:875
This file contains miscellaneous commonly used macros and functions.
#define UNIMPLEMENTED_FOR(type)
Definition: macros.h:96
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:390
static bool isCopper(const PNS::ITEM *aItem)
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: string_utils.h:391
const std::map< LINE_STYLE, struct LINE_STYLE_DESC > lineTypeNames
LINE_STYLE
Dashed line types.
Definition: stroke_params.h:48
const VECTOR2I CalcArcCenter(const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
Determine the center of an arc or circle given three points on its circumference.
Definition: trigo.cpp:520
#define INDETERMINATE_STATE
Used for holding indeterminate values, such as with multiple selections holding different values or c...
Definition: ui_common.h:46
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:121
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:673