KiCad PCB EDA Suite
class_pcb_layer_widget.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) 2004-2017 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr
5  * Copyright (C) 2010-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
6  * Copyright (C) 2010-2017 KiCad Developers, see change_log.txt for contributors.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 
27 /******************************************************/
28 /* class_pcb_layer_widget.cpp - Pcbnew layers manager */
29 /******************************************************/
30 
31 #include <fctsys.h>
32 #include <pgm_base.h>
33 #include <class_drawpanel.h>
34 #include <class_draw_panel_gal.h>
35 #include <view/view.h>
36 #include <painter.h>
37 
38 #include <confirm.h>
39 #include <wxPcbStruct.h>
40 #include <pcb_display_options.h>
41 #include <layer_widget.h>
42 #include <macros.h>
43 #include <menus_helpers.h>
44 
45 #include <class_board.h>
46 #include <class_pcb_layer_widget.h>
47 
48 #include <pcbnew.h>
49 #include <collectors.h>
50 #include <pcbnew_id.h>
51 
53 
54 
57 
58 #define RR LAYER_WIDGET::ROW // Render Row abbreviation to reduce source width
59 #define NOCOLOR COLOR4D::UNSPECIFIED // specify rows that do not have a color selector icon
60 
61  // text id color tooltip
62  RR( _( "Through Via" ), LAYER_VIA_THROUGH, WHITE, _( "Show through vias" ) ),
63  RR( _( "Bl/Buried Via" ), LAYER_VIA_BBLIND, WHITE, _( "Show blind or buried vias" ) ),
64  RR( _( "Micro Via" ), LAYER_VIA_MICROVIA, WHITE, _( "Show micro vias") ),
65  RR( _( "Non Plated Holes" ),LAYER_NON_PLATED, WHITE, _( "Show non plated holes in specific color") ),
66  RR( _( "Ratsnest" ), LAYER_RATSNEST, WHITE, _( "Show unconnected nets as a ratsnest") ),
67 
68  RR( _( "No-Connects" ), LAYER_NO_CONNECTS, BLUE, _( "Show a marker on pads which have no net connected" ) ),
69  RR( _( "Pads Front" ), LAYER_PAD_FR, WHITE, _( "Show footprint pads on board's front" ) ),
70  RR( _( "Pads Back" ), LAYER_PAD_BK, WHITE, _( "Show footprint pads on board's back" ) ),
71 
72  RR( _( "Text Front" ), LAYER_MOD_TEXT_FR, NOCOLOR, _( "Show footprint text on board's front" ) ),
73  RR( _( "Text Back" ), LAYER_MOD_TEXT_BK, NOCOLOR, _( "Show footprint text on board's back" ) ),
74  RR( _( "Hidden Text" ), LAYER_MOD_TEXT_INVISIBLE, WHITE, _( "Show footprint text marked as invisible" ) ),
75 
76  RR( _( "Anchors" ), LAYER_ANCHOR, WHITE, _( "Show footprint and text origins as a cross" ) ),
77  RR( _( "Grid" ), LAYER_GRID, WHITE, _( "Show the (x,y) grid dots" ) ),
78  RR( _( "Footprints Front" ),LAYER_MOD_FR, NOCOLOR, _( "Show footprints that are on board's front") ),
79  RR( _( "Footprints Back" ), LAYER_MOD_BK, NOCOLOR, _( "Show footprints that are on board's back") ),
80  RR( _( "Values" ), LAYER_MOD_VALUES, NOCOLOR, _( "Show footprint's values") ),
81  RR( _( "References" ), LAYER_MOD_REFERENCES, NOCOLOR, _( "Show footprint's references") ),
82  RR( _( "Worksheet" ), LAYER_WORKSHEET, DARKRED, _( "Show worksheet") ),
83  RR( _( "Cursor" ), LAYER_CURSOR, WHITE, _( "PCB Cursor" ), true, false ),
84  RR( _( "Aux items" ), LAYER_AUX_ITEMS, WHITE, _( "Auxillary items (rulers, assistants, axes, etc.)" ), true, false ),
85  RR( _( "Background" ), LAYER_PCB_BACKGROUND, BLACK, _( "PCB Background" ), true, false )
86 };
87 
88 static int s_allowed_in_FpEditor[] =
89 {
92 };
93 
94 
95 PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwner,
96  int aPointSize, bool aFpEditorMode ) :
97  LAYER_WIDGET( aParent, aFocusOwner, aPointSize ),
98  myframe( aParent )
99 {
101  m_fp_editor_mode = aFpEditorMode;
102  ReFillRender();
103 
104  // Update default tabs labels
106 
107  //-----<Popup menu>-------------------------------------------------
108  // handle the popup menu over the layer window.
109  m_LayerScrolledWindow->Connect( wxEVT_RIGHT_DOWN,
110  wxMouseEventHandler( PCB_LAYER_WIDGET::onRightDownLayers ), NULL, this );
111 
112  // since Popupmenu() calls this->ProcessEvent() we must call this->Connect()
113  // and not m_LayerScrolledWindow->Connect()
114 
116  wxEVT_COMMAND_MENU_SELECTED,
117  wxCommandEventHandler( PCB_LAYER_WIDGET::onPopupSelection ), NULL, this );
118 }
119 
120 
122 {
123  return myframe->IsGalCanvasActive();
124 }
125 
126 
128 {
129  for( unsigned ii = 0; ii < DIM( s_allowed_in_FpEditor ); ii++ )
130  if( s_allowed_in_FpEditor[ii] == aId )
131  return true;
132 
133  return false;
134 }
135 
136 
138 {
139  static LSET allowed = LSET::AllTechMask();
140  // Currently not in use because putting a graphic item on a copper layer
141  // is not currently supported by DRC.
142  // allowed.set( F_Cu ).set( B_Cu );
143  return allowed.test( aLayer );
144 }
145 
146 
148 {
149  // menu text is capitalized:
150  // http://library.gnome.org/devel/hig-book/2.20/design-text-labels.html.en#layout-capitalization
152  _( "Show All Copper Layers" ),
153  KiBitmap( select_layer_pair_xpm ) );
155  _( "Hide All Copper Layers But Active" ),
156  KiBitmap( select_w_layer_xpm ) );
158  _( "Always Hide All Copper Layers But Active" ),
159  KiBitmap( select_w_layer_xpm ) );
161  _( "Hide All Copper Layers" ),
162  KiBitmap( show_no_copper_layers_xpm ) );
163 
164  menu.AppendSeparator();
165 
167  _( "Show All Non Copper Layers" ),
168  KiBitmap( select_w_layer_xpm ) );
170  _( "Hide All Non Copper Layers" ),
171  KiBitmap( show_no_copper_layers_xpm ) );
172 
173  menu.AppendSeparator();
174 
175  AddMenuItem( &menu, ID_SHOW_NO_LAYERS, _( "Hide All Layers" ),
176  KiBitmap( show_no_layers_xpm ) );
177  AddMenuItem( &menu, ID_SHOW_ALL_LAYERS, _( "Show All Layers" ),
178  KiBitmap( show_all_layers_xpm ) );
179 
180  menu.AppendSeparator();
181 
182  AddMenuItem( &menu, ID_SHOW_ALL_FRONT, _( "Show All Front Layers" ),
183  KiBitmap( show_no_layers_xpm ) );
184 
185  AddMenuItem( &menu, ID_SHOW_ALL_BACK, _( "Show All Back Layers" ),
186  KiBitmap( show_all_layers_xpm ) );
187 }
188 
189 
190 void PCB_LAYER_WIDGET::onRightDownLayers( wxMouseEvent& event )
191 {
192  wxMenu menu;
193 
194  AddRightClickMenuItems( menu );
195  PopupMenu( &menu );
196 
197  passOnFocus();
198 }
199 
200 
201 void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
202 {
203  int rowCount;
204  int menuId = event.GetId();
205  bool visible;
206  bool force_active_layer_visible;
207 
209  force_active_layer_visible = ( menuId == ID_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE ||
211 
212  switch( menuId )
213  {
214  case ID_SHOW_NO_LAYERS:
215  case ID_SHOW_ALL_LAYERS:
216  {
217  visible = ( menuId == ID_SHOW_ALL_LAYERS );
218  rowCount = GetLayerRowCount();
219 
220  for( int row=0; row<rowCount; ++row )
221  {
222  bool isLast;
223  wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
224  PCB_LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
225  cb->SetValue( visible );
226 
227  isLast = row == rowCount-1;
228 
229  OnLayerVisible( layer, visible, isLast );
230 
231  if( isLast )
232  break;
233  }
234  break;
235  }
236 
243  {
244 
245  // Search the last copper layer row index:
246  int lastCu = -1;
247  rowCount = GetLayerRowCount();
248  for( int row = rowCount-1; row>=0; --row )
249  {
250  wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
251  PCB_LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
252 
253  if( IsCopperLayer( layer ) )
254  {
255  lastCu = row;
256  break;
257  }
258  }
259 
260  // Enable/disable the copper layers visibility:
261  int startrow = 0;
262 
263  if( ( menuId == ID_SHOW_ALL_NON_COPPER ) ||
264  ( menuId == ID_HIDE_ALL_NON_COPPER ) )
265  {
266  startrow = lastCu + 1;
267  }
268 
269  for( int row = startrow; row<rowCount; ++row )
270  {
271  wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
272  PCB_LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
273 
274  visible = ( ( menuId == ID_SHOW_ALL_COPPER_LAYERS ) || ( menuId == ID_SHOW_ALL_NON_COPPER ) );
275 
276  if( force_active_layer_visible && (layer == myframe->GetActiveLayer() ) )
277  visible = true;
278 
279  cb->SetValue( visible );
280 
281  bool isLastLayer = (row == lastCu);
282 
283  if( ( menuId == ID_SHOW_ALL_NON_COPPER ) ||
284  ( menuId == ID_HIDE_ALL_NON_COPPER ) )
285  {
286  isLastLayer = false;
287  }
288  OnLayerVisible( layer, visible, isLastLayer );
289 
290  if( isLastLayer )
291  break;
292  }
293  break;
294  }
295 
296  case ID_SHOW_ALL_FRONT:
297  {
298  visible = false;
299  rowCount = GetLayerRowCount();
300 
301  for( int row=0; row<rowCount; ++row )
302  {
303  bool isLast;
304  wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
305  PCB_LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
306  isLast = ( row == rowCount-1 );
307 
308  if( layer == F_Paste || layer == F_SilkS ||
309  layer == F_Mask || layer == F_Cu ||
310  layer == F_Fab || layer == F_CrtYd || layer == Edge_Cuts )
311  {
312  visible = true;
313  }
314  else
315  {
316  visible = false;
317  }
318 
319  cb->SetValue( visible );
320  OnLayerVisible( layer, visible, isLast );
321 
322  if( isLast )
323  break;
324  }
325  break;
326  }
327  case ID_SHOW_ALL_BACK:
328  {
329  visible = false;
330  rowCount = GetLayerRowCount();
331 
332  for( int row=0; row<rowCount; ++row )
333  {
334  bool isLast;
335  wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
336  PCB_LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
337  isLast = ( row == rowCount-1 );
338 
339  if( layer == B_Paste || layer == B_SilkS ||
340  layer == B_Mask || layer == B_Cu ||
341  layer == B_Fab || layer == B_CrtYd || layer == Edge_Cuts )
342  {
343  visible = true;
344  }
345  else
346  {
347  visible = false;
348  }
349 
350  cb->SetValue( visible );
351  OnLayerVisible( layer, visible, isLast );
352 
353  if( isLast )
354  break;
355  }
356  break;
357  }
358  }
359 }
360 
361 
363 {
364  m_notebook->SetPageText( 0, _( "Layer" ) );
365  m_notebook->SetPageText( 1, _( "Render" ) );
366 }
367 
368 
370 {
371  BOARD* board = myframe->GetBoard();
372  ClearRenderRows();
373 
374  // Add "Render" tab rows to LAYER_WIDGET, after setting color and checkbox state.
375  // Because s_render_rows is created static, we must explicitly call
376  // wxGetTranslation for texts which are internationalized (tool tips
377  // and item names)
378  for( unsigned row=0; row<DIM(s_render_rows); ++row )
379  {
380  LAYER_WIDGET::ROW renderRow = s_render_rows[row];
381 
382  if( m_fp_editor_mode && !isAllowedInFpMode( renderRow.id ) )
383  continue;
384 
385  renderRow.tooltip = wxGetTranslation( s_render_rows[row].tooltip );
386  renderRow.rowName = wxGetTranslation( s_render_rows[row].rowName );
387 
388  if( renderRow.color != COLOR4D::UNSPECIFIED ) // does this row show a color?
389  {
390  // this window frame must have an established BOARD, i.e. after SetBoard()
391  renderRow.color = myframe->Settings().Colors().GetItemColor( static_cast<GAL_LAYER_ID>( renderRow.id ) );
392  }
393 
394  renderRow.state = board->IsElementVisible( static_cast<GAL_LAYER_ID>( renderRow.id ) );
395 
396  AppendRenderRow( renderRow );
397  }
398 }
399 
400 
402 {
403  BOARD* board = myframe->GetBoard();
404 
405  for( unsigned row=0; row<DIM(s_render_rows); ++row )
406  {
407  int rowId = s_render_rows[row].id;
408 
409  if( m_fp_editor_mode && !isAllowedInFpMode( rowId ) )
410  continue;
411 
412  // this does not fire a UI event
413  SetRenderState( rowId, board->IsElementVisible( static_cast<GAL_LAYER_ID>( rowId ) ) );
414  }
415 }
416 
417 
419 {
420  BOARD* board = myframe->GetBoard();
421  int count = GetLayerRowCount();
422 
423  for( int row=0; row<count; ++row )
424  {
425  // this utilizes more implementation knowledge than ideal, eventually
426  // add member ROW getRow() or similar to base LAYER_WIDGET.
427 
428  wxWindow* w = getLayerComp( row, COLUMN_ICON_ACTIVE );
429 
430  PCB_LAYER_ID layerId = ToLAYER_ID( getDecodedId( w->GetId() ) );
431 
432  // this does not fire a UI event
433  SetLayerVisible( layerId, board->IsLayerVisible( layerId ) );
434  }
435 }
436 
437 
439 {
440  BOARD* brd = myframe->GetBoard();
441  LSET enabled = brd->GetEnabledLayers();
442 
443  ClearLayerRows();
444 
445  wxString dsc;
446 
447  // show all coppers first, with front on top, back on bottom, then technical layers
448  for( LSEQ cu_stack = enabled.CuStack(); cu_stack; ++cu_stack )
449  {
450  PCB_LAYER_ID layer = *cu_stack;
451 
452  switch( layer )
453  {
454  case F_Cu:
455  dsc = _( "Front copper layer" );
456  break;
457 
458  case B_Cu:
459  dsc = _( "Back copper layer" );
460  break;
461 
462  default:
463  dsc = _( "Inner copper layer" );
464  break;
465  }
466 
468  brd->GetLayerName( layer ), layer, myframe->Settings().Colors().GetLayerColor( layer ),
469  dsc, true ) );
470 
471  if( m_fp_editor_mode && !isLayerAllowedInFpMode( layer ) )
472  {
473  getLayerComp( GetLayerRowCount()-1, COLUMN_COLOR_LYRNAME )->Enable( false );
475  COLUMN_COLORBM )->SetToolTip( wxEmptyString );
476  }
477  }
478 
479 
480  // technical layers are shown in this order:
481  // Because they are static, wxGetTranslation must be explicitly
482  // called for tooltips.
483  static const struct {
484  PCB_LAYER_ID layerId;
485  wxString tooltip;
486  } non_cu_seq[] = {
487  { F_Adhes, _( "Adhesive on board's front" ) },
488  { B_Adhes, _( "Adhesive on board's back" ) },
489  { F_Paste, _( "Solder paste on board's front" ) },
490  { B_Paste, _( "Solder paste on board's back" ) },
491  { F_SilkS, _( "Silkscreen on board's front" ) },
492  { B_SilkS, _( "Silkscreen on board's back" ) },
493  { F_Mask, _( "Solder mask on board's front" ) },
494  { B_Mask, _( "Solder mask on board's back" ) },
495  { Dwgs_User, _( "Explanatory drawings" ) },
496  { Cmts_User, _( "Explanatory comments" ) },
497  { Eco1_User, _( "User defined meaning" ) },
498  { Eco2_User, _( "User defined meaning" ) },
499  { Edge_Cuts, _( "Board's perimeter definition" ) },
500  { Margin, _( "Board's edge setback outline" ) },
501  { F_CrtYd, _( "Footprint courtyards on board's front" ) },
502  { B_CrtYd, _( "Footprint courtyards on board's back" ) },
503  { F_Fab, _( "Footprint assembly on board's front" ) },
504  { B_Fab, _( "Footprint assembly on board's back" ) }
505  };
506 
507  for( unsigned i=0; i<DIM( non_cu_seq ); ++i )
508  {
509  PCB_LAYER_ID layer = non_cu_seq[i].layerId;
510 
511  if( !enabled[layer] )
512  continue;
513 
515  brd->GetLayerName( layer ), layer, myframe->Settings().Colors().GetLayerColor( layer ),
516  wxGetTranslation( non_cu_seq[i].tooltip ), true ) );
517 
518  if( m_fp_editor_mode && !isLayerAllowedInFpMode( layer ) )
519  {
520  getLayerComp( GetLayerRowCount()-1, COLUMN_COLOR_LYRNAME )->Enable( false );
522  COLUMN_COLORBM )->SetToolTip( wxEmptyString );
523  }
524  }
525 }
526 
527 
528 //-----<LAYER_WIDGET callbacks>-------------------------------------------
529 
531 {
532  // Avoid setting the alpha channel, when we are in legacy mode,
533  // because in legacy mode the alpha channel is not used, but changing it
534  // destroys the GAL color setup
535  if( !myframe->IsGalCanvasActive() )
536  {
537  COLOR4D oldColor = myframe->Settings().Colors().GetLayerColor( ToLAYER_ID( aLayer ) );
538  aColor.a = oldColor.a;
539  }
540 
541  myframe->Settings().Colors().SetLayerColor( ToLAYER_ID( aLayer ), aColor );
542 
543  if( myframe->IsGalCanvasActive() )
544  {
545  KIGFX::VIEW* view = myframe->GetGalCanvas()->GetView();
547  view->UpdateLayerColor( aLayer );
548  view->UpdateLayerColor( GetNetnameLayer( aLayer ) );
549  }
550 
551  myframe->GetCanvas()->Refresh();
552 }
553 
554 
556 {
557  // the layer change from the PCB_LAYER_WIDGET can be denied by returning
558  // false from this function.
559  PCB_LAYER_ID layer = ToLAYER_ID( aLayer );
560 
561  if( m_fp_editor_mode && !isLayerAllowedInFpMode( layer ) )
562  return false;
563 
564  myframe->SetActiveLayer( layer );
566 
568  OnLayerSelected();
569  else if( displ_opts->m_ContrastModeDisplay )
570  myframe->GetCanvas()->Refresh();
571 
572  return true;
573 }
574 
575 
577 {
579  return false;
580 
581  // postprocess after an active layer selection
582  // ensure active layer visible
583  wxCommandEvent event;
585  onPopupSelection( event );
586 
587  return true;
588 }
589 
590 
591 void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal )
592 {
593  BOARD* brd = myframe->GetBoard();
594 
595  LSET visibleLayers = brd->GetVisibleLayers();
596 
597  visibleLayers.set( aLayer, isVisible );
598 
599  brd->SetVisibleLayers( visibleLayers );
600 
601  myframe->OnModify();
602 
603  EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
604 
605  if( galCanvas )
606  galCanvas->GetView()->SetLayerVisible( aLayer, isVisible );
607 
608  if( isFinal )
609  myframe->GetCanvas()->Refresh();
610 }
611 
612 
614 {
615  AddRightClickMenuItems( aMenu );
616 }
617 
618 
620 {
621  wxASSERT( aId > GAL_LAYER_ID_START && aId < GAL_LAYER_ID_END );
622 
623  myframe->Settings().Colors().SetItemColor( static_cast<GAL_LAYER_ID>( aId ), aColor );
624 
625  EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
626 
627  if( galCanvas && myframe->IsGalCanvasActive() )
628  {
629  if( aId == LAYER_GRID )
630  galCanvas->GetGAL()->SetGridColor( aColor );
631 
632  KIGFX::VIEW* view = galCanvas->GetView();
634  view->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); // useful to update rastnest
635  view->UpdateLayerColor( aId );
636  galCanvas->Refresh();
637  }
638 
639  myframe->GetCanvas()->Refresh();
640 }
641 
642 
643 void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
644 {
645  BOARD* brd = myframe->GetBoard();
646  wxASSERT( aId > GAL_LAYER_ID_START && aId < GAL_LAYER_ID_END );
647 
648  // The layer visibility status is saved in the board file so set the board modified
649  // state so the user has the option to save the changes.
650  if( brd->IsElementVisible( static_cast<GAL_LAYER_ID>( aId ) ) != isEnabled )
651  myframe->OnModify();
652 
653  brd->SetElementVisibility( static_cast<GAL_LAYER_ID>( aId ), isEnabled );
654 
655  EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
656 
657  if( galCanvas && myframe->IsGalCanvasActive() )
658  {
659  if( aId == LAYER_GRID )
660  {
661  galCanvas->GetGAL()->SetGridVisibility( myframe->IsGridVisible() );
663  }
664  else if ( aId == LAYER_RATSNEST )
665  {
666  // don't touch the layers. ratsnest is enabled on per-item basis.
668  galCanvas->GetView()->SetLayerVisible( aId, true );
669  }
670  else
671  galCanvas->GetView()->SetLayerVisible( aId, isEnabled );
672 
673  galCanvas->Refresh();
674  }
675 
676  myframe->GetCanvas()->Refresh();
677 }
678 
679 //-----</LAYER_WIDGET callbacks>------------------------------------------
Definition: colors.h:57
#define COLUMN_COLOR_LYRNAME
Definition: layer_widget.h:54
#define DIM(x)
of elements in an array
Definition: macros.h:98
void AddRightClickMenuItems(wxMenu &menu)
Function addRightClickMenuItems add menu items to a menu that should be shown when right-clicking the...
wxAuiNotebook * m_notebook
Definition: layer_widget.h:110
to draw blind/buried vias
show a marker on pads with no nets
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Function SetElementVisibility changes the visibility of an element category.
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...
#define RR
Struct ROW provides all the data needed to add a row to a LAYER_WIDGET.
Definition: layer_widget.h:85
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
bool OnLayerSelect(int aLayer) override
Function OnLayerSelect is called to notify client code whenever the user selects a different layer...
int GetNetnameLayer(int aLayer)
Returns a netname layer corresponding to the given layer.
This file is part of the common library.
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:337
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:55
anchor of items having an anchor point (texts, footprints)
LSEQ CuStack() const
Function CuStack returns a sequence of copper layers in starting from the front/top and extending to ...
Definition: lset.cpp:147
Class BOARD to handle a board.
bool isLayerAllowedInFpMode(PCB_LAYER_ID aLayer)
Function isLayerAllowedInFpMode.
bool isLast(CPTREE &aTree, CITER it)
Definition: ptree.cpp:122
show modules on back
PCB_BASE_FRAME * myframe
show modules values (when texts are visibles)
BOARD * GetBoard() const
bool OnLayerSelected()
Function OnLayerSelected ensure the active layer is visible, and other layers not visible when m_alwa...
void SetLayerColor(LAYER_NUM aLayer, COLOR4D aColor)
Function SetLayerColor sets the color for aLayer.
#define NOCOLOR
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
Add new GAL layers here.
void OnLayerRightClick(wxMenu &aMenu) override
Function OnLayerRightClick is called to notify client code about a layer being right-clicked.
static LSET AllTechMask()
Function AllTechMask returns a mask holding all technical layers (no CU layer) on both side...
Definition: lset.cpp:716
LSET GetEnabledLayers() const
Function GetEnabledLayers is a proxy function that calls the corresponding function in m_BoardSetting...
void ClearRenderRows()
Function ClearRenderRows empties out the render rows.
smd pads, back layer
Definition: colors.h:54
bool state
initial wxCheckBox state
Definition: layer_widget.h:90
virtual bool IsGridVisible() const
Function IsGridVisible() , virtual.
Definition: draw_frame.h:481
void SetLayersManagerTabsText()
Function SetLayersManagerTabsText Update the layer manager tabs labels Useful when changing Language ...
void ClearLayerRows()
Function ClearLayerRows empties out the layer rows.
void * GetDisplayOptions() override
Function GetDisplayOptions returns the display options current in use Display options are relative to...
wxString tooltip
if not empty, use this tooltip on row
Definition: layer_widget.h:91
Auxiliary rendering target (noncached)
Definition: definitions.h:42
This file contains miscellaneous commonly used macros and functions.
show modules on front
COLOR4D GetItemColor(int aItemIdx) const
Function GetItemColor.
void AppendRenderRow(const ROW &aRow)
Function AppendRenderRow appends a new row in the render portion of the widget.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
COLOR4D color
COLOR4D::UNSPECIFIED if none.
Definition: layer_widget.h:89
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.
Class PCB_DISPLAY_OPTIONS handles display options like enable/disable some optional drawings...
PCB_LAYER_ID
A quick note on layer IDs:
double a
Alpha component.
Definition: color4d.h:289
#define COLUMN_ICON_ACTIVE
Definition: layer_widget.h:51
bool isAllowedInFpMode(int aId)
Function isAllowedInFpMode.
Class LSET is a set of PCB_LAYER_IDs.
Auxillary items (guides, rule, etc)
static int s_allowed_in_FpEditor[]
#define COLUMN_COLORBM
Definition: layer_widget.h:52
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:568
void OnLayerColorChange(int aLayer, COLOR4D aColor) override
Function OnLayerColorChange is called to notify client code about a layer color change.
void SetVisibleLayers(LSET aLayerMask)
Function SetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
PCB_GENERAL_SETTINGS & Settings()
to draw usual through hole vias
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer given by aLayer.
PCB_LAYER_WIDGET(PCB_BASE_FRAME *aParent, wxWindow *aFocusOwner, int aPointSize=10, bool aFpEditorMode=false)
Constructor.
void AppendLayerRow(const ROW &aRow)
Function AppendLayerRow appends a new row in the layer portion of the widget.
void ReFillRender()
Function ReFillRender rebuilds Render for instance after the config is read.
wxScrolledWindow * m_LayerScrolledWindow
Definition: layer_widget.h:112
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:862
void onRightDownLayers(wxMouseEvent &event)
Function OnRightDownLayers puts up a popup menu for the layer panel.
void SetLayerVisible(int aLayer, bool aVisible=true)
Function SetLayerVisible() Controls the visibility of a particular layer.
Definition: view.h:387
virtual void SetActiveLayer(PCB_LAYER_ID aLayer)
Function SetActiveLayer will change the currently active layer to aLayer.
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:196
int GetLayerRowCount() const
Function GetLayerRowCount returns the number of rows in the layer tab.
static LAYER_NUM getDecodedId(int aControlId)
Function getDecodedId decodes aControlId to original un-encoded value.
Class LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
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...
COLORS_DESIGN_SETTINGS & Colors()
static const LAYER_WIDGET::ROW s_render_rows[]
This is a read only template that is copied and modified before adding to LAYER_WIDGET.
void OnRenderColorChange(int aId, COLOR4D aColor) override
Function OnRenderColorChange is called to notify client code whenever the user changes a rendering co...
virtual void ImportLegacyColors(const COLORS_DESIGN_SETTINGS *aSettings)=0
Function ImportLegacyColors Loads a list of color settings for layers.
void passOnFocus()
Function passOnFocus gives away the keyboard focus up to the main parent window.
void UpdateLayerColor(int aLayer)
Function UpdateLayerColor() Applies the new coloring scheme held by RENDER_SETTINGS in case that it h...
Definition: view.cpp:657
void OnLayerVisible(int aLayer, bool isVisible, bool isFinal) override
Function OnLayerVisible is called to notify client code about a layer visibility change.
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
virtual void OnModify()
Function OnModify Virtual Must be called after a change in order to set the "modify" flag of the curr...
Class LAYER_WIDGET is abstract and is used to manage a list of layers, with the notion of a "current"...
Definition: layer_widget.h:77
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Function IsElementVisible tests whether a given element category is visible.
void SyncLayerVisibilities()
Function SyncLayerVisibilities updates each "Layer" checkbox in this layer widget according to each l...
smd pads, front layer
see class PGM_BASE
#define COLUMN_COLOR_LYR_CB
Definition: layer_widget.h:53
handle color for not plated holes
virtual bool AreArbitraryColorsAllowed() override
Subclasses can override this to provide logic for allowing arbitrary color selection via wxColourPick...
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
wxString rowName
the prompt or layername
Definition: layer_widget.h:87
LSET GetVisibleLayers() const
Function GetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
COLOR4D GetLayerColor(LAYER_NUM aLayer) const
Function GetLayerColor.
void SetGridVisibility(bool aVisibility)
Sets the visibility setting of the grid.
Definition: colors.h:49
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
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
Definition: colors.h:45
void SetLayerVisible(LAYER_NUM aLayer, bool isVisible)
Function SetLayerVisible sets aLayer visible or not.
Class VIEW.
Definition: view.h:58
void OnRenderEnable(int aId, bool isEnabled) override
Function OnRenderEnable is called to notify client code whenever the user changes an rendering enable...
void SetRenderState(int aId, bool isSet)
Function SetRenderState sets the state of the checkbox associated with aId within the Render tab grou...
void SyncRenderStates()
Function SyncRenderStates updates the checkboxes (checked or not) to be consistent with the current s...
Definition of PCB_DISPLAY_OPTIONS class.
int id
either a layer or "visible element" id
Definition: layer_widget.h:88
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:774
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
show modules references (when texts are visibles)
void onPopupSelection(wxCommandEvent &event)
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
Function IsLayerVisible is a proxy function that calls the correspondent function in m_BoardSettings ...
Definition: class_board.h:451
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39