Fix bug in GerbView's Export to Pcbnew command
This commit is contained in:
parent
6d0a8f2c71
commit
fd0a89c23f
|
@ -29,10 +29,10 @@ void WinEDA_GerberFrame::ExportDataInPcbnewFormat( wxCommandEvent& event )
|
||||||
bool no_used_layers = true; // Changed to false if any used layer found
|
bool no_used_layers = true; // Changed to false if any used layer found
|
||||||
|
|
||||||
// Check whether any of the Gerber layers are actually currently used
|
// Check whether any of the Gerber layers are actually currently used
|
||||||
while( no_used_layers && ii < 32 )
|
while( no_used_layers && ii < 32 )
|
||||||
{
|
{
|
||||||
if( g_GERBER_Descr_List[ii] != NULL )
|
if( g_GERBER_Descr_List[ii] != NULL )
|
||||||
no_used_layers = false;
|
no_used_layers = false;
|
||||||
ii++;
|
ii++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, FILE* aFile,
|
||||||
{
|
{
|
||||||
int layer = track->GetLayer();
|
int layer = track->GetLayer();
|
||||||
int pcb_layer_number = LayerLookUpTable[layer];
|
int pcb_layer_number = LayerLookUpTable[layer];
|
||||||
if( pcb_layer_number < 0 )
|
if( pcb_layer_number < 0 || pcb_layer_number > LAST_NO_COPPER_LAYER )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( pcb_layer_number > LAST_COPPER_LAYER )
|
if( pcb_layer_number > LAST_COPPER_LAYER )
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "wx/statline.h"
|
#include "wx/statline.h"
|
||||||
|
|
||||||
/* Variables locales */
|
/* Variables locales */
|
||||||
|
#define LAYER_UNSELECTED NB_LAYERS
|
||||||
static int ButtonTable[32]; // Indexes buttons to Gerber layers
|
static int ButtonTable[32]; // Indexes buttons to Gerber layers
|
||||||
static int LayerLookUpTable[32]; // Indexes Gerber layers to PCB file layers
|
static int LayerLookUpTable[32]; // Indexes Gerber layers to PCB file layers
|
||||||
wxStaticText* layer_list[32]; // Indexes text strings to buttons
|
wxStaticText* layer_list[32]; // Indexes text strings to buttons
|
||||||
|
@ -57,7 +58,7 @@ private:
|
||||||
|
|
||||||
/* Table des evenements pour WinEDA_SwapLayerFrame */
|
/* Table des evenements pour WinEDA_SwapLayerFrame */
|
||||||
BEGIN_EVENT_TABLE(WinEDA_SwapLayerFrame, wxDialog)
|
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,
|
wxEVT_COMMAND_BUTTON_CLICKED,
|
||||||
WinEDA_SwapLayerFrame::Sel_Layer )
|
WinEDA_SwapLayerFrame::Sel_Layer )
|
||||||
EVT_BUTTON( wxID_OK, WinEDA_SwapLayerFrame::OnOkClick )
|
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.
|
// Specify the default value for each member of these arrays.
|
||||||
ButtonTable[ii] = -1;
|
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;
|
int pcb_layer_number = 0;
|
||||||
|
@ -312,17 +313,17 @@ void WinEDA_SwapLayerFrame::Sel_Layer(wxCommandEvent& event)
|
||||||
ii = event.GetId() - ID_BUTTON_0;
|
ii = event.GetId() - ID_BUTTON_0;
|
||||||
|
|
||||||
jj = LayerLookUpTable[ButtonTable[ii]];
|
jj = LayerLookUpTable[ButtonTable[ii]];
|
||||||
if( (jj < 0) || (jj > NB_LAYERS) )
|
if( (jj < 0) || (jj > LAYER_UNSELECTED) )
|
||||||
jj = 0; // (Defaults to "Copper" layer.)
|
jj = 0; // (Defaults to "Copper" layer.)
|
||||||
jj = m_Parent->SelectLayer(jj, -1, -1, true);
|
jj = m_Parent->SelectLayer(jj, -1, -1, true);
|
||||||
|
|
||||||
if( (jj < 0) || (jj > NB_LAYERS) )
|
if( (jj < 0) || (jj > LAYER_UNSELECTED) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( jj != LayerLookUpTable[ButtonTable[ii]] )
|
if( jj != LayerLookUpTable[ButtonTable[ii]] )
|
||||||
{
|
{
|
||||||
LayerLookUpTable[ButtonTable[ii]] = jj;
|
LayerLookUpTable[ButtonTable[ii]] = jj;
|
||||||
if( jj == NB_LAYERS )
|
if( jj == LAYER_UNSELECTED )
|
||||||
{
|
{
|
||||||
layer_list[ii]->SetLabel( _( "Do not export" ) );
|
layer_list[ii]->SetLabel( _( "Do not export" ) );
|
||||||
// Change the text color to blue (to highlight
|
// Change the text color to blue (to highlight
|
||||||
|
|
Loading…
Reference in New Issue