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 commit.Modify( m_item );
367
368 bool pushCommit = ( m_item->GetEditFlags() == 0 );
369
370 // Set IN_EDIT flag to force undo/redo/abort proper operation and avoid new calls to
371 // SaveCopyInUndoList for the same text if is moved, and then rotated, edited, etc....
372 if( !pushCommit )
374
375 if( m_item->GetShape() == SHAPE_T::SEGMENT )
376 {
377 segment_length = KiROUND( m_item->GetLength() );
378 segment_angle = m_item->GetSegmentAngle().Round( 3 );
379 }
380
381 if( m_item->GetShape() == SHAPE_T::RECTANGLE )
382 {
383 rectangle_height = m_item->GetRectangleHeight();
384 rectangle_width = m_item->GetRectangleWidth();
385 }
386
387 if( m_flipStartEnd && m_item->GetShape() != SHAPE_T::ARC )
388 {
391 }
392 else
393 {
396 }
397
398 if( m_item->GetShape() == SHAPE_T::CIRCLE )
399 {
401 }
402 else if( m_flipStartEnd && m_item->GetShape() != SHAPE_T::ARC )
403 {
406 }
407 else
408 {
411 }
412
413 if( m_item->GetShape() == SHAPE_T::SEGMENT )
414 {
415 bool change_begin = ( begin_point != m_item->GetStart() );
416 bool change_end = ( end_point != m_item->GetEnd() );
417 bool change_length = ( segment_length != m_segmentLength.GetValue() );
418 EDA_ANGLE difference = std::abs( segment_angle - m_segmentAngle.GetAngleValue() );
419 bool change_angle = ( difference >= EDA_ANGLE( 0.00049, DEGREES_T ) );
420
421 if( !( change_begin && change_end ) )
422 {
423 segment_length = m_segmentLength.GetIntValue();
424 segment_angle = m_segmentAngle.GetAngleValue().Round( 3 );
425
426 if( change_length || change_angle )
427 {
428 if( change_end )
429 {
431 - KiROUND( segment_length * segment_angle.Cos() ) );
433 + KiROUND( segment_length * segment_angle.Sin() ) );
434 }
435 else
436 {
438 + KiROUND( segment_length * segment_angle.Cos() ) );
440 - KiROUND( segment_length * segment_angle.Sin() ) );
441 }
442 }
443 }
444
445 if( change_length )
447 else
449
450 if( change_angle )
452 else
454 }
455
456 if( m_item->GetShape() == SHAPE_T::RECTANGLE )
457 {
458 bool change_begin = ( begin_point != m_item->GetStart() );
459 bool change_end = ( end_point != m_item->GetEnd() );
460 bool change_height = ( rectangle_height != m_rectangleHeight.GetValue() );
461 bool change_width = ( rectangle_width != m_rectangleWidth.GetValue() );
462
463 if( !( change_begin && change_end ) )
464 {
465 rectangle_height = m_rectangleHeight.GetIntValue();
466 rectangle_width = m_rectangleWidth.GetIntValue();
467
468 if( change_height || change_width )
469 {
470 if( change_end )
471 {
472 m_item->SetStartX( m_item->GetEndX() - rectangle_width );
473 m_item->SetStartY( m_item->GetEndY() - rectangle_height );
474 }
475 else
476 {
477 m_item->SetEndX( m_item->GetStartX() + rectangle_width );
478 m_item->SetEndY( m_item->GetStartY() + rectangle_height );
479 }
480 }
481 }
482
484 }
485
486
487 // For Bezier curve: Set the two control points
488 if( m_item->GetShape() == SHAPE_T::BEZIER )
489 {
492 }
493
494 if( m_item->GetShape() == SHAPE_T::ARC )
495 {
497
498 m_item->SetCenter( c );
499 }
500
501 bool wasLocked = m_item->IsLocked();
502
503 m_item->SetFilled( m_filledCtrl->GetValue() );
504 m_item->SetLocked( m_locked->GetValue() );
505
506 STROKE_PARAMS stroke = m_item->GetStroke();
507
508 stroke.SetWidth( m_thickness.GetIntValue() );
509
510 auto it = lineTypeNames.begin();
511 std::advance( it, m_lineStyleCombo->GetSelection() );
512
513 if( it == lineTypeNames.end() )
514 stroke.SetLineStyle( LINE_STYLE::DEFAULT );
515 else
516 stroke.SetLineStyle( it->first );
517
518 m_item->SetStroke( stroke );
519
520 m_item->SetLayer( ToLAYER_ID( layer ) );
521
523
524 if( m_item->IsOnCopperLayer() )
526 else
527 m_item->SetNetCode( -1 );
528
529 if( pushCommit )
530 commit.Push( _( "Edit Shape Properties" ) );
531
532 // Notify clients which treat locked and unlocked items differently (ie: POINT_EDITOR)
533 if( wasLocked != m_item->IsLocked() )
535
536 return true;
537}
538
539
541{
542 wxArrayString errors;
543
544 if( !DIALOG_SHAPE_PROPERTIES_BASE::Validate() )
545 return false;
546
547 // Type specific checks.
548 switch( m_item->GetShape() )
549 {
550 case SHAPE_T::ARC:
551 // Check angle of arc.
552 if( m_angle.GetAngleValue() == ANGLE_0 )
553 errors.Add( _( "Arc angle cannot be zero." ) );
554
556 {
557 errors.Add( wxString::Format( _( "Invalid Arc with radius %f and angle %f." ),
558 0.0, m_angle.GetDoubleValue() ) );
559 }
560 else
561 {
564 VECTOR2D center = CalcArcCenter( start, end, m_angle.GetAngleValue() );
565
566 double radius = ( center - start ).EuclideanNorm();
567 double max_offset = std::max( std::abs( center.x ) + radius,
568 std::abs( center.y ) + radius );
569
570 if( max_offset >= ( std::numeric_limits<VECTOR2I::coord_type>::max() / 2.0 )
571 || center == start || center == end )
572 {
573 errors.Add( wxString::Format( _( "Invalid Arc with radius %f and angle %f." ),
574 radius, m_angle.GetDoubleValue() ) );
575 }
576 }
577
578 if( m_thickness.GetValue() <= 0 )
579 errors.Add( _( "Line width must be greater than zero." ) );
580
581 break;
582
583 case SHAPE_T::CIRCLE:
584 // Check radius.
585 if( m_endX.GetValue() <= 0 )
586 errors.Add( _( "Radius must be greater than zero." ) );
587
588 if( !m_filledCtrl->GetValue() && m_thickness.GetValue() <= 0 )
589 errors.Add( _( "Line width must be greater than zero for an unfilled circle." ) );
590
591 break;
592
593 case SHAPE_T::RECTANGLE:
594 // Check for null rect.
596 errors.Add( _( "Rectangle cannot be empty." ) );
597
598 if( !m_filledCtrl->GetValue() && m_thickness.GetValue() <= 0 )
599 errors.Add( _( "Line width must be greater than zero for an unfilled rectangle." ) );
600
601 break;
602
603 case SHAPE_T::POLY:
604 if( !m_filledCtrl->GetValue() && m_thickness.GetValue() <= 0 )
605 errors.Add( _( "Line width must be greater than zero for an unfilled polygon." ) );
606
607 break;
608
609 case SHAPE_T::SEGMENT:
610 if( m_thickness.GetValue() <= 0 )
611 errors.Add( _( "Line width must be greater than zero." ) );
612
613 break;
614
615 case SHAPE_T::BEZIER:
616 if( !m_filledCtrl->GetValue() && m_thickness.GetValue() <= 0 )
617 errors.Add( _( "Line width must be greater than zero for an unfilled curve." ) );
618
619 break;
620
621 default:
623 break;
624 }
625
626 if( errors.GetCount() )
627 {
628 HTML_MESSAGE_BOX dlg( this, _( "Error List" ) );
629 dlg.ListSet( errors );
630 dlg.ShowModal();
631 }
632
633 return errors.GetCount() == 0;
634}
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:62
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_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: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
#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: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:521
#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, bool aQuiet=false)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:100
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:676