KiCad PCB EDA Suite
PCB_LAYER_WIDGET Class Reference

Class PCB_LAYER_WIDGET is here to implement the abstract functions of LAYER_WIDGET so they may be tied into the PCB_EDIT_FRAME's data and so we can add a popup menu which is specific to PCBNEW's needs. More...

#include <pcb_layer_widget.h>

Inheritance diagram for PCB_LAYER_WIDGET:
LAYER_WIDGET

Public Member Functions

 PCB_LAYER_WIDGET (PCB_BASE_FRAME *aParent, wxWindow *aFocusOwner, bool aFpEditorMode=false)
 Constructor. More...
 
void ReFill ()
 
void ReFillRender ()
 Function ReFillRender rebuilds Render for instance after the config is read. More...
 
void SyncLayerVisibilities ()
 Function SyncLayerVisibilities updates each "Layer" checkbox in this layer widget according to each layer's current visibility determined by IsLayerVisible(), and is helpful immediately after loading a BOARD which may have state information in it. More...
 
void SyncLayerAlphaIndicators ()
 Function SyncLayerAlphaIndicators updates each "Layer"s alpha indicator to show if the board is currently being rendered with more transparency or less. More...
 
void SetLayersManagerTabsText ()
 Function SetLayersManagerTabsText Update the layer manager tabs labels Useful when changing Language or to set labels to a non default value. More...
 
void OnLayerColorChange (int aLayer, COLOR4D aColor) override
 Function OnLayerColorChange is called to notify client code about a layer color change. More...
 
bool OnLayerSelect (int aLayer) override
 Function OnLayerSelect is called to notify client code whenever the user selects a different layer. More...
 
void OnLayerVisible (int aLayer, bool isVisible, bool isFinal) override
 Function OnLayerVisible is called to notify client code about a layer visibility change. More...
 
void OnLayerRightClick (wxMenu &aMenu) override
 Function OnLayerRightClick is called to notify client code about a layer being right-clicked. More...
 
void OnRenderColorChange (int aId, COLOR4D aColor) override
 Function OnRenderColorChange is called to notify client code whenever the user changes a rendering color. More...
 
void OnRenderEnable (int aId, bool isEnabled) override
 Function OnRenderEnable is called to notify client code whenever the user changes an rendering enable in one of the rendering checkboxes. More...
 
bool OnLayerSelected ()
 Function OnLayerSelected ensure the active layer is visible, and other layers not visible when m_alwaysShowActiveLayer is true Otherwise do nothing. More...
 
void AddRightClickMenuItems (wxMenu &menu)
 Function addRightClickMenuItems add menu items to a menu that should be shown when right-clicking the PCB layer widget. More...
 
wxSize GetBestSize () const
 Function GetBestSize returns the preferred minimum size, taking into consideration the dynamic content. More...
 
int GetLayerRowCount () const
 Function GetLayerRowCount returns the number of rows in the layer tab. More...
 
int GetRenderRowCount () const
 Function GetRenderRowCount returns the number of rows in the render tab. More...
 
void AppendLayerRow (const ROW &aRow)
 Function AppendLayerRow appends a new row in the layer portion of the widget. More...
 
void AppendLayerRows (const ROW *aRowsArray, int aRowCount)
 Function AppendLayerRows appends new rows in the layer portion of the widget. More...
 
void ClearLayerRows ()
 Function ClearLayerRows empties out the layer rows. More...
 
void AppendRenderRow (const ROW &aRow)
 Function AppendRenderRow appends a new row in the render portion of the widget. More...
 
void AppendRenderRows (const ROW *aRowsArray, int aRowCount)
 Function AppendRenderRows appends new rows in the render portion of the widget. More...
 
void ClearRenderRows ()
 Function ClearRenderRows empties out the render rows. More...
 
void SelectLayerRow (int aRow)
 Function SelectLayerRow changes the row selection in the layer list to the given row. More...
 
void SelectLayer (LAYER_NUM aLayer)
 Function SelectLayer changes the row selection in the layer list to aLayer provided. More...
 
LAYER_NUM GetSelectedLayer ()
 Function GetSelectedLayer returns the selected layer or -1 if none. More...
 
void SetLayerVisible (LAYER_NUM aLayer, bool isVisible)
 Function SetLayerVisible sets aLayer visible or not. More...
 
bool IsLayerVisible (LAYER_NUM aLayer)
 Function IsLayerVisible returns the visible state of the layer ROW associated with aLayer id. More...
 
void SetLayerColor (LAYER_NUM aLayer, COLOR4D aColor)
 Function SetLayerColor changes the color of aLayer. More...
 
COLOR4D GetLayerColor (LAYER_NUM aLayer) const
 Function GetLayerColor returns the color of the layer ROW associated with aLayer id. More...
 
void SetRenderState (int aId, bool isSet)
 Function SetRenderState sets the state of the checkbox associated with aId within the Render tab group of the widget. More...
 
bool GetRenderState (int aId)
 Function GetRenderState returns the state of the checkbox associated with aId. More...
 
void UpdateLayouts ()
 
void UpdateLayerIcons ()
 Function UpdateLayerIcons Update all layer manager icons (layers only) Useful when loading a file or clearing a layer because they change, and the indicator arrow icon needs to be updated. More...
 

Static Public Attributes

static const wxEventType EVT_LAYER_COLOR_CHANGE = wxNewEventType()
 

Protected Types

enum  POPUP_ID {
  ID_SHOW_ALL_COPPER_LAYERS = LAYER_WIDGET::ID_LAST_VALUE, ID_SHOW_NO_COPPER_LAYERS, ID_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE, ID_ALWAYS_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE,
  ID_SHOW_NO_LAYERS, ID_SHOW_ALL_LAYERS, ID_SHOW_ALL_FRONT, ID_SHOW_ALL_BACK,
  ID_HIDE_ALL_NON_COPPER, ID_SHOW_ALL_NON_COPPER, ID_LAST_VALUE
}
 

Protected Member Functions

virtual COLOR4D getBackgroundLayerColor () override
 Subclasses can override this to provide accurate representation of transparent colour swatches. More...
 
bool isAllowedInFpMode (int aId)
 Function isAllowedInFpMode. More...
 
bool isLayerAllowedInFpMode (PCB_LAYER_ID aLayer)
 Function isLayerAllowedInFpMode. More...
 
void onRightDownLayers (wxMouseEvent &event)
 Function OnRightDownLayers puts up a popup menu for the layer panel. More...
 
void onPopupSelection (wxCommandEvent &event)
 
void installRightLayerClickHandler ()
 this is for the popup menu, the right click handler has to be installed on every child control within the layer panel. More...
 
virtual bool useAlternateBitmap (int aRow)
 Virtual Function useAlternateBitmap. More...
 
void OnLeftDownLayers (wxMouseEvent &event)
 
void OnRightDownLayer (wxMouseEvent &event, COLOR_SWATCH *aColorSwatch, const wxString &aLayerName)
 Function OnRightDownLayer Called when user right-clicks a layer. More...
 
void OnLayerSwatchChanged (wxCommandEvent &aEvent)
 Function OnSwatchChanged() is called when a user changes a swatch color. More...
 
void OnLayerCheckBox (wxCommandEvent &event)
 Function OnLayerCheckBox handles the "is layer visible" checkbox and propogates the event to the client's notification function. More...
 
void OnRightDownRender (wxMouseEvent &aEvent, COLOR_SWATCH *aColorSwatch, const wxString &aRenderName)
 Function OnRightDownRender Called when user right-clicks a render option. More...
 
void OnRenderSwatchChanged (wxCommandEvent &aEvent)
 Function OnRenderSwatchChanged Called when user has changed the swatch color of a render entry. More...
 
void OnRenderCheckBox (wxCommandEvent &event)
 
void OnTabChange (wxNotebookEvent &event)
 
wxWindow * getLayerComp (int aRow, int aColumn) const
 Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL if these parameters are out of range. More...
 
wxWindow * getRenderComp (int aRow, int aColumn) const
 
int findLayerRow (LAYER_NUM aLayer) const
 Function findLayerRow returns the row index that aLayer resides in, or -1 if not found. More...
 
int findRenderRow (int aId) const
 
void insertLayerRow (int aRow, const ROW &aSpec)
 Function insertLayerRow appends or inserts a new row in the layer portion of the widget. More...
 
void insertRenderRow (int aRow, const ROW &aSpec)
 
void setLayerCheckbox (LAYER_NUM aLayer, bool isVisible)
 
void passOnFocus ()
 Function passOnFocus gives away the keyboard focus up to the main parent window. More...
 

Static Protected Member Functions

static int encodeId (int aColumn, int aId)
 Function encodeId is here to allow saving a layer index within a control as its wxControl id, but to do so in a way that all child wxControl ids within a wxWindow are unique, since this is required by Windows. More...
 
static LAYER_NUM getDecodedId (int aControlId)
 Function getDecodedId decodes aControlId to original un-encoded value. More...
 

Protected Attributes

bool m_alwaysShowActiveCopperLayer
 
bool m_fp_editor_mode
 
PCB_BASE_FRAMEmyframe
 
wxAuiNotebook * m_notebook
 
wxPanel * m_LayerPanel
 
wxScrolledWindow * m_LayerScrolledWindow
 
wxFlexGridSizer * m_LayersFlexGridSizer
 
wxPanel * m_RenderingPanel
 
wxScrolledWindow * m_RenderScrolledWindow
 
wxFlexGridSizer * m_RenderFlexGridSizer
 
wxWindow * m_FocusOwner
 
int m_CurrentRow
 selected row of layer list More...
 
int m_PointSize
 
ROW_ICON_PROVIDERm_IconProvider
 

Static Protected Attributes

static const LAYER_WIDGET::ROW s_render_rows []
 This is a read only template that is copied and modified before adding to LAYER_WIDGET. More...
 

Detailed Description

Class PCB_LAYER_WIDGET is here to implement the abstract functions of LAYER_WIDGET so they may be tied into the PCB_EDIT_FRAME's data and so we can add a popup menu which is specific to PCBNEW's needs.

Definition at line 42 of file pcb_layer_widget.h.

Member Enumeration Documentation

◆ POPUP_ID

Enumerator
ID_SHOW_ALL_COPPER_LAYERS 
ID_SHOW_NO_COPPER_LAYERS 
ID_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE 
ID_ALWAYS_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE 
ID_SHOW_NO_LAYERS 
ID_SHOW_ALL_LAYERS 
ID_SHOW_ALL_FRONT 
ID_SHOW_ALL_BACK 
ID_HIDE_ALL_NON_COPPER 
ID_SHOW_ALL_NON_COPPER 
ID_LAST_VALUE 

Definition at line 125 of file pcb_layer_widget.h.

Constructor & Destructor Documentation

◆ PCB_LAYER_WIDGET()

PCB_LAYER_WIDGET::PCB_LAYER_WIDGET ( PCB_BASE_FRAME aParent,
wxWindow *  aFocusOwner,
bool  aFpEditorMode = false 
)

Constructor.

Parameters
aParentis the parent window
aFocusOwneris the window that should be sent the focus after
aFpEditorModefalse for the board editor (default), true for fp editor when true, some options or layers which cannot be used in editor mode are not displayed

Definition at line 102 of file pcb_layer_widget.cpp.

103  :
104  LAYER_WIDGET( aParent, aFocusOwner ),
105  myframe( aParent )
106 {
108  m_fp_editor_mode = aFpEditorMode;
109 
110  // Update default tabs labels
112 
113  //-----<Popup menu>-------------------------------------------------
114  // handle the popup menu over the layer window.
115  m_LayerScrolledWindow->Connect( wxEVT_RIGHT_DOWN,
116  wxMouseEventHandler( PCB_LAYER_WIDGET::onRightDownLayers ), NULL, this );
117 
118  // since Popupmenu() calls this->ProcessEvent() we must call this->Connect()
119  // and not m_LayerScrolledWindow->Connect()
120 
122  wxEVT_COMMAND_MENU_SELECTED,
123  wxCommandEventHandler( PCB_LAYER_WIDGET::onPopupSelection ), NULL, this );
124 }
PCB_BASE_FRAME * myframe
void SetLayersManagerTabsText()
Function SetLayersManagerTabsText Update the layer manager tabs labels Useful when changing Language ...
wxScrolledWindow * m_LayerScrolledWindow
Definition: layer_widget.h:129
void onRightDownLayers(wxMouseEvent &event)
Function OnRightDownLayers puts up a popup menu for the layer panel.
bool m_alwaysShowActiveCopperLayer
LAYER_WIDGET(wxWindow *aParent, wxWindow *aFocusOwner, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
Constructor.
void onPopupSelection(wxCommandEvent &event)

References ID_LAST_VALUE, ID_SHOW_ALL_COPPER_LAYERS, m_alwaysShowActiveCopperLayer, m_fp_editor_mode, LAYER_WIDGET::m_LayerScrolledWindow, onPopupSelection(), onRightDownLayers(), and SetLayersManagerTabsText().

Member Function Documentation

◆ AddRightClickMenuItems()

void PCB_LAYER_WIDGET::AddRightClickMenuItems ( wxMenu &  menu)

Function addRightClickMenuItems add menu items to a menu that should be shown when right-clicking the PCB layer widget.

Definition at line 151 of file pcb_layer_widget.cpp.

152 {
153  // menu text is capitalized:
154  // http://library.gnome.org/devel/hig-book/2.20/design-text-labels.html.en#layout-capitalization
156  _( "Show All Copper Layers" ),
157  KiBitmap( select_layer_pair_xpm ) );
159  _( "Hide All Copper Layers But Active" ),
160  KiBitmap( select_w_layer_xpm ) );
162  _( "Always Hide All Copper Layers But Active" ),
163  KiBitmap( select_w_layer_xpm ) );
165  _( "Hide All Copper Layers" ),
166  KiBitmap( show_no_copper_layers_xpm ) );
167 
168  menu.AppendSeparator();
169 
171  _( "Show All Non Copper Layers" ),
172  KiBitmap( select_w_layer_xpm ) );
174  _( "Hide All Non Copper Layers" ),
175  KiBitmap( show_no_copper_layers_xpm ) );
176 
177  menu.AppendSeparator();
178 
179  AddMenuItem( &menu, ID_SHOW_NO_LAYERS, _( "Hide All Layers" ),
180  KiBitmap( show_no_layers_xpm ) );
181  AddMenuItem( &menu, ID_SHOW_ALL_LAYERS, _( "Show All Layers" ),
182  KiBitmap( show_all_layers_xpm ) );
183 
184  menu.AppendSeparator();
185 
186  AddMenuItem( &menu, ID_SHOW_ALL_FRONT, _( "Show All Front Layers" ),
187  KiBitmap( show_no_layers_xpm ) );
188 
189  AddMenuItem( &menu, ID_SHOW_ALL_BACK, _( "Show All Back Layers" ),
190  KiBitmap( show_all_layers_xpm ) );
191 }
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:251
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
#define _(s)

