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@verizon.net>
7  * Copyright (C) 1992-2020 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 
27 #include <fctsys.h>
28 #include <kiface_i.h>
29 #include <confirm.h>
30 #include <dialog_helpers.h>
31 #include <pcb_base_frame.h>
32 #include <base_units.h>
33 #include <msgpanel.h>
34 #include <pgm_base.h>
35 #include <3d_viewer/eda_3d_viewer.h> // To include VIEWER3D_FRAMENAME
36 #include <pcbnew.h>
38 #include <fp_lib_table.h>
39 #include <pcbnew_id.h>
40 #include <class_board.h>
41 #include <class_module.h>
42 #include <class_drawsegment.h>
43 #include <collectors.h>
44 #include <pcb_draw_panel_gal.h>
45 #include <math/vector2d.h>
46 #include <trigo.h>
47 #include <pcb_painter.h>
49 #include <pcbnew_settings.h>
50 #include <tool/tool_manager.h>
51 #include <tool/tool_dispatcher.h>
52 #include <tools/pcb_actions.h>
53 #include <tool/grid_menu.h>
54 #include "cleanup_item.h"
55 
56 wxDEFINE_EVENT( BOARD_CHANGED, wxCommandEvent );
57 
58 PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
59  const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
60  long aStyle, const wxString & aFrameName ) :
61  EDA_DRAW_FRAME( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ),
62  m_Pcb( nullptr )
63 {
64  m_Settings = static_cast<PCBNEW_SETTINGS*>( Kiface().KifaceSettings() );
65 }
66 
67 
69 {
70  // Ensure m_canvasType is up to date, to save it in config
72 
73  delete m_Pcb;
74 }
75 
76 
78 {
79  return dynamic_cast<EDA_3D_VIEWER*>( FindWindowByName( QUALIFIED_VIEWER3D_FRAMENAME( this ) ) );
80 }
81 
82 
83 void PCB_BASE_FRAME::Update3DView( bool aForceReload, const wxString* aTitle )
84 {
85  EDA_3D_VIEWER* draw3DFrame = Get3DViewerFrame();
86 
87  if( draw3DFrame )
88  {
89  if( aTitle )
90  draw3DFrame->SetTitle( *aTitle );
91 
92  draw3DFrame->NewDisplay( aForceReload );
93  }
94 }
95 
96 
98 {
99  // This is a lazy loading function, it loads the project specific table when
100  // that table is asked for, not before.
101 
103 
104  // its gotta be NULL or a FP_LIB_TABLE, or a bug.
105  wxASSERT( !tbl || tbl->Type() == FP_LIB_TABLE_T );
106 
107  if( !tbl )
108  {
109  // Stack the project specific FP_LIB_TABLE overlay on top of the global table.
110  // ~FP_LIB_TABLE() will not touch the fallback table, so multiple projects may
111  // stack this way, all using the same global fallback table.
112  tbl = new FP_LIB_TABLE( &GFootprintTable );
113 
114  SetElem( ELEM_FPTBL, tbl );
115 
116  wxString projectFpLibTableFileName = FootprintLibTblName();
117 
118  try
119  {
120  tbl->Load( projectFpLibTableFileName );
121  }
122  catch( const IO_ERROR& ioe )
123  {
124  DisplayErrorMessage( nullptr, _( "Error loading project footprint libraries" ),
125  ioe.What() );
126  }
127  }
128 
129  return tbl;
130 }
131 
132 
134 {
135  if( m_Pcb != aBoard )
136  {
137  delete m_Pcb;
138  m_Pcb = aBoard;
139 
140  wxCommandEvent e( BOARD_CHANGED );
141  ProcessEventLocally( e );
142  }
143 }
144 
145 
147 {
148  if( module )
149  {
150  GetBoard()->Add( module, ADD_MODE::APPEND );
151 
152  module->SetFlags( IS_NEW );
153  module->SetPosition( wxPoint( 0, 0 ) ); // cursor in GAL may not be initialized yet
154 
155  // Put it on FRONT layer (note that it might be stored flipped if the lib is an archive
156  // built from a board)
157  if( module->IsFlipped() )
158  module->Flip( module->GetPosition(), m_Settings->m_FlipLeftRight );
159 
160  // Place it in orientation 0 even if it is not saved with orientation 0 in lib (note that
161  // it might be stored in another orientation if the lib is an archive built from a board)
162  module->SetOrientation( 0 );
163  }
164 }
165 
166 
168 {
169  return GetBoard()->GetItem( aId );
170 }
171 
172 
174 {
175  static KIID lastBrightenedItemID( niluuid );
176 
177  BOARD_ITEM* lastItem = GetBoard()->GetItem( lastBrightenedItemID );
178 
179  if( lastItem && lastItem != aItem )
180  {
181  lastItem->ClearBrightened();
182 
183  if( lastItem->Type() == PCB_MODULE_T )
184  {
185  static_cast<MODULE*>( lastItem )->RunOnChildren( [&] ( BOARD_ITEM* child )
186  {
187  child->ClearBrightened();
188  });
189  }
190 
191  GetCanvas()->GetView()->Update( lastItem );
192  lastBrightenedItemID = niluuid;
193  GetCanvas()->Refresh();
194  }
195 
196  if( aItem )
197  {
198  aItem->SetBrightened();
199 
200  if( aItem->Type() == PCB_MODULE_T )
201  {
202  static_cast<MODULE*>( aItem )->RunOnChildren( [&] ( BOARD_ITEM* child )
203  {
204  child->SetBrightened();
205  });
206  }
207 
208  GetCanvas()->GetView()->Update( aItem );
209  lastBrightenedItemID = aItem->m_Uuid;
210  FocusOnLocation( aItem->GetFocusPosition() );
211  GetCanvas()->Refresh();
212  }
213 }
214 
215 
216 void PCB_BASE_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
217 {
218  wxASSERT( m_Pcb );
219  m_Pcb->SetPageSettings( aPageSettings );
220 
221  if( GetScreen() )
222  GetScreen()->InitDataPoints( aPageSettings.GetSizeIU() );
223 }
224 
225 
227 {
228  wxASSERT( m_Pcb );
229  return m_Pcb->GetPageSettings();
230 }
231 
232 
233 const wxSize PCB_BASE_FRAME::GetPageSizeIU() const
234 {
235  wxASSERT( m_Pcb );
236 
237  // this function is only needed because EDA_DRAW_FRAME is not compiled
238  // with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
239  // into an application specific source file.
240  return m_Pcb->GetPageSettings().GetSizeIU();
241 }
242 
243 
245 {
246  wxASSERT( m_Pcb );
248 }
249 
250 
252 {
253  wxASSERT( m_Pcb );
255 }
256 
257 
259 {
260  wxASSERT( m_Pcb );
261  return m_Pcb->GetTitleBlock();
262 }
263 
264 
265 void PCB_BASE_FRAME::SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
266 {
267  wxASSERT( m_Pcb );
268  m_Pcb->SetTitleBlock( aTitleBlock );
269 }
270 
271 
273 {
274  wxASSERT( m_Pcb );
275  return m_Pcb->GetDesignSettings();
276 }
277 
278 
280 {
281  m_drawBgColor= aColor;
282  m_auimgr.Update();
283 }
284 
285 
287 {
288  wxASSERT( m_Pcb );
290 }
291 
292 
294 {
295  wxASSERT( m_Pcb );
297 }
298 
299 
301 {
302  wxASSERT( m_Pcb );
303  return m_Pcb->GetPlotOptions();
304 }
305 
306 
308 {
309  wxASSERT( m_Pcb );
310  m_Pcb->SetPlotOptions( aSettings );
311 }
312 
313 
314 EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
315 {
316  wxASSERT( m_Pcb );
317 
318  EDA_RECT area = aBoardEdgesOnly ? m_Pcb->GetBoardEdgesBoundingBox() : m_Pcb->GetBoundingBox();
319 
320  if( area.GetWidth() == 0 && area.GetHeight() == 0 )
321  {
322  wxSize pageSize = GetPageSizeIU();
323 
325  {
326  area.SetOrigin( 0, 0 );
327  area.SetEnd( pageSize.x, pageSize.y );
328  }
329  else
330  {
331  area.SetOrigin( -pageSize.x / 2, -pageSize.y / 2 );
332  area.SetEnd( pageSize.x / 2, pageSize.y / 2 );
333  }
334  }
335 
336  return area;
337 }
338 
339 
340 // Virtual function
342 {
343 }
344 
345 
347 {
348  // call my base class
350 
351  // tooltips in toolbars
353 
354  // status bar
355  UpdateMsgPanel();
356 }
357 
358 
360 {
361  EDA_3D_VIEWER* draw3DFrame = Get3DViewerFrame();
362 
363  if( !draw3DFrame )
364  draw3DFrame = new EDA_3D_VIEWER( &Kiway(), this, _( "3D Viewer" ) );
365 
366  // Raising the window does not show the window on Windows if iconized. This should work
367  // on any platform.
368  if( draw3DFrame->IsIconized() )
369  draw3DFrame->Iconize( false );
370 
371  draw3DFrame->Raise();
372  draw3DFrame->Show( true );
373 
374  // Raising the window does not set the focus on Linux. This should work on any platform.
375  if( wxWindow::FindFocus() != draw3DFrame )
376  draw3DFrame->SetFocus();
377 
378  return draw3DFrame;
379 }
380 
381 
382 // Note: virtual, overridden in PCB_EDIT_FRAME;
384 {
385  PCB_LAYER_ID preslayer = GetActiveLayer();
386  auto& displ_opts = GetDisplayOptions();
387 
388  // Check if the specified layer matches the present layer
389  if( layer == preslayer )
390  return;
391 
392  // Copper layers cannot be selected unconditionally; how many of those layers are
393  // currently enabled needs to be checked.
394  if( IsCopperLayer( layer ) )
395  {
396  // If only one copper layer is enabled, the only such layer that can be selected to
397  // is the "Copper" layer (so the selection of any other copper layer is disregarded).
398  if( m_Pcb->GetCopperLayerCount() < 2 )
399  {
400  if( layer != B_Cu )
401  return;
402  }
403 
404  // If more than one copper layer is enabled, the "Copper" and "Component" layers
405  // can be selected, but the total number of copper layers determines which internal
406  // layers are also capable of being selected.
407  else
408  {
409  if( layer != B_Cu && layer != F_Cu && layer >= ( m_Pcb->GetCopperLayerCount() - 1 ) )
410  return;
411  }
412  }
413 
414  // Is yet more checking required? E.g. when the layer to be selected is a non-copper
415  // layer, or when switching between a copper layer and a non-copper layer, or vice-versa?
416  // ...
417 
418  SetActiveLayer( layer );
419 
420  if( displ_opts.m_ContrastModeDisplay )
421  GetCanvas()->Refresh();
422 }
423 
424 
426 {
428  GetCanvas()->GetView() );
429 
430  // account for the globals
432  guide.SetIgnoreMTextsOnBack( ! m_Pcb->IsElementVisible( LAYER_MOD_TEXT_BK ) );
433  guide.SetIgnoreMTextsOnFront( ! m_Pcb->IsElementVisible( LAYER_MOD_TEXT_FR ) );
434  guide.SetIgnoreModulesOnBack( ! m_Pcb->IsElementVisible( LAYER_MOD_BK ) );
435  guide.SetIgnoreModulesOnFront( ! m_Pcb->IsElementVisible( LAYER_MOD_FR ) );
436  guide.SetIgnorePadsOnBack( ! m_Pcb->IsElementVisible( LAYER_PAD_BK ) );
437  guide.SetIgnorePadsOnFront( ! m_Pcb->IsElementVisible( LAYER_PAD_FR ) );
438  guide.SetIgnoreThroughHolePads( ! m_Pcb->IsElementVisible( LAYER_PADS_TH ) );
439  guide.SetIgnoreModulesVals( ! m_Pcb->IsElementVisible( LAYER_MOD_VALUES ) );
440  guide.SetIgnoreModulesRefs( ! m_Pcb->IsElementVisible( LAYER_MOD_REFERENCES ) );
441  guide.SetIgnoreThroughVias( ! m_Pcb->IsElementVisible( LAYER_VIA_THROUGH ) );
442  guide.SetIgnoreBlindBuriedVias( ! m_Pcb->IsElementVisible( LAYER_VIA_BBLIND ) );
443  guide.SetIgnoreMicroVias( ! m_Pcb->IsElementVisible( LAYER_VIA_MICROVIA ) );
444  guide.SetIgnoreTracks( ! m_Pcb->IsElementVisible( LAYER_TRACKS ) );
445 
446  return guide;
447 }
448 
449 
450 /*
451  * Display the grid status.
452  */
454 {
455  wxString line;
456  wxString gridformatter;
457 
458  switch( m_userUnits )
459  {
460  case EDA_UNITS::INCHES: gridformatter = "grid X %.6f Y %.6f"; break;
461  case EDA_UNITS::MILLIMETRES: gridformatter = "grid X %.6f Y %.6f"; break;
462  default: gridformatter = "grid X %f Y %f"; break;
463  }
464 
465  double grid_x = To_User_Unit( m_userUnits, GetCanvas()->GetGAL()->GetGridSize().x );
466  double grid_y = To_User_Unit( m_userUnits, GetCanvas()->GetGAL()->GetGridSize().y );
467  line.Printf( gridformatter, grid_x, grid_y );
468 
469  SetStatusText( line, 4 );
470 }
471 
472 
473 /*
474  * Update the status bar information.
475  */
477 {
479 
480  BASE_SCREEN* screen = GetScreen();
481 
482  if( !screen )
483  return;
484 
485  wxString line;
487 
488  if( GetShowPolarCoords() ) // display polar coordinates
489  {
490  double dx = cursorPos.x - screen->m_LocalOrigin.x;
491  double dy = cursorPos.y - screen->m_LocalOrigin.y;
492  double theta = RAD2DEG( atan2( -dy, dx ) );
493  double ro = hypot( dx, dy );
494  wxString formatter;
495 
496  switch( GetUserUnits() )
497  {
498  case EDA_UNITS::INCHES:
499  formatter = wxT( "r %.6f theta %.1f" );
500  break;
502  formatter = wxT( "r %.6f theta %.1f" );
503  break;
504  case EDA_UNITS::UNSCALED:
505  formatter = wxT( "r %f theta %f" );
506  break;
507  default: wxASSERT( false ); break;
508  }
509 
510  line.Printf( formatter, To_User_Unit( GetUserUnits(), ro ), theta );
511 
512  SetStatusText( line, 3 );
513  }
514 
515  // Display absolute coordinates:
516  double dXpos = To_User_Unit( GetUserUnits(), cursorPos.x );
517  double dYpos = To_User_Unit( GetUserUnits(), cursorPos.y );
518 
519  // The following sadly is an if Eeschema/if Pcbnew
520  wxString absformatter;
521  wxString locformatter;
522 
523  switch( GetUserUnits() )
524  {
525  case EDA_UNITS::INCHES:
526  absformatter = "X %.6f Y %.6f";
527  locformatter = "dx %.6f dy %.6f dist %.4f";
528  break;
529 
531  absformatter = "X %.6f Y %.6f";
532  locformatter = "dx %.6f dy %.6f dist %.3f";
533  break;
534 
535  case EDA_UNITS::UNSCALED:
536  absformatter = "X %f Y %f";
537  locformatter = "dx %f dy %f dist %f";
538  break;
539 
540  default:
541  wxASSERT( false );
542  break;
543  }
544 
545  line.Printf( absformatter, dXpos, dYpos );
546  SetStatusText( line, 2 );
547 
548  if( !GetShowPolarCoords() ) // display relative cartesian coordinates
549  {
550  // Display relative coordinates:
551  dXpos = To_User_Unit( GetUserUnits(), cursorPos.x - screen->m_LocalOrigin.x );
552  dYpos = To_User_Unit( GetUserUnits(), cursorPos.y - screen->m_LocalOrigin.y );
553 
554  // We already decided the formatter above
555  line.Printf( locformatter, dXpos, dYpos, hypot( dXpos, dYpos ) );
556  SetStatusText( line, 3 );
557  }
558 
559  DisplayGridMsg();
560 }
561 
562 
564 {
565  EDA_DRAW_FRAME::unitsChangeRefresh(); // Update the status bar.
566 
567  // Notify all tools the units have changed
568  if( m_toolManager )
570 
572 }
573 
574 
576 {
578 
579  if( aCfg->m_Window.grid.sizes.empty() )
580  {
581  aCfg->m_Window.grid.sizes = { "1000 mil",
582  "500 mil",
583  "250 mil",
584  "200 mil",
585  "100 mil",
586  "50 mil",
587  "25 mil",
588  "20 mil",
589  "10 mil",
590  "5 mil",
591  "2 mil",
592  "1 mil",
593  "5.0 mm",
594  "2.5 mm",
595  "1.0 mm",
596  "0.5 mm",
597  "0.25 mm",
598  "0.2 mm",
599  "0.1 mm",
600  "0.05 mm",
601  "0.025 mm",
602  "0.01 mm" };
603  }
604 
605  if( aCfg->m_Window.zoom_factors.empty() )
606  {
607  aCfg->m_Window.zoom_factors = { 0.035,
608  0.05,
609  0.08,
610  0.13,
611  0.22,
612  0.35,
613  0.6,
614  1.0,
615  1.5,
616  2.2,
617  3.5,
618  5.0,
619  8.0,
620  13.0,
621  20.0,
622  35.0,
623  50.0,
624  80.0,
625  130.0,
626  220.0,
627  300.0 };
628  }
629 
630  for( double& factor : aCfg->m_Window.zoom_factors )
631  factor = std::min( factor, MAX_ZOOM_FACTOR );
632 
633  // Some, but not all derived classes have a PCBNEW_SETTINGS.
634  PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
635 
636  if( cfg )
637  {
640  }
641 }
642 
643 
644 int PCB_BASE_FRAME::GetSeverity( int aErrorCode ) const
645 {
646  if( aErrorCode >= CLEANUP_FIRST )
647  return RPT_SEVERITY_ACTION;
648 
650 
651  return bds.m_DRCSeverities[ aErrorCode ];
652 }
653 
654 
656 {
658 
659  // Some, but not all derived classes have a PCBNEW_SETTINGS.
660  PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
661 
662  if( cfg )
663  {
666  }
667 }
668 
669 
671 {
672  return Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
673 }
674 
675 
677 {
678  return Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>();
679 }
680 
682 {
683  wxCHECK( m_Settings, nullptr );
684  return &m_Settings->m_MagneticItems;
685 }
686 
687 
688 void PCB_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged )
689 {
690  EDA_DRAW_FRAME::CommonSettingsChanged( aEnvVarsChanged );
691 
693 
694  // The 3D viewer isn't in the Kiway, so send its update manually
695  EDA_3D_VIEWER* viewer = Get3DViewerFrame();
696 
697  if( viewer )
698  viewer->CommonSettingsChanged( aEnvVarsChanged );
699 }
700 
701 
703 {
704  GetScreen()->SetModify();
705  GetScreen()->SetSave();
706 
707  UpdateStatusBar();
708  UpdateMsgPanel();
709 }
710 
711 
713 {
714  return static_cast<PCB_DRAW_PANEL_GAL*>( EDA_DRAW_FRAME::GetCanvas() );
715 }
716 
717 
719 {
721 
722  EDA_DRAW_PANEL_GAL* canvas = GetCanvas();
723 
724  if( m_toolManager )
725  {
727  GetCanvas()->GetViewControls(), config(), this );
728  }
729 
730  if( m_toolManager )
732 
733  // Transfer latest current display options from legacy to GAL canvas:
734  auto painter = static_cast<KIGFX::PCB_PAINTER*>( canvas->GetView()->GetPainter() );
735  auto settings = painter->GetSettings();
736  auto displ_opts = GetDisplayOptions();
737  settings->LoadDisplayOptions( displ_opts, ShowPageLimits() );
738  settings->LoadColors( GetColorSettings() );
739 
740  canvas->GetView()->RecacheAllItems();
742  canvas->StartDrawing();
743 }
744 
double To_User_Unit(EDA_UNITS aUnit, double aValue, bool aUseMils)
Function To_User_Unit convert aValue in internal units to the appropriate user units defined by aUnit...
Definition: base_units.cpp:92
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
Definition: class_board.h:781
virtual void SetBoard(BOARD *aBoard)
Function SetBoard sets the m_Pcb member in such as way as to ensure deleting any previous BOARD.
to draw blind/buried vias
virtual void ShowChangedLanguage() override
Redraw the menus and what not in current language.
const PAGE_INFO & GetPageSettings() const
Definition: class_board.h:572
void DisplayGridMsg() override
Function DisplayGridMsg()
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_holder.h:56
const PCB_PLOT_PARAMS & GetPlotOptions() const
Definition: class_board.h:575
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project Overloaded in FOOTPRINT_EDIT_FRAME.
virtual void unitsChangeRefresh() override
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:104
void CommonSettingsChanged(bool aEnvVarsChanged) override
Notification that common settings are updated.
wxDEFINE_EVENT(BOARD_CHANGED, wxCommandEvent)
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.
wxPoint m_GridOrigin
origin for grid offsets
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:252
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
EDA_ITEM * GetItem(const KIID &aId) override
Fetch an item by KIID.
virtual void AddModuleToBoard(MODULE *module)
Adds the given module to the board.
void SetSave()
Definition: base_screen.h:185
bool IsFlipped() const
function IsFlipped
Definition: class_module.h:288
multilayer pads, usually with holes
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:91
Implementation of conversion functions that require both schematic and board internal units.
This file is part of the common library.
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
void SetDefaultZoneSettings(const ZONE_SETTINGS &aSettings)
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
Definition: class_board.h:579
const EDA_RECT GetBoardEdgesBoundingBox() const
Function GetBoardEdgesBoundingBox Returns the board bounding box calculated using exclusively the boa...
Definition: class_board.h:793
FRAME_T
Enum FRAME_T is the set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition: frame_type.h:34
FOOTPRINT_EDITOR_SETTINGS * GetFootprintEditorSettings()
std::map< int, int > m_DRCSeverities
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
The current canvas type.
FP_LIB_TABLE GFootprintTable
!!!!!!!!!!!!!! This code is obsolete because of the merge into pcbnew, don't bother with it.
virtual COLOR_SETTINGS * GetColorSettings() override
Helper to retrieve the current color settings.
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: class_board.h:573
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual const wxPoint GetFocusPosition() const
Function GetFocusPosition similar to GetPosition, but allows items to return their visual center rath...
Definition: base_struct.h:344
void RecacheAllItems()
Function RecacheAllItems() Rebuilds GAL display lists.
Definition: view.cpp:1402
double RAD2DEG(double rad)
Definition: trigo.h:215
void CommonSettingsChanged(bool aEnvVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
const wxPoint & GetGridOrigin() const override
Return the absolute coordinates of the origin of the snap grid.
int GetWidth() const
Definition: eda_rect.h:119
void SetBrightened()
Definition: base_struct.h:209
void RecreateToolbars()
Rebuild all toolbars, and update the checked state of ckeck tools.
LSET GetVisibleLayers() const
Function GetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:131
show modules values (when texts are visibles)
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock) override
wxAuiManager m_auimgr
static TOOL_ACTION updateUnits
Definition: pcb_actions.h:403
void SetDrawBgColor(COLOR4D aColor) override
virtual MAGNETIC_SETTINGS * GetMagneticItemsSettings()
VTBL_ENTRY _ELEM * GetElem(ELEM_T aIndex)
Typically wrapped somewhere else in a more meaningful function wrapper.
Definition: project.cpp:240
PCBNEW_SETTINGS * GetPcbNewSettings()
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.
virtual const PCB_PLOT_PARAMS & GetPlotSettings() const
Function GetPlotSettings returns the PCB_PLOT_PARAMS for the BOARD owned by this frame.
COLOR4D m_drawBgColor
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Function GetDisplayOptions Display options control the way tracks, vias, outlines and other things ar...
TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout,...
Definition: title_block.h:40
BOARD_ITEM * GetItem(const KIID &aID)
std::vector< double > zoom_factors
Definition: app_settings.h:78
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
bool ShowPageLimits() const
VTBL_ENTRY void SetElem(ELEM_T aIndex, _ELEM *aElem)
Definition: project.cpp:252
void ClearBrightened()
Definition: base_struct.h:212
Classes used in Pcbnew, CvPcb and GerbView.
show modules on front
#define IS_NEW
New item, just created.
Definition: base_struct.h:117
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:50
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: common.h:68
class MODULE, a footprint
Definition: typeinfo.h:89
PCB_LAYER_ID
A quick note on layer IDs:
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide()
Function GetCollectorsGuide.
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Saves common frame parameters to a configuration data file.
std::vector< wxString > sizes
Definition: app_settings.h:52
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:232
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:91
virtual void ActivateGalCanvas() override
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
EDA_3D_VIEWER * CreateAndShow3D_Frame()
Shows the 3D view frame.
GRID_SETTINGS grid
Definition: app_settings.h:81
PAGE_INFO describes the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
bool m_showBorderAndTitleBlock
BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:44
void SetEnd(int x, int y)
Definition: eda_rect.h:192
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Function Flip Flip this object, i.e.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
to draw usual through hole vias
const ZONE_SETTINGS & GetZoneSettings() const
KIID niluuid(0)
Helper dialog and control classes.
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Function ResetTools() Resets all tools (i.e.
KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the s...
Definition: kiway.h:273
virtual KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
virtual void SetPlotSettings(const PCB_PLOT_PARAMS &aSettings)
EDA_RECT GetBoardBoundingBox(bool aBoardEdgesOnly=false) const
Function GetBoardBoundingBox calculates the bounding box containing all board items (or board edge se...
#define MAX_ZOOM_FACTOR
void SetPosition(const wxPoint &aPos) override
void SetPlotOptions(const PCB_PLOT_PARAMS &aOptions)
Definition: class_board.h:576
virtual void SetActiveLayer(PCB_LAYER_ID aLayer)
virtual void ActivateGalCanvas()
Use to start up the GAL drawing canvas.
void SetIgnoreMTextsMarkedNoShow(bool ignore)
Definition: collectors.h:541
virtual void ReCreateMenuBar() override
Recreates the menu bar.
void Load(const wxString &aFileName)
Load the library table using the path defined by aFileName aFallBackTable.
PCB_PLOT_PARAMS handles plot parameters and options when plotting/printing a board.
virtual KIGFX::PCB_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
void StartDrawing()
Function StartDrawing() Begins drawing if it was stopped previously.
KICAD_T Type() override
Definition: fp_lib_table.h:108
int GetHeight() const
Definition: eda_rect.h:120
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:50
int GetSeverity(int aErrorCode) const override
PCB_DISPLAY_OPTIONS m_DisplayOptions
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Saves 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: base_struct.h:162
VTBL_ENTRY FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Definition: project.cpp:284
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Function IsElementVisible tests whether a given element category is visible.
PCBNEW_SETTINGS * m_Settings
const TITLE_BLOCK & GetTitleBlock() const override
WINDOW_SETTINGS m_Window
Definition: app_settings.h:153
virtual void OnModify()
Function OnModify Must be called after a change in order to set the "modify" flag of the current scre...
virtual void UpdateStatusBar() override
Update the status bar information.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:48
smd pads, front layer
TITLE_BLOCK & GetTitleBlock()
Definition: class_board.h:578
see class PGM_BASE
Declaration of the eda_3d_viewer class.
bool GetShowPolarCoords() const
For those frames that support polar coordinates.
Class to handle a graphic segment.
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, APP_SETTINGS_BASE *aSettings, TOOLS_HOLDER *aFrame)
Sets the work environment (model, view, view controls and the parent window).
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Function SetEventDispatcher() Sets a dispatcher that processes events and forwards them to tools.
#define _(s)
Definition: 3d_actions.cpp:33
void SetOrientation(double newangle)
int GetCopperLayerCount() const
Function GetCopperLayerCount.
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
const PAGE_INFO & GetPageSettings() const override
EDA_UNITS m_userUnits
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
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...
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
void CommonSettingsChanged(bool aEnvVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
void SetZoneSettings(const ZONE_SETTINGS &aSettings)
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard.
Definition: eda_3d_viewer.h:65
GAL_TYPE GetBackend() const
Function GetBackend Returns the type of backend currently used by GAL canvas.
void UpdateStatusBar() override
Update the status bar information.
ZONE_SETTINGS & GetDefaultZoneSettings()
BOARD * GetBoard() const
void SetModify()
Definition: base_screen.h:183
A general implementation of a COLLECTORS_GUIDE.
Definition: collectors.h:385
MAGNETIC_SETTINGS m_MagneticItems
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
virtual void Update3DView(bool aForceReload, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
Message panel definition file.
void FocusOnLocation(const wxPoint &aPos)
Useful to focus on a particular location, in find functions Move the graphic cursor (crosshair cursor...
void NewDisplay(bool aForceImmediateRedraw=false)
Reload and refresh (rebuild) the 3D scene.
PCB_DISPLAY_OPTIONS m_Display
Rendering engine changes.
Definition: tool_base.h:83
EDA_3D_VIEWER * Get3DViewerFrame()
virtual void ShowChangedLanguage()
Redraw the menus and what not in current language.
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
const wxPoint GetPosition() const override
Definition: class_module.h:206
#define QUALIFIED_VIEWER3D_FRAMENAME(parent)
Definition: eda_3d_viewer.h:51
void FocusOnItem(BOARD_ITEM *aItem)
VTBL_ENTRY const wxString FootprintLibTblName() const
Function FootprintLibTblName returns the path and filename of this project's fp-lib-table,...
Definition: project.cpp:140
show modules references (when texts are visibles)
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
VECTOR2D m_LocalOrigin
Relative Screen cursor coordinate (on grid) in user units.
Definition: base_screen.h:64
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193
virtual void UpdateMsgPanel()
Redraw the message panel.
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:99