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 {
103  m_Pcb = NULL;
104 
105  m_UserGridSize = wxRealPoint( 100.0, 100.0 );
106  m_UserGridUnit = INCHES;
107  m_Collector = new GENERAL_COLLECTOR();
108 
109  m_FastGrid1 = 0;
110  m_FastGrid2 = 0;
111 
112  m_auxiliaryToolBar = NULL;
113 
114  m_zoomLevelCoeff = 11.0 * IU_PER_MILS; // Adjusted to roughly displays zoom level = 1
115  // when the screen shows a 1:1 image
116  // obviously depends on the monitor,
117  // but this is an acceptable value
118 }
119 
120 
122 {
123  delete m_Collector;
124  delete m_Pcb;
125 }
126 
127 
129 {
130  // return the 3D viewer frame, when exists, or NULL
131  return dynamic_cast<EDA_3D_VIEWER*>
132  ( wxWindow::FindWindowByName( VIEWER3D_FRAMENAME ) );
133 }
134 
135 
137 {
138  // This is a lazy loading function, it loads the project specific table when
139  // that table is asked for, not before.
140 
142 
143  // its gotta be NULL or a FP_LIB_TABLE, or a bug.
144  wxASSERT( !tbl || dynamic_cast<FP_LIB_TABLE*>( tbl ) );
145 
146  if( !tbl )
147  {
148  // Stack the project specific FP_LIB_TABLE overlay on top of the global table.
149  // ~FP_LIB_TABLE() will not touch the fallback table, so multiple projects may
150  // stack this way, all using the same global fallback table.
151  tbl = new FP_LIB_TABLE( &GFootprintTable );
152 
153  SetElem( ELEM_FPTBL, tbl );
154 
155  wxString projectFpLibTableFileName = FootprintLibTblName();
156 
157  try
158  {
159  tbl->Load( projectFpLibTableFileName );
160  }
161  catch( const IO_ERROR& ioe )
162  {
163  DisplayError( NULL, ioe.What() );
164  }
165  }
166 
167  return tbl;
168 }
169 
170 
172 {
173  if( m_Pcb != aBoard )
174  {
175  delete m_Pcb;
176  m_Pcb = aBoard;
177  }
178 }
179 
180 
181 void PCB_BASE_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
182 {
183  wxASSERT( m_Pcb );
184  m_Pcb->SetPageSettings( aPageSettings );
185 
186  if( GetScreen() )
187  GetScreen()->InitDataPoints( aPageSettings.GetSizeIU() );
188 }
189 
190 
192 {
193  wxASSERT( m_Pcb );
194  return m_Pcb->GetPageSettings();
195 }
196 
197 
198 const wxSize PCB_BASE_FRAME::GetPageSizeIU() const
199 {
200  wxASSERT( m_Pcb );
201 
202  // this function is only needed because EDA_DRAW_FRAME is not compiled
203  // with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
204  // into an application specific source file.
205  return m_Pcb->GetPageSettings().GetSizeIU();
206 }
207 
208 
210 {
211  wxASSERT( m_Pcb );
212  return m_Pcb->GetAuxOrigin();
213 }
214 
215 
217 {
218  wxASSERT( m_Pcb );
219  m_Pcb->SetAuxOrigin( aPoint );
220 }
221 
222 
224 {
225  wxASSERT( m_Pcb );
226  return m_Pcb->GetGridOrigin();
227 }
228 
229 
231 {
232  wxASSERT( m_Pcb );
233  m_Pcb->SetGridOrigin( aPoint );
234 }
235 
236 
238 {
239  wxASSERT( m_Pcb );
240  return m_Pcb->GetTitleBlock();
241 }
242 
243 
244 void PCB_BASE_FRAME::SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
245 {
246  wxASSERT( m_Pcb );
247  m_Pcb->SetTitleBlock( aTitleBlock );
248 }
249 
250 
252 {
253  wxASSERT( m_Pcb );
254  return m_Pcb->GetDesignSettings();
255 }
256 
257 
259 {
260  wxASSERT( m_Pcb );
261  m_Pcb->SetDesignSettings( aSettings );
262 }
263 
264 
266 {
267  wxASSERT( m_Pcb );
268  return m_Pcb->GetZoneSettings();
269 }
270 
271 
273 {
274  wxASSERT( m_Pcb );
275  m_Pcb->SetZoneSettings( aSettings );
276 }
277 
278 
280 {
281  wxASSERT( m_Pcb );
282  return m_Pcb->GetPlotOptions();
283 }
284 
285 
287 {
288  wxASSERT( m_Pcb );
289  m_Pcb->SetPlotOptions( aSettings );
290 }
291 
292 
293 EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
294 {
295  wxASSERT( m_Pcb );
296 
297  EDA_RECT area = aBoardEdgesOnly ? m_Pcb->GetBoardEdgesBoundingBox() : m_Pcb->GetBoundingBox();
298 
299  if( area.GetWidth() == 0 && area.GetHeight() == 0 )
300  {
301  wxSize pageSize = GetPageSizeIU();
302 
304  {
305  area.SetOrigin( 0, 0 );
306  area.SetEnd( pageSize.x, pageSize.y );
307  }
308  else
309  {
310  area.SetOrigin( -pageSize.x / 2, -pageSize.y / 2 );
311  area.SetEnd( pageSize.x / 2, pageSize.y / 2 );
312  }
313  }
314 
315  return area;
316 }
317 
318 
320 {
321  if( m_Pcb == NULL )
322  return 1.0;
323 
324  EDA_RECT ibbbox = GetBoardBoundingBox();
325  DSIZE clientz = m_canvas->GetClientSize();
326  DSIZE boardz( ibbbox.GetWidth(), ibbbox.GetHeight() );
327 
328  double iu_per_du_X = clientz.x ? boardz.x / clientz.x : 1.0;
329  double iu_per_du_Y = clientz.y ? boardz.y / clientz.y : 1.0;
330 
331  double bestzoom = std::max( iu_per_du_X, iu_per_du_Y );
332 
333  SetScrollCenterPosition( ibbbox.Centre() );
334 
335  return bestzoom;
336 }
337 
338 
339 void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos, bool aWarp )
340 {
341  // factored out of pcbnew/find.cpp
342 
344 
345  // There may be need to reframe the drawing.
346  if( !m_canvas->IsPointOnDisplay( aPos ) )
347  {
348  SetCrossHairPosition( aPos );
349  RedrawScreen( aPos, aWarp );
350  }
351  else
352  {
353  // Put cursor on item position
354  m_canvas->CrossHairOff( &dc );
355  SetCrossHairPosition( aPos );
356 
357  if( aWarp )
359  }
360  m_canvas->CrossHairOn( &dc );
361  m_canvas->CrossHairOn( &dc );
362 }
363 
364 
365 // Virtual function
367 {
368 }
369 
370 
371 // Virtual functions: Do nothing for PCB_BASE_FRAME window
372 void PCB_BASE_FRAME::Show3D_Frame( wxCommandEvent& event )
373 {
374 }
375 
376 
377 // Note: virtual, overridden in PCB_EDIT_FRAME;
379 {
380  PCB_LAYER_ID preslayer = GetActiveLayer();
382 
383  // Check if the specified layer matches the present layer
384  if( layer == preslayer )
385  return;
386 
387  // Copper layers cannot be selected unconditionally; how many
388  // of those layers are currently enabled needs to be checked.
389  if( IsCopperLayer( layer ) )
390  {
391  // If only one copper layer is enabled, the only such layer
392  // that can be selected to is the "Copper" layer (so the
393  // selection of any other copper layer is disregarded).
394  if( m_Pcb->GetCopperLayerCount() < 2 )
395  {
396  if( layer != B_Cu )
397  {
398  return;
399  }
400  }
401 
402  // If more than one copper layer is enabled, the "Copper"
403  // and "Component" layers can be selected, but the total
404  // number of copper layers determines which internal
405  // layers are also capable of being selected.
406  else
407  {
408  if( ( layer != B_Cu ) && ( layer != F_Cu )
409  && ( layer >= m_Pcb->GetCopperLayerCount() - 1 ) )
410  {
411  return;
412  }
413  }
414  }
415 
416  // Is yet more checking required? E.g. when the layer to be selected
417  // is a non-copper layer, or when switching between a copper layer
418  // and a non-copper layer, or vice-versa?
419  // ...
420 
421  GetScreen()->m_Active_Layer = layer;
422 
423  if( displ_opts->m_ContrastModeDisplay )
424  m_canvas->Refresh();
425 }
426 
427 
428 void PCB_BASE_FRAME::OnTogglePolarCoords( wxCommandEvent& aEvent )
429 {
431  SetStatusText( wxEmptyString );
432 
433  displ_opts->m_DisplayPolarCood = !displ_opts->m_DisplayPolarCood;
434 
435  UpdateStatusBar();
436 }
437 
438 
439 void PCB_BASE_FRAME::OnTogglePadDrawMode( wxCommandEvent& aEvent )
440 {
442 
443  displ_opts->m_DisplayPadFill = !displ_opts->m_DisplayPadFill;
445 
446  if( gal )
447  {
448  // Apply new display options to the GAL canvas
449  auto view = gal->GetView();
450  auto painter = static_cast<KIGFX::PCB_PAINTER*> ( view->GetPainter() );
451  auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*> ( painter->GetSettings() );
452  settings->LoadDisplayOptions( displ_opts );
453 
454  // Update pads
455  BOARD* board = GetBoard();
456  for( MODULE* module = board->m_Modules; module; module = module->Next() )
457  {
458  for( auto pad : module->Pads() )
459  view->Update( pad, KIGFX::GEOMETRY );
460  }
461  }
462 
463  m_canvas->Refresh();
464 }
465 
466 
467 void PCB_BASE_FRAME::OnUpdateCoordType( wxUpdateUIEvent& aEvent )
468 {
470 
471  aEvent.Check( displ_opts->m_DisplayPolarCood );
473  displ_opts->m_DisplayPolarCood ?
474  _( "Display rectangular coordinates" ) :
475  _( "Display polar coordinates" ) );
476 }
477 
478 
479 void PCB_BASE_FRAME::OnUpdatePadDrawMode( wxUpdateUIEvent& aEvent )
480 {
482  aEvent.Check( !displ_opts->m_DisplayPadFill );
484  displ_opts->m_DisplayPadFill ?
485  _( "Show pads in outline mode" ) :
486  _( "Show pads in fill mode" ) );
487 }
488 
489 
490 void PCB_BASE_FRAME::OnUpdateSelectGrid( wxUpdateUIEvent& aEvent )
491 {
492  // No need to update the grid select box if it doesn't exist or the grid setting change
493  // was made using the select box.
494  if( m_gridSelectBox == NULL || m_auxiliaryToolBar == NULL )
495  return;
496 
497  int select = wxNOT_FOUND;
498 
499  for( size_t i = 0; i < GetScreen()->GetGridCount(); i++ )
500  {
501  if( GetScreen()->GetGridCmdId() == GetScreen()->GetGrid( i ).m_CmdId )
502  {
503  select = (int) i;
504  break;
505  }
506  }
507 
508  if( select != m_gridSelectBox->GetSelection() )
509  m_gridSelectBox->SetSelection( select );
510 }
511 
512 
513 void PCB_BASE_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent )
514 {
515  if( m_zoomSelectBox == NULL || m_auxiliaryToolBar == NULL )
516  return;
517 
518  int current = 0;
519  double zoom = IsGalCanvasActive() ? GetGalCanvas()->GetLegacyZoom() : GetScreen()->GetZoom();
520 
521  for( unsigned i = 0; i < GetScreen()->m_ZoomList.size(); i++ )
522  {
523  if( std::fabs( zoom - GetScreen()->m_ZoomList[i] ) < 1e-6 )
524  {
525  current = i + 1;
526  break;
527  }
528  }
529 
530  if( current != m_zoomSelectBox->GetSelection() )
531  m_zoomSelectBox->SetSelection( current );
532 }
533 
534 
535 void PCB_BASE_FRAME::ProcessItemSelection( wxCommandEvent& aEvent )
536 {
537  int id = aEvent.GetId();
538 
539  // index into the collector list:
540  int itemNdx = id - ID_POPUP_PCB_ITEM_SELECTION_START;
541 
542  if( id >= ID_POPUP_PCB_ITEM_SELECTION_START && id <= ID_POPUP_PCB_ITEM_SELECTION_END )
543  {
544  BOARD_ITEM* item = (*m_Collector)[itemNdx];
545  m_canvas->SetAbortRequest( false );
546 
547 #if 0 && defined (DEBUG)
548  item->Show( 0, std::cout );
549 #endif
550 
551  SetCurItem( item );
552  }
553 }
554 
555 
556 void PCB_BASE_FRAME::SetCurItem( BOARD_ITEM* aItem, bool aDisplayInfo )
557 {
558  GetScreen()->SetCurItem( aItem );
559 
560  if( aDisplayInfo )
561  UpdateMsgPanel();
562 }
563 
564 
566 {
567  BOARD_ITEM* item = GetScreen()->GetCurItem();
568  MSG_PANEL_ITEMS items;
569 
570  if( item )
571  {
572  item->GetMsgPanelInfo( items );
573  }
574  else // show general information about the board
575  {
576  if( IsGalCanvasActive() )
577  GetGalCanvas()->GetMsgPanelInfo( items );
578  else
579  m_Pcb->GetMsgPanelInfo( items );
580  }
581 
582  SetMsgPanel( items );
583 }
584 
585 
587 {
588  return GetScreen()->GetCurItem();
589 }
590 
591 
593 {
595  GetActiveLayer() );
596 
597  // account for the globals
599  guide.SetIgnoreMTextsOnBack( ! m_Pcb->IsElementVisible( LAYER_MOD_TEXT_BK ) );
600  guide.SetIgnoreMTextsOnFront( ! m_Pcb->IsElementVisible( LAYER_MOD_TEXT_FR ) );
601  guide.SetIgnoreModulesOnBack( ! m_Pcb->IsElementVisible( LAYER_MOD_BK ) );
602  guide.SetIgnoreModulesOnFront( ! m_Pcb->IsElementVisible( LAYER_MOD_FR ) );
603  guide.SetIgnorePadsOnBack( ! m_Pcb->IsElementVisible( LAYER_PAD_BK ) );
604  guide.SetIgnorePadsOnFront( ! m_Pcb->IsElementVisible( LAYER_PAD_FR ) );
605  guide.SetIgnoreModulesVals( ! m_Pcb->IsElementVisible( LAYER_MOD_VALUES ) );
606  guide.SetIgnoreModulesRefs( ! m_Pcb->IsElementVisible( LAYER_MOD_REFERENCES ) );
607 
608  return guide;
609 }
610 
611 void PCB_BASE_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
612 {
613  bool redraw = false;
614 
615  EDA_DRAW_FRAME::SetToolID( aId, aCursor, aToolMsg );
616 
617  if( aId < 0 )
618  return;
619 
621 
622  // handle color changes for transitions in and out of ID_TRACK_BUTT
623  if( ( GetToolId() == ID_TRACK_BUTT && aId != ID_TRACK_BUTT )
624  || ( GetToolId() != ID_TRACK_BUTT && aId == ID_TRACK_BUTT ) )
625  {
626  if( displ_opts->m_ContrastModeDisplay )
627  redraw = true;
628  }
629 
630  // must do this after the tool has been set, otherwise pad::Draw() does
631  // not show proper color when GetDisplayOptions().ContrastModeDisplay is true.
632  if( redraw && m_canvas )
633  m_canvas->Refresh();
634 }
635 
636 
637 /*
638  * Update the status bar information.
639  */
641 {
642  PCB_SCREEN* screen = GetScreen();
643 
644  if( !screen )
645  return;
646 
647  int dx;
648  int dy;
649  double dXpos;
650  double dYpos;
651  wxString line;
652  wxString locformatter;
654 
656 
657  if( displ_opts->m_DisplayPolarCood ) // display polar coordinates
658  {
659  double theta, ro;
660 
661  dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
662  dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
663 
664  theta = ArcTangente( -dy, dx ) / 10;
665 
666  ro = hypot( dx, dy );
667  wxString formatter;
668  switch( g_UserUnit )
669  {
670  case INCHES:
671  formatter = wxT( "Ro %.6f Th %.1f" );
672  break;
673 
674  case MILLIMETRES:
675  formatter = wxT( "Ro %.6f Th %.1f" );
676  break;
677 
678  case UNSCALED_UNITS:
679  formatter = wxT( "Ro %f Th %f" );
680  break;
681 
682  case DEGREES:
683  wxASSERT( false );
684  break;
685  }
686 
687  line.Printf( formatter, To_User_Unit( g_UserUnit, ro ), theta );
688 
689  SetStatusText( line, 3 );
690  }
691 
692  // Display absolute coordinates:
695 
696  // The following sadly is an if Eeschema/if Pcbnew
697  wxString absformatter;
698 
699  switch( g_UserUnit )
700  {
701  case INCHES:
702  absformatter = wxT( "X %.6f Y %.6f" );
703  locformatter = wxT( "dx %.6f dy %.6f dist %.4f" );
704  break;
705 
706  case MILLIMETRES:
707  absformatter = wxT( "X %.6f Y %.6f" );
708  locformatter = wxT( "dx %.6f dy %.6f dist %.3f" );
709  break;
710 
711  case UNSCALED_UNITS:
712  absformatter = wxT( "X %f Y %f" );
713  locformatter = wxT( "dx %f dy %f dist %f" );
714  break;
715 
716  case DEGREES:
717  wxASSERT( false );
718  break;
719  }
720 
721  line.Printf( absformatter, dXpos, dYpos );
722  SetStatusText( line, 2 );
723 
724  if( !displ_opts->m_DisplayPolarCood ) // display relative cartesian coordinates
725  {
726  // Display relative coordinates:
727  dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
728  dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
729  dXpos = To_User_Unit( g_UserUnit, dx );
730  dYpos = To_User_Unit( g_UserUnit, dy );
731 
732  // We already decided the formatter above
733  line.Printf( locformatter, dXpos, dYpos, hypot( dXpos, dYpos ) );
734  SetStatusText( line, 3 );
735  }
736 }
737 
738 
740 {
741  EDA_DRAW_FRAME::unitsChangeRefresh(); // Update the status bar.
742 
744 }
745 
746 
747 void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
748 {
750 
751  // Ensure grid id is an existent grid id:
752  if( (m_LastGridSizeId <= 0) ||
755 
756  wxString baseCfgName = GetName();
757 
758  aCfg->Read( baseCfgName + UserGridSizeXEntry, &m_UserGridSize.x, 0.01 );
759  aCfg->Read( baseCfgName + UserGridSizeYEntry, &m_UserGridSize.y, 0.01 );
760 
761  long itmp;
762  aCfg->Read( baseCfgName + UserGridUnitsEntry, &itmp, ( long )INCHES );
763  m_UserGridUnit = (EDA_UNITS_T) itmp;
764  aCfg->Read( baseCfgName + DisplayPadFillEntry, &m_DisplayOptions.m_DisplayPadFill, true );
765  aCfg->Read( baseCfgName + DisplayViaFillEntry, &m_DisplayOptions.m_DisplayViaFill, true );
766  aCfg->Read( baseCfgName + DisplayPadNumberEntry, &m_DisplayOptions.m_DisplayPadNum, true );
767  aCfg->Read( baseCfgName + DisplayModuleEdgeEntry, &m_DisplayOptions.m_DisplayModEdgeFill, true );
768 
769  aCfg->Read( baseCfgName + FastGrid1Entry, &itmp, ( long )0);
770  m_FastGrid1 = itmp;
771  aCfg->Read( baseCfgName + FastGrid2Entry, &itmp, ( long )0);
772  m_FastGrid2 = itmp;
773 
774  aCfg->Read( baseCfgName + DisplayModuleTextEntry, &m_DisplayOptions.m_DisplayModTextFill, true );
775 }
776 
777 
778 void PCB_BASE_FRAME::SaveSettings( wxConfigBase* aCfg )
779 {
781 
782  wxString baseCfgName = GetName();
783 
784  aCfg->Write( baseCfgName + UserGridSizeXEntry, m_UserGridSize.x );
785  aCfg->Write( baseCfgName + UserGridSizeYEntry, m_UserGridSize.y );
786  aCfg->Write( baseCfgName + UserGridUnitsEntry, ( long )m_UserGridUnit );
787  aCfg->Write( baseCfgName + DisplayPadFillEntry, m_DisplayOptions.m_DisplayPadFill );
788  aCfg->Write( baseCfgName + DisplayViaFillEntry, m_DisplayOptions.m_DisplayViaFill );
789  aCfg->Write( baseCfgName + DisplayPadNumberEntry, m_DisplayOptions.m_DisplayPadNum );
790  aCfg->Write( baseCfgName + DisplayModuleEdgeEntry, m_DisplayOptions.m_DisplayModEdgeFill );
791  aCfg->Write( baseCfgName + DisplayModuleTextEntry, m_DisplayOptions.m_DisplayModTextFill );
792  aCfg->Write( baseCfgName + FastGrid1Entry, ( long )m_FastGrid1 );
793  aCfg->Write( baseCfgName + FastGrid2Entry, ( long )m_FastGrid2 );
794 }
795 
796 
798 {
799  GetScreen()->SetModify();
800  GetScreen()->SetSave();
801 
802  if( IsGalCanvasActive() )
803  {
804  UpdateStatusBar();
805  UpdateMsgPanel();
806  }
807 }
808 
809 
811 {
813 }
814 
815 
817 {
818  UpdateStatusBar();
819  DisplayUnitsMsg();
820 
821  if( m_gridSelectBox == NULL )
822  return;
823 
824  // Update grid values with the current units setting.
825  m_gridSelectBox->Clear();
826  wxArrayString gridsList;
827  int icurr = GetScreen()->BuildGridsChoiceList( gridsList, g_UserUnit != INCHES );
828 
829  for( size_t i = 0; i < GetScreen()->GetGridCount(); i++ )
830  {
831  GRID_TYPE& grid = GetScreen()->GetGrid( i );
832  m_gridSelectBox->Append( gridsList[i], (void*) &grid.m_CmdId );
833  }
834 
835  m_gridSelectBox->SetSelection( icurr );
836 }
837 
839 {
840  if( m_zoomSelectBox == NULL )
841  return;
842 
843  wxString msg;
844 
845  m_zoomSelectBox->Clear();
846  m_zoomSelectBox->Append( _( "Zoom Auto" ) );
847  m_zoomSelectBox->SetSelection( 0 );
848 
849  for( unsigned i = 0; i < GetScreen()->m_ZoomList.size(); ++i )
850  {
851  msg = _( "Zoom " );
852 
853  double level = m_zoomLevelCoeff / (double)GetScreen()->m_ZoomList[i];
854  wxString value = wxString::Format( wxT( "%.2f" ), level );
855  msg += value;
856 
857  m_zoomSelectBox->Append( msg );
858 
859  if( GetScreen()->GetZoom() == GetScreen()->m_ZoomList[i] )
860  m_zoomSelectBox->SetSelection( i + 1 );
861  }
862 }
863 
864 
866 {
867  if( m_FastGrid1 >= (int)GetScreen()->GetGridCount() )
868  return;
869 
870  int cmdId = GetScreen()->GetGrids()[m_FastGrid1].m_CmdId;
872 
873  if( m_gridSelectBox )
874  {
875  wxCommandEvent cmd( wxEVT_CHOICE );
876  cmd.SetEventObject( this );
877  OnSelectGrid( cmd );
878  }
879  else
880  GetCanvas()->Refresh();
881 }
882 
883 
885 {
886  if( m_FastGrid2 >= (int)GetScreen()->GetGridCount() )
887  return;
888 
889  int cmdId = GetScreen()->GetGrids()[m_FastGrid2].m_CmdId;
891 
892  if( m_gridSelectBox )
893  {
894  wxCommandEvent cmd( wxEVT_CHOICE );
895  cmd.SetEventObject( this );
896  OnSelectGrid( cmd );
897  }
898  else
899  GetCanvas()->Refresh();
900 }
901 
903 {
905 
906  if( m_gridSelectBox )
907  {
908  wxCommandEvent cmd( wxEVT_CHOICE );
909  cmd.SetEventObject( this );
910  OnSelectGrid( cmd );
911  }
912  else
913  GetCanvas()->Refresh();
914 }
915 
916 
918 {
920 
921  if( m_gridSelectBox )
922  {
923  wxCommandEvent cmd( wxEVT_CHOICE );
924  cmd.SetEventObject( this );
925  OnSelectGrid( cmd );
926  }
927  else
928  GetCanvas()->Refresh();
929 }
930 
931 
932 void PCB_BASE_FRAME::SwitchCanvas( wxCommandEvent& aEvent )
933 {
934  bool use_gal = false;
936 
937  switch( aEvent.GetId() )
938  {
940  break;
941 
944 
945  if( use_gal )
947  break;
948 
951 
952  if( use_gal )
954  break;
955  }
956 
957  SaveCanvasTypeSetting( canvasType );
958  UseGalCanvas( use_gal );
959 }
960 
961 
962 void PCB_BASE_FRAME::UseGalCanvas( bool aEnable )
963 {
964  EDA_DRAW_FRAME::UseGalCanvas( aEnable );
965 
966  EDA_DRAW_PANEL_GAL* galCanvas = GetGalCanvas();
967 
968  if( m_toolManager )
970  GetGalCanvas()->GetViewControls(), this );
971 
972  if( aEnable )
973  {
974  SetBoard( m_Pcb );
975 
976  if( m_toolManager )
978 
979  // Transfer latets current display options from legacy to GAL canvas:
980  auto painter = static_cast<KIGFX::PCB_PAINTER*>( galCanvas->GetView()->GetPainter() );
981  auto settings = painter->GetSettings();
983  settings->LoadDisplayOptions( displ_opts );
984 
985  galCanvas->GetView()->RecacheAllItems();
986  galCanvas->SetEventDispatcher( m_toolDispatcher );
987  galCanvas->StartDrawing();
988  }
989  else
990  {
991  if( m_toolManager )
993 
994  // Redirect all events to the legacy canvas
995  galCanvas->SetEventDispatcher( NULL );
996  }
997 }
998 
999 
1001 {
1003  wxConfigBase* cfg = Kiface().KifaceSettings();
1004 
1005  if( cfg )
1006  canvasType = (EDA_DRAW_PANEL_GAL::GAL_TYPE) cfg->ReadLong( CANVAS_TYPE_KEY,
1008 
1009  if( canvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
1010  || canvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
1011  {
1012  assert( false );
1013  canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
1014  }
1015 
1016  return canvasType;
1017 }
1018 
1019 
1021 {
1022  if( aCanvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
1023  || aCanvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
1024  {
1025  assert( false );
1026  return false;
1027  }
1028 
1029  wxConfigBase* cfg = Kiface().KifaceSettings();
1030 
1031  if( cfg )
1032  return cfg->Write( CANVAS_TYPE_KEY, (long) aCanvasType );
1033 
1034  return false;
1035 }
1036 
1037 
1038 void PCB_BASE_FRAME::OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent )
1039 {
1040  wxMenuBar* menuBar = GetMenuBar();
1041  EDA_DRAW_PANEL_GAL* gal_canvas = GetGalCanvas();
1043 
1044  if( IsGalCanvasActive() && gal_canvas )
1045  canvasType = gal_canvas->GetBackend();
1046 
1047  struct { int menuId; int galType; } menuList[] =
1048  {
1052  };
1053 
1054  for( auto ii: menuList )
1055  {
1056  wxMenuItem* item = menuBar->FindItem( ii.menuId );
1057  if( ii.galType == canvasType )
1058  item->Check( true );
1059  }
1060 }
TOOL_MANAGER * m_toolManager
Definition: draw_frame.h:94
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:799
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:558
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.
KICAD_MANAGER_FRAME::Process_Config KICAD_MANAGER_FRAME::OnUpdatePreferredPdfBrowser EVT_UPDATE_UI_RANGE(ID_TO_SCH, ID_TO_PCB_FP_EDITOR, KICAD_MANAGER_FRAME::OnUpdateRequiresProject) enum hotkey_id_commnand
void OnTogglePadDrawMode(wxCommandEvent &aEvent)
const ZONE_SETTINGS & GetZoneSettings() const
Definition: class_board.h:557
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:341
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:342
void SetGridOrigin(const wxPoint &aPoint) override
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
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:555
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:549
static const wxChar DisplayModuleEdgeEntry[]
void RecacheAllItems()
Function RecacheAllItems() Rebuilds GAL display lists.
Definition: view.cpp:1253
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.
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:166
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:334
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:321
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:811
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
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 EVT_UPDATE_UI(ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected) EVT_UPDATE_UI(ID_MODEDIT_LOAD_MODULE_FROM_BOARD
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.
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:178
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.
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:551
Helper dialog and control classes.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:533
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:809
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:543
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:552
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:548
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:335
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:554
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.
#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:419
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:817
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
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:69
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...