KiCad PCB EDA Suite
SELECT_COPPER_LAYERS_PAIR_DIALOG Class Reference

Class SELECT_COPPER_LAYERS_PAIR_DIALOG displays a double pcb copper layers list in a dialog, to select a layer pair from these lists. More...

Inheritance diagram for SELECT_COPPER_LAYERS_PAIR_DIALOG:
PCB_LAYER_SELECTOR DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE LAYER_SELECTOR

Public Member Functions

 SELECT_COPPER_LAYERS_PAIR_DIALOG (PCB_BASE_FRAME *aParent, BOARD *aPcb, PCB_LAYER_ID aFrontLayer, PCB_LAYER_ID aBackLayer)
 
void GetLayerPair (PCB_LAYER_ID &aFrontLayer, PCB_LAYER_ID &aBackLayer)
 
bool SetLayersHotkeys (bool value)
 

Static Public Member Functions

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

Public Attributes

struct EDA_HOTKEY_CONFIGm_hotkeys
 

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
 
wxStaticText * m_staticTextTopLayer
 
wxGrid * m_leftGridLayers
 
wxStaticText * m_staticTextBottomLayer
 
wxGrid * m_rightGridLayers
 
wxStaticLine * m_staticline1
 
wxStdDialogButtonSizer * m_sdbSizer
 
wxButton * m_sdbSizerOK
 
wxButton * m_sdbSizerCancel
 

Private Member Functions

void OnLeftGridCellClick (wxGridEvent &event) override
 
void OnRightGridCellClick (wxGridEvent &event) override
 
void buildList ()
 

Private Attributes

BOARDm_brd
 
PCB_LAYER_ID m_frontLayer
 
PCB_LAYER_ID m_backLayer
 
int m_leftRowSelected
 
int m_rightRowSelected
 
std::vector< PCB_LAYER_IDm_layersId
 

Detailed Description

Class SELECT_COPPER_LAYERS_PAIR_DIALOG displays a double pcb copper layers list in a dialog, to select a layer pair from these lists.

Definition at line 230 of file sel_layer.cpp.

Constructor & Destructor Documentation

◆ SELECT_COPPER_LAYERS_PAIR_DIALOG()

SELECT_COPPER_LAYERS_PAIR_DIALOG::SELECT_COPPER_LAYERS_PAIR_DIALOG ( PCB_BASE_FRAME aParent,
BOARD aPcb,
PCB_LAYER_ID  aFrontLayer,
PCB_LAYER_ID  aBackLayer 
)

Definition at line 282 of file sel_layer.cpp.

283  :
284  PCB_LAYER_SELECTOR( aParent ),
286 {
287  m_frontLayer = aFrontLayer;
288  m_backLayer = aBackLayer;
289  m_leftRowSelected = 0;
290  m_rightRowSelected = 0;
291  m_brd = aPcb;
292 
293  m_leftGridLayers->SetCellHighlightPenWidth( 0 );
294  m_rightGridLayers->SetCellHighlightPenWidth( 0 );
295  m_leftGridLayers->SetColFormatBool( SELECT_COLNUM );
296  m_rightGridLayers->SetColFormatBool( SELECT_COLNUM );
297  buildList();
298 
299  SetFocus();
300 
301  GetSizer()->SetSizeHints( this );
302  Center();
303 }
#define SELECT_COLNUM
Definition: sel_layer.cpp:41
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Select Copper Layer Pair"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
PCB_LAYER_SELECTOR(PCB_BASE_FRAME *aFrame)
Definition: sel_layer.cpp:51

References buildList(), PCAD2KICAD::Center, m_backLayer, m_brd, m_frontLayer, DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::m_leftGridLayers, m_leftRowSelected, DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::m_rightGridLayers, m_rightRowSelected, and SELECT_COLNUM.

Member Function Documentation

◆ buildList()

void SELECT_COPPER_LAYERS_PAIR_DIALOG::buildList ( )
private