References _, AddMenuItem(), ID_ALWAYS_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE, ID_HIDE_ALL_NON_COPPER, ID_SHOW_ALL_BACK, ID_SHOW_ALL_COPPER_LAYERS, ID_SHOW_ALL_FRONT, ID_SHOW_ALL_LAYERS, ID_SHOW_ALL_NON_COPPER, ID_SHOW_NO_COPPER_LAYERS, ID_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE, ID_SHOW_NO_LAYERS, and KiBitmap().

Referenced by OnLayerRightClick(), and onRightDownLayers().

◆ AppendLayerRow()

void LAYER_WIDGET::AppendLayerRow ( const ROW aRow)
inherited

Function AppendLayerRow appends a new row in the layer portion of the widget.

The user must ensure that ROW::id is unique for all existing rows on Windows.

Definition at line 609 of file layer_widget.cpp.

610 {
611  int nextRow = GetLayerRowCount();
612  insertLayerRow( nextRow, aRow );
613 }
int GetLayerRowCount() const
Function GetLayerRowCount returns the number of rows in the layer tab.
void insertLayerRow(int aRow, const ROW &aSpec)
Function insertLayerRow appends or inserts a new row in the layer portion of the widget.

References LAYER_WIDGET::GetLayerRowCount(), and LAYER_WIDGET::insertLayerRow().

Referenced by LAYER_WIDGET::AppendLayerRows(), ReFill(), and GERBER_LAYER_WIDGET::ReFill().

◆ AppendLayerRows()

void LAYER_WIDGET::AppendLayerRows ( const ROW aRowsArray,
int  aRowCount 
)
inlineinherited

Function AppendLayerRows appends new rows in the layer portion of the widget.

The user must ensure that ROW::id is unique for all existing rows on Windows.

Definition at line 304 of file layer_widget.h.

305  {
306  for( int row=0; row<aRowCount; ++row )
307  AppendLayerRow( aRowsArray[row] );
308 
309  UpdateLayouts();
310  }
void UpdateLayouts()
void AppendLayerRow(const ROW &aRow)
Function AppendLayerRow appends a new row in the layer portion of the widget.

References LAYER_WIDGET::AppendLayerRow(), and LAYER_WIDGET::UpdateLayouts().

◆ AppendRenderRow()

void LAYER_WIDGET::AppendRenderRow ( const ROW aRow)
inherited

Function AppendRenderRow appends a new row in the render portion of the widget.

The user must ensure that ROW::id is unique for all existing rows on Windows.

Definition at line 622 of file layer_widget.cpp.

623 {
624  int nextRow = GetRenderRowCount();
625  insertRenderRow( nextRow, aRow );
626 }
void insertRenderRow(int aRow, const ROW &aSpec)
int GetRenderRowCount() const
Function GetRenderRowCount returns the number of rows in the render tab.

References LAYER_WIDGET::GetRenderRowCount(), and LAYER_WIDGET::insertRenderRow().

Referenced by LAYER_WIDGET::AppendRenderRows(), and ReFillRender().

◆ AppendRenderRows()

void LAYER_WIDGET::AppendRenderRows ( const ROW aRowsArray,
int  aRowCount 
)
inlineinherited

Function AppendRenderRows appends new rows in the render portion of the widget.

The user must ensure that ROW::id is unique for all existing rows on Windows.

Definition at line 330 of file layer_widget.h.

331  {
332  for( int row=0; row<aRowCount; ++row )
333  AppendRenderRow( aRowsArray[row] );
334 
335  UpdateLayouts();
336  }
void UpdateLayouts()
void AppendRenderRow(const ROW &aRow)
Function AppendRenderRow appends a new row in the render portion of the widget.

References LAYER_WIDGET::AppendRenderRow(), and LAYER_WIDGET::UpdateLayouts().

Referenced by GERBER_LAYER_WIDGET::ReFillRender().

◆ ClearLayerRows()

void LAYER_WIDGET::ClearLayerRows ( )
inherited

Function ClearLayerRows empties out the layer rows.

Definition at line 616 of file layer_widget.cpp.

617 {
618  m_LayersFlexGridSizer->Clear( true );
619 }
wxFlexGridSizer * m_LayersFlexGridSizer
Definition: layer_widget.h:130

References LAYER_WIDGET::m_LayersFlexGridSizer.

Referenced by ReFill(), and GERBER_LAYER_WIDGET::ReFill().

◆ ClearRenderRows()

void LAYER_WIDGET::ClearRenderRows ( )
inherited

Function ClearRenderRows empties out the render rows.

Definition at line 629 of file layer_widget.cpp.

630 {
631  m_RenderFlexGridSizer->Clear( true );
632 }
wxFlexGridSizer * m_RenderFlexGridSizer
Definition: layer_widget.h:133

References LAYER_WIDGET::m_RenderFlexGridSizer.

Referenced by ReFillRender(), and GERBER_LAYER_WIDGET::ReFillRender().

◆ encodeId()

int LAYER_WIDGET::encodeId ( int  aColumn,
int  aId 
)
staticprotectedinherited

Function encodeId is here to allow saving a layer index within a control as its wxControl id, but to do so in a way that all child wxControl ids within a wxWindow are unique, since this is required by Windows.

See also
getDecodedId()

Definition at line 63 of file layer_widget.cpp.

64 {
65  int id = aId * LYR_COLUMN_COUNT + aColumn;
66  return id;
67 }
#define LYR_COLUMN_COUNT
Layer tab column count.
Definition: layer_widget.h:49

References LYR_COLUMN_COUNT.

Referenced by LAYER_WIDGET::insertLayerRow(), and LAYER_WIDGET::insertRenderRow().

◆ findLayerRow()

int LAYER_WIDGET::findLayerRow ( LAYER_NUM  aLayer) const
protectedinherited

Function findLayerRow returns the row index that aLayer resides in, or -1 if not found.

Definition at line 265 of file layer_widget.cpp.

266 {
267  int count = GetLayerRowCount();
268 
269  for( int row = 0; row < count; ++row )
270  {
271  // column 0 in the layer scroll window has a wxStaticBitmap, get its ID.
272  wxWindow* w = getLayerComp( row, 0 );
273  wxASSERT( w );
274 
275  if( aLayer == getDecodedId( w->GetId() ))
276  return row;
277  }
278 
279  return -1;
280 }
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...
static LAYER_NUM getDecodedId(int aControlId)
Function getDecodedId decodes aControlId to original un-encoded value.
int GetLayerRowCount() const
Function GetLayerRowCount returns the number of rows in the layer tab.

References LAYER_WIDGET::getDecodedId(), LAYER_WIDGET::getLayerComp(), and LAYER_WIDGET::GetLayerRowCount().

Referenced by LAYER_WIDGET::GetLayerColor(), LAYER_WIDGET::IsLayerVisible(), LAYER_WIDGET::OnLeftDownLayers(), LAYER_WIDGET::SelectLayer(), LAYER_WIDGET::setLayerCheckbox(), and LAYER_WIDGET::SetLayerColor().

◆ findRenderRow()

int LAYER_WIDGET::findRenderRow ( int  aId) const
protectedinherited

Definition at line 294 of file layer_widget.cpp.

295 {
296  int count = GetRenderRowCount();
297 
298  for( int row = 0; row < count; ++row )
299  {
300  // column 0 in the layer scroll window has a wxStaticBitmap, get its ID.
301  wxWindow* w = getRenderComp( row, 0 );
302  wxASSERT( w );
303 
304  if( aId == getDecodedId( w->GetId() ))
305  return row;
306  }
307 
308  return -1;
309 }
wxWindow * getRenderComp(int aRow, int aColumn) const
static LAYER_NUM getDecodedId(int aControlId)
Function getDecodedId decodes aControlId to original un-encoded value.
int GetRenderRowCount() const
Function GetRenderRowCount returns the number of rows in the render tab.

References LAYER_WIDGET::getDecodedId(), LAYER_WIDGET::getRenderComp(), and LAYER_WIDGET::GetRenderRowCount().

Referenced by LAYER_WIDGET::GetRenderState(), and LAYER_WIDGET::SetRenderState().

◆ getBackgroundLayerColor()

COLOR4D PCB_LAYER_WIDGET::getBackgroundLayerColor ( )
overrideprotectedvirtual

Subclasses can override this to provide accurate representation of transparent colour swatches.

Reimplemented from LAYER_WIDGET.

Definition at line 127 of file pcb_layer_widget.cpp.

128 {
130 }
PCB_BASE_FRAME * myframe
COLOR4D GetLayerColor(LAYER_NUM aLayer) const
Function GetLayerColor.
PCB_GENERAL_SETTINGS & Settings()
COLORS_DESIGN_SETTINGS & Colors()

References PCB_GENERAL_SETTINGS::Colors(), COLORS_DESIGN_SETTINGS::GetLayerColor(), LAYER_PCB_BACKGROUND, myframe, and PCB_BASE_FRAME::Settings().

◆ GetBestSize()

wxSize LAYER_WIDGET::GetBestSize ( ) const
inherited

Function GetBestSize returns the preferred minimum size, taking into consideration the dynamic content.

Nothing in wxWidgets was reliable enough so this overrides one of their functions.

Definition at line 540 of file layer_widget.cpp.

541 {
542  // size of m_LayerScrolledWindow --------------
543  wxArrayInt widths = m_LayersFlexGridSizer->GetColWidths();
544  int totWidth = 0;
545 
546  if( widths.GetCount() )
547  {
548  for( int i = 0; i < LYR_COLUMN_COUNT; ++i )
549  {
550  totWidth += widths[i] + m_LayersFlexGridSizer->GetHGap();
551  // printf("widths[%d]:%d\n", i, widths[i] );
552  }
553  }
554 
555  // Account for the parent's frame:
556  totWidth += 15;
557 
558 
559  /* The minimum height is a small size to properly force computation
560  * of the panel's scrollbars (otherwise it will assume it *has* all
561  * this space) */
562  unsigned totHeight = 32;
563 
564  wxSize layerz( totWidth, totHeight );
565 
566  layerz += m_LayerPanel->GetWindowBorderSize();
567 
568 
569  // size of m_RenderScrolledWindow --------------
570  widths = m_RenderFlexGridSizer->GetColWidths();
571  totWidth = 0;
572 
573  if( widths.GetCount() )
574  {
575  for( int i = 0; i < RND_COLUMN_COUNT; ++i )
576  {
577  totWidth += widths[i] + m_RenderFlexGridSizer->GetHGap();
578  // printf("widths[%d]:%d\n", i, widths[i] );
579  }
580  }
581  // account for the parent's frame, this one has void space of 10 PLUS a border:
582  totWidth += 15;
583 
584  // For totHeight re-use the previous small one
585  wxSize renderz( totWidth, totHeight );
586 
587  renderz += m_RenderingPanel->GetWindowBorderSize();
588 
589  wxSize clientz( std::max(renderz.x,layerz.x), std::max(renderz.y,layerz.y) );
590 
591  return clientz;
592 }
#define LYR_COLUMN_COUNT
Layer tab column count.
Definition: layer_widget.h:49
wxFlexGridSizer * m_LayersFlexGridSizer
Definition: layer_widget.h:130
#define RND_COLUMN_COUNT
Rendering tab column count.
Definition: layer_widget.h:50
wxFlexGridSizer * m_RenderFlexGridSizer
Definition: layer_widget.h:133
wxPanel * m_RenderingPanel
Definition: layer_widget.h:131
#define max(a, b)
Definition: auxiliary.h:86
size_t i
Definition: json11.cpp:597
wxPanel * m_LayerPanel
Definition: layer_widget.h:128

References i, LYR_COLUMN_COUNT, LAYER_WIDGET::m_LayerPanel, LAYER_WIDGET::m_LayersFlexGridSizer, LAYER_WIDGET::m_RenderFlexGridSizer, LAYER_WIDGET::m_RenderingPanel, max, and RND_COLUMN_COUNT.

Referenced by GERBVIEW_FRAME::GERBVIEW_FRAME(), FOOTPRINT_EDIT_FRAME::ReFillLayerWidget(), and GERBVIEW_FRAME::ReFillLayerWidget().

◆ getDecodedId()

LAYER_NUM LAYER_WIDGET::getDecodedId ( int  aControlId)
staticprotectedinherited

Function getDecodedId decodes aControlId to original un-encoded value.

This of course holds iff encodedId was called with a LAYER_NUM (this box is used for other things than layers, too)

Definition at line 70 of file layer_widget.cpp.

71 {
72  int id = aControlId / LYR_COLUMN_COUNT; // rounding is OK.
73  return id;
74 }
#define LYR_COLUMN_COUNT
Layer tab column count.
Definition: layer_widget.h:49

References LYR_COLUMN_COUNT.

Referenced by LAYER_WIDGET::findLayerRow(), LAYER_WIDGET::findRenderRow(), LAYER_WIDGET::GetSelectedLayer(), LAYER_WIDGET::OnLayerCheckBox(), LAYER_WIDGET::OnLayerSwatchChanged(), LAYER_WIDGET::OnLeftDownLayers(), GERBER_LAYER_WIDGET::onPopupSelection(), onPopupSelection(), LAYER_WIDGET::OnRenderCheckBox(), LAYER_WIDGET::OnRenderSwatchChanged(), SyncLayerAlphaIndicators(), and SyncLayerVisibilities().

◆ GetLayerColor()

COLOR4D LAYER_WIDGET::GetLayerColor ( LAYER_NUM  aLayer) const
inherited

Function GetLayerColor returns the color of the layer ROW associated with aLayer id.

Definition at line 732 of file layer_widget.cpp.

733 {
734  int row = findLayerRow( aLayer );
735  if( row >= 0 )
736  {
737  int col = 1; // bitmap button is column 1
738  auto swatch = static_cast<COLOR_SWATCH*>( getLayerComp( row, col ) );
739  wxASSERT( swatch );
740 
741  return swatch->GetSwatchColor();
742  }
743 
744  return COLOR4D::UNSPECIFIED; // it's caller fault, gave me a bad layer
745 }
int findLayerRow(LAYER_NUM aLayer) const
Function findLayerRow returns the row index that aLayer resides in, or -1 if not found.
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...

References LAYER_WIDGET::findLayerRow(), and LAYER_WIDGET::getLayerComp().

◆ getLayerComp()

wxWindow * LAYER_WIDGET::getLayerComp ( int  aRow,
int  aColumn 
) const
protectedinherited

Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL if these parameters are out of range.

