KiCad PCB EDA Suite
gerbview_frame.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
29 #include <fctsys.h>
30 #include <kiface_i.h>
31 #include <pgm_base.h>
32 #include <wxstruct.h>
33 #include <class_drawpanel.h>
34 #include <build_version.h>
35 #include <trigo.h>
36 #include <base_units.h>
38 #include <msgpanel.h>
39 #include <bitmaps.h>
41 
42 #include <gerbview.h>
43 #include <gerbview_frame.h>
44 #include <gerbview_id.h>
45 #include <hotkeys.h>
48 #include <dialog_helpers.h>
51 
54 #include <tool/tool_manager.h>
55 #include <tool/tool_dispatcher.h>
56 #include <tools/gerbview_actions.h>
57 #include <view/view.h>
58 #include <gerbview_painter.h>
59 
60 
61 // Config keywords
62 static const wxString cfgShowPageSizeOption( wxT( "PageSizeOpt" ) );
63 static const wxString cfgShowDCodes( wxT( "ShowDCodesOpt" ) );
64 static const wxString cfgShowNegativeObjects( wxT( "ShowNegativeObjectsOpt" ) );
65 static const wxString cfgShowBorderAndTitleBlock( wxT( "ShowBorderAndTitleBlock" ) );
66 
67 
68 // Colors for layers and items
70 
71 GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
72  EDA_DRAW_FRAME( aKiway, aParent, FRAME_GERBER, wxT( "GerbView" ),
73  wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GERBVIEW_FRAME_NAME )
74 {
75  m_auxiliaryToolBar = NULL;
77  m_gerberLayout = NULL;
78  m_zoomLevelCoeff = ZOOM_FACTOR( 110 ); // Adjusted to roughly displays zoom level = 1
79  // when the screen shows a 1:1 image
80  // obviously depends on the monitor,
81  // but this is an acceptable value
82 
83  PAGE_INFO pageInfo( wxT( "GERBER" ) );
84  SetPageSettings( pageInfo );
85 
87 
88  m_showAxis = true; // true to show X and Y axis on screen
89  m_showBorderAndTitleBlock = false; // true for reference drawings.
91  m_SelLayerBox = NULL;
92  m_DCodeSelector = NULL;
93  m_displayMode = 0;
97 
98  EDA_DRAW_PANEL_GAL* galCanvas = new GERBVIEW_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ),
102 
103  SetGalCanvas( galCanvas );
104 
105  // GerbView requires draw priority for rendering negative objects
106  galCanvas->GetView()->UseDrawPriority( true );
107 
108  if( m_canvas )
110 
111  // Give an icon
112  wxIcon icon;
113  icon.CopyFromBitmap( KiBitmap( icon_gerbview_xpm ) );
114  SetIcon( icon );
115 
116  SetLayout( new GBR_LAYOUT() );
117 
118  SetVisibleLayers( -1 ); // All draw layers visible.
119 
120  SetScreen( new GBR_SCREEN( GetPageSettings().GetSizeIU() ) );
121 
122  // Create the PCB_LAYER_WIDGET *after* SetLayout():
123  wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
124  int pointSize = font.GetPointSize();
125  int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
126 
127  if( screenHeight <= 900 )
128  pointSize = (pointSize * 8) / 10;
129 
130  m_LayersManager = new GERBER_LAYER_WIDGET( this, m_canvas, pointSize );
131 
132  // LoadSettings() *after* creating m_LayersManager, because LoadSettings()
133  // initialize parameters in m_LayersManager
134  LoadSettings( config() );
135 
136  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
137 
138  if( m_LastGridSizeId < 0 )
139  m_LastGridSizeId = 0;
142  GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
143 
144  ReCreateMenuBar();
148 
149  m_auimgr.SetManagedWindow( this );
150 
151  EDA_PANEINFO horiz;
152  horiz.HorizontalToolbarPane();
153 
154  EDA_PANEINFO vert;
155  vert.VerticalToolbarPane();
156 
157  EDA_PANEINFO mesg;
158  mesg.MessageToolbarPane();
159 
160  // Create a wxAuiPaneInfo for the Layers Manager, not derived from the template.
161  // the Layers Manager is floatable, but initially docked at far right
162  EDA_PANEINFO lyrs;
163  lyrs.LayersToolbarPane();
164  lyrs.MinSize( m_LayersManager->GetBestSize() );
165  lyrs.BestSize( m_LayersManager->GetBestSize() );
166  lyrs.Caption( _( "Visibles" ) );
167  lyrs.TopDockable( false ).BottomDockable( false );
168 
169 
170  if( m_mainToolBar )
171  m_auimgr.AddPane( m_mainToolBar,
172  wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) );
173 
174  if( m_auxiliaryToolBar ) // the auxiliary horizontal toolbar, that shows component and netname lists
175  {
176  m_auimgr.AddPane( m_auxiliaryToolBar,
177  wxAuiPaneInfo( horiz ).Name( wxT( "m_auxiliaryToolBar" ) ).Top().Row( 1 ) );
178  }
179 
180  if( m_drawToolBar )
181  m_auimgr.AddPane( m_drawToolBar,
182  wxAuiPaneInfo( vert ).Name( wxT( "m_drawToolBar" ) ).Right().Row( 1 ) );
183 
184  m_auimgr.AddPane( m_LayersManager,
185  lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Layer( 0 ) );
186 
187  if( m_optionsToolBar )
188  m_auimgr.AddPane( m_optionsToolBar,
189  wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ).Left() );
190 
191  if( m_canvas )
192  m_auimgr.AddPane( m_canvas,
193  wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
194 
195  if( GetGalCanvas() )
196  m_auimgr.AddPane( (wxWindow*) GetGalCanvas(),
197  wxAuiPaneInfo().Name( wxT( "DrawFrameGal" ) ).CentrePane().Hide() );
198 
199  if( m_messagePanel )
200  m_auimgr.AddPane( m_messagePanel,
201  wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer( 10 ) );
202 
203  ReFillLayerWidget(); // this is near end because contents establish size
204  m_auimgr.Update();
205 
206  setupTools();
207 
208  SetActiveLayer( 0, true );
209  Zoom_Automatique( false ); // Gives a default zoom value
211 
213 
214  if( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
215  {
216  if( GetGalCanvas()->SwitchBackend( canvasType ) )
217  UseGalCanvas( true );
218 
219  wxUpdateUIEvent e;
221  }
222  else
223  {
225  m_canvas->Refresh();
226  }
227 
228  // Enable the axes to match legacy draw style
229  auto& galOptions = GetGalDisplayOptions();
230  galOptions.m_axesEnabled = true;
231  galOptions.NotifyChanged();
232 
234  m_LayersManager->ReFillRender(); // Update colors in Render after the config is read
235 }
236 
237 
239 {
240  if( m_toolManager )
242 
243  if( auto canvas = GetGalCanvas() )
244  {
245  canvas->GetView()->Clear();
246  }
247 
249 }
250 
251 
252 void GERBVIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
253 {
254  Destroy();
255 }
256 
257 
258 bool GERBVIEW_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
259 {
260  // The current project path is also a valid command parameter. Check if a single path
261  // rather than a file name was passed to GerbView and use it as the initial MRU path.
262  if( aFileSet.size() > 0 )
263  {
264  wxString path = aFileSet[0];
265 
266  // For some reason wxApp appears to leave the trailing double quote on quoted
267  // parameters which are required for paths with spaces. Maybe this should be
268  // pushed back into PGM_SINGLE_TOP::OnPgmInit() but that may cause other issues.
269  // We can't buy a break!
270  if( path.Last() == wxChar( '\"' ) )
271  path.RemoveLast();
272 
273  if( !wxFileExists( path ) && wxDirExists( path ) )
274  {
275  wxLogDebug( wxT( "MRU path: %s." ), GetChars( path ) );
276  m_mruPath = path;
277  return true;
278  }
279 
280  const unsigned limit = std::min( unsigned( aFileSet.size() ),
281  unsigned( GERBER_DRAWLAYERS_COUNT ) );
282 
283  int layer = 0;
284 
285  for( unsigned i=0; i<limit; ++i, ++layer )
286  {
287  SetActiveLayer( layer );
288 
289  // Try to guess the type of file by its ext
290  // if it is .drl (Kicad files), it is a drill file
291  wxFileName fn( aFileSet[i] );
292  wxString ext = fn.GetExt();
293 
294  if( ext == DrillFileExtension ) // In Excellon format
295  LoadExcellonFiles( aFileSet[i] );
296  else if( ext == GerberJobFileExtension )
297  LoadGerberJobFile( aFileSet[i] );
298  else
299  LoadGerberFiles( aFileSet[i] );
300  }
301  }
302 
303  Zoom_Automatique( true ); // Zoom fit in frame
304 
306 
307  return true;
308 }
309 
310 
312 {
314 
315  // gives a size to bbox (current page size), if no item in list
316  if( bbox.GetWidth() == 0 || bbox.GetHeight() == 0 )
317  {
318  wxSize pagesize = GetPageSettings().GetSizeMils();
319  bbox.SetSize( wxSize( Mils2iu( pagesize.x ), Mils2iu( pagesize.y ) ) );
320  }
321 
322  // Compute best zoom:
323  wxSize size = m_canvas->GetClientSize();
324  double x = (double) bbox.GetWidth() / (double) size.x;
325  double y = (double) bbox.GetHeight() / (double) size.y;
326  double best_zoom = std::max( x, y ) * 1.1;
327 
329 
330  return best_zoom;
331 }
332 
333 
334 void GERBVIEW_FRAME::LoadSettings( wxConfigBase* aCfg )
335 {
337 
338  // was: wxGetApp().ReadCurrentSetupValues( GetConfigurationSettings() );
340 
341  PAGE_INFO pageInfo( wxT( "GERBER" ) );
342 
344 
346  {
347  wxString pageType;
348  aCfg->Read( cfgShowPageSizeOption, &pageType, wxT( "GERBER" ) );
349  pageInfo.SetType( pageType );
350  }
351 
352  SetPageSettings( pageInfo );
353 
354  GetScreen()->InitDataPoints( pageInfo.GetSizeIU() );
355 
356  bool tmp;
357  aCfg->Read( cfgShowDCodes, &tmp, true );
359  aCfg->Read( cfgShowNegativeObjects, &tmp, false );
361 
362  // because we have more than one file history, we must read this one
363  // using a specific path
364  aCfg->SetPath( wxT( "drl_files" ) );
365  m_drillFileHistory.Load( *aCfg );
366  aCfg->SetPath( wxT( ".." ) );
367 
368  // because we have more than one file history, we must read this one
369  // using a specific path
370  aCfg->SetPath( wxT( "zip_files" ) );
371  m_zipFileHistory.Load( *aCfg );
372  aCfg->SetPath( wxT( ".." ) );
373 
374  // because we have more than one file history, we must read this one
375  // using a specific path
376  aCfg->SetPath( "job_files" );
377  m_jobFileHistory.Load( *aCfg );
378  aCfg->SetPath( wxT( ".." ) );
379 }
380 
381 
382 void GERBVIEW_FRAME::SaveSettings( wxConfigBase* aCfg )
383 {
385 
386  // was: wxGetApp().SaveCurrentSetupValues( GetConfigurationSettings() );
388 
389  aCfg->Write( cfgShowPageSizeOption, GetPageSettings().GetType() );
391  aCfg->Write( cfgShowDCodes, IsElementVisible( LAYER_DCODES ) );
392  aCfg->Write( cfgShowNegativeObjects,
394 
395  // Save the drill file history list.
396  // Because we have more than one file history, we must save this one
397  // in a specific path
398  aCfg->SetPath( wxT( "drl_files" ) );
399  m_drillFileHistory.Save( *aCfg );
400  aCfg->SetPath( wxT( ".." ) );
401 
402  // Save the zip file history list.
403  aCfg->SetPath( wxT( "zip_files" ) );
404  m_zipFileHistory.Save( *aCfg );
405  aCfg->SetPath( wxT( ".." ) );
406 
407  // Save the job file history list.
408  aCfg->SetPath( "job_files" );
409  m_jobFileHistory.Save( *aCfg );
410  aCfg->SetPath( ".." );
411 }
412 
413 
415 {
419 
420  wxAuiPaneInfo& lyrs = m_auimgr.GetPane( m_LayersManager );
421 
422  wxSize bestz = m_LayersManager->GetBestSize();
423  bestz.x += 5; // gives a little margin
424 
425  lyrs.MinSize( bestz );
426  lyrs.BestSize( bestz );
427  lyrs.FloatingSize( bestz );
428 
429  if( lyrs.IsDocked() )
430  m_auimgr.Update();
431  else
432  m_LayersManager->SetSize( bestz );
433 
434  syncLayerWidget();
435 }
436 
437 
439  bool aNewState )
440 {
441  switch( aItemIdVisible )
442  {
443  case LAYER_DCODES:
444  m_DisplayOptions.m_DisplayDCodes = aNewState;
445  break;
446 
449  break;
450 
451  case LAYER_GERBVIEW_GRID:
452  SetGridVisibility( aNewState );
453  break;
454 
455  default:
456  wxLogDebug( wxT( "GERBVIEW_FRAME::SetElementVisibility(): bad arg %d" ), aItemIdVisible );
457  }
458 
460  m_LayersManager->SetRenderState( aItemIdVisible, aNewState );
461 }
462 
463 
465 {
466  auto view = GetGalCanvas()->GetView();
467  auto painter = static_cast<KIGFX::GERBVIEW_PAINTER*>( view->GetPainter() );
468  auto settings = static_cast<KIGFX::GERBVIEW_RENDER_SETTINGS*>( painter->GetSettings() );
469  settings->LoadDisplayOptions( &m_DisplayOptions );
470 
471  settings->ImportLegacyColors( m_colorsSettings );
472 
473  view->RecacheAllItems();
474  view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
475 }
476 
477 
479 {
480  int layer = aLayer;
481 
482  for( unsigned i = 0; i < ImagesMaxCount(); ++i )
483  {
484  const GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
485 
486  if( gerber == NULL ) // this graphic layer is available: use it
487  return layer;
488 
489  ++layer; // try next graphic layer
490 
491  if( layer >= (int)ImagesMaxCount() )
492  layer = 0;
493  }
494 
495  return NO_AVAILABLE_LAYERS;
496 }
497 
498 
500 {
503 }
504 
505 
506 void GERBVIEW_FRAME::syncLayerBox( bool aRebuildLayerBox )
507 {
508  if( aRebuildLayerBox )
510 
511  m_SelLayerBox->SetSelection( GetActiveLayer() );
512 
513  int dcodeSelected = -1;
515 
516  if( gerber )
517  dcodeSelected = gerber->m_Selected_Tool;
518 
519  if( m_DCodeSelector )
520  {
522  m_DCodeSelector->SetDCodeSelection( dcodeSelected );
523  m_DCodeSelector->Enable( gerber != NULL );
524  }
525 
527 }
528 
529 
531 {
532  int ii, jj;
533  wxString Line;
534  wxArrayString list;
535  double scale = g_UserUnit == INCHES ? IU_PER_MILS * 1000 : IU_PER_MM;
536  int curr_layer = GetActiveLayer();
537 
538  for( int layer = 0; layer < (int)ImagesMaxCount(); ++layer )
539  {
540  GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
541 
542  if( gerber == NULL )
543  continue;
544 
545  if( gerber->GetDcodesCount() == 0 )
546  continue;
547 
548  if( layer == curr_layer )
549  Line.Printf( wxT( "*** Active layer (%2.2d) ***" ), layer + 1 );
550  else
551  Line.Printf( wxT( "*** layer %2.2d ***" ), layer + 1 );
552 
553  list.Add( Line );
554 
555  const char* units = g_UserUnit == INCHES ? "\"" : "mm";
556 
557  for( ii = 0, jj = 1; ii < TOOLS_MAX_COUNT; ii++ )
558  {
559  D_CODE* pt_D_code = gerber->GetDCODE( ii + FIRST_DCODE );
560 
561  if( pt_D_code == NULL )
562  continue;
563 
564  if( !pt_D_code->m_InUse && !pt_D_code->m_Defined )
565  continue;
566 
567  Line.Printf( wxT( "tool %2.2d: D%2.2d V %.4f %s H %.4f %s %s attribute '%s'" ),
568  jj,
569  pt_D_code->m_Num_Dcode,
570  pt_D_code->m_Size.y / scale, units,
571  pt_D_code->m_Size.x / scale, units,
572  D_CODE::ShowApertureType( pt_D_code->m_Shape ),
573  pt_D_code->m_AperFunction.IsEmpty()? wxT( "none" ) : GetChars( pt_D_code->m_AperFunction )
574  );
575 
576  if( !pt_D_code->m_Defined )
577  Line += wxT( " (not defined)" );
578 
579  if( pt_D_code->m_InUse )
580  Line += wxT( " (in use)" );
581 
582  list.Add( Line );
583  jj++;
584  }
585  }
586 
587  wxSingleChoiceDialog dlg( this, wxEmptyString, _( "D Codes" ), list, (void**) NULL,
588  wxCHOICEDLG_STYLE & ~wxCANCEL );
589 
590  dlg.ShowModal();
591 }
592 
593 
595 {
597 
598  // Display the gerber filename
599  if( gerber == NULL )
600  {
601  SetTitle( "GerbView" );
602 
603  SetStatusText( wxEmptyString, 0 );
604 
605  wxString info;
606  info.Printf( _( "Drawing layer %d not in use" ), GetActiveLayer() + 1 );
607  m_TextInfo->SetValue( info );
608 
609  if( EnsureTextCtrlWidth( m_TextInfo, &info ) ) // Resized
610  m_auimgr.Update();
611 
612  ClearMsgPanel();
613  return;
614  }
615  else
616  {
617  wxString title;
618  title.Printf( L"GerbView \u2014 %s%s",
619  gerber->m_FileName,
620  gerber->m_IsX2_file
621  ? " " + _( "(with X2 attributes)" )
622  : wxString( wxEmptyString ) );
623  SetTitle( title );
624 
625  gerber->DisplayImageInfo( this );
626 
627  // Display Image Name and Layer Name (from the current gerber data):
628  wxString status;
629  status.Printf( _( "Image name: '%s' Layer name: '%s'" ),
630  GetChars( gerber->m_ImageName ),
631  GetChars( gerber->GetLayerParams().m_LayerName ) );
632  SetStatusText( status, 0 );
633 
634  // Display data format like fmt in X3.4Y3.4 no LZ or fmt mm X2.3 Y3.5 no TZ in main toolbar
635  wxString info;
636  info.Printf( wxT( "fmt: %s X%d.%d Y%d.%d no %cZ" ),
637  gerber->m_GerbMetric ? wxT( "mm" ) : wxT( "in" ),
638  gerber->m_FmtLen.x - gerber->m_FmtScale.x, gerber->m_FmtScale.x,
639  gerber->m_FmtLen.y - gerber->m_FmtScale.y, gerber->m_FmtScale.y,
640  gerber->m_NoTrailingZeros ? 'T' : 'L' );
641 
642  if( gerber->m_IsX2_file )
643  info << wxT(" ") << _( "X2 attr" );
644 
645  m_TextInfo->SetValue( info );
646 
647  if( EnsureTextCtrlWidth( m_TextInfo, &info ) ) // Resized
648  m_auimgr.Update();
649  }
650 }
651 
652 
654 {
655  switch( aItemIdVisible )
656  {
657  case LAYER_DCODES:
659  break;
660 
663  break;
664 
665  case LAYER_GERBVIEW_GRID:
666  return IsGridVisible();
667  break;
668 
669  default:
670  wxLogDebug( wxT( "GERBVIEW_FRAME::IsElementVisible(): bad arg %d" ), aItemIdVisible );
671  }
672 
673  return true;
674 }
675 
676 
678 {
679  long layerMask = 0;
680 
681  if( auto canvas = GetGalCanvas() )
682  {
683  // NOTE: This assumes max 32 drawlayers!
684  for( int i = 0; i < GERBER_DRAWLAYERS_COUNT; i++ )
685  {
686  if( canvas->GetView()->IsLayerVisible( GERBER_DRAW_LAYER( i ) ) )
687  layerMask |= ( 1 << i );
688  }
689 
690  return layerMask;
691  }
692  else
693  {
694  return -1;
695  }
696 }
697 
698 
699 void GERBVIEW_FRAME::SetVisibleLayers( long aLayerMask )
700 {
701  if( auto canvas = GetGalCanvas() )
702  {
703  // NOTE: This assumes max 32 drawlayers!
704  for( int i = 0; i < GERBER_DRAWLAYERS_COUNT; i++ )
705  {
706  bool v = ( aLayerMask & ( 1 << i ) );
707  int layer = GERBER_DRAW_LAYER( i );
708  canvas->GetView()->SetLayerVisible( layer, v );
709  canvas->GetView()->SetLayerVisible( GERBER_DCODE_LAYER( layer ), v );
710  }
711  }
712 }
713 
714 
715 bool GERBVIEW_FRAME::IsLayerVisible( int aLayer ) const
716 {
718  {
719  if( IsGalCanvasActive() )
720  aLayer = GERBER_DRAW_LAYER( aLayer );
721 
722  return m_LayersManager->IsLayerVisible( aLayer );
723  }
724  else
725  return GetGerberLayout()->IsLayerPrintable( aLayer );
726 }
727 
728 
730 {
731  COLOR4D color = COLOR4D::UNSPECIFIED;
732 
733  switch( aItemIdVisible )
734  {
736  case LAYER_DCODES:
737  color = m_colorsSettings->GetItemColor( aItemIdVisible );
738  break;
739 
740  case LAYER_GERBVIEW_GRID:
741  color = GetGridColor();
742  break;
743 
744  default:
745  wxLogDebug( wxT( "GERBVIEW_FRAME::GetVisibleElementColor(): bad arg %d" ),
746  (int)aItemIdVisible );
747  }
748 
749  return color;
750 }
751 
752 
754 {
757 }
758 
759 
761  COLOR4D aColor )
762 {
763  switch( aItemIdVisible )
764  {
766  case LAYER_DCODES:
767  m_colorsSettings->SetItemColor( aItemIdVisible, aColor );
768  break;
769 
770  case LAYER_GERBVIEW_GRID:
771  // Ensure grid always has low alpha
772  aColor.a = 0.8;
773  SetGridColor( aColor );
774  m_colorsSettings->SetItemColor( aItemIdVisible, aColor );
775  break;
776 
777  default:
778  wxLogDebug( wxT( "GERBVIEW_FRAME::SetVisibleElementColor(): bad arg %d" ),
779  (int) aItemIdVisible );
780  }
781 }
782 
784 {
787  else
788  return GetDrawBgColor();
789 }
790 
791 
793 {
794  return m_colorsSettings->GetLayerColor( aLayer );
795 }
796 
797 
798 void GERBVIEW_FRAME::SetLayerColor( int aLayer, COLOR4D aColor )
799 {
800  m_colorsSettings->SetLayerColor( aLayer, aColor );
802 }
803 
804 
806 {
807  return ( (GBR_SCREEN*) GetScreen() )->m_Active_Layer;
808 }
809 
810 
811 void GERBVIEW_FRAME::SetActiveLayer( int aLayer, bool doLayerWidgetUpdate )
812 {
813  ( (GBR_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;
814 
815  if( doLayerWidgetUpdate )
817 
818  if( IsGalCanvasActive() )
819  {
820  m_toolManager->RunAction( GERBVIEW_ACTIONS::layerChanged ); // notify other tools
821  GetGalCanvas()->SetFocus(); // otherwise hotkeys are stuck somewhere
822 
823  // NOTE(JE) The next two calls are slow (scales with number of items)
826 
827  GetGalCanvas()->Refresh();
828  }
829 }
830 
831 
832 void GERBVIEW_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
833 {
834  m_paper = aPageSettings;
835 
836  if( GetScreen() )
837  GetScreen()->InitDataPoints( aPageSettings.GetSizeIU() );
838 }
839 
840 
842 {
843  return m_paper;
844 }
845 
846 
847 const wxSize GERBVIEW_FRAME::GetPageSizeIU() const
848 {
849  // this function is only needed because EDA_DRAW_FRAME is not compiled
850  // with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
851  // into an application specific source file.
852  return GetPageSettings().GetSizeIU();
853 }
854 
855 
857 {
858  wxASSERT( m_gerberLayout );
859  return m_gerberLayout->GetTitleBlock();
860 }
861 
862 
863 void GERBVIEW_FRAME::SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
864 {
865  wxASSERT( m_gerberLayout );
866  m_gerberLayout->SetTitleBlock( aTitleBlock );
867 }
868 
869 
871 {
872  wxASSERT( m_gerberLayout );
873  return m_gerberLayout->GetAuxOrigin();
874 }
875 
876 
877 void GERBVIEW_FRAME::SetAuxOrigin( const wxPoint& aPosition )
878 {
879  wxASSERT( m_gerberLayout );
880  m_gerberLayout->SetAuxOrigin( aPosition );
881 }
882 
883 
884 void GERBVIEW_FRAME::SetCurItem( GERBER_DRAW_ITEM* aItem, bool aDisplayInfo )
885 {
886  GetScreen()->SetCurItem( aItem );
887 
888  if( aItem )
889  {
890  if( aDisplayInfo )
891  {
892  MSG_PANEL_ITEMS items;
893  aItem->GetMsgPanelInfo( items );
894  SetMsgPanel( items );
895  }
896  }
897  else
898  {
899  EraseMsgBox();
900  }
901 }
902 
903 
905 {
906  if( IsGalCanvasActive() )
907  {
908  GetGalCanvas()->GetGAL()->SetGridColor( aColor );
909  }
910 
911  m_gridColor = aColor;
912 }
913 
914 
916 {
918  return GetGerberLayout()->GetBoundingBox();
919 }
920 
922 {
924 
925  GBR_SCREEN* screen = (GBR_SCREEN*) GetScreen();
926 
927  if( !screen )
928  return;
929 
930  int dx;
931  int dy;
932  double dXpos;
933  double dYpos;
934  wxString line;
935  wxString locformatter;
936 
937  if( m_DisplayOptions.m_DisplayPolarCood ) // display relative polar coordinates
938  {
939  double theta, ro;
940 
941  dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
942  dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
943 
944  // atan2 in the 0,0 case returns 0
945  theta = RAD2DEG( atan2( (double) -dy, (double) dx ) );
946 
947  ro = hypot( dx, dy );
948  wxString formatter;
949  switch( g_UserUnit )
950  {
951  case INCHES:
952  formatter = wxT( "Ro %.6f Th %.1f" );
953  break;
954 
955  case MILLIMETRES:
956  formatter = wxT( "Ro %.5f Th %.1f" );
957  break;
958 
959  case UNSCALED_UNITS:
960  formatter = wxT( "Ro %f Th %f" );
961  break;
962 
963  case DEGREES:
964  wxASSERT( false );
965  break;
966  }
967 
968  line.Printf( formatter, To_User_Unit( g_UserUnit, ro ), theta );
969 
970  SetStatusText( line, 3 );
971  }
972 
973  // Display absolute coordinates:
976 
977  wxString absformatter;
978 
979  switch( g_UserUnit )
980  {
981  case INCHES:
982  absformatter = wxT( "X %.6f Y %.6f" );
983  locformatter = wxT( "dx %.6f dy %.6f dist %.4f" );
984  break;
985 
986  case MILLIMETRES:
987  absformatter = wxT( "X %.5f Y %.5f" );
988  locformatter = wxT( "dx %.5f dy %.5f dist %.3f" );
989  break;
990 
991  case UNSCALED_UNITS:
992  absformatter = wxT( "X %f Y %f" );
993  locformatter = wxT( "dx %f dy %f dist %f" );
994  break;
995 
996  case DEGREES:
997  wxASSERT( false );
998  break;
999  }
1000 
1001  line.Printf( absformatter, dXpos, dYpos );
1002  SetStatusText( line, 2 );
1003 
1004  if( !m_DisplayOptions.m_DisplayPolarCood ) // display relative cartesian coordinates
1005  {
1006  // Display relative coordinates:
1007  dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
1008  dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
1009  dXpos = To_User_Unit( g_UserUnit, dx );
1010  dYpos = To_User_Unit( g_UserUnit, dy );
1011 
1012  // We already decided the formatter above
1013  line.Printf( locformatter, dXpos, dYpos, hypot( dXpos, dYpos ) );
1014  SetStatusText( line, 3 );
1015  }
1016 }
1017 
1018 
1020 {
1022 }
1023 
1025 {
1026  return m_gerberLayout->GetImagesList()->GetGbrImage( aIdx );
1027 }
1028 
1030 {
1032 }
1033 
1034 
1036 { // Called on units change (see EDA_DRAW_FRAME)
1039 }
1040 
1041 
1043 {
1044  for( int i = 0; i < LAYER_ID_COUNT; i++ )
1045  {
1047  c.SetToNearestLegacyColor();
1049  }
1050 }
1051 
1052 
1053 void GERBVIEW_FRAME::UseGalCanvas( bool aEnable )
1054 {
1055  EDA_DRAW_FRAME::UseGalCanvas( aEnable );
1056 
1057  EDA_DRAW_PANEL_GAL* galCanvas = GetGalCanvas();
1058 
1059  if( m_toolManager )
1061  GetGalCanvas()->GetViewControls(), this );
1062 
1063  if( aEnable )
1064  {
1065  if( m_toolManager )
1067 
1069 
1070  galCanvas->GetView()->RecacheAllItems();
1071  galCanvas->SetEventDispatcher( m_toolDispatcher );
1072  galCanvas->StartDrawing();
1073  }
1074  else
1075  {
1076  if( m_toolManager )
1078 
1079  galCanvas->StopDrawing();
1080 
1081  // Redirect all events to the legacy canvas
1082  galCanvas->SetEventDispatcher( NULL );
1083 
1085  m_canvas->Refresh();
1086  }
1087 
1090 
1092 }
1093 
1094 
1096 {
1097  // Create the manager and dispatcher & route draw panel events to the dispatcher
1100  GetGalCanvas()->GetViewControls(), this );
1101  m_actions = new GERBVIEW_ACTIONS();
1103 
1104  // Register tools
1107 
1108  // Run the selection tool, it is supposed to be always active
1109  m_toolManager->InvokeTool( "gerbview.InteractiveSelection" );
1110 }
1111 
EDA_PANEINFO & HorizontalToolbarPane()
Function HorizontalToolbarPane Change *this to a horizontal toolbar for KiCad.
Definition: wxstruct.h:487
TOOL_MANAGER * m_toolManager
Definition: draw_frame.h:95
Class GBR_LAYOUT holds list of GERBER_DRAW_ITEM currently loaded.
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock) override
#define KICAD_DEFAULT_DRAWFRAME_STYLE
Definition: wxstruct.h:55
void SetCurItem(EDA_ITEM *aItem)
Function SetCurItem sets the currently selected object, m_CurrentItem.
static const wxString cfgShowBorderAndTitleBlock(wxT("ShowBorderAndTitleBlock"))
static TOOL_ACTION layerChanged
virtual void SetHighContrastLayer(int aLayer)
Function SetHighContrastLayer Takes care of display settings for the given layer to be displayed in h...
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox.
wxString m_mruPath
Most recently used path.
Definition: wxstruct.h:165
void SetItemColor(int aItemIdx, COLOR4D aColor)
Function SetItemColor sets the color for an item which is one of the item indices given in enum PCB_L...
const wxSize GetPageSizeIU() const override
Function GetPageSizeIU works off of GetPageSettings() to return the size of the paper page in the int...
D_CODE * GetDCODE(int aDCODE) const
Function GetDCODE returns a pointer to the D_CODE within this GERBER for the given aDCODE...
COLORS_DESIGN_SETTINGS g_ColorsSettings(FRAME_GERBER)
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for render...
Definition: draw_frame.h:891
bool m_showAxis
True shows the X and Y axis indicators.
Definition: draw_frame.h:103
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
void UpdateStatusBar() override
Function UpdateStatusBar updates the status bar information.
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
void DeleteAllImages()
remove all loaded data in list, and delete all images.
bool IsLayerPrintable(int aLayer) const
Function IsLayerPrintable tests whether a given layer is visible.
EDA_RECT GetGerberLayoutBoundingBox()
Function GetGerberLayoutBoundingBox calculates the bounding box containing all gerber items...
virtual void forceColorsToLegacy() override
>
Implementation of conversion functions that require both schematic and board internal units...
COLOR4D GetNegativeItemsColor()
Function GetNegativeItemsColor.
TOOL_DISPATCHER * m_toolDispatcher
Definition: draw_frame.h:96
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:94
void SetVisibleElementColor(GERBVIEW_LAYER_ID aItemIdVisible, COLOR4D aColor)
void syncLayerBox(bool aRebuildLayerBox=false)
Function syncLayerBox updates the currently "selected" layer within m_SelLayerBox The currently activ...
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...
void SetAuxOrigin(const wxPoint &aPoint) override
bool m_InUse
false if the aperure (previously defined) is not used to draw something
Definition: dcode.h:102
void SetCurItem(GERBER_DRAW_ITEM *aItem, bool aDisplayInfo=true)
Function SetCurItem sets the currently selected item and displays it in the MsgPanel.
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:95
void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:141
const wxPoint & GetAuxOrigin() const override
Function GetAuxOrigin returns the origin of the axis used for plotting and various exports...
void SetScrollCenterPosition(const wxPoint &aPoint)
const wxPoint & GetAuxOrigin() const
void SetPageSettings(const PAGE_INFO &aPageSettings) override
const TITLE_BLOCK & GetTitleBlock() const override
GERBER_LAYER_WIDGET * m_LayersManager
#define ZOOM_FACTOR(x)
Definition: classpcb.cpp:42
void UseDrawPriority(bool aFlag)
Function UseDrawPriority()
Definition: view.h:628
void LoadDisplayOptions(const GBR_DISPLAY_OPTIONS *aOptions)
Function LoadDisplayOptions Loads settings related to display options.
void RecacheAllItems()
Function RecacheAllItems() Rebuilds GAL display lists.
Definition: view.cpp:1253
double RAD2DEG(double rad)
Definition: trigo.h:200
bool OpenProjectFiles(const std::vector< wxString > &aFileSet, int aCtl) override
Class GERBER_FILE_IMAGE holds the Image data and parameters for one gerber file and layer parameters ...
void SetActiveLayer(int aLayer, bool doLayerWidgetUpdate=true)
Function SetActiveLayer will change the currently active layer to aLayer and also update the GERBER_L...
int GetHeight() const
GBR_LAYER_BOX_SELECTOR * m_SelLayerBox
void SetAuxOrigin(const wxPoint &aPosition)
void SetDCodeSelection(int aDCodeId)
Function SetDCodeSelection.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
static const wxString cfgShowNegativeObjects(wxT("ShowNegativeObjectsOpt"))
virtual wxConfigBase * config()
Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_F...
Definition: basicframe.cpp:380
void SetLayerColor(LAYER_NUM aLayer, COLOR4D aColor)
Function SetLayerColor sets the color for aLayer.
void SetGalCanvas(EDA_DRAW_PANEL_GAL *aPanel)
Definition: draw_frame.h:871
bool m_DisplayNegativeObjects
Option to draw negative objects in a specific color.
wxAuiManager m_auimgr
Definition: wxstruct.h:149
wxFileHistory m_drillFileHistory
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
static const wxString cfgShowDCodes(wxT("ShowDCodesOpt"))
wxSize GetBestSize() const
Function GetBestSize returns the preferred minimum size, taking into consideration the dynamic conten...
Class EDA_DRAW_FRAME is the base class for create windows for drawing purpose.
Definition: draw_frame.h:54
EDA_PANEINFO & LayersToolbarPane()
Function LayersToolbarPane Change *this to a layers toolbar for KiCad.
Definition: wxstruct.h:539
int GetActiveLayer()
Function SetActiveLayer returns the active layer.
void SetVisibleLayers(long aLayerMask)
Function SetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
Class TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout, or editing view.
wxPoint m_O_Curseur
Relative Screen cursor coordinate (on grid) in user units.
COLOR4D m_gridColor
Grid color.
Definition: draw_frame.h:83
virtual void UseGalCanvas(bool aEnable)
Function UseGalCanvas used to switch between standard and GAL-based canvas.
void SaveSettings(wxConfigBase *aCfg) override
Function SaveSettings saves common frame parameters to a configuration data file. ...
Definition: draw_frame.cpp:746
void DeactivateTool()
Function DeactivateTool() Deactivates the currently active tool.
GERBVIEW_LAYER_ID
GerbView draw layers.
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls a tool by sending a tool activation event to tool of given ID...
Specialization of the wxAuiPaneInfo class for KiCad panels.
Definition: wxstruct.h:478
EDA_RECT ComputeBoundingBox() const
Function ComputeBoundingBox calculates the bounding box containing all Gerber items.
virtual bool IsGridVisible() const
Function IsGridVisible() , virtual.
Definition: draw_frame.h:481
void SaveSettings(wxConfigBase *aCfg) override
Function SaveSettings saves common frame parameters to a configuration data file. ...
int getNextAvailableLayer(int aLayer=0) const
Function getNextAvailableLayer finds the next empty layer starting at aLayer and returns it to the ca...
void SetGridVisibility(bool aVisible) override
Function SetGridVisibility(), virtual from EDA_DRAW_FRAME It may be overloaded by derived classes...
GERBVIEW_FRAME(KIWAY *aKiway, wxWindow *aParent)
Class GERBVIEW_ACTIONS.
long GetVisibleLayers() const
Function GetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
Auxiliary rendering target (noncached)
Definition: definitions.h:42
const wxSize & GetSizeMils() const
void ReCreateHToolbar() override
bool LoadGerberJobFile(const wxString &aFileName)
Load a Gerber job file, and load gerber files found in job files.
COLOR4D GetItemColor(int aItemIdx) const
Function GetItemColor.
#define GERBER_DCODE_LAYER(x)
void InitDataPoints(const wxSize &aPageSizeInternalUnits)
Definition: base_screen.cpp:69
Class TOOL_MANAGER.
Definition: tool_manager.h:49
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
void Zoom_Automatique(bool aWarpPointer)
Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows a...
Definition: zoom.cpp:77
EDA_PANEINFO & VerticalToolbarPane()
Function VerticalToolbarPane Change *this to a vertical toolbar for KiCad.
Definition: wxstruct.h:505
bool m_Defined
false if the aperture is not defined in the header
Definition: dcode.h:104
void SetGridColor(const COLOR4D &aGridColor)
Set the grid color.
KIGFX::GAL * GetGAL() const
Function GetGAL() Returns a pointer to the GAL instance used in the panel.
void DisplayImageInfo(GERBVIEW_FRAME *aMainFrame)
Function DisplayImageInfo has knowledge about the frame and how and where to put status information a...
double a
Alpha component.
Definition: color4d.h:289
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:347
COLOR4D GetVisibleElementColor(GERBVIEW_LAYER_ID aItemIdVisible)
Function GetVisibleElementColor returns the color of a gerber visible element.
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:126
bool EnsureTextCtrlWidth(wxTextCtrl *aCtrl, const wxString *aString)
Function EnsureTextCtrlWidth sets the minimum pixel width on a text control in order to make a text s...
Definition: common.cpp:108
unsigned ImagesMaxCount() const
The max number of file images.
virtual COLOR4D GetDrawBgColor() const
Definition: draw_frame.h:324
PAGE_INFO m_paper
void ReCreateAuxiliaryToolbar() override
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:77
virtual void unitsChangeRefresh() override
Function unitsChangeRefresh is called when when the units setting has changed to allow for any derive...
#define GERBER_DRAWLAYERS_COUNT
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
GERBER_FILE_IMAGE * GetGbrImage(int aIdx)
void EraseMsgBox()
Definition: draw_frame.cpp:261
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).
Class GERBVIEW_PAINTER Contains methods for drawing GerbView-specific items.
#define FIRST_DCODE
Definition: dcode.h:71
#define NO_AVAILABLE_LAYERS
bool LoadGerberFiles(const wxString &aFileName)
function LoadGerberFiles Load a photoplot (Gerber) file or many files.
Base window classes and related definitions.
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:129
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
Definition: common.h:144
int m_Num_Dcode
D code value ( >= 10 )
Definition: dcode.h:96
COLORS_DESIGN_SETTINGS * m_colorsSettings
GBR_DISPLAY_OPTIONS m_DisplayOptions
virtual void SetTopLayer(int aLayer)
Function SetTopLayer Moves the selected layer to the top, so it is displayed above all others...
void applyDisplaySettingsToGAL()
Updates the GAL with display settings changes.
const wxString DrillFileExtension
TITLE_BLOCK & GetTitleBlock()
The common library.
static const wxChar * ShowApertureType(APERTURE_T aType)
Function ShowApertureType returns a character string telling what type of aperture type aType is...
Definition: dcode.cpp:95
double BestZoom() override
Return the zoom level which displays the full page on screen.
Helper dialog and control classes.
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Function ResetTools() Resets all tools (i.e.
GBR_LAYOUT * m_gerberLayout
wxFileHistory m_jobFileHistory
Class KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within...
Definition: kiway.h:257
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 void SetFocus() override
GBR_LAYOUT * GetGerberLayout() const
bool m_DisplayPolarCood
Option to display coordinates in status bar in X,Y or Polar coords.
virtual void UseGalCanvas(bool aEnable) override
>
wxPoint m_FramePos
Definition: wxstruct.h:139
Class GERBER_LAYER_WIDGET is here to implement the abtract functions of LAYER_WIDGET so they may be t...
bool SetType(const wxString &aStandardPageDescriptionName, bool IsPortrait=false)
Function SetType sets the name of the page type and also the sizes and margins commonly associated wi...
wxPoint Centre() const
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
void OnCloseWindow(wxCloseEvent &Event)
bool IsLayerVisible(int aLayer) const
Function IsLayerVisible tests whether a given layer is visible.
Class GERBVIEW_RENDER_SETTINGS Stores GerbView specific render settings.
int m_LastGridSizeId
Definition: draw_frame.h:78
virtual COLOR4D GetGridColor()
Function GetGridColor() , virtual.
Definition: draw_frame.h:500
#define GERBVIEW_FRAME_NAME
Class GERBVIEW_FRAME is the main window used in GerbView.
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:123
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
Definition: wxstruct.h:145
void StartDrawing()
Function StartDrawing() Begins drawing if it was stopped previously.
#define LAYER_ID_COUNT
Must update this if you add any enums after GerbView!
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
Definition: draw_frame.cpp:716
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting() const
Returns the canvas type stored in the application settings.
void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
const wxString GerberJobFileExtension
void ReCreateOptToolbar()
Create or update the left vertical toolbar (option toolbar.
Class TOOL_DISPATCHER.
wxString m_AperFunction
the aperture attribute (created by a TA.AperFunction command) attached to the D_CODE ...
Definition: dcode.h:105
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
wxTextCtrl * m_TextInfo
DCODE_SELECTION_BOX * m_DCodeSelector
wxAuiToolBar * m_auxiliaryToolBar
Auxiliary tool bar typically shown below the main tool bar at the top of the main window...
wxFileHistory m_zipFileHistory
const PAGE_INFO & GetPageSettings() const override
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
bool IsLayerVisible(LAYER_NUM aLayer)
Function IsLayerVisible returns the visible state of the layer ROW associated with aLayer id...
COLOR4D GetLayerColor(int aLayer) const
Function GetLayerColor gets a layer color for any valid layer.
void SetSize(const wxSize &size)
EDA_PANEINFO & MessageToolbarPane()
Function MessageToolbarPane Change *this to a message pane for KiCad.
Definition: wxstruct.h:524
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:86
void wxConfigSaveSetups(wxConfigBase *aCfg, const PARAM_CFG_ARRAY &aList)
Function wxConfigSaveSetups writes aList of PARAM_CFG_ARRAY elements to save configuration values to ...
const int scale
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
see class PGM_BASE
Class D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
void OnUpdateSwitchCanvas(wxUpdateUIEvent &aEvent)
Update UI called when switches currently used canvas (default / Cairo / OpenGL).
PARAM_CFG_ARRAY & GetConfigurationSettings(void)
Function GetConfigurationSettings Populates the GerbView applications settings list.
#define max(a, b)
Definition: auxiliary.h:86
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Function SetEventDispatcher() Sets a dispatcher that processes events and forwards them to tools...
void SetElementVisibility(GERBVIEW_LAYER_ID aItemIdVisible, bool aNewState)
Function SetElementVisibility changes the visibility of an element category.
GERBER_FILE_IMAGE_LIST * GetImagesList() const
bool IsElementVisible(GERBVIEW_LAYER_ID aItemIdVisible) const
Function IsElementVisible tests whether a given element category is visible.
Class EDA_RECT handles the component boundary box.
#define TOOLS_MAX_COUNT
Definition: dcode.h:73
struct EDA_HOTKEY_CONFIG GerbviewHokeysDescr[]
void SetLayerColor(int aLayer, COLOR4D aColor)
Function SetLayerColor changes a layer color for any valid layer.
int GetWidth() const
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:102
COLOR4D GetLayerColor(LAYER_NUM aLayer) const
Function GetLayerColor.
virtual void SetGridColor(COLOR4D aColor) override
>
void syncLayerWidget()
Function syncLayerWidget updates the currently "selected" layer within the GERBER_LAYER_WIDGET.
void SetEnableBlockCommands(bool aEnable)
Class COLORS_DESIGN_SETTINGS is a list of color settings for designs in Pcbnew.
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
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:91
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
bool LoadExcellonFiles(const wxString &aFileName)
function LoadExcellonFiles Load a drill (EXCELLON) file or many files.
virtual void SetGridVisibility(bool aVisible)
Function SetGridVisibility() , virtual It may be overloaded by derived classes.
Definition: draw_frame.h:491
wxSize m_FrameSize
Definition: wxstruct.h:140
#define GERBER_DRAW_LAYER(x)
void InitTools()
Function InitTools() Initializes all registered tools.
void ReFillRender()
Function ReFillRender Rebuild Render for instance after the config is read.
GERBER_FILE_IMAGE * GetGbrImage(int aIdx) const
virtual void unitsChangeRefresh()
Function unitsChangeRefresh is called when when the units setting has changed to allow for any derive...
Definition: draw_frame.cpp:254
bool m_show_layer_manager_tools
void ReCreateMenuBar() override
Function ReCreateMenuBar Creates recreates the menu bar.
int SetGrid(const wxRealPoint &size)
set the current grid size m_Grid.
virtual void RegisterAllTools(TOOL_MANAGER *aToolManager)=0
Registers all valid tools for an application with the tool manager
Message panel definition file.
void SetRenderState(int aId, bool isSet)
Function SetRenderState sets the state of the checkbox associated with aId within the Render tab grou...
void SetLayout(GBR_LAYOUT *aLayout)
Function SetLayout sets the m_gerberLayout member in such as way as to ensure deleting any previous G...
ACTIONS * m_actions
Definition: draw_frame.h:97
bool m_IsPrinting
true when printing a page, false when drawing on screen
bool m_DisplayDCodes
Option to show dcode values on items drawn with a dcode tool.
Rendering engine changes.
Definition: tool_base.h:84
void wxConfigLoadSetups(wxConfigBase *aCfg, const PARAM_CFG_ARRAY &aList)
Function wxConfigLoadSetups uses aList of PARAM_CFG_ARRAY elements to load configuration values from ...
void SelectLayer(LAYER_NUM aLayer)
Function SelectLayer changes the row selection in the layer list to aLayer provided.
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 Liste_D_Codes()
Set Size Items (Lines, Flashes) from DCodes List.
void ClearMsgPanel(void)
Clear all messages from the message panel.
Definition: draw_frame.cpp:775
void ReFillLayerWidget()
Function ReFillLayerWidget changes out all the layers in m_Layers and may be called upon loading new ...
void UpdateTitleAndInfo()
Function UpdateTitleAndInfo displays the short filename (if exists) of the selected layer on the capt...
void StopDrawing()
Function StopDrawing() Prevents the GAL canvas from further drawing till it is recreated or StartDraw...
static const wxString cfgShowPageSizeOption(wxT("PageSizeOpt"))
GERBER_LAYER & GetLayerParams()
Function GetLayerParams.
#define min(a, b)
Definition: auxiliary.h:85
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
const wxString GetZoomLevelIndicator() const override
Function GetZoomLevelIndicator returns a human readable value which can be displayed as zoom level in...
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39