Definition at line 306 of file sel_layer.cpp.

307 {
308  wxColour bg = GetLayerColor( LAYER_PCB_BACKGROUND ).ToColour();
309  int row = 0;
310  wxString layername;
311 
312  for( LSEQ ui_seq = m_brd->GetEnabledLayers().UIOrder(); ui_seq; ++ui_seq )
313  {
314  PCB_LAYER_ID layerid = *ui_seq;
315 
316  if( !IsCopperLayer( layerid ) )
317  continue;
318 
319  wxColour fg = GetLayerColor( layerid ).ToColour();
320  wxColour color( wxColour::AlphaBlend( fg.Red(), bg.Red(), fg.Alpha() / 255.0 ),
321  wxColour::AlphaBlend( fg.Green(), bg.Green(), fg.Alpha() / 255.0 ),
322  wxColour::AlphaBlend( fg.Blue(), bg.Blue(), fg.Alpha() / 255.0 ) );
323 
324  layername = wxT( " " ) + GetLayerName( layerid );
325 
326  if( row )
327  m_leftGridLayers->AppendRows( 1 );
328 
329  m_leftGridLayers->SetCellBackgroundColour( row, COLOR_COLNUM, color );
330  m_leftGridLayers->SetCellValue( row, LAYERNAME_COLNUM, layername );
331  m_layersId.push_back( layerid );
332 
333  if( m_frontLayer == layerid )
334  {
335  m_leftGridLayers->SetCellValue( row, SELECT_COLNUM, "1" );
336  m_leftGridLayers->SetGridCursor( row, COLOR_COLNUM );
337  m_leftRowSelected = row;
338  }
339 
340  if( row )
341  m_rightGridLayers->AppendRows( 1 );
342 
343  m_rightGridLayers->SetCellBackgroundColour( row, COLOR_COLNUM, color );
344  m_rightGridLayers->SetCellValue( row, LAYERNAME_COLNUM, layername );
345 
346  if( m_backLayer == layerid )
347  {
348  m_rightGridLayers->SetCellValue( row, SELECT_COLNUM, "1" );
349  m_rightRowSelected = row;
350  }
351 
352  row++;
353  }
354 }
#define SELECT_COLNUM
Definition: sel_layer.cpp:41
int color
Definition: DXF_plotter.cpp:62
LSET GetEnabledLayers() const
Function GetEnabledLayers is a proxy function that calls the corresponding function in m_BoardSetting...
std::vector< PCB_LAYER_ID > m_layersId
Definition: sel_layer.cpp:240
PCB_LAYER_ID
A quick note on layer IDs:
Class LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
#define COLOR_COLNUM
Definition: sel_layer.cpp:42
wxString GetLayerName(LAYER_NUM aLayer) const override
Definition: sel_layer.cpp:74
COLOR4D GetLayerColor(LAYER_NUM aLayer) const override
Definition: sel_layer.cpp:68
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
#define LAYERNAME_COLNUM
Definition: sel_layer.cpp:43
LSEQ UIOrder() const
Definition: lset.cpp:803

References color, COLOR_COLNUM, BOARD::GetEnabledLayers(), PCB_LAYER_SELECTOR::GetLayerColor(), PCB_LAYER_SELECTOR::GetLayerName(), IsCopperLayer(), LAYER_PCB_BACKGROUND, LAYERNAME_COLNUM, m_backLayer, m_brd, m_frontLayer, m_layersId, DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::m_leftGridLayers, m_leftRowSelected, DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::m_rightGridLayers, m_rightRowSelected, SELECT_COLNUM, and LSET::UIOrder().

Referenced by SELECT_COPPER_LAYERS_PAIR_DIALOG().

◆ DrawColorSwatch()

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

