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 (int aLayer) const override
 
COLOR4D getLayerColor (int aLayer) const override
 
wxString getLayerName (int 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 47 of file layer_box_selector.cpp.

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

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 ( int  aLayer) const
inlineoverrideprotectedvirtual

Implements LAYER_SELECTOR.

Definition at line 63 of file sel_layer.cpp.

64 {
65 return m_frame->GetColorSettings()->GetColor( aLayer );
66 }
COLOR4D GetColor(int aLayer) const
virtual COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.

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 ( int  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:397
BOARD * GetBoard() const
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:926

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 ( int  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 }
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:524
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59

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: