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 wxComboBox( m_auxiliaryToolBar,
123  ID_GBR_AUX_TOOLBAR_PCB_CMP_CHOICE, wxEmptyString,
124  wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY );
125  m_SelComponentBox->SetToolTip( _("Highlight items belonging to this component") );
126  text = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _( "Cmp: ") );
127  m_auxiliaryToolBar->AddControl( text );
128  m_auxiliaryToolBar->AddControl( m_SelComponentBox );
129  m_auxiliaryToolBar->AddSpacer( 5 );
130  }
131 
132  // Creates choice box to display net names and highlight selected:
133  if( !m_SelNetnameBox )
134  {
135  m_SelNetnameBox = new wxComboBox( m_auxiliaryToolBar,
136  ID_GBR_AUX_TOOLBAR_PCB_NET_CHOICE, wxEmptyString,
137  wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY );
138  m_SelNetnameBox->SetToolTip( _("Highlight items belonging to this net") );
139  text = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _( "Net:" ) );
140  m_auxiliaryToolBar->AddControl( text );
141  m_auxiliaryToolBar->AddControl( m_SelNetnameBox );
142  m_auxiliaryToolBar->AddSpacer( 5 );
143  }
144 
145  // Creates choice box to display aperture attributes and highlight selected:
147  {
148  m_SelAperAttributesBox = new wxComboBox( m_auxiliaryToolBar,
150  wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY );
151  m_SelAperAttributesBox->SetToolTip( _("Highlight items with this aperture attribute") );
152  text = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _( "Attr:" ) );
153  m_auxiliaryToolBar->AddControl( text );
155  m_auxiliaryToolBar->AddSpacer( 5 );
156  }
157 
158  if( !m_DCodeSelector )
159  {
162  wxDefaultPosition, wxSize( 150, -1 ) );
163  text = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _( "DCode:" ) );
164  m_auxiliaryToolBar->AddControl( text );
165  m_auxiliaryToolBar->AddControl( m_DCodeSelector );
166  }
167 
168  if( !m_gridSelectBox )
169  {
171  m_gridSelectBox = new wxComboBox( m_auxiliaryToolBar, ID_ON_GRID_SELECT, wxEmptyString,
172  wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY );
173  m_auxiliaryToolBar->AddControl( m_gridSelectBox );
174  }
175 
176  if( !m_zoomSelectBox )
177  {
179  m_zoomSelectBox = new wxComboBox( m_auxiliaryToolBar, ID_ON_ZOOM_SELECT, wxEmptyString,
180  wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY );
181  m_auxiliaryToolBar->AddControl( m_zoomSelectBox );
182  }
183 
190 
191  // combobox sizes can have changed: apply new best sizes
192  auto item = m_auxiliaryToolBar->FindTool( ID_GBR_AUX_TOOLBAR_PCB_CMP_CHOICE );
193  item->SetMinSize( m_SelComponentBox->GetBestSize() );
194 
196  item->SetMinSize( m_SelNetnameBox->GetBestSize() );
197 
199  item->SetMinSize( m_SelAperAttributesBox->GetBestSize() );
200 
201  item = m_auxiliaryToolBar->FindTool( ID_ON_GRID_SELECT );
202  item->SetMinSize( m_gridSelectBox->GetBestSize() );
203 
204  item = m_auxiliaryToolBar->FindTool( ID_ON_ZOOM_SELECT );
205  item->SetMinSize( m_zoomSelectBox->GetBestSize() );
206 
207  // after adding the buttons to the toolbar, must call Realize()
208  m_auxiliaryToolBar->Realize();
209 }
210 
211 
213 {
214  if( m_drawToolBar )
215  return;
216 
217  m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
218  KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
219 
220  // Set up toolbar
221  m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, _( "Select item" ),
222  KiScaledBitmap( cursor_xpm, this ) );
224 
225  m_drawToolBar->Realize();
226 }
227 
228 
230 {
231  if( m_optionsToolBar )
232  m_optionsToolBar->Clear();
233  else
234  m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize,
235  KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
236 
237  // TODO: these can be moved to the 'proper' vertical toolbar if and when there are
238  // actual tools to put there. That, or I'll get around to implementing configurable
239  // toolbars.
240  m_optionsToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString,
241  KiScaledBitmap( cursor_xpm, this ),
242  wxEmptyString, wxITEM_CHECK );
243 
244  if( IsGalCanvasActive() )
245  {
246  m_optionsToolBar->AddTool( ID_TB_MEASUREMENT_TOOL, wxEmptyString,
247  KiScaledBitmap( measurement_xpm, this ),
248  _( "Measure distance between two points" ),
249  wxITEM_CHECK );
250  }
251 
253 
254  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
255  KiScaledBitmap( grid_xpm, this ),
256  _( "Turn grid off" ), wxITEM_CHECK );
257 
258  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
259  KiScaledBitmap( polar_coord_xpm, this ),
260  _( "Turn polar coordinates on" ), wxITEM_CHECK );
261 
262  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
263  KiScaledBitmap( unit_inch_xpm, this ),
264  _( "Set units to inches" ), wxITEM_CHECK );
265 
266  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
267  KiScaledBitmap( unit_mm_xpm, this ),
268  _( "Set units to millimeters" ), wxITEM_CHECK );
269 
270 #ifndef __APPLE__
271  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
272  KiScaledBitmap( cursor_shape_xpm, this ),
273  _( "Change cursor shape" ), wxITEM_CHECK );
274 #else
275  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
276  KiScaledBitmap( cursor_shape_xpm, this ),
277  _( "Change cursor shape (not supported in Legacy Toolset)" ),
278  wxITEM_CHECK );
279 #endif
280 
283  KiScaledBitmap( pad_sketch_xpm, this ),
284  _( "Show flashed items in outline mode" ), wxITEM_CHECK );
285 
286  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_LINES_SKETCH, wxEmptyString,
287  KiScaledBitmap( showtrack_xpm, this ),
288  _( "Show lines in outline mode" ), wxITEM_CHECK );
289 
290  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, wxEmptyString,
291  KiScaledBitmap( opt_show_polygon_xpm, this ),
292  _( "Show polygons in outline mode" ),
293  wxITEM_CHECK );
294 
295  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS, wxEmptyString,
296  KiScaledBitmap( gerbview_show_negative_objects_xpm, this ),
297  _( "Show negatives objects in ghost color" ),
298  wxITEM_CHECK );
299 
300  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_DCODES, wxEmptyString,
301  KiScaledBitmap( show_dcodenumber_xpm, this ),
302  _( "Show dcode number" ), wxITEM_CHECK );
303 
304  // tools to select draw mode in GerbView, unused in GAL
305  if( !IsGalCanvasActive() )
306  {
308  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_0, wxEmptyString,
309  KiScaledBitmap( gbr_select_mode0_xpm, this ),
310  _( "Show layers in raw mode\n"
311  "(could have problems with negative items when more than one gerber file is shown)" ),
312  wxITEM_RADIO );
313  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_1, wxEmptyString,
314  KiScaledBitmap( gbr_select_mode1_xpm, this ),
315  _( "Show layers in stacked mode\n"
316  "(show negative items without artifacts)" ),
317  wxITEM_RADIO );
318  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_2, wxEmptyString,
319  KiScaledBitmap( gbr_select_mode2_xpm, this ),
320  _( "Show layers in transparency mode\n"
321  "(show negative items without artifacts)" ),
322  wxITEM_RADIO );
323  }
324  else
325  {
326  m_optionsToolBar->AddTool( ID_TB_OPTIONS_DIFF_MODE, wxEmptyString,
327  KiScaledBitmap( gbr_select_mode2_xpm, this ),
328  _( "Show layers in diff (compare) mode" ),
329  wxITEM_CHECK );
330 
331  m_optionsToolBar->AddTool( ID_TB_OPTIONS_HIGH_CONTRAST_MODE, wxEmptyString,
332  KiScaledBitmap( contrast_mode_xpm, this ),
333  _( "Enable high contrast display mode" ),
334  wxITEM_CHECK );
335 
336  }
337 
338  // Tools to show/hide toolbars:
341  wxEmptyString,
342  KiScaledBitmap( layers_manager_xpm, this ),
343  _( "Show/hide the layers manager toolbar" ),
344  wxITEM_CHECK );
345 
346 
347  m_optionsToolBar->Realize();
348 }
349 
350 
351 #define NO_SELECTION_STRING _("<No selection>")
352 
354 {
355  m_DCodeSelector->Clear();
356 
357  // Add an empty string to deselect net highlight
359 
360  int layer = GetActiveLayer();
361  GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
362 
363  if( !gerber || gerber->GetDcodesCount() == 0 )
364  {
365  if( m_DCodeSelector->GetSelection() != 0 )
366  m_DCodeSelector->SetSelection( 0 );
367 
368  return;
369  }
370 
371  // Build the aperture list of the current layer, and add it to the combo box:
372  wxArrayString dcode_list;
373  wxString msg;
374  const char* units = GetUserUnits() == INCHES ? "mils" : "mm";
375  double scale = GetUserUnits() == INCHES ? IU_PER_MILS : IU_PER_MM;
376 
377  for( int ii = 0; ii < TOOLS_MAX_COUNT; ii++ )
378  {
379  D_CODE* dcode = gerber->GetDCODE( ii + FIRST_DCODE );
380 
381  if( dcode == NULL )
382  continue;
383 
384  if( !dcode->m_InUse && !dcode->m_Defined )
385  continue;
386 
387  msg.Printf( "tool %d [%.3fx%.3f %s] %s",
388  dcode->m_Num_Dcode,
389  dcode->m_Size.y / scale, dcode->m_Size.x / scale,
390  units,
392  );
393  if( !dcode->m_AperFunction.IsEmpty() )
394  msg << ", " << dcode->m_AperFunction;
395 
396  dcode_list.Add( msg );
397  }
398 
399  m_DCodeSelector->AppendDCodeList( dcode_list );
400 
401  if( dcode_list.size() > 1 )
402  {
403  wxSize size = m_DCodeSelector->GetBestSize();
404  size.x = std::max( size.x, 100 );
405  m_DCodeSelector->SetMinSize( size );
406  m_auimgr.Update();
407  }
408 }
409 
410 
412 {
413  m_SelComponentBox->Clear();
414 
415  // Build the full list of component names from the partial lists stored in each file image
416  std::map<wxString, int> full_list;
417 
418  for( unsigned layer = 0; layer < GetImagesList()->ImagesMaxCount(); ++layer )
419  {
420  GERBER_FILE_IMAGE* gerber = GetImagesList()->GetGbrImage( layer );
421 
422  if( gerber == NULL ) // Graphic layer not yet used
423  continue;
424 
425  full_list.insert( gerber->m_ComponentsList.begin(), gerber->m_ComponentsList.end() );
426  }
427 
428  // Add an empty string to deselect net highlight
430 
431  // Now copy the list to the choice box
432  for( auto ii = full_list.begin(); ii != full_list.end(); ++ii )
433  {
434  m_SelComponentBox->Append( ii->first );
435  }
436 
437  m_SelComponentBox->SetSelection( 0 );
438 }
439 
440 
442 {
443  m_SelNetnameBox->Clear();
444 
445  // Build the full list of netnames from the partial lists stored in each file image
446  std::map<wxString, int> full_list;
447 
448  for( unsigned layer = 0; layer < GetImagesList()->ImagesMaxCount(); ++layer )
449  {
450  GERBER_FILE_IMAGE* gerber = GetImagesList()->GetGbrImage( layer );
451 
452  if( gerber == NULL ) // Graphic layer not yet used
453  continue;
454 
455  full_list.insert( gerber->m_NetnamesList.begin(), gerber->m_NetnamesList.end() );
456  }
457 
458  // Add an empty string to deselect net highlight
460 
461  // Now copy the list to the choice box
462  for( auto ii = full_list.begin(); ii != full_list.end(); ++ii )
463  {
464  m_SelNetnameBox->Append( ii->first );
465  }
466 
467  m_SelNetnameBox->SetSelection( 0 );
468 }
469 
470 
472 {
473  m_SelAperAttributesBox->Clear();
474 
475  // Build the full list of netnames from the partial lists stored in each file image
476  std::map<wxString, int> full_list;
477 
478  for( unsigned layer = 0; layer < GetImagesList()->ImagesMaxCount(); ++layer )
479  {
480  GERBER_FILE_IMAGE* gerber = GetImagesList()->GetGbrImage( layer );
481 
482  if( gerber == NULL ) // Graphic layer not yet used
483  continue;
484 
485  if( gerber->GetDcodesCount() == 0 )
486  continue;
487 
488  for( int ii = 0; ii < TOOLS_MAX_COUNT; ii++ )
489  {
490  D_CODE* aperture = gerber->GetDCODE( ii + FIRST_DCODE );
491 
492  if( aperture == NULL )
493  continue;
494 
495  if( !aperture->m_InUse && !aperture->m_Defined )
496  continue;
497 
498  if( !aperture->m_AperFunction.IsEmpty() )
499  full_list.insert( std::make_pair( aperture->m_AperFunction, 0 ) );
500  }
501  }
502 
503  // Add an empty string to deselect net highlight
505 
506  // Now copy the list to the choice box
507  for( auto ii = full_list.begin(); ii != full_list.end(); ++ii )
508  {
509  m_SelAperAttributesBox->Append( ii->first );
510  }
511 
512  m_SelAperAttributesBox->SetSelection( 0 );
513 }
514 
515 
516 void GERBVIEW_FRAME::OnUpdateDrawMode( wxUpdateUIEvent& aEvent )
517 {
518  switch( aEvent.GetId() )
519  {
521  aEvent.Check( GetDisplayMode() == 0 );
522  break;
523 
525  aEvent.Check( GetDisplayMode() == 1 );
526  break;
527 
529  aEvent.Check( GetDisplayMode() == 2 );
530  break;
531 
532  default:
533  break;
534  }
535 }
536 
537 
538 void GERBVIEW_FRAME::OnToggleCoordType( wxCommandEvent& aEvent )
539 {
541 
542  UpdateStatusBar();
543 }
544 
545 
546 void GERBVIEW_FRAME::OnUpdateCoordType( wxUpdateUIEvent& aEvent )
547 {
548  aEvent.Check( m_DisplayOptions.m_DisplayPolarCood );
549 
550  if( m_optionsToolBar )
553  _( "Turn on rectangular coordinates" ) :
554  _( "Turn on polar coordinates" ) );
555 }
556 
557 
558 void GERBVIEW_FRAME::OnUpdateFlashedItemsDrawMode( wxUpdateUIEvent& aEvent )
559 {
561 
562  if( m_optionsToolBar )
565  _( "Show flashed items in outline mode" ) :
566  _( "Show flashed items in fill mode" ) );
567 }
568 
569 
570 void GERBVIEW_FRAME::OnUpdateLineDrawMode( wxUpdateUIEvent& aEvent )
571 {
572  aEvent.Check( !m_DisplayOptions.m_DisplayLinesFill );
573 
574  if( m_optionsToolBar )
577  _( "Show lines in outline mode" ) :
578  _( "Show lines in fill mode" ) );
579 }
580 
581 
582 void GERBVIEW_FRAME::OnUpdatePolygonDrawMode( wxUpdateUIEvent& aEvent )
583 {
584  aEvent.Check( !m_DisplayOptions.m_DisplayPolygonsFill );
585 
586  if( m_optionsToolBar )
589  _( "Show polygons in outline mode" ) :
590  _( "Show polygons in fill mode" ) );
591 }
592 
593 
594 void GERBVIEW_FRAME::OnUpdateShowDCodes( wxUpdateUIEvent& aEvent )
595 {
596  aEvent.Check( IsElementVisible( LAYER_DCODES ) );
597 
598  if( m_optionsToolBar )
599  m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_DCODES,
601  _( "Hide DCodes" ) : _( "Show DCodes" ) );
602 }
603 
604 
605 void GERBVIEW_FRAME::OnUpdateShowNegativeItems( wxUpdateUIEvent& aEvent )
606 {
607  aEvent.Check( IsElementVisible( LAYER_NEGATIVE_OBJECTS ) );
608 
609  if( m_optionsToolBar )
612  _( "Show negative objects in normal color" ) :
613  _( "Show negative objects in ghost color" ) );
614 }
615 
616 
617 void GERBVIEW_FRAME::OnUpdateDiffMode( wxUpdateUIEvent& aEvent )
618 {
619  aEvent.Check( m_DisplayOptions.m_DiffMode );
620 
621  if( m_optionsToolBar )
622  m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_DIFF_MODE,
624  _( "Show layers in normal mode" ) :
625  _( "Show layers in differential mode" ) );
626 }
627 
628 
629 void GERBVIEW_FRAME::OnUpdateHighContrastMode( wxUpdateUIEvent& aEvent )
630 {
631  aEvent.Check( m_DisplayOptions.m_HighContrastMode );
632 
633  if( m_optionsToolBar )
636  _( "Disable high contrast mode" ) :
637  _( "Enable high contrast mode" ) );
638 }
639 
640 
641 void GERBVIEW_FRAME::OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent )
642 {
643  aEvent.Check( m_show_layer_manager_tools );
644 
645  if( m_optionsToolBar )
646  {
648  m_optionsToolBar->SetToolShortHelp( aEvent.GetId(), _( "Hide layers manager" ) );
649  else
650  m_optionsToolBar->SetToolShortHelp( aEvent.GetId(), _( "Show layers manager" ) );
651  }
652 }
653 
654 
655 void GERBVIEW_FRAME::OnUpdateSelectDCode( wxUpdateUIEvent& aEvent )
656 {
657  if( !m_DCodeSelector )
658  return;
659 
660  int layer = GetActiveLayer();
661  GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
662  int selected = ( gerber ) ? gerber->m_Selected_Tool : 0;
663 
664  aEvent.Enable( gerber != NULL );
665 
666  if( m_DCodeSelector->GetSelectedDCodeId() != selected )
667  {
668  m_DCodeSelector->SetDCodeSelection( selected );
669  // Be sure the selection can be made. If no, set to
670  // a correct value
671  if( gerber )
673  }
674 }
675 
676 
677 void GERBVIEW_FRAME::OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent )
678 {
679  if( m_SelLayerBox->GetSelection() != GetActiveLayer() )
680  {
681  m_SelLayerBox->SetSelection( GetActiveLayer() );
682  }
683 }
void OnUpdateHighContrastMode(wxUpdateUIEvent &aEvent)
void OnUpdateLineDrawMode(wxUpdateUIEvent &aEvent)
bool m_DisplayPolygonsFill
Option to draw polygons (filled/sketch)
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
D_CODE * GetDCODE(int aDCODE) const
Function GetDCODE returns a pointer to the D_CODE within this GERBER for the given aDCODE...
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.
wxComboBox * m_zoomSelectBox
Definition: draw_frame.h:152
wxComboBox * m_SelNetnameBox
bool m_DisplayLinesFill
Option to draw line items (filled/sketch)
void ReCreateHToolbar() override
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:927
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:156
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:163
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
wxComboBox * m_gridSelectBox
Definition: draw_frame.h:151
GERBER_FILE_IMAGE * GetGbrImage(int aIdx) const
EDA_UNITS_T GetUserUnits() const override
Return the user units currently in use.
Definition: draw_frame.h:290
Definition: common.h:161
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.
wxComboBox * m_SelComponentBox
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 IsElementVisible(int aLayerID) const
Function IsElementVisible tests whether a given element category is visible.
bool m_DisplayPolarCood
Option to display coordinates in status bar in X,Y or Polar coords.
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:160
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()
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
bool m_show_layer_manager_tools
GERBER_FILE_IMAGE_LIST * GetImagesList() const
Accessors to GERBER_FILE_IMAGE_LIST and GERBER_FILE_IMAGE data.
wxComboBox * m_SelAperAttributesBox
std::map< wxString, int > m_ComponentsList
void OnUpdateShowLayerManager(wxUpdateUIEvent &aEvent)