Definition at line 48 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  if( aBackground != COLOR4D::UNSPECIFIED )
58  {
59  brush.SetColour( aBackground.WithAlpha(1.0).ToColour() );
60  bmpDC.SetBrush( brush );
61  bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
62  }
63 
64  brush.SetColour( aColor.ToColour() );
65  bmpDC.SetBrush( brush );
66  bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
67 
68  bmpDC.SetBrush( *wxTRANSPARENT_BRUSH );
69  bmpDC.SetPen( *wxBLACK_PEN );
70  bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
71 }
COLOR4D WithAlpha(double aAlpha) const
Function WithAlpha Returns a colour with the same colour, but the given alpha.
Definition: color4d.h:255

References KIGFX::COLOR4D::WithAlpha().

Referenced by GRID_CELL_LAYER_RENDERER::Draw(), GBR_LAYER_BOX_SELECTOR::Resync(), PCB_LAYER_BOX_SELECTOR::Resync(), and LAYER_BOX_SELECTOR::ResyncBitmapOnly().

◆ GetLayerColor()

COLOR4D PCB_LAYER_SELECTOR::GetLayerColor ( LAYER_NUM  aLayer) const
inlineoverrideprotectedvirtualinherited

Implements LAYER_SELECTOR.

Definition at line 68 of file sel_layer.cpp.

69  {
70  return m_frame->Settings().Colors().GetLayerColor( aLayer );
71  }
PCB_BASE_FRAME * m_frame
Definition: sel_layer.cpp:58
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(), PCB_LAYER_SELECTOR::m_frame, and PCB_BASE_FRAME::Settings().

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

◆ GetLayerName()

wxString PCB_LAYER_SELECTOR::GetLayerName ( LAYER_NUM  aLayer) const
inlineoverrideprotectedvirtualinherited

Implements LAYER_SELECTOR.

Definition at line 74 of file sel_layer.cpp.

75  {
76  return m_frame->GetBoard()->GetLayerName( ToLAYER_ID( aLayer ) );
77  }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer given by aLayer.
PCB_BASE_FRAME * m_frame
Definition: sel_layer.cpp:58
BOARD * GetBoard() const
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:813

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

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

◆ GetLayerPair()

void SELECT_COPPER_LAYERS_PAIR_DIALOG::GetLayerPair ( PCB_LAYER_ID aFrontLayer,
PCB_LAYER_ID aBackLayer 
)
inline

Definition at line 246 of file sel_layer.cpp.

247  {
248  aFrontLayer = m_frontLayer;
249  aBackLayer = m_backLayer;
250  }

References m_backLayer, and m_frontLayer.

Referenced by PCB_BASE_FRAME::SelectCopperLayerPair().

◆ IsLayerEnabled()

bool PCB_LAYER_SELECTOR::IsLayerEnabled ( LAYER_NUM  aLayer) const
inlineoverrideprotectedvirtualinherited

Implements LAYER_SELECTOR.

Definition at line 61 of file sel_layer.cpp.

62  {
63  return m_frame->GetBoard()->IsLayerEnabled( PCB_LAYER_ID( aLayer ) );
64  }
PCB_BASE_FRAME * m_frame
Definition: sel_layer.cpp:58
bool IsLayerEnabled(PCB_LAYER_ID aLayer) const
Function IsLayerEnabled is a proxy function that calls the correspondent function in m_BoardSettings ...
Definition: class_board.h:441
PCB_LAYER_ID
A quick note on layer IDs:
BOARD * GetBoard() const

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

◆ OnLeftGridCellClick()