Parameters
aRowis the row index
aColumnis the column
Returns
wxWindow - the component installed within the sizer at given grid coordinate.

Definition at line 254 of file layer_widget.cpp.

255 {
256  unsigned ndx = aRow * LYR_COLUMN_COUNT + aColumn;
257 
258  if( ndx < m_LayersFlexGridSizer->GetChildren().GetCount() )
259  return m_LayersFlexGridSizer->GetChildren()[ndx]->GetWindow();
260 
261  return NULL;
262 }
#define LYR_COLUMN_COUNT
Layer tab column count.
Definition: layer_widget.h:49
wxFlexGridSizer * m_LayersFlexGridSizer
Definition: layer_widget.h:130

References LYR_COLUMN_COUNT, and LAYER_WIDGET::m_LayersFlexGridSizer.

Referenced by LAYER_WIDGET::findLayerRow(), LAYER_WIDGET::GetLayerColor(), LAYER_WIDGET::GetSelectedLayer(), LAYER_WIDGET::IsLayerVisible(), LAYER_WIDGET::OnLeftDownLayers(), GERBER_LAYER_WIDGET::onPopupSelection(), onPopupSelection(), LAYER_WIDGET::OnRenderSwatchChanged(), ReFill(), LAYER_WIDGET::SelectLayerRow(), LAYER_WIDGET::setLayerCheckbox(), LAYER_WIDGET::SetLayerColor(), SyncLayerAlphaIndicators(), SyncLayerVisibilities(), and LAYER_WIDGET::UpdateLayerIcons().

◆ GetLayerRowCount()

int LAYER_WIDGET::GetLayerRowCount ( ) const
inherited

Function GetLayerRowCount returns the number of rows in the layer tab.

Definition at line 595 of file layer_widget.cpp.

596 {
597  int controlCount = m_LayersFlexGridSizer->GetChildren().GetCount();
598  return controlCount / LYR_COLUMN_COUNT;
599 }
#define LYR_COLUMN_COUNT
Layer tab column count.
Definition: layer_widget.h:49
wxFlexGridSizer * m_LayersFlexGridSizer
Definition: layer_widget.h:130

References LYR_COLUMN_COUNT, and LAYER_WIDGET::m_LayersFlexGridSizer.

Referenced by LAYER_WIDGET::AppendLayerRow(), LAYER_WIDGET::findLayerRow(), LAYER_WIDGET::OnLeftDownLayers(), GERBER_LAYER_WIDGET::onPopupSelection(), onPopupSelection(), LAYER_WIDGET::OnRenderSwatchChanged(), ReFill(), SyncLayerAlphaIndicators(), SyncLayerVisibilities(), and LAYER_WIDGET::UpdateLayerIcons().

◆ getRenderComp()

wxWindow * LAYER_WIDGET::getRenderComp ( int  aRow,
int  aColumn 
) const
protectedinherited

Definition at line 283 of file layer_widget.cpp.

284 {
285  int ndx = aRow * RND_COLUMN_COUNT + aColumn;
286 
287  if( (unsigned) ndx < m_RenderFlexGridSizer->GetChildren().GetCount() )
288  return m_RenderFlexGridSizer->GetChildren()[ndx]->GetWindow();
289 
290  return NULL;
291 }
#define RND_COLUMN_COUNT
Rendering tab column count.
Definition: layer_widget.h:50
wxFlexGridSizer * m_RenderFlexGridSizer
Definition: layer_widget.h:133

References LAYER_WIDGET::m_RenderFlexGridSizer, and RND_COLUMN_COUNT.

Referenced by LAYER_WIDGET::findRenderRow(), LAYER_WIDGET::GetRenderState(), LAYER_WIDGET::OnRenderSwatchChanged(), and LAYER_WIDGET::SetRenderState().

◆ GetRenderRowCount()

int LAYER_WIDGET::GetRenderRowCount ( ) const
inherited

Function GetRenderRowCount returns the number of rows in the render tab.

Definition at line 602 of file layer_widget.cpp.

603 {
604  int controlCount = m_RenderFlexGridSizer->GetChildren().GetCount();
605  return controlCount / RND_COLUMN_COUNT;
606 }
#define RND_COLUMN_COUNT
Rendering tab column count.
Definition: layer_widget.h:50
wxFlexGridSizer * m_RenderFlexGridSizer
Definition: layer_widget.h:133

References LAYER_WIDGET::m_RenderFlexGridSizer, and RND_COLUMN_COUNT.

Referenced by LAYER_WIDGET::AppendRenderRow(), LAYER_WIDGET::findRenderRow(), and LAYER_WIDGET::OnRenderSwatchChanged().

◆ GetRenderState()

bool LAYER_WIDGET::GetRenderState ( int  aId)
inherited

Function GetRenderState returns the state of the checkbox associated with aId.

Returns
bool - true if checked, else false.

Definition at line 762 of file layer_widget.cpp.

763 {
764  int row = findRenderRow( aId );
765 
766  if( row >= 0 )
767  {
768  int col = 1; // checkbox is column 1
769  wxCheckBox* cb = (wxCheckBox*) getRenderComp( row, col );
770  wxASSERT( cb );
771  return cb->GetValue();
772  }
773 
774  return false; // the value of a non-existent row
775 }
int findRenderRow(int aId) const
wxWindow * getRenderComp(int aRow, int aColumn) const

References LAYER_WIDGET::findRenderRow(), and LAYER_WIDGET::getRenderComp().

◆ GetSelectedLayer()

LAYER_NUM LAYER_WIDGET::GetSelectedLayer ( )
inherited

Function GetSelectedLayer returns the selected layer or -1 if none.

Definition at line 676 of file layer_widget.cpp.

677 {
678  wxWindow* w = getLayerComp( m_CurrentRow, 0 );
679  if( w )
680  return getDecodedId( w->GetId() );
681 
682  return UNDEFINED_LAYER;
683 }
int m_CurrentRow
selected row of layer list
Definition: layer_widget.h:136
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...
static LAYER_NUM getDecodedId(int aControlId)
Function getDecodedId decodes aControlId to original un-encoded value.

References LAYER_WIDGET::getDecodedId(), LAYER_WIDGET::getLayerComp(), LAYER_WIDGET::m_CurrentRow, and UNDEFINED_LAYER.

◆ insertLayerRow()

void LAYER_WIDGET::insertLayerRow ( int  aRow,
const ROW aSpec 
)
protectedinherited

Function insertLayerRow appends or inserts a new row in the layer portion of the widget.

Definition at line 312 of file layer_widget.cpp.

313 {
314  wxASSERT( aRow >= 0 );
315 
316  int col;
317  int index = aRow * LYR_COLUMN_COUNT;
318  const int flags = wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT;
319 
320  // column 0
321  col = COLUMN_ICON_ACTIVE;
323  ROW_ICON_PROVIDER::STATE::OFF, encodeId( col, aSpec.id ) );
324  sbm->Bind( wxEVT_LEFT_DOWN, &LAYER_WIDGET::OnLeftDownLayers, this );
325  m_LayersFlexGridSizer->wxSizer::Insert( index+col, sbm, 0, flags );
326 
327  // column 1 (COLUMN_COLORBM)
328  col = COLUMN_COLORBM;
329 
330  auto bmb = new COLOR_SWATCH( m_LayerScrolledWindow, aSpec.color, encodeId( col, aSpec.id ),
331  getBackgroundLayerColor(), aSpec.defaultColor );
332  bmb->Bind( wxEVT_LEFT_DOWN, &LAYER_WIDGET::OnLeftDownLayers, this );
333  bmb->Bind( COLOR_SWATCH_CHANGED, &LAYER_WIDGET::OnLayerSwatchChanged, this );
334  bmb->SetToolTip( _("Left double click or middle click for color change, right click for menu" ) );
335  m_LayersFlexGridSizer->wxSizer::Insert( index+col, bmb, 0, flags );
336 
337  // column 2 (COLUMN_COLOR_LYR_CB)
338  col = COLUMN_COLOR_LYR_CB;
339  wxCheckBox* cb = new wxCheckBox( m_LayerScrolledWindow, encodeId( col, aSpec.id ), wxEmptyString );
340  cb->SetValue( aSpec.state );
341  cb->Bind( wxEVT_COMMAND_CHECKBOX_CLICKED, &LAYER_WIDGET::OnLayerCheckBox, this );
342  cb->SetToolTip( _( "Enable this for visibility" ) );
343  m_LayersFlexGridSizer->wxSizer::Insert( index+col, cb, 0, flags );
344 
345  // column 3 (COLUMN_COLOR_LYRNAME)
346  col = COLUMN_COLOR_LYRNAME;
347  wxStaticText* st = new wxStaticText( m_LayerScrolledWindow, encodeId( col, aSpec.id ), aSpec.rowName );
348  shrinkFont( st, m_PointSize );
349  st->Bind( wxEVT_LEFT_DOWN, &LAYER_WIDGET::OnLeftDownLayers, this );
350  st->SetToolTip( aSpec.tooltip );
351  m_LayersFlexGridSizer->wxSizer::Insert( index+col, st, 0, flags );
352 
353  // column 4 (COLUMN_ALPHA_INDICATOR)
356  ROW_ICON_PROVIDER::STATE::OFF, wxID_ANY );
357  m_LayersFlexGridSizer->wxSizer::Insert( index+col, sbm, 0, flags );
358 
359  // Bind right click eventhandler to all columns
360  wxString layerName( aSpec.rowName );
361 
362  sbm->Bind( wxEVT_RIGHT_DOWN, [this, bmb, layerName] ( wxMouseEvent& aEvt ) {
363  OnRightDownLayer( aEvt, bmb, layerName );
364  } );
365  bmb->Bind( wxEVT_RIGHT_DOWN, [this, bmb, layerName] ( wxMouseEvent& aEvt ) {
366  OnRightDownLayer( aEvt, bmb, layerName );
367  } );
368  cb->Bind( wxEVT_RIGHT_DOWN, [this, bmb, layerName] ( wxMouseEvent& aEvt ) {
369  OnRightDownLayer( aEvt, bmb, layerName );
370  } );
371  st->Bind( wxEVT_RIGHT_DOWN, [this, bmb, layerName] ( wxMouseEvent& aEvt ) {
372  OnRightDownLayer( aEvt, bmb, layerName );
373  } );
374 }
#define COLUMN_COLOR_LYRNAME
Definition: layer_widget.h:55
void OnLeftDownLayers(wxMouseEvent &event)
#define LYR_COLUMN_COUNT
Layer tab column count.
Definition: layer_widget.h:49
#define COLUMN_ALPHA_INDICATOR
Definition: layer_widget.h:56
#define OFF
wxFlexGridSizer * m_LayersFlexGridSizer
Definition: layer_widget.h:130
static void shrinkFont(wxWindow *aControl, int aPointSize)
Function shrinkFont reduces the size of the wxFont associated with aControl.
void OnLayerCheckBox(wxCommandEvent &event)
Function OnLayerCheckBox handles the "is layer visible" checkbox and propogates the event to the clie...
static int encodeId(int aColumn, int aId)
Function encodeId is here to allow saving a layer index within a control as its wxControl id,...
Class representing a row indicator icon for use in places like the layer widget.
#define COLUMN_ICON_ACTIVE
Definition: layer_widget.h:52
#define COLUMN_COLORBM
Definition: layer_widget.h:53
wxScrolledWindow * m_LayerScrolledWindow
Definition: layer_widget.h:129
#define _(s)
void OnRightDownLayer(wxMouseEvent &event, COLOR_SWATCH *aColorSwatch, const wxString &aLayerName)
Function OnRightDownLayer Called when user right-clicks a layer.
#define COLUMN_COLOR_LYR_CB
Definition: layer_widget.h:54
virtual COLOR4D getBackgroundLayerColor()
Subclasses can override this to provide accurate representation of transparent colour swatches.
Definition: layer_widget.h:155
Class representing a simple color swatch, of the kind used to set layer colors.
Definition: color_swatch.h:38
void OnLayerSwatchChanged(wxCommandEvent &aEvent)
Function OnSwatchChanged() is called when a user changes a swatch color.
ROW_ICON_PROVIDER * m_IconProvider
Definition: layer_widget.h:139

References _, LAYER_WIDGET::ROW::color, COLUMN_ALPHA_INDICATOR, COLUMN_COLOR_LYR_CB, COLUMN_COLOR_LYRNAME, COLUMN_COLORBM, COLUMN_ICON_ACTIVE, LAYER_WIDGET::ROW::defaultColor, LAYER_WIDGET::encodeId(), LAYER_WIDGET::getBackgroundLayerColor(), LAYER_WIDGET::ROW::id, LYR_COLUMN_COUNT, LAYER_WIDGET::m_IconProvider, LAYER_WIDGET::m_LayerScrolledWindow, LAYER_WIDGET::m_LayersFlexGridSizer, LAYER_WIDGET::m_PointSize, OFF, LAYER_WIDGET::OnLayerCheckBox(), LAYER_WIDGET::OnLayerSwatchChanged(), LAYER_WIDGET::OnLeftDownLayers(), LAYER_WIDGET::OnRightDownLayer(), LAYER_WIDGET::ROW::rowName, shrinkFont(), LAYER_WIDGET::ROW::state, and LAYER_WIDGET::ROW::tooltip.

Referenced by LAYER_WIDGET::AppendLayerRow().

◆ insertRenderRow()

void LAYER_WIDGET::insertRenderRow ( int  aRow,
const ROW aSpec 
)
protectedinherited

Definition at line 377 of file layer_widget.cpp.

