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 void onTechLayersChanged( wxCommandEvent& event ) override;
60
61 bool Validate() override;
62
63 // Show/hide the widgets used in net selection (shown only for copper layers)
65 {
67
68 m_netSelector->Show( isCopper );
69 m_netLabel->Show( isCopper );
70 }
71
73 {
75
76 m_techLayersLabel->Enable( isExtCopper );
77 m_hasSolderMask->Enable( isExtCopper );
78
79 bool showMaskMargin = isExtCopper && m_hasSolderMask->GetValue();
80
81 m_solderMaskMarginLabel->Enable( showMaskMargin );
82 m_solderMaskMarginCtrl->Enable( showMaskMargin );
83 m_solderMaskMarginUnit->Enable( showMaskMargin );
84 }
85
86private:
89
101
103};
104
107 m_parent( aParent ),
108 m_item( aShape ),
109 m_startX( aParent, m_startXLabel, m_startXCtrl, m_startXUnits ),
110 m_startY( aParent, m_startYLabel, m_startYCtrl, m_startYUnits ),
111 m_endX( aParent, m_endXLabel, m_endXCtrl, m_endXUnits ),
112 m_endY( aParent, m_endYLabel, m_endYCtrl, m_endYUnits ),
113 m_thickness( aParent, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits ),
114 m_segmentLength( aParent, m_segmentLengthLabel, m_segmentLengthCtrl, m_segmentLengthUnits ),
115 m_segmentAngle( aParent, m_segmentAngleLabel, m_segmentAngleCtrl, m_segmentAngleUnits ),
116 m_angle( aParent, m_angleLabel, m_angleCtrl, m_angleUnits ),
117 m_rectangleHeight( aParent, m_rectangleHeightLabel, m_rectangleHeightCtrl, m_rectangleHeightUnits ),
118 m_rectangleWidth( aParent, m_rectangleWidthLabel, m_rectangleWidthCtrl, m_rectangleWidthUnits ),
119 m_bezierCtrl1X( aParent, m_BezierPointC1XLabel, m_BezierC1X_Ctrl, m_BezierPointC1XUnit ),
120 m_bezierCtrl1Y( aParent, m_BezierPointC1YLabel, m_BezierC1Y_Ctrl, m_BezierPointC1YUnit ),
121 m_bezierCtrl2X( aParent, m_BezierPointC2XLabel, m_BezierC2X_Ctrl, m_BezierPointC2XUnit ),
122 m_bezierCtrl2Y( aParent, m_BezierPointC2YLabel, m_BezierC2Y_Ctrl, m_BezierPointC2YUnit ),
123 m_solderMaskMargin( aParent, m_solderMaskMarginLabel, m_solderMaskMarginCtrl, m_solderMaskMarginUnit ),
124 m_flipStartEnd( false )
125{
126 SetTitle( wxString::Format( GetTitle(), m_item->GetFriendlyName() ) );
127 m_hash_key = TO_UTF8( GetTitle() );
128
129 wxFont infoFont = KIUI::GetInfoFont( this );
130 m_techLayersLabel->SetFont( infoFont );
131
132 // Configure display origin transforms
141
142 m_segmentAngle.SetUnits( EDA_UNITS::DEGREES );
144
145 m_angle.SetUnits( EDA_UNITS::DEGREES );
146
147 // Do not allow locking items in the footprint editor
148 m_locked->Show( dynamic_cast<PCB_EDIT_FRAME*>( aParent ) != nullptr );
149
150 // Configure the layers list selector
152 {
153 LSET forbiddenLayers = LSET::ForbiddenFootprintLayers();
154
155 // If someone went to the trouble of setting the layer in a text editor, then there's
156 // very little sense in nagging them about it.
157 forbiddenLayers.set( m_item->GetLayer(), false );
158
160 }
161
162 for( const auto& [ lineStyle, lineStyleDesc ] : lineTypeNames )
163 m_lineStyleCombo->Append( lineStyleDesc.name, KiBitmapBundle( lineStyleDesc.bitmap ) );
164
166
170
171 m_netSelector->SetBoard( aParent->GetBoard() );
172 m_netSelector->SetNetInfo( &aParent->GetBoard()->GetNetInfo() );
173
175 {
176 m_netLabel->Hide();
177 m_netSelector->Hide();
178 }
179 else
180 {
181 int net = aShape->GetNetCode();
182
183 if( net >= 0 )
184 {
186 }
187 else
188 {
191 }
192 }
193
194 if( m_item->GetShape() == SHAPE_T::POLY )
195 {
196 m_sizerStartEnd->Show( false );
197 SetInitialFocus( m_filledCtrl ); // Or Esc key won't work
198 }
199 else
200 {
202 }
203
204 // Only a Bezeier curve has control points. So do not show these parameters for other shapes
205 if( m_item->GetShape() != SHAPE_T::BEZIER )
206 m_sizerBezier->Show( false );
207
208 // Only a segment has this format
209 if( m_item->GetShape() != SHAPE_T::SEGMENT )
210 {
211 m_segmentLength.Show( false );
212 m_segmentAngle.Show( false );
213 }
214
215 if( m_item->GetShape() != SHAPE_T::RECTANGLE )
216 {
217 m_rectangleHeight.Show( false );
218 m_rectangleWidth.Show( false );
219 }
220
221 // Only an arc has a angle parameter. So do not show this parameter for other shapes
222 if( m_item->GetShape() != SHAPE_T::ARC )
223 m_angle.Show( false );
224
225 if( m_item->GetShape() == SHAPE_T::ARC || m_item->GetShape() == SHAPE_T::SEGMENT )
226 m_filledCtrl->Show( false );
227
228 // Change texts for circles:
229 if( m_item->GetShape() == SHAPE_T::CIRCLE )
230 {
231 m_startPointLabel->SetLabel( _( "Center Point" ) );
232 m_endPointLabel->SetLabel( _( "Radius" ) );
233
234 m_endXLabel->Show( false );
236 m_endY.Show( false );
237 }
238
240
241 // Now all widgets have the size fixed, call FinishDialogSettings
243}
244
245
247{
248 wxCHECK_RET( aShape, wxT( "ShowGraphicItemPropertiesDialog() error: NULL item" ) );
249
250 DIALOG_SHAPE_PROPERTIES dlg( this, aShape );
251
252 if( dlg.ShowQuasiModal() == wxID_OK )
253 {
254 if( aShape->IsOnLayer( GetActiveLayer() ) )
255 {
257 drawingTool->SetStroke( aShape->GetStroke(), GetActiveLayer() );
258 }
259 }
260}
261
262
263void DIALOG_SHAPE_PROPERTIES::onLayerSelection( wxCommandEvent& event )
264{
266 {
268 }
269
271}
272
273
274void DIALOG_SHAPE_PROPERTIES::onFilledCheckbox( wxCommandEvent& event )
275{
276 if( m_filledCtrl->GetValue() )
277 {
278 m_lineStyleCombo->SetSelection( 0 );
279 m_lineStyleLabel->Enable( false );
280 m_lineStyleCombo->Enable( false );
281 }
282 else
283 {
285
286 if( style == LINE_STYLE::DEFAULT )
287 style = LINE_STYLE::SOLID;
288
289 if( (int) style < (int) lineTypeNames.size() )
290 m_lineStyleCombo->SetSelection( (int) style );
291
292 m_lineStyleLabel->Enable( true );
293 m_lineStyleCombo->Enable( true );
294 }
295}
296
297
299{
301}
302
303
305{
306 if( !m_item )
307 return false;
308
309 if( m_item->GetShape() == SHAPE_T::ARC )
311
312 if( m_item->GetShape() == SHAPE_T::RECTANGLE )
313 {
316 }
317
318 if( m_item->GetShape() == SHAPE_T::SEGMENT )
319 {
320 if( m_item->GetStart().x == m_item->GetEnd().x )
322 else
324
327 }
328
329 if( m_flipStartEnd && m_item->GetShape() != SHAPE_T::ARC )
330 {
333 }
334 else
335 {
338 }
339
340 if( m_item->GetShape() == SHAPE_T::CIRCLE )
341 {
343 }
344 else if( m_flipStartEnd && m_item->GetShape() != SHAPE_T::ARC )
345 {
348 }
349 else
350 {
353 }
354
355 if( m_item->GetShape() == SHAPE_T::BEZIER )
356 {
361 }
362
363 m_filledCtrl->SetValue( m_item->IsFilled() );
364 m_locked->SetValue( m_item->IsLocked() );
365
367
368 int style = static_cast<int>( m_item->GetStroke().GetLineStyle() );
369
370 if( style == -1 )
371 m_lineStyleCombo->SetStringSelection( DEFAULT_STYLE );
372 else if( style < (int) lineTypeNames.size() )
373 m_lineStyleCombo->SetSelection( style );
374 else
375 wxFAIL_MSG( "Line type not found in the type lookup map" );
376
378
379 m_hasSolderMask->SetValue( m_item->HasSolderMask() );
380
381 if( m_item->GetLocalSolderMaskMargin().has_value() )
383 else
384 m_solderMaskMargin.SetValue( wxEmptyString );
385
388
389 return DIALOG_SHAPE_PROPERTIES_BASE::TransferDataToWindow();
390}
391
392
394{
395 if( !DIALOG_SHAPE_PROPERTIES_BASE::TransferDataFromWindow() )
396 return false;
397
398 if( !m_item )
399 return true;
400
402 VECTOR2I begin_point = m_item->GetStart();
403 VECTOR2I end_point = m_item->GetEnd();
404 int segment_length = 0;
405 EDA_ANGLE segment_angle = EDA_ANGLE( 0, RADIANS_T );
406 int rectangle_height = 0;
407 int rectangle_width = 0;
408
409 BOARD_COMMIT commit( m_parent );
410 commit.Modify( m_item );
411
412 bool pushCommit = ( m_item->GetEditFlags() == 0 );
413
414 // Set IN_EDIT flag to force undo/redo/abort proper operation and avoid new calls to
415 // SaveCopyInUndoList for the same text if is moved, and then rotated, edited, etc....
416 if( !pushCommit )
418
419 if( m_item->GetShape() == SHAPE_T::SEGMENT )
420 {
421 segment_length = KiROUND( m_item->GetLength() );
422 segment_angle = m_item->GetSegmentAngle().Round( 3 );
423 }
424
425 if( m_item->GetShape() == SHAPE_T::RECTANGLE )
426 {
427 rectangle_height = m_item->GetRectangleHeight();
428 rectangle_width = m_item->GetRectangleWidth();
429 }
430
431 if( m_flipStartEnd && m_item->GetShape() != SHAPE_T::ARC )
432 {
435 }
436 else
437 {
440 }
441
442 if( m_item->GetShape() == SHAPE_T::CIRCLE )
443 {
445 }
446 else if( m_flipStartEnd && m_item->GetShape() != SHAPE_T::ARC )
447 {
450 }
451 else
452 {
455 }
456
457 if( m_item->GetShape() == SHAPE_T::SEGMENT )
458 {
459 bool change_begin = ( begin_point != m_item->GetStart() );
460 bool change_end = ( end_point != m_item->GetEnd() );
461 bool change_length = ( segment_length != m_segmentLength.GetValue() );
462 EDA_ANGLE difference = std::abs( segment_angle - m_segmentAngle.GetAngleValue() );
463 bool change_angle = ( difference >= EDA_ANGLE( 0.00049, DEGREES_T ) );
464
465 if( !( change_begin && change_end ) )
466 {
467 segment_length = m_segmentLength.GetIntValue();
468 segment_angle = m_segmentAngle.GetAngleValue().Round( 3 );
469
470 if( change_length || change_angle )
471 {
472 if( change_end )
473 {
475 - KiROUND( segment_length * segment_angle.Cos() ) );
477 + KiROUND( segment_length * segment_angle.Sin() ) );
478 }
479 else
480 {
482 + KiROUND( segment_length * segment_angle.Cos() ) );
484 - KiROUND( segment_length * segment_angle.Sin() ) );
485 }
486 }
487 }
488
489 if( change_length )
491 else
493
494 if( change_angle )
496 else
498 }
499
500 if( m_item->GetShape() == SHAPE_T::RECTANGLE )
501 {
502 bool change_begin = ( begin_point != m_item->GetStart() );
503 bool change_end = ( end_point != m_item->GetEnd() );
504 bool change_height = ( rectangle_height != m_rectangleHeight.GetValue() );
505 bool change_width = ( rectangle_width != m_rectangleWidth.GetValue() );
506
507 if( !( change_begin && change_end ) )
508 {
509 rectangle_height = m_rectangleHeight.GetIntValue();
510 rectangle_width = m_rectangleWidth.GetIntValue();
511
512 if( change_height || change_width )
513 {
514 if( change_end )
515 {
516 m_item->SetStartX( m_item->GetEndX() - rectangle_width );
517 m_item->SetStartY( m_item->GetEndY() - rectangle_height );
518 }
519 else
520 {
521 m_item->SetEndX( m_item->GetStartX() + rectangle_width );
522 m_item->SetEndY( m_item->GetStartY() + rectangle_height );
523 }
524 }
525 }
526
528 }
529
530
531 // For Bezier curve: Set the two control points
532 if( m_item->GetShape() == SHAPE_T::BEZIER )
533 {
536 }
537
538 if( m_item->GetShape() == SHAPE_T::ARC )
539 {
541
542 m_item->SetCenter( c );
543 }
544
545 bool wasLocked = m_item->IsLocked();
546
547 m_item->SetFilled( m_filledCtrl->GetValue() );
548 m_item->SetLocked( m_locked->GetValue() );
549
550 STROKE_PARAMS stroke = m_item->GetStroke();
551
552 stroke.SetWidth( m_thickness.GetIntValue() );
553
554 auto it = lineTypeNames.begin();
555 std::advance( it, m_lineStyleCombo->GetSelection() );
556
557 if( it == lineTypeNames.end() )
558 stroke.SetLineStyle( LINE_STYLE::DEFAULT );
559 else
560 stroke.SetLineStyle( it->first );
561
562 m_item->SetStroke( stroke );
563
564 m_item->SetLayer( ToLAYER_ID( layer ) );
565
567
570 else
572
574
575 if( m_item->IsOnCopperLayer() )
577 else
578 m_item->SetNetCode( -1 );
579
580 if( pushCommit )
581 commit.Push( _( "Edit Shape Properties" ) );
582
583 // Notify clients which treat locked and unlocked items differently (ie: POINT_EDITOR)
584 if( wasLocked != m_item->IsLocked() )
586
587 return true;
588}
589
590
592{
593 wxArrayString errors;
594
595 if( !DIALOG_SHAPE_PROPERTIES_BASE::Validate() )
596 return false;
597
598 // Type specific checks.
599 switch( m_item->GetShape() )
600 {
601 case SHAPE_T::ARC:
602 // Check angle of arc.
603 if( m_angle.GetAngleValue() == ANGLE_0 )
604 errors.Add( _( "Arc angle cannot be zero." ) );
605
607 {
608 errors.Add( wxString::Format( _( "Invalid Arc with radius %f and angle %f." ),
609 0.0, m_angle.GetDoubleValue() ) );
610 }
611 else
612 {
615 VECTOR2D center = CalcArcCenter( start, end, m_angle.GetAngleValue() );
616
617 double radius = ( center - start ).EuclideanNorm();
618 double max_offset = std::max( std::abs( center.x ) + radius,
619 std::abs( center.y ) + radius );
620
621 if( max_offset >= ( std::numeric_limits<VECTOR2I::coord_type>::max() / 2.0 )
622 || center == start || center == end )
623 {
624 errors.Add( wxString::Format( _( "Invalid Arc with radius %f and angle %f." ),
625 radius, m_angle.GetDoubleValue() ) );
626 }
627 }
628
629 if( m_thickness.GetValue() <= 0 )
630 errors.Add( _( "Line width must be greater than zero." ) );
631
632 break;
633
634 case SHAPE_T::CIRCLE:
635 // Check radius.
636 if( m_endX.GetValue() <= 0 )
637 errors.Add( _( "Radius must be greater than zero." ) );
638
639 if( !m_filledCtrl->GetValue() && m_thickness.GetValue() <= 0 )
640 errors.Add( _( "Line width must be greater than zero for an unfilled circle." ) );
641
642 break;
643
644 case SHAPE_T::RECTANGLE:
645 // Check for null rect.
647 errors.Add( _( "Rectangle cannot be empty." ) );
648
649 if( !m_filledCtrl->GetValue() && m_thickness.GetValue() <= 0 )
650 errors.Add( _( "Line width must be greater than zero for an unfilled rectangle." ) );
651
652 break;
653
654 case SHAPE_T::POLY:
655 if( !m_filledCtrl->GetValue() && m_thickness.GetValue() <= 0 )
656 errors.Add( _( "Line width must be greater than zero for an unfilled polygon." ) );
657
658 break;
659
660 case SHAPE_T::SEGMENT:
661 if( m_thickness.GetValue() <= 0 )
662 errors.Add( _( "Line width must be greater than zero." ) );
663
664 break;
665
666 case SHAPE_T::BEZIER:
667 if( !m_filledCtrl->GetValue() && m_thickness.GetValue() <= 0 )
668 errors.Add( _( "Line width must be greater than zero for an unfilled curve." ) );
669
670 break;
671
672 default:
674 break;
675 }
676
677 if( errors.GetCount() )
678 {
679 HTML_MESSAGE_BOX dlg( this, _( "Error List" ) );
680 dlg.ListSet( errors );
681 dlg.ShowModal();
682 }
683
684 return errors.GetCount() == 0;
685}
constexpr int ARC_HIGH_DEF
Definition: base_units.h:120
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
Definition: bitmap.cpp:110
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition: box2.h:990
BASE_SET & set(size_t pos)
Definition: base_set.h:115
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
virtual void SetLocked(bool aLocked)
Definition: board_item.h:328
virtual bool IsLocked() const
Definition: board_item.cpp:75
virtual bool IsOnCopperLayer() const
Definition: board_item.h:150
const NETINFO_LIST & GetNetInfo() const
Definition: board.h:871
DIALOG_SHAPE_PROPERTIES(SCH_BASE_FRAME *aParent, SCH_SHAPE *aShape)
bool TransferDataToWindow() override
void onLayerSelection(wxCommandEvent &event) override
void onTechLayersChanged(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:213
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
int ShowModal() override
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:234
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_ITEM_FLAGS GetEditFlags() const
Definition: eda_item.h:133
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:127
EDA_ANGLE GetArcAngle() const
Definition: eda_shape.cpp:645
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:527
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:575
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:474
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:636
static const TOOL_EVENT SelectedEvent
Definition: actions.h:290
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:36
static LSET ForbiddenFootprintLayers()
Layers which are not allowed within footprint definitions.
Definition: lset.cpp:792
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)
std::optional< int > GetLocalSolderMaskMargin() const
Definition: pcb_shape.h:186
bool HasSolderMask() const
Definition: pcb_shape.h:183
void SetHasSolderMask(bool aVal)
Definition: pcb_shape.h:182
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Definition: pcb_shape.cpp:326
wxString GetFriendlyName() const override
Definition: pcb_shape.h:64
STROKE_PARAMS GetStroke() const override
Definition: pcb_shape.h:89
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
Definition: pcb_shape.h:185
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition: pcb_shape.cpp:356
void SetStroke(const STROKE_PARAMS &aStroke) override
Definition: pcb_shape.h:90
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: pcb_shape.h:69
Simple container to manage line stroke parameters.
Definition: stroke_params.h:79
int GetWidth() const
Definition: stroke_params.h:89
void SetLineStyle(LINE_STYLE aLineStyle)
Definition: stroke_params.h:93
void SetWidth(int aWidth)
Definition: stroke_params.h:90
LINE_STYLE GetLineStyle() const
Definition: stroke_params.h:92
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:129
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:199
bool IsNull() const
Return true if the control holds no value (ie: empty string, not 0).
#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
#define IN_EDIT
Item currently edited.
@ FRAME_FOOTPRINT_EDITOR
Definition: frame_type.h:43
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:532
bool IsExternalCopperLayer(int aLayerId)
Tests whether a layer is an external (F_Cu or B_Cu) copper layer.
Definition: layer_ids.h:543
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:810
This file contains miscellaneous commonly used macros and functions.
#define UNIMPLEMENTED_FOR(type)
Definition: macros.h:96
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:154
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:398
const std::map< LINE_STYLE, struct LINE_STYLE_DESC > lineTypeNames
LINE_STYLE
Dashed line types.
Definition: stroke_params.h:46
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:521
#define INDETERMINATE_STATE
Used for holding indeterminate values, such as with multiple selections holding different values or c...
Definition: ui_common.h:46
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:691