KiCad PCB EDA Suite
SELECT_LAYER_DIALOG Class Reference
Inheritance diagram for SELECT_LAYER_DIALOG:

Public Member Functions

 SELECT_LAYER_DIALOG (GERBVIEW_FRAME *parent, int aDefaultLayer, int aCopperLayerCount, bool aShowDeselectOption)
 
 ~SELECT_LAYER_DIALOG ()
 

Private Member Functions

void OnLayerSelected (wxCommandEvent &event)
 
void OnCancelClick (wxCommandEvent &event)
 

Private Attributes

wxRadioBox * m_layerList
 
std::vector< int > m_layerId
 

Detailed Description

Definition at line 49 of file dialog_select_one_pcb_layer.cpp.

Constructor & Destructor Documentation

◆ SELECT_LAYER_DIALOG()

SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG ( GERBVIEW_FRAME parent,
int  aDefaultLayer,
int  aCopperLayerCount,
bool  aShowDeselectOption 
)

Definition at line 110 of file dialog_select_one_pcb_layer.cpp.

112  :
113  wxDialog( parent, -1, _( "Select Layer:" ), wxPoint( -1, -1 ),
114  wxSize( 470, 250 ),
115  wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )
116 {
117  wxButton* button;
118  int ii;
119  wxArrayString layerList;
120  int layerSelect = -1;
121 
122  // Build the layer list; first build copper layers list
123  int layerCount = 0;
124 
125  for( ii = FIRST_COPPER_LAYER; ii <= LAST_COPPER_LAYER; ++ii )
126  {
127  if( ii == FIRST_COPPER_LAYER || ii == LAST_COPPER_LAYER || ii < aCopperLayerCount-1 )
128  {
129  layerList.Add( GetPCBDefaultLayerName( ii ) );
130 
131  if( ii == aDefaultLayer )
132  layerSelect = layerCount;
133 
134  m_layerId.push_back( ii );
135  layerCount++;
136  }
137  }
138 
139  // Build the layer list; build non copper layers list
140  for( ; ; ++ii )
141  {
142  if( GetPCBDefaultLayerName( ii ) == "" ) // End of list
143  break;
144 
145  layerList.Add( GetPCBDefaultLayerName( ii ) );
146 
147  if( ii == aDefaultLayer )
148  layerSelect = layerCount;
149 
150  m_layerId.push_back( ii );
151  layerCount++;
152  }
153 
154  // When appropriate, also provide a "(Deselect)" radiobutton
155  if( aShowDeselectOption )
156  {
157  layerList.Add( _( "Do not export" ) );
158 
159  if( UNSELECTED_LAYER == aDefaultLayer )
160  layerSelect = layerCount;
161 
162  m_layerId.push_back( UNSELECTED_LAYER );
163  layerCount++;
164  }
165 
166  m_layerList = new wxRadioBox( this, ID_LAYER_SELECT, _( "Layer" ),
167  wxPoint( -1, -1 ), wxSize( -1, -1 ),
168  layerList,
169  (layerCount < 8) ? layerCount : 8,
170  wxRA_SPECIFY_ROWS );
171 
172  if( layerSelect >= 0 )
173  m_layerList->SetSelection( layerSelect );
174 
175  wxBoxSizer* FrameBoxSizer = new wxBoxSizer( wxHORIZONTAL );
176  SetSizer( FrameBoxSizer );
177  FrameBoxSizer->Add( m_layerList, 0, wxALIGN_TOP | wxALL, 5 );
178  wxBoxSizer* ButtonBoxSizer = new wxBoxSizer( wxVERTICAL );
179  FrameBoxSizer->Add( ButtonBoxSizer, 0, wxALIGN_BOTTOM | wxALL, 0 );
180 
181  button = new wxButton( this, wxID_OK, _( "OK" ) );
182  button->SetDefault();
183  ButtonBoxSizer->Add( button, 0, wxGROW | wxALL, 5 );
184 
185  button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
186  ButtonBoxSizer->Add( button, 0, wxGROW | wxALL, 5 );
187 
188  GetSizer()->SetSizeHints( this );
189 
190  Center();
191 }
const wxString GetPCBDefaultLayerName(int aLayerId)
#define _(s)
#define FIRST_COPPER_LAYER
#define LAST_COPPER_LAYER

References _, PCAD2KICAD::Center, FIRST_COPPER_LAYER, GetPCBDefaultLayerName(), ID_LAYER_SELECT, LAST_COPPER_LAYER, m_layerId, m_layerList, and UNSELECTED_LAYER.

◆ ~SELECT_LAYER_DIALOG()

SELECT_LAYER_DIALOG::~SELECT_LAYER_DIALOG ( )
inline

Definition at line 59 of file dialog_select_one_pcb_layer.cpp.

59 { };

Member Function Documentation

◆ OnCancelClick()

void SELECT_LAYER_DIALOG::OnCancelClick ( wxCommandEvent &  event)
private

Definition at line 202 of file dialog_select_one_pcb_layer.cpp.

203 {
204  EndModal( -1 );
205 }

◆ OnLayerSelected()

void SELECT_LAYER_DIALOG::OnLayerSelected ( wxCommandEvent &  event)
private

Definition at line 194 of file dialog_select_one_pcb_layer.cpp.

195 {
196  int ii = m_layerId[m_layerList->GetSelection()];
197 
198  EndModal( ii );
199 }

References m_layerId, and m_layerList.

Member Data Documentation

◆ m_layerId

std::vector<int> SELECT_LAYER_DIALOG::m_layerId
private

Definition at line 53 of file dialog_select_one_pcb_layer.cpp.

Referenced by OnLayerSelected(), and SELECT_LAYER_DIALOG().

◆ m_layerList

wxRadioBox* SELECT_LAYER_DIALOG::m_layerList
private

Definition at line 52 of file dialog_select_one_pcb_layer.cpp.

Referenced by OnLayerSelected(), and SELECT_LAYER_DIALOG().


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