378 {
379  wxASSERT( aRow >= 0 );
380 
381  int col;
382  int index = aRow * RND_COLUMN_COUNT;
383  const int flags = wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT;
384 
385  wxString renderName( aSpec.rowName );
386  wxCheckBox* cb = nullptr;
387 
388  // column 1
389  if( !aSpec.spacer )
390  {
391  col = 1;
392  cb = new wxCheckBox( m_RenderScrolledWindow, encodeId( col, aSpec.id ),
393  aSpec.rowName, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
394  shrinkFont( cb, m_PointSize );
395  cb->SetValue( aSpec.state );
396  cb->Enable( aSpec.changeable );
397  cb->Bind( wxEVT_COMMAND_CHECKBOX_CLICKED, &LAYER_WIDGET::OnRenderCheckBox, this );
398  cb->SetToolTip( aSpec.tooltip );
399  }
400 
401  // column 0
402  col = 0;
403  if( aSpec.color != COLOR4D::UNSPECIFIED )
404  {
405  auto bmb = new COLOR_SWATCH( m_RenderScrolledWindow, aSpec.color, encodeId( col, aSpec.id ),
406  getBackgroundLayerColor(), aSpec.defaultColor );
407  bmb->Bind( COLOR_SWATCH_CHANGED, &LAYER_WIDGET::OnRenderSwatchChanged, this );
408  bmb->SetToolTip( _( "Left double click or middle click for color change" ) );
409  m_RenderFlexGridSizer->wxSizer::Insert( index+col, bmb, 0, flags );
410 
411  bmb->Bind( wxEVT_RIGHT_DOWN, [this, bmb, renderName] ( wxMouseEvent& aEvt ) {
412  OnRightDownRender( aEvt, bmb, renderName );
413  } );
414  cb->Bind( wxEVT_RIGHT_DOWN, [this, bmb, renderName] ( wxMouseEvent& aEvt ) {
415  OnRightDownRender( aEvt, bmb, renderName );
416  } );
417 
418  // could add a left click handler on the color button that toggles checkbox.
419  }
420  else // == -1, no color selection wanted
421  {
422  // need a place holder within the sizer to keep grid full.
423  wxPanel* invisible = new wxPanel( m_RenderScrolledWindow, encodeId( col, aSpec.id ) );
424  m_RenderFlexGridSizer->wxSizer::Insert( index+col, invisible, 0, flags );
425  }
426 
427  // Items have to be inserted in order
428  col = 1;
429 
430  if( aSpec.spacer )
431  {
432  wxPanel* invisible = new wxPanel( m_RenderScrolledWindow, wxID_ANY );
433  m_RenderFlexGridSizer->wxSizer::Insert( index+col, invisible, 0, flags );
434  }
435  else
436  {
437  m_RenderFlexGridSizer->wxSizer::Insert( index+col, cb, 0, flags );
438  }
439 }
wxScrolledWindow * m_RenderScrolledWindow
Definition: layer_widget.h:132
static void shrinkFont(wxWindow *aControl, int aPointSize)
Function shrinkFont reduces the size of the wxFont associated with aControl.
#define RND_COLUMN_COUNT
Rendering tab column count.
Definition: layer_widget.h:50
wxFlexGridSizer * m_RenderFlexGridSizer
Definition: layer_widget.h:133
void OnRenderCheckBox(wxCommandEvent &event)
static int encodeId(int aColumn, int aId)
Function encodeId is here to allow saving a layer index within a control as its wxControl id,...
void OnRightDownRender(wxMouseEvent &aEvent, COLOR_SWATCH *aColorSwatch, const wxString &aRenderName)
Function OnRightDownRender Called when user right-clicks a render option.
void OnRenderSwatchChanged(wxCommandEvent &aEvent)
Function OnRenderSwatchChanged Called when user has changed the swatch color of a render entry.
#define _(s)
virtual COLOR4D getBackgroundLayerColor()
Subclasses can override this to provide accurate representation of transparent colour swatches.
Definition: layer_widget.h:155
Class representing a simple color swatch, of the kind used to set layer colors.
Definition: color_swatch.h:38

References _, LAYER_WIDGET::ROW::changeable, LAYER_WIDGET::ROW::color, LAYER_WIDGET::ROW::defaultColor, LAYER_WIDGET::encodeId(), LAYER_WIDGET::getBackgroundLayerColor(), LAYER_WIDGET::ROW::id, LAYER_WIDGET::m_PointSize, LAYER_WIDGET::m_RenderFlexGridSizer, LAYER_WIDGET::m_RenderScrolledWindow, LAYER_WIDGET::OnRenderCheckBox(), LAYER_WIDGET::OnRenderSwatchChanged(), LAYER_WIDGET::OnRightDownRender(), RND_COLUMN_COUNT, LAYER_WIDGET::ROW::rowName, shrinkFont(), LAYER_WIDGET::ROW::spacer, LAYER_WIDGET::ROW::state, and LAYER_WIDGET::ROW::tooltip.

Referenced by LAYER_WIDGET::AppendRenderRow().

◆ installRightLayerClickHandler()

void PCB_LAYER_WIDGET::installRightLayerClickHandler ( )
protected

this is for the popup menu, the right click handler has to be installed on every child control within the layer panel.

◆ isAllowedInFpMode()

bool PCB_LAYER_WIDGET::isAllowedInFpMode ( int  aId)
protected

Function isAllowedInFpMode.

Returns
true if item aId has meaning in footprint editor mode. and therefore is shown in render panel

Definition at line 133 of file pcb_layer_widget.cpp.

134 {
135  for( unsigned ii = 0; ii < arrayDim( s_allowed_in_FpEditor ); ii++ )
136  if( s_allowed_in_FpEditor[ii] == aId )
137  return true;
138 
139  return false;
140 }
static int s_allowed_in_FpEditor[]
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108

References arrayDim(), and s_allowed_in_FpEditor.

Referenced by ReFillRender().

◆ isLayerAllowedInFpMode()

bool PCB_LAYER_WIDGET::isLayerAllowedInFpMode ( PCB_LAYER_ID  aLayer)
protected

Function isLayerAllowedInFpMode.

User layers, which are not paired, are not shown in layers manager. However a not listed layer can be reachable in the graphic item properties dialog.

Parameters
aLayeris the layer id to test
Returns
true if PCB_LAYER_ID aLayer has meaning in footprint editor mode. and therefore is shown in render panel

Definition at line 143 of file pcb_layer_widget.cpp.

144 {
145  static LSET allowed = LSET::AllTechMask();
146  allowed.set( F_Cu ).set( B_Cu );
147  return allowed.test( aLayer );
148 }
static LSET AllTechMask()
Function AllTechMask returns a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:746
Class LSET is a set of PCB_LAYER_IDs.

References LSET::AllTechMask(), B_Cu, and F_Cu.

◆ IsLayerVisible()

bool LAYER_WIDGET::IsLayerVisible ( LAYER_NUM  aLayer)
inherited

Function IsLayerVisible returns the visible state of the layer ROW associated with aLayer id.

Definition at line 705 of file layer_widget.cpp.

706 {
707  int row = findLayerRow( aLayer );
708  if( row >= 0 )
709  {
710  wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
711  wxASSERT( cb );
712  return cb->GetValue();
713  }
714  return false;
715 }
int findLayerRow(LAYER_NUM aLayer) const
Function findLayerRow returns the row index that aLayer resides in, or -1 if not found.
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...
#define COLUMN_COLOR_LYR_CB
Definition: layer_widget.h:54

References COLUMN_COLOR_LYR_CB, LAYER_WIDGET::findLayerRow(), and LAYER_WIDGET::getLayerComp().

Referenced by GERBVIEW_FRAME::IsLayerVisible().

◆ OnLayerCheckBox()

void LAYER_WIDGET::OnLayerCheckBox ( wxCommandEvent &  event)
protectedinherited

Function OnLayerCheckBox handles the "is layer visible" checkbox and propogates the event to the client's notification function.

Definition at line 168 of file layer_widget.cpp.

169 {
170  wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject();
171  LAYER_NUM layer = getDecodedId( eventSource->GetId() );
172  OnLayerVisible( layer, eventSource->IsChecked() );
173  passOnFocus();
174 }
virtual void OnLayerVisible(LAYER_NUM aLayer, bool isVisible, bool isFinal=true)=0
Function OnLayerVisible is called to notify client code about a layer visibility change.
static LAYER_NUM getDecodedId(int aControlId)
Function getDecodedId decodes aControlId to original un-encoded value.
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
void passOnFocus()
Function passOnFocus gives away the keyboard focus up to the main parent window.

References LAYER_WIDGET::getDecodedId(), LAYER_WIDGET::OnLayerVisible(), and LAYER_WIDGET::passOnFocus().

Referenced by LAYER_WIDGET::insertLayerRow().

◆ OnLayerColorChange()

void PCB_LAYER_WIDGET::OnLayerColorChange ( int  aLayer,
COLOR4D  aColor 
)
overridevirtual

Function OnLayerColorChange is called to notify client code about a layer color change.

Derived classes will handle this accordingly.

Parameters
aLayeris the board layer to change
aColoris the new color

Implements LAYER_WIDGET.

Definition at line 575 of file pcb_layer_widget.cpp.

576 {
577  myframe->Settings().Colors().SetLayerColor( aLayer, aColor );
578 
579  KIGFX::VIEW* view = myframe->GetCanvas()->GetView();
581  view->UpdateLayerColor( aLayer );
582  view->UpdateLayerColor( GetNetnameLayer( aLayer ) );
583 
585 
586  myframe->GetCanvas()->Refresh();
587 
588  if( aLayer == LAYER_PCB_BACKGROUND )
589  myframe->SetDrawBgColor( aColor );
590 }
int GetNetnameLayer(int aLayer)
Returns a netname layer corresponding to the given layer.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
PCB_BASE_FRAME * myframe
void SetLayerColor(LAYER_NUM aLayer, COLOR4D aColor)
Function SetLayerColor sets the color for aLayer which is one of the item indices given in enum PCB_L...
void SetDrawBgColor(COLOR4D aColor) override
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
virtual void ImportLegacyColors(const COLORS_DESIGN_SETTINGS *aSettings)
Function ImportLegacyColors Loads a list of color settings for layers.
Definition: painter.h:67
PCB_GENERAL_SETTINGS & Settings()
virtual KIGFX::PCB_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
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...
COLORS_DESIGN_SETTINGS & Colors()
void UpdateLayerColor(int aLayer)
Function UpdateLayerColor() Applies the new coloring scheme held by RENDER_SETTINGS in case that it h...
Definition: view.cpp:777
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
virtual void ReCreateHToolbar()=0
Class VIEW.
Definition: view.h:61

References PCB_GENERAL_SETTINGS::Colors(), PCB_BASE_FRAME::GetCanvas(), GetNetnameLayer(), KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), PCB_DRAW_PANEL_GAL::GetView(), KIGFX::RENDER_SETTINGS::ImportLegacyColors(), LAYER_PCB_BACKGROUND, myframe, EDA_DRAW_FRAME::ReCreateHToolbar(), EDA_DRAW_PANEL_GAL::Refresh(), PCB_BASE_FRAME::SetDrawBgColor(), COLORS_DESIGN_SETTINGS::SetLayerColor(), PCB_BASE_FRAME::Settings(), and KIGFX::VIEW::UpdateLayerColor().

◆ OnLayerRightClick()

void PCB_LAYER_WIDGET::OnLayerRightClick ( wxMenu &  aMenu)
overridevirtual

Function OnLayerRightClick is called to notify client code about a layer being right-clicked.

Parameters
aMenuis the right-click menu containing layer-scoped options. It can be used to add extra, wider scoped menu items.

Implements LAYER_WIDGET.

Definition at line 654 of file pcb_layer_widget.cpp.

655 {
656  AddRightClickMenuItems( aMenu );
657 }
void AddRightClickMenuItems(wxMenu &menu)
Function addRightClickMenuItems add menu items to a menu that should be shown when right-clicking the...

References AddRightClickMenuItems().

◆ OnLayerSelect()

bool PCB_LAYER_WIDGET::OnLayerSelect ( int  aLayer)
overridevirtual

Function OnLayerSelect is called to notify client code whenever the user selects a different layer.

Derived classes will handle this accordingly, and can deny the change by returning false.

Parameters
aLayeris the board layer to select

Implements LAYER_WIDGET.

Definition at line 593 of file pcb_layer_widget.cpp.

594 {
595  // the layer change from the PCB_LAYER_WIDGET can be denied by returning
596  // false from this function.
597  PCB_LAYER_ID layer = ToLAYER_ID( aLayer );
598 
599  if( m_fp_editor_mode && LSET::ForbiddenFootprintLayers().test( layer ) )
600  return false;
601 
602  myframe->SetActiveLayer( layer );
604 
606  OnLayerSelected();
607  else if( displ_opts->m_ContrastModeDisplay )
608  myframe->GetCanvas()->Refresh();
609 
610  return true;
611 }
static LSET ForbiddenFootprintLayers()
Function ForbiddenFootprintLayers Layers which are not allowed within footprint definitions.
Definition: lset.cpp:789
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
PCB_BASE_FRAME * myframe
bool OnLayerSelected()
Function OnLayerSelected ensure the active layer is visible, and other layers not visible when m_alwa...
void * GetDisplayOptions() override
Function GetDisplayOptions returns the display options current in use Display options are relative to...
Class PCB_DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
PCB_LAYER_ID
A quick note on layer IDs:
virtual void SetActiveLayer(PCB_LAYER_ID aLayer)
Function SetActiveLayer will change the currently active layer to aLayer.
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...
bool m_alwaysShowActiveCopperLayer
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:813

References LSET::ForbiddenFootprintLayers(), PCB_BASE_FRAME::GetCanvas(), PCB_BASE_FRAME::GetDisplayOptions(), m_alwaysShowActiveCopperLayer, PCB_DISPLAY_OPTIONS::m_ContrastModeDisplay, m_fp_editor_mode, myframe, OnLayerSelected(), EDA_DRAW_PANEL_GAL::Refresh(), PCB_BASE_FRAME::SetActiveLayer(), and ToLAYER_ID().

◆ OnLayerSelected()

bool PCB_LAYER_WIDGET::OnLayerSelected ( )

Function OnLayerSelected ensure the active layer is visible, and other layers not visible when m_alwaysShowActiveLayer is true Otherwise do nothing.

Returns
true m_alwaysShowActiveLayer is true and the canvas is refreshed, and false if do nothing

Definition at line 614 of file pcb_layer_widget.cpp.

615 {
617  return false;
618 
619  // postprocess after an active layer selection
620  // ensure active layer visible
621  wxCommandEvent event;
623  onPopupSelection( event );
624 
625  return true;
626 }
bool m_alwaysShowActiveCopperLayer
void onPopupSelection(wxCommandEvent &event)

References ID_ALWAYS_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE, m_alwaysShowActiveCopperLayer, and onPopupSelection().

Referenced by OnLayerSelect(), and FOOTPRINT_EDIT_FRAME::UpdateUserInterface().

◆ OnLayerSwatchChanged()

void LAYER_WIDGET::OnLayerSwatchChanged ( wxCommandEvent &  aEvent)
protectedinherited

Function OnSwatchChanged() is called when a user changes a swatch color.

Definition at line 149 of file layer_widget.cpp.

