KiCad PCB EDA Suite
pcb_base_frame.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) 2018 Jean-Pierre Charras, [email protected]
5 * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
6 * Copyright (C) 2011 Wayne Stambaugh <[email protected]>
7 * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
29#include <boost/version.hpp>
30
31#if BOOST_VERSION >= 106700
32#include <boost/uuid/entropy_error.hpp>
33#endif
34
35#include <kiface_base.h>
36#include <confirm.h>
37#include <pcb_base_frame.h>
38#include <base_units.h>
39#include <widgets/msgpanel.h>
40#include <pgm_base.h>
41#include <3d_viewer/eda_3d_viewer_frame.h> // To include VIEWER3D_FRAMENAME
43#include <pcbnew_settings.h>
44#include <fp_lib_table.h>
45#include <pcbnew_id.h>
46#include <board.h>
47#include <footprint.h>
48#include <collectors.h>
49#include <pcb_draw_panel_gal.h>
50#include <math/vector2d.h>
51#include <pcb_group.h>
52
53#include <pcb_painter.h>
56#include <tool/tool_manager.h>
58#include <tools/pcb_actions.h>
59#include <tool/grid_menu.h>
60#include "cleanup_item.h"
61#include <zoom_defines.h>
63
64#if defined( KICAD_USE_3DCONNEXION )
66#endif
67
70
71wxDEFINE_EVENT( BOARD_CHANGED, wxCommandEvent );
72
73PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
74 const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
75 long aStyle, const wxString& aFrameName ) :
76 EDA_DRAW_FRAME( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName, pcbIUScale ),
77 m_pcb( nullptr ),
78 m_originTransforms( *this ),
79 m_spaceMouse( nullptr )
80{
81}
82
83
85{
86#if defined( KICAD_USE_3DCONNEXION )
87 if( m_spaceMouse != nullptr )
88 delete m_spaceMouse;
89#endif
90
91 // Ensure m_canvasType is up to date, to save it in config
93
94 delete m_pcb;
95}
96
97
98bool PCB_BASE_FRAME::canCloseWindow( wxCloseEvent& aEvent )
99{
100 // Close modeless dialogs. They're trouble when they get destroyed after the frame and/or
101 // board.
102 wxWindow* viewer3D = Get3DViewerFrame();
103
104 if( viewer3D )
105 viewer3D->Close( true );
106
107 return true;
108}
109
110
111void PCB_BASE_FRAME::handleActivateEvent( wxActivateEvent& aEvent )
112{
114
115#if defined( KICAD_USE_3DCONNEXION )
116 if( m_spaceMouse != nullptr )
117 {
118 m_spaceMouse->SetFocus( aEvent.GetActive() );
119 }
120#endif
121}
122
123
124void PCB_BASE_FRAME::handleIconizeEvent( wxIconizeEvent& aEvent )
125{
127
128#if defined( KICAD_USE_3DCONNEXION )
129 if( m_spaceMouse != nullptr && aEvent.IsIconized() )
130 {
131 m_spaceMouse->SetFocus( false );
132 }
133#endif
134}
135
136
138{
139 wxWindow* frame = FindWindowByName( QUALIFIED_VIEWER3D_FRAMENAME( this ) );
140 return dynamic_cast<EDA_3D_VIEWER_FRAME*>( frame );
141}
142
143
144void PCB_BASE_FRAME::Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle )
145{
146 EDA_3D_VIEWER_FRAME* draw3DFrame = Get3DViewerFrame();
147
148 if( draw3DFrame )
149 {
150 if( aTitle )
151 draw3DFrame->SetTitle( *aTitle );
152
153 if( aMarkDirty )
154 draw3DFrame->ReloadRequest();
155
156 if( aRefresh )
157 draw3DFrame->Redraw();
158 }
159}
160
161
163{
164 // This is a lazy loading function, it loads the project specific table when
165 // that table is asked for, not before.
166
168
169 // its gotta be NULL or a FP_LIB_TABLE, or a bug.
170 wxASSERT( !tbl || tbl->Type() == FP_LIB_TABLE_T );
171
172 if( !tbl )
173 {
174 // Stack the project specific FP_LIB_TABLE overlay on top of the global table.
175 // ~FP_LIB_TABLE() will not touch the fallback table, so multiple projects may
176 // stack this way, all using the same global fallback table.
177 tbl = new FP_LIB_TABLE( &GFootprintTable );
178
179 SetElem( ELEM_FPTBL, tbl );
180
181 wxString projectFpLibTableFileName = FootprintLibTblName();
182
183 try
184 {
185 tbl->Load( projectFpLibTableFileName );
186 }
187 catch( const IO_ERROR& ioe )
188 {
189 DisplayErrorMessage( nullptr, _( "Error loading project footprint libraries." ),
190 ioe.What() );
191 }
192 catch( ... )
193 {
194 DisplayErrorMessage( nullptr, _( "Error loading project footprint library table." ) );
195 }
196 }
197
198 return tbl;
199}
200
201
203{
204 if( m_pcb != aBoard )
205 {
206 delete m_pcb;
207 m_pcb = aBoard;
208
209 if( GetBoard() && GetCanvas() )
210 {
212
213 if( rs )
214 {
215 rs->SetDashLengthRatio( GetBoard()->GetPlotOptions().GetDashedLineDashRatio() );
216 rs->SetGapLengthRatio( GetBoard()->GetPlotOptions().GetDashedLineGapRatio() );
217 }
218 }
219
220 wxCommandEvent e( BOARD_CHANGED );
221 ProcessEventLocally( e );
222 }
223}
224
225
227{
228 if( aFootprint )
229 {
230 GetBoard()->Add( aFootprint, ADD_MODE::APPEND );
231
232 aFootprint->SetFlags( IS_NEW );
233 aFootprint->SetPosition( wxPoint( 0, 0 ) ); // cursor in GAL may not be initialized yet
234
235 // Put it on FRONT layer (note that it might be stored flipped if the lib is an archive
236 // built from a board)
237 if( aFootprint->IsFlipped() )
238 aFootprint->Flip( aFootprint->GetPosition(), GetPcbNewSettings()->m_FlipLeftRight );
239
240 // Place it in orientation 0 even if it is not saved with orientation 0 in lib (note that
241 // it might be stored in another orientation if the lib is an archive built from a board)
242 aFootprint->SetOrientation( ANGLE_0 );
243 }
244}
245
246
248{
249 return GetBoard()->GetItem( aId );
250}
251
252
254{
255 std::vector<BOARD_ITEM*> items;
256
257 if( aItem )
258 items.push_back( aItem );
259
260 FocusOnItems( items, aLayer );
261}
262
263
264void PCB_BASE_FRAME::FocusOnItems( std::vector<BOARD_ITEM*> aItems, PCB_LAYER_ID aLayer )
265{
266 static std::vector<KIID> lastBrightenedItemIDs;
267
268 BOARD_ITEM* lastItem = nullptr;
269
270 for( KIID lastBrightenedItemID : lastBrightenedItemIDs )
271 {
274 #if BOOST_VERSION >= 106700
275 try
276 {
277 lastItem = GetBoard()->GetItem( lastBrightenedItemID );
278 }
279 catch( const boost::uuids::entropy_error& )
280 {
281 wxLogError( wxT( "A Boost UUID entropy exception was thrown in %s:%s." ),
282 __FILE__, __FUNCTION__ );
283 }
284 #else
285 lastItem = GetBoard()->GetItem( lastBrightenedItemID );
286 #endif
287
288 if( lastItem && lastItem != DELETED_BOARD_ITEM::GetInstance() )
289 {
290 lastItem->ClearBrightened();
291
292 if( lastItem->Type() == PCB_FOOTPRINT_T )
293 {
294 static_cast<FOOTPRINT*>( lastItem )->RunOnChildren(
295 [&]( BOARD_ITEM* child )
296 {
297 child->ClearBrightened();
298 } );
299 }
300 else if( lastItem->Type() == PCB_GROUP_T )
301 {
302 static_cast<PCB_GROUP*>( lastItem )->RunOnChildren(
303 [&]( BOARD_ITEM* child )
304 {
305 child->ClearBrightened();
306 } );
307 }
308
309 GetCanvas()->GetView()->Update( lastItem );
310 lastBrightenedItemID = niluuid;
311 GetCanvas()->Refresh();
312 }
313 }
314
315 lastBrightenedItemIDs.clear();
316
317 if( aItems.empty() )
318 return;
319
320 VECTOR2I focusPt;
321 KIGFX::VIEW* view = GetCanvas()->GetView();
322 SHAPE_POLY_SET viewportPoly( view->GetViewport() );
323
324 for( wxWindow* dialog : findDialogs() )
325 {
326 wxPoint dialogPos = GetCanvas()->ScreenToClient( dialog->GetScreenPosition() );
327 SHAPE_POLY_SET dialogPoly( BOX2D( view->ToWorld( dialogPos, true ),
328 view->ToWorld( dialog->GetSize(), false ) ) );
329
330 try
331 {
332 viewportPoly.BooleanSubtract( dialogPoly, SHAPE_POLY_SET::PM_FAST );
333 }
334 catch( const ClipperLib::clipperException& exc )
335 {
336 // This may be overkill and could be an assertion but we are more likely to
337 // find any clipper errors this way.
338 wxLogError( wxT( "Clipper library exception '%s' occurred." ), exc.what() );
339 }
340 }
341
342 SHAPE_POLY_SET itemPoly, clippedPoly;
343
344 for( BOARD_ITEM* item : aItems )
345 {
346 if( item && item != DELETED_BOARD_ITEM::GetInstance() )
347 {
348 item->SetBrightened();
349
350 if( item->Type() == PCB_FOOTPRINT_T )
351 {
352 static_cast<FOOTPRINT*>( item )->RunOnChildren(
353 [&]( BOARD_ITEM* child )
354 {
355 child->SetBrightened();
356 });
357 }
358 else if( item->Type() == PCB_GROUP_T )
359 {
360 static_cast<PCB_GROUP*>( item )->RunOnChildren(
361 [&]( BOARD_ITEM* child )
362 {
363 child->SetBrightened();
364 });
365 }
366
367 GetCanvas()->GetView()->Update( item );
368 lastBrightenedItemIDs.push_back( item->m_Uuid );
369
370 // Focus on the object's location. Prefer a visible part of the object to its anchor
371 // in order to keep from scrolling around.
372
373 focusPt = item->GetPosition();
374
375 if( aLayer == UNDEFINED_LAYER )
376 aLayer = item->GetLayerSet().Seq()[0];
377
378 switch( item->Type() )
379 {
380 case PCB_FOOTPRINT_T:
381 try
382 {
383 itemPoly = static_cast<FOOTPRINT*>( item )->GetBoundingHull();
384 }
385 catch( const ClipperLib::clipperException& exc )
386 {
387 // This may be overkill and could be an assertion but we are more likely to
388 // find any clipper errors this way.
389 wxLogError( wxT( "Clipper library exception '%s' occurred." ), exc.what() );
390 }
391
392 break;
393
394 case PCB_PAD_T:
395 case PCB_MARKER_T:
396 case PCB_VIA_T:
397 FocusOnLocation( item->GetFocusPosition() );
398 GetCanvas()->Refresh();
399 return;
400
401 case PCB_SHAPE_T:
402 case PCB_TEXT_T:
403 case PCB_TEXTBOX_T:
404 case PCB_FP_TEXT_T:
405 case PCB_FP_TEXTBOX_T:
406 case PCB_FP_SHAPE_T:
407 case PCB_FP_ZONE_T:
408 case PCB_TRACE_T:
409 case PCB_ARC_T:
411 case PCB_DIM_LEADER_T:
412 case PCB_DIM_CENTER_T:
413 case PCB_DIM_RADIAL_T:
420 item->TransformShapeWithClearanceToPolygon( itemPoly, aLayer, 0,
422 break;
423
424 case PCB_ZONE_T:
425 {
426 ZONE* zone = static_cast<ZONE*>( item );
427 #if 0
428 // Using the filled area shapes to find a Focus point can give good results, but
429 // unfortunately the calculations are highly time consuming, even for not very
430 // large areas (can be easily a few minutes for large areas).
431 // so we used only the zone outline that usually do not have too many vertices.
432 zone->TransformShapeWithClearanceToPolygon( itemPoly, aLayer, 0,
433 pcbIUScale.FromMillimeter( 0.1 ), ERROR_INSIDE );
434
435 if( itemPoly.IsEmpty() )
436 itemPoly = *zone->Outline();
437 #else
438 // much faster calculation time when using only the zone outlines
439 itemPoly = *zone->Outline();
440 #endif
441
442 break;
443 }
444
445 default:
446 {
447 BOX2I item_bbox = item->GetBoundingBox();
448 itemPoly.NewOutline();
449 itemPoly.Append( item_bbox.GetOrigin() );
450 itemPoly.Append( item_bbox.GetOrigin() + VECTOR2I( item_bbox.GetWidth(), 0 ) );
451 itemPoly.Append( item_bbox.GetOrigin() + VECTOR2I( 0, item_bbox.GetHeight() ) );
452 itemPoly.Append( item_bbox.GetOrigin() + VECTOR2I( item_bbox.GetWidth(),
453 item_bbox.GetHeight() ) );
454 break;
455 }
456 }
457
458 try
459 {
460 clippedPoly.BooleanIntersection( itemPoly, viewportPoly, SHAPE_POLY_SET::PM_FAST );
461 }
462 catch( const ClipperLib::clipperException& exc )
463 {
464 // This may be overkill and could be an assertion but we are more likely to
465 // find any clipper errors this way.
466 wxLogError( wxT( "Clipper library exception '%s' occurred." ), exc.what() );
467 }
468
469 if( !clippedPoly.IsEmpty() )
470 itemPoly = clippedPoly;
471 }
472 }
473
474 /*
475 * Perform a step-wise deflate to find the visual-center-of-mass
476 */
477
478 BOX2I bbox = itemPoly.BBox();
479 int step = std::min( bbox.GetWidth(), bbox.GetHeight() ) / 10;
480
481 while( !itemPoly.IsEmpty() )
482 {
483 focusPt = itemPoly.BBox().Centre();
484
485 try
486 {
488 }
489 catch( const ClipperLib::clipperException& exc )
490 {
491 // This may be overkill and could be an assertion but we are more likely to
492 // find any clipper errors this way.
493 wxLogError( wxT( "Clipper library exception '%s' occurred." ), exc.what() );
494 }
495 }
496
497 FocusOnLocation( focusPt );
498
499 GetCanvas()->Refresh();
500}
501
502
504{
505 KIGFX::PCB_VIEW* view = GetCanvas()->GetView();
506
507 if( view && GetBoard()->m_SolderMask && view->HasItem( GetBoard()->m_SolderMask ) )
508 view->Remove( GetBoard()->m_SolderMask );
509}
510
511
513{
514 KIGFX::PCB_VIEW* view = GetCanvas()->GetView();
515
516 if( view && GetBoard()->m_SolderMask )
517 {
518 if( view->HasItem( GetBoard()->m_SolderMask ) )
519 view->Remove( GetBoard()->m_SolderMask );
520
521 view->Add( GetBoard()->m_SolderMask );
522 }
523}
524
525
526void PCB_BASE_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
527{
528 m_pcb->SetPageSettings( aPageSettings );
529
530 if( GetScreen() )
532}
533
534
536{
537 return m_pcb->GetPageSettings();
538}
539
540
542{
543 // this function is only needed because EDA_DRAW_FRAME is not compiled
544 // with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
545 // into an application specific source file.
547}
548
549
551{
553}
554
555
557{
559}
560
561
563{
565}
566
567
569{
570 VECTOR2I origin( 0, 0 );
571
572 switch( GetPcbNewSettings()->m_Display.m_DisplayOrigin )
573 {
575 case PCB_DISPLAY_ORIGIN::PCB_ORIGIN_AUX: origin = GetAuxOrigin(); break;
577 default: wxASSERT( false ); break;
578 }
579
580 return origin;
581}
582
584{
585 return m_originTransforms;
586}
587
588
590{
591 return m_pcb->GetTitleBlock();
592}
593
594
596{
597 m_pcb->SetTitleBlock( aTitleBlock );
598}
599
600
602{
603 return m_pcb->GetDesignSettings();
604}
605
606
608{
609 m_drawBgColor= aColor;
610 m_auimgr.Update();
611}
612
613
615{
617}
618
619
621{
623}
624
625
627{
628 return m_pcb->GetPlotOptions();
629}
630
631
633{
634 m_pcb->SetPlotOptions( aSettings );
635}
636
637
638BOX2I PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
639{
640 BOX2I area = aBoardEdgesOnly ? m_pcb->GetBoardEdgesBoundingBox() : m_pcb->GetBoundingBox();
641
642 if( area.GetWidth() == 0 && area.GetHeight() == 0 )
643 {
644 wxSize pageSize = GetPageSizeIU();
645
647 {
648 area.SetOrigin( 0, 0 );
649 area.SetEnd( pageSize.x, pageSize.y );
650 }
651 else
652 {
653 area.SetOrigin( -pageSize.x / 2, -pageSize.y / 2 );
654 area.SetEnd( pageSize.x / 2, pageSize.y / 2 );
655 }
656 }
657
658 return area;
659}
660
661
662// Virtual function
664{
665}
666
667
669{
670 // call my base class
672
673 // tooltips in toolbars
675
676 // status bar
678}
679
680
682{
683 EDA_3D_VIEWER_FRAME* draw3DFrame = Get3DViewerFrame();
684
685 if( !draw3DFrame )
686 draw3DFrame = new EDA_3D_VIEWER_FRAME( &Kiway(), this, _( "3D Viewer" ) );
687
688 // Raising the window does not show the window on Windows if iconized. This should work
689 // on any platform.
690 if( draw3DFrame->IsIconized() )
691 draw3DFrame->Iconize( false );
692
693 draw3DFrame->Raise();
694 draw3DFrame->Show( true );
695
696 // Raising the window does not set the focus on Linux. This should work on any platform.
697 if( wxWindow::FindFocus() != draw3DFrame )
698 draw3DFrame->SetFocus();
699
700 // Allocate a slice of time to display the 3D frame
701 // a call to wxSafeYield() should be enough (and better), but on Linux we need
702 // to call wxYield()
703 // otherwise the activity messages are not displayed during the first board loading
704 wxYield();
705
706 // Note, the caller is responsible to load/update the board 3D view.
707 // after frame creation the board is not automatically created.
708
709 return draw3DFrame;
710}
711
712
714{
715 PCB_LAYER_ID preslayer = GetActiveLayer();
716 auto& displ_opts = GetDisplayOptions();
717
718 // Check if the specified layer matches the present layer
719 if( layer == preslayer )
720 return;
721
722 // Copper layers cannot be selected unconditionally; how many of those layers are
723 // currently enabled needs to be checked.
724 if( IsCopperLayer( layer ) )
725 {
726 // If only one copper layer is enabled, the only such layer that can be selected to
727 // is the "Copper" layer (so the selection of any other copper layer is disregarded).
728 if( m_pcb->GetCopperLayerCount() < 2 )
729 {
730 if( layer != B_Cu )
731 return;
732 }
733
734 // If more than one copper layer is enabled, the "Copper" and "Component" layers
735 // can be selected, but the total number of copper layers determines which internal
736 // layers are also capable of being selected.
737 else
738 {
739 if( layer != B_Cu && layer != F_Cu && layer >= ( m_pcb->GetCopperLayerCount() - 1 ) )
740 return;
741 }
742 }
743
744 // Is yet more checking required? E.g. when the layer to be selected is a non-copper
745 // layer, or when switching between a copper layer and a non-copper layer, or vice-versa?
746 // ...
747
748 SetActiveLayer( layer );
749
750 if( displ_opts.m_ContrastModeDisplay != HIGH_CONTRAST_MODE::NORMAL )
751 GetCanvas()->Refresh();
752}
753
754
756{
758 GetCanvas()->GetView() );
759
760 // account for the globals
775
776 return guide;
777}
778
779
781{
782 VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize();
783 wxString line;
784
785 line.Printf( wxT( "grid X %s Y %s" ),
786 MessageTextFromValue( gridSize.x, false ),
787 MessageTextFromValue( gridSize.y, false ) );
788
789 SetStatusText( line, 4 );
790}
791
792
794{
796
797 BASE_SCREEN* screen = GetScreen();
798
799 if( !screen )
800 return;
801
802 wxString line;
804
805 if( GetShowPolarCoords() ) // display polar coordinates
806 {
807 double dx = cursorPos.x - screen->m_LocalOrigin.x;
808 double dy = cursorPos.y - screen->m_LocalOrigin.y;
809 double theta = RAD2DEG( atan2( -dy, dx ) );
810 double ro = hypot( dx, dy );
811
812 line.Printf( wxT( "r %s theta %.3f" ),
813 MessageTextFromValue( ro, false ),
814 theta );
815
816 SetStatusText( line, 3 );
817 }
818
819 // Transform absolute coordinates for user origin preferences
820 double userXpos = m_originTransforms.ToDisplayAbsX( static_cast<double>( cursorPos.x ) );
821 double userYpos = m_originTransforms.ToDisplayAbsY( static_cast<double>( cursorPos.y ) );
822
823 // Display absolute coordinates:
824 line.Printf( wxT( "X %s Y %s" ),
825 MessageTextFromValue( userXpos, false ),
826 MessageTextFromValue( userYpos, false ) );
827 SetStatusText( line, 2 );
828
829 if( !GetShowPolarCoords() ) // display relative cartesian coordinates
830 {
831 // Calculate relative coordinates
832 double relXpos = cursorPos.x - screen->m_LocalOrigin.x;
833 double relYpos = cursorPos.y - screen->m_LocalOrigin.y;
834
835 // Transform relative coordinates for user origin preferences
836 userXpos = m_originTransforms.ToDisplayRelX( relXpos );
837 userYpos = m_originTransforms.ToDisplayRelY( relYpos );
838
839 line.Printf( wxT( "dx %s dy %s dist %s" ),
840 MessageTextFromValue( userXpos, false ),
841 MessageTextFromValue( userYpos, false ),
842 MessageTextFromValue( hypot( userXpos, userYpos ), false ) );
843 SetStatusText( line, 3 );
844 }
845
847}
848
849
851{
852 EDA_DRAW_FRAME::unitsChangeRefresh(); // Update the status bar.
853
855}
856
857
859{
861
862 if( aCfg->m_Window.grid.sizes.empty() )
863 aCfg->m_Window.grid.sizes = aCfg->DefaultGridSizeList();
864
865 // Currently values read from config file are not used because the user cannot
866 // change this config
867 // if( aCfg->m_Window.zoom_factors.empty() )
868 {
870 }
871
872 // Some, but not all derived classes have a PCBNEW_SETTINGS.
873 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
874
875 if( cfg )
877
878 wxASSERT( GetCanvas() );
879
880 if( GetCanvas() )
881 {
883
884 if( rs )
885 {
888 }
889 }
890}
891
892
894{
895 if( aErrorCode >= CLEANUP_FIRST )
896 return RPT_SEVERITY_ACTION;
897
899
900 return bds.m_DRCSeverities[ aErrorCode ];
901}
902
903
905{
907
908 // Some, but not all derived classes have a PCBNEW_SETTINGS.
909 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
910
911 if( cfg )
913}
914
915
917{
918 return Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
919}
920
921
923{
924 return Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>();
925}
926
927
929{
930 switch( GetFrameType() )
931 {
932 case FRAME_PCB_EDITOR:
936 default:
937 return Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
938
942 case FRAME_CVPCB:
944 return Pgm().GetSettingsManager().GetAppSettings<CVPCB_SETTINGS>();
945 }
946}
947
948
950{
952}
953
954
955void PCB_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
956{
957 EDA_DRAW_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
958
960 PCB_RENDER_SETTINGS* renderSettings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( settings );
961
962 renderSettings->LoadColors( GetColorSettings( true ) );
963 renderSettings->LoadDisplayOptions( GetDisplayOptions() );
964
966 [&]( KIGFX::VIEW_ITEM* aItem ) -> bool
967 {
968 if( dynamic_cast<RATSNEST_VIEW_ITEM*>( aItem ) )
969 {
970 return true; // ratsnest display
971 }
972 else if( dynamic_cast<PCB_TRACK*>( aItem ) )
973 {
974 return true; // track, arc & via clearance display
975 }
976 else if( dynamic_cast<PAD*>( aItem ) )
977 {
978 return true; // pad clearance display
979 }
980
981 return false;
982 } );
983
985
987
988 // The 3D viewer isn't in the Kiway, so send its update manually
990
991 if( viewer )
992 viewer->CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
993}
994
995
997{
999
1001
1004}
1005
1006
1008{
1009 return static_cast<PCB_DRAW_PANEL_GAL*>( EDA_DRAW_FRAME::GetCanvas() );
1010}
1011
1012
1014{
1016
1017 EDA_DRAW_PANEL_GAL* canvas = GetCanvas();
1018 KIGFX::VIEW* view = canvas->GetView();
1019
1020 if( m_toolManager )
1021 {
1022 m_toolManager->SetEnvironment( m_pcb, view, canvas->GetViewControls(), config(), this );
1023
1025 }
1026
1027 KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( view->GetPainter() );
1028 KIGFX::PCB_RENDER_SETTINGS* settings = painter->GetSettings();
1029 const PCB_DISPLAY_OPTIONS& displ_opts = GetDisplayOptions();
1030
1031 settings->LoadDisplayOptions( displ_opts );
1032 settings->LoadColors( GetColorSettings() );
1033
1034 view->RecacheAllItems();
1036 canvas->StartDrawing();
1037
1038#if defined( KICAD_USE_3DCONNEXION )
1039 try
1040 {
1041 if( m_spaceMouse == nullptr )
1042 {
1044 }
1045 }
1046 catch( const std::system_error& e )
1047 {
1048 wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() );
1049 }
1050#endif
1051}
1052
1053
1054void PCB_BASE_FRAME::SetDisplayOptions( const PCB_DISPLAY_OPTIONS& aOptions, bool aRefresh )
1055{
1057 m_displayOptions = aOptions;
1058
1059 EDA_DRAW_PANEL_GAL* canvas = GetCanvas();
1060 KIGFX::PCB_VIEW* view = static_cast<KIGFX::PCB_VIEW*>( canvas->GetView() );
1061
1062 view->UpdateDisplayOptions( aOptions );
1065
1066 // Vias on a restricted layer set must be redrawn when high contrast mode is changed
1067 if( hcChanged )
1068 {
1070 []( KIGFX::VIEW_ITEM* aItem ) -> bool
1071 {
1072 if( PCB_VIA* via = dynamic_cast<PCB_VIA*>( aItem ) )
1073 {
1074 return via->GetViaType() == VIATYPE::BLIND_BURIED
1075 || via->GetViaType() == VIATYPE::MICROVIA;
1076 }
1077
1078 return false;
1079 } );
1080 }
1081
1082 if( aRefresh )
1083 canvas->Refresh();
1084}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:109
@ NORMAL
Inactive layers are shown normally (no high-contrast mode)
BOX2< VECTOR2D > BOX2D
Definition: box2.h:848
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:101
WINDOW_SETTINGS m_Window
Definition: app_settings.h:184
virtual const std::vector< wxString > DefaultGridSizeList() const
By default, this returns the list of grids available in PcbNew-based applications.
Handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:41
VECTOR2D m_LocalOrigin
Relative Screen cursor coordinate (on grid) in user units.
Definition: base_screen.h:90
void InitDataPoints(const wxSize &aPageSizeInternalUnits)
Definition: base_screen.cpp:46
void SetContentModified(bool aModified=true)
Definition: base_screen.h:59
Container for design settings for a BOARD object.
std::map< int, SEVERITY > m_DRCSeverities
void SetGridOrigin(const VECTOR2I &aOrigin)
const VECTOR2I & GetGridOrigin()
const VECTOR2I & GetAuxOrigin()
void SetDefaultZoneSettings(const ZONE_SETTINGS &aSettings)
ZONE_SETTINGS & GetDefaultZoneSettings()
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:50
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
void SetPlotOptions(const PCB_PLOT_PARAMS &aOptions)
Definition: board.h:628
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:515
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: board.cpp:686
const BOX2I GetBoardEdgesBoundingBox() const
Return the board bounding box calculated using exclusively the board edges (graphics on Edge....
Definition: board.h:821
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: board.h:807
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition: board.cpp:567
const PAGE_INFO & GetPageSettings() const
Definition: board.h:624
BOARD_ITEM * GetItem(const KIID &aID) const
Definition: board.cpp:933
TITLE_BLOCK & GetTitleBlock()
Definition: board.h:630
int GetCopperLayerCount() const
Definition: board.cpp:489
void IncrementTimeStamp()
Definition: board.cpp:216
void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: board.h:625
const PCB_PLOT_PARAMS & GetPlotOptions() const
Definition: board.h:627
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:618
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
Definition: board.h:632
void SetOrigin(const Vec &pos)
Definition: box2.h:202
const Vec & GetOrigin() const
Definition: box2.h:183
coord_type GetHeight() const
Definition: box2.h:188
coord_type GetWidth() const
Definition: box2.h:187
Vec Centre() const
Definition: box2.h:70
void SetEnd(coord_type x, coord_type y)
Definition: box2.h:255
static DELETED_BOARD_ITEM * GetInstance()
Definition: board_item.h:356
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard.
void ReloadRequest()
Request reloading the 3D view.
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification that common settings are updated.
FRAME_T GetFrameType() const
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
virtual void handleIconizeEvent(wxIconizeEvent &aEvent)
Handle a window iconize event.
wxAuiManager m_auimgr
The base class for create windows for drawing purpose.
virtual void ActivateGalCanvas()
Use to start up the GAL drawing canvas.
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
void UpdateGridSelectBox()
Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes,...
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void FocusOnLocation(const VECTOR2I &aPos)
Useful to focus on a particular location, in find functions.
void RecreateToolbars()
Rebuild all toolbars, and update the checked state of check tools.
COLOR4D m_drawBgColor
virtual void handleActivateEvent(wxActivateEvent &aEvent)
Handle a window activation event.
virtual void UpdateMsgPanel()
Redraw the message panel.
void UpdateStatusBar() override
Update the status bar information.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
void unitsChangeRefresh() override
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
std::vector< wxWindow * > findDialogs()
bool m_showBorderAndTitleBlock
bool GetShowPolarCoords() const
For those frames that support polar coordinates.
GAL_TYPE GetBackend() const
Return the type of backend currently used by GAL canvas.
virtual void SetHighContrastLayer(int aLayer)
Take care of display settings for the given layer to be displayed in high contrast mode.
KIGFX::VIEW_CONTROLS * GetViewControls() const
Return a pointer to the #VIEW_CONTROLS instance used in the panel.
virtual KIGFX::VIEW * GetView() const
Return a pointer to the #VIEW instance used in the panel.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
KIGFX::GAL * GetGAL() const
Return a pointer to the GAL instance used in the panel.
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Set a dispatcher that processes events and forwards them to tools.
void StartDrawing()
Begin drawing if it was stopped previously.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:142
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
void ClearBrightened()
Definition: eda_item.h:122
void SetBrightened()
Definition: eda_item.h:119
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:1636
void SetOrientation(const EDA_ANGLE &aNewAngle)
Definition: footprint.cpp:1766
bool IsFlipped() const
Definition: footprint.h:319
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:1553
VECTOR2I GetPosition() const override
Definition: footprint.h:192
KICAD_T Type() override
Definition: fp_lib_table.h:99
A general implementation of a COLLECTORS_GUIDE.
Definition: collectors.h:326
void SetIgnoreBlindBuriedVias(bool ignore)
Definition: collectors.h:471
void SetIgnoreTracks(bool ignore)
Definition: collectors.h:477
void SetIgnoreMTextsMarkedNoShow(bool ignore)
Definition: collectors.h:411
void SetIgnoreModulesOnFront(bool ignore)
Definition: collectors.h:435
void SetIgnoreModulesRefs(bool ignore)
Definition: collectors.h:465
void SetIgnoreMicroVias(bool ignore)
Definition: collectors.h:474
void SetIgnorePadsOnBack(bool ignore)
Definition: collectors.h:441
void SetIgnoreModulesOnBack(bool ignore)
Definition: collectors.h:429
void SetIgnoreModulesVals(bool ignore)
Definition: collectors.h:459
void SetIgnoreThroughVias(bool ignore)
Definition: collectors.h:468
void SetIgnoreThroughHolePads(bool ignore)
Definition: collectors.h:453
void SetIgnoreMTextsOnFront(bool ignore)
Definition: collectors.h:423
void SetIgnoreMTextsOnBack(bool ignore)
Definition: collectors.h:417
void SetIgnorePadsOnFront(bool ignore)
Definition: collectors.h:447
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
const VECTOR2D & GetGridSize() const
Return the grid size.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
Contains methods for drawing PCB-specific items.
Definition: pcb_painter.h:156
virtual PCB_RENDER_SETTINGS * GetSettings() override
Return a pointer to current settings that are going to be used when drawing items.
Definition: pcb_painter.h:161
PCB specific render settings.
Definition: pcb_painter.h:71
void LoadColors(const COLOR_SETTINGS *aSettings) override
void LoadDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
Load settings related to display options (high-contrast mode, full or outline modes for vias/pads/tra...
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: pcb_view.cpp:92
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Add a VIEW_ITEM to the view.
Definition: pcb_view.cpp:58
virtual void Remove(VIEW_ITEM *aItem) override
Remove a VIEW_ITEM from the view.
Definition: pcb_view.cpp:75
void UpdateDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
Definition: pcb_view.cpp:125
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
void SetGapLengthRatio(double aRatio)
void SetDashLengthRatio(double aRatio)
void SetHighlightFactor(float aFactor)
void SetSelectFactor(float aFactor)
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
An abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:77
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:69
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
Definition: view.cpp:508
bool HasItem(const VIEW_ITEM *aItem) const
Indicates whether or not the given item has been added to the view.
Definition: view.cpp:1560
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:445
void RecacheAllItems()
Rebuild GAL display lists.
Definition: view.cpp:1381
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition: view.cpp:1478
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:213
void UpdateAllItemsConditionally(int aUpdateFlags, std::function< bool(VIEW_ITEM *)> aCondition)
Update items in the view according to the given flags and condition.
Definition: view.cpp:1488
Definition: kiid.h:47
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:267
void Load(const wxString &aFileName)
Load the library table using the path defined by aFileName aFallBackTable.
The class that implements the public interface to the SpaceMouse plug-in.
void SetFocus(bool aFocus)
Set the connection to the 3Dconnexion driver to the focus state so that 3DMouse data is routed to thi...
A class to perform either relative or absolute display origin transforms for a single axis of a point...
Definition: pad.h:58
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
const wxSize GetSizeIU(double aIUScale) const
Gets the page size in internal units.
Definition: page_info.h:162
MAGNETIC_SETTINGS m_MagneticItems
SEVERITY GetSeverity(int aErrorCode) const override
virtual void OnDisplayOptionsChanged()
void FocusOnItems(std::vector< BOARD_ITEM * > aItems, PCB_LAYER_ID aLayer=UNDEFINED_LAYER)
void handleIconizeEvent(wxIconizeEvent &aEvent) override
Handle a window iconize event.
ORIGIN_TRANSFORMS & GetOriginTransforms() override
Return a reference to the default ORIGIN_TRANSFORMS object.
virtual const PCB_PLOT_PARAMS & GetPlotSettings() const
Return the PCB_PLOT_PARAMS for the BOARD owned by this frame.
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void handleActivateEvent(wxActivateEvent &aEvent) override
Handle a window activation event.
virtual void unitsChangeRefresh() override
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
EDA_ITEM * GetItem(const KIID &aId) const override
Fetch an item by KIID.
PCBNEW_SETTINGS * GetPcbNewSettings() const
virtual void SwitchLayer(PCB_LAYER_ID aLayer)
Change the active layer in the frame.
virtual PCB_LAYER_ID GetActiveLayer() const
PCB_BASE_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName)
virtual void OnModify()
Must be called after a change in order to set the "modify" flag of the current screen and update the ...
const VECTOR2I & GetAuxOrigin() const
virtual PCB_VIEWERS_SETTINGS_BASE * GetViewerSettingsBase() const
const VECTOR2I GetUserOrigin() const
virtual MAGNETIC_SETTINGS * GetMagneticItemsSettings()
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
const VECTOR2I & GetGridOrigin() const override
Return the absolute coordinates of the origin of the snap grid.
const TITLE_BLOCK & GetTitleBlock() const override
const PAGE_INFO & GetPageSettings() const override
virtual void ReCreateMenuBar() override
Recreates the menu bar.
BOX2I GetBoardBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual void ActivateGalCanvas() override
Use to start up the GAL drawing canvas.
void SetDrawBgColor(const COLOR4D &aColor) override
virtual void SetBoard(BOARD *aBoard, PROGRESS_REPORTER *aReporter=nullptr)
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
virtual void SetPageSettings(const PAGE_INFO &aPageSettings) override
NL_PCBNEW_PLUGIN * m_spaceMouse
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock) override
const ZONE_SETTINGS & GetZoneSettings() const
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SetZoneSettings(const ZONE_SETTINGS &aSettings)
BOARD * GetBoard() const
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
virtual void ShowChangedLanguage() override
Redraw the menus and what not in current language.
virtual void AddFootprintToBoard(FOOTPRINT *aFootprint)
Add the given footprint to the board.
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions, bool aRefresh=true)
Updates the current display options from the given options struct.
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide()
virtual void SetPlotSettings(const PCB_PLOT_PARAMS &aSettings)
PCB_DISPLAY_OPTIONS m_displayOptions
FOOTPRINT_EDITOR_SETTINGS * GetFootprintEditorSettings() const
void SetGridOrigin(const VECTOR2I &aPoint) override
const wxSize GetPageSizeIU() const override
Works off of GetPageSettings() to return the size of the paper page in the internal units of this par...
PCB_ORIGIN_TRANSFORMS m_originTransforms
EDA_3D_VIEWER_FRAME * CreateAndShow3D_Frame()
Shows the 3D view frame.
EDA_3D_VIEWER_FRAME * Get3DViewerFrame()
virtual void SetActiveLayer(PCB_LAYER_ID aLayer)
void DisplayGridMsg() override
Display the current grid pane on the status bar.
virtual COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
void FocusOnItem(BOARD_ITEM *aItem, PCB_LAYER_ID aLayer=UNDEFINED_LAYER)
virtual void UpdateStatusBar() override
Update the status bar information.
HIGH_CONTRAST_MODE m_ContrastModeDisplay
How inactive layers are displayed.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:51
T ToDisplayRelY(T aInternalValue) const
T ToDisplayAbsX(T aInternalValue) const
T ToDisplayRelX(T aInternalValue) const
Transform a 2-D coordinate point referenced to the internal origin to the equivalent point referenced...
T ToDisplayAbsY(T aInternalValue) const
Parameters and options when plotting/printing a board.
A progress reporter interface for use in multi-threaded environments.
virtual FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Definition: project.cpp:318
virtual const wxString FootprintLibTblName() const
Returns the path and filename of this project's footprint library table.
Definition: project.cpp:149
virtual _ELEM * GetElem(ELEM_T aIndex)
Get and set the elements for this project.
Definition: project.cpp:283
virtual void SetElem(ELEM_T aIndex, _ELEM *aElem)
Definition: project.cpp:293
@ ELEM_FPTBL
Definition: project.h:205
Represent a set of closed polygons.
void BooleanSubtract(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset intersection For aFastMode meaning, see function booleanOp.
@ CHAMFER_ACUTE_CORNERS
Acute angles are chamfered.
bool IsEmpty() const
void Deflate(int aAmount, int aCircleSegmentsCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS)
void BooleanIntersection(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset union between a and b, store the result in it self For aFastMode meaning,...
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...
int NewOutline()
Creates a new hole in a given outline.
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
Hold the information shown in the lower right corner of a plot, printout, or editing view.
Definition: title_block.h:41
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:170
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:172
@ GAL_SWITCH
Rendering engine changes.
Definition: tool_base.h:81
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Reset all tools (i.e.
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, APP_SETTINGS_BASE *aSettings, TOOLS_HOLDER *aFrame)
Set the work environment (model, view, view controls and the parent window).
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
ZONE_SETTINGS handles zones parameters.
Definition: zone_settings.h:70
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Convert the zone shape to a closed polygon Used in filling zones calculations Circles and arcs are ap...
Definition: zone.cpp:1269
SHAPE_POLY_SET * Outline()
Definition: zone.h:305
@ CLEANUP_FIRST
Definition: cleanup_item.h:33
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:299
This file is part of the common library.
FP_LIB_TABLE GFootprintTable
The global footprint library table.
Definition: cvpcb.cpp:134
#define _(s)
static constexpr EDA_ANGLE & ANGLE_0
Definition: eda_angle.h:412
#define QUALIFIED_VIEWER3D_FRAMENAME(parent)
#define IS_NEW
New item, just created.
FRAME_T
The set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition: frame_type.h:33
@ FRAME_PCB_EDITOR
Definition: frame_type.h:40
@ FRAME_FOOTPRINT_VIEWER_MODAL
Definition: frame_type.h:43
@ FRAME_CVPCB_DISPLAY
Definition: frame_type.h:49
@ FRAME_FOOTPRINT_VIEWER
Definition: frame_type.h:42
@ FRAME_FOOTPRINT_WIZARD
Definition: frame_type.h:44
@ FRAME_FOOTPRINT_PREVIEW
Definition: frame_type.h:46
@ FRAME_FOOTPRINT_EDITOR
Definition: frame_type.h:41
@ FRAME_PCB_DISPLAY3D
Definition: frame_type.h:45
@ FRAME_CVPCB
Definition: frame_type.h:48
@ ERROR_INSIDE
KIID niluuid(0)
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:823
@ LAYER_MOD_TEXT_INVISIBLE
text marked as invisible
Definition: layer_ids.h:200
@ LAYER_PAD_FR
smd pads, front layer
Definition: layer_ids.h:202
@ LAYER_MOD_TEXT
Definition: layer_ids.h:198
@ LAYER_TRACKS
Definition: layer_ids.h:212
@ LAYER_MOD_FR
show footprints on front
Definition: layer_ids.h:208
@ LAYER_PAD_BK
smd pads, back layer
Definition: layer_ids.h:203
@ LAYER_MOD_VALUES
show footprints values (when texts are visible)
Definition: layer_ids.h:210
@ LAYER_PADS_TH
multilayer pads, usually with holes
Definition: layer_ids.h:213
@ LAYER_VIAS
Meta control for all vias opacity/visibility.
Definition: layer_ids.h:193
@ LAYER_MOD_BK
show footprints on back
Definition: layer_ids.h:209
@ LAYER_MOD_REFERENCES
show footprints references (when texts are visible)
Definition: layer_ids.h:211
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
@ B_Cu
Definition: layer_ids.h:95
@ UNDEFINED_LAYER
Definition: layer_ids.h:60
@ F_Cu
Definition: layer_ids.h:64
Message panel definition file.
@ COLOR
Color has changed.
Definition: view_item.h:48
@ REPAINT
Item needs to be redrawn.
Definition: view_item.h:52
Declaration of the NL_PCBNEW_PLUGIN class.
wxDEFINE_EVENT(BOARD_CHANGED, wxCommandEvent)
@ BLIND_BURIED
@ PCB_ORIGIN_AUX
@ PCB_ORIGIN_GRID
@ PCB_ORIGIN_PAGE
see class PGM_BASE
SEVERITY
@ RPT_SEVERITY_ACTION
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111
float highlight_factor
How much to brighten highlighted objects by.
Definition: app_settings.h:119
float select_factor
How much to brighten selected objects by.
Definition: app_settings.h:120
const double IU_PER_MILS
Definition: base_units.h:78
constexpr int mmToIU(double mm) const
Definition: base_units.h:89
std::vector< wxString > sizes
Definition: app_settings.h:53
GRID_SETTINGS grid
Definition: app_settings.h:90
std::vector< double > zoom_factors
Definition: app_settings.h:87
double RAD2DEG(double rad)
Definition: trigo.h:196
@ FP_LIB_TABLE_T
Definition: typeinfo.h:235
@ PCB_FP_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition: typeinfo.h:95
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:88
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition: typeinfo.h:110
@ PCB_FP_SHAPE_T
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:94
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:107
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:102
@ PCB_FP_TEXTBOX_T
class FP_TEXTBOX, wrapped text in a footprint
Definition: typeinfo.h:93
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition: typeinfo.h:108
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:115
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
Definition: typeinfo.h:91
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition: typeinfo.h:112
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition: typeinfo.h:90
@ PCB_FP_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition: typeinfo.h:97
@ PCB_MARKER_T
class PCB_MARKER, a marker used to show something
Definition: typeinfo.h:104
@ PCB_FP_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition: typeinfo.h:99
@ PCB_FP_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:96
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition: typeinfo.h:86
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition: typeinfo.h:106
@ PCB_FP_ZONE_T
class ZONE, managed by a footprint
Definition: typeinfo.h:100
@ PCB_FP_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
Definition: typeinfo.h:98
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition: typeinfo.h:87
@ PCB_FP_TEXT_T
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:103
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:101
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
Definition: typeinfo.h:109
VECTOR2< int > VECTOR2I
Definition: vector2d.h:618
#define ZOOM_LIST_PCBNEW
Definition: zoom_defines.h:32