Fix bug in GerbView's Export to Pcbnew command

This commit is contained in:
g_harland 2007-11-22 00:40:17 +00:00
parent 6d0a8f2c71
commit fd0a89c23f
2 changed files with 11 additions and 10 deletions

View File

@ -150,7 +150,7 @@ static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, FILE* aFile,
{
int layer = track->GetLayer();
int pcb_layer_number = LayerLookUpTable[layer];
if( pcb_layer_number < 0 )
if( pcb_layer_number < 0 || pcb_layer_number > LAST_NO_COPPER_LAYER )
continue;
if( pcb_layer_number > LAST_COPPER_LAYER )

View File

@ -13,6 +13,7 @@
#include "wx/statline.h"
/* Variables locales */
#define LAYER_UNSELECTED NB_LAYERS
static int ButtonTable[32]; // Indexes buttons to Gerber layers
static int LayerLookUpTable[32]; // Indexes Gerber layers to PCB file layers
wxStaticText* layer_list[32]; // Indexes text strings to buttons
@ -57,7 +58,7 @@ private:
/* Table des evenements pour WinEDA_SwapLayerFrame */
BEGIN_EVENT_TABLE(WinEDA_SwapLayerFrame, wxDialog)
EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + NB_LAYERS - 1,
EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + 31,
wxEVT_COMMAND_BUTTON_CLICKED,
WinEDA_SwapLayerFrame::Sel_Layer )
EVT_BUTTON( wxID_OK, WinEDA_SwapLayerFrame::OnOkClick )
@ -131,7 +132,7 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame(WinEDA_GerberFrame *parent) :
// Specify the default value for each member of these arrays.
ButtonTable[ii] = -1;
LayerLookUpTable[ii] = NB_LAYERS; // Value associated with deselected Gerber layer
LayerLookUpTable[ii] = LAYER_UNSELECTED; // Value associated with deselected Gerber layer
}
int pcb_layer_number = 0;
@ -312,17 +313,17 @@ void WinEDA_SwapLayerFrame::Sel_Layer(wxCommandEvent& event)
ii = event.GetId() - ID_BUTTON_0;
jj = LayerLookUpTable[ButtonTable[ii]];
if( (jj < 0) || (jj > NB_LAYERS) )
if( (jj < 0) || (jj > LAYER_UNSELECTED) )
jj = 0; // (Defaults to "Copper" layer.)
jj = m_Parent->SelectLayer(jj, -1, -1, true);
if( (jj < 0) || (jj > NB_LAYERS) )
if( (jj < 0) || (jj > LAYER_UNSELECTED) )
return;
if( jj != LayerLookUpTable[ButtonTable[ii]] )
{
LayerLookUpTable[ButtonTable[ii]] = jj;
if( jj == NB_LAYERS )
if( jj == LAYER_UNSELECTED )
{
layer_list[ii]->SetLabel( _( "Do not export" ) );
// Change the text color to blue (to highlight