150 {
151  auto eventSource = static_cast<COLOR_SWATCH*>( aEvent.GetEventObject() );
152 
153  COLOR4D newColor = eventSource->GetSwatchColor();
154 
155  LAYER_NUM layer = getDecodedId( eventSource->GetId() );
156 
157  // tell the client code.
158  OnLayerColorChange( layer, newColor );
159 
160  // notify others
161  wxCommandEvent event( EVT_LAYER_COLOR_CHANGE );
162  wxPostEvent( this, event );
163 
164  passOnFocus();
165 }
static const wxEventType EVT_LAYER_COLOR_CHANGE
Definition: layer_widget.h:123
virtual void OnLayerColorChange(int aLayer, COLOR4D aColor)=0
Function OnLayerColorChange is called to notify client code about a layer color change.
static LAYER_NUM getDecodedId(int aControlId)
Function getDecodedId decodes aControlId to original un-encoded value.
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
void passOnFocus()
Function passOnFocus gives away the keyboard focus up to the main parent window.
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

References LAYER_WIDGET::EVT_LAYER_COLOR_CHANGE, LAYER_WIDGET::getDecodedId(), LAYER_WIDGET::OnLayerColorChange(), and LAYER_WIDGET::passOnFocus().

Referenced by LAYER_WIDGET::insertLayerRow().

◆ OnLayerVisible()

void PCB_LAYER_WIDGET::OnLayerVisible ( int  aLayer,
bool  isVisible,
bool  isFinal 
)
overridevirtual

Function OnLayerVisible is called to notify client code about a layer visibility change.

Parameters
aLayeris the board layer to select
isVisibleis the new visible state
isFinalis true when this is the last of potentially several such calls, and can be used to decide when to update the screen only one time instead of several times in the midst of a multiple layer change.

Implements LAYER_WIDGET.

Definition at line 629 of file pcb_layer_widget.cpp.

630 {
631  BOARD* brd = myframe->GetBoard();
632 
633  LSET visibleLayers = brd->GetVisibleLayers();
634 
635  if( visibleLayers.test( aLayer ) != isVisible )
636  {
637  visibleLayers.set( aLayer, isVisible );
638 
639  brd->SetVisibleLayers( visibleLayers );
640 
641  // Layer visibility is not stored in .kicad_mod files
642  if( !m_fp_editor_mode )
643  myframe->OnModify();
644 
645  if( myframe->GetCanvas() )
646  myframe->GetCanvas()->GetView()->SetLayerVisible( aLayer, isVisible );
647  }
648 
649  if( isFinal )
650  myframe->GetCanvas()->Refresh();
651 }
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
LSET GetVisibleLayers() const
Function GetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
PCB_BASE_FRAME * myframe
Class LSET is a set of PCB_LAYER_IDs.
void SetVisibleLayers(LSET aLayerMask)
Function SetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
void SetLayerVisible(int aLayer, bool aVisible=true)
Function SetLayerVisible() Controls the visibility of a particular layer.
Definition: view.h:399
virtual KIGFX::PCB_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
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...
virtual void OnModify()
Function OnModify Virtual Must be called after a change in order to set the "modify" flag of the curr...
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:161
BOARD * GetBoard() const

References PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetCanvas(), PCB_DRAW_PANEL_GAL::GetView(), BOARD::GetVisibleLayers(), m_fp_editor_mode, myframe, PCB_BASE_FRAME::OnModify(), EDA_DRAW_PANEL_GAL::Refresh(), KIGFX::VIEW::SetLayerVisible(), and BOARD::SetVisibleLayers().

Referenced by onPopupSelection().

◆ OnLeftDownLayers()

void LAYER_WIDGET::OnLeftDownLayers ( wxMouseEvent &  event)
protectedinherited

Definition at line 77 of file layer_widget.cpp.

78 {
79  int row;
80  LAYER_NUM layer;
81 
82  wxWindow* eventSource = (wxWindow*) event.GetEventObject();
83 
84  // if mouse event is coming from the m_LayerScrolledWindow and not one
85  // of its children, we have to find the row manually based on y coord.
86  if( eventSource == m_LayerScrolledWindow )
87  {
88  int y = event.GetY();
89 
90  wxArrayInt heights = m_LayersFlexGridSizer->GetRowHeights();
91 
92  int height = 0;
93 
94  int rowCount = GetLayerRowCount();
95  for( row = 0; row<rowCount; ++row )
96  {
97  if( y < height + heights[row] )
98  break;
99 
100  height += heights[row];
101  }
102 
103  if( row >= rowCount )
104  row = rowCount - 1;
105 
106  layer = getDecodedId( getLayerComp( row, 0 )->GetId() );
107  }
108 
109  else
110  {
111  // all nested controls on a given row will have their ID encoded with
112  // encodeId(), and the corresponding decoding is getDecodedId()
113  int id = eventSource->GetId();
114  layer = getDecodedId( id );
115  row = findLayerRow( layer );
116  }
117 
118  if( OnLayerSelect( layer ) ) // if client allows this change.
119  SelectLayerRow( row );
120 
121  passOnFocus();
122 }
int findLayerRow(LAYER_NUM aLayer) const
Function findLayerRow returns the row index that aLayer resides in, or -1 if not found.
wxFlexGridSizer * m_LayersFlexGridSizer
Definition: layer_widget.h:130
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...
wxScrolledWindow * m_LayerScrolledWindow
Definition: layer_widget.h:129
void SelectLayerRow(int aRow)
Function SelectLayerRow changes the row selection in the layer list to the given row.
static LAYER_NUM getDecodedId(int aControlId)
Function getDecodedId decodes aControlId to original un-encoded value.
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
int GetLayerRowCount() const
Function GetLayerRowCount returns the number of rows in the layer tab.
void passOnFocus()
Function passOnFocus gives away the keyboard focus up to the main parent window.
virtual bool OnLayerSelect(int aLayer)=0
Function OnLayerSelect is called to notify client code whenever the user selects a different layer.

References LAYER_WIDGET::findLayerRow(), LAYER_WIDGET::getDecodedId(), LAYER_WIDGET::getLayerComp(), LAYER_WIDGET::GetLayerRowCount(), LAYER_WIDGET::m_LayerScrolledWindow, LAYER_WIDGET::m_LayersFlexGridSizer, LAYER_WIDGET::OnLayerSelect(), LAYER_WIDGET::passOnFocus(), and LAYER_WIDGET::SelectLayerRow().

Referenced by LAYER_WIDGET::insertLayerRow().

◆ onPopupSelection()

void PCB_LAYER_WIDGET::onPopupSelection ( wxCommandEvent &  event)
protected

Definition at line 205 of file pcb_layer_widget.cpp.

206 {
207  int rowCount;
208  int menuId = event.GetId();
209  bool visible;
210  bool force_active_layer_visible;
211 
213  force_active_layer_visible = ( menuId == ID_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE ||
215 
216  switch( menuId )
217  {
218  case ID_SHOW_NO_LAYERS:
219  case ID_SHOW_ALL_LAYERS:
220  {
221  visible = ( menuId == ID_SHOW_ALL_LAYERS );
222  rowCount = GetLayerRowCount();
223 
224  for( int row=0; row<rowCount; ++row )
225  {
226  bool isLast;
227  wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
228  PCB_LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
229  cb->SetValue( visible );
230 
231  isLast = row == rowCount-1;
232 
233  OnLayerVisible( layer, visible, isLast );
234 
235  if( isLast )
236  break;
237  }
238  break;
239  }
240 
247  {
248 
249  // Search the last copper layer row index:
250  int lastCu = -1;
251  rowCount = GetLayerRowCount();
252  for( int row = rowCount-1; row>=0; --row )
253  {
254  wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
255  PCB_LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
256 
257  if( IsCopperLayer( layer ) )
258  {
259  lastCu = row;
260  break;
261  }
262  }
263 
264  // Enable/disable the copper layers visibility:
265  int startrow = 0;
266 
267  if( ( menuId == ID_SHOW_ALL_NON_COPPER ) ||
268  ( menuId == ID_HIDE_ALL_NON_COPPER ) )
269  {
270  startrow = lastCu + 1;
271  }
272 
273  for( int row = startrow; row<rowCount; ++row )
274  {
275  wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
276  PCB_LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
277 
278  visible = ( ( menuId == ID_SHOW_ALL_COPPER_LAYERS ) || ( menuId == ID_SHOW_ALL_NON_COPPER ) );
279 
280  if( force_active_layer_visible && (layer == myframe->GetActiveLayer() ) )
281  visible = true;
282 
283  cb->SetValue( visible );
284 
285  bool isLastLayer = (row == lastCu);
286 
287  if( ( menuId == ID_SHOW_ALL_NON_COPPER ) ||
288  ( menuId == ID_HIDE_ALL_NON_COPPER ) )
289  {
290  isLastLayer = false;
291  }
292  OnLayerVisible( layer, visible, isLastLayer );
293 
294  if( isLastLayer )
295  break;
296  }
297  break;
298  }
299 
300  case ID_SHOW_ALL_FRONT:
301  {
302  visible = false;
303  rowCount = GetLayerRowCount();
304 
305  for( int row=0; row<rowCount; ++row )
306  {
307  bool isLast;
308  wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
309  PCB_LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
310  isLast = ( row == rowCount-1 );
311 
312  if( layer == F_Paste || layer == F_SilkS ||
313  layer == F_Mask || layer == F_Cu ||
314  layer == F_Fab || layer == F_CrtYd || layer == Edge_Cuts )
315  {
316  visible = true;
317  }
318  else
319  {
320  visible = false;
321  }
322 
323  cb->SetValue( visible );
324  OnLayerVisible( layer, visible, isLast );
325 
326  if( isLast )
327  break;
328  }
329  break;
330  }
331  case ID_SHOW_ALL_BACK:
332  {
333  visible = false;
334  rowCount = GetLayerRowCount();
335 
336  for( int row=0; row<rowCount; ++row )
337  {
338  bool isLast;
339  wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
340  PCB_LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
341  isLast = ( row == rowCount-1 );
342 
343  if( layer == B_Paste || layer == B_SilkS ||
344  layer == B_Mask || layer == B_Cu ||
345  layer == B_Fab || layer == B_CrtYd || layer == Edge_Cuts )
346  {
347  visible = true;
348  }
349  else
350  {
351  visible = false;
352  }
353 
354  cb->SetValue( visible );
355  OnLayerVisible( layer, visible, isLast );
356 
357  if( isLast )
358  break;
359  }
360  break;
361  }
362  }
363 }
bool isLast(CPTREE &aTree, CITER it)
Definition: ptree.cpp:122
PCB_BASE_FRAME * myframe
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
PCB_LAYER_ID
A quick note on layer IDs:
static LAYER_NUM getDecodedId(int aControlId)
Function getDecodedId decodes aControlId to original un-encoded value.
bool m_alwaysShowActiveCopperLayer
int GetLayerRowCount() const
Function GetLayerRowCount returns the number of rows in the layer tab.
void OnLayerVisible(int aLayer, bool isVisible, bool isFinal) override
Function OnLayerVisible is called to notify client code about a layer visibility change.
#define COLUMN_COLOR_LYR_CB
Definition: layer_widget.h:54
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:813

References B_CrtYd, B_Cu, B_Fab, B_Mask, B_Paste, B_SilkS, COLUMN_COLOR_LYR_CB, Edge_Cuts, F_CrtYd, F_Cu, F_Fab, F_Mask, F_Paste, F_SilkS, PCB_BASE_FRAME::GetActiveLayer(), LAYER_WIDGET::getDecodedId(), LAYER_WIDGET::getLayerComp(), LAYER_WIDGET::GetLayerRowCount(), ID_ALWAYS_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE, ID_HIDE_ALL_NON_COPPER, ID_SHOW_ALL_BACK, ID_SHOW_ALL_COPPER_LAYERS, ID_SHOW_ALL_FRONT, ID_SHOW_ALL_LAYERS, ID_SHOW_ALL_NON_COPPER, ID_SHOW_NO_COPPER_LAYERS, ID_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE, ID_SHOW_NO_LAYERS, IsCopperLayer(), isLast(), m_alwaysShowActiveCopperLayer, myframe, OnLayerVisible(), and ToLAYER_ID().

Referenced by OnLayerSelected(), and PCB_LAYER_WIDGET().

◆ OnRenderCheckBox()

void LAYER_WIDGET::OnRenderCheckBox ( wxCommandEvent &  event)
protectedinherited

Definition at line 236 of file layer_widget.cpp.

237 {
238  wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject();
239  LAYER_NUM id = getDecodedId( eventSource->GetId() );
240  OnRenderEnable( id, eventSource->IsChecked() );
241  passOnFocus();
242 }
virtual void OnRenderEnable(int aId, bool isEnabled)=0
Function OnRenderEnable is called to notify client code whenever the user changes an rendering enable...
static LAYER_NUM getDecodedId(int aControlId)
Function getDecodedId decodes aControlId to original un-encoded value.
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
void passOnFocus()
Function passOnFocus gives away the keyboard focus up to the main parent window.

References LAYER_WIDGET::getDecodedId(), LAYER_WIDGET::OnRenderEnable(), and LAYER_WIDGET::passOnFocus().

Referenced by LAYER_WIDGET::insertRenderRow().

◆ OnRenderColorChange()

void PCB_LAYER_WIDGET::OnRenderColorChange ( int  aId,
COLOR4D  aColor 
)
overridevirtual

Function OnRenderColorChange is called to notify client code whenever the user changes a rendering color.

Parameters
aIdis the same id that was established in a Rendering row via the AddRenderRow() function.
aColoris the new color

Implements LAYER_WIDGET.

Definition at line 660 of file pcb_layer_widget.cpp.

661 {
662  wxASSERT( aId > GAL_LAYER_ID_START && aId < GAL_LAYER_ID_END );
663 
664  myframe->Settings().Colors().SetItemColor( static_cast<GAL_LAYER_ID>( aId ), aColor );
665 
666  if( aId == LAYER_GRID )
667  myframe->GetCanvas()->GetGAL()->SetGridColor( aColor );
668 
669  KIGFX::VIEW* view = myframe->GetCanvas()->GetView();
671  view->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); // useful to update rastnest
672  view->UpdateLayerColor( aId );
673 
674  // plated-through-holes don't have their own color; they use the background color
675  if( aId == LAYER_PCB_BACKGROUND )
677 
680  myframe->GetCanvas()->Refresh();
681 }
void ForceRefresh()
Function ForceRefresh() Forces a redraw.
void SetItemColor(int aItemIdx, COLOR4D aColor)
Function SetItemColor sets the color for an item which is one of the item indices given in enum GAL_L...
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
PCB_BASE_FRAME * myframe
Add new GAL layers here.
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
Auxiliary rendering target (noncached)
Definition: definitions.h:49
void SetGridColor(const COLOR4D &aGridColor)
Set the grid color.
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:585
virtual void ImportLegacyColors(const COLORS_DESIGN_SETTINGS *aSettings)
Function ImportLegacyColors Loads a list of color settings for layers.
Definition: painter.h:67
PCB_GENERAL_SETTINGS & Settings()
KIGFX::GAL * GetGAL() const
Function GetGAL() Returns a pointer to the GAL instance used in the panel.
virtual KIGFX::PCB_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
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...
COLORS_DESIGN_SETTINGS & Colors()
void UpdateLayerColor(int aLayer)
Function UpdateLayerColor() Applies the new coloring scheme held by RENDER_SETTINGS in case that it h...
Definition: view.cpp:777
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
virtual void ReCreateHToolbar()=0
Class VIEW.
Definition: view.h:61

