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 ( GERBVIEW_FRAME parent,
int  aDefaultLayer,
int  aCopperLayerCount,
bool  aShowDeselectOption 
)

Definition at line 110 of file dialog_select_one_pcb_layer.cpp.

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

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 < NB_PCB_LAYERS; ++ii )
141  {
142  layerList.Add( GetPCBDefaultLayerName( ii ) );
143 
144  if( ii == aDefaultLayer )
145  layerSelect = layerCount;
146 
147  m_layerId.push_back( ii );
148  layerCount++;
149  }
150 
151  // When appropriate, also provide a "(Deselect)" radiobutton
152  if( aShowDeselectOption )
153  {
154  layerList.Add( _( "Do not export" ) );
155 
156  if( UNSELECTED_LAYER == aDefaultLayer )
157  layerSelect = layerCount;
158 
159  m_layerId.push_back( UNSELECTED_LAYER );
160  layerCount++;
161  }
162 
163  m_layerList = new wxRadioBox( this, ID_LAYER_SELECT, _( "Layer" ),
164  wxPoint( -1, -1 ), wxSize( -1, -1 ),
165  layerList,
166  (layerCount < 8) ? layerCount : 8,
167  wxRA_SPECIFY_ROWS );
168 
169  if( layerSelect >= 0 )
170  m_layerList->SetSelection( layerSelect );
171 
172  wxBoxSizer* FrameBoxSizer = new wxBoxSizer( wxHORIZONTAL );
173  SetSizer( FrameBoxSizer );
174  FrameBoxSizer->Add( m_layerList, 0, wxALIGN_TOP | wxALL, 5 );
175  wxBoxSizer* ButtonBoxSizer = new wxBoxSizer( wxVERTICAL );
176  FrameBoxSizer->Add( ButtonBoxSizer, 0, wxALIGN_BOTTOM | wxALL, 0 );
177 
178  button = new wxButton( this, wxID_OK, _( "OK" ) );
179  button->SetDefault();
180  ButtonBoxSizer->Add( button, 0, wxGROW | wxALL, 5 );
181 
182  button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
183  ButtonBoxSizer->Add( button, 0, wxGROW | wxALL, 5 );
184 
185  GetSizer()->SetSizeHints( this );
186 
187  Center();
188 }
const wxString GetPCBDefaultLayerName(int aLayerId)
#define NB_PCB_LAYERS
#define FIRST_COPPER_LAYER
#define LAST_COPPER_LAYER
SELECT_LAYER_DIALOG::~SELECT_LAYER_DIALOG ( )
inline

Definition at line 59 of file dialog_select_one_pcb_layer.cpp.

59 { };

Member Function Documentation

void SELECT_LAYER_DIALOG::OnCancelClick ( wxCommandEvent &  event)
private

Definition at line 199 of file dialog_select_one_pcb_layer.cpp.

200 {
201  EndModal( -1 );
202 }
void SELECT_LAYER_DIALOG::OnLayerSelected ( wxCommandEvent &  event)
private

Definition at line 191 of file dialog_select_one_pcb_layer.cpp.

References m_layerId, and m_layerList.

192 {
193  int ii = m_layerId[m_layerList->GetSelection()];
194 
195  EndModal( ii );
196 }

Member Data Documentation

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().

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: