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-2016 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-2016 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 <pcbstruct.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 
60  // text id color tooltip
61  RR( _( "Through Via" ), LAYER_VIA_THROUGH, WHITE, _( "Show through vias" ) ),
62  RR( _( "Bl/Buried Via" ), LAYER_VIA_BBLIND, WHITE, _( "Show blind or buried vias" ) ),
63  RR( _( "Micro Via" ), LAYER_VIA_MICROVIA, WHITE, _( "Show micro vias") ),
64  RR( _( "Non Plated Holes" ),LAYER_NON_PLATED, WHITE, _( "Show non plated holes in specific color") ),
65  RR( _( "Ratsnest" ), LAYER_RATSNEST, WHITE, _( "Show unconnected nets as a ratsnest") ),
66 
67  RR( _( "Pads Front" ), LAYER_PAD_FR, WHITE, _( "Show footprint pads on board's front" ) ),
68  RR( _( "Pads Back" ), LAYER_PAD_BK, WHITE, _( "Show footprint pads on board's back" ) ),
69 
70  RR( _( "Text Front" ), LAYER_MOD_TEXT_FR, COLOR4D::UNSPECIFIED, _( "Show footprint text on board's front" ) ),
71  RR( _( "Text Back" ), LAYER_MOD_TEXT_BK, COLOR4D::UNSPECIFIED, _( "Show footprint text on board's back" ) ),
72  RR( _( "Hidden Text" ), LAYER_MOD_TEXT_INVISIBLE, WHITE, _( "Show footprint text marked as invisible" ) ),
73 
74  RR( _( "Anchors" ), LAYER_ANCHOR, WHITE, _( "Show footprint and text origins as a cross" ) ),
75  RR( _( "Grid" ), LAYER_GRID, WHITE, _( "Show the (x,y) grid dots" ) ),
76  RR( _( "No-Connects" ), LAYER_NO_CONNECTS, COLOR4D::UNSPECIFIED, _( "Show a marker on pads which have no net connected" ) ),
77  RR( _( "Footprints Front" ),LAYER_MOD_FR, COLOR4D::UNSPECIFIED, _( "Show footprints that are on board's front") ),
78  RR( _( "Footprints Back" ), LAYER_MOD_BK, COLOR4D::UNSPECIFIED, _( "Show footprints that are on board's back") ),
79  RR( _( "Values" ), LAYER_MOD_VALUES, COLOR4D::UNSPECIFIED, _( "Show footprint's values") ),
80  RR( _( "References" ), LAYER_MOD_REFERENCES, COLOR4D::UNSPECIFIED, _( "Show footprint's references") ),
81 };
82 
83 static int s_allowed_in_FpEditor[] =
84 {
87 };
88 
89 
90 PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwner,
91  int aPointSize, bool aFpEditorMode ) :
92  LAYER_WIDGET( aParent, aFocusOwner, aPointSize ),
93  myframe( aParent )
94 {
96  m_fp_editor_mode = aFpEditorMode;
97  ReFillRender();
98 
99  // Update default tabs labels
101 
102  //-----<Popup menu>-------------------------------------------------
103  // handle the popup menu over the layer window.
104  m_LayerScrolledWindow->Connect( wxEVT_RIGHT_DOWN,
105  wxMouseEventHandler( PCB_LAYER_WIDGET::onRightDownLayers ), NULL, this );
106 
107  // since Popupmenu() calls this->ProcessEvent() we must call this->Connect()
108  // and not m_LayerScrolledWindow->Connect()
109 
111  wxEVT_COMMAND_MENU_SELECTED,
112  wxCommandEventHandler( PCB_LAYER_WIDGET::onPopupSelection ), NULL, this );
113  // install the right click handler into each control at end of ReFill()
114  // using installRightLayerClickHandler
115 }
116 
117 
119 {
120  return myframe->IsGalCanvasActive();
121 }
122 
123 
125 {
126  for( unsigned ii = 0; ii < DIM( s_allowed_in_FpEditor ); ii++ )
127  if( s_allowed_in_FpEditor[ii] == aId )
128  return true;
129 
130  return false;
131 }
132 
133 
135 {
136  static LSET allowed = LSET::AllTechMask();
137  // Currently not in use because putting a graphic item on a copper layer
138  // is not currently supported by DRC.
139  // allowed.set( F_Cu ).set( B_Cu );
140  return allowed.test( aLayer );
141 }
142 
143 
145 {
146  int rowCount = GetLayerRowCount();
147 
148  for( int row=0; row < rowCount; ++row )
149  {
150  for( int col=0; col<LYR_COLUMN_COUNT; ++col )
151  {
152  wxWindow* w = getLayerComp( row, col );
153 
154  w->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler(
155  PCB_LAYER_WIDGET::onRightDownLayers ), NULL, this );
156  }
157  }
158 }
159 
160 
161 void PCB_LAYER_WIDGET::onRightDownLayers( wxMouseEvent& event )
162 {
163  wxMenu menu;
164 
165  // menu text is capitalized:
166  // http://library.gnome.org/devel/hig-book/2.20/design-text-labels.html.en#layout-capitalization
168  _( "Show All Copper Layers" ),
169  KiBitmap( select_layer_pair_xpm ) );
171  _( "Hide All Copper Layers But Active" ),
172  KiBitmap( select_w_layer_xpm ) );
174  _( "Always Hide All Copper Layers But Active" ),
175  KiBitmap( select_w_layer_xpm ) );
177  _( "Hide All Copper Layers" ),
178  KiBitmap( show_no_copper_layers_xpm ) );
179 
180  menu.AppendSeparator();
181 
182  AddMenuItem( &menu, ID_SHOW_NO_LAYERS, _( "Hide All Layers" ),
183  KiBitmap( show_no_layers_xpm ) );
184  AddMenuItem( &menu, ID_SHOW_ALL_LAYERS, _( "Show All Layers" ),
185  KiBitmap( show_all_layers_xpm ) );
186 
187  PopupMenu( &menu );
188 
189  passOnFocus();
190 }
191 
192 
193 void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
194 {
195  int rowCount;
196  int menuId = event.GetId();
197  bool visible;
198  bool force_active_layer_visible;
199 
201  force_active_layer_visible = ( menuId == ID_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE ||
203 
204  switch( menuId )
205  {
206 
207  case ID_SHOW_NO_LAYERS:
208  case ID_SHOW_ALL_LAYERS:
209  visible = menuId == ID_SHOW_ALL_LAYERS;
210  rowCount = GetLayerRowCount();
211 
212  for( int row=0; row<rowCount; ++row )
213  {
214  bool isLast;
215  wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
216  PCB_LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
217  cb->SetValue( visible );
218 
219  isLast = row == rowCount-1;
220 
221  OnLayerVisible( layer, visible, isLast );
222 
223  if( isLast )
224  break;
225  }
226  break;
227 
232 
233  // Search the last copper layer row index:
234  int lastCu = -1;
235  rowCount = GetLayerRowCount();
236  for( int row = rowCount-1; row>=0; --row )
237  {
238  wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
239  PCB_LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
240 
241  if( IsCopperLayer( layer ) )
242  {
243  lastCu = row;
244  break;
245  }
246  }
247 
248  // Enable/disable the copper layers visibility:
249  for( int row=0; row<rowCount; ++row )
250  {
251  wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
252  PCB_LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
253 
254  if( IsCopperLayer( layer ) )
255  {
256  visible = menuId == ID_SHOW_ALL_COPPER_LAYERS;
257 
258  if( force_active_layer_visible && (layer == myframe->GetActiveLayer() ) )
259  visible = true;
260 
261  cb->SetValue( visible );
262 
263  bool isLastCopperLayer = (row == lastCu);
264  OnLayerVisible( layer, visible, isLastCopperLayer );
265 
266  if( isLastCopperLayer )
267  break;
268  }
269  }
270  break;
271 
272  }
273 }
274 
275 
277 {
278  m_notebook->SetPageText( 0, _( "Layer" ) );
279  m_notebook->SetPageText( 1, _( "Render" ) );
280 }
281 
282 
284 {
285  BOARD* board = myframe->GetBoard();
286  ClearRenderRows();
287 
288  // Add "Render" tab rows to LAYER_WIDGET, after setting color and checkbox state.
289  // Because s_render_rows is created static, we must explicitly call
290  // wxGetTranslation for texts which are internationalized (tool tips
291  // and item names)
292  for( unsigned row=0; row<DIM(s_render_rows); ++row )
293  {
294  LAYER_WIDGET::ROW renderRow = s_render_rows[row];
295 
296  if( m_fp_editor_mode && !isAllowedInFpMode( renderRow.id ) )
297  continue;
298 
299  renderRow.tooltip = wxGetTranslation( s_render_rows[row].tooltip );
300  renderRow.rowName = wxGetTranslation( s_render_rows[row].rowName );
301 
302  if( renderRow.color != COLOR4D::UNSPECIFIED ) // does this row show a color?
303  {
304  // this window frame must have an established BOARD, i.e. after SetBoard()
305  renderRow.color = board->GetVisibleElementColor( static_cast<GAL_LAYER_ID>( renderRow.id ) );
306  }
307 
308  renderRow.state = board->IsElementVisible( static_cast<GAL_LAYER_ID>( renderRow.id ) );
309 
310  AppendRenderRow( renderRow );
311  }
312 }
313 
314 
316 {
317  BOARD* board = myframe->GetBoard();
318 
319  for( unsigned row=0; row<DIM(s_render_rows); ++row )
320  {
321  int rowId = s_render_rows[row].id;
322 
323  if( m_fp_editor_mode && !isAllowedInFpMode( rowId ) )
324  continue;
325 
326  // this does not fire a UI event
327  SetRenderState( rowId, board->IsElementVisible( static_cast<GAL_LAYER_ID>( rowId ) ) );
328  }
329 }
330 
331 
333 {
334  BOARD* board = myframe->GetBoard();
335  int count = GetLayerRowCount();
336 
337  for( int row=0; row<count; ++row )
338  {
339  // this utilizes more implementation knowledge than ideal, eventually
340  // add member ROW getRow() or similar to base LAYER_WIDGET.
341 
342  wxWindow* w = getLayerComp( row, COLUMN_ICON_ACTIVE );
343 
344  PCB_LAYER_ID layerId = ToLAYER_ID( getDecodedId( w->GetId() ) );
345 
346  // this does not fire a UI event
347  SetLayerVisible( layerId, board->IsLayerVisible( layerId ) );
348  }
349 }
350 
351 
353 {
354  BOARD* brd = myframe->GetBoard();
355  LSET enabled = brd->GetEnabledLayers();
356 
357  ClearLayerRows();
358 
359  wxString dsc;
360 
361  // show all coppers first, with front on top, back on bottom, then technical layers
362  for( LSEQ cu_stack = enabled.CuStack(); cu_stack; ++cu_stack )
363  {
364  PCB_LAYER_ID layer = *cu_stack;
365 
366  switch( layer )
367  {
368  case F_Cu:
369  dsc = _( "Front copper layer" );
370  break;
371 
372  case B_Cu:
373  dsc = _( "Back copper layer" );
374  break;
375 
376  default:
377  dsc = _( "Inner copper layer" );
378  break;
379  }
380 
382  brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ),
383  dsc, true ) );
384 
385  if( m_fp_editor_mode && !isLayerAllowedInFpMode( layer ) )
386  {
387  getLayerComp( GetLayerRowCount()-1, COLUMN_COLOR_LYRNAME )->Enable( false );
389  COLUMN_COLORBM )->SetToolTip( wxEmptyString );
390  }
391  }
392 
393 
394  // technical layers are shown in this order:
395  // Because they are static, wxGetTranslation must be explicitly
396  // called for tooltips.
397  static const struct {
398  PCB_LAYER_ID layerId;
399  wxString tooltip;
400  } non_cu_seq[] = {
401  { F_Adhes, _( "Adhesive on board's front" ) },
402  { B_Adhes, _( "Adhesive on board's back" ) },
403  { F_Paste, _( "Solder paste on board's front" ) },
404  { B_Paste, _( "Solder paste on board's back" ) },
405  { F_SilkS, _( "Silkscreen on board's front" ) },
406  { B_SilkS, _( "Silkscreen on board's back" ) },
407  { F_Mask, _( "Solder mask on board's front" ) },
408  { B_Mask, _( "Solder mask on board's back" ) },
409  { Dwgs_User, _( "Explanatory drawings" ) },
410  { Cmts_User, _( "Explanatory comments" ) },
411  { Eco1_User, _( "User defined meaning" ) },
412  { Eco2_User, _( "User defined meaning" ) },
413  { Edge_Cuts, _( "Board's perimeter definition" ) },
414  { Margin, _( "Board's edge setback outline" ) },
415  { F_CrtYd, _( "Footprint courtyards on board's front" ) },
416  { B_CrtYd, _( "Footprint courtyards on board's back" ) },
417  { F_Fab, _( "Footprint assembly on board's front" ) },
418  { B_Fab, _( "Footprint assembly on board's back" ) }
419  };
420 
421  for( unsigned i=0; i<DIM( non_cu_seq ); ++i )
422  {
423  PCB_LAYER_ID layer = non_cu_seq[i].layerId;
424 
425  if( !enabled[layer] )
426  continue;
427 
429  brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ),
430  wxGetTranslation( non_cu_seq[i].tooltip ), true ) );
431 
432  if( m_fp_editor_mode && !isLayerAllowedInFpMode( layer ) )
433  {
434  getLayerComp( GetLayerRowCount()-1, COLUMN_COLOR_LYRNAME )->Enable( false );
436  COLUMN_COLORBM )->SetToolTip( wxEmptyString );
437  }
438  }
439 
441 }
442 
443 
444 //-----<LAYER_WIDGET callbacks>-------------------------------------------
445 
447 {
448  myframe->GetBoard()->SetLayerColor( ToLAYER_ID( aLayer ), aColor );
449 
450  if( myframe->IsGalCanvasActive() )
451  {
452  KIGFX::VIEW* view = myframe->GetGalCanvas()->GetView();
454  view->UpdateLayerColor( aLayer );
455  view->UpdateLayerColor( GetNetnameLayer( aLayer ) );
456  }
457 
458  myframe->GetCanvas()->Refresh();
459 }
460 
461 
463 {
464  // the layer change from the PCB_LAYER_WIDGET can be denied by returning
465  // false from this function.
466  PCB_LAYER_ID layer = ToLAYER_ID( aLayer );
467 
468  if( m_fp_editor_mode && !isLayerAllowedInFpMode( layer ) )
469  return false;
470 
471  myframe->SetActiveLayer( layer );
473 
475  OnLayerSelected();
476  else if( displ_opts->m_ContrastModeDisplay )
477  myframe->GetCanvas()->Refresh();
478 
479  return true;
480 }
481 
482 
484 {
486  return false;
487 
488  // postprocess after an active layer selection
489  // ensure active layer visible
490  wxCommandEvent event;
492  onPopupSelection( event );
493 
494  return true;
495 }
496 
497 
498 void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal )
499 {
500  BOARD* brd = myframe->GetBoard();
501 
502  LSET visibleLayers = brd->GetVisibleLayers();
503 
504  visibleLayers.set( aLayer, isVisible );
505 
506  brd->SetVisibleLayers( visibleLayers );
507 
508  EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
509 
510  if( galCanvas )
511  galCanvas->GetView()->SetLayerVisible( aLayer, isVisible );
512 
513  if( isFinal )
514  myframe->GetCanvas()->Refresh();
515 }
516 
517 
519 {
520  wxASSERT( aId > GAL_LAYER_ID_START && aId < GAL_LAYER_ID_END );
521 
522  BOARD* brd = myframe->GetBoard();
523  brd->SetVisibleElementColor( static_cast<GAL_LAYER_ID>( aId ), aColor );
524 
525  EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
526 
527  if( galCanvas && myframe->IsGalCanvasActive() )
528  {
529  KIGFX::VIEW* view = galCanvas->GetView();
531  view->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); // useful to update rastnest
532  view->UpdateLayerColor( aId );
533  galCanvas->Refresh();
534  }
535 
536  myframe->GetCanvas()->Refresh();
537 }
538 
539 
540 void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
541 {
542  BOARD* brd = myframe->GetBoard();
543  wxASSERT( aId > GAL_LAYER_ID_START && aId < GAL_LAYER_ID_END );
544 
545  // The layer visibility status is saved in the board file so set the board modified
546  // state so the user has the option to save the changes.
547  if( brd->IsElementVisible( static_cast<GAL_LAYER_ID>( aId ) ) != isEnabled )
548  myframe->OnModify();
549 
550  brd->SetElementVisibility( static_cast<GAL_LAYER_ID>( aId ), isEnabled );
551 
552  EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
553 
554  if( galCanvas && myframe->IsGalCanvasActive() )
555  {
556  if( aId == LAYER_GRID )
557  {
558  galCanvas->GetGAL()->SetGridVisibility( myframe->IsGridVisible() );
560  }
561  else
562  galCanvas->GetView()->SetLayerVisible( aId, isEnabled );
563 
564  galCanvas->Refresh();
565  }
566 
567  myframe->GetCanvas()->Refresh();
568 }
569 
570 //-----</LAYER_WIDGET callbacks>------------------------------------------
#define ID_SHOW_NO_COPPER_LAYERS
COLOR4D GetLayerColor(PCB_LAYER_ID aLayer) const
Function GetLayerColor gets a layer color for any valid layer, including non-copper ones...
#define COLUMN_COLOR_LYRNAME
Definition: layer_widget.h:53
#define DIM(x)
of elements in an array
Definition: macros.h:98
void SetLayerColor(PCB_LAYER_ID aLayer, COLOR4D aColor)
Function SetLayerColor changes a layer color for any valid layer, including non-copper ones...
wxAuiNotebook * m_notebook
Definition: layer_widget.h:107
#define LYR_COLUMN_COUNT
Layer tab column count.
Definition: layer_widget.h:47
to draw blind/buried vias
show a marker on pads with no nets
bool IsElementVisible(GAL_LAYER_ID LAYER_aPCB) const
Function IsElementVisible tests whether a given element category is visible.
#define RR
Struct ROW provides all the data needed to add a row to a LAYER_WIDGET.
Definition: layer_widget.h:84
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
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:299
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
#define ID_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE
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...
COLOR4D GetVisibleElementColor(GAL_LAYER_ID LAYER_aPCB)
Function GetVisibleElementColor returns the color of a pcb visible element.
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
Add new GAL layers here.
static LSET AllTechMask()
Function AllTechMask returns a mask holding all technical layers (no CU layer) on both side...
Definition: lset.cpp:709
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
bool state
initial wxCheckBox state
Definition: layer_widget.h:89
virtual bool IsGridVisible() const
Function IsGridVisible() , virtual.
Definition: draw_frame.h:416
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:90
Auxiliary rendering target (noncached)
Definition: definitions.h:42
This file contains miscellaneous commonly used macros and functions.
#define ID_ALWAYS_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE
show modules on front
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:88
KIGFX::GAL * GetGAL() const
Function GetGAL() Returns a pointer to the GAL instance used in the panel.
PCB_LAYER_ID
A quick note on layer IDs:
#define COLUMN_ICON_ACTIVE
Definition: layer_widget.h:50
bool isAllowedInFpMode(int aId)
Function isAllowedInFpMode.
Class LSET is a set of PCB_LAYER_IDs.
static int s_allowed_in_FpEditor[]
#define COLUMN_COLORBM
Definition: layer_widget.h:51
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:575
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...
to draw usual through hole vias
Classes and definitions used in Pcbnew.
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.
COLORS_DESIGN_SETTINGS * GetColorsSettings() const
Function GetColorSettings.
Definition: class_board.h:561
void SetElementVisibility(GAL_LAYER_ID LAYER_aPCB, bool aNewState)
Function SetElementVisibility changes the visibility of an element category.
void ReFillRender()
Function ReFillRender rebuilds Render for instance after the config is read.
#define ID_SHOW_ALL_COPPER_LAYERS
bool m_ContrastModeDisplay
Definition: pcbstruct.h:85
wxScrolledWindow * m_LayerScrolledWindow
Definition: layer_widget.h:109
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:795
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
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...
Class DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
Definition: pcbstruct.h:62
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:656
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:76
void SyncLayerVisibilities()
Function SyncLayerVisibilities updates each "Layer" checkbox in this layer widget according to each l...
smd pads, front layer
see class PGM_BASE
void SetVisibleElementColor(GAL_LAYER_ID LAYER_aPCB, COLOR4D aColor)
#define COLUMN_COLOR_LYR_CB
Definition: layer_widget.h:52
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:166
wxString rowName
the prompt or layername
Definition: layer_widget.h:86
LSET GetVisibleLayers() const
Function GetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
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:803
void installRightLayerClickHandler()
this is for the popup menu, the right click handler has to be installed on every child control within...
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...
int id
either a layer or "visible element" id
Definition: layer_widget.h:87
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:767
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:440
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39