References PCB_GENERAL_SETTINGS::Colors(), EDA_DRAW_PANEL_GAL::ForceRefresh(), GAL_LAYER_ID_END, GAL_LAYER_ID_START, PCB_BASE_FRAME::GetCanvas(), EDA_DRAW_PANEL_GAL::GetGAL(), KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), PCB_DRAW_PANEL_GAL::GetView(), KIGFX::RENDER_SETTINGS::ImportLegacyColors(), LAYER_GRID, LAYER_PADS_PLATEDHOLES, LAYER_PCB_BACKGROUND, KIGFX::VIEW::MarkTargetDirty(), myframe, EDA_DRAW_FRAME::ReCreateHToolbar(), EDA_DRAW_PANEL_GAL::Refresh(), KIGFX::GAL::SetGridColor(), COLORS_DESIGN_SETTINGS::SetItemColor(), PCB_BASE_FRAME::Settings(), KIGFX::TARGET_NONCACHED, and KIGFX::VIEW::UpdateLayerColor().

◆ OnRenderEnable()

void PCB_LAYER_WIDGET::OnRenderEnable ( int  aId,
bool  isEnabled 
)
overridevirtual

Function OnRenderEnable is called to notify client code whenever the user changes an rendering enable in one of the rendering checkboxes.

Parameters
aIdis the same id that was established in a Rendering row via the AddRenderRow() function.
isEnabledis the state of the checkbox, true if checked.

Implements LAYER_WIDGET.

Definition at line 684 of file pcb_layer_widget.cpp.

685 {
686  BOARD* brd = myframe->GetBoard();
687  wxASSERT( aId > GAL_LAYER_ID_START && aId < GAL_LAYER_ID_END );
688 
690  {
691  // The layer visibility status is saved in the board file so set the board
692  // modified state so the user has the option to save the changes.
693  if( brd->IsElementVisible( static_cast<GAL_LAYER_ID>( aId ) ) != isEnabled )
694  myframe->OnModify();
695  }
696 
697  brd->SetElementVisibility( static_cast<GAL_LAYER_ID>( aId ), isEnabled );
698 
699  if( aId == LAYER_GRID )
700  {
703  }
704  else if( aId == LAYER_RATSNEST )
705  {
706  // don't touch the layers. ratsnest is enabled on per-item basis.
708  myframe->GetCanvas()->GetView()->SetLayerVisible( aId, true );
709 
711  {
712  auto opt = static_cast<PCB_DISPLAY_OPTIONS*>( myframe->GetDisplayOptions() );
713  opt->m_ShowGlobalRatsnest = isEnabled;
715  }
716  }
717  else
718  myframe->GetCanvas()->GetView()->SetLayerVisible( aId, isEnabled );
719 
720  myframe->GetCanvas()->Refresh();
721  myframe->GetCanvas()->Refresh();
722 }
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Function SetElementVisibility changes the visibility of an element category.
virtual bool IsGridVisible() const
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
PCB_BASE_FRAME * myframe
Add new GAL layers here.
void * GetDisplayOptions() override
Function GetDisplayOptions returns the display options current in use Display options are relative to...
Auxiliary rendering target (noncached)
Definition: definitions.h:49
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:585
KIGFX::GAL * GetGAL() const
Function GetGAL() Returns a pointer to the GAL instance used in the panel.
void SetLayerVisible(int aLayer, bool aVisible=true)
Function SetLayerVisible() Controls the visibility of a particular layer.
Definition: view.h:399
void UpdateDisplayOptions(PCB_DISPLAY_OPTIONS *aOptions)
Definition: pcb_view.cpp:113
virtual KIGFX::PCB_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
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...
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Function IsElementVisible tests whether a given element category is visible.
virtual void OnModify()
Function OnModify Virtual Must be called after a change in order to set the "modify" flag of the curr...
bool IsType(FRAME_T aType) const
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:161
void SetGridVisibility(bool aVisibility)
Sets the visibility setting of the grid.
BOARD * GetBoard() const

References FRAME_PCB_EDITOR, GAL_LAYER_ID_END, GAL_LAYER_ID_START, PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetCanvas(), PCB_BASE_FRAME::GetDisplayOptions(), EDA_DRAW_PANEL_GAL::GetGAL(), PCB_DRAW_PANEL_GAL::GetView(), BOARD::IsElementVisible(), EDA_DRAW_FRAME::IsGridVisible(), EDA_BASE_FRAME::IsType(), LAYER_GRID, LAYER_RATSNEST, KIGFX::VIEW::MarkTargetDirty(), myframe, PCB_BASE_FRAME::OnModify(), EDA_DRAW_PANEL_GAL::Refresh(), BOARD::SetElementVisibility(), KIGFX::GAL::SetGridVisibility(), KIGFX::VIEW::SetLayerVisible(), KIGFX::TARGET_NONCACHED, and KIGFX::PCB_VIEW::UpdateDisplayOptions().

◆ OnRenderSwatchChanged()

void LAYER_WIDGET::OnRenderSwatchChanged ( wxCommandEvent &  aEvent)
protectedinherited

Function OnRenderSwatchChanged Called when user has changed the swatch color of a render entry.

Definition at line 198 of file layer_widget.cpp.

199 {
200  auto eventSource = static_cast<COLOR_SWATCH*>( aEvent.GetEventObject() );
201 
202  COLOR4D newColor = eventSource->GetSwatchColor();
203 
204  LAYER_NUM id = getDecodedId( eventSource->GetId() );
205 
206  if( id == LAYER_PCB_BACKGROUND )
207  {
208  // Update all swatch backgrounds
209  int count = GetLayerRowCount();
210  int row;
211  int col = 1; // bitmap button is column 1 in layers tab
212  for( row = 0; row < count; ++row )
213  {
214  COLOR_SWATCH* swatch = dynamic_cast<COLOR_SWATCH*>( getLayerComp( row, col ) );
215  if( swatch )
216  swatch->SetSwatchBackground( newColor );
217  }
218 
219  count = GetRenderRowCount();
220  col = 0; // bitmap button is column 0 in render tab
221  for( row = 0; row < count; ++row )
222  {
223  COLOR_SWATCH* swatch = dynamic_cast<COLOR_SWATCH*>( getRenderComp( row, col ) );
224  if( swatch )
225  swatch->SetSwatchBackground( newColor );
226  }
227  }
228 
229  // tell the client code.
230  OnRenderColorChange( id, newColor );
231 
232  passOnFocus();
233 }
virtual void OnRenderColorChange(int aId, COLOR4D aColor)=0
Function OnRenderColorChange is called to notify client code whenever the user changes a rendering co...
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.
wxWindow * getRenderComp(int aRow, int aColumn) const
static LAYER_NUM getDecodedId(int aControlId)
Function getDecodedId decodes aControlId to original un-encoded value.
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
int GetLayerRowCount() const
Function GetLayerRowCount returns the number of rows in the layer tab.
void passOnFocus()
Function passOnFocus gives away the keyboard focus up to the main parent window.
Class representing a simple color swatch, of the kind used to set layer colors.
Definition: color_swatch.h:38
int GetRenderRowCount() const
Function GetRenderRowCount returns the number of rows in the render tab.
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

References LAYER_WIDGET::getDecodedId(), LAYER_WIDGET::getLayerComp(), LAYER_WIDGET::GetLayerRowCount(), LAYER_WIDGET::getRenderComp(), LAYER_WIDGET::GetRenderRowCount(), LAYER_PCB_BACKGROUND, LAYER_WIDGET::OnRenderColorChange(), LAYER_WIDGET::passOnFocus(), and COLOR_SWATCH::SetSwatchBackground().

Referenced by LAYER_WIDGET::insertRenderRow().

◆ OnRightDownLayer()

void LAYER_WIDGET::OnRightDownLayer ( wxMouseEvent &  event,
COLOR_SWATCH aColorSwatch,
const wxString &  aLayerName 
)
protectedinherited

Function OnRightDownLayer Called when user right-clicks a layer.

Definition at line 125 of file layer_widget.cpp.

126 {
127  wxMenu menu;
128 
130  _( "Change Layer Color for " ) + aLayerName,
131  KiBitmap( setcolor_copper_xpm ) );
132  menu.AppendSeparator();
133 
134  OnLayerRightClick( menu );
135 
136  menu.Bind( wxEVT_COMMAND_MENU_SELECTED, [aColorSwatch]( wxCommandEvent& event ) {
137  if ( event.GetId() == ID_CHANGE_LAYER_COLOR ) {
138  aColorSwatch->GetNewSwatchColor();
139  } else {
140  event.Skip();
141  }
142  } );
143 
144  PopupMenu( &menu );
145  passOnFocus();
146 }
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:251
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
#define _(s)
void passOnFocus()
Function passOnFocus gives away the keyboard focus up to the main parent window.
virtual void OnLayerRightClick(wxMenu &aMenu)=0
Function OnLayerRightClick is called to notify client code about a layer being right-clicked.
void GetNewSwatchColor()
Prompt for a new colour, using the colour picker dialog.

References _, AddMenuItem(), COLOR_SWATCH::GetNewSwatchColor(), LAYER_WIDGET::ID_CHANGE_LAYER_COLOR, KiBitmap(), LAYER_WIDGET::OnLayerRightClick(), and LAYER_WIDGET::passOnFocus().

Referenced by LAYER_WIDGET::insertLayerRow().

◆ onRightDownLayers()

void PCB_LAYER_WIDGET::onRightDownLayers ( wxMouseEvent &  event)
protected

Function OnRightDownLayers puts up a popup menu for the layer panel.

Definition at line 194 of file pcb_layer_widget.cpp.

195 {
196  wxMenu menu;
197 
198  AddRightClickMenuItems( menu );
199  PopupMenu( &menu );
200 
201  passOnFocus();
202 }
void AddRightClickMenuItems(wxMenu &menu)
Function addRightClickMenuItems add menu items to a menu that should be shown when right-clicking the...
void passOnFocus()
Function passOnFocus gives away the keyboard focus up to the main parent window.

References AddRightClickMenuItems(), and LAYER_WIDGET::passOnFocus().

Referenced by PCB_LAYER_WIDGET().

◆ OnRightDownRender()

void LAYER_WIDGET::OnRightDownRender ( wxMouseEvent &  aEvent,
COLOR_SWATCH aColorSwatch,
const wxString &  aRenderName 
)
protectedinherited

Function OnRightDownRender Called when user right-clicks a render option.

Definition at line 177 of file layer_widget.cpp.

178 {
179  wxMenu menu;
180 
182  _( "Change Render Color for " ) + aRenderName,
183  KiBitmap( setcolor_board_body_xpm ) );
184 
185  menu.Bind( wxEVT_COMMAND_MENU_SELECTED, [aColorSwatch]( wxCommandEvent& event ) {
186  if ( event.GetId() == ID_CHANGE_RENDER_COLOR ) {
187  aColorSwatch->GetNewSwatchColor();
188  } else {
189  event.Skip();
190  }
191  } );
192 
193  PopupMenu( &menu );
194  passOnFocus();
195 }
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:251
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
#define _(s)
void passOnFocus()
Function passOnFocus gives away the keyboard focus up to the main parent window.
void GetNewSwatchColor()
Prompt for a new colour, using the colour picker dialog.

References _, AddMenuItem(), COLOR_SWATCH::GetNewSwatchColor(), LAYER_WIDGET::ID_CHANGE_RENDER_COLOR, KiBitmap(), and LAYER_WIDGET::passOnFocus().

Referenced by LAYER_WIDGET::insertRenderRow().

◆ OnTabChange()

void LAYER_WIDGET::OnTabChange ( wxNotebookEvent &  event)
protectedinherited

Definition at line 245 of file layer_widget.cpp.

246 {
247 // wxFocusEvent event( wxEVT_SET_FOCUS );
248 // m_FocusOwner->AddPendingEvent( event );
249 
250  passOnFocus(); // does not work in this context, probably because we have receive control here too early.
251 }
void passOnFocus()
Function passOnFocus gives away the keyboard focus up to the main parent window.

References LAYER_WIDGET::passOnFocus().

Referenced by LAYER_WIDGET::LAYER_WIDGET().

◆ passOnFocus()

◆ ReFill()

void PCB_LAYER_WIDGET::ReFill ( )

Definition at line 482 of file pcb_layer_widget.cpp.

