Gerbview: code cleanup (mainly remove g_GERBER_List global variable)

This commit is contained in:
jean-pierre charras 2016-06-17 20:00:29 +02:00
parent 0862ac28d0
commit a907e50424
20 changed files with 139 additions and 80 deletions

View File

@ -36,9 +36,9 @@
#include <class_gerber_file_image.h>
#include <class_gerber_file_image_list.h>
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool erase );
// Call back function used in block command
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool erase );
int GERBVIEW_FRAME::BlockCommand( EDA_KEY key )
@ -82,7 +82,7 @@ void GERBVIEW_FRAME::HandleBlockPlace( wxDC* DC )
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
Block_Move( DC );
Block_Move();
GetScreen()->m_BlockLocate.ClearItemsList();
break;
@ -177,16 +177,14 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
if( screen->m_BlockLocate.GetMoveVector().x || screen->m_BlockLocate.GetMoveVector().y )
{
screen->m_BlockLocate.Draw( aPanel,
aDC,
screen->m_BlockLocate.Draw( aPanel, aDC,
screen->m_BlockLocate.GetMoveVector(),
g_XorMode,
Color );
g_XorMode, Color );
}
}
void GERBVIEW_FRAME::Block_Move( wxDC* DC )
void GERBVIEW_FRAME::Block_Move()
{
wxPoint delta;
wxPoint oldpos;
@ -201,10 +199,11 @@ void GERBVIEW_FRAME::Block_Move( wxDC* DC )
/* Calculate displacement vectors. */
delta = GetScreen()->m_BlockLocate.GetMoveVector();
GERBER_FILE_IMAGE_LIST* images = GetGerberLayout()->GetImagesList();
for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
for( unsigned layer = 0; layer < images->ImagesMaxCount(); ++layer )
{
GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( layer );
GERBER_FILE_IMAGE* gerber = images->GetGbrImage( layer );
if( gerber == NULL ) // Graphic layer not yet used
continue;

View File

@ -7,9 +7,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2012 Jean-Pierre Charras <jean-pierre.charras@ujf-grenoble.fr>
* Copyright (C) 1992-2016 Jean-Pierre Charras <jp.charras at wanadoo.fr>
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 1992-2016 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -42,7 +42,9 @@ void GBR_LAYER_BOX_SELECTOR::Resync()
Freeze();
Clear();
for( int layerid = 0; layerid < GERBER_DRAWLAYERS_COUNT; ++layerid )
GERBER_FILE_IMAGE_LIST& images = GERBER_FILE_IMAGE_LIST::GetImagesList();
for( unsigned layerid = 0; layerid < images.ImagesMaxCount(); ++layerid )
{
wxBitmap layerbmp( BM_SIZE, BM_SIZE );
wxString layername;
@ -79,7 +81,8 @@ EDA_COLOR_T GBR_LAYER_BOX_SELECTOR::GetLayerColor( int aLayer ) const
// Returns the name of the layer id
wxString GBR_LAYER_BOX_SELECTOR::GetLayerName( int aLayer ) const
{
wxString name = g_GERBER_List.GetDisplayName( aLayer );
GERBER_FILE_IMAGE_LIST& images = GERBER_FILE_IMAGE_LIST::GetImagesList();
wxString name = images.GetDisplayName( aLayer );
return name;
}

View File

@ -45,6 +45,13 @@ GBR_LAYOUT::~GBR_LAYOUT()
{
}
// Accessor to the list of gerber files (and drill files) images
GERBER_FILE_IMAGE_LIST* GBR_LAYOUT::GetImagesList()
{
return &GERBER_FILE_IMAGE_LIST::GetImagesList();
}
bool GBR_LAYOUT::IsLayerPrintable( int aLayer ) const
{
for( unsigned ii = 0; ii < m_printLayersList.size(); ++ii )
@ -56,14 +63,15 @@ bool GBR_LAYOUT::IsLayerPrintable( int aLayer ) const
return false;
}
EDA_RECT GBR_LAYOUT::ComputeBoundingBox()
{
EDA_RECT bbox;
bool first_item = true;
for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
for( unsigned layer = 0; layer < GetImagesList()->ImagesMaxCount(); ++layer )
{
GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( layer );
GERBER_FILE_IMAGE* gerber = GetImagesList()->GetGbrImage( layer );
if( gerber == NULL ) // Graphic layer not yet used
continue;
@ -171,7 +179,7 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
layer = active_layer;
}
GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( layer );
GERBER_FILE_IMAGE* gerber = GetImagesList()->GetGbrImage( layer );
if( gerber == NULL ) // Graphic layer not yet used
continue;
@ -335,9 +343,9 @@ void GBR_LAYOUT::DrawItemsDCodeID( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
GRSetDrawMode( aDC, aDrawMode );
for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
for( unsigned layer = 0; layer < GetImagesList()->ImagesMaxCount(); ++layer )
{
GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( layer );
GERBER_FILE_IMAGE* gerber = GetImagesList()->GetGbrImage( layer );
if( gerber == NULL ) // Graphic layer not yet used
continue;

View File

@ -43,6 +43,8 @@
#include <gr_basic.h>
class GERBER_FILE_IMAGE_LIST;
/**
* Class GBR_LAYOUT
* holds list of GERBER_DRAW_ITEM currently loaded.
@ -60,6 +62,10 @@ public:
GBR_LAYOUT();
~GBR_LAYOUT();
// Accessor to the GERBER_FILE_IMAGE_LIST,
// which handles the list of gerber files (and drill files) images loaded
GERBER_FILE_IMAGE_LIST* GetImagesList();
const wxPoint& GetAuxOrigin() const
{
return m_originAxisPosition;

View File

@ -38,6 +38,10 @@
#include <map>
// The global image list:
GERBER_FILE_IMAGE_LIST s_GERBER_List;
// GERBER_FILE_IMAGE_LIST is a helper class to handle a list of GERBER_FILE_IMAGE files
GERBER_FILE_IMAGE_LIST::GERBER_FILE_IMAGE_LIST()
{
@ -54,6 +58,12 @@ GERBER_FILE_IMAGE_LIST::~GERBER_FILE_IMAGE_LIST()
}
GERBER_FILE_IMAGE_LIST& GERBER_FILE_IMAGE_LIST::GetImagesList()
{
return s_GERBER_List;
}
GERBER_FILE_IMAGE* GERBER_FILE_IMAGE_LIST::GetGbrImage( int aIdx )
{
if( (unsigned)aIdx < m_GERBER_List.size() )
@ -217,6 +227,3 @@ void GERBER_FILE_IMAGE_LIST::SortImagesByZOrder()
}
}
// The global image list:
GERBER_FILE_IMAGE_LIST g_GERBER_List;

View File

@ -69,8 +69,11 @@ public:
~GERBER_FILE_IMAGE_LIST();
//Accessor
static GERBER_FILE_IMAGE_LIST& GetImagesList();
GERBER_FILE_IMAGE* GetGbrImage( int aIdx );
unsigned ImagesMaxCount() { return m_GERBER_List.size(); }
/**
* Add a GERBER_FILE_IMAGE* at index aIdx
* or at the first free location if aIdx < 0
@ -112,7 +115,4 @@ public:
void SortImagesByZOrder();
};
extern GERBER_FILE_IMAGE_LIST g_GERBER_List;
#endif // ifndef CLASS_GERBER_FILE_IMAGE_LIST_H

View File

@ -77,11 +77,12 @@ GERBER_LAYER_WIDGET::GERBER_LAYER_WIDGET( GERBVIEW_FRAME* aParent, wxWindow* aFo
// using installRightLayerClickHandler
}
/**
* Function SetLayersManagerTabsText
* Update the layer manager tabs labels
* Useful when changing Language or to set labels to a non default value
*/
GERBER_FILE_IMAGE_LIST* GERBER_LAYER_WIDGET::GetImagesList()
{
return &GERBER_FILE_IMAGE_LIST::GetImagesList();
}
void GERBER_LAYER_WIDGET::SetLayersManagerTabsText( )
{
m_notebook->SetPageText(0, _("Layer") );
@ -208,7 +209,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
break;
case ID_SORT_GBR_LAYERS:
g_GERBER_List.SortImagesByZOrder();
GetImagesList()->SortImagesByZOrder();
myframe->ReFillLayerWidget();
myframe->syncLayerBox( true );
myframe->GetCanvas()->Refresh();
@ -238,7 +239,7 @@ void GERBER_LAYER_WIDGET::ReFill()
for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
{
wxString msg = g_GERBER_List.GetDisplayName( layer );
wxString msg = GetImagesList()->GetDisplayName( layer );
AppendLayerRow( LAYER_WIDGET::ROW( msg, layer,
myframe->GetLayerColor( layer ), wxEmptyString, true ) );
@ -311,7 +312,7 @@ void GERBER_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
*/
bool GERBER_LAYER_WIDGET::useAlternateBitmap(int aRow)
{
return g_GERBER_List.GetGbrImage( aRow ) != NULL;
return GetImagesList()->GetGbrImage( aRow ) != NULL;
}
/*

View File

@ -77,6 +77,8 @@ class GERBER_LAYER_WIDGET : public LAYER_WIDGET
*/
virtual bool useAlternateBitmap(int aRow);
GERBER_FILE_IMAGE_LIST* GetImagesList();
public:
/**
@ -103,6 +105,7 @@ public:
void OnLayerVisible( int aLayer, bool isVisible, bool isFinal );
void OnRenderColorChange( int aId, EDA_COLOR_T aColor );
void OnRenderEnable( int aId, bool isEnabled );
/**
* Function SetLayersManagerTabsText
* Update the layer manager tabs labels

View File

@ -47,7 +47,7 @@ bool GERBVIEW_FRAME::Clear_DrawLayers( bool query )
return false;
}
g_GERBER_List.DeleteAllImages();
GetGerberLayout()->GetImagesList()->DeleteAllImages();
GetGerberLayout()->SetBoundingBox( EDA_RECT() );
@ -70,7 +70,7 @@ void GERBVIEW_FRAME::Erase_Current_DrawLayer( bool query )
SetCurItem( NULL );
g_GERBER_List.DeleteImage( layer );
GetGerberLayout()->GetImagesList()->DeleteImage( layer );
m_LayersManager->UpdateLayerIcons();
syncLayerBox();

View File

@ -155,15 +155,16 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
}
s_Parameters.m_PageSetupData = s_pageSetupData;
GERBER_FILE_IMAGE_LIST* images = m_Parent->GetGerberLayout()->GetImagesList();
// Create layer list
for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii )
for( unsigned ii = 0; ii < images->ImagesMaxCount(); ++ii )
{
msg = _( "Layer" );
msg << wxT( " " ) << ii + 1;
m_BoxSelectLayer[ii] = new wxCheckBox( this, -1, msg );
if( g_GERBER_List.GetGbrImage( ii ) == NULL ) // Nothing loaded on this draw layer
if( images->GetGbrImage( ii ) == NULL ) // Nothing loaded on this draw layer
m_BoxSelectLayer[ii]->Enable( false );
if( ii < 16 )

View File

@ -229,7 +229,7 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
void GERBVIEW_FRAME::OnSelectActiveDCode( wxCommandEvent& event )
{
GERBER_FILE_IMAGE* gerber_image = g_GERBER_List.GetGbrImage( getActiveLayer() );
GERBER_FILE_IMAGE* gerber_image = GetGbrImage( getActiveLayer() );
if( gerber_image )
{
@ -261,7 +261,7 @@ void GERBVIEW_FRAME::OnSelectActiveLayer( wxCommandEvent& event )
void GERBVIEW_FRAME::OnShowGerberSourceFile( wxCommandEvent& event )
{
int layer = getActiveLayer();
GERBER_FILE_IMAGE* gerber_layer = g_GERBER_List.GetGbrImage( layer );
GERBER_FILE_IMAGE* gerber_layer = GetGbrImage( layer );
if( gerber_layer )
{

View File

@ -1,10 +1,3 @@
/**
* @file excellon_read_drill_file.cpp
* Functions to read drill files (EXCELLON format) created by Pcbnew
* These files use only a subset of EXCELLON commands.
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
@ -62,6 +55,13 @@
* Feed Rate and Spindle Speed are just skipped because they are not used in a viewer
*/
/**
* @file excellon_read_drill_file.cpp
* Functions to read drill files (EXCELLON format) created by Pcbnew
* These files use only a subset of EXCELLON commands.
*/
#include <fctsys.h>
#include <common.h>
#include <confirm.h>
@ -161,12 +161,13 @@ bool GERBVIEW_FRAME::Read_EXCELLON_File( const wxString& aFullFileName )
{
wxString msg;
int layerId = getActiveLayer(); // current layer used in GerbView
EXCELLON_IMAGE* drill_Layer = (EXCELLON_IMAGE*) g_GERBER_List.GetGbrImage( layerId );
GERBER_FILE_IMAGE_LIST* images = GetGerberLayout()->GetImagesList();
EXCELLON_IMAGE* drill_Layer = (EXCELLON_IMAGE*) images->GetGbrImage( layerId );
if( drill_Layer == NULL )
{
drill_Layer = new EXCELLON_IMAGE( layerId );
layerId = g_GERBER_List.AddGbrImage( drill_Layer, layerId );
layerId = images->AddGbrImage( drill_Layer, layerId );
}
if( layerId < 0 )

View File

@ -156,10 +156,11 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event )
{
int layercount = 0;
GERBER_FILE_IMAGE_LIST* images = GetGerberLayout()->GetImagesList();
// Count the Gerber layers which are actually currently used
for( LAYER_NUM ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii )
for( LAYER_NUM ii = 0; ii < (LAYER_NUM)images->ImagesMaxCount(); ++ii )
{
if( g_GERBER_List.GetGbrImage( ii ) )
if( images->GetGbrImage( ii ) )
layercount++;
}
@ -221,10 +222,11 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( LAYER_NUM* aLayerLookUpTable, int aCopperLa
// create an image of gerber data
// First: non copper layers:
const int pcbCopperLayerMax = 31;
GERBER_FILE_IMAGE_LIST* images = m_gerbview_frame->GetGerberLayout()->GetImagesList();
for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
for( unsigned layer = 0; layer < images->ImagesMaxCount(); ++layer )
{
GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( layer );
GERBER_FILE_IMAGE* gerber = images->GetGbrImage( layer );
if( gerber == NULL ) // Graphic layer not yet used
continue;
@ -244,9 +246,9 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( LAYER_NUM* aLayerLookUpTable, int aCopperLa
}
// Copper layers
for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
for( unsigned layer = 0; layer < images->ImagesMaxCount(); ++layer )
{
GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( layer );
GERBER_FILE_IMAGE* gerber = images->GetGbrImage( layer );
if( gerber == NULL ) // Graphic layer not yet used
continue;

View File

@ -369,16 +369,16 @@ int GERBVIEW_FRAME::getNextAvailableLayer( int aLayer ) const
{
int layer = aLayer;
for( int i = 0; i < GERBER_DRAWLAYERS_COUNT; ++i )
for( unsigned i = 0; i < ImagesMaxCount(); ++i )
{
GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( layer );
const GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
if( gerber == NULL ) // this graphic layer is available: use it
return layer;
++layer; // try next graphic layer
if( layer >= GERBER_DRAWLAYERS_COUNT )
if( layer >= (int)ImagesMaxCount() )
layer = 0;
}
@ -401,7 +401,7 @@ void GERBVIEW_FRAME::syncLayerBox( bool aRebuildLayerBox )
m_SelLayerBox->SetSelection( getActiveLayer() );
int dcodeSelected = -1;
GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( getActiveLayer() );
GERBER_FILE_IMAGE* gerber = GetGbrImage( getActiveLayer() );
if( gerber )
dcodeSelected = gerber->m_Selected_Tool;
@ -422,13 +422,12 @@ void GERBVIEW_FRAME::Liste_D_Codes()
D_CODE* pt_D_code;
wxString Line;
wxArrayString list;
double scale = g_UserUnit == INCHES ? IU_PER_MILS * 1000 :
IU_PER_MM;
double scale = g_UserUnit == INCHES ? IU_PER_MILS * 1000 : IU_PER_MM;
int curr_layer = getActiveLayer();
for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
for( int layer = 0; layer < (int)ImagesMaxCount(); ++layer )
{
GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( layer );
GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
if( gerber == NULL )
continue;
@ -444,6 +443,7 @@ void GERBVIEW_FRAME::Liste_D_Codes()
list.Add( Line );
const char* units = g_UserUnit == INCHES ? "\"" : "mm";
for( ii = 0, jj = 1; ii < TOOLS_MAX_COUNT; ii++ )
{
pt_D_code = gerber->GetDCODE( ii + FIRST_DCODE, false );
@ -483,7 +483,7 @@ void GERBVIEW_FRAME::Liste_D_Codes()
void GERBVIEW_FRAME::UpdateTitleAndInfo()
{
GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( getActiveLayer() );
GERBER_FILE_IMAGE* gerber = GetGbrImage( getActiveLayer() );
wxString text;
// Display the gerber filename
@ -848,3 +848,14 @@ const wxString GERBVIEW_FRAME::GetZoomLevelIndicator() const
{
return EDA_DRAW_FRAME::GetZoomLevelIndicator();
}
GERBER_FILE_IMAGE* GERBVIEW_FRAME::GetGbrImage( int aIdx ) const
{
return m_gerberLayout->GetImagesList()->GetGbrImage( aIdx );
}
unsigned GERBVIEW_FRAME::ImagesMaxCount() const
{
return m_gerberLayout->GetImagesList()->ImagesMaxCount();
}

View File

@ -46,6 +46,8 @@ class DCODE_SELECTION_BOX;
class GERBER_LAYER_WIDGET;
class GBR_LAYER_BOX_SELECTOR;
class GERBER_DRAW_ITEM;
class GERBER_FILE_IMAGE;
class GERBER_FILE_IMAGE_LIST;
/**
@ -82,6 +84,18 @@ public:
return m_gerberLayout;
}
/**
* Accessors to GERBER_FILE_IMAGE_LIST and GERBER_FILE_IMAGE data
*/
GERBER_FILE_IMAGE_LIST* GetImagesList() const
{
return m_gerberLayout->GetImagesList();
}
GERBER_FILE_IMAGE* GetGbrImage( int aIdx ) const;
unsigned ImagesMaxCount() const; ///< The max number of file images
/**
* Function GetGerberLayoutBoundingBox
@ -165,7 +179,7 @@ private:
bool m_show_layer_manager_tools;
// An array sting to store warning messages when reaging a gerber file.
// An array sting to store warning messages when reading a gerber file.
wxArrayString m_Messages;
public:
@ -535,11 +549,8 @@ public:
* moves all tracks and segments within the selected block.
* New location is determined by the current offset from the selected
* block's original location.
* Defined separately in Pcbnew and GerbView
*
* @param DC A device context to draw on.
*/
void Block_Move( wxDC* DC );
void Block_Move();
/**
* Function ToPrinter

View File

@ -49,7 +49,8 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc
ref = GetNearestGridPosition( ref );
int layer = getActiveLayer();
GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( layer );
GERBER_FILE_IMAGE_LIST* images = GetGerberLayout()->GetImagesList();
GERBER_FILE_IMAGE* gerber = images->GetGbrImage( layer );
// Search first on active layer
GERBER_DRAW_ITEM* gerb_item = NULL;
@ -68,9 +69,9 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc
if( !found ) // Search on all layers
{
for( layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
for( layer = 0; layer < (int)images->ImagesMaxCount(); ++layer )
{
gerber = g_GERBER_List.GetGbrImage( layer );
gerber = images->GetGbrImage( layer );
if( gerber == NULL ) // Graphic layer not yet used
continue;

View File

@ -42,7 +42,8 @@ void GERBVIEW_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
if( DrawStruct == NULL )
{
GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( getActiveLayer() );
GERBER_FILE_IMAGE_LIST* images = GetGerberLayout()->GetImagesList();
GERBER_FILE_IMAGE* gerber = images->GetGbrImage( getActiveLayer() );
if( gerber )
gerber->DisplayImageInfo( this );

View File

@ -41,12 +41,13 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName )
wxString msg;
int layer = getActiveLayer();
GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( layer );
GERBER_FILE_IMAGE_LIST* images = GetGerberLayout()->GetImagesList();
GERBER_FILE_IMAGE* gerber = images->GetGbrImage( layer );
if( gerber == NULL )
{
gerber = new GERBER_FILE_IMAGE( layer );
g_GERBER_List.AddGbrImage( gerber, layer );
images->AddGbrImage( gerber, layer );
}
/* Read the gerber file */

View File

@ -120,9 +120,11 @@ void LAYERS_MAP_DIALOG::initDialog()
LAYER_NUM pcb_layer_num = 0;
m_gerberActiveLayersCount = 0;
for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii )
GERBER_FILE_IMAGE_LIST* images = m_Parent->GetGerberLayout()->GetImagesList();
for( unsigned ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii )
{
if( g_GERBER_List.GetGbrImage( ii ) == NULL )
if( images->GetGbrImage( ii ) == NULL )
break;
if( (pcb_layer_num == m_exportBoardCopperLayersCount - 1)
@ -190,7 +192,7 @@ void LAYERS_MAP_DIALOG::initDialog()
wxRIGHT | wxLEFT, 5 );
/* Add file name and extension without path. */
wxFileName fn( g_GERBER_List.GetGbrImage( ii )->m_FileName );
wxFileName fn( images->GetGbrImage( ii )->m_FileName );
label = new wxStaticText( this, wxID_STATIC, fn.GetFullName(),
wxDefaultPosition, wxDefaultSize );
flexColumnBoxSizer->Add( label, 0,

View File

@ -307,7 +307,8 @@ void GERBVIEW_FRAME::OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent )
void GERBVIEW_FRAME::OnUpdateSelectDCode( wxUpdateUIEvent& aEvent )
{
int layer = getActiveLayer();
GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( layer );
GERBER_FILE_IMAGE_LIST* images = GetGerberLayout()->GetImagesList();
GERBER_FILE_IMAGE* gerber = images->GetGbrImage( layer );
int selected = ( gerber ) ? gerber->m_Selected_Tool : 0;
if( m_DCodeSelector && m_DCodeSelector->GetSelectedDCodeId() != selected )