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-2021 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 <fp_lib_table.h>
44 #include <pcbnew_id.h>
45 #include <board.h>
46 #include <footprint.h>
47 #include <collectors.h>
48 #include <pcb_draw_panel_gal.h>
49 #include <math/vector2d.h>
50 #include <pcb_group.h>
51 
52 #include <pcb_painter.h>
54 #include <pcbnew_settings.h>
55 #include <tool/tool_manager.h>
56 #include <tool/tool_dispatcher.h>
57 #include <tools/pcb_actions.h>
58 #include <tool/grid_menu.h>
59 #include "cleanup_item.h"
60 #include <zoom_defines.h>
62 
63 
64 wxDEFINE_EVENT( BOARD_CHANGED, wxCommandEvent );
65 
66 PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
67  const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
68  long aStyle, const wxString & aFrameName ) :
69  EDA_DRAW_FRAME( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ),
70  m_pcb( nullptr ),
71  m_originTransforms( *this )
72 {
73  m_settings = static_cast<PCBNEW_SETTINGS*>( Kiface().KifaceSettings() );
74 }
75 
76 
78 {
79  // Ensure m_canvasType is up to date, to save it in config
81 
82  delete m_pcb;
83 }
84 
85 
86 bool PCB_BASE_FRAME::canCloseWindow( wxCloseEvent& aEvent )
87 {
88  // Close modeless dialogs. They're trouble when they get destroyed after the frame and/or
89  // board.
90  wxWindow* viewer3D = Get3DViewerFrame();
91 
92  if( viewer3D )
93  viewer3D->Close( true );
94 
95  return true;
96 }
97 
98 
100 {
101  wxWindow* frame = FindWindowByName( QUALIFIED_VIEWER3D_FRAMENAME( this ) );
102  return dynamic_cast<EDA_3D_VIEWER_FRAME*>( frame );
103 }
104 
105 
106 void PCB_BASE_FRAME::Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle )
107 {
108  EDA_3D_VIEWER_FRAME* draw3DFrame = Get3DViewerFrame();
109 
110  if( draw3DFrame )
111  {
112  if( aTitle )
113  draw3DFrame->SetTitle( *aTitle );
114 
115  if( aMarkDirty )
116  draw3DFrame->ReloadRequest();
117 
118  if( aRefresh )
119  draw3DFrame->Redraw();
120  }
121 }
122 
123 
125 {
126  // This is a lazy loading function, it loads the project specific table when
127  // that table is asked for, not before.
128 
130 
131  // its gotta be NULL or a FP_LIB_TABLE, or a bug.
132  wxASSERT( !tbl || tbl->Type() == FP_LIB_TABLE_T );
133 
134  if( !tbl )
135  {
136  // Stack the project specific FP_LIB_TABLE overlay on top of the global table.
137  // ~FP_LIB_TABLE() will not touch the fallback table, so multiple projects may
138  // stack this way, all using the same global fallback table.
139  tbl = new FP_LIB_TABLE( &GFootprintTable );
140 
141  SetElem( ELEM_FPTBL, tbl );
142 
143  wxString projectFpLibTableFileName = FootprintLibTblName();
144 
145  try
146  {
147  tbl->Load( projectFpLibTableFileName );
148  }
149  catch( const IO_ERROR& ioe )
150  {
151  DisplayErrorMessage( nullptr, _( "Error loading project footprint libraries." ),
152  ioe.What() );
153  }
154  catch( ... )
155  {
156  DisplayErrorMessage( nullptr, _( "Error loading project footprint library table." ) );
157  }
158  }
159 
160  return tbl;
161 }
162 
163 
165 {
166  if( m_pcb != aBoard )
167  {
168  delete m_pcb;
169  m_pcb = aBoard;
170 
171  wxCommandEvent e( BOARD_CHANGED );
172  ProcessEventLocally( e );
173  }
174 }
175 
176 
178 {
179  if( aFootprint )
180  {
181  GetBoard()->Add( aFootprint, ADD_MODE::APPEND );
182 
183  aFootprint->SetFlags( IS_NEW );
184  aFootprint->SetPosition( wxPoint( 0, 0 ) ); // cursor in GAL may not be initialized yet
185 
186  // Put it on FRONT layer (note that it might be stored flipped if the lib is an archive
187  // built from a board)
188  if( aFootprint->IsFlipped() )
189  aFootprint->Flip( aFootprint->GetPosition(), m_settings->m_FlipLeftRight );
190 
191  // Place it in orientation 0 even if it is not saved with orientation 0 in lib (note that
192  // it might be stored in another orientation if the lib is an archive built from a board)
193  aFootprint->SetOrientation( 0 );
194  }
195 }
196 
197 
199 {
200  return GetBoard()->GetItem( aId );
201 }
202 
203 
205 {
206  std::vector<BOARD_ITEM*> items;
207 
208  if( aItem )
209  items.push_back( aItem );
210 
211  FocusOnItems( items, aLayer );
212 }
213 
214 
215 void PCB_BASE_FRAME::FocusOnItems( std::vector<BOARD_ITEM*> aItems, PCB_LAYER_ID aLayer )
216 {
217  static std::vector<KIID> lastBrightenedItemIDs;
218 
219  BOARD_ITEM* lastItem = nullptr;
220 
221  for( KIID lastBrightenedItemID : lastBrightenedItemIDs )
222  {
225  #if BOOST_VERSION >= 106700
226  try
227  {
228  lastItem = GetBoard()->GetItem( lastBrightenedItemID );
229  }
230  catch( const boost::uuids::entropy_error& )
231  {
232  wxLogError( wxT( "A Boost UUID entropy exception was thrown in %s:%s." ),
233  __FILE__, __FUNCTION__ );
234  }
235  #else
236  lastItem = GetBoard()->GetItem( lastBrightenedItemID );
237  #endif
238 
239  if( lastItem && lastItem != DELETED_BOARD_ITEM::GetInstance() )
240  {
241  lastItem->ClearBrightened();
242 
243  if( lastItem->Type() == PCB_FOOTPRINT_T )
244  {
245  static_cast<FOOTPRINT*>( lastItem )->RunOnChildren(
246  [&]( BOARD_ITEM* child )
247  {
248  child->ClearBrightened();
249  } );
250  }
251  else if( lastItem->Type() == PCB_GROUP_T )
252  {
253  static_cast<PCB_GROUP*>( lastItem )->RunOnChildren(
254  [&]( BOARD_ITEM* child )
255  {
256  child->ClearBrightened();
257  } );
258  }
259 
260  GetCanvas()->GetView()->Update( lastItem );
261  lastBrightenedItemID = niluuid;
262  GetCanvas()->Refresh();
263  }
264  }
265 
266  lastBrightenedItemIDs.clear();
267 
268  if( aItems.empty() )
269  return;
270 
271  wxPoint focusPt;
272  KIGFX::VIEW* view = GetCanvas()->GetView();
273  SHAPE_POLY_SET viewportPoly( view->GetViewport() );
274 
275  for( wxWindow* dialog : findDialogs() )
276  {
277  wxPoint dialogPos = GetCanvas()->ScreenToClient( dialog->GetScreenPosition() );
278  SHAPE_POLY_SET dialogPoly( BOX2D( view->ToWorld( dialogPos, true ),
279  view->ToWorld( dialog->GetSize(), false ) ) );
280 
281  try
282  {
283  viewportPoly.BooleanSubtract( dialogPoly, SHAPE_POLY_SET::PM_FAST );
284  }
285  catch( const ClipperLib::clipperException& exc )
286  {
287  // This may be overkill and could be an assertion but we are more likely to
288  // find any clipper errors this way.
289  wxLogError( wxT( "Clipper library exception '%s' occurred." ), exc.what() );
290  }
291  }
292 
293  SHAPE_POLY_SET itemPoly, clippedPoly;
294 
295  for( BOARD_ITEM* item : aItems )
296  {
297  if( item && item != DELETED_BOARD_ITEM::GetInstance() )
298  {
299  item->SetBrightened();
300 
301  if( item->Type() == PCB_FOOTPRINT_T )
302  {
303  static_cast<FOOTPRINT*>( item )->RunOnChildren(
304  [&]( BOARD_ITEM* child )
305  {
306  child->SetBrightened();
307  });
308  }
309  else if( item->Type() == PCB_GROUP_T )
310  {
311  static_cast<PCB_GROUP*>( item )->RunOnChildren(
312  [&]( BOARD_ITEM* child )
313  {
314  child->SetBrightened();
315  });
316  }
317 
318  GetCanvas()->GetView()->Update( item );
319  lastBrightenedItemIDs.push_back( item->m_Uuid );
320 
321  // Focus on the object's location. Prefer a visible part of the object to its anchor
322  // in order to keep from scrolling around.
323 
324  focusPt = item->GetPosition();
325 
326  if( aLayer == UNDEFINED_LAYER )
327  aLayer = item->GetLayerSet().Seq()[0];
328 
329  switch( item->Type() )
330  {
331  case PCB_FOOTPRINT_T:
332  try
333  {
334  itemPoly = static_cast<FOOTPRINT*>( item )->GetBoundingHull();
335  }
336  catch( const ClipperLib::clipperException& exc )
337  {
338  // This may be overkill and could be an assertion but we are more likely to
339  // find any clipper errors this way.
340  wxLogError( wxT( "Clipper library exception '%s' occurred." ), exc.what() );
341  }
342 
343  break;
344 
345  case PCB_PAD_T:
346  case PCB_MARKER_T:
347  case PCB_VIA_T:
348  FocusOnLocation( item->GetFocusPosition() );
349  GetCanvas()->Refresh();
350  return;
351 
352  case PCB_SHAPE_T:
353  case PCB_TEXT_T:
354  case PCB_FP_TEXT_T:
355  case PCB_FP_SHAPE_T:
356  case PCB_FP_ZONE_T:
357  case PCB_TRACE_T:
358  case PCB_ARC_T:
359  case PCB_DIMENSION_T:
360  case PCB_DIM_ALIGNED_T:
361  case PCB_DIM_LEADER_T:
362  case PCB_DIM_CENTER_T:
364  item->TransformShapeWithClearanceToPolygon( itemPoly, aLayer, 0, Millimeter2iu( 0.1 ),
365  ERROR_INSIDE );
366  break;
367 
368  case PCB_ZONE_T:
369  {
370  ZONE* zone = static_cast<ZONE*>( item );
371  #if 0
372  // Using the filled area shapes to find a Focus point can give good results, but
373  // unfortunately the calculations are highly time consuming, even for not very
374  // large areas (can be easily a few minutes for large areas).
375  // so we used only the zone outline that usually do not have too many vertices.
376  zone->TransformShapeWithClearanceToPolygon( itemPoly, aLayer, 0, Millimeter2iu( 0.1 ),
377  ERROR_INSIDE );
378 
379  if( itemPoly.IsEmpty() )
380  itemPoly = *zone->Outline();
381  #else
382  // much faster calculation time when using only the zone outlines
383  itemPoly = *zone->Outline();
384  #endif
385 
386  break;
387  }
388 
389  default:
390  {
391  BOX2I item_bbox = item->GetBoundingBox();
392  itemPoly.NewOutline();
393  itemPoly.Append( item_bbox.GetOrigin() );
394  itemPoly.Append( item_bbox.GetOrigin() + VECTOR2I( item_bbox.GetWidth(), 0 ) );
395  itemPoly.Append( item_bbox.GetOrigin() + VECTOR2I( 0, item_bbox.GetHeight() ) );
396  itemPoly.Append( item_bbox.GetOrigin() + VECTOR2I( item_bbox.GetWidth(),
397  item_bbox.GetHeight() ) );
398  break;
399  }
400  }
401 
402  try
403  {
404  clippedPoly.BooleanIntersection( itemPoly, viewportPoly, SHAPE_POLY_SET::PM_FAST );
405  }
406  catch( const ClipperLib::clipperException& exc )
407  {
408  // This may be overkill and could be an assertion but we are more likely to
409  // find any clipper errors this way.
410  wxLogError( wxT( "Clipper library exception '%s' occurred." ), exc.what() );
411  }
412 
413  if( !clippedPoly.IsEmpty() )
414  itemPoly = clippedPoly;
415  }
416  }
417 
418  /*
419  * Perform a step-wise deflate to find the visual-center-of-mass
420  */
421 
422  BOX2I bbox = itemPoly.BBox();
423  int step = std::min( bbox.GetWidth(), bbox.GetHeight() ) / 10;
424 
425  while( !itemPoly.IsEmpty() )
426  {
427  focusPt = (wxPoint) itemPoly.BBox().Centre();
428 
429  try
430  {
431  itemPoly.Deflate( step, 4, SHAPE_POLY_SET::CHAMFER_ACUTE_CORNERS );
432  }
433  catch( const ClipperLib::clipperException& exc )
434  {
435  // This may be overkill and could be an assertion but we are more likely to
436  // find any clipper errors this way.
437  wxLogError( wxT( "Clipper library exception '%s' occurred." ), exc.what() );
438  }
439  }
440 
441  FocusOnLocation( focusPt );
442 
443  GetCanvas()->Refresh();
444 }
445 
446 
447 void PCB_BASE_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
448 {
449  m_pcb->SetPageSettings( aPageSettings );
450 
451  if( GetScreen() )
452  GetScreen()->InitDataPoints( aPageSettings.GetSizeIU() );
453 }
454 
455 
457 {
458  return m_pcb->GetPageSettings();
459 }
460 
461 
462 const wxSize PCB_BASE_FRAME::GetPageSizeIU() const
463 {
464  // this function is only needed because EDA_DRAW_FRAME is not compiled
465  // with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
466  // into an application specific source file.
467  return m_pcb->GetPageSettings().GetSizeIU();
468 }
469 
470 
471 const wxPoint& PCB_BASE_FRAME::GetGridOrigin() const
472 {
474 }
475 
476 
477 void PCB_BASE_FRAME::SetGridOrigin( const wxPoint& aPoint )
478 {
480 }
481 
482 
483 const wxPoint& PCB_BASE_FRAME::GetAuxOrigin() const
484 {
486 }
487 
488 
489 const wxPoint PCB_BASE_FRAME::GetUserOrigin() const
490 {
491  auto& displ_opts = GetDisplayOptions();
492  wxPoint origin( 0, 0 );
493 
494  switch( displ_opts.m_DisplayOrigin )
495  {
497  case PCB_DISPLAY_OPTIONS::PCB_ORIGIN_AUX: origin = GetAuxOrigin(); break;
498  case PCB_DISPLAY_OPTIONS::PCB_ORIGIN_GRID: origin = GetGridOrigin(); break;
499  default: wxASSERT( false ); break;
500  }
501 
502  return origin;
503 }
504 
506 {
507  return m_originTransforms;
508 }
509 
510 
512 {
513  return m_pcb->GetTitleBlock();
514 }
515 
516 
517 void PCB_BASE_FRAME::SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
518 {
519  m_pcb->SetTitleBlock( aTitleBlock );
520 }
521 
522 
524 {
525  return m_pcb->GetDesignSettings();
526 }
527 
528 
530 {
531  m_drawBgColor= aColor;
532  m_auimgr.Update();
533 }
534 
535 
537 {
539 }
540 
541 
543 {
545 }
546 
547 
549 {
550  return m_pcb->GetPlotOptions();
551 }
552 
553 
555 {
556  m_pcb->SetPlotOptions( aSettings );
557 }
558 
559 
560 EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
561 {
562  EDA_RECT area = aBoardEdgesOnly ? m_pcb->GetBoardEdgesBoundingBox() : m_pcb->GetBoundingBox();
563 
564  if( area.GetWidth() == 0 && area.GetHeight() == 0 )
565  {
566  wxSize pageSize = GetPageSizeIU();
567 
569  {
570  area.SetOrigin( 0, 0 );
571  area.SetEnd( pageSize.x, pageSize.y );
572  }
573  else
574  {
575  area.SetOrigin( -pageSize.x / 2, -pageSize.y / 2 );
576  area.SetEnd( pageSize.x / 2, pageSize.y / 2 );
577  }
578  }
579 
580  return area;
581 }
582 
583 
584 // Virtual function
586 {
587 }
588 
589 
591 {
592  // call my base class
594 
595  // tooltips in toolbars
597 
598  // status bar
599  UpdateMsgPanel();
600 }
601 
602 
604 {
605  EDA_3D_VIEWER_FRAME* draw3DFrame = Get3DViewerFrame();
606 
607  if( !draw3DFrame )
608  draw3DFrame = new EDA_3D_VIEWER_FRAME( &Kiway(), this, _( "3D Viewer" ) );
609 
610  // Raising the window does not show the window on Windows if iconized. This should work
611  // on any platform.
612  if( draw3DFrame->IsIconized() )
613  draw3DFrame->Iconize( false );
614 
615  draw3DFrame->Raise();
616  draw3DFrame->Show( true );
617 
618  // Raising the window does not set the focus on Linux. This should work on any platform.
619  if( wxWindow::FindFocus() != draw3DFrame )
620  draw3DFrame->SetFocus();
621 
622  // Allocate a slice of time to display the 3D frame
623  // a call to wxSafeYield() should be enough (and better), but on Linux we need
624  // to call wxYield()
625  // otherwise the activity messages are not displayed during the first board loading
626  wxYield();
627 
628  // Note, the caller is responsible to load/update the board 3D view.
629  // after frame creation the board is not automatically created.
630 
631  return draw3DFrame;
632 }
633 
634 
636 {
637  PCB_LAYER_ID preslayer = GetActiveLayer();
638  auto& displ_opts = GetDisplayOptions();
639 
640  // Check if the specified layer matches the present layer
641  if( layer == preslayer )
642  return;
643 
644  // Copper layers cannot be selected unconditionally; how many of those layers are
645  // currently enabled needs to be checked.
646  if( IsCopperLayer( layer ) )
647  {
648  // If only one copper layer is enabled, the only such layer that can be selected to
649  // is the "Copper" layer (so the selection of any other copper layer is disregarded).
650  if( m_pcb->GetCopperLayerCount() < 2 )
651  {
652  if( layer != B_Cu )
653  return;
654  }
655 
656  // If more than one copper layer is enabled, the "Copper" and "Component" layers
657  // can be selected, but the total number of copper layers determines which internal
658  // layers are also capable of being selected.
659  else
660  {
661  if( layer != B_Cu && layer != F_Cu && layer >= ( m_pcb->GetCopperLayerCount() - 1 ) )
662  return;
663  }
664  }
665 
666  // Is yet more checking required? E.g. when the layer to be selected is a non-copper
667  // layer, or when switching between a copper layer and a non-copper layer, or vice-versa?
668  // ...
669 
670  SetActiveLayer( layer );
671 
672  if( displ_opts.m_ContrastModeDisplay != HIGH_CONTRAST_MODE::NORMAL )
673  GetCanvas()->Refresh();
674 }
675 
676 
678 {
680  GetCanvas()->GetView() );
681 
682  // account for the globals
684  guide.SetIgnoreMTextsOnBack( ! m_pcb->IsElementVisible( LAYER_MOD_TEXT ) );
685  guide.SetIgnoreMTextsOnFront( ! m_pcb->IsElementVisible( LAYER_MOD_TEXT ) );
686  guide.SetIgnoreModulesOnBack( ! m_pcb->IsElementVisible( LAYER_MOD_BK ) );
687  guide.SetIgnoreModulesOnFront( ! m_pcb->IsElementVisible( LAYER_MOD_FR ) );
688  guide.SetIgnorePadsOnBack( ! m_pcb->IsElementVisible( LAYER_PAD_BK ) );
689  guide.SetIgnorePadsOnFront( ! m_pcb->IsElementVisible( LAYER_PAD_FR ) );
690  guide.SetIgnoreThroughHolePads( ! m_pcb->IsElementVisible( LAYER_PADS_TH ) );
691  guide.SetIgnoreModulesVals( ! m_pcb->IsElementVisible( LAYER_MOD_VALUES ) );
692  guide.SetIgnoreModulesRefs( ! m_pcb->IsElementVisible( LAYER_MOD_REFERENCES ) );
693  guide.SetIgnoreThroughVias( ! m_pcb->IsElementVisible( LAYER_VIAS ) );
694  guide.SetIgnoreBlindBuriedVias( ! m_pcb->IsElementVisible( LAYER_VIAS ) );
695  guide.SetIgnoreMicroVias( ! m_pcb->IsElementVisible( LAYER_VIAS ) );
696  guide.SetIgnoreTracks( ! m_pcb->IsElementVisible( LAYER_TRACKS ) );
697 
698  return guide;
699 }
700 
701 
703 {
704  VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize();
705  wxString line;
706 
707  line.Printf( wxT( "grid X %s Y %s" ),
708  MessageTextFromValue( m_userUnits, gridSize.x, false ),
709  MessageTextFromValue( m_userUnits, gridSize.y, false ) );
710 
711  SetStatusText( line, 4 );
712 }
713 
714 
716 {
718 
719  BASE_SCREEN* screen = GetScreen();
720 
721  if( !screen )
722  return;
723 
724  wxString line;
726 
727  if( GetShowPolarCoords() ) // display polar coordinates
728  {
729  double dx = cursorPos.x - screen->m_LocalOrigin.x;
730  double dy = cursorPos.y - screen->m_LocalOrigin.y;
731  double theta = RAD2DEG( atan2( -dy, dx ) );
732  double ro = hypot( dx, dy );
733 
734  line.Printf( wxT( "r %s theta %.3f" ),
735  MessageTextFromValue( GetUserUnits(), ro, false ), theta );
736 
737  SetStatusText( line, 3 );
738  }
739 
740  // Transform absolute coordinates for user origin preferences
741  double userXpos = m_originTransforms.ToDisplayAbsX( static_cast<double>( cursorPos.x ) );
742  double userYpos = m_originTransforms.ToDisplayAbsY( static_cast<double>( cursorPos.y ) );
743 
744  // Display absolute coordinates:
745  line.Printf( wxT( "X %s Y %s" ),
746  MessageTextFromValue( GetUserUnits(), userXpos, false ),
747  MessageTextFromValue( GetUserUnits(), userYpos, false ) );
748  SetStatusText( line, 2 );
749 
750  if( !GetShowPolarCoords() ) // display relative cartesian coordinates
751  {
752  // Calculate relative coordinates
753  double relXpos = cursorPos.x - screen->m_LocalOrigin.x;
754  double relYpos = cursorPos.y - screen->m_LocalOrigin.y;
755 
756  // Transform relative coordinates for user origin preferences
757  userXpos = m_originTransforms.ToDisplayRelX( relXpos );
758  userYpos = m_originTransforms.ToDisplayRelY( relYpos );
759 
760  line.Printf( wxT( "dx %s dy %s dist %s" ),
761  MessageTextFromValue( GetUserUnits(), userXpos, false ),
762  MessageTextFromValue( GetUserUnits(), userYpos, false ),
763  MessageTextFromValue( GetUserUnits(), hypot( userXpos, userYpos ), false ) );
764  SetStatusText( line, 3 );
765  }
766 
767  DisplayGridMsg();
768 }
769 
770 
772 {
773  EDA_DRAW_FRAME::unitsChangeRefresh(); // Update the status bar.
774 
776 }
777 
778 
780 {
782 
783  if( aCfg->m_Window.grid.sizes.empty() )
784  aCfg->m_Window.grid.sizes = aCfg->DefaultGridSizeList();
785 
786  // Currently values read from config file are not used because the user cannot
787  // change this config
788  // if( aCfg->m_Window.zoom_factors.empty() )
789  {
791  }
792 
793  // Some, but not all derived classes have a PCBNEW_SETTINGS.
794  PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
795 
796  if( cfg )
797  {
800  }
801 
802  wxASSERT( GetCanvas() );
803 
804  if( GetCanvas() )
805  {
807 
808  if( rs )
809  {
813  }
814  }
815 }
816 
817 
818 SEVERITY PCB_BASE_FRAME::GetSeverity( int aErrorCode ) const
819 {
820  if( aErrorCode >= CLEANUP_FIRST )
821  return RPT_SEVERITY_ACTION;
822 
824 
825  return bds.m_DRCSeverities[ aErrorCode ];
826 }
827 
828 
830 {
832 
833  // Some, but not all derived classes have a PCBNEW_SETTINGS.
834  PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
835 
836  if( cfg )
837  {
840  }
841 }
842 
843 
845 {
846  return Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
847 }
848 
849 
851 {
852  return Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>();
853 }
854 
855 
857 {
858  wxCHECK( m_settings, nullptr );
859  return &m_settings->m_MagneticItems;
860 }
861 
862 
863 void PCB_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
864 {
865  EDA_DRAW_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
866 
868 
870  [&]( KIGFX::VIEW_ITEM* aItem ) -> bool
871  {
872  if( dynamic_cast<RATSNEST_VIEW_ITEM*>( aItem ) )
873  {
874  return true; // ratsnest display
875  }
876  else if( dynamic_cast<PCB_TRACK*>( aItem ) )
877  {
878  return true; // track, arc & via clearance display
879  }
880  else if( dynamic_cast<PAD*>( aItem ) )
881  {
882  return true; // pad clearance display
883  }
884 
885  return false;
886  } );
887 
889 
891 
892  // The 3D viewer isn't in the Kiway, so send its update manually
894 
895  if( viewer )
896  viewer->CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
897 }
898 
899 
901 {
903 
905 
906  UpdateStatusBar();
907  UpdateMsgPanel();
908 }
909 
910 
912 {
913  return static_cast<PCB_DRAW_PANEL_GAL*>( EDA_DRAW_FRAME::GetCanvas() );
914 }
915 
916 
918 {
920 
921  EDA_DRAW_PANEL_GAL* canvas = GetCanvas();
922  KIGFX::VIEW* view = canvas->GetView();
923 
924  if( m_toolManager )
925  {
926  m_toolManager->SetEnvironment( m_pcb, view, canvas->GetViewControls(), config(), this );
927 
929  }
930 
931  KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( view->GetPainter() );
932  KIGFX::PCB_RENDER_SETTINGS* settings = painter->GetSettings();
933  const PCB_DISPLAY_OPTIONS& displ_opts = GetDisplayOptions();
934 
935  settings->LoadDisplayOptions( displ_opts, ShowPageLimits() );
936  settings->LoadColors( GetColorSettings() );
937 
938  view->RecacheAllItems();
940  canvas->StartDrawing();
941 }
942 
943 
944 void PCB_BASE_FRAME::SetDisplayOptions( const PCB_DISPLAY_OPTIONS& aOptions, bool aRefresh )
945 {
946  bool hcChanged = m_displayOptions.m_ContrastModeDisplay != aOptions.m_ContrastModeDisplay;
947  m_displayOptions = aOptions;
948 
949  EDA_DRAW_PANEL_GAL* canvas = GetCanvas();
950  KIGFX::PCB_VIEW* view = static_cast<KIGFX::PCB_VIEW*>( canvas->GetView() );
951 
952  view->UpdateDisplayOptions( aOptions );
955 
956  // Vias on a restricted layer set must be redrawn when high contrast mode is changed
957  if( hcChanged )
958  {
960  []( KIGFX::VIEW_ITEM* aItem ) -> bool
961  {
962  if( PCB_VIA* via = dynamic_cast<PCB_VIA*>( aItem ) )
963  {
964  return via->GetViaType() == VIATYPE::BLIND_BURIED
965  || via->GetViaType() == VIATYPE::MICROVIA;
966  }
967 
968  return false;
969  } );
970  }
971 
972  if( aRefresh )
973  canvas->Refresh();
974 }
BOARD_ITEM * GetItem(const KIID &aID) const
Definition: board.cpp:845
#define ZOOM_LIST_PCBNEW
Definition: zoom_defines.h:32
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: board.h:724
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:104
smd pads, front layer
Definition: layer_ids.h:209
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
Definition: view.cpp:512
virtual void ShowChangedLanguage() override
Redraw the menus and what not in current language.
const PAGE_INFO & GetPageSettings() const
Definition: board.h:536
virtual void SetHighContrastLayer(int aLayer)
Take care of display settings for the given layer to be displayed in high contrast mode.
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition: typeinfo.h:100
void DisplayGridMsg() override
Display the current grid pane on the status bar.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
const PCB_PLOT_PARAMS & GetPlotOptions() const
Definition: board.h:539
void SetDrawBgColor(const COLOR4D &aColor) override
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:101
virtual void unitsChangeRefresh() override
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
KIID niluuid(0)
wxDEFINE_EVENT(BOARD_CHANGED, wxCommandEvent)
KIGFX::VIEW_CONTROLS * GetViewControls() const
Return a pointer to the #VIEW_CONTROLS instance used in the panel.
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92
FP_LIB_TABLE GFootprintTable
The global footprint library table.
Definition: cvpcb.cpp:134
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:1492
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:292
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
void SetGridOrigin(const wxPoint &aPoint) override
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
EDA_3D_VIEWER_FRAME * Get3DViewerFrame()
#define IS_NEW
New item, just created.
virtual void OnDisplayOptionsChanged()
Implementation of conversion functions that require both schematic and board internal units.
This file is part of the common library.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
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:449
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:108
void SetDefaultZoneSettings(const ZONE_SETTINGS &aSettings)
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
Definition: board.h:544
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
const EDA_RECT GetBoardEdgesBoundingBox() const
Return the board bounding box calculated using exclusively the board edges (graphics on Edge....
Definition: board.h:738
show footprints values (when texts are visible)
Definition: layer_ids.h:217
FOOTPRINT_EDITOR_SETTINGS * GetFootprintEditorSettings() const
A progress reporter interface for use in multi-threaded environments.
FRAME_T
The set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition: frame_type.h:32
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition: typeinfo.h:102
SHAPE_POLY_SET * Outline()
Definition: zone.h:320
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: board.h:537
smd pads, back layer
Definition: layer_ids.h:210
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
bool IsEmpty() const
void RecacheAllItems()
Rebuild GAL display lists.
Definition: view.cpp:1385
double RAD2DEG(double rad)
Definition: trigo.h:230
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition: view.cpp:1482
const wxPoint & GetGridOrigin() const override
Return the absolute coordinates of the origin of the snap grid.
BOX2< VECTOR2D > BOX2D
Definition: box2.h:507
int GetWidth() const
Definition: eda_rect.h:118
void SetBrightened()
Definition: eda_item.h:129
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:152
void RecreateToolbars()
Rebuild all toolbars, and update the checked state of check tools.
class PCB_TEXT, text on a layer
Definition: typeinfo.h:91
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification that common settings are updated.
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:481
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:97
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:130
const wxPoint GetUserOrigin() const
T ToDisplayRelX(T aInternalValue) const
Transform a 2-D coordinate point referenced to the internal origin to the equivalent point referenced...
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
class PAD, a pad in a footprint
Definition: typeinfo.h:89
show footprints on back
Definition: layer_ids.h:216
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock) override
wxAuiManager m_auimgr
virtual MAGNETIC_SETTINGS * GetMagneticItemsSettings()
virtual _ELEM * GetElem(ELEM_T aIndex)
Get and set the elements for this project.
Definition: project.cpp:246
An abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:76
Color has changed.
Definition: view_item.h:48
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
PCB_BASE_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName)
The base class for create windows for drawing purpose.
const wxPoint & GetGridOrigin()
VECTOR2< int > VECTOR2I
Definition: vector2d.h:622
virtual const PCB_PLOT_PARAMS & GetPlotSettings() const
Return the PCB_PLOT_PARAMS for the BOARD owned by this frame.
Contains methods for drawing PCB-specific items.
Definition: pcb_painter.h:241
PCBNEW_SETTINGS * m_settings
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106
COLOR4D m_drawBgColor
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
Hold the information shown in the lower right corner of a plot, printout, or editing view.
Definition: title_block.h:40
float high_contrast_factor
How much to darken inactive layers by.
Definition: app_settings.h:118
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
std::vector< double > zoom_factors
Definition: app_settings.h:86
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:208
SEVERITY GetSeverity(int aErrorCode) const override
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
bool ShowPageLimits() const
virtual void SetElem(ELEM_T aIndex, _ELEM *aElem)
Definition: project.cpp:258
void ClearBrightened()
Definition: eda_item.h:132
Classes used in Pcbnew, CvPcb and GerbView.
virtual COLOR_SETTINGS * GetColorSettings() const override
Helper to retrieve the current color settings.
virtual PCB_LAYER_ID GetActiveLayer() const
void UpdateGridSelectBox()
Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes,...
void InitDataPoints(const wxSize &aPageSizeInternalUnits)
Definition: base_screen.cpp:46
PCB_DISPLAY_OPTIONS m_displayOptions
PCB specific render settings.
Definition: pcb_painter.h:64
void unitsChangeRefresh() override
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
virtual void SwitchLayer(PCB_LAYER_ID aLayer)
Change the active layer in the frame.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Adds an item to the container.
Definition: board.cpp:608
Definition: kiid.h:44
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions, bool aRefresh=true)
Updates the current display options from the given options struct.
Container for display options like enable/disable some optional drawings.
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
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide()
void SetHighContrastFactor(float aFactor)
Item needs to be redrawn.
Definition: view_item.h:52
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
std::vector< wxString > sizes
Definition: app_settings.h:52
void UpdateDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
Definition: pcb_view.cpp:125
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:99
virtual void ActivateGalCanvas() override
Use to start up the GAL drawing canvas.
Meta control for all vias opacity/visibility.
Definition: layer_ids.h:200
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
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:247
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard.
GRID_SETTINGS grid
Definition: app_settings.h:89
T ToDisplayAbsY(T aInternalValue) const
Represent a set of closed polygons.
static DELETED_BOARD_ITEM * GetInstance()
Definition: board_item.h:348
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:53
bool m_showBorderAndTitleBlock
Handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:40
void SetEnd(int x, int y)
Definition: eda_rect.h:191
EDA_ITEM * GetItem(const KIID &aId) const override
Fetch an item by KIID.
void SetOrientation(double aNewAngle)
Definition: footprint.cpp:1681
coord_type GetWidth() const
Definition: box2.h:180
const ZONE_SETTINGS & GetZoneSettings() const
Inactive layers are shown normally (no high-contrast mode)
void FocusOnItems(std::vector< BOARD_ITEM * > aItems, PCB_LAYER_ID aLayer=UNDEFINED_LAYER)
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:1491
text marked as invisible
Definition: layer_ids.h:207
void Deflate(int aAmount, int aCircleSegmentsCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS)
show footprints on front
Definition: layer_ids.h:215
T ToDisplayRelY(T aInternalValue) const
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Reset all tools (i.e.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:260
KIGFX::GAL * GetGAL() const
Return a pointer to the GAL instance used in the panel.
#define _(s)
virtual KIGFX::VIEW * GetView() const
Return a pointer to the #VIEW instance used in the panel.
HIGH_CONTRAST_MODE m_ContrastModeDisplay
How inactive layers are displayed.
virtual void SetPlotSettings(const PCB_PLOT_PARAMS &aSettings)
EDA_RECT GetBoardBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
float select_factor
How much to brighten selected objects by.
Definition: app_settings.h:117
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
class ZONE, a copper pour area
Definition: typeinfo.h:105
void SetPlotOptions(const PCB_PLOT_PARAMS &aOptions)
Definition: board.h:540
virtual void SetActiveLayer(PCB_LAYER_ID aLayer)
virtual void ActivateGalCanvas()
Use to start up the GAL drawing canvas.
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.
SEVERITY
void SetIgnoreMTextsMarkedNoShow(bool ignore)
Definition: collectors.h:499
virtual void ReCreateMenuBar() override
Recreates the menu bar.
void Load(const wxString &aFileName)
Load the library table using the path defined by aFileName aFallBackTable.
Parameters and options when plotting/printing a board.
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,...
void IncrementTimeStamp()
Definition: board.cpp:192
class PCB_DIMENSION_BASE: abstract dimension meta-type
Definition: typeinfo.h:99
int NewOutline()
Creates a new hole in a given outline.
Acute angles are chamfered.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void StartDrawing()
Begin drawing if it was stopped previously.
KICAD_T Type() override
Definition: fp_lib_table.h:99
int GetHeight() const
Definition: eda_rect.h:119
void FocusOnItem(BOARD_ITEM *aItem, PCB_LAYER_ID aLayer=UNDEFINED_LAYER)
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:808
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:160
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
ZONE_SETTINGS handles zones parameters.
Definition: zone_settings.h:67
virtual FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Definition: project.cpp:283
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition: board.cpp:533
void SetContentModified(bool aModified=true)
Definition: base_screen.h:59
const VECTOR2D & GetGridSize() const
Return the grid size.
bool IsFlipped() const
Definition: footprint.h:278
show footprints references (when texts are visible)
Definition: layer_ids.h:218
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
const TITLE_BLOCK & GetTitleBlock() const override
WINDOW_SETTINGS m_Window
Definition: app_settings.h:181
virtual void OnModify()
Must be called after a change in order to set the "modify" flag of the current screen and update the ...
virtual void UpdateStatusBar() override
Update the status bar information.
float highlight_factor
How much to brighten highlighted objects by.
Definition: app_settings.h:116
void ReloadRequest()
Request reloading the 3D view.
class PCB_MARKER, a marker used to show something
Definition: typeinfo.h:98
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:158
TITLE_BLOCK & GetTitleBlock()
Definition: board.h:542
see class PGM_BASE
bool GetShowPolarCoords() const
For those frames that support polar coordinates.
multilayer pads, usually with holes
Definition: layer_ids.h:220
Vec Centre() const
Definition: box2.h:63
const wxPoint & GetAuxOrigin()
A class to perform either relative or absolute display origin transforms for a single axis of a point...
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
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).
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Set a dispatcher that processes events and forwards them to tools.
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
ORIGIN_TRANSFORMS & GetOriginTransforms() override
Return a reference to the default ORIGIN_TRANSFORMS object.
std::map< int, SEVERITY > m_DRCSeverities
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
Definition: layer_ids.h:71
std::vector< wxWindow * > findDialogs()
int GetCopperLayerCount() const
Definition: board.cpp:455
class ZONE, managed by a footprint
Definition: typeinfo.h:94
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...
Handle the component boundary box.
Definition: eda_rect.h:42
void SetSelectFactor(float aFactor)
PCBNEW_SETTINGS * GetPcbNewSettings() const
const PAGE_INFO & GetPageSettings() const override
void SetHighlightFactor(float aFactor)
EDA_UNITS m_userUnits
Map containing the UI update handlers registered with wx for each action.
virtual void AddFootprintToBoard(FOOTPRINT *aFootprint)
Add the given footprint to the board.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
coord_type GetHeight() const
Definition: box2.h:181
void SetGridOrigin(const wxPoint &aOrigin)
wxPoint GetPosition() const override
Definition: footprint.h:187
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual void SetPageSettings(const PAGE_INFO &aPageSettings) 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...
void SetZoneSettings(const ZONE_SETTINGS &aSettings)
EDA_3D_VIEWER_FRAME * CreateAndShow3D_Frame()
Shows the 3D view frame.
#define QUALIFIED_VIEWER3D_FRAMENAME(parent)
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition: typeinfo.h:103
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
GAL_TYPE GetBackend() const
Return the type of backend currently used by GAL canvas.
void UpdateStatusBar() override
Update the status bar information.
ZONE_SETTINGS & GetDefaultZoneSettings()
void BooleanSubtract(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset intersection For aFastMode meaning, see function booleanOp.
BOARD * GetBoard() const
const Vec & GetOrigin() const
Definition: box2.h:176
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
A general implementation of a COLLECTORS_GUIDE.
Definition: collectors.h:377
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:1353
MAGNETIC_SETTINGS m_MagneticItems
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void SetPosition(const wxPoint &aPos) override
Definition: footprint.cpp:1562
virtual void LoadColors(const COLOR_SETTINGS *aSettings)
T ToDisplayAbsX(T aInternalValue) const
Message panel definition file.
void FocusOnLocation(const wxPoint &aPos)
Useful to focus on a particular location, in find functions.
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
static constexpr int Millimeter2iu(double mm)
PCB_DISPLAY_OPTIONS m_Display
Rendering engine changes.
Definition: tool_base.h:81
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75
virtual const wxString FootprintLibTblName() const
Returns the path and filename of this project's footprint library table.
Definition: project.cpp:146
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
virtual const std::vector< wxString > DefaultGridSizeList() const
By default, this returns the list of grids available in PcbNew-based applications.
VECTOR2D m_LocalOrigin
Relative Screen cursor coordinate (on grid) in user units.
Definition: base_screen.h:90
PCB_ORIGIN_TRANSFORMS m_originTransforms
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
virtual void UpdateMsgPanel()
Redraw the message panel.
Container for design settings for a BOARD object.
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...
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103
const wxPoint & GetAuxOrigin() const