KiCad PCB EDA Suite
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 #include <class_board.h>
28 #include <fctsys.h>
30 #include <layer_widget.h>
31 #include <macros.h>
32 #include <menus_helpers.h>
33 #include <pcb_display_options.h>
34 #include <pcb_edit_frame.h>
35 #include <pcb_layer_widget.h>
36 #include <pcb_painter.h>
37 #include <pcbnew_id.h>
38 #include <pcbnew_settings.h>
39 #include <pgm_base.h>
41 #include <tool/tool_manager.h>
42 #include <view/view.h>
43 #include <widgets/indicator_icon.h>
44 
45 
48 
49 #define RR LAYER_WIDGET::ROW // Render Row abbreviation to reduce source width
50 #define NOCOLOR COLOR4D::UNSPECIFIED // specify rows that do not have a color selector icon
51 
52  // text id color tooltip
53  RR( _( "Footprints Front" ), LAYER_MOD_FR, NOCOLOR, _( "Show footprints that are on board's front") ),
54  RR( _( "Footprints Back" ), LAYER_MOD_BK, NOCOLOR, _( "Show footprints that are on board's back") ),
55  RR( _( "Values" ), LAYER_MOD_VALUES, NOCOLOR, _( "Show footprint values") ),
56  RR( _( "Reference Designators" ),LAYER_MOD_REFERENCES, NOCOLOR, _( "Show footprint reference designators") ),
57  RR( _( "Footprint Text Front" ), LAYER_MOD_TEXT_FR, NOCOLOR, _( "Show footprint text on board's front" ) ),
58  RR( _( "Footprint Text Back" ), LAYER_MOD_TEXT_BK, NOCOLOR, _( "Show footprint text on board's back" ) ),
59  RR( _( "Hidden Text" ), LAYER_MOD_TEXT_INVISIBLE, WHITE, _( "Show footprint text marked as invisible" ) ),
60  RR( _( "Pads Front" ), LAYER_PAD_FR, WHITE, _( "Show footprint pads on board's front" ) ),
61  RR( _( "Pads Back" ), LAYER_PAD_BK, WHITE, _( "Show footprint pads on board's back" ) ),
62  RR( _( "Through Hole Pads" ), LAYER_PADS_TH, YELLOW, _( "Show through hole pads in specific color") ),
63  RR(),
64  RR( _( "Tracks" ), LAYER_TRACKS, NOCOLOR, _( "Show tracks" ) ),
65  RR( _( "Through Via" ), LAYER_VIA_THROUGH, WHITE, _( "Show through vias" ) ),
66  RR( _( "Bl/Buried Via" ), LAYER_VIA_BBLIND, WHITE, _( "Show blind or buried vias" ) ),
67  RR( _( "Micro Via" ), LAYER_VIA_MICROVIA, WHITE, _( "Show micro vias") ),
68  RR( _( "Non Plated Holes" ), LAYER_NON_PLATEDHOLES, WHITE, _( "Show non plated holes in specific color") ),
69  RR(),
70  RR( _( "Ratsnest" ), LAYER_RATSNEST, WHITE, _( "Show unconnected nets as a ratsnest") ),
71  RR( _( "No-Connects" ), LAYER_NO_CONNECTS, BLUE, _( "Show a marker on pads which have no net connected" ) ),
72  RR( _( "DRC Warnings" ), LAYER_DRC_WARNING, YELLOW, _( "DRC violations with a Warning severity" ) ),
73  RR( _( "DRC Errors" ), LAYER_DRC_ERROR, PURERED, _( "DRC violations with an Error severity" ) ),
74  RR( _( "Anchors" ), LAYER_ANCHOR, WHITE, _( "Show footprint and text origins as a cross" ) ),
75  RR( _( "Worksheet" ), LAYER_WORKSHEET, DARKRED, _( "Show worksheet") ),
76  RR( _( "Cursor" ), LAYER_CURSOR, WHITE, _( "PCB Cursor" ), true, false ),
77  RR( _( "Aux Items" ), LAYER_AUX_ITEMS, WHITE, _( "Auxiliary items (rulers, assistants, axes, etc.)" ), true, false ),
78  RR( _( "Grid" ), LAYER_GRID, WHITE, _( "Show the (x,y) grid dots" ) ),
79  RR( _( "Background" ), LAYER_PCB_BACKGROUND, BLACK, _( "PCB Background" ), true, false )
80 };
81 
82 static int s_allowed_in_FpEditor[] =
83 {
93  LAYER_GRID,
95 };
96 
97 
98 PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwner,
99  bool aFpEditorMode ) :
100  LAYER_WIDGET( aParent, aFocusOwner ),
101  myframe( aParent )
102 {
104  m_fp_editor_mode = aFpEditorMode;
105 
106  // Update default tabs labels
108 
109  //-----<Popup menu>-------------------------------------------------
110  // handle the popup menu over the layer window.
111  m_LayerScrolledWindow->Connect( wxEVT_RIGHT_DOWN,
112  wxMouseEventHandler( PCB_LAYER_WIDGET::onRightDownLayers ), NULL, this );
113 
114  // since Popupmenu() calls this->ProcessEvent() we must call this->Connect()
115  // and not m_LayerScrolledWindow->Connect()
116 
118  wxEVT_COMMAND_MENU_SELECTED,
119  wxCommandEventHandler( PCB_LAYER_WIDGET::onPopupSelection ), NULL, this );
120 }
121 
122 
124 {
126 }
127 
128 
130 {
131  for( unsigned ii = 0; ii < arrayDim( s_allowed_in_FpEditor ); ii++ )
132  if( s_allowed_in_FpEditor[ii] == aId )
133  return true;
134 
135  return false;
136 }
137 
138 
140 {
141  static LSET allowed = LSET::AllTechMask();
142  allowed.set( F_Cu ).set( B_Cu );
143  return allowed.test( aLayer );
144 }
145 
146 
148 {
150  _( "Show All Copper Layers" ),
153  _( "Hide All Copper Layers" ),
155 
156  menu.AppendSeparator();
157 
159  _( "Hide All Copper Layers But Active" ),
162  _( "Always Hide All Copper Layers But Active" ),
164 
165  menu.AppendSeparator();
166 
168  _( "Show All Non Copper Layers" ),
171  _( "Hide All Non Copper Layers" ),
173 
174  menu.AppendSeparator();
175 
176  AddMenuItem( &menu, ID_SHOW_ALL_LAYERS, _( "Show All Layers" ),
178  AddMenuItem( &menu, ID_SHOW_NO_LAYERS, _( "Hide All Layers" ),
180 
181  menu.AppendSeparator();
182 
183  AddMenuItem( &menu, ID_SHOW_ONLY_FRONT_ASSEMBLY, _( "Show Only Front Assembly Layers" ),
184  KiBitmap( shape_3d_xpm ) );
185 
186  AddMenuItem( &menu, ID_SHOW_ONLY_FRONT, _( "Show Only Front Layers" ),
188 
189  // Only show the internal layer option if internal layers are enabled
190  if( myframe->GetBoard()->GetCopperLayerCount() > 2 )
191  {
192  AddMenuItem( &menu, ID_SHOW_ONLY_INNER, _( "Show Only Inner Layers" ),
194  }
195 
196  AddMenuItem( &menu, ID_SHOW_ONLY_BACK, _( "Show Only Back Layers" ),
198 
199  AddMenuItem( &menu, ID_SHOW_ONLY_BACK_ASSEMBLY, _( "Show Only Back Assembly Layers" ),
201 }
202 
203 
204 void PCB_LAYER_WIDGET::onRightDownLayers( wxMouseEvent& event )
205 {
206  wxMenu menu;
207 
208  AddRightClickMenuItems( menu );
209  PopupMenu( &menu );
210 
211  passOnFocus();
212 }
213 
214 
215 void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
216 {
217  // Force the active layer to be visible
218  bool forceActiveLayer = false;
219 
220  // Reset the always show property
222 
223  // Make a distinction between the layers we want to enable and those we
224  // want to disable explictly. That way we can either or the current layerset
225  // or operate on all layers.
226  LSET layersToShow;
227  LSET layersToHide;
228 
229  switch( event.GetId() )
230  {
231  case ID_SHOW_NO_LAYERS:
232  layersToHide = LSET::AllLayersMask();
233  break;
234 
235  case ID_SHOW_ALL_LAYERS:
236  layersToShow = LSET::AllLayersMask();
237  break;
238 
240  layersToShow = LSET::AllCuMask();
241  break;
242 
246 
248  forceActiveLayer = true;
250 
252  layersToHide = LSET::AllCuMask();
253  break;
254 
256  layersToHide = LSET::AllNonCuMask();
257  break;
258 
260  layersToShow = LSET::AllNonCuMask();
261  break;
262 
264  // Include the edgecuts layer as well as the front assembly layers and hide the other layers
265  layersToShow = LSET::FrontAssembly().set( Edge_Cuts );
266  layersToHide = ~layersToShow;
268  break;
269 
270  case ID_SHOW_ONLY_FRONT:
271  // Include the edgecuts layer as well as the front layers and hide the other layers
272  layersToShow = LSET::FrontMask().set( Edge_Cuts );
273  layersToHide = ~layersToShow;
274  break;
275 
276  case ID_SHOW_ONLY_INNER:
277  // Include the edgecuts layer as well as the internal layers and hide the other layers
278  layersToShow = LSET::InternalCuMask().set( Edge_Cuts );
279  layersToHide = ~layersToShow;
280  break;
281 
282  case ID_SHOW_ONLY_BACK:
283  // Include the edgecuts layer as well as the back layers and hide the other layers
284  layersToShow = LSET::BackMask().set( Edge_Cuts );
285  layersToHide = ~layersToShow;
286  break;
287 
289  // Include the edgecuts layer as well as the back assembly layers and hide the other layers
290  layersToShow = LSET::BackAssembly().set( Edge_Cuts );
291  layersToHide = ~layersToShow;
293  break;
294  }
295 
296  int rowCount = GetLayerRowCount();
297 
298  for( int row = 0; row < rowCount; ++row )
299  {
300  wxCheckBox* cb = static_cast<wxCheckBox*>( getLayerComp( row, COLUMN_COLOR_LYR_CB ) );
301  PCB_LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
302 
303  bool visible = cb->GetValue();
304 
305  if( layersToShow.Contains( layer ) )
306  visible = true;
307 
308  if( layersToHide.Contains( layer ) )
309  visible = false;
310 
311  // Force the active layer in the editor to be visible
312  if( forceActiveLayer && ( layer == myframe->GetActiveLayer() ) )
313  visible = true;
314 
315  cb->SetValue( visible );
316  OnLayerVisible( layer, visible, false );
317  }
318 
319  // Refresh the drawing canvas
320  myframe->GetCanvas()->Refresh();
321 }
322 
323 
325 {
326  m_notebook->SetPageText( 0, _( "Layers" ) );
327  m_notebook->SetPageText( 1, _( "Items" ) );
328 }
329 
330 
332 {
333  BOARD* board = myframe->GetBoard();
334 
335  ClearRenderRows();
336 
337  // Add "Items" tab rows to LAYER_WIDGET, after setting color and checkbox state.
338  // Because s_render_rows is created static, we must explicitly call
339  // wxGetTranslation for texts which are internationalized (tool tips
340  // and item names)
341  for( unsigned row=0; row<arrayDim(s_render_rows); ++row )
342  {
343  LAYER_WIDGET::ROW renderRow = s_render_rows[row];
344 
345  if( m_fp_editor_mode && !isAllowedInFpMode( renderRow.id ) )
346  continue;
347 
348  if( !renderRow.spacer )
349  {
350  renderRow.tooltip = wxGetTranslation( s_render_rows[row].tooltip );
351  renderRow.rowName = wxGetTranslation( s_render_rows[row].rowName );
352 
353  if( renderRow.color != COLOR4D::UNSPECIFIED ) // does this row show a color?
354  {
355  // this window frame must have an established BOARD, i.e. after SetBoard()
356  renderRow.color = myframe->GetColorSettings()->GetColor(
357  static_cast<GAL_LAYER_ID>( renderRow.id ) );
359  static_cast<GAL_LAYER_ID>( renderRow.id ) );
360  }
361 
362  if( renderRow.id == LAYER_RATSNEST )
364  else if( renderRow.id == LAYER_GRID )
365  renderRow.state = myframe->IsGridVisible();
366  else
367  renderRow.state = board->IsElementVisible(
368  static_cast<GAL_LAYER_ID>( renderRow.id ) );
369  }
370 
371  AppendRenderRow( renderRow );
372  }
373 
374  UpdateLayouts();
375 }
376 
377 
379 {
380  BOARD* board = myframe->GetBoard();
381  int count = GetLayerRowCount();
382 
383  for( int row=0; row<count; ++row )
384  {
385  // this utilizes more implementation knowledge than ideal, eventually
386  // add member ROW getRow() or similar to base LAYER_WIDGET.
387 
388  wxWindow* w = getLayerComp( row, COLUMN_ICON_ACTIVE );
389 
390  PCB_LAYER_ID layerId = ToLAYER_ID( getDecodedId( w->GetId() ) );
391 
392  // this does not fire a UI event
393  setLayerCheckbox( layerId, board->IsLayerVisible( layerId ) );
394  }
395 }
396 
397 
398 #define ALPHA_EPSILON 0.04
399 
401 {
402  int count = GetLayerRowCount();
404  KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( mgr->GetView()->GetPainter() );
405  KIGFX::PCB_RENDER_SETTINGS* settings = painter->GetSettings();
406 
407  for( int row = 0; row < count; ++row )
408  {
409  // this utilizes more implementation knowledge than ideal, eventually
410  // add member ROW getRow() or similar to base LAYER_WIDGET.
411 
412  wxWindow* w = getLayerComp( row, COLUMN_ICON_ACTIVE );
413  PCB_LAYER_ID layerId = ToLAYER_ID( getDecodedId( w->GetId() ) );
414  KIGFX::COLOR4D screenColor = settings->GetLayerColor( layerId );
415 
416  COLOR_SWATCH* swatch = static_cast<COLOR_SWATCH*>( getLayerComp( row, COLUMN_COLORBM ) );
417  KIGFX::COLOR4D layerColor = swatch->GetSwatchColor();
418 
419  INDICATOR_ICON* indicator = static_cast<INDICATOR_ICON*>( getLayerComp( row, COLUMN_ALPHA_INDICATOR ) );
420 
421  if( std::abs( screenColor.a - layerColor.a ) > ALPHA_EPSILON )
422  {
423  if( screenColor.a < layerColor.a )
424  indicator->SetIndicatorState( ROW_ICON_PROVIDER::STATE::DOWN );
425  else
426  indicator->SetIndicatorState( ROW_ICON_PROVIDER::STATE::UP );
427  }
428  else
430  }
431 }
432 
433 
435 {
437 
439 
440  int count = GetLayerRowCount();
441  int row;
442  int col = 1; // bitmap button is column 1 in layers tab
443 
444  for( row = 0; row < count; ++row )
445  {
446  COLOR_SWATCH* swatch = dynamic_cast<COLOR_SWATCH*>( getLayerComp( row, col ) );
447 
448  if( swatch )
449  {
450  swatch->SetSwatchBackground( bg );
451  swatch->SetSwatchColor( cs->GetColor( getDecodedId( swatch->GetId() ) ), false );
452  }
453  }
454 
455  count = GetRenderRowCount();
456  col = 0; // bitmap button is column 0 in render tab
457 
458  for( row = 0; row < count; ++row )
459  {
460  COLOR_SWATCH* swatch = dynamic_cast<COLOR_SWATCH*>( getRenderComp( row, col ) );
461 
462  if( swatch )
463  {
464  swatch->SetSwatchBackground( bg );
465  swatch->SetSwatchColor( cs->GetColor( getDecodedId( swatch->GetId() ) ), false );
466  }
467  }
468 }
469 
470 
472 {
473  BOARD* brd = myframe->GetBoard();
474  LSET enabled = brd->GetEnabledLayers();
475 
476  ClearLayerRows();
477 
478  wxString dsc;
479 
480  // show all coppers first, with front on top, back on bottom, then technical layers
481  for( LSEQ cu_stack = enabled.CuStack(); cu_stack; ++cu_stack )
482  {
483  PCB_LAYER_ID layer = *cu_stack;
484 
485  switch( layer )
486  {
487  case F_Cu:
488  dsc = _( "Front copper layer" );
489  break;
490 
491  case B_Cu:
492  dsc = _( "Back copper layer" );
493  break;
494 
495  default:
496  dsc = _( "Inner copper layer" );
497  break;
498  }
499 
500  AppendLayerRow( LAYER_WIDGET::ROW( brd->GetLayerName( layer ), layer,
501  myframe->GetColorSettings()->GetColor( layer ), dsc, true, true,
502  myframe->GetColorSettings()->GetDefaultColor( layer ) ) );
503 
505  {
506  getLayerComp( GetLayerRowCount()-1, COLUMN_COLOR_LYRNAME )->Enable( false );
507  getLayerComp( GetLayerRowCount()-1, COLUMN_COLORBM )->SetToolTip( wxEmptyString );
508  }
509  }
510 
511  UpdateLayouts();
512 
513 
514  // technical layers are shown in this order:
515  // Because they are static, wxGetTranslation must be explicitly
516  // called for tooltips.
517  static const struct {
518  PCB_LAYER_ID layerId;
519  wxString tooltip;
520  } non_cu_seq[] = {
521  { F_Adhes, _( "Adhesive on board's front" ) },
522  { B_Adhes, _( "Adhesive on board's back" ) },
523  { F_Paste, _( "Solder paste on board's front" ) },
524  { B_Paste, _( "Solder paste on board's back" ) },
525  { F_SilkS, _( "Silkscreen on board's front" ) },
526  { B_SilkS, _( "Silkscreen on board's back" ) },
527  { F_Mask, _( "Solder mask on board's front" ) },
528  { B_Mask, _( "Solder mask on board's back" ) },
529  { Dwgs_User, _( "Explanatory drawings" ) },
530  { Cmts_User, _( "Explanatory comments" ) },
531  { Eco1_User, _( "User defined meaning" ) },
532  { Eco2_User, _( "User defined meaning" ) },
533  { Edge_Cuts, _( "Board's perimeter definition" ) },
534  { Margin, _( "Board's edge setback outline" ) },
535  { F_CrtYd, _( "Footprint courtyards on board's front" ) },
536  { B_CrtYd, _( "Footprint courtyards on board's back" ) },
537  { F_Fab, _( "Footprint assembly on board's front" ) },
538  { B_Fab, _( "Footprint assembly on board's back" ) }
539  };
540 
541  for( unsigned i=0; i<arrayDim( non_cu_seq ); ++i )
542  {
543  PCB_LAYER_ID layer = non_cu_seq[i].layerId;
544 
545  if( !enabled[layer] )
546  continue;
547 
548  AppendLayerRow( LAYER_WIDGET::ROW( brd->GetLayerName( layer ), layer,
549  myframe->GetColorSettings()->GetColor( layer ),
550  wxGetTranslation( non_cu_seq[i].tooltip ), true, true,
551  myframe->GetColorSettings()->GetDefaultColor( layer ) ) );
552 
554  {
555  getLayerComp( GetLayerRowCount()-1, COLUMN_COLOR_LYRNAME )->Enable( false );
556  getLayerComp( GetLayerRowCount()-1, COLUMN_COLORBM )->SetToolTip( wxEmptyString );
557  }
558  }
559 }
560 
561 
562 //-----<LAYER_WIDGET callbacks>-------------------------------------------
563 
565 {
567  cs->SetColor( aLayer, aColor );
568 
570 
571  KIGFX::VIEW* view = myframe->GetCanvas()->GetView();
572  view->UpdateLayerColor( aLayer );
573  view->UpdateLayerColor( GetNetnameLayer( aLayer ) );
574 
576 
577  myframe->GetCanvas()->Refresh();
578 
579  if( aLayer == LAYER_PCB_BACKGROUND )
580  myframe->SetDrawBgColor( aColor );
581 }
582 
583 
585 {
586  // the layer change from the PCB_LAYER_WIDGET can be denied by returning
587  // false from this function.
588  PCB_LAYER_ID layer = ToLAYER_ID( aLayer );
589 
591  return false;
592 
593  myframe->SetActiveLayer( layer );
594 
597 
599  OnLayerSelected();
600  else if( hcm )
601  myframe->GetCanvas()->Refresh();
602 
603  return true;
604 }
605 
606 
608 {
610  return false;
611 
612  // postprocess after an active layer selection
613  // ensure active layer visible
614  wxCommandEvent event;
616  onPopupSelection( event );
617 
618  return true;
619 }
620 
621 
622 void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal )
623 {
624  BOARD* brd = myframe->GetBoard();
625 
626  LSET visibleLayers = brd->GetVisibleLayers();
627 
628  if( visibleLayers.test( aLayer ) != isVisible )
629  {
630  visibleLayers.set( aLayer, isVisible );
631 
632  brd->SetVisibleLayers( visibleLayers );
633 
634  if( myframe->GetCanvas() )
635  myframe->GetCanvas()->GetView()->SetLayerVisible( aLayer, isVisible );
636  }
637 
638  if( isFinal )
639  myframe->GetCanvas()->Refresh();
640 }
641 
642 
644 {
645  AddRightClickMenuItems( aMenu );
646 }
647 
648 
650 {
651  wxASSERT( aId > GAL_LAYER_ID_START && aId < GAL_LAYER_ID_END );
652 
653  myframe->GetColorSettings()->SetColor( aId, aColor );
655 
656  KIGFX::VIEW* view = myframe->GetCanvas()->GetView();
657  view->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); // useful to update rastnest
658  view->UpdateLayerColor( aId );
659 
660  // plated-through-holes don't have their own color; they use the background color
661  if( aId == LAYER_PCB_BACKGROUND )
663 
666  myframe->GetCanvas()->Refresh();
667 }
668 
669 
670 void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
671 {
672  BOARD* brd = myframe->GetBoard();
673  wxASSERT( aId > GAL_LAYER_ID_START && aId < GAL_LAYER_ID_END );
674 
675  // Grid is not set through the board visibility
676  if( aId == LAYER_GRID )
677  myframe->SetGridVisibility( isEnabled );
678  else
679  brd->SetElementVisibility( static_cast<GAL_LAYER_ID>( aId ), isEnabled );
680 
681  if( aId == LAYER_RATSNEST )
682  {
683  // don't touch the layers. ratsnest is enabled on per-item basis.
685  myframe->GetCanvas()->GetView()->SetLayerVisible( aId, true );
686 
688  {
690  opt.m_ShowGlobalRatsnest = isEnabled;
692  }
693  }
694  else if( aId != LAYER_GRID )
695  myframe->GetCanvas()->GetView()->SetLayerVisible( aId, isEnabled );
696 
697  myframe->GetCanvas()->Refresh();
698  myframe->GetCanvas()->Refresh();
699 }
700 
701 //-----</LAYER_WIDGET callbacks>------------------------------------------
COLOR4D defaultColor
The default color for the row.
Definition: layer_widget.h:96
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:712
#define COLUMN_COLOR_LYRNAME
Definition: layer_widget.h:55
void AddRightClickMenuItems(wxMenu &menu)
Function addRightClickMenuItems add menu items to a menu that should be shown when right-clicking the...
void SetIndicatorState(ICON_ID aIconId)
Sets the row indiciator to the given state.
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:284
wxAuiNotebook * m_notebook
Definition: layer_widget.h:127
to draw blind/buried vias
#define ALPHA_EPSILON
LSEQ CuStack() const
Function CuStack returns a sequence of copper layers in starting from the front/top and extending to ...
Definition: lset.cpp:155
show a marker on pads with no nets
void ForceRefresh()
Function ForceRefresh() Forces a redraw.
#define KI_FALLTHROUGH
KIGFX::COLOR4D GetSwatchColor() const
static int s_allowed_in_FpEditor[]
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Function SetElementVisibility changes the visibility of an element category.
void SetSwatchColor(KIGFX::COLOR4D aColor, bool sendEvent)
Set the current swatch color directly.
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer.
Struct ROW provides all the data needed to add a row to a LAYER_WIDGET.
Definition: layer_widget.h:87
multilayer pads, usually with holes
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.
#define COLUMN_ALPHA_INDICATOR
Definition: layer_widget.h:56
static LSET ForbiddenFootprintLayers()
Function ForbiddenFootprintLayers Layers which are not allowed within footprint definitions.
Definition: lset.cpp:825
bool spacer
if true, this row is a spacer
Definition: layer_widget.h:95
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:232
handle color for not plated holes (holes, not pads)
anchor of items having an anchor point (texts, footprints)
virtual COLOR_SETTINGS * GetColorSettings() override
Helper to retrieve the current color settings.
void UpdateLayouts()
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
bool isLayerAllowedInFpMode(PCB_LAYER_ID aLayer)
Function isLayerAllowedInFpMode.
bool Contains(PCB_LAYER_ID aLayer)
See if the layer set contains a PCB layer.
static LSET AllNonCuMask()
Function AllNonCuMask returns a mask holding all layer minus CU layers.
Definition: lset.cpp:735
const BITMAP_OPAQUE show_no_copper_layers_xpm[1]
const BITMAP_OPAQUE select_layer_pair_xpm[1]
LSET GetVisibleLayers() const
Function GetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
PCB_BASE_FRAME * myframe
show modules values (when texts are visibles)
virtual COLOR4D getBackgroundLayerColor() override
Subclasses can override this to provide accurate representation of transparent colour swatches.
bool OnLayerSelected()
Function OnLayerSelected ensure the active layer is visible, and other layers not visible when m_alwa...
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...
void SetSwatchBackground(KIGFX::COLOR4D aBackground)
Set the swatch background color.
LSET GetEnabledLayers() const
Function GetEnabledLayers is a proxy function that calls the corresponding function in m_BoardSetting...
void SetDrawBgColor(COLOR4D aColor) override
Definition: color4d.h:44
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:782
PCB_PAINTER Contains methods for drawing PCB-specific items.
Definition: pcb_painter.h:265
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Function GetDisplayOptions Display options control the way tracks, vias, outlines and other things ar...
void ClearRenderRows()
Function ClearRenderRows empties out the render rows.
static LSET FrontMask()
Function FrontMask returns a mask holding all technical layers and the external CU layer on front sid...
Definition: lset.cpp:811
const BITMAP_OPAQUE show_all_copper_layers_xpm[1]
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
bool state
initial wxCheckBox state
Definition: layer_widget.h:92
void SetLayersManagerTabsText()
Function SetLayersManagerTabsText Update the layer manager tabs labels Useful when changing Language ...
void ClearLayerRows()
Function ClearLayerRows empties out the layer rows.
wxString tooltip
if not empty, use this tooltip on row
Definition: layer_widget.h:93
Auxiliary rendering target (noncached)
Definition: definitions.h:49
This file contains miscellaneous commonly used macros and functions.
show modules on front
virtual PCB_LAYER_ID GetActiveLayer() const
PCB_RENDER_SETTINGS Stores PCB specific render settings.
Definition: pcb_painter.h:63
Definition: color4d.h:67
TOOL_MANAGER.
Definition: tool_manager.h:51
void AppendRenderRow(const ROW &aRow)
Function AppendRenderRow appends a new row in the render portion of the widget.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:80
COLOR4D color
COLOR4D::UNSPECIFIED if none.
Definition: layer_widget.h:91
static LSET BackAssembly()
Function BackAssembly() returns a complete set of all bottom assembly layers, which is all B_SilkS an...
Definition: lset.cpp:659
PCB_DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
PCB_LAYER_ID
A quick note on layer IDs:
representing a row indicator icon for use in places like the layer widget
double a
Alpha component.
Definition: color4d.h:369
#define COLUMN_ICON_ACTIVE
Definition: layer_widget.h:52
bool isAllowedInFpMode(int aId)
Function isAllowedInFpMode.
LSET is a set of PCB_LAYER_IDs.
const BITMAP_OPAQUE show_all_back_layers_xpm[1]
void UpdateDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
Definition: pcb_view.cpp:113
Auxiliary items (guides, rule, etc)
void setLayerCheckbox(LAYER_NUM aLayer, bool isVisible)
#define NULL
#define COLUMN_COLORBM
Definition: layer_widget.h:53
wxWindow * getRenderComp(int aRow, int aColumn) const
const BITMAP_OPAQUE select_w_layer_xpm[1]
virtual PCB_RENDER_SETTINGS * GetSettings() override
Definition: pcb_painter.h:277
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:585
bool IsGridVisible() const
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...
#define OFF
to draw usual through hole vias
#define NOCOLOR
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.
const BITMAP_OPAQUE shape_3d_back_xpm[1]
COLOR4D GetDefaultColor(int aLayer)
static LSET InternalCuMask()
Function InternalCuMask() returns a complete set of internal copper layers, which is all Cu layers ex...
Definition: lset.cpp:672
const BITMAP_OPAQUE show_all_layers_xpm[1]
wxScrolledWindow * m_LayerScrolledWindow
Definition: layer_widget.h:129
static LSET FrontAssembly()
Function FrontAssembly() returns a complete set of all top assembly layers, which is all F_SilkS and ...
Definition: lset.cpp:646
HIGH_CONTRAST_MODE m_ContrastModeDisplay
How inactive layers are displayed.
void onRightDownLayers(wxMouseEvent &event)
Function OnRightDownLayers puts up a popup menu for the layer panel.
static LSET AllLayersMask()
Definition: lset.cpp:749
void SetLayerVisible(int aLayer, bool aVisible=true)
Function SetLayerVisible() Controls the visibility of a particular layer.
Definition: view.h:399
virtual void SetActiveLayer(PCB_LAYER_ID aLayer)
void SyncLayerColors()
Updates the color for each layer and item from the active color theme.
static LAYER_NUM getDecodedId(int aControlId)
Function getDecodedId decodes aControlId to original un-encoded value.
virtual KIGFX::PCB_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
const BITMAP_OPAQUE shape_3d_xpm[1]
Definition: shape_3d.cpp:35
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
void SyncLayerAlphaIndicators()
Function SyncLayerAlphaIndicators updates each "Layer"s alpha indicator to show if the board is curre...
void UpdateColors()
Updates the color settings in the painter and GAL.
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...
bool m_alwaysShowActiveCopperLayer
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:160
int GetLayerRowCount() const
Function GetLayerRowCount returns the number of rows in the layer tab.
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Function IsElementVisible tests whether a given element category is visible.
void passOnFocus()
Function passOnFocus gives away the keyboard focus up to the main parent window.
Definition: color4d.h:48
layer for drc markers with SEVERITY_WARNING
void UpdateLayerColor(int aLayer)
Function UpdateLayerColor() Applies the new coloring scheme held by RENDER_SETTINGS in case that it h...
Definition: view.cpp:777
void OnLayerVisible(int aLayer, bool isVisible, bool isFinal) override
Function OnLayerVisible is called to notify client code about a layer visibility change.
COLOR4D GetColor(int aLayer) const
LAYER_WIDGET is abstract and is used to manage a list of layers, with the notion of a "current" layer...
Definition: layer_widget.h:79
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
Function IsLayerVisible is a proxy function that calls the correspondent function in m_BoardSettings ...
Definition: color4d.h:56
void SyncLayerVisibilities()
Function SyncLayerVisibilities updates each "Layer" checkbox in this layer widget according to each l...
virtual void ReCreateHToolbar()=0
smd pads, front layer
see class PGM_BASE
bool IsType(FRAME_T aType) const
#define COLUMN_COLOR_LYR_CB
Definition: layer_widget.h:54
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
wxString rowName
the prompt or layername
Definition: layer_widget.h:89
#define _(s)
Definition: 3d_actions.cpp:33
int GetCopperLayerCount() const
Function GetCopperLayerCount.
Class representing a simple color swatch, of the kind used to set layer colors.
Definition: color_swatch.h:38
static LSET BackMask()
Function BackMask returns a mask holding all technical layers and the external CU layer on back side.
Definition: lset.cpp:818
Color settings are a bit different than most of the settings objects in that there can be more than o...
int GetRenderRowCount() const
Function GetRenderRowCount returns the number of rows in the render tab.
const BITMAP_OPAQUE show_all_front_layers_xpm[1]
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:74
BOARD * GetBoard() const
VIEW.
Definition: view.h:61
void OnRenderEnable(int aId, bool isEnabled) override
Function OnRenderEnable is called to notify client code whenever the user changes an rendering enable...
Definition of PCB_DISPLAY_OPTIONS class.
int id
either a layer or "visible element" id
Definition: layer_widget.h:90
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:849
virtual void SetGridVisibility(bool aVisible)
PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
show modules references (when texts are visibles)
layer for drc markers with SEVERITY_ERROR
void onPopupSelection(wxCommandEvent &event)
const BITMAP_OPAQUE show_no_layers_xpm[1]
#define RR
PCB_LAYER_WIDGET(PCB_BASE_FRAME *aParent, wxWindow *aFocusOwner, bool aFpEditorMode=false)
Constructor.
void SetColor(int aLayer, COLOR4D aColor)
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:99