KiCad PCB EDA Suite
PCB_LAYER_SELECTOR Class Reference
Inheritance diagram for PCB_LAYER_SELECTOR:
LAYER_SELECTOR PCB_ONE_LAYER_SELECTOR SELECT_COPPER_LAYERS_PAIR_DIALOG

Public Member Functions

 PCB_LAYER_SELECTOR (PCB_BASE_FRAME *aFrame)
 
bool SetLayersHotkeys (bool value)
 

Static Public Member Functions

static void DrawColorSwatch (wxBitmap &aLayerbmp, const COLOR4D &aBackground, const COLOR4D &aColor)
 

Protected Member Functions

bool isLayerEnabled (LAYER_NUM aLayer) const override
 
COLOR4D getLayerColor (LAYER_NUM aLayer) const override
 
wxString getLayerName (LAYER_NUM aLayer) const override
 

Protected Attributes

PCB_BASE_FRAMEm_frame
 
bool m_layerhotkeys
 

Detailed Description

Definition at line 44 of file sel_layer.cpp.

Constructor & Destructor Documentation

◆ PCB_LAYER_SELECTOR()

PCB_LAYER_SELECTOR::PCB_LAYER_SELECTOR ( PCB_BASE_FRAME aFrame)
inline

Definition at line 47 of file sel_layer.cpp.

47  :
49  {
50  m_frame = aFrame;
51  }
PCB_BASE_FRAME * m_frame
Definition: sel_layer.cpp:54

References m_frame.

Member Function Documentation

◆ DrawColorSwatch()

void LAYER_SELECTOR::DrawColorSwatch ( wxBitmap &  aLayerbmp,
const COLOR4D aBackground,
const COLOR4D aColor 
)
staticinherited

Definition at line 48 of file layer_box_selector.cpp.

50 {
51  wxMemoryDC bmpDC;
52  wxBrush brush;
53 
54  // Prepare Bitmap
55  bmpDC.SelectObject( aLayerbmp );
56 
57  brush.SetStyle( wxBRUSHSTYLE_SOLID );
58 
59  if( aBackground != COLOR4D::UNSPECIFIED )
60  {
61  brush.SetColour( aBackground.WithAlpha( 1.0 ).ToColour() );
62  bmpDC.SetBrush( brush );
63  bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
64  }
65 
66  brush.SetColour( aColor.ToColour() );
67  bmpDC.SetBrush( brush );
68  bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
69 
70  bmpDC.SetBrush( *wxTRANSPARENT_BRUSH );
71  bmpDC.SetPen( *wxBLACK_PEN );
72  bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
73 }
COLOR4D WithAlpha(double aAlpha) const
Return a color with the same color, but the given alpha.
Definition: color4d.h:308

References KIGFX::COLOR4D::WithAlpha().

Referenced by PANEL_SETUP_BOARD_STACKUP::createColorBox(), GRID_CELL_LAYER_RENDERER::Draw(), PANEL_SETUP_BOARD_STACKUP::onColorSelected(), GBR_LAYER_BOX_SELECTOR::Resync(), PCB_LAYER_BOX_SELECTOR::Resync(), LAYER_BOX_SELECTOR::ResyncBitmapOnly(), and PANEL_SETUP_BOARD_STACKUP::synchronizeWithBoard().

◆ getLayerColor()

COLOR4D PCB_LAYER_SELECTOR::getLayerColor ( LAYER_NUM  aLayer) const
inlineoverrideprotectedvirtual

Implements LAYER_SELECTOR.

Definition at line 63 of file sel_layer.cpp.

64  {
65  return m_frame->GetColorSettings()->GetColor( aLayer );
66  }
PCB_BASE_FRAME * m_frame
Definition: sel_layer.cpp:54
virtual COLOR_SETTINGS * GetColorSettings() const override
Helper to retrieve the current color settings.
COLOR4D GetColor(int aLayer) const

References COLOR_SETTINGS::GetColor(), PCB_BASE_FRAME::GetColorSettings(), and m_frame.

Referenced by PCB_ONE_LAYER_SELECTOR::buildList(), and SELECT_COPPER_LAYERS_PAIR_DIALOG::buildList().

◆ getLayerName()

wxString PCB_LAYER_SELECTOR::getLayerName ( LAYER_NUM  aLayer) const
inlineoverrideprotectedvirtual

Implements LAYER_SELECTOR.

Definition at line 69 of file sel_layer.cpp.

70  {
71  return m_frame->GetBoard()->GetLayerName( ToLAYER_ID( aLayer ) );
72  }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:361
PCB_BASE_FRAME * m_frame
Definition: sel_layer.cpp:54
BOARD * GetBoard() const
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:905

References PCB_BASE_FRAME::GetBoard(), BOARD::GetLayerName(), m_frame, and ToLAYER_ID().

Referenced by PCB_ONE_LAYER_SELECTOR::buildList(), and SELECT_COPPER_LAYERS_PAIR_DIALOG::buildList().

◆ isLayerEnabled()

bool PCB_LAYER_SELECTOR::isLayerEnabled ( LAYER_NUM  aLayer) const
inlineoverrideprotectedvirtual

Implements LAYER_SELECTOR.

Definition at line 57 of file sel_layer.cpp.

58  {
59  return m_frame->GetBoard()->IsLayerEnabled( PCB_LAYER_ID( aLayer ) );
60  }
PCB_BASE_FRAME * m_frame
Definition: sel_layer.cpp:54
bool IsLayerEnabled(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
Definition: board.cpp:492
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:64
BOARD * GetBoard() const

References PCB_BASE_FRAME::GetBoard(), BOARD::IsLayerEnabled(), and m_frame.

◆ SetLayersHotkeys()

Member Data Documentation

◆ m_frame

PCB_BASE_FRAME* PCB_LAYER_SELECTOR::m_frame
protected
Returns
true if the layer id is enabled (i.e. is it should be displayed).

Definition at line 54 of file sel_layer.cpp.

Referenced by getLayerColor(), getLayerName(), isLayerEnabled(), and PCB_LAYER_SELECTOR().

◆ m_layerhotkeys

bool LAYER_SELECTOR::m_layerhotkeys
protectedinherited

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