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, jean-pierre.charras@ujf-grenoble.fr
5  * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
6  * Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
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>
61 
62 
63 wxDEFINE_EVENT( BOARD_CHANGED, wxCommandEvent );
64 
65 PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
66  const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
67  long aStyle, const wxString & aFrameName ) :
68  EDA_DRAW_FRAME( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ),
69  m_pcb( nullptr ),
70  m_originTransforms( *this )
71 {
72  m_settings = static_cast<PCBNEW_SETTINGS*>( Kiface().KifaceSettings() );
73 }
74 
75 
77 {
78  // Ensure m_canvasType is up to date, to save it in config
80 
81  delete m_pcb;
82 }
83 
84 
85 bool PCB_BASE_FRAME::canCloseWindow( wxCloseEvent& aEvent )
86 {
87  // Close modeless dialogs. They're trouble when they get destroyed after the frame and/or
88  // board.
89  wxWindow* viewer3D = Get3DViewerFrame();
90 
91  if( viewer3D )
92  viewer3D->Close( true );
93 
94  return true;
95 }
96 
97 
99 {
100  wxWindow* frame = FindWindowByName( QUALIFIED_VIEWER3D_FRAMENAME( this ) );
101  return dynamic_cast<EDA_3D_VIEWER_FRAME*>( frame );
102 }
103 
104 
105 void PCB_BASE_FRAME::Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle )
106 {
107  EDA_3D_VIEWER_FRAME* draw3DFrame = Get3DViewerFrame();
108 
109  if( draw3DFrame )
110  {
111  if( aTitle )
112  draw3DFrame->SetTitle( *aTitle );
113 
114  if( aMarkDirty )
115  draw3DFrame->ReloadRequest();
116 
117  if( aRefresh )
118  draw3DFrame->Redraw();
119  }
120 }
121 
122 
124 {
125  // This is a lazy loading function, it loads the project specific table when
126  // that table is asked for, not before.
127 
129 
130  // its gotta be NULL or a FP_LIB_TABLE, or a bug.
131  wxASSERT( !tbl || tbl->Type() == FP_LIB_TABLE_T );
132 
133  if( !tbl )
134  {
135  // Stack the project specific FP_LIB_TABLE overlay on top of the global table.
136  // ~FP_LIB_TABLE() will not touch the fallback table, so multiple projects may
137  // stack this way, all using the same global fallback table.
138  tbl = new FP_LIB_TABLE( &GFootprintTable );
139 
140  SetElem( ELEM_FPTBL, tbl );
141 
142  wxString projectFpLibTableFileName = FootprintLibTblName();
143 
144  try
145  {
146  tbl->Load( projectFpLibTableFileName );
147  }
148  catch( const IO_ERROR& ioe )
149  {
150  DisplayErrorMessage( nullptr, _( "Error loading project footprint libraries." ),
151  ioe.What() );
152  }
153  catch( ... )
154  {
155  DisplayErrorMessage( nullptr, _( "Error loading project footprint library table." ) );
156  }
157  }
158 
159  return tbl;
160 }
161 
162 
164 {
165  if( m_pcb != aBoard )
166  {
167  delete m_pcb;
168  m_pcb = aBoard;
169 
170  wxCommandEvent e( BOARD_CHANGED );
171  ProcessEventLocally( e );
172  }
173 }
174 
175 
177 {
178  if( aFootprint )
179  {
180  GetBoard()->Add( aFootprint, ADD_MODE::APPEND );
181 
182  aFootprint->SetFlags( IS_NEW );
183  aFootprint->SetPosition( wxPoint( 0, 0 ) ); // cursor in GAL may not be initialized yet
184 
185  // Put it on FRONT layer (note that it might be stored flipped if the lib is an archive
186  // built from a board)
187  if( aFootprint->IsFlipped() )
188  aFootprint->Flip( aFootprint->GetPosition(), m_settings->m_FlipLeftRight );
189 
190  // Place it in orientation 0 even if it is not saved with orientation 0 in lib (note that
191  // it might be stored in another orientation if the lib is an archive built from a board)
192  aFootprint->SetOrientation( 0 );
193  }
194 }
195 
196 
198 {
199  return GetBoard()->GetItem( aId );
200 }
201 
202 
204 {
205  static KIID lastBrightenedItemID( niluuid );
206 
207  BOARD_ITEM* lastItem = nullptr;
208 
211 #if BOOST_VERSION >= 106700
212  try
213  {
214  lastItem = GetBoard()->GetItem( lastBrightenedItemID );
215  }
216  catch( const boost::uuids::entropy_error& )
217  {
218  wxLogError( "A Boost UUID entropy exception was thrown in %s:%s.", __FILE__, __FUNCTION__ );
219  }
220 #else
221  lastItem = GetBoard()->GetItem( lastBrightenedItemID );
222 #endif
223 
224  if( lastItem && lastItem != aItem && lastItem != DELETED_BOARD_ITEM::GetInstance() )
225  {
226  lastItem->ClearBrightened();
227 
228  if( lastItem->Type() == PCB_FOOTPRINT_T )
229  {
230  static_cast<FOOTPRINT*>( lastItem )->RunOnChildren(
231  [&]( BOARD_ITEM* child )
232  {
233  child->ClearBrightened();
234  } );
235  }
236  else if( lastItem->Type() == PCB_GROUP_T )
237  {
238  static_cast<PCB_GROUP*>( lastItem )->RunOnChildren(
239  [&]( BOARD_ITEM* child )
240  {
241  child->ClearBrightened();
242  } );
243  }
244 
245  GetCanvas()->GetView()->Update( lastItem );
246  lastBrightenedItemID = niluuid;
247  GetCanvas()->Refresh();
248  }
249 
250  if( aItem && aItem != DELETED_BOARD_ITEM::GetInstance() )
251  {
252  aItem->SetBrightened();
253 
254  if( aItem->Type() == PCB_FOOTPRINT_T )
255  {
256  static_cast<FOOTPRINT*>( aItem )->RunOnChildren(
257  [&]( BOARD_ITEM* child )
258  {
259  child->SetBrightened();
260  });
261  }
262  else if( aItem->Type() == PCB_GROUP_T )
263  {
264  static_cast<PCB_GROUP*>( aItem )->RunOnChildren(
265  [&]( BOARD_ITEM* child )
266  {
267  child->SetBrightened();
268  });
269  }
270 
271  GetCanvas()->GetView()->Update( aItem );
272  lastBrightenedItemID = aItem->m_Uuid;
273 
274  // Focus on the object's location. Prefer a visible part of the object to its anchor
275  // in order to keep from scrolling around.
276 
277  wxPoint focusPt = aItem->GetFocusPosition();
278  KIGFX::VIEW* view = GetCanvas()->GetView();
279  SHAPE_POLY_SET viewportPoly( view->GetViewport() );
280 
281  for( wxWindow* dialog : findDialogs() )
282  {
283  wxPoint dialogPos = GetCanvas()->ScreenToClient( dialog->GetScreenPosition() );
284  SHAPE_POLY_SET dialogPoly( BOX2D( view->ToWorld( dialogPos, true ),
285  view->ToWorld( dialog->GetSize(), false ) ) );
286 
287  viewportPoly.BooleanSubtract( dialogPoly, SHAPE_POLY_SET::PM_FAST );
288  }
289 
290  SHAPE_POLY_SET itemPoly, clippedPoly;
291 
292  if( aLayer == UNDEFINED_LAYER )
293  aLayer = aItem->GetLayer();
294 
295  switch( aItem->Type() )
296  {
297  case PCB_FOOTPRINT_T:
298  itemPoly = static_cast<FOOTPRINT*>( aItem )->GetBoundingHull();
299  break;
300 
301  case PCB_PAD_T:
302  case PCB_SHAPE_T:
303  case PCB_TEXT_T:
304  case PCB_FP_TEXT_T:
305  case PCB_FP_SHAPE_T:
306  case PCB_FP_ZONE_T:
307  case PCB_TRACE_T:
308  case PCB_VIA_T:
309  case PCB_ARC_T:
310  case PCB_DIMENSION_T:
311  case PCB_DIM_ALIGNED_T:
312  case PCB_DIM_LEADER_T:
313  case PCB_DIM_CENTER_T:
315  case PCB_ZONE_T:
316  aItem->TransformShapeWithClearanceToPolygon( itemPoly, aLayer, 0, Millimeter2iu( 0.1 ),
317  ERROR_INSIDE );
318  break;
319 
320  default:
321  {
322  BOX2I item_bbox = aItem->GetBoundingBox();
323  itemPoly.NewOutline();
324  itemPoly.Append( item_bbox.GetOrigin() );
325  itemPoly.Append( item_bbox.GetOrigin() + VECTOR2I( item_bbox.GetWidth(), 0 ) );
326  itemPoly.Append( item_bbox.GetOrigin() + VECTOR2I( 0, item_bbox.GetHeight() ) );
327  itemPoly.Append( item_bbox.GetOrigin() + VECTOR2I( item_bbox.GetWidth(), item_bbox.GetHeight() ) );
328  break;
329  }
330  }
331 
332  clippedPoly.BooleanIntersection( itemPoly, viewportPoly, SHAPE_POLY_SET::PM_FAST );
333 
334  if( !clippedPoly.IsEmpty() )
335  itemPoly = clippedPoly;
336 
337  /*
338  * Perform a step-wise deflate to find the visual-center-of-mass
339  */
340 
341  BOX2I bbox = itemPoly.BBox();
342  int step = std::min( bbox.GetWidth(), bbox.GetHeight() ) / 10;
343 
344  while( !itemPoly.IsEmpty() )
345  {
346  focusPt = (wxPoint) itemPoly.BBox().Centre();
347  itemPoly.Deflate( step, 4 );
348  }
349 
350  FocusOnLocation( focusPt );
351 
352  GetCanvas()->Refresh();
353  }
354 }
355 
356 
357 void PCB_BASE_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
358 {
359  m_pcb->SetPageSettings( aPageSettings );
360 
361  if( GetScreen() )
362  GetScreen()->InitDataPoints( aPageSettings.GetSizeIU() );
363 }
364 
365 
367 {
368  return m_pcb->GetPageSettings();
369 }
370 
371 
372 const wxSize PCB_BASE_FRAME::GetPageSizeIU() const
373 {
374  // this function is only needed because EDA_DRAW_FRAME is not compiled
375  // with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
376  // into an application specific source file.
377  return m_pcb->GetPageSettings().GetSizeIU();
378 }
379 
380 
381 const wxPoint& PCB_BASE_FRAME::GetGridOrigin() const
382 {
384 }
385 
386 
387 void PCB_BASE_FRAME::SetGridOrigin( const wxPoint& aPoint )
388 {
390 }
391 
392 
393 const wxPoint& PCB_BASE_FRAME::GetAuxOrigin() const
394 {
396 }
397 
398 
399 const wxPoint PCB_BASE_FRAME::GetUserOrigin() const
400 {
401  auto& displ_opts = GetDisplayOptions();
402  wxPoint origin( 0, 0 );
403 
404  switch( displ_opts.m_DisplayOrigin )
405  {
407  case PCB_DISPLAY_OPTIONS::PCB_ORIGIN_AUX: origin = GetAuxOrigin(); break;
408  case PCB_DISPLAY_OPTIONS::PCB_ORIGIN_GRID: origin = GetGridOrigin(); break;
409  default: wxASSERT( false ); break;
410  }
411 
412  return origin;
413 }
414 
416 {
417  return m_originTransforms;
418 }
419 
420 
422 {
423  return m_pcb->GetTitleBlock();
424 }
425 
426 
427 void PCB_BASE_FRAME::SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
428 {
429  m_pcb->SetTitleBlock( aTitleBlock );
430 }
431 
432 
434 {
435  return m_pcb->GetDesignSettings();
436 }
437 
438 
440 {
441  m_drawBgColor= aColor;
442  m_auimgr.Update();
443 }
444 
445 
447 {
449 }
450 
451 
453 {
455 }
456 
457 
459 {
460  return m_pcb->GetPlotOptions();
461 }
462 
463 
465 {
466  m_pcb->SetPlotOptions( aSettings );
467 }
468 
469 
470 EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
471 {
472  EDA_RECT area = aBoardEdgesOnly ? m_pcb->GetBoardEdgesBoundingBox() : m_pcb->GetBoundingBox();
473 
474  if( area.GetWidth() == 0 && area.GetHeight() == 0 )
475  {
476  wxSize pageSize = GetPageSizeIU();
477 
479  {
480  area.SetOrigin( 0, 0 );
481  area.SetEnd( pageSize.x, pageSize.y );
482  }
483  else
484  {
485  area.SetOrigin( -pageSize.x / 2, -pageSize.y / 2 );
486  area.SetEnd( pageSize.x / 2, pageSize.y / 2 );
487  }
488  }
489 
490  return area;
491 }
492 
493 
494 // Virtual function
496 {
497 }
498 
499 
501 {
502  // call my base class
504 
505  // tooltips in toolbars
507 
508  // status bar
509  UpdateMsgPanel();
510 }
511 
512 
514 {
515  EDA_3D_VIEWER_FRAME* draw3DFrame = Get3DViewerFrame();
516 
517  if( !draw3DFrame )
518  draw3DFrame = new EDA_3D_VIEWER_FRAME( &Kiway(), this, _( "3D Viewer" ) );
519 
520  // Raising the window does not show the window on Windows if iconized. This should work
521  // on any platform.
522  if( draw3DFrame->IsIconized() )
523  draw3DFrame->Iconize( false );
524 
525  draw3DFrame->Raise();
526  draw3DFrame->Show( true );
527 
528  // Raising the window does not set the focus on Linux. This should work on any platform.
529  if( wxWindow::FindFocus() != draw3DFrame )
530  draw3DFrame->SetFocus();
531 
532  // Allocate a slice of time to display the 3D frame
533  // a call to wxSafeYield() should be enough (and better), but on Linux we need
534  // to call wxYield()
535  // otherwise the activity messages are not displayed during the first board loading
536  wxYield();
537 
538  // Note, the caller is responsible to load/update the board 3D view.
539  // after frame creation the board is not automatically created.
540 
541  return draw3DFrame;
542 }
543 
544 
546 {
547  PCB_LAYER_ID preslayer = GetActiveLayer();
548  auto& displ_opts = GetDisplayOptions();
549 
550  // Check if the specified layer matches the present layer
551  if( layer == preslayer )
552  return;
553 
554  // Copper layers cannot be selected unconditionally; how many of those layers are
555  // currently enabled needs to be checked.
556  if( IsCopperLayer( layer ) )
557  {
558  // If only one copper layer is enabled, the only such layer that can be selected to
559  // is the "Copper" layer (so the selection of any other copper layer is disregarded).
560  if( m_pcb->GetCopperLayerCount() < 2 )
561  {
562  if( layer != B_Cu )
563  return;
564  }
565 
566  // If more than one copper layer is enabled, the "Copper" and "Component" layers
567  // can be selected, but the total number of copper layers determines which internal
568  // layers are also capable of being selected.
569  else
570  {
571  if( layer != B_Cu && layer != F_Cu && layer >= ( m_pcb->GetCopperLayerCount() - 1 ) )
572  return;
573  }
574  }
575 
576  // Is yet more checking required? E.g. when the layer to be selected is a non-copper
577  // layer, or when switching between a copper layer and a non-copper layer, or vice-versa?
578  // ...
579 
580  SetActiveLayer( layer );
581 
582  if( displ_opts.m_ContrastModeDisplay != HIGH_CONTRAST_MODE::NORMAL )
583  GetCanvas()->Refresh();
584 }
585 
586 
588 {
590  GetCanvas()->GetView() );
591 
592  // account for the globals
594  guide.SetIgnoreMTextsOnBack( ! m_pcb->IsElementVisible( LAYER_MOD_TEXT_BK ) );
595  guide.SetIgnoreMTextsOnFront( ! m_pcb->IsElementVisible( LAYER_MOD_TEXT_FR ) );
596  guide.SetIgnoreModulesOnBack( ! m_pcb->IsElementVisible( LAYER_MOD_BK ) );
597  guide.SetIgnoreModulesOnFront( ! m_pcb->IsElementVisible( LAYER_MOD_FR ) );
598  guide.SetIgnorePadsOnBack( ! m_pcb->IsElementVisible( LAYER_PAD_BK ) );
599  guide.SetIgnorePadsOnFront( ! m_pcb->IsElementVisible( LAYER_PAD_FR ) );
600  guide.SetIgnoreThroughHolePads( ! m_pcb->IsElementVisible( LAYER_PADS_TH ) );
601  guide.SetIgnoreModulesVals( ! m_pcb->IsElementVisible( LAYER_MOD_VALUES ) );
602  guide.SetIgnoreModulesRefs( ! m_pcb->IsElementVisible( LAYER_MOD_REFERENCES ) );
603  guide.SetIgnoreThroughVias( ! m_pcb->IsElementVisible( LAYER_VIAS ) );
604  guide.SetIgnoreBlindBuriedVias( ! m_pcb->IsElementVisible( LAYER_VIAS ) );
605  guide.SetIgnoreMicroVias( ! m_pcb->IsElementVisible( LAYER_VIAS ) );
606  guide.SetIgnoreTracks( ! m_pcb->IsElementVisible( LAYER_TRACKS ) );
607 
608  return guide;
609 }
610 
611 
613 {
614  wxString line;
615 
616  line.Printf( "grid X %s Y %s",
617  MessageTextFromValue( m_userUnits, GetCanvas()->GetGAL()->GetGridSize().x ),
618  MessageTextFromValue( m_userUnits, GetCanvas()->GetGAL()->GetGridSize().y ) );
619 
620  SetStatusText( line, 4 );
621 }
622 
623 
625 {
627 
628  BASE_SCREEN* screen = GetScreen();
629 
630  if( !screen )
631  return;
632 
633  wxString line;
635 
636  if( GetShowPolarCoords() ) // display polar coordinates
637  {
638  double dx = cursorPos.x - screen->m_LocalOrigin.x;
639  double dy = cursorPos.y - screen->m_LocalOrigin.y;
640  double theta = RAD2DEG( atan2( -dy, dx ) );
641  double ro = hypot( dx, dy );
642 
643  line.Printf( wxT( "r %s theta %.3f" ),
644  MessageTextFromValue( GetUserUnits(), ro, false ), theta );
645 
646  SetStatusText( line, 3 );
647  }
648 
649  // Transform absolute coordinates for user origin preferences
650  double userXpos = m_originTransforms.ToDisplayAbsX( static_cast<double>( cursorPos.x ) );
651  double userYpos = m_originTransforms.ToDisplayAbsY( static_cast<double>( cursorPos.y ) );
652 
653  // Display absolute coordinates:
654  line.Printf( wxT( "X %s Y %s" ),
655  MessageTextFromValue( GetUserUnits(), userXpos, false ),
656  MessageTextFromValue( GetUserUnits(), userYpos, false ) );
657  SetStatusText( line, 2 );
658 
659  if( !GetShowPolarCoords() ) // display relative cartesian coordinates
660  {
661  // Calculate relative coordinates
662  double relXpos = cursorPos.x - screen->m_LocalOrigin.x;
663  double relYpos = cursorPos.y - screen->m_LocalOrigin.y;
664 
665  // Transform relative coordinates for user origin preferences
666  userXpos = m_originTransforms.ToDisplayRelX( relXpos );
667  userYpos = m_originTransforms.ToDisplayRelY( relYpos );
668 
669  line.Printf( wxT( "dx %s dy %s dist %s" ),
670  MessageTextFromValue( GetUserUnits(), userXpos, false ),
671  MessageTextFromValue( GetUserUnits(), userYpos, false ),
672  MessageTextFromValue( GetUserUnits(), hypot( userXpos, userYpos ), false ) );
673  SetStatusText( line, 3 );
674  }
675 
676  DisplayGridMsg();
677 }
678 
679 
681 {
682  EDA_DRAW_FRAME::unitsChangeRefresh(); // Update the status bar.
683 
685 }
686 
687 
689 {
691 
692  if( aCfg->m_Window.grid.sizes.empty() )
693  aCfg->m_Window.grid.sizes = aCfg->DefaultGridSizeList();
694 
695  // Currently values read from config file are not used because the user cannot
696  // change this config
697  // if( aCfg->m_Window.zoom_factors.empty() )
698  {
700  }
701 
702  // Some, but not all derived classes have a PCBNEW_SETTINGS.
703  PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
704 
705  if( cfg )
706  {
709  }
710 
711  wxASSERT( GetCanvas() );
712 
713  if( GetCanvas() )
714  {
716 
717  if( rs )
718  {
722  }
723  }
724 }
725 
726 
727 SEVERITY PCB_BASE_FRAME::GetSeverity( int aErrorCode ) const
728 {
729  if( aErrorCode >= CLEANUP_FIRST )
730  return RPT_SEVERITY_ACTION;
731 
733 
734  return bds.m_DRCSeverities[ aErrorCode ];
735 }
736 
737 
739 {
741 
742  // Some, but not all derived classes have a PCBNEW_SETTINGS.
743  PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
744 
745  if( cfg )
746  {
749  }
750 }
751 
752 
754 {
755  return Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
756 }
757 
758 
760 {
761  return Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>();
762 }
763 
764 
766 {
767  wxCHECK( m_settings, nullptr );
768  return &m_settings->m_MagneticItems;
769 }
770 
771 
772 void PCB_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
773 {
774  EDA_DRAW_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
775 
778 
780 
781  // The 3D viewer isn't in the Kiway, so send its update manually
783 
784  if( viewer )
785  viewer->CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
786 }
787 
788 
790 {
792 
794 
795  UpdateStatusBar();
796  UpdateMsgPanel();
797 }
798 
799 
801 {
802  return static_cast<PCB_DRAW_PANEL_GAL*>( EDA_DRAW_FRAME::GetCanvas() );
803 }
804 
805 
807 {
809 
810  EDA_DRAW_PANEL_GAL* canvas = GetCanvas();
811 
812  if( m_toolManager )
813  {
815  GetCanvas()->GetViewControls(), config(), this );
816  }
817 
818  if( m_toolManager )
820 
821  // Transfer latest current display options from legacy to GAL canvas:
822  auto painter = static_cast<KIGFX::PCB_PAINTER*>( canvas->GetView()->GetPainter() );
823  auto settings = painter->GetSettings();
824  auto displ_opts = GetDisplayOptions();
825  settings->LoadDisplayOptions( displ_opts, ShowPageLimits() );
826  settings->LoadColors( GetColorSettings() );
827 
828  canvas->GetView()->RecacheAllItems();
830  canvas->StartDrawing();
831 }
832 
833 
834 void PCB_BASE_FRAME::SetDisplayOptions( const PCB_DISPLAY_OPTIONS& aOptions, bool aRefresh )
835 {
836  bool hcChanged = m_displayOptions.m_ContrastModeDisplay != aOptions.m_ContrastModeDisplay;
837  m_displayOptions = aOptions;
838 
839  EDA_DRAW_PANEL_GAL* canvas = GetCanvas();
840  KIGFX::PCB_VIEW* view = static_cast<KIGFX::PCB_VIEW*>( canvas->GetView() );
841 
842  view->UpdateDisplayOptions( aOptions );
845 
846  // Vias on a restricted layer set must be redrawn when high contrast mode is changed
847  if( hcChanged )
848  {
850  []( KIGFX::VIEW_ITEM* aItem ) -> bool
851  {
852  if( PCB_VIA* via = dynamic_cast<PCB_VIA*>( aItem ) )
853  {
854  return via->GetViaType() == VIATYPE::BLIND_BURIED
855  || via->GetViaType() == VIATYPE::MICROVIA;
856  }
857 
858  return false;
859  } );
860  }
861 
862  if( aRefresh )
863  canvas->Refresh();
864 }
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:723
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
virtual void SetBoard(BOARD *aBoard)
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
smd pads, front layer
Definition: layer_ids.h:198
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
Definition: view.cpp:510
virtual void ShowChangedLanguage() override
Redraw the menus and what not in current language.
const PAGE_INFO & GetPageSettings() const
Definition: board.h:535
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:538
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
wxPoint m_GridOrigin
origin for grid offsets
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:1434
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:447
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:543
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:737
show footprints values (when texts are visible)
Definition: layer_ids.h:206
FOOTPRINT_EDITOR_SETTINGS * GetFootprintEditorSettings() const
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
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:536
smd pads, back layer
Definition: layer_ids.h:199
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual const wxPoint GetFocusPosition() const
Similar to GetPosition, but allows items to return their visual center rather than their anchor.
Definition: eda_item.h:259
bool IsEmpty() const
void RecacheAllItems()
Rebuild GAL display lists.
Definition: view.cpp:1389
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:1424
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:109
void SetBrightened()
Definition: eda_item.h:130
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:153
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:121
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:205
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.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
virtual const PCB_PLOT_PARAMS & GetPlotSettings() const
Return the PCB_PLOT_PARAMS for the BOARD owned by this frame.
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:133
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
void unitsChangeRefresh() override
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
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.
Container for display options like enable/disable some optional drawings.
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions, bool aRefresh=true)
Updates the current display options from the given options struct.
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:189
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
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:351
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:182
EDA_ITEM * GetItem(const KIID &aId) const override
Fetch an item by KIID.
void SetOrientation(double aNewAngle)
Definition: footprint.cpp:1662
coord_type GetWidth() const
Definition: box2.h:180
const ZONE_SETTINGS & GetZoneSettings() const
Inactive layers are shown normally (no high-contrast mode)
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:1472
text marked as invisible
Definition: layer_ids.h:196
void Deflate(int aAmount, int aCircleSegmentsCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS)
show footprints on front
Definition: layer_ids.h:204
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
#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
class ZONE, a copper pour area
Definition: typeinfo.h:105
void SetPlotOptions(const PCB_PLOT_PARAMS &aOptions)
Definition: board.h:539
virtual void SetActiveLayer(PCB_LAYER_ID aLayer)
virtual void ActivateGalCanvas()
Use to start up the GAL drawing canvas.
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.
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:110
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:796
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.
virtual void SwitchLayer(wxDC *DC, PCB_LAYER_ID layer)
ZONE_SETTINGS handles zones parameters.
Definition: zone_settings.h:67
const KIID m_Uuid
Definition: eda_item.h:475
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
bool IsFlipped() const
Definition: footprint.h:277
show footprints references (when texts are visible)
Definition: layer_ids.h:207
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.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:158
TITLE_BLOCK & GetTitleBlock()
Definition: board.h:541
see class PGM_BASE
bool GetShowPolarCoords() const
For those frames that support polar coordinates.
multilayer pads, usually with holes
Definition: layer_ids.h:209
Vec Centre() const
Definition: box2.h:63
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:190
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:100
coord_type GetHeight() const
Definition: box2.h:181
wxPoint GetPosition() const override
Definition: footprint.h:186
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
virtual void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const
Convert the item shape to a closed polygon.
Definition: board_item.cpp:142
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
virtual const EDA_RECT GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:75
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
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:1543
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
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:140
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
wxPoint m_AuxOrigin
origin for plot exports
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:113
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