483 {
484  BOARD* brd = myframe->GetBoard();
485  LSET enabled = brd->GetEnabledLayers();
486 
487  ClearLayerRows();
488 
489  wxString dsc;
490 
491  // show all coppers first, with front on top, back on bottom, then technical layers
492  for( LSEQ cu_stack = enabled.CuStack(); cu_stack; ++cu_stack )
493  {
494  PCB_LAYER_ID layer = *cu_stack;
495 
496  switch( layer )
497  {
498  case F_Cu:
499  dsc = _( "Front copper layer" );
500  break;
501 
502  case B_Cu:
503  dsc = _( "Back copper layer" );
504  break;
505 
506  default:
507  dsc = _( "Inner copper layer" );
508  break;
509  }
510 
511  AppendLayerRow( LAYER_WIDGET::ROW( brd->GetLayerName( layer ), layer,
512  myframe->Settings().Colors().GetLayerColor( layer ), dsc, true, true,
513  myframe->Settings().Colors().GetDefaultLayerColor( layer ) ) );
514 
515  if( m_fp_editor_mode && LSET::ForbiddenFootprintLayers().test( layer ) )
516  {
517  getLayerComp( GetLayerRowCount()-1, COLUMN_COLOR_LYRNAME )->Enable( false );
518  getLayerComp( GetLayerRowCount()-1, COLUMN_COLORBM )->SetToolTip( wxEmptyString );
519  }
520  }
521 
522  UpdateLayouts();
523 
524 
525  // technical layers are shown in this order:
526  // Because they are static, wxGetTranslation must be explicitly
527  // called for tooltips.
528  static const struct {
529  PCB_LAYER_ID layerId;
530  wxString tooltip;
531  } non_cu_seq[] = {
532  { F_Adhes, _( "Adhesive on board's front" ) },
533  { B_Adhes, _( "Adhesive on board's back" ) },
534  { F_Paste, _( "Solder paste on board's front" ) },
535  { B_Paste, _( "Solder paste on board's back" ) },
536  { F_SilkS, _( "Silkscreen on board's front" ) },
537  { B_SilkS, _( "Silkscreen on board's back" ) },
538  { F_Mask, _( "Solder mask on board's front" ) },
539  { B_Mask, _( "Solder mask on board's back" ) },
540  { Dwgs_User, _( "Explanatory drawings" ) },
541  { Cmts_User, _( "Explanatory comments" ) },
542  { Eco1_User, _( "User defined meaning" ) },
543  { Eco2_User, _( "User defined meaning" ) },
544  { Edge_Cuts, _( "Board's perimeter definition" ) },
545  { Margin, _( "Board's edge setback outline" ) },
546  { F_CrtYd, _( "Footprint courtyards on board's front" ) },
547  { B_CrtYd, _( "Footprint courtyards on board's back" ) },
548  { F_Fab, _( "Footprint assembly on board's front" ) },
549  { B_Fab, _( "Footprint assembly on board's back" ) }
550  };
551 
552  for( unsigned i=0; i<arrayDim( non_cu_seq ); ++i )
553  {
554  PCB_LAYER_ID layer = non_cu_seq[i].layerId;
555 
556  if( !enabled[layer] )
557  continue;
558 
559  AppendLayerRow( LAYER_WIDGET::ROW( brd->GetLayerName( layer ), layer,
560  myframe->Settings().Colors().GetLayerColor( layer ),
561  wxGetTranslation( non_cu_seq[i].tooltip ), true, true,
562  myframe->Settings().Colors().GetDefaultLayerColor( layer ) ) );
563 
564  if( m_fp_editor_mode && LSET::ForbiddenFootprintLayers().test( layer ) )
565  {
566  getLayerComp( GetLayerRowCount()-1, COLUMN_COLOR_LYRNAME )->Enable( false );
567  getLayerComp( GetLayerRowCount()-1, COLUMN_COLORBM )->SetToolTip( wxEmptyString );
568  }
569  }
570 }
#define COLUMN_COLOR_LYRNAME
Definition: layer_widget.h:55
LSEQ CuStack() const
Function CuStack returns a sequence of copper layers in starting from the front/top and extending to ...
Definition: lset.cpp:150
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer given by aLayer.
Struct ROW provides all the data needed to add a row to a LAYER_WIDGET.
Definition: layer_widget.h:87
static LSET ForbiddenFootprintLayers()
Function ForbiddenFootprintLayers Layers which are not allowed within footprint definitions.
Definition: lset.cpp:789
void UpdateLayouts()
PCB_BASE_FRAME * myframe
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...
LSET GetEnabledLayers() const
Function GetEnabledLayers is a proxy function that calls the corresponding function in m_BoardSetting...
static COLOR4D GetDefaultLayerColor(LAYER_NUM aLayer)
Function GetDefaultLayerColor.
void ClearLayerRows()
Function ClearLayerRows empties out the layer rows.
COLOR4D GetLayerColor(LAYER_NUM aLayer) const
Function GetLayerColor.
PCB_LAYER_ID
A quick note on layer IDs:
Class LSET is a set of PCB_LAYER_IDs.
#define COLUMN_COLORBM
Definition: layer_widget.h:53
PCB_GENERAL_SETTINGS & Settings()
void AppendLayerRow(const ROW &aRow)
Function AppendLayerRow appends a new row in the layer portion of the widget.
#define _(s)
Class LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
COLORS_DESIGN_SETTINGS & Colors()
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108
int GetLayerRowCount() const
Function GetLayerRowCount returns the number of rows in the layer tab.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:161
size_t i
Definition: json11.cpp:597
BOARD * GetBoard() const

References _, LAYER_WIDGET::AppendLayerRow(), arrayDim(), B_Adhes, B_CrtYd, B_Cu, B_Fab, B_Mask, B_Paste, B_SilkS, LAYER_WIDGET::ClearLayerRows(), Cmts_User, PCB_GENERAL_SETTINGS::Colors(), COLUMN_COLOR_LYRNAME, COLUMN_COLORBM, LSET::CuStack(), Dwgs_User, Eco1_User, Eco2_User, Edge_Cuts, F_Adhes, F_CrtYd, F_Cu, F_Fab, F_Mask, F_Paste, F_SilkS, LSET::ForbiddenFootprintLayers(), PCB_BASE_FRAME::GetBoard(), COLORS_DESIGN_SETTINGS::GetDefaultLayerColor(), BOARD::GetEnabledLayers(), COLORS_DESIGN_SETTINGS::GetLayerColor(), LAYER_WIDGET::getLayerComp(), BOARD::GetLayerName(), LAYER_WIDGET::GetLayerRowCount(), i, m_fp_editor_mode, Margin, myframe, PCB_BASE_FRAME::Settings(), and LAYER_WIDGET::UpdateLayouts().

Referenced by FOOTPRINT_EDIT_FRAME::ReFillLayerWidget().

◆ ReFillRender()

void PCB_LAYER_WIDGET::ReFillRender ( )

Function ReFillRender rebuilds Render for instance after the config is read.

Definition at line 373 of file pcb_layer_widget.cpp.

374 {
375  BOARD* board = myframe->GetBoard();
376  auto settings = board->GetDesignSettings();
377 
378  ClearRenderRows();
379 
380  // Add "Items" tab rows to LAYER_WIDGET, after setting color and checkbox state.
381  // Because s_render_rows is created static, we must explicitly call
382  // wxGetTranslation for texts which are internationalized (tool tips
383  // and item names)
384  for( unsigned row=0; row<arrayDim(s_render_rows); ++row )
385  {
386  LAYER_WIDGET::ROW renderRow = s_render_rows[row];
387 
388  if( m_fp_editor_mode && !isAllowedInFpMode( renderRow.id ) )
389  continue;
390 
391  if( renderRow.id == LAYER_VIA_MICROVIA && !settings.m_MicroViasAllowed )
392  continue;
393 
394  if( renderRow.id == LAYER_VIA_BBLIND && !settings.m_BlindBuriedViaAllowed )
395  continue;
396 
397  if( !renderRow.spacer )
398  {
399  renderRow.tooltip = wxGetTranslation( s_render_rows[row].tooltip );
400  renderRow.rowName = wxGetTranslation( s_render_rows[row].rowName );
401 
402  if( renderRow.color != COLOR4D::UNSPECIFIED ) // does this row show a color?
403  {
404  // this window frame must have an established BOARD, i.e. after SetBoard()
405  renderRow.color = myframe->Settings().Colors().GetItemColor(
406  static_cast<GAL_LAYER_ID>( renderRow.id ) );
408  static_cast<GAL_LAYER_ID>( renderRow.id ) );
409  }
410 
411  if( renderRow.id == LAYER_RATSNEST )
412  renderRow.state =
413  static_cast<PCB_DISPLAY_OPTIONS*>( myframe->GetDisplayOptions() )->m_ShowGlobalRatsnest;
414  else
415  renderRow.state = board->IsElementVisible(
416  static_cast<GAL_LAYER_ID>( renderRow.id ) );
417  }
418 
419  AppendRenderRow( renderRow );
420  }
421 
422  UpdateLayouts();
423 }
COLOR4D defaultColor
The default color for the row.
Definition: layer_widget.h:96
to draw blind/buried vias
Struct ROW provides all the data needed to add a row to a LAYER_WIDGET.
Definition: layer_widget.h:87
bool spacer
if true, this row is a spacer
Definition: layer_widget.h:95
void UpdateLayouts()
PCB_BASE_FRAME * myframe
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:540
void ClearRenderRows()
Function ClearRenderRows empties out the render rows.
bool state
initial wxCheckBox state
Definition: layer_widget.h:92
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:93
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.
COLOR4D color
COLOR4D::UNSPECIFIED if none.
Definition: layer_widget.h:91
bool isAllowedInFpMode(int aId)
Function isAllowedInFpMode.
PCB_GENERAL_SETTINGS & Settings()
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.
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Function IsElementVisible tests whether a given element category is visible.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:161
wxString rowName
the prompt or layername
Definition: layer_widget.h:89
static COLOR4D GetDefaultItemColor(int aItemIdx)
Function GetDefaultItemColor.
BOARD * GetBoard() const
int id
either a layer or "visible element" id
Definition: layer_widget.h:90

References LAYER_WIDGET::AppendRenderRow(), arrayDim(), LAYER_WIDGET::ClearRenderRows(), LAYER_WIDGET::ROW::color, PCB_GENERAL_SETTINGS::Colors(), LAYER_WIDGET::ROW::defaultColor, PCB_BASE_FRAME::GetBoard(), COLORS_DESIGN_SETTINGS::GetDefaultItemColor(), BOARD::GetDesignSettings(), PCB_BASE_FRAME::GetDisplayOptions(), COLORS_DESIGN_SETTINGS::GetItemColor(), LAYER_WIDGET::ROW::id, isAllowedInFpMode(), BOARD::IsElementVisible(), LAYER_RATSNEST, LAYER_VIA_BBLIND, LAYER_VIA_MICROVIA, m_fp_editor_mode, myframe, LAYER_WIDGET::ROW::rowName, s_render_rows, PCB_BASE_FRAME::Settings(), LAYER_WIDGET::ROW::spacer, LAYER_WIDGET::ROW::state, LAYER_WIDGET::ROW::tooltip, and LAYER_WIDGET::UpdateLayouts().

Referenced by FOOTPRINT_EDIT_FRAME::UpdateUserInterface().

◆ SelectLayer()

void LAYER_WIDGET::SelectLayer ( LAYER_NUM  aLayer)
inherited

Function SelectLayer changes the row selection in the layer list to aLayer provided.

Definition at line 669 of file layer_widget.cpp.

670 {
671  int row = findLayerRow( aLayer );
672  SelectLayerRow( row );
673 }
int findLayerRow(LAYER_NUM aLayer) const
Function findLayerRow returns the row index that aLayer resides in, or -1 if not found.
void SelectLayerRow(int aRow)
Function SelectLayerRow changes the row selection in the layer list to the given row.

References LAYER_WIDGET::findLayerRow(), and LAYER_WIDGET::SelectLayerRow().

Referenced by GERBVIEW_FRAME::SetActiveLayer(), GERBVIEW_FRAME::syncLayerWidget(), and FOOTPRINT_EDIT_FRAME::UpdateUserInterface().

◆ SelectLayerRow()

void LAYER_WIDGET::SelectLayerRow ( int  aRow)
inherited

Function SelectLayerRow changes the row selection in the layer list to the given row.

Definition at line 635 of file layer_widget.cpp.

636 {
637  // enable the layer tab at index 0
638  m_notebook->SetSelection( 0 );
639 
640  INDICATOR_ICON* oldIndicator = (INDICATOR_ICON*) getLayerComp( m_CurrentRow, 0 );
641  if( oldIndicator )
642  {
644  oldIndicator->SetIndicatorState( ROW_ICON_PROVIDER::STATE::DIMMED );
645  else
647  }
648 
649  INDICATOR_ICON* newIndicator = (INDICATOR_ICON*) getLayerComp( aRow, 0 );
650  if( newIndicator )
651  {
653 
654  // Make sure the desired layer row is visible.
655  // It seems that as of 2.8.2, setting the focus does this.
656  // I don't expect the scrolling to be needed at all because
657  // the minimum window size may end up being established so that the
658  // scroll bars will not be visible.
659  getLayerComp( aRow, 1 )->SetFocus();
660  }
661 
662  m_CurrentRow = aRow;
663 
664  // give the focus back to the app.
665  passOnFocus();
666 }
void SetIndicatorState(ICON_ID aIconId)
Sets the row indiciator to the given state.
wxAuiNotebook * m_notebook
Definition: layer_widget.h:127
int m_CurrentRow
selected row of layer list
Definition: layer_widget.h:136
#define OFF
virtual bool useAlternateBitmap(int aRow)
Virtual Function useAlternateBitmap.
Definition: layer_widget.h:149
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...
Class representing a row indicator icon for use in places like the layer widget.
void passOnFocus()
Function passOnFocus gives away the keyboard focus up to the main parent window.
#define ON

References LAYER_WIDGET::getLayerComp(), LAYER_WIDGET::m_CurrentRow, LAYER_WIDGET::m_notebook, OFF, ON, LAYER_WIDGET::passOnFocus(), INDICATOR_ICON::SetIndicatorState(), and LAYER_WIDGET::useAlternateBitmap().

Referenced by LAYER_WIDGET::OnLeftDownLayers(), and LAYER_WIDGET::SelectLayer().

◆ setLayerCheckbox()

void LAYER_WIDGET::setLayerCheckbox ( LAYER_NUM  aLayer,
bool  isVisible 
)
protectedinherited

Definition at line 693 of file layer_widget.cpp.

694 {
695  int row = findLayerRow( aLayer );
696  if( row >= 0 )
697  {
698  wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
699  wxASSERT( cb );
700  cb->SetValue( isVisible ); // does not fire an event
701  }
702 }
int findLayerRow(LAYER_NUM aLayer) const
Function findLayerRow returns the row index that aLayer resides in, or -1 if not found.
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...
#define COLUMN_COLOR_LYR_CB
Definition: layer_widget.h:54

References COLUMN_COLOR_LYR_CB, LAYER_WIDGET::findLayerRow(), and LAYER_WIDGET::getLayerComp().

Referenced by LAYER_WIDGET::SetLayerVisible(), and SyncLayerVisibilities().

◆ SetLayerColor()

void LAYER_WIDGET::SetLayerColor ( LAYER_NUM  aLayer,
COLOR4D  aColor 
)
inherited

Function SetLayerColor changes the color of aLayer.

Definition at line 718 of file layer_widget.cpp.

719 {
720  int row = findLayerRow( aLayer );
721  if( row >= 0 )
722  {
723  int col = 1; // bitmap button is column 1
724  auto swatch = static_cast<COLOR_SWATCH*>( getLayerComp( row, col ) );
725  wxASSERT( swatch );
726 
727  swatch->SetSwatchColor( aColor, false );
728  }
729 }
int findLayerRow(LAYER_NUM aLayer) const
Function findLayerRow returns the row index that aLayer resides in, or -1 if not found.
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...

References LAYER_WIDGET::findLayerRow(), and LAYER_WIDGET::getLayerComp().

◆ SetLayersManagerTabsText()

void PCB_LAYER_WIDGET::SetLayersManagerTabsText ( )

Function SetLayersManagerTabsText Update the layer manager tabs labels Useful when changing Language or to set labels to a non default value.

