KiCad PCB EDA Suite
basepcbframe.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) 2012 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-2017 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 
31 #include <fctsys.h>
32 #include <kiface_i.h>
33 #include <wxstruct.h>
34 #include <confirm.h>
35 #include <kiface_i.h>
36 #include <dialog_helpers.h>
37 #include <kicad_device_context.h>
38 #include <wxBasePcbFrame.h>
39 #include <base_units.h>
40 #include <msgpanel.h>
41 
42 #include <3d_viewer/eda_3d_viewer.h> // To include VIEWER3D_FRAMENAME
43 
44 #include <pcbnew.h>
45 #include <fp_lib_table.h>
46 #include <pcbnew_id.h>
47 #include <class_board.h>
48 #include <class_track.h>
49 #include <class_module.h>
50 #include <class_drawsegment.h>
51 
52 #include <collectors.h>
53 #include <class_drawpanel.h>
54 #include <pcb_draw_panel_gal.h>
55 #include <view/view.h>
56 #include <math/vector2d.h>
57 #include <trigo.h>
58 #include <pcb_painter.h>
59 
60 #include <tool/tool_manager.h>
61 #include <tool/tool_dispatcher.h>
62 
63 const wxChar PCB_BASE_FRAME::CANVAS_TYPE_KEY[] = wxT( "canvas_type" );
64 
65 // Configuration entry names.
66 static const wxChar UserGridSizeXEntry[] = wxT( "PcbUserGrid_X" );
67 static const wxChar UserGridSizeYEntry[] = wxT( "PcbUserGrid_Y" );
68 static const wxChar UserGridUnitsEntry[] = wxT( "PcbUserGrid_Unit" );
69 static const wxChar DisplayPadFillEntry[] = wxT( "DiPadFi" );
70 static const wxChar DisplayViaFillEntry[] = wxT( "DiViaFi" );
71 static const wxChar DisplayPadNumberEntry[] = wxT( "DiPadNu" );
72 static const wxChar DisplayModuleEdgeEntry[] = wxT( "DiModEd" );
73 static const wxChar DisplayModuleTextEntry[] = wxT( "DiModTx" );
74 static const wxChar FastGrid1Entry[] = wxT( "FastGrid1" );
75 static const wxChar FastGrid2Entry[] = wxT( "FastGrid2" );
76 
77 
78 BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME )
80  PCB_BASE_FRAME::ProcessItemSelection )
81 
84 
85  EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLAR_COORD, PCB_BASE_FRAME::OnUpdateCoordType )
86  EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_PADS_SKETCH, PCB_BASE_FRAME::OnUpdatePadDrawMode )
87  EVT_UPDATE_UI( ID_ON_GRID_SELECT, PCB_BASE_FRAME::OnUpdateSelectGrid )
88  EVT_UPDATE_UI( ID_ON_ZOOM_SELECT, PCB_BASE_FRAME::OnUpdateSelectZoom )
89  // Switching canvases
90  EVT_UPDATE_UI( ID_MENU_CANVAS_LEGACY, PCB_BASE_FRAME::OnUpdateSwitchCanvas )
91  EVT_UPDATE_UI( ID_MENU_CANVAS_CAIRO, PCB_BASE_FRAME::OnUpdateSwitchCanvas )
92  EVT_UPDATE_UI( ID_MENU_CANVAS_OPENGL, PCB_BASE_FRAME::OnUpdateSwitchCanvas )
93 
95 END_EVENT_TABLE()
96 
97 
98 PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
99  const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
100  long aStyle, const wxString & aFrameName ) :
101  EDA_DRAW_FRAME( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ),
102  m_configSettings( aFrameType )
103 {
104  m_Pcb = NULL;
105 
106  m_UserGridSize = wxRealPoint( 100.0, 100.0 );
107  m_UserGridUnit = INCHES;
108  m_Collector = new GENERAL_COLLECTOR();
109 
110  m_FastGrid1 = 0;
111  m_FastGrid2 = 0;
112 
113  m_auxiliaryToolBar = NULL;
114 
115  m_zoomLevelCoeff = 11.0 * IU_PER_MILS; // Adjusted to roughly displays zoom level = 1
116  // when the screen shows a 1:1 image
117  // obviously depends on the monitor,
118  // but this is an acceptable value
119 }
120 
121 
123 {
124  delete m_Collector;
125  delete m_Pcb;
126 }
127 
128 
130 {
131  // return the 3D viewer frame, when exists, or NULL
132  return dynamic_cast<EDA_3D_VIEWER*>
133  ( wxWindow::FindWindowByName( VIEWER3D_FRAMENAME ) );
134 }
135 
136 
138 {
139  // This is a lazy loading function, it loads the project specific table when
140  // that table is asked for, not before.
141 
143 
144  // its gotta be NULL or a FP_LIB_TABLE, or a bug.
145  wxASSERT( !tbl || dynamic_cast<FP_LIB_TABLE*>( tbl ) );
146 
147  if( !tbl )
148  {
149  // Stack the project specific FP_LIB_TABLE overlay on top of the global table.
150  // ~FP_LIB_TABLE() will not touch the fallback table, so multiple projects may
151  // stack this way, all using the same global fallback table.
152  tbl = new FP_LIB_TABLE( &GFootprintTable );
153 
154  SetElem( ELEM_FPTBL, tbl );
155 
156  wxString projectFpLibTableFileName = FootprintLibTblName();
157 
158  try
159  {
160  tbl->Load( projectFpLibTableFileName );
161  }
162  catch( const IO_ERROR& ioe )
163  {
164  DisplayErrorMessage( nullptr,
165  _( "Error loading project footprint libraries" ),
166  ioe.What() );
167  }
168  }
169 
170  return tbl;
171 }
172 
173 
175 {
176  if( m_Pcb != aBoard )
177  {
178  delete m_Pcb;
179  m_Pcb = aBoard;
180  m_Pcb->SetColorsSettings( &Settings().Colors() );
181  }
182 }
183 
184 
185 void PCB_BASE_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
186 {
187  wxASSERT( m_Pcb );
188  m_Pcb->SetPageSettings( aPageSettings );
189 
190  if( GetScreen() )
191  GetScreen()->InitDataPoints( aPageSettings.GetSizeIU() );
192 }
193 
194 
196 {
197  wxASSERT( m_Pcb );
198  return m_Pcb->GetPageSettings();
199 }
200 
201 
202 const wxSize PCB_BASE_FRAME::GetPageSizeIU() const
203 {
204  wxASSERT( m_Pcb );
205 
206  // this function is only needed because EDA_DRAW_FRAME is not compiled
207  // with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
208  // into an application specific source file.
209  return m_Pcb->GetPageSettings().GetSizeIU();
210 }
211 
212 
214 {
215  wxASSERT( m_Pcb );
216  return m_Pcb->GetAuxOrigin();
217 }
218 
219 
221 {
222  wxASSERT( m_Pcb );
223  m_Pcb->SetAuxOrigin( aPoint );
224 }
225 
226 
228 {
229  wxASSERT( m_Pcb );
230  return m_Pcb->GetGridOrigin();
231 }
232 
233 
235 {
236  wxASSERT( m_Pcb );
237  m_Pcb->SetGridOrigin( aPoint );
238 }
239 
240 
242 {
243  wxASSERT( m_Pcb );
244  return m_Pcb->GetTitleBlock();
245 }
246 
247 
248 void PCB_BASE_FRAME::SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
249 {
250  wxASSERT( m_Pcb );
251  m_Pcb->SetTitleBlock( aTitleBlock );
252 }
253 
254 
256 {
257  wxASSERT( m_Pcb );
258  return m_Pcb->GetDesignSettings();
259 }
260 
261 
263 {
264  wxASSERT( m_Pcb );
265  m_Pcb->SetDesignSettings( aSettings );
266 }
267 
268 
270 {
271  wxASSERT( m_Pcb );
272  return m_Pcb->GetZoneSettings();
273 }
274 
275 
277 {
278  wxASSERT( m_Pcb );
279  m_Pcb->SetZoneSettings( aSettings );
280 }
281 
282 
284 {
285  wxASSERT( m_Pcb );
286  return m_Pcb->GetPlotOptions();
287 }
288 
289 
291 {
292  wxASSERT( m_Pcb );
293  m_Pcb->SetPlotOptions( aSettings );
294 }
295 
296 
297 EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
298 {
299  wxASSERT( m_Pcb );
300 
301  EDA_RECT area = aBoardEdgesOnly ? m_Pcb->GetBoardEdgesBoundingBox() : m_Pcb->GetBoundingBox();
302 
303  if( area.GetWidth() == 0 && area.GetHeight() == 0 )
304  {
305  wxSize pageSize = GetPageSizeIU();
306 
308  {
309  area.SetOrigin( 0, 0 );
310  area.SetEnd( pageSize.x, pageSize.y );
311  }
312  else
313  {
314  area.SetOrigin( -pageSize.x / 2, -pageSize.y / 2 );
315  area.SetEnd( pageSize.x / 2, pageSize.y / 2 );
316  }
317  }
318 
319  return area;
320 }
321 
322 
324 {
325  if( m_Pcb == NULL )
326  return 1.0;
327 
328  EDA_RECT ibbbox = GetBoardBoundingBox();
329  DSIZE clientz = m_canvas->GetClientSize();
330  DSIZE boardz( ibbbox.GetWidth(), ibbbox.GetHeight() );
331 
332  double iu_per_du_X = clientz.x ? boardz.x / clientz.x : 1.0;
333  double iu_per_du_Y = clientz.y ? boardz.y / clientz.y : 1.0;
334 
335  double bestzoom = std::max( iu_per_du_X, iu_per_du_Y );
336 
337  SetScrollCenterPosition( ibbbox.Centre() );
338 
339  return bestzoom;
340 }
341 
342 
343 void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos, bool aWarp )
344 {
345  // factored out of pcbnew/find.cpp
346 
348 
349  // There may be need to reframe the drawing.
350  if( !m_canvas->IsPointOnDisplay( aPos ) )
351  {
352  SetCrossHairPosition( aPos );
353  RedrawScreen( aPos, aWarp );
354  }
355  else
356  {
357  // Put cursor on item position
358  m_canvas->CrossHairOff( &dc );
359  SetCrossHairPosition( aPos );
360 
361  if( aWarp )
363  }
364  m_canvas->CrossHairOn( &dc );
365  m_canvas->CrossHairOn( &dc );
366 }
367 
368 
369 // Virtual function
371 {
372 }
373 
374 
375 // Virtual functions: Do nothing for PCB_BASE_FRAME window
376 void PCB_BASE_FRAME::Show3D_Frame( wxCommandEvent& event )
377 {
378 }
379 
380 
381 // Note: virtual, overridden in PCB_EDIT_FRAME;
383 {
384  PCB_LAYER_ID preslayer = GetActiveLayer();
386 
387  // Check if the specified layer matches the present layer
388  if( layer == preslayer )
389  return;
390 
391  // Copper layers cannot be selected unconditionally; how many
392  // of those layers are currently enabled needs to be checked.
393  if( IsCopperLayer( layer ) )
394  {
395  // If only one copper layer is enabled, the only such layer
396  // that can be selected to is the "Copper" layer (so the
397  // selection of any other copper layer is disregarded).
398  if( m_Pcb->GetCopperLayerCount() < 2 )
399  {
400  if( layer != B_Cu )
401  {
402  return;
403  }
404  }
405 
406  // If more than one copper layer is enabled, the "Copper"
407  // and "Component" layers can be selected, but the total
408  // number of copper layers determines which internal
409  // layers are also capable of being selected.
410  else
411  {
412  if( ( layer != B_Cu ) && ( layer != F_Cu )
413  && ( layer >= m_Pcb->GetCopperLayerCount() - 1 ) )
414  {
415  return;
416  }
417  }
418  }
419 
420  // Is yet more checking required? E.g. when the layer to be selected
421  // is a non-copper layer, or when switching between a copper layer
422  // and a non-copper layer, or vice-versa?
423  // ...
424 
425  GetScreen()->m_Active_Layer = layer;
426 
427  if( displ_opts->m_ContrastModeDisplay )
428  m_canvas->Refresh();
429 }
430 
431 
432 void PCB_BASE_FRAME::OnTogglePolarCoords( wxCommandEvent& aEvent )
433 {
435  SetStatusText( wxEmptyString );
436 
437  displ_opts->m_DisplayPolarCood = !displ_opts->m_DisplayPolarCood;
438 
439  UpdateStatusBar();
440 }
441 
442 
443 void PCB_BASE_FRAME::OnTogglePadDrawMode( wxCommandEvent& aEvent )
444 {
446 
447  displ_opts->m_DisplayPadFill = !displ_opts->m_DisplayPadFill;
449 
450  if( gal )
451  {
452  // Apply new display options to the GAL canvas
453  auto view = gal->GetView();
454  auto painter = static_cast<KIGFX::PCB_PAINTER*> ( view->GetPainter() );
455  auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*> ( painter->GetSettings() );
456  settings->LoadDisplayOptions( displ_opts );
457 
458  // Update pads
459  BOARD* board = GetBoard();
460  for( MODULE* module = board->m_Modules; module; module = module->Next() )
461  {
462  for( auto pad : module->Pads() )
463  view->Update( pad, KIGFX::GEOMETRY );
464  }
465  }
466 
467  m_canvas->Refresh();
468 }
469 
470 
471 void PCB_BASE_FRAME::OnUpdateCoordType( wxUpdateUIEvent& aEvent )
472 {
474 
475  aEvent.Check( displ_opts->m_DisplayPolarCood );
477  displ_opts->m_DisplayPolarCood ?
478  _( "Display rectangular coordinates" ) :
479  _( "Display polar coordinates" ) );
480 }
481 
482 
483 void PCB_BASE_FRAME::OnUpdatePadDrawMode( wxUpdateUIEvent& aEvent )
484 {
486  aEvent.Check( !displ_opts->m_DisplayPadFill );
488  displ_opts->m_DisplayPadFill ?
489  _( "Show pads in outline mode" ) :
490  _( "Show pads in fill mode" ) );
491 }
492 
493 
494 void PCB_BASE_FRAME::OnUpdateSelectGrid( wxUpdateUIEvent& aEvent )
495 {
496  // No need to update the grid select box if it doesn't exist or the grid setting change
497  // was made using the select box.
498  if( m_gridSelectBox == NULL || m_auxiliaryToolBar == NULL )
499  return;
500 
501  int select = wxNOT_FOUND;
502 
503  for( size_t i = 0; i < GetScreen()->GetGridCount(); i++ )
504  {
505  if( GetScreen()->GetGridCmdId() == GetScreen()->GetGrid( i ).m_CmdId )
506  {
507  select = (int) i;
508  break;
509  }
510  }
511 
512  if( select != m_gridSelectBox->GetSelection() )
513  m_gridSelectBox->SetSelection( select );
514 }
515 
516 
517 void PCB_BASE_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent )
518 {
519  if( m_zoomSelectBox == NULL || m_auxiliaryToolBar == NULL )
520  return;
521 
522  int current = 0;
523  double zoom = IsGalCanvasActive() ? GetGalCanvas()->GetLegacyZoom() : GetScreen()->GetZoom();
524 
525  for( unsigned i = 0; i < GetScreen()->m_ZoomList.size(); i++ )
526  {
527  if( std::fabs( zoom - GetScreen()->m_ZoomList[i] ) < 1e-6 )
528  {
529  current = i + 1;
530  break;
531  }
532  }
533 
534  if( current != m_zoomSelectBox->GetSelection() )
535  m_zoomSelectBox->SetSelection( current );
536 }
537 
538 
539 void PCB_BASE_FRAME::ProcessItemSelection( wxCommandEvent& aEvent )
540 {
541  int id = aEvent.GetId();
542 
543  // index into the collector list:
544  int itemNdx = id - ID_POPUP_PCB_ITEM_SELECTION_START;
545 
546  if( id >= ID_POPUP_PCB_ITEM_SELECTION_START && id <= ID_POPUP_PCB_ITEM_SELECTION_END )
547  {
548  BOARD_ITEM* item = (*m_Collector)[itemNdx];
549  m_canvas->SetAbortRequest( false );
550 
551 #if 0 && defined (DEBUG)
552  item->Show( 0, std::cout );
553 #endif
554 
555  SetCurItem( item );
556  }
557 }
558 
559 
560 void PCB_BASE_FRAME::SetCurItem( BOARD_ITEM* aItem, bool aDisplayInfo )
561 {
562  GetScreen()->SetCurItem( aItem );
563 
564  if( aDisplayInfo )
565  UpdateMsgPanel();
566 }
567 
568 
570 {
571  BOARD_ITEM* item = GetScreen()->GetCurItem();
572  MSG_PANEL_ITEMS items;
573 
574  if( item )
575  {
576  item->GetMsgPanelInfo( items );
577  }
578  else // show general information about the board
579  {
580  if( IsGalCanvasActive() )
581  GetGalCanvas()->GetMsgPanelInfo( items );
582  else
583  m_Pcb->GetMsgPanelInfo( items );
584  }
585 
586  SetMsgPanel( items );
587 }
588 
589 
591 {
592  return GetScreen()->GetCurItem();
593 }
594 
595 
597 {
599  GetActiveLayer() );
600 
601  // account for the globals
603  guide.SetIgnoreMTextsOnBack( ! m_Pcb->IsElementVisible( LAYER_MOD_TEXT_BK ) );
604  guide.SetIgnoreMTextsOnFront( ! m_Pcb->IsElementVisible( LAYER_MOD_TEXT_FR ) );
605  guide.SetIgnoreModulesOnBack( ! m_Pcb->IsElementVisible( LAYER_MOD_BK ) );
606  guide.SetIgnoreModulesOnFront( ! m_Pcb->IsElementVisible( LAYER_MOD_FR ) );
607  guide.SetIgnorePadsOnBack( ! m_Pcb->IsElementVisible( LAYER_PAD_BK ) );
608  guide.SetIgnorePadsOnFront( ! m_Pcb->IsElementVisible( LAYER_PAD_FR ) );
609  guide.SetIgnoreModulesVals( ! m_Pcb->IsElementVisible( LAYER_MOD_VALUES ) );
610  guide.SetIgnoreModulesRefs( ! m_Pcb->IsElementVisible( LAYER_MOD_REFERENCES ) );
611 
612  return guide;
613 }
614 
615 void PCB_BASE_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
616 {
617  bool redraw = false;
618 
619  EDA_DRAW_FRAME::SetToolID( aId, aCursor, aToolMsg );
620 
621  if( aId < 0 )
622  return;
623 
625 
626  // handle color changes for transitions in and out of ID_TRACK_BUTT
627  if( ( GetToolId() == ID_TRACK_BUTT && aId != ID_TRACK_BUTT )
628  || ( GetToolId() != ID_TRACK_BUTT && aId == ID_TRACK_BUTT ) )
629  {
630  if( displ_opts->m_ContrastModeDisplay )
631  redraw = true;
632  }
633 
634  // must do this after the tool has been set, otherwise pad::Draw() does
635  // not show proper color when GetDisplayOptions().ContrastModeDisplay is true.
636  if( redraw && m_canvas )
637  m_canvas->Refresh();
638 }
639 
640 
641 /*
642  * Update the status bar information.
643  */
645 {
646  PCB_SCREEN* screen = GetScreen();
647 
648  if( !screen )
649  return;
650 
651  int dx;
652  int dy;
653  double dXpos;
654  double dYpos;
655  wxString line;
656  wxString locformatter;
658 
660 
661  if( displ_opts->m_DisplayPolarCood ) // display polar coordinates
662  {
663  double theta, ro;
664 
665  dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
666  dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
667 
668  theta = ArcTangente( -dy, dx ) / 10;
669 
670  ro = hypot( dx, dy );
671  wxString formatter;
672  switch( g_UserUnit )
673  {
674  case INCHES:
675  formatter = wxT( "Ro %.6f Th %.1f" );
676  break;
677 
678  case MILLIMETRES:
679  formatter = wxT( "Ro %.6f Th %.1f" );
680  break;
681 
682  case UNSCALED_UNITS:
683  formatter = wxT( "Ro %f Th %f" );
684  break;
685 
686  case DEGREES:
687  wxASSERT( false );
688  break;
689  }
690 
691  line.Printf( formatter, To_User_Unit( g_UserUnit, ro ), theta );
692 
693  SetStatusText( line, 3 );
694  }
695 
696  // Display absolute coordinates:
699 
700  // The following sadly is an if Eeschema/if Pcbnew
701  wxString absformatter;
702 
703  switch( g_UserUnit )
704  {
705  case INCHES:
706  absformatter = wxT( "X %.6f Y %.6f" );
707  locformatter = wxT( "dx %.6f dy %.6f dist %.4f" );
708  break;
709 
710  case MILLIMETRES:
711  absformatter = wxT( "X %.6f Y %.6f" );
712  locformatter = wxT( "dx %.6f dy %.6f dist %.3f" );
713  break;
714 
715  case UNSCALED_UNITS:
716  absformatter = wxT( "X %f Y %f" );
717  locformatter = wxT( "dx %f dy %f dist %f" );
718  break;
719 
720  case DEGREES:
721  wxASSERT( false );
722  break;
723  }
724 
725  line.Printf( absformatter, dXpos, dYpos );
726  SetStatusText( line, 2 );
727 
728  if( !displ_opts->m_DisplayPolarCood ) // display relative cartesian coordinates
729  {
730  // Display relative coordinates:
731  dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
732  dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
733  dXpos = To_User_Unit( g_UserUnit, dx );
734  dYpos = To_User_Unit( g_UserUnit, dy );
735 
736  // We already decided the formatter above
737  line.Printf( locformatter, dXpos, dYpos, hypot( dXpos, dYpos ) );
738  SetStatusText( line, 3 );
739  }
740 }
741 
742 
744 {
745  EDA_DRAW_FRAME::unitsChangeRefresh(); // Update the status bar.
746 
748 }
749 
750 
751 void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
752 {
754 
755  // Ensure grid id is an existent grid id:
756  if( (m_LastGridSizeId <= 0) ||
759 
760  wxString baseCfgName = GetName();
761 
762  aCfg->Read( baseCfgName + UserGridSizeXEntry, &m_UserGridSize.x, 0.01 );
763  aCfg->Read( baseCfgName + UserGridSizeYEntry, &m_UserGridSize.y, 0.01 );
764 
765  long itmp;
766  aCfg->Read( baseCfgName + UserGridUnitsEntry, &itmp, ( long )INCHES );
767  m_UserGridUnit = (EDA_UNITS_T) itmp;
768  aCfg->Read( baseCfgName + DisplayPadFillEntry, &m_DisplayOptions.m_DisplayPadFill, true );
769  aCfg->Read( baseCfgName + DisplayViaFillEntry, &m_DisplayOptions.m_DisplayViaFill, true );
770  aCfg->Read( baseCfgName + DisplayPadNumberEntry, &m_DisplayOptions.m_DisplayPadNum, true );
771  aCfg->Read( baseCfgName + DisplayModuleEdgeEntry, &m_DisplayOptions.m_DisplayModEdgeFill, true );
772 
773  aCfg->Read( baseCfgName + FastGrid1Entry, &itmp, ( long )0);
774  m_FastGrid1 = itmp;
775  aCfg->Read( baseCfgName + FastGrid2Entry, &itmp, ( long )0);
776  m_FastGrid2 = itmp;
777 
778  aCfg->Read( baseCfgName + DisplayModuleTextEntry, &m_DisplayOptions.m_DisplayModTextFill, true );
779 }
780 
781 
782 void PCB_BASE_FRAME::SaveSettings( wxConfigBase* aCfg )
783 {
785 
786  wxString baseCfgName = GetName();
787 
788  aCfg->Write( baseCfgName + UserGridSizeXEntry, m_UserGridSize.x );
789  aCfg->Write( baseCfgName + UserGridSizeYEntry, m_UserGridSize.y );
790  aCfg->Write( baseCfgName + UserGridUnitsEntry, ( long )m_UserGridUnit );
791  aCfg->Write( baseCfgName + DisplayPadFillEntry, m_DisplayOptions.m_DisplayPadFill );
792  aCfg->Write( baseCfgName + DisplayViaFillEntry, m_DisplayOptions.m_DisplayViaFill );
793  aCfg->Write( baseCfgName + DisplayPadNumberEntry, m_DisplayOptions.m_DisplayPadNum );
794  aCfg->Write( baseCfgName + DisplayModuleEdgeEntry, m_DisplayOptions.m_DisplayModEdgeFill );
795  aCfg->Write( baseCfgName + DisplayModuleTextEntry, m_DisplayOptions.m_DisplayModTextFill );
796  aCfg->Write( baseCfgName + FastGrid1Entry, ( long )m_FastGrid1 );
797  aCfg->Write( baseCfgName + FastGrid2Entry, ( long )m_FastGrid2 );
798 }
799 
800 
802 {
803  GetScreen()->SetModify();
804  GetScreen()->SetSave();
805 
806  if( IsGalCanvasActive() )
807  {
808  UpdateStatusBar();
809  UpdateMsgPanel();
810  }
811 }
812 
813 
815 {
817 }
818 
819 
821 {
822  UpdateStatusBar();
823  DisplayUnitsMsg();
824 
825  if( m_gridSelectBox == NULL )
826  return;
827 
828  // Update grid values with the current units setting.
829  m_gridSelectBox->Clear();
830  wxArrayString gridsList;
831  int icurr = GetScreen()->BuildGridsChoiceList( gridsList, g_UserUnit != INCHES );
832 
833  for( size_t i = 0; i < GetScreen()->GetGridCount(); i++ )
834  {
835  GRID_TYPE& grid = GetScreen()->GetGrid( i );
836  m_gridSelectBox->Append( gridsList[i], (void*) &grid.m_CmdId );
837  }
838 
839  m_gridSelectBox->SetSelection( icurr );
840 }
841 
843 {
844  if( m_zoomSelectBox == NULL )
845  return;
846 
847  wxString msg;
848 
849  m_zoomSelectBox->Clear();
850  m_zoomSelectBox->Append( _( "Zoom Auto" ) );
851  m_zoomSelectBox->SetSelection( 0 );
852 
853  for( unsigned i = 0; i < GetScreen()->m_ZoomList.size(); ++i )
854  {
855  msg = _( "Zoom " );
856 
857  double level = m_zoomLevelCoeff / (double)GetScreen()->m_ZoomList[i];
858  wxString value = wxString::Format( wxT( "%.2f" ), level );
859  msg += value;
860 
861  m_zoomSelectBox->Append( msg );
862 
863  if( GetScreen()->GetZoom() == GetScreen()->m_ZoomList[i] )
864  m_zoomSelectBox->SetSelection( i + 1 );
865  }
866 }
867 
868 
870 {
871  if( m_FastGrid1 >= (int)GetScreen()->GetGridCount() )
872  return;
873 
874  int cmdId = GetScreen()->GetGrids()[m_FastGrid1].m_CmdId;
876 
877  if( m_gridSelectBox )
878  {
879  wxCommandEvent cmd( wxEVT_CHOICE );
880  cmd.SetEventObject( this );
881  OnSelectGrid( cmd );
882  }
883  else
884  GetCanvas()->Refresh();
885 }
886 
887 
889 {
890  if( m_FastGrid2 >= (int)GetScreen()->GetGridCount() )
891  return;
892 
893  int cmdId = GetScreen()->GetGrids()[m_FastGrid2].m_CmdId;
895 
896  if( m_gridSelectBox )
897  {
898  wxCommandEvent cmd( wxEVT_CHOICE );
899  cmd.SetEventObject( this );
900  OnSelectGrid( cmd );
901  }
902  else
903  GetCanvas()->Refresh();
904 }
905 
907 {
909 
910  if( m_gridSelectBox )
911  {
912  wxCommandEvent cmd( wxEVT_CHOICE );
913  cmd.SetEventObject( this );
914  OnSelectGrid( cmd );
915  }
916  else
917  GetCanvas()->Refresh();
918 }
919 
920 
922 {
924 
925  if( m_gridSelectBox )
926  {
927  wxCommandEvent cmd( wxEVT_CHOICE );
928  cmd.SetEventObject( this );
929  OnSelectGrid( cmd );
930  }
931  else
932  GetCanvas()->Refresh();
933 }
934 
935 
936 void PCB_BASE_FRAME::SwitchCanvas( wxCommandEvent& aEvent )
937 {
938  bool use_gal = false;
940 
941  switch( aEvent.GetId() )
942  {
944  break;
945 
948 
949  if( use_gal )
951  break;
952 
955 
956  if( use_gal )
958  break;
959  }
960 
961  SaveCanvasTypeSetting( canvasType );
962  UseGalCanvas( use_gal );
963 }
964 
965 
966 void PCB_BASE_FRAME::UseGalCanvas( bool aEnable )
967 {
968  EDA_DRAW_FRAME::UseGalCanvas( aEnable );
969 
970  EDA_DRAW_PANEL_GAL* galCanvas = GetGalCanvas();
971 
972  if( m_toolManager )
974  GetGalCanvas()->GetViewControls(), this );
975 
976  if( aEnable )
977  {
978  SetBoard( m_Pcb );
979 
980  if( m_toolManager )
982 
983  // Transfer latest current display options from legacy to GAL canvas:
984  auto painter = static_cast<KIGFX::PCB_PAINTER*>( galCanvas->GetView()->GetPainter() );
985  auto settings = painter->GetSettings();
987  settings->LoadDisplayOptions( displ_opts );
988 
989  galCanvas->GetView()->RecacheAllItems();
990  galCanvas->SetEventDispatcher( m_toolDispatcher );
991  galCanvas->StartDrawing();
992  }
993  else
994  {
995  if( m_toolManager )
997 
998  // Redirect all events to the legacy canvas
999  galCanvas->SetEventDispatcher( NULL );
1000  }
1001 }
1002 
1003 
1005 {
1007  wxConfigBase* cfg = Kiface().KifaceSettings();
1008 
1009  if( cfg )
1010  canvasType = (EDA_DRAW_PANEL_GAL::GAL_TYPE) cfg->ReadLong( CANVAS_TYPE_KEY,
1012 
1013  if( canvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
1014  || canvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
1015  {
1016  assert( false );
1017  canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
1018  }
1019 
1020  return canvasType;
1021 }
1022 
1023 
1025 {
1026  if( aCanvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
1027  || aCanvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
1028  {
1029  assert( false );
1030  return false;
1031  }
1032 
1033  wxConfigBase* cfg = Kiface().KifaceSettings();
1034 
1035  if( cfg )
1036  return cfg->Write( CANVAS_TYPE_KEY, (long) aCanvasType );
1037 
1038  return false;
1039 }
1040 
1041 
1042 void PCB_BASE_FRAME::OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent )
1043 {
1044  wxMenuBar* menuBar = GetMenuBar();
1045  EDA_DRAW_PANEL_GAL* gal_canvas = GetGalCanvas();
1047 
1048  if( IsGalCanvasActive() && gal_canvas )
1049  canvasType = gal_canvas->GetBackend();
1050 
1051  struct { int menuId; int galType; } menuList[] =
1052  {
1056  };
1057 
1058  for( auto ii: menuList )
1059  {
1060  wxMenuItem* item = menuBar->FindItem( ii.menuId );
1061  if( ii.galType == canvasType )
1062  item->Check( true );
1063  }
1064 }
void SetColorsSettings(COLORS_DESIGN_SETTINGS *aColorsSettings)
Function SetColorsSettings.
Definition: class_board.h:569
TOOL_MANAGER * m_toolManager
Definition: draw_frame.h:94
virtual void SwitchCanvas(wxCommandEvent &aEvent)
switches currently used canvas (default / Cairo / OpenGL).
static const wxChar FastGrid1Entry[]
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
Definition: class_board.h:785
virtual void SetBoard(BOARD *aBoard)
Function SetBoard sets the m_Pcb member in such as way as to ensure deleting any previous BOARD...
void SetZoneSettings(const ZONE_SETTINGS &aSettings)
Definition: class_board.h:557
void SetCurItem(BOARD_ITEM *aItem)
Function SetCurItem sets the currently selected object, m_CurrentItem.
bool IsElementVisible(GAL_LAYER_ID LAYER_aPCB) const
Function IsElementVisible tests whether a given element category is visible.
void OnTogglePadDrawMode(wxCommandEvent &aEvent)
const ZONE_SETTINGS & GetZoneSettings() const
Definition: class_board.h:556
virtual void Show3D_Frame(wxCommandEvent &event)
virtual void unitsChangeRefresh() override
Function unitsChangeRefresh is called when when the units setting has changed to allow for any derive...
bool SaveCanvasTypeSetting(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Function SaveCanvasTypeSetting() Stores the canvas type in the application settings.
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg) override
Function SetToolID sets the tool command ID to aId and sets the cursor to aCursor.
void SetGridOrigin(const wxPoint &aPoint)
Function SetGridOrigin sets the origin point of the grid.
Definition: class_board.h:349
virtual const wxString GetZoomLevelIndicator() const
Function GetZoomLevelIndicator returns a human readable value which can be displayed as zoom level in...
Definition: draw_frame.cpp:680
const wxPoint & GetGridOrigin() const
Definition: class_board.h:350
void SetGridOrigin(const wxPoint &aPoint) override
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:326
GAL_TYPE GetBackend() const
Function GetBackend Returns the type of backend currently used by GAL canvas.
Implementation of conversion functions that require both schematic and board internal units...
This file is part of the common library.
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
TOOL_DISPATCHER * m_toolDispatcher
Definition: draw_frame.h:95
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:299
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
Definition: class_board.h:554
int GetGridCmdId() const
Return the command ID of the currently selected grid.
double GetLegacyZoom() const
Function GetLegacyZoom() Returns current view scale converted to zoom value used by the legacy canvas...
void OnUpdateCoordType(wxUpdateUIEvent &aEvent)
virtual bool SwitchBackend(GAL_TYPE aGalType)
Function SwitchBackend Switches method of rendering graphics.
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
static const wxChar UserGridSizeXEntry[]
double GetZoom() const
Function GetZoom returns the current "zoom factor", which is a measure of "internal units per device ...
void SetScrollCenterPosition(const wxPoint &aPoint)
Class BOARD to handle a board.
void SetFastGrid2()
Function SetFastGrid2()
const ZONE_SETTINGS & GetZoneSettings() const
void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: class_board.h:548
static const wxChar DisplayModuleEdgeEntry[]
void RecacheAllItems()
Function RecacheAllItems() Rebuilds GAL display lists.
Definition: view.cpp:1245
MODULE * Next() const
Definition: class_module.h:100
void updateGridSelectBox()
Definition: id.h:232
int GetCopperLayerCount() const
Function GetCopperLayerCount.
const wxPoint & GetGridOrigin() const override
Function GetGridOrigin returns the absolute coordinates of the origin of the snap grid...
void SetCurItem(BOARD_ITEM *aItem, bool aDisplayInfo=true)
Function SetCurItem sets the currently selected item and displays it in the MsgPanel.
show modules on back
int GetHeight() const
const GRIDS & GetGrids() const
Function GetGrids().
void OnUpdatePadDrawMode(wxUpdateUIEvent &aEvent)
void SetOrigin(const wxPoint &pos)
show modules values (when texts are visibles)
bool m_DisplayModEdgeFill
Definition: pcbstruct.h:69
BOARD * GetBoard() const
EDA_UNITS_T m_UserGridUnit
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock) override
bool m_DisplayPolarCood
Definition: pcbstruct.h:76
VTBL_ENTRY _ELEM * GetElem(ELEM_T aIndex)
Typically wrapped somewhere else in a more meaningful function wrapper.
Definition: project.cpp:196
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard FOOTPRINT_EDIT_FRAME::OnUpdateReplaceModuleInBoard EVT_UPDATE_UI_RANGE(ID_MODEDIT_PAD_TOOL, ID_MODEDIT_MEASUREMENT_TOOL, FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar) EVT_UPDATE_UI(ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH
void SetNextGrid() override
Virtual function SetNextGrid() changes the grid size settings to the next one available.
Sentinel, do not use as a parameter.
virtual void SetPrevGrid()
Function SetPrevGrid() changes the grid size settings to the previous one available.
Definition: draw_frame.cpp:600
Class EDA_DRAW_FRAME is the base class for create windows for drawing purpose.
Definition: draw_frame.h:53
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:348
void LoadDisplayOptions(const DISPLAY_OPTIONS *aOptions)
Function LoadDisplayOptions Loads settings related to display options (high-contrast mode...
Class PCB_PAINTER Contains methods for drawing PCB-specific items.
Definition: pcb_painter.h:173
PCB_LAYER_ID m_Active_Layer
Class TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout, or editing view.
void OnUpdateSelectZoom(wxUpdateUIEvent &aEvent)
smd pads, back layer
wxPoint m_O_Curseur
Relative Screen cursor coordinate (on grid) in user units.
wxChoice * m_gridSelectBox
Choice box to choose the grid size.
Definition: draw_frame.h:115
virtual void UseGalCanvas(bool aEnable)
Function UseGalCanvas used to switch between standard and GAL-based canvas.
void SetAuxOrigin(const wxPoint &aPoint)
Function SetAuxOrigin sets the origin point used for plotting.
Definition: class_board.h:342
void SaveSettings(wxConfigBase *aCfg) override
Function SaveSettings saves common frame parameters to a configuration data file. ...
Definition: draw_frame.cpp:735
virtual const PCB_PLOT_PARAMS & GetPlotSettings() const
Function GetPlotSettings returns the PCB_PLOT_PARAMS for the BOARD owned by this frame.
const wxPoint & GetAuxOrigin() const override
Function GetAuxOrigin returns the origin of the axis used for plotting and various exports...
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
Functions relatives to tracks, vias and segments used to fill zones.
size_t GetGridCount() const
Function GetGridCount().
void * GetDisplayOptions() override
Function GetDisplayOptions returns the display options current in use Display options are relative to...
FP_LIB_TABLE GFootprintTable
The global footprint library table.
Definition: pcbnew.cpp:311
virtual void UseGalCanvas(bool aEnable) override
>
void DisplayUnitsMsg()
Function DisplayUnitsMsg displays current unit pane on the status bar.
Definition: draw_frame.cpp:503
void CursorGoto(const wxPoint &aPos, bool aWarp=true)
Function CursorGoto positions the cursor at a given coordinate and reframes the drawing if the reques...
VTBL_ENTRY void SetElem(ELEM_T aIndex, _ELEM *aElem)
Definition: project.cpp:208
wxRealPoint m_UserGridSize
const EDA_RECT GetBoardEdgesBoundingBox() const
Function GetBoardEdgesBoundingBox Returns the board bounding box calculated using exclusively the boa...
Definition: class_board.h:797
EVT_MENU_RANGE(ID_POPUP_PCB_ITEM_SELECTION_START, ID_POPUP_PCB_ITEM_SELECTION_END, PCB_BASE_FRAME::ProcessItemSelection) PCB_BASE_FRAME
GENERAL_COLLECTOR * m_Collector
show modules on front
void SetFastGrid1()
Function SetFastGrid1()
void InitDataPoints(const wxSize &aPageSizeInternalUnits)
Definition: base_screen.cpp:69
int BuildGridsChoiceList(wxArrayString &aGridsList, bool aMmFirst) const
Function BuildGridsChoiceList().
Class PCB_RENDER_SETTINGS Stores PCB specific render settings.
Definition: pcb_painter.h:62
static const wxChar DisplayViaFillEntry[]
bool IsPointOnDisplay(const wxPoint &aPosition)
Function IsPointOnDisplay.
Definition: draw_panel.cpp:288
PCB_LAYER_ID
A quick note on layer IDs:
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide()
Function GetCollectorsGuide.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString aExtraInfo)
Function DisplayErrorMessage displays an error message with aMessage.
Definition: confirm.cpp:85
a helper to handle the real device context used in KiCad
BOARD_ITEM * GetCurItem() const
Function GetCurItem returns the currently selected BOARD_ITEM, overriding BASE_SCREEN::GetCurItem().
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:125
static const wxChar UserGridUnitsEntry[]
Classes used in Pcbnew, CvPcb and GerbView.
double ArcTangente(int dy, int dx)
Definition: trigo.cpp:271
const GRID_TYPE & GetGrid() const
Return the grid object of the currently selected grid.
virtual PCB_RENDER_SETTINGS * GetSettings() override
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
Definition: pcb_painter.h:185
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Function SetMsgPanel clears the message panel and populates it with the contents of aList...
Definition: draw_frame.cpp:773
static const wxChar DisplayModuleTextEntry[]
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, wxWindow *aFrame)
Sets the work environment (model, view, view controls and the parent window).
void OnTogglePolarCoords(wxCommandEvent &aEvent)
Base window classes and related definitions.
PCB_GENERAL_SETTINGS & Settings()
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:112
void SetEnd(int x, int y)
Definition: common.h:145
wxChoice * m_zoomSelectBox
Choice box to choose the zoom value.
Definition: draw_frame.h:118
static const wxChar FastGrid2Entry[]
double GetZoom()
Function GetZoom.
Definition: draw_frame.cpp:480
void OnUpdateSelectGrid(wxUpdateUIEvent &aEvent)
void OnUpdateSwitchCanvas(wxUpdateUIEvent &aEvent)
Update UI called when switches currently used canvas (default / Cairo / OpenGL).
bool m_ContrastModeDisplay
Definition: pcbstruct.h:85
const PCB_PLOT_PARAMS & GetPlotOptions() const
Definition: class_board.h:550
Helper dialog and control classes.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:532
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Function ResetTools() Resets all tools (i.e.
Class KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within...
Definition: kiway.h:257
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
virtual void SetPlotSettings(const PCB_PLOT_PARAMS &aSettings)
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:823
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
void SetDesignSettings(const BOARD_DESIGN_SETTINGS &aDesignSettings)
Function SetDesignSettings.
Definition: class_board.h:542
void SetPresetGrid(int aIndex)
Function SetPresetGrid() changes the grid size to one of the preset values.
Definition: draw_frame.cpp:614
EVT_TOOL(ID_FOOTPRINT_WIZARD_SELECT_WIZARD, FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard) EVT_TOOL(ID_FOOTPRINT_WIZARD_RESET_TO_DEFAULT
wxPoint Centre() const
void SetPlotOptions(const PCB_PLOT_PARAMS &aOptions)
Definition: class_board.h:551
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg)
Function SetToolID sets the tool command ID to aId and sets the cursor to aCursor.
Definition: draw_frame.cpp:535
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:196
ID_POPUP_GRID_USER
Definition: draw_frame.cpp:105
void SaveSettings(wxConfigBase *aCfg) override
Function SaveSettings saves common frame parameters to a configuration data file. ...
void SetIgnoreMTextsMarkedNoShow(bool ignore)
Definition: collectors.h:528
VTBL_ENTRY const wxString FootprintLibTblName() const
Function FootprintLibTblName returns the path and filename of this project's fp-lib-table, i.e.
Definition: project.cpp:114
virtual void ReCreateMenuBar() override
Function ReCreateMenuBar Creates recreates the menu bar.
int m_LastGridSizeId
Definition: draw_frame.h:77
static const wxChar DisplayPadFillEntry[]
void Load(const wxString &aFileName)
Function Load.
Class PCB_PLOT_PARAMS handles plot parameters and options when plotting/printing a board...
void CrossHairOff(wxDC *DC)
Definition: draw_panel.cpp:253
virtual void GetMsgPanelInfo(std::vector< MSG_PANEL_ITEM > &aList)
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
Definition: base_struct.h:277
void StartDrawing()
Function StartDrawing() Begins drawing if it was stopped previously.
static const wxChar DisplayPadNumberEntry[]
void SetAbortRequest(bool aAbortRequest)
const PAGE_INFO & GetPageSettings() const
Definition: class_board.h:547
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
Definition: draw_frame.cpp:705
DISPLAY_OPTIONS m_DisplayOptions
virtual double BestZoom() override
Function BestZoom.
virtual void SetNextGrid()
Function SetNextGrid() changes the grid size settings to the next one available.
Definition: draw_frame.cpp:586
Class DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
Definition: pcbstruct.h:62
virtual void SwitchLayer(wxDC *DC, PCB_LAYER_ID layer)
Class ZONE_SETTINGS handles zones parameters.
VTBL_ENTRY FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
static const wxChar UserGridSizeYEntry[]
const wxPoint & GetAuxOrigin() const
Definition: class_board.h:343
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
const TITLE_BLOCK & GetTitleBlock() const override
EDA_RECT GetBoardBoundingBox(bool aBoardEdgesOnly=false) const
Function GetBoardBoundingBox calculates the bounding box containing all board items (or board edge se...
void RedrawScreen(const wxPoint &aCenterPoint, bool aWarpPointer)
Function RedrawScreen redraws the entire screen area by updating the scroll bars and mouse pointer in...
Definition: zoom.cpp:46
virtual void OnModify()
Function OnModify Virtual Must be called after a change in order to set the "modify" flag of the curr...
bool m_DisplayPadFill
Definition: pcbstruct.h:65
virtual void UpdateStatusBar() override
Function UpdateStatusBar updates the status bar information.
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
void CrossHairOn(wxDC *DC)
Definition: draw_panel.cpp:260
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:85
smd pads, front layer
TITLE_BLOCK & GetTitleBlock()
Definition: class_board.h:553
virtual void OnSelectGrid(wxCommandEvent &event)
Command event handler for selecting grid sizes.
Definition: draw_frame.cpp:400
Declaration of the eda_3d_viewer class.
Class to handle a graphic segment.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
Class GRID_TYPE is for grid arrays.
#define max(a, b)
Definition: auxiliary.h:86
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
static const wxChar CANVAS_TYPE_KEY[]
Key in KifaceSettings to store the canvas type.
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Function SetEventDispatcher() Sets a dispatcher that processes events and forwards them to tools...
DLIST< MODULE > m_Modules
Definition: class_board.h:245
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
KICAD_MANAGER_FRAME::language_change KICAD_MANAGER_FRAME::OnChangeIconsOptions EVT_UPDATE_UI(ID_SELECT_PREFERED_PDF_BROWSER, KICAD_MANAGER_FRAME::OnUpdatePreferredPdfBrowser) EVT_UPDATE_UI_RANGE(ID_TO_SCH
#define INSTALL_UNBUFFERED_DC(name, parent)
bool m_DisplayPadNum
Definition: pcbstruct.h:67
Class GENERAL_COLLECTOR is intended for use when the right click button is pressed, or when the plain "arrow" tool is in effect.
Definition: collectors.h:211
int GetToolId() const
Definition: draw_frame.h:433
virtual void SetDesignSettings(const BOARD_DESIGN_SETTINGS &aSettings)
LSET GetVisibleLayers() const
Function GetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
Class EDA_RECT handles the component boundary box.
const PAGE_INFO & GetPageSettings() const override
int GetWidth() const
PCB_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:102
virtual void SetPageSettings(const PAGE_INFO &aPageSettings) override
const wxSize GetPageSizeIU() const override
Function GetPageSizeIU works off of GetPageSettings() to return the size of the paper page in the int...
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
double To_User_Unit(EDA_UNITS_T aUnit, double aValue)
Function To_User_Unit convert aValue in internal units to the appropriate user units defined by aUnit...
Definition: base_units.cpp:90
void SetZoneSettings(const ZONE_SETTINGS &aSettings)
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:831
void SetAuxOrigin(const wxPoint &aPoint) override
Class EDA_3D_VIEWER Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard...
Definition: eda_3d_viewer.h:50
Module description (excepted pads)
virtual void unitsChangeRefresh()
Function unitsChangeRefresh is called when when the units setting has changed to allow for any derive...
Definition: draw_frame.cpp:243
void updateZoomSelectBox()
void UpdateMsgPanel() override
>
Class GENERAL_COLLECTORS_GUIDE is a general implementation of a COLLECTORS_GUIDE. ...
Definition: collectors.h:378
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
Message panel definition file.
bool m_DisplayViaFill
Definition: pcbstruct.h:66
BOARD_ITEM * GetCurItem()
Rendering engine changes.
Definition: tool_base.h:84
EDA_3D_VIEWER * Get3DViewerFrame()
virtual void UpdateStatusBar()
Function UpdateStatusBar updates the status bar information.
Definition: draw_frame.cpp:669
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
void ProcessItemSelection(wxCommandEvent &event)
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
bool m_DisplayModTextFill
Definition: pcbstruct.h:70
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
wxAuiToolBar * m_auxiliaryToolBar
Auxiliary tool bar typically shown below the main tool bar at the top of the main window...
void GetMsgPanelInfo(std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
#define VIEWER3D_FRAMENAME
Definition: eda_3d_viewer.h:44
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
EDA_UNITS_T
Definition: common.h:144
show modules references (when texts are visibles)
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting() const
Function LoadCanvasTypeSetting() Returns the canvas type stored in the application settings...
Color has changed.
Definition: view_item.h:57
virtual void GetMsgPanelInfo(std::vector< MSG_PANEL_ITEM > &aList)
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
const wxString GetZoomLevelIndicator() const override
Function GetZoomLevelIndicator returns a human readable value which can be displayed as zoom level in...
void SetPrevGrid() override
Virtual function SetPrevGrid() changes the grid size settings to the previous one available...