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
154 int net = aShape->GetNetCode();
155
156 if( net >= 0 )
157 {
159 }
160 else
161 {
164 }
165
166 if( m_item->GetShape() == SHAPE_T::POLY )
167 m_sizerStartEnd->Show( false );
168
169 // Only a Bezeier curve has control points. So do not show these parameters for other shapes
170 if( m_item->GetShape() != SHAPE_T::BEZIER )
171 m_sizerBezier->Show( false );
172
173 // Only a segment has this format
174 if( m_item->GetShape() != SHAPE_T::SEGMENT )
175 {
176 m_segmentLength.Show( false );
177 m_segmentAngle.Show( false );
178 }
179
180 if( m_item->GetShape() != SHAPE_T::RECTANGLE )
181 {
182 m_rectangleHeight.Show( false );
183 m_rectangleWidth.Show( false );
184 }
185
186 // Only an arc has a angle parameter. So do not show this parameter for other shapes
187 if( m_item->GetShape() != SHAPE_T::ARC )
188 m_angle.Show( false );
189
190 if( m_item->GetShape() == SHAPE_T::ARC || m_item->GetShape() == SHAPE_T::SEGMENT )
191 m_filledCtrl->Show( false );
192
193 // Change texts for circles:
194 if( m_item->GetShape() == SHAPE_T::CIRCLE )
195 {
196 m_startPointLabel->SetLabel( _( "Center Point" ) );
197 m_endPointLabel->SetLabel( _( "Radius" ) );
198
199 m_endXLabel->Show( false );
201 m_endY.Show( false );
202 }
203
206
207 // Now all widgets have the size fixed, call FinishDialogSettings
209}
210
211
213{
214 wxCHECK_RET( aShape, wxT( "ShowGraphicItemPropertiesDialog() error: NULL item" ) );
215
216 DIALOG_SHAPE_PROPERTIES dlg( this, aShape );
217
218 if( dlg.ShowQuasiModal() == wxID_OK )
219 {
220 if( aShape->IsOnLayer( GetActiveLayer() ) )
221 {
223 drawingTool->SetStroke( aShape->GetStroke(), GetActiveLayer() );
224 }
225 }
226}
227
228
229void DIALOG_SHAPE_PROPERTIES::onLayerSelection( wxCommandEvent& event )
230{
232 {
234 }
235}
236
237
238void DIALOG_SHAPE_PROPERTIES::onFilledCheckbox( wxCommandEvent& event )
239{
240 if( m_filledCtrl->GetValue() )
241 {
242 m_lineStyleCombo->SetSelection( 0 );
243 m_lineStyleLabel->Enable( false );
244 m_lineStyleCombo->Enable( false );
245 }
246 else
247 {
249
250 if( style == LINE_STYLE::DEFAULT )
251 style = LINE_STYLE::SOLID;
252
253 if( (int) style < (int) lineTypeNames.size() )
254 m_lineStyleCombo->SetSelection( (int) style );
255
256 m_lineStyleLabel->Enable( true );
257 m_lineStyleCombo->Enable( true );
258 }
259}
260
262{
263 if( !m_item )
264 return false;
265
266 if( m_item->GetShape() == SHAPE_T::ARC )
268
269 if( m_item->GetShape() == SHAPE_T::RECTANGLE )
270 {
273 }
274
275 if( m_item->GetShape() == SHAPE_T::SEGMENT )
276 {
277 if( m_item->GetStart().x == m_item->GetEnd().x )
279 else
281
284 }
285
286 if( m_flipStartEnd && m_item->GetShape() != SHAPE_T::ARC )
287 {
290 }
291 else
292 {
295 }
296
297 if( m_item->GetShape() == SHAPE_T::CIRCLE )
298 {
300 }
301 else if( m_flipStartEnd && m_item->GetShape() != SHAPE_T::ARC )
302 {
305 }
306 else
307 {
310 }
311
312 if( m_item->GetShape() == SHAPE_T::BEZIER )
313 {
318 }
319
320 m_filledCtrl->SetValue( m_item->IsFilled() );
321 m_locked->SetValue( m_item->IsLocked() );
322
324
325 int style = static_cast<int>( m_item->GetStroke().GetLineStyle() );
326
327 if( style == -1 )
328 m_lineStyleCombo->SetStringSelection( DEFAULT_STYLE );
329 else if( style < (int) lineTypeNames.size() )
330 m_lineStyleCombo->SetSelection( style );
331 else
332 wxFAIL_MSG( "Line type not found in the type lookup map" );
333
336
337 return DIALOG_SHAPE_PROPERTIES_BASE::TransferDataToWindow();
338}
339
340
342{
343 if( !DIALOG_SHAPE_PROPERTIES_BASE::TransferDataFromWindow() )
344 return false;
345
346 if( !m_item )
347 return true;
348
350 VECTOR2I begin_point = m_item->GetStart();
351 VECTOR2I end_point = m_item->GetEnd();
352 int segment_length = 0;
353 EDA_ANGLE segment_angle = EDA_ANGLE( 0, RADIANS_T );
354 int rectangle_height = 0;
355 int rectangle_width = 0;
356
357 BOARD_COMMIT commit( m_parent );
358
359 commit.Modify( m_item );
360
361 if( m_item->GetShape() == SHAPE_T::SEGMENT )
362 {
363 segment_length = KiROUND( m_item->GetLength() );
364 segment_angle = m_item->GetSegmentAngle().Round( 3 );
365 }
366
367 if( m_item->GetShape() == SHAPE_T::RECTANGLE )
368 {
369 rectangle_height = m_item->GetRectangleHeight();
370 rectangle_width = m_item->GetRectangleWidth();
371 }
372
373 if( m_flipStartEnd && m_item->GetShape() != SHAPE_T::ARC )
374 {
377 }
378 else
379 {
382 }
383
384 if( m_item->GetShape() == SHAPE_T::CIRCLE )
385 {
387 }
388 else if( m_flipStartEnd && m_item->GetShape() != SHAPE_T::ARC )
389 {
392 }
393 else
394 {
397 }
398
399 if( m_item->GetShape() == SHAPE_T::SEGMENT )
400 {
401 bool change_begin = ( begin_point != m_item->GetStart() );
402 bool change_end = ( end_point != m_item->GetEnd() );
403 bool change_length = ( segment_length != m_segmentLength.GetValue() );
404 EDA_ANGLE difference = std::abs( segment_angle - m_segmentAngle.GetAngleValue() );
405 bool change_angle = ( difference >= EDA_ANGLE( 0.00049, DEGREES_T ) );
406
407 if( !( change_begin && change_end ) )
408 {
409 segment_length = m_segmentLength.GetIntValue();
410 segment_angle = m_segmentAngle.GetAngleValue().Round( 3 );
411
412 if( change_length || change_angle )
413 {
414 if( change_end )
415 {
417 - KiROUND( segment_length * segment_angle.Cos() ) );
419 + KiROUND( segment_length * segment_angle.Sin() ) );
420 }
421 else
422 {
424 + KiROUND( segment_length * segment_angle.Cos() ) );
426 - KiROUND( segment_length * segment_angle.Sin() ) );
427 }
428 }
429 }
430
431 if( change_length )
433 else
435
436 if( change_angle )
438 else
440 }
441
442 if( m_item->GetShape() == SHAPE_T::RECTANGLE )
443 {
444 bool change_begin = ( begin_point != m_item->GetStart() );
445 bool change_end = ( end_point != m_item->GetEnd() );
446 bool change_height = ( rectangle_height != m_rectangleHeight.GetValue() );
447 bool change_width = ( rectangle_width != m_rectangleWidth.GetValue() );
448
449 if( !( change_begin && change_end ) )
450 {
451 rectangle_height = m_rectangleHeight.GetIntValue();
452 rectangle_width = m_rectangleWidth.GetIntValue();
453
454 if( change_height || change_width )
455 {
456 if( change_end )
457 {
458 m_item->SetStartX( m_item->GetEndX() - rectangle_width );
459 m_item->SetStartY( m_item->GetEndY() - rectangle_height );
460 }
461 else
462 {
463 m_item->SetEndX( m_item->GetStartX() + rectangle_width );
464 m_item->SetEndY( m_item->GetStartY() + rectangle_height );
465 }
466 }
467 }
468
470 }
471
472
473 // For Bezier curve: Set the two control points
474 if( m_item->GetShape() == SHAPE_T::BEZIER )
475 {
478 }
479
480 if( m_item->GetShape() == SHAPE_T::ARC )
481 {
483
484 m_item->SetCenter( c );
485 }
486
487 bool wasLocked = m_item->IsLocked();
488
489 m_item->SetFilled( m_filledCtrl->GetValue() );
490 m_item->SetLocked( m_locked->GetValue() );
491
492 STROKE_PARAMS stroke = m_item->GetStroke();
493
494 stroke.SetWidth( m_thickness.GetIntValue() );
495
496 auto it = lineTypeNames.begin();
497 std::advance( it, m_lineStyleCombo->GetSelection() );
498
499 if( it == lineTypeNames.end() )
500 stroke.SetLineStyle( LINE_STYLE::DEFAULT );
501 else
502 stroke.SetLineStyle( it->first );
503
504 m_item->SetStroke( stroke );
505
506 m_item->SetLayer( ToLAYER_ID( layer ) );
507
509
510 if( m_item->IsOnCopperLayer() )
512 else
513 m_item->SetNetCode( -1 );
514
515 commit.Push( _( "Edit Shape Properties" ) );
516
517 // Notify clients which treat locked and unlocked items differently (ie: POINT_EDITOR)
518 if( wasLocked != m_item->IsLocked() )
520
521 return true;
522}
523
524
526{
527 wxArrayString errors;
528
529 if( !DIALOG_SHAPE_PROPERTIES_BASE::Validate() )
530 return false;
531
532 // Type specific checks.
533 switch( m_item->GetShape() )
534 {
535 case SHAPE_T::ARC:
536 // Check angle of arc.
537 if( m_angle.GetAngleValue() == ANGLE_0 )
538 errors.Add( _( "Arc angle cannot be zero." ) );
539
541 {
542 errors.Add( wxString::Format( _( "Invalid Arc with radius %f and angle %f." ),
543 0.0, m_angle.GetDoubleValue() ) );
544 }
545 else
546 {
549 VECTOR2D center = CalcArcCenter( start, end, m_angle.GetAngleValue() );
550
551 double radius = ( center - start ).EuclideanNorm();
552 double max_offset = std::max( std::abs( center.x ) + radius,
553 std::abs( center.y ) + radius );
554
555 if( max_offset >= ( std::numeric_limits<VECTOR2I::coord_type>::max() / 2.0 )
556 || center == start || center == end )
557 {
558 errors.Add( wxString::Format( _( "Invalid Arc with radius %f and angle %f." ),
559 radius, m_angle.GetDoubleValue() ) );
560 }
561 }
562
563 if( m_thickness.GetValue() <= 0 )
564 errors.Add( _( "Line width must be greater than zero." ) );
565
566 break;
567
568 case SHAPE_T::CIRCLE:
569 // Check radius.
570 if( m_endX.GetValue() <= 0 )
571 errors.Add( _( "Radius must be greater than zero." ) );
572
573 if( !m_filledCtrl->GetValue() && m_thickness.GetValue() <= 0 )
574 errors.Add( _( "Line width must be greater than zero for an unfilled circle." ) );
575
576 break;
577
578 case SHAPE_T::RECTANGLE:
579 // Check for null rect.
581 errors.Add( _( "Rectangle cannot be empty." ) );
582
583 if( !m_filledCtrl->GetValue() && m_thickness.GetValue() <= 0 )
584 errors.Add( _( "Line width must be greater than zero for an unfilled rectangle." ) );
585
586 break;
587
588 case SHAPE_T::POLY:
589 if( !m_filledCtrl->GetValue() && m_thickness.GetValue() <= 0 )
590 errors.Add( _( "Line width must be greater than zero for an unfilled polygon." ) );
591
592 break;
593
594 case SHAPE_T::SEGMENT:
595 if( m_thickness.GetValue() <= 0 )
596 errors.Add( _( "Line width must be greater than zero." ) );
597
598 break;
599
600 case SHAPE_T::BEZIER:
601 if( !m_filledCtrl->GetValue() && m_thickness.GetValue() <= 0 )
602 errors.Add( _( "Line width must be greater than zero for an unfilled curve." ) );
603
604 break;
605
606 default:
608 break;
609 }
610
611 if( errors.GetCount() )
612 {
613 HTML_MESSAGE_BOX dlg( this, _( "Error List" ) );
614 dlg.ListSet( errors );
615 dlg.ShowModal();
616 }
617
618 return errors.GetCount() == 0;
619}
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
Definition: bitmap.cpp:110
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
virtual void SetLocked(bool aLocked)
Definition: board_item.h:300
virtual bool IsOnLayer(PCB_LAYER_ID aLayer) const
Test to see if this object is on the given layer.
Definition: board_item.h:291
virtual bool IsLocked() const
Definition: board_item.cpp:74
virtual bool IsOnCopperLayer() const
Definition: board_item.h:151
const NETINFO_LIST & GetNetInfo() const
Definition: board.h:850
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:98
void SetupStandardButtons(std::map< int, wxString > aLabels={})
int ShowQuasiModal()
std::string m_hash_key
Definition: dialog_shim.h:206
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:212
EDA_ANGLE Round(int digits) const
Definition: eda_angle.h:318
double Cos() const
Definition: eda_angle.h:227
FRAME_T GetFrameType() const
EDA_ANGLE GetArcAngle() const
Definition: eda_shape.cpp:661
void SetStartX(int x)
Definition: eda_shape.h:141
const VECTOR2I & GetBezierC2() const
Definition: eda_shape.h:189
void SetBezierC2(const VECTOR2I &aPt)
Definition: eda_shape.h:188
void SetCenter(const VECTOR2I &aCenter)
Definition: eda_shape.cpp:543
int GetStartY() const
Definition: eda_shape.h:126
void SetLength(const double &aLength)
Definition: eda_shape.cpp:175
void SetEndY(int aY)
Definition: eda_shape.h:160
void RebuildBezierToSegmentsPointsList(int aMinSegLen)
Rebuild the m_bezierPoints vertex list that approximate the Bezier curve by a list of segments.
Definition: eda_shape.cpp:478
int GetEndX() const
Definition: eda_shape.h:152
int GetRectangleWidth() const
Definition: eda_shape.cpp:163
void SetStartY(int y)
Definition: eda_shape.h:135
bool IsFilled() const
Definition: eda_shape.h:91
void SetFilled(bool aFlag)
Definition: eda_shape.h:96
int GetRadius() const
Definition: eda_shape.cpp:591
SHAPE_T GetShape() const
Definition: eda_shape.h:120
int GetEndY() const
Definition: eda_shape.h:151
void SetEndX(int aX)
Definition: eda_shape.h:166
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition: eda_shape.h:150
void SetRadius(int aX)
Definition: eda_shape.h:172
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
Definition: eda_shape.h:125
void SetRectangle(const long long int &aHeight, const long long int &aWidth)
Definition: eda_shape.cpp:186
void SetSegmentAngle(const EDA_ANGLE &aAngle)
Definition: eda_shape.cpp:200
void SetBezierC1(const VECTOR2I &aPt)
Definition: eda_shape.h:185
double GetLength() const
Definition: eda_shape.cpp:121
wxString SHAPE_T_asString() const
Definition: eda_shape.cpp:87
int GetStartX() const
Definition: eda_shape.h:127
const VECTOR2I & GetBezierC1() const
Definition: eda_shape.h:186
int GetRectangleHeight() const
Definition: eda_shape.cpp:151
EDA_ANGLE GetSegmentAngle() const
Definition: eda_shape.cpp:652
static const TOOL_EVENT SelectedEvent
Definition: actions.h:260
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: layer_ids.h:574
static LSET ForbiddenFootprintLayers()
Layers which are not allowed within footprint definitions.
Definition: lset.cpp:1005
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)
int GetWidth() const override
Definition: pcb_shape.cpp:366
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Definition: pcb_shape.cpp:314
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:435
@ 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:880
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:1022
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:424
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
double EuclideanNorm(const VECTOR2I &vector)
Definition: trigo.h:128
#define INDETERMINATE_STATE
Used for holding indeterminate values, such as with multiple selections holding different values or c...
Definition: ui_common.h:45
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:118
VECTOR2< int > VECTOR2I
Definition: vector2d.h:588