void SELECT_COPPER_LAYERS_PAIR_DIALOG::OnLeftGridCellClick ( wxGridEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE.

Definition at line 357 of file sel_layer.cpp.

358 {
359  int row = event.GetRow();
360  PCB_LAYER_ID layer = m_layersId[row];
361 
362  if( m_frontLayer == layer )
363  return;
364 
365  m_leftGridLayers->SetCellValue( m_leftRowSelected, SELECT_COLNUM, wxEmptyString );
366  m_frontLayer = layer;
367  m_leftRowSelected = row;
368  m_leftGridLayers->SetCellValue( m_leftRowSelected, SELECT_COLNUM, "1" );
369 }
#define SELECT_COLNUM
Definition: sel_layer.cpp:41
std::vector< PCB_LAYER_ID > m_layersId
Definition: sel_layer.cpp:240
PCB_LAYER_ID
A quick note on layer IDs:

References m_frontLayer, m_layersId, DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::m_leftGridLayers, m_leftRowSelected, and SELECT_COLNUM.

◆ OnRightGridCellClick()

void SELECT_COPPER_LAYERS_PAIR_DIALOG::OnRightGridCellClick ( wxGridEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE.

Definition at line 372 of file sel_layer.cpp.

373 {
374  int row = event.GetRow();
375  PCB_LAYER_ID layer = m_layersId[row];
376 
377  if( m_backLayer == layer )
378  return;
379 
380  m_rightGridLayers->SetCellValue( m_rightRowSelected, SELECT_COLNUM, wxEmptyString );
381  m_backLayer = layer;
382  m_rightRowSelected = row;
383  m_rightGridLayers->SetCellValue( m_rightRowSelected, SELECT_COLNUM, "1" );
384 }
#define SELECT_COLNUM
Definition: sel_layer.cpp:41
std::vector< PCB_LAYER_ID > m_layersId
Definition: sel_layer.cpp:240
PCB_LAYER_ID
A quick note on layer IDs:

References m_backLayer, m_layersId, DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::m_rightGridLayers, m_rightRowSelected, and SELECT_COLNUM.

◆ SetLayersHotkeys()

Member Data Documentation

◆ m_backLayer

PCB_LAYER_ID SELECT_COPPER_LAYERS_PAIR_DIALOG::m_backLayer
private

◆ m_brd

BOARD* SELECT_COPPER_LAYERS_PAIR_DIALOG::m_brd
private

Definition at line 234 of file sel_layer.cpp.

Referenced by buildList(), and SELECT_COPPER_LAYERS_PAIR_DIALOG().

◆ m_frame

◆ m_frontLayer

PCB_LAYER_ID SELECT_COPPER_LAYERS_PAIR_DIALOG::m_frontLayer
private

◆ m_hotkeys

struct EDA_HOTKEY_CONFIG* LAYER_SELECTOR::m_hotkeys
inherited

Definition at line 46 of file layer_box_selector.h.

Referenced by LAYER_SELECTOR::LAYER_SELECTOR().

◆ m_layerhotkeys

bool LAYER_SELECTOR::m_layerhotkeys
protectedinherited

◆ m_layersId

std::vector<PCB_LAYER_ID> SELECT_COPPER_LAYERS_PAIR_DIALOG::m_layersId
private

Definition at line 240 of file sel_layer.cpp.

Referenced by buildList(), OnLeftGridCellClick(), and OnRightGridCellClick().

◆ m_leftGridLayers

◆ m_leftRowSelected

int SELECT_COPPER_LAYERS_PAIR_DIALOG::m_leftRowSelected
private

Definition at line 237 of file sel_layer.cpp.

Referenced by buildList(), OnLeftGridCellClick(), and SELECT_COPPER_LAYERS_PAIR_DIALOG().

◆ m_rightGridLayers

◆ m_rightRowSelected

int SELECT_COPPER_LAYERS_PAIR_DIALOG::m_rightRowSelected
private

◆ m_sdbSizer

wxStdDialogButtonSizer* DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::m_sdbSizer
protectedinherited

◆ m_sdbSizerCancel

wxButton* DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::m_sdbSizerCancel
protectedinherited

◆ m_sdbSizerOK

wxButton* DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::m_sdbSizerOK
protectedinherited

◆ m_staticline1

wxStaticLine* DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::m_staticline1
protectedinherited

◆ m_staticTextBottomLayer

wxStaticText* DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::m_staticTextBottomLayer
protectedinherited

◆ m_staticTextTopLayer

wxStaticText* DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::m_staticTextTopLayer
protectedinherited

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