KiCad PCB EDA Suite
toolbars_gerber.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) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
6  * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
7  *
8  * This program is free software: you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation, either version 3 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
27 #include <fctsys.h>
28 
29 #include <common.h>
30 #include <gerbview.h>
31 #include <gerbview_frame.h>
32 #include <bitmaps.h>
33 #include <gerbview_id.h>
34 #include <hotkeys.h>
35 #include <gerber_file_image.h>
36 #include <gerber_file_image_list.h>
37 #include <gbr_layer_box_selector.h>
38 #include <DCodeSelectionbox.h>
39 #include <dialog_helpers.h>
40 #include <bitmaps.h>
41 
42 #include <wx/wupdlock.h>
43 
45 {
46  wxString msg;
47 
48  if( m_mainToolBar )
49  m_mainToolBar->Clear();
50  else
51  m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
52  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
53 
54  // Set up toolbar
55  m_mainToolBar->AddTool( ID_GERBVIEW_ERASE_ALL, wxEmptyString,
56  KiScaledBitmap( delete_gerber_xpm, this ),
57  _( "Clear all layers" ) );
58 
59  m_mainToolBar->AddTool( ID_GERBVIEW_RELOAD_ALL, wxEmptyString,
60  KiScaledBitmap( reload2_xpm, this ),
61  _( "Reload all layers" ) );
62 
63  m_mainToolBar->AddTool( wxID_FILE, wxEmptyString, KiScaledBitmap( load_gerber_xpm, this ),
64  _( "Open Gerber file(s) on the current layer. Previous data will be deleted" ) );
65 
66  m_mainToolBar->AddTool( ID_GERBVIEW_LOAD_DRILL_FILE, wxEmptyString,
67  KiScaledBitmap( gerbview_drill_file_xpm, this ),
68  _( "Open Excellon drill file(s) on the current layer. Previous data will be deleted" ) );
69 
71  m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, KiScaledBitmap( print_button_xpm, this ),
72  _( "Print layers" ) );
73 
75  msg = AddHotkeyName( _( "Redraw view" ), GerbviewHokeysDescr, HK_ZOOM_REDRAW, IS_COMMENT );
76  m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiScaledBitmap( zoom_redraw_xpm, this ), msg );
77 
78  msg = AddHotkeyName( _( "Zoom in" ), GerbviewHokeysDescr, HK_ZOOM_IN, IS_COMMENT );
79  m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiScaledBitmap( zoom_in_xpm, this ), msg );
80 
81  msg = AddHotkeyName( _( "Zoom out" ), GerbviewHokeysDescr, HK_ZOOM_OUT, IS_COMMENT );
82  m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiScaledBitmap( zoom_out_xpm, this ), msg );
83 
84  msg = AddHotkeyName( _( "Zoom to fit" ), GerbviewHokeysDescr, HK_ZOOM_AUTO, IS_COMMENT );
85  m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
86  KiScaledBitmap( zoom_fit_in_page_xpm, this ), msg );
87 
88  m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiScaledBitmap( zoom_area_xpm, this ),
89  _( "Zoom to selection" ), wxITEM_CHECK );
90 
92 
95  wxDefaultPosition, wxDefaultSize, 0, NULL );
97 
98  m_mainToolBar->AddControl( m_SelLayerBox );
99 
100  m_TextInfo = new wxTextCtrl( m_mainToolBar, wxID_ANY, wxEmptyString, wxDefaultPosition,
101  wxDefaultSize, wxTE_READONLY );
102  m_mainToolBar->AddControl( m_TextInfo );
103 
104  // after adding the buttons to the toolbar, must call Realize() to reflect the changes
105  m_mainToolBar->Realize();
106 }
107 
108 
110 {
111  wxWindowUpdateLocker dummy( this );
112  wxStaticText* text;
113 
114  if( !m_auxiliaryToolBar )
115  m_auxiliaryToolBar = new wxAuiToolBar( this, ID_AUX_TOOLBAR, wxDefaultPosition,
116  wxDefaultSize,
117  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
118 
119  // Creates box to display and choose components:
120  if( !m_SelComponentBox )
121  {
122  m_SelComponentBox = new wxChoice( m_auxiliaryToolBar,
124  m_SelComponentBox->SetToolTip( _("Highlight items belonging to this component") );
125  text = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _( "Cmp: ") );
126  m_auxiliaryToolBar->AddControl( text );
127  m_auxiliaryToolBar->AddControl( m_SelComponentBox );
128  m_auxiliaryToolBar->AddSpacer( 5 );
129  }
130 
131  // Creates choice box to display net names and highlight selected:
132  if( !m_SelNetnameBox )
133  {
134  m_SelNetnameBox = new wxChoice( m_auxiliaryToolBar,
136  m_SelNetnameBox->SetToolTip( _("Highlight items belonging to this net") );
137  text = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _( "Net:" ) );
138  m_auxiliaryToolBar->AddControl( text );
139  m_auxiliaryToolBar->AddControl( m_SelNetnameBox );
140  m_auxiliaryToolBar->AddSpacer( 5 );
141  }
142 
143  // Creates choice box to display aperture attributes and highlight selected:
145  {
148  m_SelAperAttributesBox->SetToolTip( _("Highlight items with this aperture attribute") );
149  text = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _( "Attr:" ) );
150  m_auxiliaryToolBar->AddControl( text );
152  m_auxiliaryToolBar->AddSpacer( 5 );
153  }
154 
155  if( !m_DCodeSelector )
156  {
159  wxDefaultPosition, wxSize( 150, -1 ) );
160  text = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _( "DCode:" ) );
161  m_auxiliaryToolBar->AddControl( text );
162  m_auxiliaryToolBar->AddControl( m_DCodeSelector );
163  }
164 
165  if( !m_gridSelectBox )
166  {
169  wxDefaultPosition, wxDefaultSize, 0, nullptr );
170  m_auxiliaryToolBar->AddControl( m_gridSelectBox );
171  }
172 
173  if( !m_zoomSelectBox )
174  {
177  wxDefaultPosition, wxDefaultSize, 0, nullptr );
178  m_auxiliaryToolBar->AddControl( m_zoomSelectBox );
179  }
180 
187 
188  // combobox sizes can have changed: apply new best sizes
189  auto item = m_auxiliaryToolBar->FindTool( ID_GBR_AUX_TOOLBAR_PCB_CMP_CHOICE );
190  item->SetMinSize( m_SelComponentBox->GetBestSize() );
191 
193  item->SetMinSize( m_SelNetnameBox->GetBestSize() );
194 
196  item->SetMinSize( m_SelAperAttributesBox->GetBestSize() );
197 
198  item = m_auxiliaryToolBar->FindTool( ID_ON_GRID_SELECT );
199  item->SetMinSize( m_gridSelectBox->GetBestSize() );
200 
201  item = m_auxiliaryToolBar->FindTool( ID_ON_ZOOM_SELECT );
202  item->SetMinSize( m_zoomSelectBox->GetBestSize() );
203 
204  // after adding the buttons to the toolbar, must call Realize()
205  m_auxiliaryToolBar->Realize();
206 }
207 
208 
210 {
211  if( m_drawToolBar )
212  return;
213 
214  m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
215  KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
216 
217  // Set up toolbar
218  m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString,
219  KiScaledBitmap( cursor_xpm, this ) );
221 
222  m_drawToolBar->Realize();
223 }
224 
225 
227 {
228  if( m_optionsToolBar )
229  m_optionsToolBar->Clear();
230  else
231  m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize,
232  KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
233 
234  // TODO: these can be moved to the 'proper' vertical toolbar if and when there are
235  // actual tools to put there. That, or I'll get around to implementing configurable
236  // toolbars.
237  m_optionsToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString,
238  KiScaledBitmap( cursor_xpm, this ),
239  wxEmptyString, wxITEM_CHECK );
240 
241  if( IsGalCanvasActive() )
242  {
243  m_optionsToolBar->AddTool( ID_TB_MEASUREMENT_TOOL, wxEmptyString,
244  KiScaledBitmap( measurement_xpm, this ),
245  _( "Measure distance between two points" ),
246  wxITEM_CHECK );
247  }
248 
250 
251  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
252  KiScaledBitmap( grid_xpm, this ),
253  _( "Turn grid off" ), wxITEM_CHECK );
254 
255  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
256  KiScaledBitmap( polar_coord_xpm, this ),
257  _( "Turn polar coordinates on" ), wxITEM_CHECK );
258 
259  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
260  KiScaledBitmap( unit_inch_xpm, this ),
261  _( "Set units to inches" ), wxITEM_CHECK );
262 
263  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
264  KiScaledBitmap( unit_mm_xpm, this ),
265  _( "Set units to millimeters" ), wxITEM_CHECK );
266 
267 #ifndef __APPLE__
268  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
269  KiScaledBitmap( cursor_shape_xpm, this ),
270  _( "Change cursor shape" ), wxITEM_CHECK );
271 #else
272  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
273  KiScaledBitmap( cursor_shape_xpm, this ),
274  _( "Change cursor shape (not supported in Legacy Toolset)" ),
275  wxITEM_CHECK );
276 #endif
277 
280  KiScaledBitmap( pad_sketch_xpm, this ),
281  _( "Show flashed items in outline mode" ), wxITEM_CHECK );
282 
283  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_LINES_SKETCH, wxEmptyString,
284  KiScaledBitmap( showtrack_xpm, this ),
285  _( "Show lines in outline mode" ), wxITEM_CHECK );
286 
287  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, wxEmptyString,
288  KiScaledBitmap( opt_show_polygon_xpm, this ),
289  _( "Show polygons in outline mode" ),
290  wxITEM_CHECK );
291 
292  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS, wxEmptyString,
293  KiScaledBitmap( gerbview_show_negative_objects_xpm, this ),
294  _( "Show negatives objects in ghost color" ),
295  wxITEM_CHECK );
296 
297  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_DCODES, wxEmptyString,
298  KiScaledBitmap( show_dcodenumber_xpm, this ),
299  _( "Show dcode number" ), wxITEM_CHECK );
300 
301  // tools to select draw mode in GerbView, unused in GAL
302  if( !IsGalCanvasActive() )
303  {
305  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_0, wxEmptyString,
306  KiScaledBitmap( gbr_select_mode0_xpm, this ),
307  _( "Show layers in raw mode\n"
308  "(could have problems with negative items when more than one gerber file is shown)" ),
309  wxITEM_RADIO );
310  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_1, wxEmptyString,
311  KiScaledBitmap( gbr_select_mode1_xpm, this ),
312  _( "Show layers in stacked mode\n"
313  "(show negative items without artifacts)" ),
314  wxITEM_RADIO );
315  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_2, wxEmptyString,
316  KiScaledBitmap( gbr_select_mode2_xpm, this ),
317  _( "Show layers in transparency mode\n"
318  "(show negative items without artifacts)" ),
319  wxITEM_RADIO );
320  }
321  else
322  {
323  m_optionsToolBar->AddTool( ID_TB_OPTIONS_DIFF_MODE, wxEmptyString,
324  KiScaledBitmap( gbr_select_mode2_xpm, this ),
325  _( "Show layers in diff (compare) mode" ),
326  wxITEM_CHECK );
327 
328  m_optionsToolBar->AddTool( ID_TB_OPTIONS_HIGH_CONTRAST_MODE, wxEmptyString,
329  KiScaledBitmap( contrast_mode_xpm, this ),
330  _( "Enable high contrast display mode" ),
331  wxITEM_CHECK );
332 
333  }
334 
335  // Tools to show/hide toolbars:
338  wxEmptyString,
339  KiScaledBitmap( layers_manager_xpm, this ),
340  _( "Show/hide the layers manager toolbar" ),
341  wxITEM_CHECK );
342 
343 
344  m_optionsToolBar->Realize();
345 }
346 
347 
348 #define NO_SELECTION_STRING _("<No selection>")
349 
351 {
352  m_DCodeSelector->Clear();
353 
354  // Add an empty string to deselect net highlight
356 
357  int layer = GetActiveLayer();
358  GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
359 
360  if( !gerber || gerber->GetDcodesCount() == 0 )
361  {
362  if( m_DCodeSelector->GetSelection() != 0 )
363  m_DCodeSelector->SetSelection( 0 );
364 
365  return;
366  }
367 
368  // Build the aperture list of the current layer, and add it to the combo box:
369  wxArrayString dcode_list;
370  wxString msg;
371  const char* units = GetUserUnits() == INCHES ? "mils" : "mm";
372  double scale = GetUserUnits() == INCHES ? IU_PER_MILS : IU_PER_MM;
373 
374  for( int ii = 0; ii < TOOLS_MAX_COUNT; ii++ )
375  {
376  D_CODE* dcode = gerber->GetDCODE( ii + FIRST_DCODE );
377 
378  if( dcode == NULL )
379  continue;
380 
381  if( !dcode->m_InUse && !dcode->m_Defined )
382  continue;
383 
384  msg.Printf( "tool %d [%.3fx%.3f %s] %s",
385  dcode->m_Num_Dcode,
386  dcode->m_Size.y / scale, dcode->m_Size.x / scale,
387  units,
389  );
390  if( !dcode->m_AperFunction.IsEmpty() )
391  msg << ", " << dcode->m_AperFunction;
392 
393  dcode_list.Add( msg );
394  }
395 
396  m_DCodeSelector->AppendDCodeList( dcode_list );
397 
398  if( dcode_list.size() > 1 )
399  {
400  wxSize size = m_DCodeSelector->GetBestSize();
401  size.x = std::max( size.x, 100 );
402  m_DCodeSelector->SetMinSize( size );
403  m_auimgr.Update();
404  }
405 }
406 
407 
409 {
410  m_SelComponentBox->Clear();
411 
412  // Build the full list of component names from the partial lists stored in each file image
413  std::map<wxString, int> full_list;
414 
415  for( unsigned layer = 0; layer < GetImagesList()->ImagesMaxCount(); ++layer )
416  {
417  GERBER_FILE_IMAGE* gerber = GetImagesList()->GetGbrImage( layer );
418 
419  if( gerber == NULL ) // Graphic layer not yet used
420  continue;
421 
422  full_list.insert( gerber->m_ComponentsList.begin(), gerber->m_ComponentsList.end() );
423  }
424 
425  // Add an empty string to deselect net highlight
427 
428  // Now copy the list to the choice box
429  for( auto ii = full_list.begin(); ii != full_list.end(); ++ii )
430  {
431  m_SelComponentBox->Append( ii->first );
432  }
433 
434  m_SelComponentBox->SetSelection( 0 );
435 }
436 
437 
439 {
440  m_SelNetnameBox->Clear();
441 
442  // Build the full list of netnames from the partial lists stored in each file image
443  std::map<wxString, int> full_list;
444 
445  for( unsigned layer = 0; layer < GetImagesList()->ImagesMaxCount(); ++layer )
446  {
447  GERBER_FILE_IMAGE* gerber = GetImagesList()->GetGbrImage( layer );
448 
449  if( gerber == NULL ) // Graphic layer not yet used
450  continue;
451 
452  full_list.insert( gerber->m_NetnamesList.begin(), gerber->m_NetnamesList.end() );
453  }
454 
455  // Add an empty string to deselect net highlight
457 
458  // Now copy the list to the choice box
459  for( auto ii = full_list.begin(); ii != full_list.end(); ++ii )
460  {
461  m_SelNetnameBox->Append( ii->first );
462  }
463 
464  m_SelNetnameBox->SetSelection( 0 );
465 }
466 
467 
469 {
470  m_SelAperAttributesBox->Clear();
471 
472  // Build the full list of netnames from the partial lists stored in each file image
473  std::map<wxString, int> full_list;
474 
475  for( unsigned layer = 0; layer < GetImagesList()->ImagesMaxCount(); ++layer )
476  {
477  GERBER_FILE_IMAGE* gerber = GetImagesList()->GetGbrImage( layer );
478 
479  if( gerber == NULL ) // Graphic layer not yet used
480  continue;
481 
482  if( gerber->GetDcodesCount() == 0 )
483  continue;
484 
485  for( int ii = 0; ii < TOOLS_MAX_COUNT; ii++ )
486  {
487  D_CODE* aperture = gerber->GetDCODE( ii + FIRST_DCODE );
488 
489  if( aperture == NULL )
490  continue;
491 
492  if( !aperture->m_InUse && !aperture->m_Defined )
493  continue;
494 
495  if( !aperture->m_AperFunction.IsEmpty() )
496  full_list.insert( std::make_pair( aperture->m_AperFunction, 0 ) );
497  }
498  }
499 
500  // Add an empty string to deselect net highlight
502 
503  // Now copy the list to the choice box
504  for( auto ii = full_list.begin(); ii != full_list.end(); ++ii )
505  {
506  m_SelAperAttributesBox->Append( ii->first );
507  }
508 
509  m_SelAperAttributesBox->SetSelection( 0 );
510 }
511 
512 
513 void GERBVIEW_FRAME::OnUpdateDrawMode( wxUpdateUIEvent& aEvent )
514 {
515  switch( aEvent.GetId() )
516  {
518  aEvent.Check( GetDisplayMode() == 0 );
519  break;
520 
522  aEvent.Check( GetDisplayMode() == 1 );
523  break;
524 
526  aEvent.Check( GetDisplayMode() == 2 );
527  break;
528 
529  default:
530  break;
531  }
532 }
533 
534 
535 void GERBVIEW_FRAME::OnToggleCoordType( wxCommandEvent& aEvent )
536 {
538 
539  UpdateStatusBar();
540 }
541 
542 
543 void GERBVIEW_FRAME::OnUpdateCoordType( wxUpdateUIEvent& aEvent )
544 {
545  aEvent.Check( m_DisplayOptions.m_DisplayPolarCood );
546 
547  if( m_optionsToolBar )
550  _( "Turn on rectangular coordinates" ) :
551  _( "Turn on polar coordinates" ) );
552 }
553 
554 
555 void GERBVIEW_FRAME::OnUpdateFlashedItemsDrawMode( wxUpdateUIEvent& aEvent )
556 {
558 
559  if( m_optionsToolBar )
562  _( "Show flashed items in outline mode" ) :
563  _( "Show flashed items in fill mode" ) );
564 }
565 
566 
567 void GERBVIEW_FRAME::OnUpdateLineDrawMode( wxUpdateUIEvent& aEvent )
568 {
569  aEvent.Check( !m_DisplayOptions.m_DisplayLinesFill );
570 
571  if( m_optionsToolBar )
574  _( "Show lines in outline mode" ) :
575  _( "Show lines in fill mode" ) );
576 }
577 
578 
579 void GERBVIEW_FRAME::OnUpdatePolygonDrawMode( wxUpdateUIEvent& aEvent )
580 {
581  aEvent.Check( !m_DisplayOptions.m_DisplayPolygonsFill );
582 
583  if( m_optionsToolBar )
586  _( "Show polygons in outline mode" ) :
587  _( "Show polygons in fill mode" ) );
588 }
589 
590 
591 void GERBVIEW_FRAME::OnUpdateShowDCodes( wxUpdateUIEvent& aEvent )
592 {
593  aEvent.Check( IsElementVisible( LAYER_DCODES ) );
594 
595  if( m_optionsToolBar )
596  m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_DCODES,
598  _( "Hide DCodes" ) : _( "Show DCodes" ) );
599 }
600 
601 
602 void GERBVIEW_FRAME::OnUpdateShowNegativeItems( wxUpdateUIEvent& aEvent )
603 {
604  aEvent.Check( IsElementVisible( LAYER_NEGATIVE_OBJECTS ) );
605 
606  if( m_optionsToolBar )
609  _( "Show negative objects in normal color" ) :
610  _( "Show negative objects in ghost color" ) );
611 }
612 
613 
614 void GERBVIEW_FRAME::OnUpdateDiffMode( wxUpdateUIEvent& aEvent )
615 {
616  aEvent.Check( m_DisplayOptions.m_DiffMode );
617 
618  if( m_optionsToolBar )
619  m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_DIFF_MODE,
621  _( "Show layers in normal mode" ) :
622  _( "Show layers in differential mode" ) );
623 }
624 
625 
626 void GERBVIEW_FRAME::OnUpdateHighContrastMode( wxUpdateUIEvent& aEvent )
627 {
628  aEvent.Check( m_DisplayOptions.m_HighContrastMode );
629 
630  if( m_optionsToolBar )
633  _( "Disable high contrast mode" ) :
634  _( "Enable high contrast mode" ) );
635 }
636 
637 
638 void GERBVIEW_FRAME::OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent )
639 {
640  aEvent.Check( m_show_layer_manager_tools );
641 
642  if( m_optionsToolBar )
643  {
645  m_optionsToolBar->SetToolShortHelp( aEvent.GetId(), _( "Hide layers manager" ) );
646  else
647  m_optionsToolBar->SetToolShortHelp( aEvent.GetId(), _( "Show layers manager" ) );
648  }
649 }
650 
651 
652 void GERBVIEW_FRAME::OnUpdateSelectDCode( wxUpdateUIEvent& aEvent )
653 {
654  if( !m_DCodeSelector )
655  return;
656 
657  int layer = GetActiveLayer();
658  GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
659  int selected = ( gerber ) ? gerber->m_Selected_Tool : 0;
660 
661  aEvent.Enable( gerber != NULL );
662 
663  if( m_DCodeSelector->GetSelectedDCodeId() != selected )
664  {
665  m_DCodeSelector->SetDCodeSelection( selected );
666  // Be sure the selection can be made. If no, set to
667  // a correct value
668  if( gerber )
670  }
671 }
672 
673 
674 void GERBVIEW_FRAME::OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent )
675 {
676  if( m_SelLayerBox->GetSelection() != GetActiveLayer() )
677  {
678  m_SelLayerBox->SetSelection( GetActiveLayer() );
679  }
680 }
void OnUpdateHighContrastMode(wxUpdateUIEvent &aEvent)
void OnUpdateLineDrawMode(wxUpdateUIEvent &aEvent)
bool m_DisplayPolygonsFill
Option to draw polygons (filled/sketch)
D_CODE * GetDCODE(int aDCODE) const
Function GetDCODE returns a pointer to the D_CODE within this GERBER for the given aDCODE...
void OnUpdateSelectDCode(wxUpdateUIEvent &aEvent)
void UpdateStatusBar() override
Update the status bar information.
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:94
int GetDisplayMode()
Function GetDisplayMode.
bool m_InUse
false if the aperure (previously defined) is not used to draw something
Definition: dcode.h:102
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:95
void OnUpdateFlashedItemsDrawMode(wxUpdateUIEvent &aEvent)
Definition: id.h:241
Class GERBER_FILE_IMAGE holds the Image data and parameters for one gerber file and layer parameters ...
GBR_LAYER_BOX_SELECTOR * m_SelLayerBox
void SetDCodeSelection(int aDCodeId)
Function SetDCodeSelection.
void OnUpdateLayerSelectBox(wxUpdateUIEvent &aEvent)
bool m_HighContrastMode
High contrast mode (dim un-highlighted objects)
void updateNetnameListSelectBox()
wxAuiManager m_auimgr
wxBitmap KiScaledBitmap(BITMAP_DEF aBitmap, EDA_BASE_FRAME *aWindow)
Construct a wxBitmap from a memory record, scaling it if device DPI demands it.
Definition: bitmap.cpp:116
int GetActiveLayer()
Function SetActiveLayer returns the active layer.
wxChoice * m_gridSelectBox
Definition: draw_frame.h:148
wxChoice * m_SelNetnameBox
bool m_DisplayLinesFill
Option to draw line items (filled/sketch)
void ReCreateHToolbar() override
void updateComponentListSelectBox()
void OnUpdatePolygonDrawMode(wxUpdateUIEvent &aEvent)
bool m_Defined
false if the aperture is not defined in the header
Definition: dcode.h:104
bool m_DiffMode
Display layers in diff mode.
GERBVIEW_FRAME::OnZipFileHistory GERBVIEW_FRAME::OnSelectActiveLayer GERBVIEW_FRAME::OnToggleShowLayerManager GERBVIEW_FRAME::OnSelectHighlightChoice GERBVIEW_FRAME::OnUpdateShowLayerManager ID_TB_OPTIONS_SHOW_GBR_MODE_2
wxAuiToolBar * m_auxiliaryToolBar
Auxiliary tool bar typically shown below the main tool bar at the top of the main window...
Definition: draw_frame.h:153
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:160
EDA_DRAW_FRAME::OnSelectGrid ID_TB_OPTIONS_SELECT_UNIT_INCH
void OnToggleCoordType(wxCommandEvent &aEvent)
void ReCreateAuxiliaryToolbar() override
void ReCreateVToolbar() override
Function ReCreateVToolbar creates or updates the right vertical toolbar.
GERBER_FILE_IMAGE * GetGbrImage(int aIdx)
#define FIRST_DCODE
Definition: dcode.h:71
EDA_UNITS_T GetUserUnits() const override
Return the user units currently in use.
Definition: draw_frame.h:284
Definition: common.h:160
wxChoice * m_zoomSelectBox
Definition: draw_frame.h:149
int m_Num_Dcode
D code value ( >= 10 )
Definition: dcode.h:96
GBR_DISPLAY_OPTIONS m_DisplayOptions
bool m_DisplayFlashedItemsFill
Option to draw flashed items (filled/sketch)
int GetSelectedDCodeId()
Function GetSelectedDCodeId.
void OnUpdateDiffMode(wxUpdateUIEvent &aEvent)
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
Helper dialog and control classes.
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:921
bool m_DisplayPolarCood
Option to display coordinates in status bar in X,Y or Polar coords.
GERBER_FILE_IMAGE_LIST * GetImagesList() const
Accessors to GERBER_FILE_IMAGE_LIST and GERBER_FILE_IMAGE data.
void OnUpdateShowNegativeItems(wxUpdateUIEvent &aEvent)
void AppendDCodeList(const wxArrayString &aChoices)
Function AppendDCodeList.
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:157
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
std::map< wxString, int > m_NetnamesList
void ReCreateOptToolbar()
Create or update the left vertical toolbar (option toolbar.
wxString m_AperFunction
the aperture attribute (created by a TA.AperFunction command) attached to the D_CODE ...
Definition: dcode.h:105
void OnUpdateShowDCodes(wxUpdateUIEvent &aEvent)
wxTextCtrl * m_TextInfo
DCODE_SELECTION_BOX * m_DCodeSelector
void updateAperAttributesSelectBox()
wxChoice * m_SelAperAttributesBox
const int scale
wxString AddHotkeyName(const wxString &aText, EDA_HOTKEY **aList, int aCommandId, HOTKEY_ACTION_TYPE aShortCutType)
Function AddHotkeyName Add the key name from the Command id value ( m_Idcommand member value) ...
Class D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
#define max(a, b)
Definition: auxiliary.h:86
void OnUpdateDrawMode(wxUpdateUIEvent &aEvent)
#define TOOLS_MAX_COUNT
Definition: dcode.h:73
struct EDA_HOTKEY_CONFIG GerbviewHokeysDescr[]
void OnUpdateCoordType(wxUpdateUIEvent &aEvent)
#define IU_PER_MILS
Definition: plotter.cpp:134
The common library.
void KiScaledSeparator(wxAuiToolBar *aToolbar, EDA_BASE_FRAME *aWindow)
Add a separator to the given toolbar scaled the same way as KiScaledBitmap.
Definition: bitmap.cpp:167
static constexpr int KICAD_AUI_TB_STYLE
Default style flags used for wxAUI toolbars
#define NO_SELECTION_STRING
wxChoice * m_SelComponentBox
GERBER_FILE_IMAGE * GetGbrImage(int aIdx) const
bool m_show_layer_manager_tools
std::map< wxString, int > m_ComponentsList
void OnUpdateShowLayerManager(wxUpdateUIEvent &aEvent)
bool IsElementVisible(int aLayerID) const
Function IsElementVisible tests whether a given element category is visible.