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 <pcb_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 static_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();
385  auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
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 {
434  auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
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 {
445  auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
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 = static_cast<KIGFX::PCB_VIEW*>( gal->GetView() );
454  view->UpdateDisplayOptions( displ_opts );
455 
456  // Update pads
457  BOARD* board = GetBoard();
458  for( MODULE* module = board->m_Modules; module; module = module->Next() )
459  {
460  for( auto pad : module->Pads() )
461  view->Update( pad, KIGFX::GEOMETRY );
462  }
463  }
464 
465  m_canvas->Refresh();
466 }
467 
468 
469 void PCB_BASE_FRAME::OnUpdateCoordType( wxUpdateUIEvent& aEvent )
470 {
471  auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
472 
473  aEvent.Check( displ_opts->m_DisplayPolarCood );
475  displ_opts->m_DisplayPolarCood ?
476  _( "Display rectangular coordinates" ) :
477  _( "Display polar coordinates" ) );
478 }
479 
480 
481 void PCB_BASE_FRAME::OnUpdatePadDrawMode( wxUpdateUIEvent& aEvent )
482 {
483  auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
484 
485  aEvent.Check( !displ_opts->m_DisplayPadFill );
487  displ_opts->m_DisplayPadFill ?
488  _( "Show pads in outline mode" ) :
489  _( "Show pads in fill mode" ) );
490 }
491 
492 
493 void PCB_BASE_FRAME::OnUpdateSelectGrid( wxUpdateUIEvent& aEvent )
494 {
495  // No need to update the grid select box if it doesn't exist or the grid setting change
496  // was made using the select box.
497  if( m_gridSelectBox == NULL || m_auxiliaryToolBar == NULL )
498  return;
499 
500  int select = wxNOT_FOUND;
501 
502  for( size_t i = 0; i < GetScreen()->GetGridCount(); i++ )
503  {
504  if( GetScreen()->GetGridCmdId() == GetScreen()->GetGrid( i ).m_CmdId )
505  {
506  select = (int) i;
507  break;
508  }
509  }
510 
511  if( select != m_gridSelectBox->GetSelection() )
512  m_gridSelectBox->SetSelection( select );
513 }
514 
515 
516 void PCB_BASE_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent )
517 {
518  if( m_zoomSelectBox == NULL || m_auxiliaryToolBar == NULL )
519  return;
520 
521  int current = 0;
522  double zoom = IsGalCanvasActive() ? GetGalCanvas()->GetLegacyZoom() : GetScreen()->GetZoom();
523 
524  for( unsigned i = 0; i < GetScreen()->m_ZoomList.size(); i++ )
525  {
526  if( std::fabs( zoom - GetScreen()->m_ZoomList[i] ) < 1e-6 )
527  {
528  current = i + 1;
529  break;
530  }
531  }
532 
533  if( current != m_zoomSelectBox->GetSelection() )
534  m_zoomSelectBox->SetSelection( current );
535 }
536 
537 
538 void PCB_BASE_FRAME::ProcessItemSelection( wxCommandEvent& aEvent )
539 {
540  int id = aEvent.GetId();
541 
542  // index into the collector list:
543  int itemNdx = id - ID_POPUP_PCB_ITEM_SELECTION_START;
544 
545  if( id >= ID_POPUP_PCB_ITEM_SELECTION_START && id <= ID_POPUP_PCB_ITEM_SELECTION_END )
546  {
547  BOARD_ITEM* item = (*m_Collector)[itemNdx];
548  m_canvas->SetAbortRequest( false );
549 
550 #if 0 && defined (DEBUG)
551  item->Show( 0, std::cout );
552 #endif
553 
554  SetCurItem( item );
555  }
556 }
557 
558 
559 void PCB_BASE_FRAME::SetCurItem( BOARD_ITEM* aItem, bool aDisplayInfo )
560 {
561  GetScreen()->SetCurItem( aItem );
562 
563  if( aDisplayInfo )
564  UpdateMsgPanel();
565 }
566 
567 
569 {
570  BOARD_ITEM* item = GetScreen()->GetCurItem();
571  MSG_PANEL_ITEMS items;
572 
573  if( item )
574  {
575  item->GetMsgPanelInfo( items );
576  }
577  else // show general information about the board
578  {
579  if( IsGalCanvasActive() )
580  GetGalCanvas()->GetMsgPanelInfo( items );
581  else
582  m_Pcb->GetMsgPanelInfo( items );
583  }
584 
585  SetMsgPanel( items );
586 }
587 
588 
590 {
591  return GetScreen()->GetCurItem();
592 }
593 
594 
596 {
598  GetActiveLayer() );
599 
600  // account for the globals
602  guide.SetIgnoreMTextsOnBack( ! m_Pcb->IsElementVisible( LAYER_MOD_TEXT_BK ) );
603  guide.SetIgnoreMTextsOnFront( ! m_Pcb->IsElementVisible( LAYER_MOD_TEXT_FR ) );
604  guide.SetIgnoreModulesOnBack( ! m_Pcb->IsElementVisible( LAYER_MOD_BK ) );
605  guide.SetIgnoreModulesOnFront( ! m_Pcb->IsElementVisible( LAYER_MOD_FR ) );
606  guide.SetIgnorePadsOnBack( ! m_Pcb->IsElementVisible( LAYER_PAD_BK ) );
607  guide.SetIgnorePadsOnFront( ! m_Pcb->IsElementVisible( LAYER_PAD_FR ) );
608  guide.SetIgnoreModulesVals( ! m_Pcb->IsElementVisible( LAYER_MOD_VALUES ) );
609  guide.SetIgnoreModulesRefs( ! m_Pcb->IsElementVisible( LAYER_MOD_REFERENCES ) );
610 
611  return guide;
612 }
613 
614 void PCB_BASE_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
615 {
616  bool redraw = false;
617 
618  EDA_DRAW_FRAME::SetToolID( aId, aCursor, aToolMsg );
619 
620  if( aId < 0 )
621  return;
622 
623  auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
624 
625  // handle color changes for transitions in and out of ID_TRACK_BUTT
626  if( ( GetToolId() == ID_TRACK_BUTT && aId != ID_TRACK_BUTT )
627  || ( GetToolId() != ID_TRACK_BUTT && aId == ID_TRACK_BUTT ) )
628  {
629  if( displ_opts->m_ContrastModeDisplay )
630  redraw = true;
631  }
632 
633  // must do this after the tool has been set, otherwise pad::Draw() does
634  // not show proper color when GetDisplayOptions().ContrastModeDisplay is true.
635  if( redraw && m_canvas )
636  m_canvas->Refresh();
637 }
638 
639 
640 /*
641  * Update the status bar information.
642  */
644 {
645  PCB_SCREEN* screen = GetScreen();
646 
647  if( !screen )
648  return;
649 
650  int dx;
651  int dy;
652  double dXpos;
653  double dYpos;
654  wxString line;
655  wxString locformatter;
656  auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
657 
659 
660  if( displ_opts->m_DisplayPolarCood ) // display polar coordinates
661  {
662  double theta, ro;
663 
664  dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
665  dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
666 
667  theta = ArcTangente( -dy, dx ) / 10;
668 
669  ro = hypot( dx, dy );
670  wxString formatter;
671  switch( g_UserUnit )
672  {
673  case INCHES:
674  formatter = wxT( "Ro %.6f Th %.1f" );
675  break;
676 
677  case MILLIMETRES:
678  formatter = wxT( "Ro %.6f Th %.1f" );
679  break;
680 
681  case UNSCALED_UNITS:
682  formatter = wxT( "Ro %f Th %f" );
683  break;
684 
685  case DEGREES:
686  wxASSERT( false );
687  break;
688  }
689 
690  line.Printf( formatter, To_User_Unit( g_UserUnit, ro ), theta );
691 
692  SetStatusText( line, 3 );
693  }
694 
695  // Display absolute coordinates:
698 
699  // The following sadly is an if Eeschema/if Pcbnew
700  wxString absformatter;
701 
702  switch( g_UserUnit )
703  {
704  case INCHES:
705  absformatter = wxT( "X %.6f Y %.6f" );
706  locformatter = wxT( "dx %.6f dy %.6f dist %.4f" );
707  break;
708 
709  case MILLIMETRES:
710  absformatter = wxT( "X %.6f Y %.6f" );
711  locformatter = wxT( "dx %.6f dy %.6f dist %.3f" );
712  break;
713 
714  case UNSCALED_UNITS:
715  absformatter = wxT( "X %f Y %f" );
716  locformatter = wxT( "dx %f dy %f dist %f" );
717  break;
718 
719  case DEGREES:
720  wxASSERT( false );
721  break;
722  }
723 
724  line.Printf( absformatter, dXpos, dYpos );
725  SetStatusText( line, 2 );
726 
727  if( !displ_opts->m_DisplayPolarCood ) // display relative cartesian coordinates
728  {
729  // Display relative coordinates:
730  dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
731  dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
732  dXpos = To_User_Unit( g_UserUnit, dx );
733  dYpos = To_User_Unit( g_UserUnit, dy );
734 
735  // We already decided the formatter above
736  line.Printf( locformatter, dXpos, dYpos, hypot( dXpos, dYpos ) );
737  SetStatusText( line, 3 );
738  }
739 }
740 
741 
743 {
744  EDA_DRAW_FRAME::unitsChangeRefresh(); // Update the status bar.
745 
747 }
748 
749 
750 void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
751 {
753 
754  // Ensure grid id is an existent grid id:
755  if( (m_LastGridSizeId <= 0) ||
758 
759  wxString baseCfgName = GetName();
760 
761  aCfg->Read( baseCfgName + UserGridSizeXEntry, &m_UserGridSize.x, 0.01 );
762  aCfg->Read( baseCfgName + UserGridSizeYEntry, &m_UserGridSize.y, 0.01 );
763 
764  long itmp;
765  aCfg->Read( baseCfgName + UserGridUnitsEntry, &itmp, ( long )INCHES );
766  m_UserGridUnit = (EDA_UNITS_T) itmp;
767  aCfg->Read( baseCfgName + DisplayPadFillEntry, &m_DisplayOptions.m_DisplayPadFill, true );
768  aCfg->Read( baseCfgName + DisplayViaFillEntry, &m_DisplayOptions.m_DisplayViaFill, true );
769  aCfg->Read( baseCfgName + DisplayPadNumberEntry, &m_DisplayOptions.m_DisplayPadNum, true );
770  aCfg->Read( baseCfgName + DisplayModuleEdgeEntry, &m_DisplayOptions.m_DisplayModEdgeFill, true );
771 
772  aCfg->Read( baseCfgName + FastGrid1Entry, &itmp, ( long )0);
773  m_FastGrid1 = itmp;
774  aCfg->Read( baseCfgName + FastGrid2Entry, &itmp, ( long )0);
775  m_FastGrid2 = itmp;
776 
777  aCfg->Read( baseCfgName + DisplayModuleTextEntry, &m_DisplayOptions.m_DisplayModTextFill, true );
778 }
779 
780 
781 void PCB_BASE_FRAME::SaveSettings( wxConfigBase* aCfg )
782 {
784 
785  wxString baseCfgName = GetName();
786 
787  aCfg->Write( baseCfgName + UserGridSizeXEntry, m_UserGridSize.x );
788  aCfg->Write( baseCfgName + UserGridSizeYEntry, m_UserGridSize.y );
789  aCfg->Write( baseCfgName + UserGridUnitsEntry, ( long )m_UserGridUnit );
790  aCfg->Write( baseCfgName + DisplayPadFillEntry, m_DisplayOptions.m_DisplayPadFill );
791  aCfg->Write( baseCfgName + DisplayViaFillEntry, m_DisplayOptions.m_DisplayViaFill );
792  aCfg->Write( baseCfgName + DisplayPadNumberEntry, m_DisplayOptions.m_DisplayPadNum );
793  aCfg->Write( baseCfgName + DisplayModuleEdgeEntry, m_DisplayOptions.m_DisplayModEdgeFill );
794  aCfg->Write( baseCfgName + DisplayModuleTextEntry, m_DisplayOptions.m_DisplayModTextFill );
795  aCfg->Write( baseCfgName + FastGrid1Entry, ( long )m_FastGrid1 );
796  aCfg->Write( baseCfgName + FastGrid2Entry, ( long )m_FastGrid2 );
797 }
798 
799 
801 {
802  GetScreen()->SetModify();
803  GetScreen()->SetSave();
804 
805  if( IsGalCanvasActive() )
806  {
807  UpdateStatusBar();
808  UpdateMsgPanel();
809  }
810 }
811 
812 
814 {
816 }
817 
818 
820 {
821  UpdateStatusBar();
822  DisplayUnitsMsg();
823 
824  if( m_gridSelectBox == NULL )
825  return;
826 
827  // Update grid values with the current units setting.
828  m_gridSelectBox->Clear();
829  wxArrayString gridsList;
830  int icurr = GetScreen()->BuildGridsChoiceList( gridsList, g_UserUnit != INCHES );
831 
832  for( size_t i = 0; i < GetScreen()->GetGridCount(); i++ )
833  {
834  GRID_TYPE& grid = GetScreen()->GetGrid( i );
835  m_gridSelectBox->Append( gridsList[i], (void*) &grid.m_CmdId );
836  }
837 
838  m_gridSelectBox->SetSelection( icurr );
839 }
840 
842 {
843  if( m_zoomSelectBox == NULL )
844  return;
845 
846  wxString msg;
847 
848  m_zoomSelectBox->Clear();
849  m_zoomSelectBox->Append( _( "Zoom Auto" ) );
850  m_zoomSelectBox->SetSelection( 0 );
851 
852  for( unsigned i = 0; i < GetScreen()->m_ZoomList.size(); ++i )
853  {
854  msg = _( "Zoom " );
855 
856  double level = m_zoomLevelCoeff / (double)GetScreen()->m_ZoomList[i];
857  wxString value = wxString::Format( wxT( "%.2f" ), level );
858  msg += value;
859 
860  m_zoomSelectBox->Append( msg );
861 
862  if( GetScreen()->GetZoom() == GetScreen()->m_ZoomList[i] )
863  m_zoomSelectBox->SetSelection( i + 1 );
864  }
865 }
866 
867 
869 {
870  if( m_FastGrid1 >= (int)GetScreen()->GetGridCount() )
871  return;
872 
873  int cmdId = GetScreen()->GetGrids()[m_FastGrid1].m_CmdId;
875 
876  if( m_gridSelectBox )
877  {
878  wxCommandEvent cmd( wxEVT_CHOICE );
879  cmd.SetEventObject( this );
880  OnSelectGrid( cmd );
881  }
882  else
883  GetCanvas()->Refresh();
884 }
885 
886 
888 {
889  if( m_FastGrid2 >= (int)GetScreen()->GetGridCount() )
890  return;
891 
892  int cmdId = GetScreen()->GetGrids()[m_FastGrid2].m_CmdId;
894 
895  if( m_gridSelectBox )
896  {
897  wxCommandEvent cmd( wxEVT_CHOICE );
898  cmd.SetEventObject( this );
899  OnSelectGrid( cmd );
900  }
901  else
902  GetCanvas()->Refresh();
903 }
904 
906 {
908 
909  if( m_gridSelectBox )
910  {
911  wxCommandEvent cmd( wxEVT_CHOICE );
912  cmd.SetEventObject( this );
913  OnSelectGrid( cmd );
914  }
915  else
916  GetCanvas()->Refresh();
917 }
918 
919 
921 {
923 
924  if( m_gridSelectBox )
925  {
926  wxCommandEvent cmd( wxEVT_CHOICE );
927  cmd.SetEventObject( this );
928  OnSelectGrid( cmd );
929  }
930  else
931  GetCanvas()->Refresh();
932 }
933 
934 
935 void PCB_BASE_FRAME::SwitchCanvas( wxCommandEvent& aEvent )
936 {
937  bool use_gal = false;
939 
940  switch( aEvent.GetId() )
941  {
943  break;
944 
947 
948  if( use_gal )
950  break;
951 
954 
955  if( use_gal )
957  break;
958  }
959 
960  saveCanvasTypeSetting( canvasType );
961  UseGalCanvas( use_gal );
962 }
963 
964 
965 void PCB_BASE_FRAME::UseGalCanvas( bool aEnable )
966 {
967  EDA_DRAW_FRAME::UseGalCanvas( aEnable );
968 
969  EDA_DRAW_PANEL_GAL* galCanvas = GetGalCanvas();
970 
971  if( m_toolManager )
973  GetGalCanvas()->GetViewControls(), this );
974 
975  if( aEnable )
976  {
977  SetBoard( m_Pcb );
978 
979  if( m_toolManager )
981 
982  // Transfer latest current display options from legacy to GAL canvas:
983  auto painter = static_cast<KIGFX::PCB_PAINTER*>( galCanvas->GetView()->GetPainter() );
984  auto settings = painter->GetSettings();
985  auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
986  settings->LoadDisplayOptions( displ_opts );
987 
988  galCanvas->GetView()->RecacheAllItems();
989  galCanvas->SetEventDispatcher( m_toolDispatcher );
990  galCanvas->StartDrawing();
991  }
992  else
993  {
994  if( m_toolManager )
996 
997  // Redirect all events to the legacy canvas
998  galCanvas->SetEventDispatcher( NULL );
999  }
1000 }
1001 
1002 
1003 void PCB_BASE_FRAME::OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent )
1004 {
1005  wxMenuBar* menuBar = GetMenuBar();
1006  EDA_DRAW_PANEL_GAL* gal_canvas = GetGalCanvas();
1008 
1009  if( IsGalCanvasActive() && gal_canvas )
1010  canvasType = gal_canvas->GetBackend();
1011 
1012  struct { int menuId; int galType; } menuList[] =
1013  {
1017  };
1018 
1019  for( auto ii: menuList )
1020  {
1021  wxMenuItem* item = menuBar->FindItem( ii.menuId );
1022  if( ii.galType == canvasType )
1023  item->Check( true );
1024  }
1025 }
void SetColorsSettings(COLORS_DESIGN_SETTINGS *aColorsSettings)
Function SetColorsSettings.
Definition: class_board.h:569
TOOL_MANAGER * m_toolManager
Definition: draw_frame.h:95
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.
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...
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:691
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:325
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:96
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:337
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:1253
MODULE * Next() const
Definition: class_module.h:120
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)
BOARD * GetBoard() const
EDA_UNITS_T m_UserGridUnit
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock) override
VTBL_ENTRY _ELEM * GetElem(ELEM_T aIndex)
Typically wrapped somewhere else in a more meaningful function wrapper.
Definition: project.cpp:207
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.
virtual void SetPrevGrid()
Function SetPrevGrid() changes the grid size settings to the previous one available.
Definition: draw_frame.cpp:611
Class EDA_DRAW_FRAME is the base class for create windows for drawing purpose.
Definition: draw_frame.h:54
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:347
Class PCB_PAINTER Contains methods for drawing PCB-specific items.
Definition: pcb_painter.h:176
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:116
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:746
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...
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:514
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:219
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().
static const wxChar DisplayViaFillEntry[]
bool IsPointOnDisplay(const wxPoint &aPosition)
Function IsPointOnDisplay.
Definition: draw_panel.cpp:287
Class PCB_DISPLAY_OPTIONS handles display options like enable/disable some optional drawings...
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:87
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:126
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:188
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:784
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:113
void SetEnd(int x, int y)
Definition: common.h:144
wxChoice * m_zoomSelectBox
Choice box to choose the zoom value.
Definition: draw_frame.h:119
static const wxChar FastGrid2Entry[]
double GetZoom()
Function GetZoom.
Definition: draw_frame.cpp:491
void OnUpdateSelectGrid(wxUpdateUIEvent &aEvent)
void OnUpdateSwitchCanvas(wxUpdateUIEvent &aEvent)
Update UI called when switches currently used canvas (default / Cairo / OpenGL).
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
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:862
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:625
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:546
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:196
void UpdateDisplayOptions(PCB_DISPLAY_OPTIONS *aOptions)
Definition: pcb_view.cpp:103
ID_POPUP_GRID_USER
Definition: draw_frame.cpp:108
void SaveSettings(wxConfigBase *aCfg) override
Function SaveSettings saves common frame parameters to a configuration data file. ...
void SetIgnoreMTextsMarkedNoShow(bool ignore)
Definition: collectors.h:487
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:120
virtual void ReCreateMenuBar() override
Function ReCreateMenuBar Creates recreates the menu bar.
int m_LastGridSizeId
Definition: draw_frame.h:78
static const wxChar DisplayPadFillEntry[]
void Load(const wxString &aFileName)
Load the library table using the path defined by aFileName aFallBackTable.
Class PCB_PLOT_PARAMS handles plot parameters and options when plotting/printing a board...
void CrossHairOff(wxDC *DC)
Definition: draw_panel.cpp:252
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:291
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:716
virtual double BestZoom() override
Function BestZoom.
PCB_DISPLAY_OPTIONS m_DisplayOptions
virtual void SetNextGrid()
Function SetNextGrid() changes the grid size settings to the next one available.
Definition: draw_frame.cpp:597
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:93
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 IsElementVisible(GAL_LAYER_ID aLayer) const
Function IsElementVisible tests whether a given element category is visible.
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:259
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:86
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:411
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)
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:212
int GetToolId() const
Definition: draw_frame.h:471
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:870
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:254
void updateZoomSelectBox()
bool saveCanvasTypeSetting(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Stores the canvas type in the application settings.
void UpdateMsgPanel() override
>
A general implementation of a COLLECTORS_GUIDE.
Definition: collectors.h:351
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.
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:680
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
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:143
show modules references (when texts are visibles)
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
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...