Definition at line 366 of file pcb_layer_widget.cpp.

367 {
368  m_notebook->SetPageText( 0, _( "Layers" ) );
369  m_notebook->SetPageText( 1, _( "Items" ) );
370 }
wxAuiNotebook * m_notebook
Definition: layer_widget.h:127
#define _(s)

References _, and LAYER_WIDGET::m_notebook.

Referenced by PCB_LAYER_WIDGET(), and FOOTPRINT_EDIT_FRAME::ShowChangedLanguage().

◆ SetLayerVisible()

void LAYER_WIDGET::SetLayerVisible ( LAYER_NUM  aLayer,
bool  isVisible 
)
inherited

Function SetLayerVisible sets aLayer visible or not.

This does not invoke OnLayerVisible().

Definition at line 686 of file layer_widget.cpp.

687 {
688  setLayerCheckbox( aLayer, isVisible );
689  OnLayerVisible( aLayer, isVisible );
690 }
virtual void OnLayerVisible(LAYER_NUM aLayer, bool isVisible, bool isFinal=true)=0
Function OnLayerVisible is called to notify client code about a layer visibility change.
void setLayerCheckbox(LAYER_NUM aLayer, bool isVisible)

References LAYER_WIDGET::OnLayerVisible(), and LAYER_WIDGET::setLayerCheckbox().

Referenced by ROUTER_TOOL::prepareInteractive().

◆ SetRenderState()

void LAYER_WIDGET::SetRenderState ( int  aId,
bool  isSet 
)
inherited

Function SetRenderState sets the state of the checkbox associated with aId within the Render tab group of the widget.

Does not fire an event, i.e. does not invoke OnRenderEnable().

Parameters
aIdis the same unique id used when adding a ROW to the Render tab.
isSet= the new checkbox state

Definition at line 748 of file layer_widget.cpp.

749 {
750  int row = findRenderRow( aId );
751 
752  if( row >= 0 )
753  {
754  int col = 1; // checkbox is column 1
755  wxCheckBox* cb = (wxCheckBox*) getRenderComp( row, col );
756  wxASSERT( cb );
757  cb->SetValue( isSet ); // does not fire an event
758  }
759 }
int findRenderRow(int aId) const
wxWindow * getRenderComp(int aRow, int aColumn) const

References LAYER_WIDGET::findRenderRow(), and LAYER_WIDGET::getRenderComp().

Referenced by FOOTPRINT_EDIT_FRAME::SetElementVisibility(), GERBVIEW_FRAME::SetElementVisibility(), and GERBVIEW_FRAME::SetGridVisibility().

◆ SyncLayerAlphaIndicators()

void PCB_LAYER_WIDGET::SyncLayerAlphaIndicators ( )

Function SyncLayerAlphaIndicators updates each "Layer"s alpha indicator to show if the board is currently being rendered with more transparency or less.

Definition at line 448 of file pcb_layer_widget.cpp.

449 {
450  int count = GetLayerRowCount();
452  KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( mgr->GetView()->GetPainter() );
453  KIGFX::PCB_RENDER_SETTINGS* settings = painter->GetSettings();
454 
455  for( int row = 0; row < count; ++row )
456  {
457  // this utilizes more implementation knowledge than ideal, eventually
458  // add member ROW getRow() or similar to base LAYER_WIDGET.
459 
460  wxWindow* w = getLayerComp( row, COLUMN_ICON_ACTIVE );
461  PCB_LAYER_ID layerId = ToLAYER_ID( getDecodedId( w->GetId() ) );
462  KIGFX::COLOR4D screenColor = settings->GetLayerColor( layerId );
463 
464  COLOR_SWATCH* swatch = static_cast<COLOR_SWATCH*>( getLayerComp( row, COLUMN_COLORBM ) );
465  KIGFX::COLOR4D layerColor = swatch->GetSwatchColor();
466 
467  INDICATOR_ICON* indicator = static_cast<INDICATOR_ICON*>( getLayerComp( row, COLUMN_ALPHA_INDICATOR ) );
468 
469  if( std::abs( screenColor.a - layerColor.a ) > ALPHA_EPSILON )
470  {
471  if( screenColor.a < layerColor.a )
472  indicator->SetIndicatorState( ROW_ICON_PROVIDER::STATE::DOWN );
473  else
474  indicator->SetIndicatorState( ROW_ICON_PROVIDER::STATE::UP );
475  }
476  else
478  }
479 }
void SetIndicatorState(ICON_ID aIconId)
Sets the row indiciator to the given state.
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:241
#define ALPHA_EPSILON
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
KIGFX::COLOR4D GetSwatchColor() const
#define COLUMN_ALPHA_INDICATOR
Definition: layer_widget.h:56
PCB_BASE_FRAME * myframe
#define OFF
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...
Class PCB_PAINTER Contains methods for drawing PCB-specific items.
Definition: pcb_painter.h:226
#define abs(a)
Definition: auxiliary.h:84
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
Class PCB_RENDER_SETTINGS Stores PCB specific render settings.
Definition: pcb_painter.h:61
Class TOOL_MANAGER.
Definition: tool_manager.h:50
PCB_LAYER_ID
A quick note on layer IDs:
Class representing a row indicator icon for use in places like the layer widget.
double a
Alpha component.
Definition: color4d.h:304
#define COLUMN_ICON_ACTIVE
Definition: layer_widget.h:52
#define COLUMN_COLORBM
Definition: layer_widget.h:53
virtual PCB_RENDER_SETTINGS * GetSettings() override
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
Definition: pcb_painter.h:238
static LAYER_NUM getDecodedId(int aControlId)
Function getDecodedId decodes aControlId to original un-encoded value.
int GetLayerRowCount() const
Function GetLayerRowCount returns the number of rows in the layer tab.
Class representing a simple color swatch, of the kind used to set layer colors.
Definition: color_swatch.h:38
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:813
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

References KIGFX::COLOR4D::a, abs, ALPHA_EPSILON, COLUMN_ALPHA_INDICATOR, COLUMN_COLORBM, COLUMN_ICON_ACTIVE, LAYER_WIDGET::getDecodedId(), LAYER_WIDGET::getLayerComp(), LAYER_WIDGET::GetLayerRowCount(), KIGFX::VIEW::GetPainter(), KIGFX::PCB_PAINTER::GetSettings(), COLOR_SWATCH::GetSwatchColor(), EDA_BASE_FRAME::GetToolManager(), TOOL_MANAGER::GetView(), myframe, OFF, INDICATOR_ICON::SetIndicatorState(), and ToLAYER_ID().

Referenced by FOOTPRINT_EDIT_FRAME::OnUpdateLayerAlpha().

◆ SyncLayerVisibilities()

void PCB_LAYER_WIDGET::SyncLayerVisibilities ( )

Function SyncLayerVisibilities updates each "Layer" checkbox in this layer widget according to each layer's current visibility determined by IsLayerVisible(), and is helpful immediately after loading a BOARD which may have state information in it.

Definition at line 426 of file pcb_layer_widget.cpp.

427 {
428  BOARD* board = myframe->GetBoard();
429  int count = GetLayerRowCount();
430 
431  for( int row=0; row<count; ++row )
432  {
433  // this utilizes more implementation knowledge than ideal, eventually
434  // add member ROW getRow() or similar to base LAYER_WIDGET.
435 
436  wxWindow* w = getLayerComp( row, COLUMN_ICON_ACTIVE );
437 
438  PCB_LAYER_ID layerId = ToLAYER_ID( getDecodedId( w->GetId() ) );
439 
440  // this does not fire a UI event
441  setLayerCheckbox( layerId, board->IsLayerVisible( layerId ) );
442  }
443 }
PCB_BASE_FRAME * myframe
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...
PCB_LAYER_ID
A quick note on layer IDs:
#define COLUMN_ICON_ACTIVE
Definition: layer_widget.h:52
void setLayerCheckbox(LAYER_NUM aLayer, bool isVisible)
static LAYER_NUM getDecodedId(int aControlId)
Function getDecodedId decodes aControlId to original un-encoded value.
int GetLayerRowCount() const
Function GetLayerRowCount returns the number of rows in the layer tab.
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:459
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:161
BOARD * GetBoard() const
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:813

References COLUMN_ICON_ACTIVE, PCB_BASE_FRAME::GetBoard(), LAYER_WIDGET::getDecodedId(), LAYER_WIDGET::getLayerComp(), LAYER_WIDGET::GetLayerRowCount(), BOARD::IsLayerVisible(), myframe, LAYER_WIDGET::setLayerCheckbox(), and ToLAYER_ID().

Referenced by FOOTPRINT_EDIT_FRAME::UpdateUserInterface().

◆ UpdateLayerIcons()

void LAYER_WIDGET::UpdateLayerIcons ( )
inherited

Function UpdateLayerIcons Update all layer manager icons (layers only) Useful when loading a file or clearing a layer because they change, and the indicator arrow icon needs to be updated.

Definition at line 788 of file layer_widget.cpp.

789 {
790  int rowCount = GetLayerRowCount();
791 
792  for( int row = 0; row < rowCount ; row++ )
793  {
795 
796  if( indicator )
797  {
799 
800  if( row == m_CurrentRow )
802  else if( useAlternateBitmap( row ) )
803  state = ROW_ICON_PROVIDER::STATE::DIMMED;
804  else
806 
807  indicator->SetIndicatorState( state );
808  }
809  }
810 }
void SetIndicatorState(ICON_ID aIconId)
Sets the row indiciator to the given state.
int m_CurrentRow
selected row of layer list
Definition: layer_widget.h:136
#define OFF
virtual bool useAlternateBitmap(int aRow)
Virtual Function useAlternateBitmap.
Definition: layer_widget.h:149
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...
Class representing a row indicator icon for use in places like the layer widget.
#define COLUMN_ICON_ACTIVE
Definition: layer_widget.h:52
int GetLayerRowCount() const
Function GetLayerRowCount returns the number of rows in the layer tab.
STATE
State constants to select the right icons
#define ON

References COLUMN_ICON_ACTIVE, LAYER_WIDGET::getLayerComp(), LAYER_WIDGET::GetLayerRowCount(), LAYER_WIDGET::m_CurrentRow, OFF, ON, INDICATOR_ICON::SetIndicatorState(), and LAYER_WIDGET::useAlternateBitmap().

Referenced by GERBVIEW_FRAME::LoadExcellonFiles(), GERBVIEW_FRAME::loadListOfGerberAndDrillFiles(), and GERBVIEW_FRAME::LoadZipArchiveFile().

◆ UpdateLayouts()

void LAYER_WIDGET::UpdateLayouts ( )
inherited

Definition at line 778 of file layer_widget.cpp.

779 {
780  m_LayersFlexGridSizer->Layout();
781  m_RenderFlexGridSizer->Layout();
782  m_LayerPanel->Layout();
783  m_RenderingPanel->Layout();
784  FitInside();
785 }
wxFlexGridSizer * m_LayersFlexGridSizer
Definition: layer_widget.h:130
wxFlexGridSizer * m_RenderFlexGridSizer
Definition: layer_widget.h:133
wxPanel * m_RenderingPanel
Definition: layer_widget.h:131
wxPanel * m_LayerPanel
Definition: layer_widget.h:128

References LAYER_WIDGET::m_LayerPanel, LAYER_WIDGET::m_LayersFlexGridSizer, LAYER_WIDGET::m_RenderFlexGridSizer, and LAYER_WIDGET::m_RenderingPanel.

Referenced by LAYER_WIDGET::AppendLayerRows(), LAYER_WIDGET::AppendRenderRows(), ReFill(), GERBER_LAYER_WIDGET::ReFill(), and ReFillRender().

◆ useAlternateBitmap()

virtual bool LAYER_WIDGET::useAlternateBitmap ( int  aRow)
inlineprotectedvirtualinherited

Virtual Function useAlternateBitmap.

Returns
true if bitmaps shown in Render layer list are alternate bitmaps, or false if they are "normal" bitmaps This is a virtual function because Pcbnew uses normal bitmaps but GerbView uses both bitmaps (alternate bitmaps to show layers in use, normal fo others)

Reimplemented in GERBER_LAYER_WIDGET.

Definition at line 149 of file layer_widget.h.

149 { return false; }

Referenced by LAYER_WIDGET::SelectLayerRow(), and LAYER_WIDGET::UpdateLayerIcons().

Member Data Documentation

◆ EVT_LAYER_COLOR_CHANGE

const wxEventType LAYER_WIDGET::EVT_LAYER_COLOR_CHANGE = wxNewEventType()
staticinherited

Definition at line 123 of file layer_widget.h.

Referenced by LAYER_WIDGET::OnLayerSwatchChanged().

◆ m_alwaysShowActiveCopperLayer

bool PCB_LAYER_WIDGET::m_alwaysShowActiveCopperLayer
protected

◆ m_CurrentRow

int LAYER_WIDGET::m_CurrentRow
protectedinherited

◆ m_FocusOwner

wxWindow* LAYER_WIDGET::m_FocusOwner
protectedinherited

Definition at line 135 of file layer_widget.h.

Referenced by LAYER_WIDGET::LAYER_WIDGET(), and LAYER_WIDGET::passOnFocus().

◆ m_fp_editor_mode

bool PCB_LAYER_WIDGET::m_fp_editor_mode
protected

◆ m_IconProvider

ROW_ICON_PROVIDER* LAYER_WIDGET::m_IconProvider
protectedinherited

◆ m_LayerPanel

wxPanel* LAYER_WIDGET::m_LayerPanel
protectedinherited

◆ m_LayerScrolledWindow

wxScrolledWindow* LAYER_WIDGET::m_LayerScrolledWindow
protectedinherited

◆ m_LayersFlexGridSizer

◆ m_notebook

wxAuiNotebook* LAYER_WIDGET::m_notebook
protectedinherited

◆ m_PointSize

int LAYER_WIDGET::m_PointSize
protectedinherited

◆ m_RenderFlexGridSizer

◆ m_RenderingPanel

wxPanel* LAYER_WIDGET::m_RenderingPanel
protectedinherited

◆ m_RenderScrolledWindow

wxScrolledWindow* LAYER_WIDGET::m_RenderScrolledWindow
protectedinherited

Definition at line 132 of file layer_widget.h.

Referenced by LAYER_WIDGET::insertRenderRow(), and LAYER_WIDGET::LAYER_WIDGET().

◆ myframe

◆ s_render_rows

const LAYER_WIDGET::ROW PCB_LAYER_WIDGET::s_render_rows
staticprotected

This is a read only template that is copied and modified before adding to LAYER_WIDGET.

Definition at line 117 of file pcb_layer_widget.h.

Referenced by ReFillRender().


The documentation for this class was generated from the following files: