This commit is contained in:
Jeff Young 2021-07-22 00:14:56 +01:00
parent 92e589b398
commit e26341d424
66 changed files with 472 additions and 583 deletions

View File

@ -318,7 +318,7 @@ void PANEL_COLOR_SETTINGS::OnColorChanged( wxCommandEvent& aEvent )
{
COLOR_SWATCH* swatch = static_cast<COLOR_SWATCH*>( aEvent.GetEventObject() );
COLOR4D newColor = swatch->GetSwatchColor();
LAYER_NUM layer = static_cast<SCH_LAYER_ID>( swatch->GetId() - FIRST_BUTTON_ID );
int layer = static_cast<SCH_LAYER_ID>( swatch->GetId() - FIRST_BUTTON_ID );
updateColor( layer, newColor );
}

View File

@ -761,10 +761,8 @@ LSET LSET::AllCuMask( int aCuLayerCount )
clear_count = Clamp( 0, clear_count, MAX_CU_LAYERS - 2 );
for( LAYER_NUM elem=In30_Cu; clear_count; --elem, --clear_count )
{
for( int elem = In30_Cu; clear_count; --elem, --clear_count )
ret.set( elem, false );
}
return ret;
}

View File

@ -490,28 +490,26 @@ struct EROT
/// Eagle wire
struct EWIRE
{
ECOORD x1;
ECOORD y1;
ECOORD x2;
ECOORD y2;
ECOORD width;
LAYER_NUM layer;
ECOORD x1;
ECOORD y1;
ECOORD x2;
ECOORD y2;
ECOORD width;
int layer;
// for style: (continuous | longdash | shortdash | dashdot)
enum {
CONTINUOUS,
LONGDASH,
SHORTDASH,
DASHDOT,
};
enum { CONTINUOUS,
LONGDASH,
SHORTDASH,
DASHDOT };
opt_int style;
opt_double curve; ///< range is -359.9..359.9
// for cap: (flat | round)
enum {
FLAT,
ROUND,
};
enum { FLAT,
ROUND };
opt_int cap;
EWIRE( wxXmlNode* aWire );
@ -531,13 +529,13 @@ struct EJUNCTION
/// Eagle label
struct ELABEL
{
ECOORD x;
ECOORD y;
ECOORD size;
LAYER_NUM layer;
opt_erot rot;
ECOORD x;
ECOORD y;
ECOORD size;
int layer;
opt_erot rot;
opt_wxString xref;
wxString netname;
wxString netname;
ELABEL( wxXmlNode* aLabel, const wxString& aNetName );
};
@ -546,12 +544,12 @@ struct ELABEL
/// Eagle via
struct EVIA
{
ECOORD x;
ECOORD y;
int layer_front_most; /// < extent
int layer_back_most; /// < inclusive
ECOORD drill;
opt_ecoord diam;
ECOORD x;
ECOORD y;
int layer_front_most; /// < extent
int layer_back_most; /// < inclusive
ECOORD drill;
opt_ecoord diam;
opt_wxString shape;
EVIA( wxXmlNode* aVia );
@ -561,11 +559,11 @@ struct EVIA
/// Eagle circle
struct ECIRCLE
{
ECOORD x;
ECOORD y;
ECOORD radius;
ECOORD width;
LAYER_NUM layer;
ECOORD x;
ECOORD y;
ECOORD radius;
ECOORD width;
int layer;
ECIRCLE( wxXmlNode* aCircle );
};

View File

@ -22,13 +22,12 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <layer_ids.h>
#include <bitmaps.h>
#include <wx/dcmemory.h>
#include <wx/odcombo.h>
#include <wx/menuitem.h>
#include <layer_ids.h>
#include <widgets/layer_box_selector.h>
@ -73,11 +72,10 @@ void LAYER_SELECTOR::DrawColorSwatch( wxBitmap& aLayerbmp, const COLOR4D& aBackg
}
LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
int n, const wxString choices[] ) :
wxBitmapComboBox( parent, id, wxEmptyString, pos, size, n, choices, wxCB_READONLY ),
LAYER_SELECTOR()
LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id, const wxPoint& pos,
const wxSize& size, int n, const wxString choices[] ) :
wxBitmapComboBox( parent, id, wxEmptyString, pos, size, n, choices, wxCB_READONLY ),
LAYER_SELECTOR()
{
if( choices != nullptr )
ResyncBitmapOnly();
@ -87,9 +85,8 @@ LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
}
LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
const wxArrayString& choices ) :
LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id, const wxPoint& pos,
const wxSize& size, const wxArrayString& choices ) :
wxBitmapComboBox( parent, id, wxEmptyString, pos, size, choices, wxCB_READONLY ),
LAYER_SELECTOR()
{
@ -108,26 +105,18 @@ LAYER_BOX_SELECTOR::~LAYER_BOX_SELECTOR()
}
int LAYER_BOX_SELECTOR::GetChoice()
{
return GetSelection();
}
LAYER_NUM LAYER_BOX_SELECTOR::GetLayerSelection() const
int LAYER_BOX_SELECTOR::GetLayerSelection() const
{
if( GetSelection() < 0 )
return UNDEFINED_LAYER;
return (LAYER_NUM)(intptr_t) GetClientData( GetSelection() );
return (int)(intptr_t) GetClientData( GetSelection() );
}
int LAYER_BOX_SELECTOR::SetLayerSelection( LAYER_NUM layer )
int LAYER_BOX_SELECTOR::SetLayerSelection( int layer )
{
int elements = GetCount();
for( int i = 0; i < elements; i++ )
for( int i = 0; i < (int) GetCount(); i++ )
{
if( GetClientData( (unsigned) i ) == (void*)(intptr_t) layer )
{
@ -137,7 +126,9 @@ int LAYER_BOX_SELECTOR::SetLayerSelection( LAYER_NUM layer )
return i;
}
else
return i; //If element already selected; do nothing
{
return i; // If element already selected; do nothing
}
}
}
@ -149,9 +140,7 @@ int LAYER_BOX_SELECTOR::SetLayerSelection( LAYER_NUM layer )
void LAYER_BOX_SELECTOR::ResyncBitmapOnly()
{
int elements = GetCount();
for( LAYER_NUM i = 0; i < elements; ++i )
for( int i = 0; i < (int) GetCount(); ++i )
{
wxBitmap layerbmp( 14, 14 );
DrawColorSwatch( layerbmp, getLayerColor( LAYER_PCB_BACKGROUND ), getLayerColor( i ) );

View File

@ -25,13 +25,11 @@
#include <widgets/lib_tree.h>
#include <macros.h>
#include <wxdataviewctrl_helpers.h>
#include <wx/artprov.h>
#include <wx/sizer.h>
#include <tool/tool_interactive.h>
#include <tool/tool_manager.h>
#include <wx/srchctrl.h>
#include <wx/settings.h>
#include <wx/statbmp.h>
#include <wx/timer.h>
@ -50,8 +48,7 @@ LIB_TREE::LIB_TREE( wxWindow* aParent, LIB_TABLE* aLibTable,
{
wxBoxSizer* search_sizer = new wxBoxSizer( wxHORIZONTAL );
m_query_ctrl = new wxSearchCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition,
wxDefaultSize );
m_query_ctrl = new wxSearchCtrl( this, wxID_ANY );
m_query_ctrl->ShowCancelButton( true );
@ -79,7 +76,6 @@ LIB_TREE::LIB_TREE( wxWindow* aParent, LIB_TABLE* aLibTable,
m_query_ctrl->Bind( wxEVT_CHAR_HOOK, &LIB_TREE::onQueryCharHook, this );
m_query_ctrl->Bind( wxEVT_MOTION, &LIB_TREE::onQueryMouseMoved, this );
Bind( wxEVT_TIMER, &LIB_TREE::onDebounceTimer, this, m_debounceTimer->GetId() );
}
@ -204,6 +200,7 @@ void LIB_TREE::Unselect()
m_tree_ctrl->UnselectAll();
}
void LIB_TREE::ExpandLibId( const LIB_ID& aLibId )
{
expandIfValid( m_adapter->FindItem( aLibId ) );
@ -394,8 +391,8 @@ void LIB_TREE::onDebounceTimer( wxTimerEvent& aEvent )
void LIB_TREE::onQueryCharHook( wxKeyEvent& aKeyStroke )
{
auto const sel = m_tree_ctrl->GetSelection();
auto type = sel.IsOk() ? m_adapter->GetTypeFor( sel ) : LIB_TREE_NODE::INVALID;
const wxDataViewItem sel = m_tree_ctrl->GetSelection();
LIB_TREE_NODE::TYPE type = sel.IsOk() ? m_adapter->GetTypeFor( sel ) : LIB_TREE_NODE::INVALID;
switch( aKeyStroke.GetKeyCode() )
{
@ -421,15 +418,14 @@ void LIB_TREE::onQueryCharHook( wxKeyEvent& aKeyStroke )
case WXK_RETURN:
if( type == LIB_TREE_NODE::LIB )
{
toggleExpand( sel );
break;
}
// Intentionally fall through, so the selected symbol will be treated as the selected one
KI_FALLTHROUGH;
else
aKeyStroke.Skip(); // pass on to search box to select node
break;
default:
aKeyStroke.Skip(); // Any other key: pass on to search box directly.
aKeyStroke.Skip(); // Any other key: pass on to search box directly.
break;
}
}
@ -460,14 +456,9 @@ void LIB_TREE::onTreeSelect( wxDataViewEvent& aEvent )
void LIB_TREE::onTreeActivate( wxDataViewEvent& aEvent )
{
if( !GetSelectedLibId().IsValid() )
{
// Expand library/part units subtree
toggleExpand( m_tree_ctrl->GetSelection() );
}
toggleExpand( m_tree_ctrl->GetSelection() ); // Expand library/part units subtree
else
{
postSelectEvent();
}
postSelectEvent(); // Open symbol/footprint
}

View File

@ -38,9 +38,8 @@ BEGIN_EVENT_TABLE( EDA_MSG_PANEL, wxPanel )
END_EVENT_TABLE()
EDA_MSG_PANEL::EDA_MSG_PANEL( wxWindow* aParent, int aId,
const wxPoint& aPosition, const wxSize& aSize,
long style, const wxString &name ) :
EDA_MSG_PANEL::EDA_MSG_PANEL( wxWindow* aParent, int aId, const wxPoint& aPosition,
const wxSize& aSize, long style, const wxString &name ) :
wxPanel( aParent, aId, aPosition, aSize, style, name )
{
SetFont( KIUI::GetStatusFont( this ) );
@ -150,7 +149,7 @@ void EDA_MSG_PANEL::SetMessage( int aXPosition, const wxString& aUpperText,
// update the vector, which is sorted by m_X
int limit = m_Items.size();
for( ndx=0; ndx<limit; ++ndx )
for( ndx = 0; ndx < limit; ++ndx )
{
// replace any item with same X
if( m_Items[ndx].m_X == item.m_X )

View File

@ -125,9 +125,9 @@ void SCH_DRAW_PANEL::DisplaySheet( SCH_SCREEN *aScreen )
void SCH_DRAW_PANEL::setDefaultLayerOrder()
{
for( LAYER_NUM i = 0; (unsigned) i < sizeof( SCH_LAYER_ORDER ) / sizeof( LAYER_NUM ); ++i )
for( int i = 0; (unsigned) i < sizeof( SCH_LAYER_ORDER ) / sizeof( int ); ++i )
{
LAYER_NUM layer = SCH_LAYER_ORDER[i];
int layer = SCH_LAYER_ORDER[i];
wxASSERT( layer < KIGFX::VIEW::VIEW_MAX_LAYERS );
m_view->SetLayerOrder( layer, i );

View File

@ -99,9 +99,9 @@ void SCH_PREVIEW_PANEL::OnShow()
void SCH_PREVIEW_PANEL::setDefaultLayerOrder()
{
for( LAYER_NUM i = 0; (unsigned) i < sizeof( SCH_LAYER_ORDER ) / sizeof( LAYER_NUM ); ++i )
for( int i = 0; (unsigned) i < sizeof( SCH_LAYER_ORDER ) / sizeof( int ); ++i )
{
LAYER_NUM layer = SCH_LAYER_ORDER[i];
int layer = SCH_LAYER_ORDER[i];
wxASSERT( layer < KIGFX::VIEW::VIEW_MAX_LAYERS );
m_view->SetLayerOrder( layer, i );

View File

@ -42,7 +42,7 @@ class DS_PROXY_VIEW_ITEM;
// Eeschema 100nm as the internal units
constexpr double SCH_WORLD_UNIT ( 1e-7 / 0.0254 );
static const LAYER_NUM SCH_LAYER_ORDER[] =
static const int SCH_LAYER_ORDER[] =
{
LAYER_GP_OVERLAY, LAYER_SELECT_OVERLAY,
LAYER_ERC_ERR, LAYER_ERC_WARN, LAYER_DANGLING,

View File

@ -39,9 +39,9 @@
#include <dialogs/dialog_layers_select_to_pcb.h>
#include <wx/msgdlg.h>
#include <gestfich.h>
extern const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber );
extern const wxString GetPCBDefaultLayerName( int aLayerNumber );
enum swap_layer_id {
@ -188,7 +188,7 @@ void LAYERS_MAP_DIALOG::initDialog()
{
goodSize = text->GetSize();
for( LAYER_NUM jj = 0; jj < GERBER_DRAWLAYERS_COUNT; ++jj )
for( int jj = 0; jj < GERBER_DRAWLAYERS_COUNT; ++jj )
{
text->SetLabel( GetPCBDefaultLayerName( jj ) );
@ -274,11 +274,7 @@ void LAYERS_MAP_DIALOG::OnBrdLayersCountSelection( wxCommandEvent& event )
void LAYERS_MAP_DIALOG::OnResetClick( wxCommandEvent& event )
{
wxString msg;
int ii;
LAYER_NUM layer;
for( ii = 0, layer = 0; ii < m_gerberActiveLayersCount; ii++, ++layer )
for( int ii = 0; ii < m_gerberActiveLayersCount; ++ii )
{
m_layersLookUpTable[ii] = UNSELECTED_LAYER;
m_layersList[ii]->SetLabel( _( "Do not export" ) );
@ -290,15 +286,13 @@ void LAYERS_MAP_DIALOG::OnResetClick( wxCommandEvent& event )
void LAYERS_MAP_DIALOG::OnStoreSetup( wxCommandEvent& event )
{
auto config = static_cast<GERBVIEW_SETTINGS*>( Kiface().KifaceSettings() );
GERBVIEW_SETTINGS* config = static_cast<GERBVIEW_SETTINGS*>( Kiface().KifaceSettings() );
config->m_BoardLayersCount = m_exportBoardCopperLayersCount;
config->m_GerberToPcbLayerMapping.clear();
for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii )
{
config->m_GerberToPcbLayerMapping.push_back( m_layersLookUpTable[ii] );
}
// Enable the "Get Stored Choice" button in case it was disabled in "initDialog()"
// due to no previously stored choices.
@ -327,7 +321,7 @@ void LAYERS_MAP_DIALOG::OnGetSetup( wxCommandEvent& event )
for( int ii = 0; ii < m_gerberActiveLayersCount; ii++ )
{
LAYER_NUM layer = m_layersLookUpTable[ii];
int layer = m_layersLookUpTable[ii];
if( layer == UNSELECTED_LAYER )
{
@ -350,17 +344,15 @@ void LAYERS_MAP_DIALOG::OnGetSetup( wxCommandEvent& event )
void LAYERS_MAP_DIALOG::OnSelectLayer( wxCommandEvent& event )
{
int ii;
int ii = event.GetId() - ID_BUTTON_0;
ii = event.GetId() - ID_BUTTON_0;
if( (ii < 0) || (ii >= GERBER_DRAWLAYERS_COUNT) )
if( ii < 0 || ii >= GERBER_DRAWLAYERS_COUNT )
{
wxFAIL_MSG( wxT( "Bad layer id" ) );
return;
}
LAYER_NUM jj = m_layersLookUpTable[m_buttonTable[ii]];
int jj = m_layersLookUpTable[ m_buttonTable[ii] ];
if( jj != UNSELECTED_LAYER && jj != UNDEFINED_LAYER && !IsValidLayer( jj ) )
jj = B_Cu; // (Defaults to "Copper" layer.)

View File

@ -41,7 +41,7 @@ class LAYERS_MAP_DIALOG : public LAYERS_MAP_DIALOG_BASE
public: LAYERS_MAP_DIALOG( GERBVIEW_FRAME* parent );
~LAYERS_MAP_DIALOG() {};
LAYER_NUM * GetLayersLookUpTable() { return m_layersLookUpTable; }
int* GetLayersLookUpTable() { return m_layersLookUpTable; }
static int GetCopperLayersCount() { return m_exportBoardCopperLayersCount; }
protected:
@ -121,14 +121,14 @@ private:
private:
GERBVIEW_FRAME* m_Parent;
int m_gerberActiveLayersCount; // Number of initialized Gerber layers
static int m_exportBoardCopperLayersCount;
int m_gerberActiveLayersCount; // Number of initialized Gerber layers
static int m_exportBoardCopperLayersCount;
// Indexes Gerber layers to PCB file layers the last value in table is the number of
// Indexes Gerber layers to PCB file layers; the last value in table is the number of
// copper layers.
LAYER_NUM m_layersLookUpTable[GERBER_DRAWLAYERS_COUNT];
int m_buttonTable[int(GERBER_DRAWLAYERS_COUNT)+1]; // Indexes buttons to Gerber layers
wxStaticText* m_layersList[int(GERBER_DRAWLAYERS_COUNT)+1]; // Indexes text strings to buttons
int m_layersLookUpTable[ GERBER_DRAWLAYERS_COUNT ];
int m_buttonTable[ int(GERBER_DRAWLAYERS_COUNT) + 1 ];
wxStaticText* m_layersList[ int(GERBER_DRAWLAYERS_COUNT) + 1 ];
};
#endif // DIALOG_LAYERS_SELECT_TO_PCB_H_

View File

@ -39,7 +39,7 @@
#include "excellon_image.h"
// Imported function
extern const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber );
extern const wxString GetPCBDefaultLayerName( int aLayerNumber );
GBR_TO_PCB_EXPORTER::GBR_TO_PCB_EXPORTER( GERBVIEW_FRAME* aFrame, const wxString& aFileName )
@ -56,7 +56,7 @@ GBR_TO_PCB_EXPORTER::~GBR_TO_PCB_EXPORTER()
}
bool GBR_TO_PCB_EXPORTER::ExportPcb( const LAYER_NUM* aLayerLookUpTable, int aCopperLayers )
bool GBR_TO_PCB_EXPORTER::ExportPcb( const int* aLayerLookUpTable, int aCopperLayers )
{
LOCALE_IO toggle; // toggles on, then off, the C locale.
@ -98,7 +98,7 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( const LAYER_NUM* aLayerLookUpTable, int aCo
if( gerber == nullptr ) // Graphic layer not yet used
continue;
LAYER_NUM pcb_layer_number = aLayerLookUpTable[layer];
int pcb_layer_number = aLayerLookUpTable[layer];
if( !IsPcbLayer( pcb_layer_number ) )
continue;
@ -106,7 +106,7 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( const LAYER_NUM* aLayerLookUpTable, int aCo
if( pcb_layer_number <= pcbCopperLayerMax ) // copper layer
continue;
for( GERBER_DRAW_ITEM* gerb_item : gerber->GetItems() )
for( GERBER_DRAW_ITEM* gerb_item : gerber->GetItems() )
export_non_copper_item( gerb_item, pcb_layer_number );
}
@ -118,7 +118,7 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( const LAYER_NUM* aLayerLookUpTable, int aCo
if( gerber == nullptr ) // Graphic layer not yet used
continue;
LAYER_NUM pcb_layer_number = aLayerLookUpTable[layer];
int pcb_layer_number = aLayerLookUpTable[layer];
if( pcb_layer_number < 0 || pcb_layer_number > pcbCopperLayerMax )
continue;
@ -139,8 +139,7 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( const LAYER_NUM* aLayerLookUpTable, int aCo
}
void GBR_TO_PCB_EXPORTER::export_non_copper_item( const GERBER_DRAW_ITEM* aGbrItem,
LAYER_NUM aLayer )
void GBR_TO_PCB_EXPORTER::export_non_copper_item( const GERBER_DRAW_ITEM* aGbrItem, int aLayer )
{
// used when a D_CODE is not found. default D_CODE to draw a flashed item
static D_CODE dummyD_CODE( 0 );
@ -277,7 +276,7 @@ void GBR_TO_PCB_EXPORTER::export_via( const EXPORT_VIA& aVia )
}
void GBR_TO_PCB_EXPORTER::export_copper_item( const GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer )
void GBR_TO_PCB_EXPORTER::export_copper_item( const GERBER_DRAW_ITEM* aGbrItem, int aLayer )
{
switch( aGbrItem->m_Shape )
{
@ -311,8 +310,7 @@ void GBR_TO_PCB_EXPORTER::export_copper_item( const GERBER_DRAW_ITEM* aGbrItem,
}
void GBR_TO_PCB_EXPORTER::export_segline_copper_item( const GERBER_DRAW_ITEM* aGbrItem,
LAYER_NUM aLayer )
void GBR_TO_PCB_EXPORTER::export_segline_copper_item( const GERBER_DRAW_ITEM* aGbrItem, int aLayer )
{
wxPoint seg_start, seg_end;
@ -327,9 +325,8 @@ void GBR_TO_PCB_EXPORTER::export_segline_copper_item( const GERBER_DRAW_ITEM* aG
}
void GBR_TO_PCB_EXPORTER::writeCopperLineItem( const wxPoint& aStart,
const wxPoint& aEnd,
int aWidth, LAYER_NUM aLayer )
void GBR_TO_PCB_EXPORTER::writeCopperLineItem( const wxPoint& aStart, const wxPoint& aEnd,
int aWidth, int aLayer )
{
fprintf( m_fp, "(segment (start %s %s) (end %s %s) (width %s) (layer %s) (net 0))\n",
Double2Str( MapToPcbUnits(aStart.x) ).c_str(),
@ -341,8 +338,7 @@ void GBR_TO_PCB_EXPORTER::writeCopperLineItem( const wxPoint& aStart,
}
void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( const GERBER_DRAW_ITEM* aGbrItem,
LAYER_NUM aLayer )
void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( const GERBER_DRAW_ITEM* aGbrItem, int aLayer )
{
double a = atan2( (double) ( aGbrItem->m_Start.y - aGbrItem->m_ArcCentre.y ),
(double) ( aGbrItem->m_Start.x - aGbrItem->m_ArcCentre.x ) );
@ -397,8 +393,7 @@ void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( const GERBER_DRAW_ITEM* aGb
}
void GBR_TO_PCB_EXPORTER::export_flashed_copper_item( const GERBER_DRAW_ITEM* aGbrItem,
LAYER_NUM aLayer )
void GBR_TO_PCB_EXPORTER::export_flashed_copper_item( const GERBER_DRAW_ITEM* aGbrItem, int aLayer )
{
static D_CODE flashed_item_D_CODE( 0 );
@ -437,7 +432,7 @@ void GBR_TO_PCB_EXPORTER::export_flashed_copper_item( const GERBER_DRAW_ITEM* aG
void GBR_TO_PCB_EXPORTER::writePcbFilledCircle( const VECTOR2I& aCenterPosition, int aRadius,
LAYER_NUM aLayer )
int aLayer )
{
fprintf( m_fp, "(gr_circle (center %s %s) (end %s %s)",
@ -452,7 +447,7 @@ void GBR_TO_PCB_EXPORTER::writePcbFilledCircle( const VECTOR2I& aCenterPosition,
}
void GBR_TO_PCB_EXPORTER::writePcbHeader( const LAYER_NUM* aLayerLookUpTable )
void GBR_TO_PCB_EXPORTER::writePcbHeader( const int* aLayerLookUpTable )
{
fprintf( m_fp, "(kicad_pcb (version 4) (generator gerbview)\n\n" );
@ -481,7 +476,7 @@ void GBR_TO_PCB_EXPORTER::writePcbHeader( const LAYER_NUM* aLayerLookUpTable )
}
void GBR_TO_PCB_EXPORTER::writePcbPolygon( const SHAPE_POLY_SET& aPolys, LAYER_NUM aLayer,
void GBR_TO_PCB_EXPORTER::writePcbPolygon( const SHAPE_POLY_SET& aPolys, int aLayer,
const wxPoint& aOffset )
{
SHAPE_POLY_SET polys = aPolys;
@ -529,7 +524,7 @@ void GBR_TO_PCB_EXPORTER::writePcbPolygon( const SHAPE_POLY_SET& aPolys, LAYER_N
}
void GBR_TO_PCB_EXPORTER::writePcbZoneItem( const GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer )
void GBR_TO_PCB_EXPORTER::writePcbZoneItem( const GERBER_DRAW_ITEM* aGbrItem, int aLayer )
{
SHAPE_POLY_SET polys = aGbrItem->m_Polygon;
polys.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );

View File

@ -57,7 +57,7 @@ public:
/**
* Save a board from a set of Gerber images.
*/
bool ExportPcb( const LAYER_NUM* aLayerLookUpTable, int aCopperLayers );
bool ExportPcb( const int* aLayerLookUpTable, int aCopperLayers );
private:
/**
@ -70,7 +70,7 @@ private:
* than the hole. We'll leave it this way if the pad gets drawn as a copper polygon, or
* increase it to the proper size if it has a circular, concentric copper flashing.
*/
void collect_hole( const GERBER_DRAW_ITEM* aGbrItem );
void collect_hole( const GERBER_DRAW_ITEM* aGbrItem );
/**
* Write a via to the board file.
@ -79,7 +79,7 @@ private:
* holes in pads. (We can't generate actual pads because the Gerbers don't contain
* info on how to group them into footprints.)
*/
void export_via( const EXPORT_VIA& aVia );
void export_via( const EXPORT_VIA& aVia );
/**
* Write a non copper line or arc to the board file.
@ -87,15 +87,15 @@ private:
* @param aGbrItem is the Gerber item (line, arc) to export.
* @param aLayer is the technical layer to use.
*/
void export_non_copper_item( const GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer );
void export_non_copper_item( const GERBER_DRAW_ITEM* aGbrItem, int aLayer );
/**
* Write a non-copper polygon to the board file.
*
* @param aLayer is the technical layer to use.
*/
void writePcbPolygon( const SHAPE_POLY_SET& aPolys, LAYER_NUM aLayer,
const wxPoint& aOffset = { 0, 0 } );
void writePcbPolygon( const SHAPE_POLY_SET& aPolys, int aLayer,
const wxPoint& aOffset = { 0, 0 } );
/**
* Write a filled circle to the board file (with line thickness = 0).
@ -105,8 +105,7 @@ private:
* @param aRadius is the circle radius.
* @param aLayer is the layer to use.
*/
void writePcbFilledCircle( const VECTOR2I& aCenterPosition, int aRadius,
LAYER_NUM aLayer );
void writePcbFilledCircle( const VECTOR2I& aCenterPosition, int aRadius, int aLayer );
/**
* Write a zone item to the board file.
@ -116,7 +115,7 @@ private:
* @param aGbrItem is the Gerber item (line, arc) to export.
* @param aLayer is the technical layer to use.
*/
void writePcbZoneItem( const GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer );
void writePcbZoneItem( const GERBER_DRAW_ITEM* aGbrItem, int aLayer );
/**
* Write a track (or via) to the board file.
@ -124,7 +123,7 @@ private:
* @param aGbrItem is the Gerber item (line, arc, flashed) to export.
* @param aLayer is the copper layer to use.
*/
void export_copper_item( const GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer );
void export_copper_item( const GERBER_DRAW_ITEM* aGbrItem, int aLayer );
/**
* Write a synthetic pad to the board file.
@ -135,7 +134,7 @@ private:
*
* @param aGbrItem is the flashed Gerber item to export.
*/
void export_flashed_copper_item( const GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer );
void export_flashed_copper_item( const GERBER_DRAW_ITEM* aGbrItem, int aLayer );
/**
* Write a track (not via) to the board file.
@ -143,7 +142,7 @@ private:
* @param aGbrItem is the Gerber item (line only) to export.
* @param aLayer is the copper layer to use.
*/
void export_segline_copper_item( const GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer );
void export_segline_copper_item( const GERBER_DRAW_ITEM* aGbrItem, int aLayer );
/**
* Write a set of tracks (arcs are approximated by track segments) to the board file.
@ -151,18 +150,17 @@ private:
* @param aGbrItem is the Gerber item (arc only) to export.
* @param aLayer is the copper layer to use
*/
void export_segarc_copper_item( const GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer );
void export_segarc_copper_item( const GERBER_DRAW_ITEM* aGbrItem, int aLayer );
/**
* Basic write function to write a a #PCB_TRACK to the board file from a non flashed item.
*/
void writeCopperLineItem( const wxPoint& aStart, const wxPoint& aEnd,
int aWidth, LAYER_NUM aLayer );
void writeCopperLineItem( const wxPoint& aStart, const wxPoint& aEnd, int aWidth, int aLayer );
/**
* Write a very basic header to the board file.
*/
void writePcbHeader( const LAYER_NUM* aLayerLookUpTable );
void writePcbHeader( const int* aLayerLookUpTable );
/**
* Map GerbView internal units to millimeters for Pcbnew board files.

View File

@ -85,8 +85,10 @@ void GERBVIEW_FRAME::ReCreateHToolbar()
m_mainToolBar->AddControl( m_SelLayerBox );
if( !m_TextInfo )
m_TextInfo = new wxTextCtrl( m_mainToolBar, ID_TOOLBARH_GERBER_DATA_TEXT_BOX, wxEmptyString, wxDefaultPosition,
wxDefaultSize, wxTE_READONLY );
{
m_TextInfo = new wxTextCtrl( m_mainToolBar, ID_TOOLBARH_GERBER_DATA_TEXT_BOX, wxEmptyString,
wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
}
m_mainToolBar->AddControl( m_TextInfo );
@ -108,8 +110,8 @@ void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
}
else
{
m_auxiliaryToolBar = new ACTION_TOOLBAR( this, ID_AUX_TOOLBAR,
wxDefaultPosition, wxDefaultSize,
m_auxiliaryToolBar = new ACTION_TOOLBAR( this, ID_AUX_TOOLBAR, wxDefaultPosition,
wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
m_auxiliaryToolBar->SetAuiManager( &m_auimgr );
}
@ -118,8 +120,7 @@ void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
// (note, when the m_auxiliaryToolBar is recreated, tools are deleted, but controls
// are not deleted: they are just no longer managed by the toolbar
if( !m_SelComponentBox )
m_SelComponentBox = new wxChoice( m_auxiliaryToolBar,
ID_GBR_AUX_TOOLBAR_PCB_CMP_CHOICE );
m_SelComponentBox = new wxChoice( m_auxiliaryToolBar, ID_GBR_AUX_TOOLBAR_PCB_CMP_CHOICE );
if( !m_cmpText )
m_cmpText = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _( "Cmp:" ) + wxS( " " ) );
@ -132,8 +133,7 @@ void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
// Creates choice box to display net names and highlight selected:
if( !m_SelNetnameBox )
m_SelNetnameBox = new wxChoice( m_auxiliaryToolBar,
ID_GBR_AUX_TOOLBAR_PCB_NET_CHOICE );
m_SelNetnameBox = new wxChoice( m_auxiliaryToolBar, ID_GBR_AUX_TOOLBAR_PCB_NET_CHOICE );
if( !m_netText )
m_netText = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _( "Net:" ) );
@ -146,8 +146,10 @@ void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
// Creates choice box to display aperture attributes and highlight selected:
if( !m_SelAperAttributesBox )
{
m_SelAperAttributesBox = new wxChoice( m_auxiliaryToolBar,
ID_GBR_AUX_TOOLBAR_PCB_APERATTRIBUTES_CHOICE );
}
if( !m_apertText )
m_apertText = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _( "Attr:" ) );
@ -159,9 +161,11 @@ void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
m_auxiliaryToolBar->AddSpacer( 5 );
if( !m_DCodeSelector )
{
m_DCodeSelector = new DCODE_SELECTION_BOX( m_auxiliaryToolBar,
ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE,
wxDefaultPosition, wxSize( 150, -1 ) );
}
if( !m_dcodeText )
m_dcodeText = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _( "DCode:" ) );
@ -172,8 +176,8 @@ void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
if( !m_gridSelectBox )
{
m_gridSelectBox = new wxChoice( m_auxiliaryToolBar, ID_ON_GRID_SELECT,
wxDefaultPosition, wxDefaultSize, 0, nullptr );
m_gridSelectBox = new wxChoice( m_auxiliaryToolBar, ID_ON_GRID_SELECT, wxDefaultPosition,
wxDefaultSize, 0, nullptr );
}
m_auxiliaryToolBar->AddScaledSeparator( this );
@ -181,8 +185,8 @@ void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
if( !m_zoomSelectBox )
{
m_zoomSelectBox = new wxChoice( m_auxiliaryToolBar, ID_ON_ZOOM_SELECT,
wxDefaultPosition, wxDefaultSize, 0, nullptr );
m_zoomSelectBox = new wxChoice( m_auxiliaryToolBar, ID_ON_ZOOM_SELECT, wxDefaultPosition,
wxDefaultSize, 0, nullptr );
}
m_auxiliaryToolBar->AddScaledSeparator( this );
@ -343,8 +347,8 @@ void GERBVIEW_FRAME::updateDCodeSelectBox()
dcode->m_Num_Dcode,
dcode->m_Size.x / scale, dcode->m_Size.y / scale,
units,
D_CODE::ShowApertureType( dcode->m_Shape )
);
D_CODE::ShowApertureType( dcode->m_Shape ) );
if( !dcode->m_AperFunction.IsEmpty() )
msg << ", " << dcode->m_AperFunction;
@ -384,8 +388,8 @@ void GERBVIEW_FRAME::updateComponentListSelectBox()
m_SelComponentBox->Append( NO_SELECTION_STRING );
// Now copy the list to the choice box
for( auto& ii : full_list )
m_SelComponentBox->Append( ii.first );
for( const std::pair<const wxString, int>& entry : full_list )
m_SelComponentBox->Append( entry.first );
m_SelComponentBox->SetSelection( 0 );
}
@ -412,8 +416,8 @@ void GERBVIEW_FRAME::updateNetnameListSelectBox()
m_SelNetnameBox->Append( NO_SELECTION_STRING );
// Now copy the list to the choice box
for( auto& ii : full_list )
m_SelNetnameBox->Append( UnescapeString( ii.first ) );
for( const std::pair<const wxString, int>& entry : full_list )
m_SelNetnameBox->Append( UnescapeString( entry.first ) );
m_SelNetnameBox->SetSelection( 0 );
}
@ -455,10 +459,8 @@ void GERBVIEW_FRAME::updateAperAttributesSelectBox()
m_SelAperAttributesBox->Append( NO_SELECTION_STRING );
// Now copy the list to the choice box
for( auto ii = full_list.begin(); ii != full_list.end(); ++ii )
{
m_SelAperAttributesBox->Append( ii->first );
}
for( const std::pair<const wxString, int>& entry : full_list )
m_SelAperAttributesBox->Append( entry.first );
m_SelAperAttributesBox->SetSelection( 0 );
}
@ -468,20 +470,10 @@ void GERBVIEW_FRAME::OnUpdateDrawMode( wxUpdateUIEvent& aEvent )
{
switch( aEvent.GetId() )
{
case ID_TB_OPTIONS_SHOW_GBR_MODE_0:
aEvent.Check( GetDisplayMode() == 0 );
break;
case ID_TB_OPTIONS_SHOW_GBR_MODE_1:
aEvent.Check( GetDisplayMode() == 1 );
break;
case ID_TB_OPTIONS_SHOW_GBR_MODE_2:
aEvent.Check( GetDisplayMode() == 2 );
break;
default:
break;
case ID_TB_OPTIONS_SHOW_GBR_MODE_0: aEvent.Check( GetDisplayMode() == 0 ); break;
case ID_TB_OPTIONS_SHOW_GBR_MODE_1: aEvent.Check( GetDisplayMode() == 1 ); break;
case ID_TB_OPTIONS_SHOW_GBR_MODE_2: aEvent.Check( GetDisplayMode() == 2 ); break;
default: break;
}
}
@ -491,9 +483,9 @@ void GERBVIEW_FRAME::OnUpdateSelectDCode( wxUpdateUIEvent& aEvent )
if( !m_DCodeSelector )
return;
int layer = GetActiveLayer();
int layer = GetActiveLayer();
GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
int selected = ( gerber ) ? gerber->m_Selected_Tool : 0;
int selected = gerber ? gerber->m_Selected_Tool : 0;
aEvent.Enable( gerber != nullptr );

View File

@ -101,7 +101,7 @@ int GERBVIEW_CONTROL::ExportToPcbnew( const TOOL_EVENT& aEvent )
GERBER_FILE_IMAGE_LIST* images = m_frame->GetGerberLayout()->GetImagesList();
// Count the Gerber layers which are actually currently used
for( LAYER_NUM ii = 0; ii < (LAYER_NUM)images->ImagesMaxCount(); ++ii )
for( int ii = 0; ii < (int) images->ImagesMaxCount(); ++ii )
{
if( images->GetGbrImage( ii ) )
layercount++;

View File

@ -66,7 +66,7 @@ int LAYER_WIDGET::encodeId( int aColumn, int aId )
}
LAYER_NUM LAYER_WIDGET::getDecodedId( int aControlId )
int LAYER_WIDGET::getDecodedId( int aControlId )
{
int id = aControlId / LYR_COLUMN_COUNT; // rounding is OK.
return id;
@ -76,7 +76,7 @@ LAYER_NUM LAYER_WIDGET::getDecodedId( int aControlId )
void LAYER_WIDGET::OnLeftDownLayers( wxMouseEvent& event )
{
int row;
LAYER_NUM layer;
int layer;
wxWindow* eventSource = (wxWindow*) event.GetEventObject();
@ -154,7 +154,7 @@ void LAYER_WIDGET::OnLayerSwatchChanged( wxCommandEvent& aEvent )
{
COLOR_SWATCH* eventSource = static_cast<COLOR_SWATCH*>( aEvent.GetEventObject() );
COLOR4D newColor = eventSource->GetSwatchColor();
LAYER_NUM layer = getDecodedId( eventSource->GetId() );
int layer = getDecodedId( eventSource->GetId() );
// tell the client code.
OnLayerColorChange( layer, newColor );
@ -170,7 +170,8 @@ void LAYER_WIDGET::OnLayerSwatchChanged( wxCommandEvent& aEvent )
void LAYER_WIDGET::OnLayerCheckBox( wxCommandEvent& event )
{
wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject();
LAYER_NUM layer = getDecodedId( eventSource->GetId() );
int layer = getDecodedId( eventSource->GetId() );
OnLayerVisible( layer, eventSource->IsChecked() );
passOnFocus();
}
@ -201,20 +202,16 @@ void LAYER_WIDGET::OnRightDownRender( wxMouseEvent& aEvent, COLOR_SWATCH* aColor
void LAYER_WIDGET::OnRenderSwatchChanged( wxCommandEvent& aEvent )
{
auto eventSource = static_cast<COLOR_SWATCH*>( aEvent.GetEventObject() );
COLOR4D newColor = eventSource->GetSwatchColor();
LAYER_NUM id = getDecodedId( eventSource->GetId() );
COLOR_SWATCH* eventSource = static_cast<COLOR_SWATCH*>( aEvent.GetEventObject() );
COLOR4D newColor = eventSource->GetSwatchColor();
int id = getDecodedId( eventSource->GetId() );
if( id == LAYER_PCB_BACKGROUND )
{
// Update all swatch backgrounds
int count = GetLayerRowCount();
int row;
int col = 1; // bitmap button is column 1 in layers tab
for( row = 0; row < count; ++row )
for( int row = 0; row < GetLayerRowCount(); ++row )
{
COLOR_SWATCH* swatch = dynamic_cast<COLOR_SWATCH*>( getLayerComp( row, col ) );
@ -222,10 +219,9 @@ void LAYER_WIDGET::OnRenderSwatchChanged( wxCommandEvent& aEvent )
swatch->SetSwatchBackground( newColor );
}
count = GetRenderRowCount();
col = 0; // bitmap button is column 0 in render tab
for( row = 0; row < count; ++row )
for( int row = 0; row < GetRenderRowCount(); ++row )
{
COLOR_SWATCH* swatch = dynamic_cast<COLOR_SWATCH*>( getRenderComp( row, col ) );
@ -244,7 +240,8 @@ void LAYER_WIDGET::OnRenderSwatchChanged( wxCommandEvent& aEvent )
void LAYER_WIDGET::OnRenderCheckBox( wxCommandEvent& event )
{
wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject();
LAYER_NUM id = getDecodedId( eventSource->GetId() );
int id = getDecodedId( eventSource->GetId() );
OnRenderEnable( id, eventSource->IsChecked() );
passOnFocus();
}
@ -271,7 +268,7 @@ wxWindow* LAYER_WIDGET::getLayerComp( int aRow, int aColumn ) const
}
int LAYER_WIDGET::findLayerRow( LAYER_NUM aLayer ) const
int LAYER_WIDGET::findLayerRow( int aLayer ) const
{
int count = GetLayerRowCount();
@ -710,14 +707,14 @@ void LAYER_WIDGET::SelectLayerRow( int aRow )
}
void LAYER_WIDGET::SelectLayer( LAYER_NUM aLayer )
void LAYER_WIDGET::SelectLayer( int aLayer )
{
int row = findLayerRow( aLayer );
SelectLayerRow( row );
}
LAYER_NUM LAYER_WIDGET::GetSelectedLayer()
int LAYER_WIDGET::GetSelectedLayer()
{
wxWindow* w = getLayerComp( m_CurrentRow, 0 );
@ -728,14 +725,14 @@ LAYER_NUM LAYER_WIDGET::GetSelectedLayer()
}
void LAYER_WIDGET::SetLayerVisible( LAYER_NUM aLayer, bool isVisible )
void LAYER_WIDGET::SetLayerVisible( int aLayer, bool isVisible )
{
setLayerCheckbox( aLayer, isVisible );
OnLayerVisible( aLayer, isVisible );
}
void LAYER_WIDGET::setLayerCheckbox( LAYER_NUM aLayer, bool isVisible )
void LAYER_WIDGET::setLayerCheckbox( int aLayer, bool isVisible )
{
int row = findLayerRow( aLayer );
@ -748,7 +745,7 @@ void LAYER_WIDGET::setLayerCheckbox( LAYER_NUM aLayer, bool isVisible )
}
bool LAYER_WIDGET::IsLayerVisible( LAYER_NUM aLayer )
bool LAYER_WIDGET::IsLayerVisible( int aLayer )
{
int row = findLayerRow( aLayer );
@ -763,7 +760,7 @@ bool LAYER_WIDGET::IsLayerVisible( LAYER_NUM aLayer )
}
void LAYER_WIDGET::SetLayerColor( LAYER_NUM aLayer, const COLOR4D& aColor )
void LAYER_WIDGET::SetLayerColor( int aLayer, const COLOR4D& aColor )
{
int row = findLayerRow( aLayer );
@ -778,7 +775,7 @@ void LAYER_WIDGET::SetLayerColor( LAYER_NUM aLayer, const COLOR4D& aColor )
}
COLOR4D LAYER_WIDGET::GetLayerColor( LAYER_NUM aLayer ) const
COLOR4D LAYER_WIDGET::GetLayerColor( int aLayer ) const
{
int row = findLayerRow( aLayer );

View File

@ -218,32 +218,32 @@ public:
/**
* Change the row selection in the layer list to \a aLayer provided.
*/
void SelectLayer( LAYER_NUM aLayer );
void SelectLayer( int aLayer );
/**
* Return the selected layer or -1 if none.
*/
LAYER_NUM GetSelectedLayer();
int GetSelectedLayer();
/**
* Set \a aLayer visible or not. This does not invoke OnLayerVisible().
*/
void SetLayerVisible( LAYER_NUM aLayer, bool isVisible );
void SetLayerVisible( int aLayer, bool isVisible );
/**
* Return the visible state of the layer ROW associated with \a aLayer id.
*/
bool IsLayerVisible( LAYER_NUM aLayer );
bool IsLayerVisible( int aLayer );
/**
* Change the color of \a aLayer
*/
void SetLayerColor( LAYER_NUM aLayer, const COLOR4D& aColor );
void SetLayerColor( int aLayer, const COLOR4D& aColor );
/**
* Return the color of the layer ROW associated with \a aLayer id.
*/
COLOR4D GetLayerColor( LAYER_NUM aLayer ) const;
COLOR4D GetLayerColor( int aLayer ) const;
/**
* Set the state of the checkbox associated with \a aId within the Render tab group of the
@ -319,7 +319,7 @@ public:
* be used to decide when to update the screen only one time instead of
* several times in the midst of a multiple layer change.
*/
virtual void OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal = true ) = 0;
virtual void OnLayerVisible( int aLayer, bool isVisible, bool isFinal = true ) = 0;
/**
* Notify client code about a layer being right-clicked.
@ -376,10 +376,10 @@ protected:
/**
* Decode \a aControlId to original un-encoded value.
*
* This holds if encodedId was called with a LAYER_NUM (this box is used for other things
* This holds if encodedId was called with a layer (this box is used for other things
* than layers, too).
*/
static LAYER_NUM getDecodedId( int aControlId );
static int getDecodedId( int aControlId );
void OnLeftDownLayers( wxMouseEvent& event );
@ -430,7 +430,7 @@ protected:
/**
* Return the row index that \a aLayer resides in, or -1 if not found.
*/
int findLayerRow( LAYER_NUM aLayer ) const;
int findLayerRow( int aLayer ) const;
int findRenderRow( int aId ) const;
/**
@ -440,7 +440,7 @@ protected:
void insertRenderRow( int aRow, const ROW& aSpec );
void setLayerCheckbox( LAYER_NUM aLayer, bool isVisible );
void setLayerCheckbox( int aLayer, bool isVisible );
void updateLayerRow( int aRow, const wxString& aName );

View File

@ -33,13 +33,6 @@
#include <wx/string.h>
/**
* This can be replaced with int and removed. Until then, it is something you can increment,
* and its meaning is only advisory but can extend beyond PCB layers into view layers
* and gerber layers.
*/
typedef int LAYER_NUM;
/**
* A quick note on layer IDs:
*
@ -773,7 +766,7 @@ private:
* @param aLayerId = Layer index to test. It can be an int, so its useful during I/O
* @return true if aLayerIndex is a valid layer index
*/
inline bool IsValidLayer( LAYER_NUM aLayerId )
inline bool IsValidLayer( int aLayerId )
{
return unsigned( aLayerId ) < PCB_LAYER_ID_COUNT;
}
@ -784,7 +777,7 @@ inline bool IsValidLayer( LAYER_NUM aLayerId )
* @param aLayer = Layer to test
* @return true if aLayer is a layer valid in Pcbnew
*/
inline bool IsPcbLayer( LAYER_NUM aLayer )
inline bool IsPcbLayer( int aLayer )
{
return aLayer >= F_Cu && aLayer < PCB_LAYER_ID_COUNT;
}
@ -795,7 +788,7 @@ inline bool IsPcbLayer( LAYER_NUM aLayer )
* @param aLayerId = Layer to test
* @return true if aLayer is a valid copper layer
*/
inline bool IsCopperLayer( LAYER_NUM aLayerId )
inline bool IsCopperLayer( int aLayerId )
{
return aLayerId >= F_Cu && aLayerId <= B_Cu;
}
@ -806,7 +799,7 @@ inline bool IsCopperLayer( LAYER_NUM aLayerId )
* @param aLayerId = Layer to test
* @return true if aLayer is a non copper layer
*/
inline bool IsNonCopperLayer( LAYER_NUM aLayerId )
inline bool IsNonCopperLayer( int aLayerId )
{
return aLayerId > B_Cu && aLayerId <= PCB_LAYER_ID_COUNT;
}
@ -819,7 +812,7 @@ inline bool IsNonCopperLayer( LAYER_NUM aLayerId )
* @param aIncludeSyntheticCopperLayers
* @return
*/
inline bool IsCopperLayer( LAYER_NUM aLayerId, bool aIncludeSyntheticCopperLayers )
inline bool IsCopperLayer( int aLayerId, bool aIncludeSyntheticCopperLayers )
{
if( aIncludeSyntheticCopperLayers )
return !IsNonCopperLayer( aLayerId );
@ -827,14 +820,14 @@ inline bool IsCopperLayer( LAYER_NUM aLayerId, bool aIncludeSyntheticCopperLayer
return IsCopperLayer( aLayerId );
}
inline bool IsViaPadLayer( LAYER_NUM aLayer )
inline bool IsViaPadLayer( int aLayer )
{
return aLayer == LAYER_VIA_THROUGH
|| aLayer == LAYER_VIA_MICROVIA
|| aLayer == LAYER_VIA_BBLIND;
}
inline bool IsHoleLayer( LAYER_NUM aLayer )
inline bool IsHoleLayer( int aLayer )
{
return aLayer == LAYER_VIA_HOLES
|| aLayer == LAYER_VIA_HOLEWALLS
@ -854,19 +847,17 @@ inline bool IsUserLayer( PCB_LAYER_ID aLayerId )
return aLayerId >= Dwgs_User && aLayerId <= Eco2_User;
}
/*
@todo Where does this comment actually belong?
IMPORTANT: If a layer is not a front layer not necessarily is true
the converse. The same hold for a back layer.
So a layer can be:
- Front
- Back
- Neither (internal or auxiliary)
The check most frequent is for back layers, since it involves flips
*/
* IMPORTANT: If a layer is not a front layer that doesn't necessarily mean it's a back layer.
*
* So a layer can be:
* - Front
* - Back
* - Neither (internal or auxiliary)
*
* The check most frequent is for back layers, since it involves flips.
*/
/**
* Layer classification: check if it's a front layer
@ -963,14 +954,13 @@ inline int GetNetnameLayer( int aLayer )
* @param aLayer = Layer to test
* @return true if aLayer is a valid netname layer
*/
inline bool IsNetnameLayer( LAYER_NUM aLayer )
inline bool IsNetnameLayer( int aLayer )
{
return aLayer >= NETNAMES_LAYER_INDEX( F_Cu ) &&
aLayer < NETNAMES_LAYER_ID_END;
return aLayer >= NETNAMES_LAYER_INDEX( F_Cu ) && aLayer < NETNAMES_LAYER_ID_END;
}
inline bool IsZoneLayer( LAYER_NUM aLayer )
inline bool IsZoneLayer( int aLayer )
{
return aLayer >= LAYER_ZONE_START && aLayer <= LAYER_ZONE_END;
}
@ -978,8 +968,8 @@ inline bool IsZoneLayer( LAYER_NUM aLayer )
inline bool IsDCodeLayer( int aLayer )
{
return aLayer >= (GERBVIEW_LAYER_ID_START + GERBER_DRAWLAYERS_COUNT) &&
aLayer < (GERBVIEW_LAYER_ID_START + (2 * GERBER_DRAWLAYERS_COUNT));
return aLayer >= ( GERBVIEW_LAYER_ID_START + GERBER_DRAWLAYERS_COUNT )
&& aLayer < ( GERBVIEW_LAYER_ID_START + ( 2 * GERBER_DRAWLAYERS_COUNT ) );
}
@ -989,18 +979,18 @@ inline bool IsDCodeLayer( int aLayer )
* @param aLayer is the layer to test
* @return true if the layer is one that participates in net coloring
*/
inline bool IsNetCopperLayer( LAYER_NUM aLayer )
inline bool IsNetCopperLayer( int aLayer )
{
static std::set<LAYER_NUM> netCopperLayers =
static std::set<int> netCopperLayers =
{
LAYER_PAD_FR,
LAYER_PAD_BK,
LAYER_PADS_TH,
LAYER_PAD_HOLEWALLS,
LAYER_VIA_THROUGH,
LAYER_VIA_BBLIND,
LAYER_VIA_MICROVIA,
LAYER_VIA_HOLEWALLS
LAYER_PAD_FR,
LAYER_PAD_BK,
LAYER_PADS_TH,
LAYER_PAD_HOLEWALLS,
LAYER_VIA_THROUGH,
LAYER_VIA_BBLIND,
LAYER_VIA_MICROVIA,
LAYER_VIA_HOLEWALLS
};
return IsCopperLayer( aLayer ) || netCopperLayers.count( aLayer );

View File

@ -51,13 +51,13 @@ public:
protected:
// Return a color index from the layer id
virtual COLOR4D getLayerColor( LAYER_NUM aLayer ) const = 0;
virtual COLOR4D getLayerColor( int aLayer ) const = 0;
// Return the name of the layer id
virtual wxString getLayerName( LAYER_NUM aLayer ) const = 0;
virtual wxString getLayerName( int aLayer ) const = 0;
// Return true if the layer id is enabled (i.e. is it should be displayed)
virtual bool isLayerEnabled( LAYER_NUM aLayer ) const = 0;
virtual bool isLayerEnabled( int aLayer ) const = 0;
bool m_layerhotkeys;
};
@ -69,25 +69,18 @@ protected:
class LAYER_BOX_SELECTOR : public wxBitmapComboBox, public LAYER_SELECTOR
{
public:
LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = nullptr );
LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, int n = 0,
const wxString choices[] = nullptr );
LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
const wxArrayString& choices );
~LAYER_BOX_SELECTOR() override;
// Get Current Item #
int GetChoice();
int GetLayerSelection() const;
// Get Current Layer
LAYER_NUM GetLayerSelection() const;
// Set Layer #
int SetLayerSelection( LAYER_NUM layer );
int SetLayerSelection( int layer );
// Reload the Layers
// Virtual pure function because GerbView uses its own functions in a derived class

View File

@ -282,8 +282,8 @@ void AR_MATRIX::SetDist( int aRow, int aCol, int aSide, DIST_CELL x )
* half-width = lg, org = ux0,uy0 end = ux1,uy1
* coordinates are in PCB units
*/
void AR_MATRIX::drawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, LAYER_NUM layer,
int color, AR_MATRIX::CELL_OP op_logic )
void AR_MATRIX::drawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer, int color,
AR_MATRIX::CELL_OP op_logic )
{
int64_t row, col;
int64_t inc;
@ -408,8 +408,8 @@ void AR_MATRIX::drawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, LAYE
* half-width = lg, center = ux0, uy0, ux1,uy1 is a point on the circle.
* coord are in PCB units.
*/
void AR_MATRIX::traceCircle( int ux0, int uy0, int ux1, int uy1, int lg, LAYER_NUM layer, int color,
AR_MATRIX::CELL_OP op_logic )
void AR_MATRIX::traceCircle( int ux0, int uy0, int ux1, int uy1, int lg, int layer, int color,
AR_MATRIX::CELL_OP op_logic )
{
int radius, nb_segm;
int x0, y0, // Starting point of the current segment trace.
@ -568,8 +568,8 @@ void AR_MATRIX::traceFilledCircle(
* center = ux0,uy0, starting at ux1, uy1. Coordinates are in
* PCB units.
*/
void AR_MATRIX::traceArc( int ux0, int uy0, int ux1, int uy1, double ArcAngle, int lg,
LAYER_NUM layer, int color, AR_MATRIX::CELL_OP op_logic )
void AR_MATRIX::traceArc( int ux0, int uy0, int ux1, int uy1, double ArcAngle, int lg, int layer,
int color, AR_MATRIX::CELL_OP op_logic )
{
int radius, nb_segm;
int x0, y0, // Starting point of the current segment trace
@ -768,7 +768,7 @@ void AR_MATRIX::TraceSegmentPcb( PCB_SHAPE* aShape, int aColor, int aMargin,
int half_width = ( aShape->GetWidth() / 2 ) + aMargin;
// Calculate the bounding rectangle of the segment (if H, V or Via)
LAYER_NUM layer = UNDEFINED_LAYER; // Draw on all layers
int layer = UNDEFINED_LAYER; // Draw on all layers
if( aShape->GetShape() == SHAPE_T::CIRCLE || aShape->GetShape() == SHAPE_T::SEGMENT )
{

View File

@ -122,16 +122,16 @@ public:
AR_MATRIX::CELL_OP op_logic );
private:
void drawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, LAYER_NUM layer, int color,
CELL_OP op_logic );
void drawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer, int color,
CELL_OP op_logic );
void traceCircle( int ux0, int uy0, int ux1, int uy1, int lg, LAYER_NUM layer, int color,
void traceCircle( int ux0, int uy0, int ux1, int uy1, int lg, int layer, int color,
AR_MATRIX::CELL_OP op_logic );
void traceFilledCircle( int cx, int cy, int radius, LSET aLayerMask, int color,
AR_MATRIX::CELL_OP op_logic );
void traceArc( int ux0, int uy0, int ux1, int uy1, double ArcAngle, int lg, LAYER_NUM layer,
void traceArc( int ux0, int uy0, int ux1, int uy1, double ArcAngle, int lg, int layer,
int color, AR_MATRIX::CELL_OP op_logic );
public:

View File

@ -75,7 +75,7 @@ BOARD::BOARD() :
// we have not loaded a board yet, assume latest until then.
m_fileFormatVersionAtLoad = LEGACY_BOARD_FILE_VERSION;
for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
for( int layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
{
m_layers[layer].m_name = GetStandardLayerName( ToLAYER_ID( layer ) );
@ -340,17 +340,15 @@ bool BOARD::SetLayerDescr( PCB_LAYER_ID aIndex, const LAYER& aLayer )
const PCB_LAYER_ID BOARD::GetLayerID( const wxString& aLayerName ) const
{
// Check the BOARD physical layer names.
for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
for( int layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
{
if ( ( m_layers[ layer ].m_name == aLayerName )
|| ( m_layers[ layer ].m_userName == aLayerName ) )
if ( m_layers[ layer ].m_name == aLayerName || m_layers[ layer ].m_userName == aLayerName )
return ToLAYER_ID( layer );
}
// Otherwise fall back to the system standard layer names for virtual layers.
for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
for( int layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
{
if( GetStandardLayerName( ToLAYER_ID( layer ) ) == aLayerName )
return ToLAYER_ID( layer );
@ -399,8 +397,6 @@ LAYER_T BOARD::GetLayerType( PCB_LAYER_ID aLayer ) const
if( !IsCopperLayer( aLayer ) )
return LT_SIGNAL;
//@@IMB: The original test was broken due to the discontinuity
// in the layer sequence.
if( IsLayerEnabled( aLayer ) )
return m_layers[aLayer].m_type;
@ -413,8 +409,6 @@ bool BOARD::SetLayerType( PCB_LAYER_ID aLayer, LAYER_T aLayerType )
if( !IsCopperLayer( aLayer ) )
return false;
//@@IMB: The original test was broken due to the discontinuity
// in the layer sequence.
if( IsLayerEnabled( aLayer ) )
{
m_layers[aLayer].m_type = aLayerType;
@ -574,15 +568,9 @@ bool BOARD::IsFootprintLayerVisible( PCB_LAYER_ID aLayer ) const
{
switch( aLayer )
{
case F_Cu:
return IsElementVisible( LAYER_MOD_FR );
case B_Cu:
return IsElementVisible( LAYER_MOD_BK );
default:
wxFAIL_MSG( wxT( "BOARD::IsModuleLayerVisible() param error: bad layer" ) );
return true;
case F_Cu: return IsElementVisible( LAYER_MOD_FR );
case B_Cu: return IsElementVisible( LAYER_MOD_BK );
default: wxFAIL_MSG( wxT( "BOARD::IsModuleLayerVisible(): bad layer" ) ); return true;
}
}

View File

@ -70,7 +70,7 @@ int GLOBAL_EDIT_TOOL::GlobalDeletions( const TOOL_EVENT& aEvent )
}
void DIALOG_GLOBAL_DELETION::SetCurrentLayer( LAYER_NUM aLayer )
void DIALOG_GLOBAL_DELETION::SetCurrentLayer( int aLayer )
{
m_currentLayer = aLayer;
m_textCtrlCurrLayer->SetValue( m_Parent->GetBoard()->GetLayerName( ToLAYER_ID( aLayer ) ) );
@ -177,8 +177,8 @@ void DIALOG_GLOBAL_DELETION::DoGlobalDeletions()
for( BOARD_ITEM* item : board->Drawings() )
{
KICAD_T type = item->Type();
LAYER_NUM layer = item->GetLayer();
KICAD_T type = item->Type();
int layer = item->GetLayer();
if( !delete_all )
{

View File

@ -30,7 +30,7 @@ class DIALOG_GLOBAL_DELETION: public DIALOG_GLOBAL_DELETION_BASE
{
public:
DIALOG_GLOBAL_DELETION( PCB_EDIT_FRAME* parent );
void SetCurrentLayer( LAYER_NUM aLayer );
void SetCurrentLayer( int aLayer );
///< @todo Move this back into the tool rather than having the dialog do the deleting.
void DoGlobalDeletions();
@ -42,7 +42,7 @@ private:
void onCheckDeleteBoardOutlines( wxCommandEvent& event ) override;
PCB_EDIT_FRAME* m_Parent;
LAYER_NUM m_currentLayer;
int m_currentLayer;
};
#endif // _DIALOG_GLOBAL_DELETION_H_

View File

@ -71,7 +71,7 @@ static bool g_modifyFootprintGraphics;
static bool g_modifyBoardText;
static bool g_modifyBoardGraphics;
static bool g_filterByLayer;
static LAYER_NUM g_layerFilter;
static int g_layerFilter;
static bool g_filterByReference;
static wxString g_referenceFilter;
static bool g_filterByFootprint;

View File

@ -57,7 +57,7 @@ static wxString g_netclassFilter;
static bool g_filterByNet;
static wxString g_netFilter;
static bool g_filterByLayer;
static LAYER_NUM g_layerFilter;
static int g_layerFilter;
static bool g_filterSelected = false;

View File

@ -277,7 +277,7 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
return false;
}
LAYER_NUM layer = m_LayerSelectionCtrl->GetLayerSelection();
int layer = m_LayerSelectionCtrl->GetLayerSelection();
BOARD_COMMIT commit( m_parent );
commit.Modify( m_item );

View File

@ -76,7 +76,7 @@ PCB_LAYER_ID DIALOG_IMPORTED_LAYERS::GetSelectedLayerID()
wxLIST_STATE_SELECTED ) ) == wxNOT_FOUND,
"There are more than one KiCad layer selected (unexpected)" );
for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
for( int layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
{
if( LayerName( ToLAYER_ID( layer ) ) == selectedKiCadLayerName )
return ToLAYER_ID( layer );

View File

@ -544,7 +544,7 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow()
else if( !m_trackWidth.IsIndeterminate() )
t->SetWidth( m_trackWidth.GetValue() );
LAYER_NUM layer = m_TrackLayerCtrl->GetLayerSelection();
int layer = m_TrackLayerCtrl->GetLayerSelection();
if( layer != UNDEFINED_LAYER )
t->SetLayer( (PCB_LAYER_ID) layer );

View File

@ -49,7 +49,7 @@
static LSEQ dlg_layers()
{
// Layers that are put out into the dialog UI, coordinate with wxformbuilder and
// getCTLs( LAYER_NUM aLayerNumber )
// getCTLs( int aLayerNumber )
static const PCB_LAYER_ID layers[] = {
F_CrtYd,
F_Fab,
@ -131,7 +131,7 @@ PANEL_SETUP_LAYERS::PANEL_SETUP_LAYERS( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* a
}
PANEL_SETUP_LAYERS_CTLs PANEL_SETUP_LAYERS::getCTLs( LAYER_NUM aLayerNumber )
PANEL_SETUP_LAYERS_CTLs PANEL_SETUP_LAYERS::getCTLs( int aLayerNumber )
{
#define RETURN_COPPER( x ) return PANEL_SETUP_LAYERS_CTLs( x##Name, x##CheckBox, x##Choice )
#define RETURN_AUX( x ) return PANEL_SETUP_LAYERS_CTLs( x##Name, x##CheckBox, x##StaticText )
@ -139,70 +139,70 @@ PANEL_SETUP_LAYERS_CTLs PANEL_SETUP_LAYERS::getCTLs( LAYER_NUM aLayerNumber )
switch( aLayerNumber )
{
case F_CrtYd: RETURN_MANDATORY( m_CrtYdFront );
case F_Fab: RETURN_AUX( m_FabFront );
case F_Adhes: RETURN_AUX( m_AdhesFront );
case F_Paste: RETURN_AUX( m_SoldPFront );
case F_SilkS: RETURN_AUX( m_SilkSFront );
case F_Mask: RETURN_AUX( m_MaskFront );
case F_Cu: RETURN_COPPER( m_Front );
case F_CrtYd: RETURN_MANDATORY( m_CrtYdFront );
case F_Fab: RETURN_AUX( m_FabFront );
case F_Adhes: RETURN_AUX( m_AdhesFront );
case F_Paste: RETURN_AUX( m_SoldPFront );
case F_SilkS: RETURN_AUX( m_SilkSFront );
case F_Mask: RETURN_AUX( m_MaskFront );
case F_Cu: RETURN_COPPER( m_Front );
case In1_Cu: RETURN_COPPER( m_In1 );
case In2_Cu: RETURN_COPPER( m_In2 );
case In3_Cu: RETURN_COPPER( m_In3 );
case In4_Cu: RETURN_COPPER( m_In4 );
case In5_Cu: RETURN_COPPER( m_In5 );
case In6_Cu: RETURN_COPPER( m_In6 );
case In7_Cu: RETURN_COPPER( m_In7 );
case In8_Cu: RETURN_COPPER( m_In8 );
case In9_Cu: RETURN_COPPER( m_In9 );
case In10_Cu: RETURN_COPPER( m_In10 );
case In11_Cu: RETURN_COPPER( m_In11 );
case In12_Cu: RETURN_COPPER( m_In12 );
case In13_Cu: RETURN_COPPER( m_In13 );
case In14_Cu: RETURN_COPPER( m_In14 );
case In15_Cu: RETURN_COPPER( m_In15 );
case In1_Cu: RETURN_COPPER( m_In1 );
case In2_Cu: RETURN_COPPER( m_In2 );
case In3_Cu: RETURN_COPPER( m_In3 );
case In4_Cu: RETURN_COPPER( m_In4 );
case In5_Cu: RETURN_COPPER( m_In5 );
case In6_Cu: RETURN_COPPER( m_In6 );
case In7_Cu: RETURN_COPPER( m_In7 );
case In8_Cu: RETURN_COPPER( m_In8 );
case In9_Cu: RETURN_COPPER( m_In9 );
case In10_Cu: RETURN_COPPER( m_In10 );
case In11_Cu: RETURN_COPPER( m_In11 );
case In12_Cu: RETURN_COPPER( m_In12 );
case In13_Cu: RETURN_COPPER( m_In13 );
case In14_Cu: RETURN_COPPER( m_In14 );
case In15_Cu: RETURN_COPPER( m_In15 );
case In16_Cu: RETURN_COPPER( m_In16 );
case In17_Cu: RETURN_COPPER( m_In17 );
case In18_Cu: RETURN_COPPER( m_In18 );
case In19_Cu: RETURN_COPPER( m_In19 );
case In20_Cu: RETURN_COPPER( m_In20 );
case In21_Cu: RETURN_COPPER( m_In21 );
case In22_Cu: RETURN_COPPER( m_In22 );
case In23_Cu: RETURN_COPPER( m_In23 );
case In24_Cu: RETURN_COPPER( m_In24 );
case In25_Cu: RETURN_COPPER( m_In25 );
case In26_Cu: RETURN_COPPER( m_In26 );
case In27_Cu: RETURN_COPPER( m_In27 );
case In28_Cu: RETURN_COPPER( m_In28 );
case In29_Cu: RETURN_COPPER( m_In29 );
case In30_Cu: RETURN_COPPER( m_In30 );
case In16_Cu: RETURN_COPPER( m_In16 );
case In17_Cu: RETURN_COPPER( m_In17 );
case In18_Cu: RETURN_COPPER( m_In18 );
case In19_Cu: RETURN_COPPER( m_In19 );
case In20_Cu: RETURN_COPPER( m_In20 );
case In21_Cu: RETURN_COPPER( m_In21 );
case In22_Cu: RETURN_COPPER( m_In22 );
case In23_Cu: RETURN_COPPER( m_In23 );
case In24_Cu: RETURN_COPPER( m_In24 );
case In25_Cu: RETURN_COPPER( m_In25 );
case In26_Cu: RETURN_COPPER( m_In26 );
case In27_Cu: RETURN_COPPER( m_In27 );
case In28_Cu: RETURN_COPPER( m_In28 );
case In29_Cu: RETURN_COPPER( m_In29 );
case In30_Cu: RETURN_COPPER( m_In30 );
case B_Cu: RETURN_COPPER( m_Back );
case B_Mask: RETURN_AUX( m_MaskBack );
case B_SilkS: RETURN_AUX( m_SilkSBack );
case B_Paste: RETURN_AUX( m_SoldPBack );
case B_Adhes: RETURN_AUX( m_AdhesBack );
case B_Fab: RETURN_AUX( m_FabBack );
case B_CrtYd: RETURN_MANDATORY( m_CrtYdBack );
case B_Cu: RETURN_COPPER( m_Back );
case B_Mask: RETURN_AUX( m_MaskBack );
case B_SilkS: RETURN_AUX( m_SilkSBack );
case B_Paste: RETURN_AUX( m_SoldPBack );
case B_Adhes: RETURN_AUX( m_AdhesBack );
case B_Fab: RETURN_AUX( m_FabBack );
case B_CrtYd: RETURN_MANDATORY( m_CrtYdBack );
case Edge_Cuts: RETURN_MANDATORY( m_PCBEdges );
case Margin: RETURN_MANDATORY( m_Margin );
case Eco2_User: RETURN_AUX( m_Eco2 );
case Eco1_User: RETURN_AUX( m_Eco1 );
case Cmts_User: RETURN_AUX( m_Comments );
case Dwgs_User: RETURN_AUX( m_Drawings );
case Edge_Cuts: RETURN_MANDATORY( m_PCBEdges );
case Margin: RETURN_MANDATORY( m_Margin );
case Eco2_User: RETURN_AUX( m_Eco2 );
case Eco1_User: RETURN_AUX( m_Eco1 );
case Cmts_User: RETURN_AUX( m_Comments );
case Dwgs_User: RETURN_AUX( m_Drawings );
case User_1: RETURN_AUX( m_User1 );
case User_2: RETURN_AUX( m_User2 );
case User_3: RETURN_AUX( m_User3 );
case User_4: RETURN_AUX( m_User4 );
case User_5: RETURN_AUX( m_User5 );
case User_6: RETURN_AUX( m_User6 );
case User_7: RETURN_AUX( m_User7 );
case User_8: RETURN_AUX( m_User8 );
case User_9: RETURN_AUX( m_User9 );
case User_1: RETURN_AUX( m_User1 );
case User_2: RETURN_AUX( m_User2 );
case User_3: RETURN_AUX( m_User3 );
case User_4: RETURN_AUX( m_User4 );
case User_5: RETURN_AUX( m_User5 );
case User_6: RETURN_AUX( m_User6 );
case User_7: RETURN_AUX( m_User7 );
case User_8: RETURN_AUX( m_User8 );
case User_9: RETURN_AUX( m_User9 );
default:
wxASSERT_MSG( 0, wxT( "bad layer id" ) );
@ -211,19 +211,19 @@ PANEL_SETUP_LAYERS_CTLs PANEL_SETUP_LAYERS::getCTLs( LAYER_NUM aLayerNumber )
}
wxControl* PANEL_SETUP_LAYERS::getName( LAYER_NUM aLayer )
wxControl* PANEL_SETUP_LAYERS::getName( int aLayer )
{
return getCTLs( aLayer ).name;
}
wxCheckBox* PANEL_SETUP_LAYERS::getCheckBox( LAYER_NUM aLayer )
wxCheckBox* PANEL_SETUP_LAYERS::getCheckBox( int aLayer )
{
return getCTLs( aLayer ).checkbox;
}
wxChoice* PANEL_SETUP_LAYERS::getChoice( LAYER_NUM aLayer )
wxChoice* PANEL_SETUP_LAYERS::getChoice( int aLayer )
{
return (wxChoice*) getCTLs( aLayer ).choice;
}
@ -267,7 +267,7 @@ void PANEL_SETUP_LAYERS::setUserDefinedLayerCheckBoxes()
for( LSEQ seq = LSET::UserDefinedLayers().Seq(); seq; ++seq )
{
PCB_LAYER_ID layer = *seq;
bool state = m_pcb->IsLayerEnabled( layer );
bool state = m_pcb->IsLayerEnabled( layer );
#ifdef HIDE_INACTIVE_LAYERS
// This code hides inactive copper layers, or redisplays hidden layers which are now needed.
@ -356,7 +356,7 @@ LSET PANEL_SETUP_LAYERS::GetUILayerMask()
}
void PANEL_SETUP_LAYERS::setLayerCheckBox( LAYER_NUM aLayer, bool isChecked )
void PANEL_SETUP_LAYERS::setLayerCheckBox( int aLayer, bool isChecked )
{
PANEL_SETUP_LAYERS_CTLs ctl = getCTLs( aLayer );
@ -427,8 +427,8 @@ void PANEL_SETUP_LAYERS::DenyChangeCheckBox( wxCommandEvent& event )
if( source == copper )
{
DisplayError( this,
_( "Use the Physical Stackup page to change the number of copper layers." ) );
DisplayError( this, _( "Use the Physical Stackup page to change the number of "
"copper layers." ) );
copper->SetValue( true );
return;
@ -585,7 +585,7 @@ bool PANEL_SETUP_LAYERS::TransferDataFromWindow()
}
int PANEL_SETUP_LAYERS::getLayerTypeIndex( LAYER_NUM aLayer )
int PANEL_SETUP_LAYERS::getLayerTypeIndex( int aLayer )
{
wxChoice* ctl = getChoice( aLayer );
int ret = ctl->GetCurrentSelection(); // Indices must have same sequence as LAYER_T
@ -593,7 +593,7 @@ int PANEL_SETUP_LAYERS::getLayerTypeIndex( LAYER_NUM aLayer )
}
wxString PANEL_SETUP_LAYERS::GetLayerName( LAYER_NUM aLayer )
wxString PANEL_SETUP_LAYERS::GetLayerName( int aLayer )
{
wxControl* control = getName( aLayer );

View File

@ -77,7 +77,7 @@ public:
LSET GetUILayerMask();
///< @return the layer name within the UI wxTextCtrl
wxString GetLayerName( LAYER_NUM layer );
wxString GetLayerName( int layer );
/**
* Called when switching to this tab to make sure that any changes to the copper layer count
@ -93,7 +93,7 @@ public:
private:
void setLayerCheckBox( LAYER_NUM layer, bool isChecked );
void setLayerCheckBox( int layer, bool isChecked );
void setCopperLayerCheckBoxes( int copperCount );
void setMandatoryLayerCheckBoxes();
void setUserDefinedLayerCheckBoxes();
@ -102,7 +102,7 @@ private:
void showSelectedLayerCheckBoxes( LSET enableLayerMask );
void showLayerTypes();
int getLayerTypeIndex( LAYER_NUM layer );
int getLayerTypeIndex( int layer );
void OnCheckBox( wxCommandEvent& event ) override;
void DenyChangeCheckBox( wxCommandEvent& event ) override;
@ -122,10 +122,10 @@ private:
*/
LSEQ getNonRemovableLayers();
PANEL_SETUP_LAYERS_CTLs getCTLs( LAYER_NUM aLayerNumber );
wxControl* getName( LAYER_NUM aLayer );
wxCheckBox* getCheckBox( LAYER_NUM aLayer );
wxChoice* getChoice( LAYER_NUM aLayer );
PANEL_SETUP_LAYERS_CTLs getCTLs( int aLayerNumber );
wxControl* getName( int aLayer );
wxCheckBox* getCheckBox( int aLayer );
wxChoice* getChoice( int aLayer );
PAGED_DIALOG* m_parentDialog;
PCB_EDIT_FRAME* m_frame;

View File

@ -35,13 +35,13 @@
#include <zone.h>
#include <pcb_target.h>
#include <pcb_dimension.h>
#include <pcb_layer_box_selector.h>
#include <dialog_drc.h>
#include <connectivity/connectivity_data.h>
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <tools/drc_tool.h>
#include <dialogs/dialog_dimension_properties.h>
#include <pcb_layer_box_selector.h>
// Handles the selection of command events.
void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )

View File

@ -73,7 +73,7 @@ static int compute_pad_access_code( BOARD *aPcb, LSET aLayerMask )
// OK, we have an inner-layer only pad (and I have no idea about
// what could be used for); anyway, find the first copper layer
// it's on
for( LAYER_NUM layer = In1_Cu; layer < B_Cu; ++layer )
for( int layer = In1_Cu; layer < B_Cu; ++layer )
{
if( aLayerMask[layer] )
return layer + 1;

View File

@ -39,10 +39,10 @@
class LIST_MOD // An helper class used to build a list of useful footprints.
{
public:
FOOTPRINT* m_Footprint; // Link to the actual footprint
wxString m_Reference; // Its schematic reference
wxString m_Value; // Its schematic value
LAYER_NUM m_Layer; // its side (B_Cu, or F_Cu)
FOOTPRINT* m_Footprint; // Link to the actual footprint
wxString m_Reference; // Its schematic reference
wxString m_Value; // Its schematic value
int m_Layer; // its side (B_Cu, or F_Cu)
};
@ -177,7 +177,7 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
footprint_pos = list[ii].m_Footprint->GetPosition();
footprint_pos -= m_place_Offset;
LAYER_NUM layer = list[ii].m_Footprint->GetLayer();
int layer = list[ii].m_Footprint->GetLayer();
wxASSERT( layer == F_Cu || layer == B_Cu );
if( layer == B_Cu )
@ -243,7 +243,7 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
footprint_pos = list[ii].m_Footprint->GetPosition();
footprint_pos -= m_place_Offset;
LAYER_NUM layer = list[ii].m_Footprint->GetLayer();
int layer = list[ii].m_Footprint->GetLayer();
wxASSERT( layer == F_Cu || layer == B_Cu );
if( layer == B_Cu )

View File

@ -155,7 +155,7 @@ void EXPORTER_PCB_VRML::SetOffset( double aXoff, double aYoff )
}
bool EXPORTER_PCB_VRML::GetLayer3D( LAYER_NUM layer, VRML_LAYER** vlayer )
bool EXPORTER_PCB_VRML::GetLayer3D( int layer, VRML_LAYER** vlayer )
{
// select the VRML layer object to draw on; return true if
// a layer has been selected.

View File

@ -113,7 +113,7 @@ public:
void SetOffset( double aXoff, double aYoff );
double GetLayerZ( LAYER_NUM aLayer )
double GetLayerZ( int aLayer )
{
if( unsigned( aLayer ) >= arrayDim( m_layer_z ) )
return 0;
@ -121,7 +121,7 @@ public:
return m_layer_z[ aLayer ];
}
void SetLayerZ( LAYER_NUM aLayer, double aValue )
void SetLayerZ( int aLayer, double aValue )
{
m_layer_z[aLayer] = aValue;
}
@ -158,21 +158,20 @@ public:
// select the VRML layer object to draw on
// return true if a layer has been selected.
bool GetLayer3D( LAYER_NUM layer, VRML_LAYER** vlayer );
bool GetLayer3D( int layer, VRML_LAYER** vlayer );
// Build the Z position of 3D layers
void ComputeLayer3D_Zpos();
private:
void write_triangle_bag( std::ostream& aOut_file, const VRML_COLOR& aColor,
VRML_LAYER* aLayer, bool aPlane, bool aTop,
double aTop_z, double aBottom_z );
void write_triangle_bag( std::ostream& aOut_file, const VRML_COLOR& aColor, VRML_LAYER* aLayer,
bool aPlane, bool aTop, double aTop_z, double aBottom_z );
void create_vrml_shell( IFSG_TRANSFORM& PcbOutput, VRML_COLOR_INDEX colorID,
VRML_LAYER* layer, double top_z, double bottom_z );
void create_vrml_shell( IFSG_TRANSFORM& PcbOutput, VRML_COLOR_INDEX colorID, VRML_LAYER* layer,
double top_z, double bottom_z );
void create_vrml_plane( IFSG_TRANSFORM& PcbOutput, VRML_COLOR_INDEX colorID,
VRML_LAYER* layer, double aHeight, bool aTopPlane );
void create_vrml_plane( IFSG_TRANSFORM& PcbOutput, VRML_COLOR_INDEX colorID, VRML_LAYER* layer,
double aHeight, bool aTopPlane );
SGNODE* getSGColor( VRML_COLOR_INDEX colorIdx );

View File

@ -720,7 +720,7 @@ public:
struct cmp_drawings
{
bool operator()( const BOARD_ITEM* aFirst, const BOARD_ITEM* aSecond ) const;
bool operator()( const BOARD_ITEM* itemA, const BOARD_ITEM* itemB ) const;
};
struct cmp_pads

View File

@ -29,7 +29,6 @@
#include <fp_lib_table.h>
#include <functional>
#include <kiway_express.h>
#include <pcb_layer_box_selector.h>
#include <pcbnew_id.h>
#include <ratsnest/ratsnest_data.h>
#include <settings/color_settings.h>
@ -37,6 +36,7 @@
#include <tools/pcb_actions.h>
#include <widgets/appearance_controls.h>
#include <widgets/lib_tree.h>
#include <pcb_layer_box_selector.h>
using namespace std::placeholders;

View File

@ -27,7 +27,6 @@
#include <pcb_edit_frame.h>
#include <pcb_layer_box_selector.h>
#include <settings/color_settings.h>
#include <widgets/layer_box_selector.h>
#include <wx/textctrl.h>
@ -48,7 +47,7 @@ GRID_CELL_LAYER_RENDERER::~GRID_CELL_LAYER_RENDERER()
void GRID_CELL_LAYER_RENDERER::Draw( wxGrid& aGrid, wxGridCellAttr& aAttr, wxDC& aDC,
const wxRect& aRect, int aRow, int aCol, bool isSelected )
{
LAYER_NUM value = aGrid.GetTable()->GetValueAsLong( aRow, aCol );
int value = aGrid.GetTable()->GetValueAsLong( aRow, aCol );
wxRect rect = aRect;
rect.Inflate( -1 );
@ -142,7 +141,7 @@ void GRID_CELL_LAYER_SELECTOR::BeginEdit( int aRow, int aCol, wxGrid* aGrid )
m_control->Bind(wxEVT_COMBOBOX_DROPDOWN, &GRID_CELL_LAYER_SELECTOR::onComboDropDown, this);
m_control->Bind(wxEVT_COMBOBOX_CLOSEUP, &GRID_CELL_LAYER_SELECTOR::onComboCloseUp, this);
m_value = (LAYER_NUM) aGrid->GetTable()->GetValueAsLong( aRow, aCol );
m_value = aGrid->GetTable()->GetValueAsLong( aRow, aCol );
// Footprints are defined in a global context and may contain layers not enabled
// on the current board. Check and display all layers if so.
@ -173,7 +172,7 @@ void GRID_CELL_LAYER_SELECTOR::BeginEdit( int aRow, int aCol, wxGrid* aGrid )
bool GRID_CELL_LAYER_SELECTOR::EndEdit( int , int , const wxGrid* , const wxString& ,
wxString *newval )
{
const LAYER_NUM value = LayerBox()->GetLayerSelection();
const int value = LayerBox()->GetLayerSelection();
if ( value == m_value )
return false;

View File

@ -81,7 +81,7 @@ protected:
PCB_BASE_FRAME* m_frame;
LSET m_mask;
LAYER_NUM m_value;
int m_value;
wxDECLARE_NO_COPY_CLASS( GRID_CELL_LAYER_SELECTOR );
};

View File

@ -42,7 +42,7 @@
wxString DIALOG_IMPORT_GFX::m_filename;
bool DIALOG_IMPORT_GFX::m_placementInteractive = true;
bool DIALOG_IMPORT_GFX::m_shouldGroupItems = true;
LAYER_NUM DIALOG_IMPORT_GFX::m_layer = Dwgs_User;
int DIALOG_IMPORT_GFX::m_layer = Dwgs_User;
double DIALOG_IMPORT_GFX::m_scaleImport = 1.0; // Do not change the imported items size
int DIALOG_IMPORT_GFX::m_originUnits = 0; // millimeter
int DIALOG_IMPORT_GFX::m_lineWidthUnits = 0; // millimeter

View File

@ -103,7 +103,7 @@ private:
static wxString m_filename;
static bool m_shouldGroupItems;
static bool m_placementInteractive;
static LAYER_NUM m_layer;
static int m_layer;
double m_lineWidth; // always in mm: line width when a line width
// is not specified
static int m_lineWidthUnits;

View File

@ -55,7 +55,7 @@
using namespace std::placeholders;
const LAYER_NUM GAL_LAYER_ORDER[] =
const int GAL_LAYER_ORDER[] =
{
LAYER_GP_OVERLAY,
LAYER_SELECT_OVERLAY,
@ -292,7 +292,7 @@ void PCB_DRAW_PANEL_GAL::SetHighContrastLayer( PCB_LAYER_ID aLayer )
// Bring some other layers to the front in case of copper layers and make them colored
// fixme do not like the idea of storing the list of layers here,
// should be done in some other way I guess..
LAYER_NUM layers[] = {
int layers[] = {
GetNetnameLayer( aLayer ), LAYER_VIA_NETNAMES,
LAYER_PAD_FR_NETNAMES, LAYER_PAD_BK_NETNAMES, LAYER_PAD_NETNAMES,
ZONE_LAYER_FOR( aLayer ),
@ -331,7 +331,7 @@ void PCB_DRAW_PANEL_GAL::SetTopLayer( PCB_LAYER_ID aLayer )
m_view->SetTopLayer( aLayer );
// Layers that should always have on-top attribute enabled
const std::vector<LAYER_NUM> layers = {
const std::vector<int> layers = {
LAYER_VIA_THROUGH, LAYER_VIA_BBLIND, LAYER_VIA_MICROVIA, LAYER_VIA_HOLES,
LAYER_VIA_HOLEWALLS,
LAYER_VIA_NETNAMES,
@ -346,17 +346,17 @@ void PCB_DRAW_PANEL_GAL::SetTopLayer( PCB_LAYER_ID aLayer )
m_view->SetTopLayer( layer );
// Extra layers that are brought to the top if a F.* or B.* is selected
const std::vector<LAYER_NUM> frontLayers = {
const std::vector<int> frontLayers = {
F_Cu, F_Adhes, F_Paste, F_SilkS, F_Mask, F_Fab, F_CrtYd, LAYER_PAD_FR,
LAYER_PAD_FR_NETNAMES, NETNAMES_LAYER_INDEX( F_Cu )
};
const std::vector<LAYER_NUM> backLayers = {
const std::vector<int> backLayers = {
B_Cu, B_Adhes, B_Paste, B_SilkS, B_Mask, B_Fab, B_CrtYd, LAYER_PAD_BK,
LAYER_PAD_BK_NETNAMES, NETNAMES_LAYER_INDEX( B_Cu )
};
const std::vector<LAYER_NUM>* extraLayers = nullptr;
const std::vector<int>* extraLayers = nullptr;
// Bring a few more extra layers to the top depending on the selected board side
if( IsFrontLayer( aLayer ) )
@ -408,7 +408,7 @@ void PCB_DRAW_PANEL_GAL::SetTopLayer( PCB_LAYER_ID aLayer )
void PCB_DRAW_PANEL_GAL::SyncLayersVisibility( const BOARD* aBoard )
{
// Load layer & elements visibility settings
for( LAYER_NUM i = 0; i < PCB_LAYER_ID_COUNT; ++i )
for( int i = 0; i < PCB_LAYER_ID_COUNT; ++i )
m_view->SetLayerVisible( i, aBoard->IsLayerVisible( PCB_LAYER_ID( i ) ) );
for( GAL_LAYER_ID i = GAL_LAYER_ID_START; i < GAL_LAYER_ID_END; ++i )
@ -424,10 +424,10 @@ void PCB_DRAW_PANEL_GAL::SyncLayersVisibility( const BOARD* aBoard )
m_view->SetLayerVisible( LAYER_PAD_BK, true );
// Always enable netname layers, as their visibility is controlled by layer dependencies
for( LAYER_NUM i = NETNAMES_LAYER_ID_START; i < NETNAMES_LAYER_ID_END; ++i )
for( int i = NETNAMES_LAYER_ID_START; i < NETNAMES_LAYER_ID_END; ++i )
m_view->SetLayerVisible( i, true );
for( LAYER_NUM i = LAYER_ZONE_START; i < LAYER_ZONE_END; i++ )
for( int i = LAYER_ZONE_START; i < LAYER_ZONE_END; i++ )
m_view->SetLayerVisible( i, true );
// Enable some layers that are GAL specific
@ -520,9 +520,9 @@ void PCB_DRAW_PANEL_GAL::OnShow()
void PCB_DRAW_PANEL_GAL::setDefaultLayerOrder()
{
for( LAYER_NUM i = 0; (unsigned) i < sizeof( GAL_LAYER_ORDER ) / sizeof( LAYER_NUM ); ++i )
for( int i = 0; (unsigned) i < sizeof( GAL_LAYER_ORDER ) / sizeof( int ); ++i )
{
LAYER_NUM layer = GAL_LAYER_ORDER[i];
int layer = GAL_LAYER_ORDER[i];
wxASSERT( layer < KIGFX::VIEW::VIEW_MAX_LAYERS );
m_view->SetLayerOrder( layer, i );
@ -563,9 +563,9 @@ void PCB_DRAW_PANEL_GAL::setDefaultLayerDeps()
for( int i = 0; i < KIGFX::VIEW::VIEW_MAX_LAYERS; i++ )
m_view->SetLayerTarget( i, target );
for( LAYER_NUM i = 0; (unsigned) i < sizeof( GAL_LAYER_ORDER ) / sizeof( LAYER_NUM ); ++i )
for( int i = 0; (unsigned) i < sizeof( GAL_LAYER_ORDER ) / sizeof( int ); ++i )
{
LAYER_NUM layer = GAL_LAYER_ORDER[i];
int layer = GAL_LAYER_ORDER[i];
wxASSERT( layer < KIGFX::VIEW::VIEW_MAX_LAYERS );
// Set layer display dependencies & targets

View File

@ -134,7 +134,7 @@ void PCB_LAYER_BOX_SELECTOR::Resync()
// Returns true if the layer id is enabled (i.e. is it should be displayed)
bool PCB_LAYER_BOX_SELECTOR::isLayerEnabled( LAYER_NUM aLayer ) const
bool PCB_LAYER_BOX_SELECTOR::isLayerEnabled( int aLayer ) const
{
BOARD* board = m_boardFrame->GetBoard();
@ -151,7 +151,7 @@ LSET PCB_LAYER_BOX_SELECTOR::getEnabledLayers() const
// Returns a color index from the layer id
COLOR4D PCB_LAYER_BOX_SELECTOR::getLayerColor( LAYER_NUM aLayer ) const
COLOR4D PCB_LAYER_BOX_SELECTOR::getLayerColor( int aLayer ) const
{
wxASSERT( m_boardFrame );
@ -160,7 +160,7 @@ COLOR4D PCB_LAYER_BOX_SELECTOR::getLayerColor( LAYER_NUM aLayer ) const
// Returns the name of the layer id
wxString PCB_LAYER_BOX_SELECTOR::getLayerName( LAYER_NUM aLayer ) const
wxString PCB_LAYER_BOX_SELECTOR::getLayerName( int aLayer ) const
{
BOARD* board = m_boardFrame->GetBoard();

View File

@ -70,13 +70,13 @@ public:
private:
// Returns a color index from the layer id
COLOR4D getLayerColor( LAYER_NUM aLayer ) const override;
COLOR4D getLayerColor( int aLayer ) const override;
// Returns true if the layer id is enabled (i.e. if it should be displayed)
bool isLayerEnabled( LAYER_NUM aLayer ) const override;
bool isLayerEnabled( int aLayer ) const override;
// Returns the name of the layer id
wxString getLayerName( LAYER_NUM aLayer ) const override;
wxString getLayerName( int aLayer ) const override;
LSET getEnabledLayers() const;

View File

@ -384,10 +384,8 @@ LSET PCB_VIA::GetLayerSet() const
wxASSERT( m_layer <= m_bottomLayer );
// PCB_LAYER_IDs are numbered from front to back, this is top to bottom.
for( LAYER_NUM id = m_layer; id <= m_bottomLayer; ++id )
{
for( int id = m_layer; id <= m_bottomLayer; ++id )
layermask.set( id );
}
return layermask;
}

View File

@ -43,7 +43,7 @@
#include <render_settings.h>
const wxString GetGerberProtelExtension( LAYER_NUM aLayer )
const wxString GetGerberProtelExtension( int aLayer )
{
if( IsCopperLayer( aLayer ) )
{
@ -84,7 +84,7 @@ const wxString GetGerberProtelExtension( LAYER_NUM aLayer )
}
const wxString GetGerberFileFunctionAttribute( const BOARD* aBoard, LAYER_NUM aLayer )
const wxString GetGerberFileFunctionAttribute( const BOARD* aBoard, int aLayer )
{
wxString attrib;
@ -206,7 +206,7 @@ const wxString GetGerberFileFunctionAttribute( const BOARD* aBoard, LAYER_NUM aL
}
static const wxString GetGerberFilePolarityAttribute( LAYER_NUM aLayer )
static const wxString GetGerberFilePolarityAttribute( int aLayer )
{
/* build the string %TF.FilePolarity,Positive*%
* or %TF.FilePolarity,Negative*%
@ -350,7 +350,7 @@ void AddGerberX2Header( PLOTTER* aPlotter, const BOARD* aBoard, bool aUseX1Compa
}
void AddGerberX2Attribute( PLOTTER* aPlotter, const BOARD* aBoard, LAYER_NUM aLayer,
void AddGerberX2Attribute( PLOTTER* aPlotter, const BOARD* aBoard, int aLayer,
bool aUseX1CompatibilityMode )
{
AddGerberX2Header( aPlotter, aBoard, aUseX1CompatibilityMode );

View File

@ -21,16 +21,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file pcbnew/pcbplot.h
* @brief Board plot function definition file.
*/
#ifndef PCBPLOT_H_
#define PCBPLOT_H_
#include <layer_ids.h>
#include <pad_shapes.h>
#include <pad_shapes.h> // for PAD_DRILL_SHAPE_T
#include <pcb_plot_params.h>
#include <settings/color_settings.h>
#include <settings/settings_manager.h>
@ -46,6 +40,7 @@ class PCB_TARGET;
class FP_TEXT;
class ZONE;
class BOARD;
class BOARD_ITEM;
class REPORTER;
class wxFileName;
@ -127,7 +122,7 @@ public:
* @param aLayer is the layer id.
* @return the layer color.
*/
COLOR4D getColor( LAYER_NUM aLayer ) const;
COLOR4D getColor( int aLayer ) const;
private:
/**
@ -136,19 +131,16 @@ private:
* It compensate and clamp the drill mark size depending on the current plot options.
*/
void plotOneDrillMark( PAD_DRILL_SHAPE_T aDrillShape, const wxPoint& aDrillPos,
const wxSize& aDrillSize, const wxSize& aPadSize,
double aOrientation, int aSmallDrill );
const wxSize& aDrillSize, const wxSize& aPadSize, double aOrientation,
int aSmallDrill );
PLOTTER* m_plotter;
BOARD* m_board;
LSET m_layerMask;
};
PLOTTER* StartPlotBoard( BOARD* aBoard,
const PCB_PLOT_PARAMS* aPlotOpts,
int aLayer,
const wxString& aFullFileName,
const wxString& aSheetDesc );
PLOTTER* StartPlotBoard( BOARD* aBoard, const PCB_PLOT_PARAMS* aPlotOpts, int aLayer,
const wxString& aFullFileName, const wxString& aSheetDesc );
/**
* Plot one copper or technical layer.
@ -174,16 +166,14 @@ void PlotOneBoardLayer( BOARD* aBoard, PLOTTER* aPlotter, PCB_LAYER_ID aLayer,
* @param aLayerMask is the mask to define the layers to plot.
* @param aPlotOpt is the plot options (files, sketch). Has meaning for some formats only.
*
* aPlotOpt has 3 important options to control this plot,
* which are set, depending on the layer type to plot
* SetEnablePlotVia( bool aEnable )
* aEnable = true to plot vias, false to skip vias (has meaning
* only for solder mask layers).
* SetSkipPlotNPTH_Pads( bool aSkip )
* aSkip = true to skip NPTH Pads, when the pad size and the pad hole
* have the same size. Used in GERBER format only.
* SetDrillMarksType( DrillMarksType aVal ) control the actual hole:
* no hole, small hole, actual hole
* aPlotOpt has 3 important options which are set depending on the layer type to plot:
* SetEnablePlotVia( bool aEnable )
* aEnable = true to plot vias, false to skip vias (has meaning only for solder mask layers)
* SetSkipPlotNPTH_Pads( bool aSkip )
* aSkip = true to skip NPTH Pads, when the pad size and the pad hole have the same size.
* Used in GERBER format only.
* SetDrillMarksType( DrillMarksType aVal )
* aVal = no hole, small hole, actual hole size
*/
void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
const PCB_PLOT_PARAMS& aPlotOpt );
@ -196,8 +186,8 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
* @param aLayerMask is the mask to define the layers to plot.
* @param aPlotOpt is the plot options. Has meaning for some formats only.
*/
void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter,
LSET aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt );
void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
const PCB_PLOT_PARAMS& aPlotOpt );
/**
* Complete a plot filename.
@ -211,16 +201,14 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter,
* @param aSuffix is the suffix to add to the base filename.
* @param aExtension is the file extension.
*/
void BuildPlotFileName( wxFileName* aFilename,
const wxString& aOutputDir,
const wxString& aSuffix,
void BuildPlotFileName( wxFileName* aFilename, const wxString& aOutputDir, const wxString& aSuffix,
const wxString& aExtension );
/**
* @return the appropriate Gerber file extension for \a aLayer
*/
const wxString GetGerberProtelExtension( LAYER_NUM aLayer );
const wxString GetGerberProtelExtension( int aLayer );
/**
* Return the "file function" attribute for \a aLayer, as defined in the
@ -232,7 +220,7 @@ const wxString GetGerberProtelExtension( LAYER_NUM aLayer );
* @param aLayer is the layer number to create the attribute for.
* @return The attribute, as a text string
*/
const wxString GetGerberFileFunctionAttribute( const BOARD* aBoard, LAYER_NUM aLayer );
const wxString GetGerberFileFunctionAttribute( const BOARD* aBoard, int aLayer );
/**
* Calculate some X2 attributes as defined in the Gerber file format specification J4
@ -269,7 +257,7 @@ void AddGerberX2Header( PLOTTER* aPlotter, const BOARD* aBoard,
* compatibility (X2 attributes added as structured comments, starting by "G04 #@! "
* followed by the X2 attribute.
*/
void AddGerberX2Attribute( PLOTTER* aPlotter, const BOARD* aBoard,
LAYER_NUM aLayer, bool aUseX1CompatibilityMode );
void AddGerberX2Attribute( PLOTTER* aPlotter, const BOARD* aBoard, int aLayer,
bool aUseX1CompatibilityMode );
#endif // PCBPLOT_H_

View File

@ -65,7 +65,7 @@
#include <wx/gdicmn.h>
COLOR4D BRDITEMS_PLOTTER::getColor( LAYER_NUM aLayer ) const
COLOR4D BRDITEMS_PLOTTER::getColor( int aLayer ) const
{
COLOR4D color = ColorSettings()->GetColor( aLayer );
@ -293,7 +293,7 @@ void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, const COLOR4D& aColor, OUTLINE_
void BRDITEMS_PLOTTER::PlotFootprintTextItems( const FOOTPRINT* aFootprint )
{
const FP_TEXT* textItem = &aFootprint->Reference();
LAYER_NUM textLayer = textItem->GetLayer();
int textLayer = textItem->GetLayer();
// Reference and value are specific items, not in graphic items list
if( GetPlotReference() && m_layerMask[textLayer]

View File

@ -57,8 +57,8 @@ public:
*/
PCB_PLOT_PARAMS& GetPlotOptions() { return m_plotOptions; }
void SetLayer( LAYER_NUM aLayer ) { m_plotLayer = aLayer; }
LAYER_NUM GetLayer() { return m_plotLayer; }
void SetLayer( int aLayer ) { m_plotLayer = aLayer; }
int GetLayer() { return m_plotLayer; }
/**
@ -108,21 +108,15 @@ public:
bool GetColorMode();
private:
/// the layer to plot
LAYER_NUM m_plotLayer;
/// Option bank
int m_plotLayer;
PCB_PLOT_PARAMS m_plotOptions;
/// This is the plotter object; it starts NULL and become instantiated
/// when a plotfile is requested
PLOTTER* m_plotter;
/// This is the plotter object; it starts NULL and become instantiated when a plotfile is
// requested
PLOTTER* m_plotter;
/// The board we're plotting
BOARD* m_board;
/// The current plot filename, set by OpenPlotfile
wxFileName m_plotFile;
BOARD* m_board;
wxFileName m_plotFile;
};
#endif

View File

@ -179,7 +179,7 @@ static wxString interpret_text( const wxString& aText )
}
static void setKeepoutSettingsToZone( ZONE* aZone, LAYER_NUM aLayer )
static void setKeepoutSettingsToZone( ZONE* aZone, int aLayer )
{
if( aLayer == EAGLE_LAYER::TRESTRICT || aLayer == EAGLE_LAYER::BRESTRICT )
{

View File

@ -76,7 +76,7 @@ void PCB_PARSER::init()
// Add untranslated default (i.e. English) layernames.
// Some may be overridden later if parsing a board rather than a footprint.
// The English name will survive if parsing only a footprint.
for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
for( int layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
{
std::string untranslated = TO_UTF8( wxString( LSET::Name( PCB_LAYER_ID( layer ) ) ) );
@ -1269,7 +1269,7 @@ void PCB_PARSER::parseLayer( LAYER* aLayer )
Expecting( T_LEFT );
// this layer_num is not used, we DO depend on LAYER_T however.
LAYER_NUM layer_num = parseInt( "layer index" );
int layer_num = parseInt( "layer index" );
NeedSYMBOLorNUMBER();
name = CurText();

View File

@ -1369,7 +1369,7 @@ void PCB_PLUGIN::formatLayers( LSET aLayerMask, int aNestLevel ) const
// output any individual layers not handled in wildcard combos above
wxString layerName;
for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
for( int layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
{
if( aLayerMask[layer] )
{

View File

@ -294,13 +294,13 @@ inline int layerMaskCountSet( LEG_MASK aMask )
// return true if aLegacyLayerNum is a valid copper layer legacy id, therefore
// top, bottom or inner activated layer
inline bool is_leg_copperlayer_valid( int aCu_Count, LAYER_NUM aLegacyLayerNum )
inline bool is_leg_copperlayer_valid( int aCu_Count, int aLegacyLayerNum )
{
return ( aLegacyLayerNum == LAYER_N_FRONT ) || ( aLegacyLayerNum < aCu_Count );
return aLegacyLayerNum == LAYER_N_FRONT || aLegacyLayerNum < aCu_Count;
}
PCB_LAYER_ID LEGACY_PLUGIN::leg_layer2new( int cu_count, LAYER_NUM aLayerNum )
PCB_LAYER_ID LEGACY_PLUGIN::leg_layer2new( int cu_count, int aLayerNum )
{
int newid;
unsigned old = aLayerNum;
@ -390,15 +390,6 @@ static inline int intParse( const char* next, const char** out = nullptr )
}
/**
* Like #intParse but returns a LAYER_NUM.
*/
static inline LAYER_NUM layerParse( const char* next, const char** out = nullptr )
{
return intParse( next, out );
}
/**
* Parse an ASCII hex integer string with possible leading whitespace into
* a long integer and updates the pointer at \a out if it is not nullptr, just
@ -884,7 +875,7 @@ void LEGACY_PLUGIN::loadSETUP()
{
// eg: "Layer[n] <a_Layer_name_with_no_spaces> <LAYER_T>"
LAYER_NUM layer_num = layerParse( line + SZ( "Layer[" ), &data );
int layer_num = intParse( line + SZ( "Layer[" ), &data );
PCB_LAYER_ID layer_id = leg_layer2new( m_cu_count, layer_num );
data = strtok_r( (char*) data+1, delims, &saveptr ); // +1 for ']'
@ -1186,7 +1177,7 @@ void LEGACY_PLUGIN::loadFOOTPRINT( FOOTPRINT* aFootprint )
BIU pos_x = biuParse( line + SZ( "Po" ), &data );
BIU pos_y = biuParse( data, &data );
int orient = intParse( data, &data );
LAYER_NUM layer_num = layerParse( data, &data );
int layer_num = intParse( data, &data );
PCB_LAYER_ID layer_id = leg_layer2new( m_cu_count, layer_num );
long edittime = hexParse( data, &data );
char* uuid = strtok_r( (char*) data, delims, (char**) &data );
@ -1575,8 +1566,8 @@ void LEGACY_PLUGIN::loadFP_SHAPE( FOOTPRINT* aFootprint )
const char* data;
// common to all cases, and we have to check their values uniformly at end
BIU width = 1;
LAYER_NUM layer = FIRST_NON_COPPER_LAYER;
BIU width = 1;
int layer = FIRST_NON_COPPER_LAYER;
switch( shape )
{
@ -1589,7 +1580,7 @@ void LEGACY_PLUGIN::loadFP_SHAPE( FOOTPRINT* aFootprint )
double angle = degParse( data, &data );
width = biuParse( data, &data );
layer = layerParse( data );
layer = intParse( data );
dwg->SetCenter0( wxPoint( center0_x, center0_y ) );
dwg->SetStart0( wxPoint( start0_x, start0_y ) );
@ -1607,7 +1598,7 @@ void LEGACY_PLUGIN::loadFP_SHAPE( FOOTPRINT* aFootprint )
BIU end0_y = biuParse( data, &data );
width = biuParse( data, &data );
layer = layerParse( data );
layer = intParse( data );
dwg->SetStart0( wxPoint( start0_x, start0_y ) );
dwg->SetEnd0( wxPoint( end0_x, end0_y ) );
@ -1624,7 +1615,7 @@ void LEGACY_PLUGIN::loadFP_SHAPE( FOOTPRINT* aFootprint )
int ptCount = intParse( data, &data );
width = biuParse( data, &data );
layer = layerParse( data );
layer = intParse( data );
dwg->SetStart0( wxPoint( start0_x, start0_y ) );
dwg->SetEnd0( wxPoint( end0_x, end0_y ) );
@ -1722,7 +1713,7 @@ void LEGACY_PLUGIN::loadMODULE_TEXT( FP_TEXT* aText )
char* hide = strtok_r( nullptr, delims, (char**) &data );
char* tmp = strtok_r( nullptr, delims, (char**) &data );
LAYER_NUM layer_num = tmp ? layerParse( tmp ) : SILKSCREEN_N_FRONT;
int layer_num = tmp ? intParse( tmp ) : SILKSCREEN_N_FRONT;
char* italic = strtok_r( nullptr, delims, (char**) &data );
@ -1863,8 +1854,8 @@ void LEGACY_PLUGIN::loadPCB_LINE()
switch( i )
{
case 0:
LAYER_NUM layer;
layer = layerParse( data );
int layer;
layer = intParse( data );
if( layer < FIRST_NON_COPPER_LAYER )
layer = FIRST_NON_COPPER_LAYER;
@ -2057,12 +2048,12 @@ void LEGACY_PLUGIN::loadPCB_TEXT()
else if( TESTLINE( "De" ) )
{
// e.g. "De 21 1 68183921-93a5-49ac-91b0-49d05a0e1647 Normal C\r\n"
LAYER_NUM layer_num = layerParse( line + SZ( "De" ), &data );
int notMirrored = intParse( data, &data );
char* uuid = strtok_r( (char*) data, delims, (char**) &data );
char* style = strtok_r( nullptr, delims, (char**) &data );
char* hJustify = strtok_r( nullptr, delims, (char**) &data );
char* vJustify = strtok_r( nullptr, delims, (char**) &data );
int layer_num = intParse( line + SZ( "De" ), &data );
int notMirrored = intParse( data, &data );
char* uuid = strtok_r( (char*) data, delims, (char**) &data );
char* style = strtok_r( nullptr, delims, (char**) &data );
char* hJustify = strtok_r( nullptr, delims, (char**) &data );
char* vJustify = strtok_r( nullptr, delims, (char**) &data );
pcbtxt->SetMirrored( !notMirrored );
const_cast<KIID&>( pcbtxt->m_Uuid ) = KIID( uuid );
@ -2159,11 +2150,11 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType )
// parse the 2nd line to determine the type of object
// e.g. "De 15 1 7 68183921-93a5-49ac-91b0-49d05a0e1647 0" for a via
LAYER_NUM layer_num = layerParse( line + SZ( "De" ), &data );
int type = intParse( data, &data );
int net_code = intParse( data, &data );
char* uuid = strtok_r( (char*) data, delims, (char**) &data );
int flags_int = intParse( data, (const char**) &data );
int layer_num = intParse( line + SZ( "De" ), &data );
int type = intParse( data, &data );
int net_code = intParse( data, &data );
char* uuid = strtok_r( (char*) data, delims, (char**) &data );
int flags_int = intParse( data, (const char**) &data );
EDA_ITEM_FLAGS flags = static_cast<EDA_ITEM_FLAGS>( flags_int );
@ -2392,7 +2383,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
}
else if( TESTLINE( "ZLayer" ) ) // layer found
{
LAYER_NUM layer_num = layerParse( line + SZ( "ZLayer" ) );
int layer_num = intParse( line + SZ( "ZLayer" ) );
zc->SetLayer( leg_layer2new( m_cu_count, layer_num ) );
}
else if( TESTLINE( "ZAux" ) ) // aux info found
@ -2651,11 +2642,11 @@ void LEGACY_PLUGIN::loadDIMENSION()
else if( TESTLINE( "Ge" ) )
{
// e.g. "Ge 1 21 68183921-93a5-49ac-91b0-49d05a0e1647\r\n"
int shape = intParse( line + SZ( "De" ), (const char**) &data );
LAYER_NUM layer_num = layerParse( data, &data );
char* uuid = strtok_r( (char*) data, delims, (char**) &data );
int shape = intParse( line + SZ( "De" ), (const char**) &data );
int layer_num = intParse( data, &data );
char* uuid = strtok_r( (char*) data, delims, (char**) &data );
dim->SetLayer( leg_layer2new( m_cu_count, layer_num ) );
dim->SetLayer( leg_layer2new( m_cu_count, layer_num ) );
const_cast<KIID&>( dim->m_Uuid ) = KIID( uuid );
// not used
@ -2774,13 +2765,13 @@ void LEGACY_PLUGIN::loadPCB_TARGET()
}
else if( TESTLINE( "Po" ) )
{
int shape = intParse( line + SZ( "Po" ), &data );
LAYER_NUM layer_num = layerParse( data, &data );
BIU pos_x = biuParse( data, &data );
BIU pos_y = biuParse( data, &data );
BIU size = biuParse( data, &data );
BIU width = biuParse( data, &data );
char* uuid = strtok_r( (char*) data, delims, (char**) &data );
int shape = intParse( line + SZ( "Po" ), &data );
int layer_num = intParse( data, &data );
BIU pos_x = biuParse( data, &data );
BIU pos_y = biuParse( data, &data );
BIU size = biuParse( data, &data );
BIU width = biuParse( data, &data );
char* uuid = strtok_r( (char*) data, delims, (char**) &data );
if( layer_num < FIRST_NON_COPPER_LAYER )
layer_num = FIRST_NON_COPPER_LAYER;

View File

@ -97,7 +97,7 @@ public:
void SetReader( LINE_READER* aReader ) { m_reader = aReader; }
// return the new .kicad_pcb layer id from the old (legacy) layer id
static PCB_LAYER_ID leg_layer2new( int cu_count, LAYER_NUM aLayerNum );
static PCB_LAYER_ID leg_layer2new( int cu_count, int aLayerNum );
static LSET leg_mask2new( int cu_count, unsigned aMask );

View File

@ -455,7 +455,7 @@ void PCB::ConnectPinToNet( const wxString& aCompRef, const wxString& aPinRef,
int PCB::FindLayer( const wxString& aLayerName ) const
{
for( LAYER_NUM i = 0; i < (int)m_layersStackup.GetCount(); ++i )
for( int i = 0; i < (int) m_layersStackup.GetCount(); ++i )
{
if( m_layersStackup[i] == aLayerName )
return i;

View File

@ -54,19 +54,19 @@ protected:
PCB_BASE_FRAME* m_frame;
///< @return true if the layer id is enabled (i.e. is it should be displayed).
bool isLayerEnabled( LAYER_NUM aLayer ) const override
bool isLayerEnabled( int aLayer ) const override
{
return m_frame->GetBoard()->IsLayerEnabled( PCB_LAYER_ID( aLayer ) );
}
// Return the color index from the layer ID.
COLOR4D getLayerColor( LAYER_NUM aLayer ) const override
COLOR4D getLayerColor( int aLayer ) const override
{
return m_frame->GetColorSettings()->GetColor( aLayer );
}
// Return the name of the layer ID.
wxString getLayerName( LAYER_NUM aLayer ) const override
wxString getLayerName( int aLayer ) const override
{
return m_frame->GetBoard()->GetLayerName( ToLAYER_ID( aLayer ) );
}
@ -83,7 +83,7 @@ public:
LSET aNotAllowedLayersMask, bool aHideCheckBoxes = false );
~PCB_ONE_LAYER_SELECTOR();
LAYER_NUM GetLayerSelection() { return m_layerSelected; }
int GetLayerSelection() { return m_layerSelected; }
private:
// Event handlers

View File

@ -85,9 +85,9 @@ void SPECCTRA_DB::buildLayerMaps( BOARD* aBoard )
m_kicadLayer2pcb.resize( B_Cu + 1 );
#if 0 // was:
for( LAYER_NUM kiNdx = layerCount - 1, pcbNdx=FIRST_LAYER; kiNdx >= 0; --kiNdx, ++pcbNdx )
for( int kiNdx = layerCount - 1, pcbNdx=FIRST_LAYER; kiNdx >= 0; --kiNdx, ++pcbNdx )
{
LAYER_NUM kilayer = (kiNdx>0 && kiNdx==layerCount-1) ? F_Cu : kiNdx;
int kilayer = (kiNdx>0 && kiNdx==layerCount-1) ? F_Cu : kiNdx;
// establish bi-directional mapping between KiCad's BOARD layer and PCB layer
pcbLayer2kicad[pcbNdx] = kilayer;

View File

@ -1664,7 +1664,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard )
int old_netcode = -1;
int old_width = -1;
LAYER_NUM old_layer = UNDEFINED_LAYER;
int old_layer = UNDEFINED_LAYER;
for( int i = 0; i < items.GetCount(); ++i )
{
@ -1696,7 +1696,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard )
wire->wire_type = T_protect; // @todo, this should be configurable
LAYER_NUM kiLayer = track->GetLayer();
int kiLayer = track->GetLayer();
int pcbLayer = m_kicadLayer2pcb[kiLayer];
path = new PATH( wire );

View File

@ -98,7 +98,7 @@ int BOARD::GetCopperLayerCount() const
}
// a dummy to satisfy link of specctra_test without pulling in BOARD stuff.
wxString BOARD::GetLayerName( LAYER_NUM aLayer ) const
wxString BOARD::GetLayerName( int aLayer ) const
{
return wxEmptyString;
}

View File

@ -364,8 +364,8 @@ int PCB_CONTROL::LayerNext( const TOOL_EVENT& aEvent )
{
PCB_BASE_FRAME* editFrame = m_frame;
BOARD* brd = board();
LAYER_NUM layer = editFrame->GetActiveLayer();
LAYER_NUM startLayer = layer;
int layer = editFrame->GetActiveLayer();
int startLayer = layer;
if( layer < F_Cu || layer > B_Cu )
return 0;
@ -390,8 +390,8 @@ int PCB_CONTROL::LayerPrev( const TOOL_EVENT& aEvent )
{
PCB_BASE_FRAME* editFrame = m_frame;
BOARD* brd = board();
LAYER_NUM layer = editFrame->GetActiveLayer();
LAYER_NUM startLayer = layer;
int layer = editFrame->GetActiveLayer();
int startLayer = layer;
if( layer < F_Cu || layer > B_Cu )
return 0;
@ -418,7 +418,7 @@ int PCB_CONTROL::LayerPrev( const TOOL_EVENT& aEvent )
int PCB_CONTROL::LayerToggle( const TOOL_EVENT& aEvent )
{
LAYER_NUM currentLayer = m_frame->GetActiveLayer();
int currentLayer = m_frame->GetActiveLayer();
PCB_SCREEN* screen = m_frame->GetScreen();
if( currentLayer == screen->m_Route_Layer_TOP )
@ -440,7 +440,7 @@ int PCB_CONTROL::LayerToggle( const TOOL_EVENT& aEvent )
int PCB_CONTROL::LayerAlphaInc( const TOOL_EVENT& aEvent )
{
COLOR_SETTINGS* settings = m_frame->GetColorSettings();
LAYER_NUM currentLayer = m_frame->GetActiveLayer();
int currentLayer = m_frame->GetActiveLayer();
KIGFX::COLOR4D currentColor = settings->GetColor( currentLayer );
if( currentColor.a <= ALPHA_MAX - ALPHA_STEP )
@ -470,7 +470,7 @@ int PCB_CONTROL::LayerAlphaInc( const TOOL_EVENT& aEvent )
int PCB_CONTROL::LayerAlphaDec( const TOOL_EVENT& aEvent )
{
COLOR_SETTINGS* settings = m_frame->GetColorSettings();
LAYER_NUM currentLayer = m_frame->GetActiveLayer();
int currentLayer = m_frame->GetActiveLayer();
KIGFX::COLOR4D currentColor = settings->GetColor( currentLayer );
if( currentColor.a >= ALPHA_MIN + ALPHA_STEP )

View File

@ -1133,7 +1133,7 @@ void APPEARANCE_CONTROLS::OnLayerChanged()
}
void APPEARANCE_CONTROLS::SetLayerVisible( LAYER_NUM aLayer, bool isVisible )
void APPEARANCE_CONTROLS::SetLayerVisible( int aLayer, bool isVisible )
{
LSET visible = getVisibleLayers();
PCB_LAYER_ID layer = ToLAYER_ID( aLayer );
@ -1828,7 +1828,7 @@ void APPEARANCE_CONTROLS::syncColorsAndVisibility()
for( std::unique_ptr<APPEARANCE_SETTING>& setting : m_layerSettings )
{
LAYER_NUM layer = setting->id;
int layer = setting->id;
if( setting->ctl_visibility )
setting->ctl_visibility->SetValue( visible[layer] );
@ -2545,7 +2545,7 @@ void APPEARANCE_CONTROLS::OnColorSwatchChanged( wxCommandEvent& aEvent )
{
COLOR_SWATCH* swatch = static_cast<COLOR_SWATCH*>( aEvent.GetEventObject() );
COLOR4D newColor = swatch->GetSwatchColor();
LAYER_NUM layer = swatch->GetId();
int layer = swatch->GetId();
COLOR_SETTINGS* cs = m_frame->GetColorSettings();
cs->SetColor( layer, newColor );

View File

@ -228,7 +228,7 @@ public:
void OnNetVisibilityChanged( int aNetCode, bool aVisibility );
///< Manually update visibility for a given layer
void SetLayerVisible( LAYER_NUM aLayer, bool isVisible );
void SetLayerVisible( int aLayer, bool isVisible );
void SetObjectVisible( GAL_LAYER_ID aLayer, bool isVisible = true );

View File

@ -82,8 +82,8 @@ ZONE::ZONE( BOARD_ITEM_CONTAINER* aParent, bool aInFP ) :
}
ZONE::ZONE( const ZONE& aZone )
: BOARD_CONNECTED_ITEM( aZone ),
ZONE::ZONE( const ZONE& aZone ) :
BOARD_CONNECTED_ITEM( aZone ),
m_Poly( nullptr ),
m_CornerSelection( nullptr )
{
@ -344,7 +344,6 @@ int ZONE::GetThermalReliefGap( PAD* aPad, wxString* aSource ) const
}
return aPad->GetEffectiveThermalGap( aSource );
}
@ -982,7 +981,7 @@ void ZONE::HatchBorder()
int hatch_line_len = m_borderHatchPitch;
// To have a better look, give a slope depending on the layer
LAYER_NUM layer = GetLayer();
int layer = GetLayer();
int slope_flag = (layer & 1) ? 1 : -1; // 1 or -1
double slope = 0.707106 * slope_flag; // 45 degrees slope
int max_a, min_a;

View File

@ -142,7 +142,7 @@ bool ZONE::IsSame( const ZONE& aZoneToCompare )
* @param aLayer = the layer of zones. if aLayer < 0, all layers are used
* @return the count of saved copies
*/
int SaveCopyOfZones( PICKED_ITEMS_LIST& aPickList, BOARD* aPcb, int aNetCode, LAYER_NUM aLayer )
int SaveCopyOfZones( PICKED_ITEMS_LIST& aPickList, BOARD* aPcb, int aNetCode, int aLayer )
{
int copyCount = 0;

View File

@ -55,7 +55,7 @@
* @param aLayer = the layer of zones. if aLayer < 0, all layers are used
* @return the count of saved copies
*/
int SaveCopyOfZones(PICKED_ITEMS_LIST & aPickList, BOARD* aPcb, int aNetCode, LAYER_NUM aLayer );
int SaveCopyOfZones(PICKED_ITEMS_LIST & aPickList, BOARD* aPcb, int aNetCode, int aLayer );
/**
@ -66,6 +66,7 @@ int SaveCopyOfZones(PICKED_ITEMS_LIST & aPickList, BOARD* aPcb, int aNetCode, LA
* @param aAuxiliaryList = the list of deleted or added (new created) items after calculations
* @param aPcb = the Board
*/
void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList, PICKED_ITEMS_LIST& aAuxiliaryList, BOARD* aPcb );
void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList, PICKED_ITEMS_LIST& aAuxiliaryList,
BOARD* aPcb );
#endif // ZONES_FUNCTIONS_TO_UNDO_REDO_H