Commit 9fd79dfa authored by Lorenzo Marcantonio's avatar Lorenzo Marcantonio

Implemented the LAYER_NUM typedef (LAYER was already taken as a class name...)...

Implemented the LAYER_NUM typedef (LAYER was already taken as a class name...) to represent a layer number.
parent 8e096794
......@@ -56,14 +56,14 @@ extern void CheckGLError();
/* returns true if aLayer should be displayed, false otherwise
*/
static bool Is3DLayerEnabled( int aLayer );
static bool Is3DLayerEnabled( LAYER_NUM aLayer );
/* returns the Z orientation parameter 1.0 or -1.0 for aLayer
* Z orientation is 1.0 for all layers but "back" layers:
* LAYER_N_BACK , ADHESIVE_N_BACK, SOLDERPASTE_N_BACK ), SILKSCREEN_N_BACK
* used to calculate the Z orientation parameter for glNormal3f
*/
static GLfloat Get3DLayer_Z_Orientation( int aLayer );
static GLfloat Get3DLayer_Z_Orientation( LAYER_NUM aLayer );
void EDA_3D_CANVAS::Redraw( bool finish )
{
......@@ -163,7 +163,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
Draw3D_Via( (SEGVIA*) track );
else
{
int layer = track->GetLayer();
LAYER_NUM layer = track->GetLayer();
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) )
Draw3D_Track( track );
......@@ -174,7 +174,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
{
for( int ii = 0; ii < pcb->GetAreaCount(); ii++ )
{
int layer = pcb->GetArea( ii )->GetLayer();
LAYER_NUM layer = pcb->GetArea( ii )->GetLayer();
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) )
Draw3D_Zone( pcb->GetArea( ii ) );
......@@ -236,8 +236,8 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
*/
void EDA_3D_CANVAS::Draw3D_Zone( ZONE_CONTAINER* aZone )
{
int layer = aZone->GetLayer();
int color = g_ColorsSettings.GetLayerColor( layer );
LAYER_NUM layer = aZone->GetLayer();
EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( layer );
int thickness = g_Parm_3D_Visu.GetLayerObjectThicknessBIU( layer );
if( layer == LAST_COPPER_LAYER )
......@@ -456,7 +456,7 @@ void EDA_3D_CANVAS::DrawGrid( double aGriSizeMM )
void EDA_3D_CANVAS::Draw3D_Track( TRACK* aTrack )
{
int layer = aTrack->GetLayer();
LAYER_NUM layer = aTrack->GetLayer();
int color = g_ColorsSettings.GetLayerColor( layer );
int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
......@@ -475,7 +475,7 @@ void EDA_3D_CANVAS::Draw3D_Track( TRACK* aTrack )
void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via )
{
int layer, top_layer, bottom_layer;
LAYER_NUM layer, top_layer, bottom_layer;
int color;
double biu_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits ;
......@@ -486,7 +486,7 @@ void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via )
via->ReturnLayerPair( &top_layer, &bottom_layer );
// Drawing horizontal thick rings:
for( layer = bottom_layer; layer < g_Parm_3D_Visu.m_CopperLayersCount; layer++ )
for( layer = bottom_layer; layer < g_Parm_3D_Visu.m_CopperLayersCount; ++layer )
{
int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( layer );
......@@ -530,7 +530,7 @@ void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via )
void EDA_3D_CANVAS::Draw3D_DrawSegment( DRAWSEGMENT* segment )
{
int layer = segment->GetLayer();
LAYER_NUM layer = segment->GetLayer();
int color = g_ColorsSettings.GetLayerColor( layer );
int thickness = g_Parm_3D_Visu.GetLayerObjectThicknessBIU( layer );
......@@ -538,7 +538,7 @@ void EDA_3D_CANVAS::Draw3D_DrawSegment( DRAWSEGMENT* segment )
if( layer == EDGE_N )
{
for( layer = 0; layer < g_Parm_3D_Visu.m_CopperLayersCount; layer++ )
for( layer = FIRST_LAYER; layer < g_Parm_3D_Visu.m_CopperLayersCount; ++layer )
{
glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) );
int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU(layer);
......@@ -624,7 +624,7 @@ static void Draw3dTextSegm( int x0, int y0, int xf, int yf )
void EDA_3D_CANVAS::Draw3D_DrawText( TEXTE_PCB* text )
{
int layer = text->GetLayer();
LAYER_NUM layer = text->GetLayer();
int color = g_ColorsSettings.GetLayerColor( layer );
SetGLColor( color );
......@@ -754,7 +754,7 @@ void EDGE_MODULE::Draw3D( EDA_3D_CANVAS* glcanvas )
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( m_Layer ) == false )
return;
int color = g_ColorsSettings.GetLayerColor( m_Layer );
EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( m_Layer );
SetGLColor( color );
// for outline shape = S_POLYGON:
......@@ -790,7 +790,7 @@ void EDGE_MODULE::Draw3D( EDA_3D_CANVAS* glcanvas )
if( m_Layer == EDGE_N )
{
for( int layer = 0; layer < g_Parm_3D_Visu.m_CopperLayersCount; layer++ )
for( LAYER_NUM layer = FIRST_LAYER; layer < g_Parm_3D_Visu.m_CopperLayersCount; ++layer )
{
glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) );
int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( layer );
......@@ -948,7 +948,7 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
switch( GetShape() )
{
case PAD_CIRCLE:
for( int layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; layer++ )
for( LAYER_NUM layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; ++layer )
{
if( layer && (layer == nlmax) )
layer = LAYER_N_FRONT;
......@@ -1007,7 +1007,6 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
wxPoint coord[5];
BuildPadPolygon( coord, wxSize(0,0), m_Orient );
for( int ii = 0; ii < 4; ii ++ )
{
CPolyPt pt( coord[ii].x + shape_pos.x, coord[ii].y+ shape_pos.y );
polyPadShape.push_back( pt );
......@@ -1027,7 +1026,7 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
if( polyPadShape.size() )
{
for( int layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; layer++ )
for( LAYER_NUM layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; ++layer )
{
if( layer && (layer == nlmax) )
layer = LAYER_N_FRONT;
......@@ -1061,41 +1060,41 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
}
bool Is3DLayerEnabled( int aLayer )
bool Is3DLayerEnabled( LAYER_NUM aLayer )
{
int flg = -1;
int flg;
// see if layer needs to be shown
// check the flags
switch (aLayer)
{
case DRAW_N:
flg=g_Parm_3D_Visu.FL_DRAWINGS;
flg = g_Parm_3D_Visu.FL_DRAWINGS;
break;
case COMMENT_N:
flg=g_Parm_3D_Visu.FL_COMMENTS;
flg = g_Parm_3D_Visu.FL_COMMENTS;
break;
case ECO1_N:
flg=g_Parm_3D_Visu.FL_ECO1;
flg = g_Parm_3D_Visu.FL_ECO1;
break;
case ECO2_N:
flg=g_Parm_3D_Visu.FL_ECO2;
flg = g_Parm_3D_Visu.FL_ECO2;
break;
}
default:
// the layer was not a layer with a flag, so show it
if( flg < 0 )
return true;
}
// if the layer has a flag, return the flag
return g_Parm_3D_Visu.m_DrawFlags[flg];
}
GLfloat Get3DLayer_Z_Orientation( int aLayer )
GLfloat Get3DLayer_Z_Orientation( LAYER_NUM aLayer )
{
double nZ;
......
......@@ -135,7 +135,7 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
}
// calculate z position for each non copper layer
for( int layer_id = FIRST_NO_COPPER_LAYER; layer_id < NB_LAYERS; layer_id++ )
for( int layer_id = FIRST_NON_COPPER_LAYER; layer_id < NB_PCB_LAYERS; layer_id++ )
{
double zpos;
#define NonCopperLayerThicknessMargin 1.1
......@@ -184,7 +184,7 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
default:
zpos = zpos_copper_front +
(layer_id - FIRST_NO_COPPER_LAYER + 5) *
(layer_id - FIRST_NON_COPPER_LAYER + 5) *
m_NonCopperLayerThickness * NonCopperLayerThicknessMargin;
break;
}
......
......@@ -93,7 +93,7 @@ public:
double m_CurrentZpos; // temporary storage of current value of Z position,
// used in some calculation
private:
double m_LayerZcoord[LAYER_COUNT]; // Z position of each layer (normalized)
double m_LayerZcoord[NB_LAYERS]; // Z position of each layer (normalized)
double m_CopperThickness; // Copper thickness (normalized)
double m_EpoxyThickness; // Epoxy thickness (normalized)
double m_NonCopperLayerThickness; // Non copper layers thickness
......@@ -173,7 +173,7 @@ public: INFO3D_VISU();
*/
int GetLayerObjectThicknessBIU( int aLayerId) const
{
return aLayerId >= FIRST_NO_COPPER_LAYER ?
return aLayerId >= FIRST_NON_COPPER_LAYER ?
GetNonCopperLayerThicknessBIU() :
GetCopperThicknessBIU();
}
......
......@@ -32,7 +32,7 @@
#include <stdlib.h>
#include <cmath>
#include <vector>
#include <layers_id_colors_and_visibility.h>
#include <potracelib.h>
#include <auxiliary.h>
......@@ -310,8 +310,7 @@ void BITMAPCONV_INFO::OuputOnePolygon( KPolygon & aPolygon )
case PCBNEW_FMT:
{
#define SILKSCREEN_N_FRONT 21
int layer = SILKSCREEN_N_FRONT;
LAYER_NUM layer = SILKSCREEN_N_FRONT;
int width = 1;
fprintf( m_Outfile, "DP %d %d %d %d %d %d %d\n",
0, 0, 0, 0,
......
......@@ -78,7 +78,7 @@ COLORS_DESIGN_SETTINGS:: COLORS_DESIGN_SETTINGS()
* @return the color for aLayer which is one of the layer indices given
* in pcbstruct.h or in schematic
*/
EDA_COLOR_T COLORS_DESIGN_SETTINGS::GetLayerColor( int aLayer ) const
EDA_COLOR_T COLORS_DESIGN_SETTINGS::GetLayerColor( LAYER_NUM aLayer ) const
{
if( (unsigned) aLayer < DIM(m_LayersColors) )
{
......@@ -93,7 +93,7 @@ EDA_COLOR_T COLORS_DESIGN_SETTINGS::GetLayerColor( int aLayer ) const
* sets the color for aLayer which is one of the layer indices given
* in pcbstruct.h or in schematic
*/
void COLORS_DESIGN_SETTINGS::SetLayerColor( int aLayer, EDA_COLOR_T aColor )
void COLORS_DESIGN_SETTINGS::SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor )
{
if( (unsigned) aLayer < DIM(m_LayersColors) )
{
......
......@@ -65,14 +65,14 @@ int LAYER_BOX_SELECTOR::GetChoice()
// Get Current Layer
int LAYER_BOX_SELECTOR::GetLayerSelection()
LAYER_NUM LAYER_BOX_SELECTOR::GetLayerSelection() const
{
return (long) GetClientData( GetSelection() );
return (LAYER_NUM)((unsigned long) GetClientData( GetSelection() ) );
}
// Set Layer #
int LAYER_BOX_SELECTOR::SetLayerSelection( int layer )
int LAYER_BOX_SELECTOR::SetLayerSelection( LAYER_NUM layer )
{
int elements = GetCount();
......@@ -97,8 +97,8 @@ int LAYER_BOX_SELECTOR::SetLayerSelection( int layer )
void LAYER_BOX_SELECTOR::ResyncBitmapOnly()
{
int elements = GetCount();
for( int i = 0; i < elements; i++ )
LAYER_NUM elements = GetCount();
for( LAYER_NUM i = FIRST_LAYER; i < elements; ++i )
{
wxBitmap layerbmp( 14, 14 );
SetBitmapLayer( layerbmp, i );
......@@ -106,7 +106,7 @@ void LAYER_BOX_SELECTOR::ResyncBitmapOnly()
}
void LAYER_BOX_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, int aLayerIndex )
void LAYER_BOX_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayerIndex )
{
wxMemoryDC bmpDC;
wxBrush brush;
......
......@@ -11,6 +11,7 @@
#include <protos.h>
#include <dialog_color_config.h>
#include <layers_id_colors_and_visibility.h>
#define ID_COLOR_SETUP 1800
......@@ -290,7 +291,7 @@ bool DIALOG_COLOR_CONFIG::UpdateColorsSettings()
bool warning = false;
for( int ii = 0; ii < MAX_LAYERS; ii++ )
for( LAYER_NUM ii = FIRST_LAYER; ii < MAX_LAYERS; ++ii )
{
SetLayerColor( currentColors[ ii ], ii );
......
......@@ -76,7 +76,7 @@ private:
excellon_state m_State; // state of excellon file analysis
bool m_SlotOn; // true during an oval driil definition
public: EXCELLON_IMAGE( GERBVIEW_FRAME* aParent, int layer ) :
public: EXCELLON_IMAGE( GERBVIEW_FRAME* aParent, LAYER_NUM layer ) :
GERBER_IMAGE( aParent, layer )
{
m_State = READ_HEADER_STATE;
......
......@@ -46,7 +46,7 @@ void GBR_LAYER_BOX_SELECTOR::Resync()
{
Clear();
for( int layerid = 0; layerid < LAYER_COUNT; layerid++ )
for( LAYER_NUM layerid = FIRST_LAYER; layerid < NB_LAYERS; ++layerid )
{
wxBitmap layerbmp( 14, 14 );
wxString layername;
......@@ -65,7 +65,7 @@ void GBR_LAYER_BOX_SELECTOR::Resync()
// Returns a color index from the layer id
EDA_COLOR_T GBR_LAYER_BOX_SELECTOR::GetLayerColor( int aLayerIndex ) const
EDA_COLOR_T GBR_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayerIndex ) const
{
GERBVIEW_FRAME* frame = (GERBVIEW_FRAME*) GetParent()->GetParent();
......@@ -74,7 +74,7 @@ EDA_COLOR_T GBR_LAYER_BOX_SELECTOR::GetLayerColor( int aLayerIndex ) const
// Returns the name of the layer id
wxString GBR_LAYER_BOX_SELECTOR::GetLayerName( int aLayerIndex ) const
wxString GBR_LAYER_BOX_SELECTOR::GetLayerName( LAYER_NUM aLayerIndex ) const
{
wxString name;
name.Printf( _( "Layer %d" ), aLayerIndex + 1 );
......
......@@ -37,15 +37,15 @@ public:
// Returns a color index from the layer id
// Virtual function
EDA_COLOR_T GetLayerColor( int aLayerIndex ) const;
EDA_COLOR_T GetLayerColor( LAYER_NUM aLayerIndex ) const;
// Returns true if the layer id is enabled (i.e. is it should be displayed)
// Virtual function
bool IsLayerEnabled( int aLayerIndex ) const { return true; };
bool IsLayerEnabled( LAYER_NUM aLayerIndex ) const { return true; };
// Returns the name of the layer id
// Virtual function
wxString GetLayerName( int aLayerIndex ) const;
wxString GetLayerName( LAYER_NUM aLayerIndex ) const;
};
#endif //CLASS_GBR_LAYER_BOX_SELECTOR_H
......@@ -27,7 +27,7 @@ GBR_LAYOUT::~GBR_LAYOUT()
* param aLayerIndex = The index of the layer to be tested
* return bool - true if the layer is visible.
*/
bool GBR_LAYOUT::IsLayerVisible( int aLayerIndex ) const
bool GBR_LAYOUT::IsLayerVisible( LAYER_NUM aLayerIndex ) const
{
return m_printLayersMask & GetLayerMask( aLayerIndex );
}
......
......@@ -102,7 +102,7 @@ public:
* @param aLayerIndex = The index of the layer to be tested
* @return bool - true if the layer is visible.
*/
bool IsLayerVisible( int aLayerIndex ) const;
bool IsLayerVisible( LAYER_NUM aLayerIndex ) const;
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // overload
......
......@@ -17,7 +17,7 @@
class GBR_SCREEN : public BASE_SCREEN
{
public:
int m_Active_Layer;
LAYER_NUM m_Active_Layer;
/**
* Constructor
* @param aPageSizeIU is the size of the initial paper page in internal units.
......
......@@ -44,7 +44,7 @@ GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( GBR_LAYOUT* aParent, GERBER_IMAGE* aGerberpa
EDA_ITEM( (EDA_ITEM*)aParent, TYPE_GERBER_DRAW_ITEM )
{
m_imageParams = aGerberparams;
m_Layer = 0;
m_Layer = FIRST_LAYER;
m_Shape = GBR_SEGMENT;
m_Flashed = false;
m_DCode = 0;
......
......@@ -90,7 +90,7 @@ public:
* redundancy for these parameters
*/
private:
int m_Layer;
LAYER_NUM m_Layer;
// These values are used to draw this item, according to gerber layers parameters
// Because they can change inside a gerber image, they are stored here
......@@ -123,7 +123,7 @@ public:
* Function GetLayer
* returns the layer this item is on.
*/
int GetLayer() const { return m_Layer; }
LAYER_NUM GetLayer() const { return m_Layer; }
/**
* Function SetLayer
......@@ -132,7 +132,7 @@ public:
* is virtual because some items (in fact: class DIMENSION)
* have a slightly different initialization
*/
void SetLayer( int aLayer ) { m_Layer = aLayer; }
void SetLayer( LAYER_NUM aLayer ) { m_Layer = aLayer; }
LAYER_MSK GetLayerMask()
{
......
......@@ -196,10 +196,9 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
void GERBER_LAYER_WIDGET::ReFill()
{
int layer;
ClearLayerRows();
for( layer = 0; layer < GERBVIEW_LAYER_COUNT; layer++ )
for( LAYER_NUM layer = FIRST_LAYER; layer < NB_GERBER_LAYERS; ++layer )
{
wxString msg;
msg.Printf( _("Layer %d"), layer+1 );
......@@ -212,18 +211,18 @@ void GERBER_LAYER_WIDGET::ReFill()
//-----<LAYER_WIDGET callbacks>-------------------------------------------
void GERBER_LAYER_WIDGET::OnLayerColorChange( int aLayer, EDA_COLOR_T aColor )
void GERBER_LAYER_WIDGET::OnLayerColorChange( LAYER_NUM aLayer, EDA_COLOR_T aColor )
{
myframe->SetLayerColor( aLayer, aColor );
myframe->m_SelLayerBox->ResyncBitmapOnly();
myframe->GetCanvas()->Refresh();
}
bool GERBER_LAYER_WIDGET::OnLayerSelect( int aLayer )
bool GERBER_LAYER_WIDGET::OnLayerSelect( LAYER_NUM aLayer )
{
// the layer change from the GERBER_LAYER_WIDGET can be denied by returning
// false from this function.
int layer = myframe->getActiveLayer( );
LAYER_NUM layer = myframe->getActiveLayer( );
myframe->setActiveLayer( aLayer, false );
myframe->syncLayerBox();
......@@ -233,7 +232,7 @@ bool GERBER_LAYER_WIDGET::OnLayerSelect( int aLayer )
return true;
}
void GERBER_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal )
void GERBER_LAYER_WIDGET::OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal )
{
LAYER_MSK visibleLayers = myframe->GetVisibleLayers();
......
......@@ -88,9 +88,9 @@ public:
void ReFillRender();
//-----<implement LAYER_WIDGET abstract callback functions>-----------
void OnLayerColorChange( int aLayer, EDA_COLOR_T aColor );
bool OnLayerSelect( int aLayer );
void OnLayerVisible( int aLayer, bool isVisible, bool isFinal );
void OnLayerColorChange( LAYER_NUM aLayer, EDA_COLOR_T aColor );
bool OnLayerSelect( LAYER_NUM aLayer );
void OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal );
void OnRenderColorChange( int aId, EDA_COLOR_T aColor );
void OnRenderEnable( int aId, bool isEnabled );
/**
......
......@@ -165,7 +165,7 @@ int GERBVIEW_FRAME::ReadDCodeDefinitionFile( const wxString& D_Code_FullFileName
wxString msg;
D_CODE* dcode;
FILE* dest;
int layer = getActiveLayer();
LAYER_NUM layer = getActiveLayer();
int type_outil;
if( g_GERBER_List[layer] == NULL )
......
......@@ -123,7 +123,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
/************************************************************************/
{
SetFocus();
int layer_max = GERBVIEW_LAYER_COUNT;
LAYER_NUM layer_max = NB_GERBER_LAYERS;
wxString msg;
if( g_pageSetupData == NULL )
......@@ -137,11 +137,11 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
s_Parameters.m_PageSetupData = g_pageSetupData;
layer_max = 32;
layer_max = NB_LAYERS;
// Create layer list
int mask = 1, ii;
for( ii = 0; ii < layer_max; ii++, mask <<= 1 )
for(LAYER_NUM ii = FIRST_LAYER; ii < layer_max; ++ii )
{
LAYER_MSK mask = GetLayerMask( ii );
msg = _( "Layer" );
msg << wxT( " " ) << ii + 1;
m_BoxSelectLayer[ii] = new wxCheckBox( this, -1, msg );
......@@ -176,7 +176,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
s_Parameters.m_XScaleAdjust = s_Parameters.m_YScaleAdjust = 1.0;
s_SelectedLayers = 0;
for( int layer = 0; layer<layer_max; ++layer )
for( LAYER_NUM layer = FIRST_LAYER; layer<layer_max; ++layer )
{
wxString layerKey;
bool option;
......@@ -225,8 +225,7 @@ int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection()
{
int page_count = 0;
s_Parameters.m_PrintMaskLayer = NO_LAYERS;
int ii;
for( ii = 0, page_count = 0; ii < GERBVIEW_LAYER_COUNT; ii++ )
for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii )
{
if( m_BoxSelectLayer[ii]->IsChecked() )
{
......@@ -255,7 +254,7 @@ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
m_Config->Write( OPTKEY_PRINT_PAGE_FRAME, s_Parameters.m_Print_Sheet_Ref);
m_Config->Write( OPTKEY_PRINT_MONOCHROME_MODE, s_Parameters.m_Print_Black_and_White);
wxString layerKey;
for( int layer = 0; layer < GERBVIEW_LAYER_COUNT; ++layer )
for( LAYER_NUM layer = FIRST_LAYER; layer < NB_GERBER_LAYERS; ++layer )
{
layerKey.Printf( OPTKEY_LAYERBASE, layer );
m_Config->Write( layerKey, m_BoxSelectLayer[layer]->IsChecked() );
......
......@@ -8,7 +8,7 @@
#include <select_layers_to_pcb.h>
// Exported function
const wxString GetPCBDefaultLayerName( int aLayerNumber );
const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber );
enum layer_sel_id {
......@@ -23,11 +23,11 @@ class SELECT_LAYER_DIALOG : public wxDialog
private:
GERBVIEW_FRAME* m_Parent;
wxRadioBox* m_LayerList;
int m_LayerId[NB_LAYERS + 1]; // One extra element for "(Deselect)" radiobutton
LAYER_NUM m_LayerId[int(NB_LAYERS) + 1]; // One extra element for "(Deselect)" radiobutton
public:
// Constructor and destructor
SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent, int aDefaultLayer,
SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent, LAYER_NUM aDefaultLayer,
int aCopperLayerCount, bool aShowDeselectOption );
~SELECT_LAYER_DIALOG() { };
......@@ -61,9 +61,9 @@ END_EVENT_TABLE()
* different radiobutton is clicked on) prior to then clicking on the "Deselect"
* button provided within the "Layer selection:" dialog box).
*/
int GERBVIEW_FRAME::SelectPCBLayer( int aDefaultLayer, int aCopperLayerCount, bool aShowDeselectOption )
LAYER_NUM GERBVIEW_FRAME::SelectPCBLayer( LAYER_NUM aDefaultLayer, int aCopperLayerCount, bool aShowDeselectOption )
{
int layer;
LAYER_NUM layer;
SELECT_LAYER_DIALOG* frame = new SELECT_LAYER_DIALOG( this, aDefaultLayer,
aCopperLayerCount,
aShowDeselectOption );
......@@ -81,14 +81,14 @@ int GERBVIEW_FRAME::SelectPCBLayer( int aDefaultLayer, int aCopperLayerCount, bo
* to the right of that radiobox.
*/
SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent,
int aDefaultLayer, int aCopperLayerCount,
LAYER_NUM aDefaultLayer, int aCopperLayerCount,
bool aShowDeselectOption ) :
wxDialog( parent, -1, _( "Select Layer:" ), wxPoint( -1, -1 ),
wxSize( 470, 250 ),
DIALOG_STYLE )
{
wxButton* Button;
int ii;
LAYER_NUM ii;
wxString LayerList[NB_LAYERS + 1]; // One extra element for "(Deselect)"
// radiobutton
int LayerCount, LayerSelect = -1;
......@@ -97,11 +97,11 @@ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent,
// Build the layer list; first build copper layers list
LayerCount = 0;
for( ii = 0; ii < BOARD_COPPER_LAYERS_MAX_COUNT; ii++ )
for( ii = FIRST_COPPER_LAYER; ii < NB_COPPER_LAYERS; ++ii )
{
m_LayerId[ii] = 0;
m_LayerId[ii] = FIRST_LAYER;
if( ii == 0 || ii == BOARD_COPPER_LAYERS_MAX_COUNT-1 || ii < aCopperLayerCount-1 )
if( ii == FIRST_COPPER_LAYER || ii == LAST_COPPER_LAYER || ii < aCopperLayerCount-1 )
{
LayerList[LayerCount] = GetPCBDefaultLayerName( ii );
......@@ -113,9 +113,9 @@ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent,
}
}
// Build the layer list; build copper layers list
for( ; ii < NB_LAYERS; ii++ )
for( ; ii < NB_LAYERS; ++ii )
{
m_LayerId[ii] = 0;
m_LayerId[ii] = FIRST_LAYER;
LayerList[LayerCount] = GetPCBDefaultLayerName( ii );
......@@ -131,10 +131,10 @@ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent,
{
LayerList[LayerCount] = _( "(Deselect)" );
if( NB_LAYERS == aDefaultLayer )
if( NB_PCB_LAYERS == aDefaultLayer )
LayerSelect = LayerCount;
m_LayerId[LayerCount] = NB_LAYERS;
m_LayerId[LayerCount] = NB_PCB_LAYERS;
LayerCount++;
}
......@@ -181,7 +181,7 @@ void SELECT_LAYER_DIALOG::OnCancelClick( wxCommandEvent& event )
EndModal( -1 );
}
const wxString GetPCBDefaultLayerName( int aLayerNumber )
const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber )
{
const wxChar* txt;
......
......@@ -193,9 +193,9 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
bool end = false;
for( int layer = 0; !end; layer++ )
for( LAYER_NUM layer = FIRST_LAYER; !end; ++layer )
{
int active_layer = gerbFrame->getActiveLayer();
LAYER_NUM active_layer = gerbFrame->getActiveLayer();
if( layer == active_layer ) // active layer will be drawn after other layers
continue;
......
......@@ -235,7 +235,7 @@ void GERBVIEW_FRAME::OnSelectActiveDCode( wxCommandEvent& event )
*/
void GERBVIEW_FRAME::OnSelectActiveLayer( wxCommandEvent& event )
{
int layer = getActiveLayer();
LAYER_NUM layer = getActiveLayer();
setActiveLayer( event.GetSelection() );
......@@ -249,7 +249,7 @@ void GERBVIEW_FRAME::OnSelectActiveLayer( wxCommandEvent& event )
*/
void GERBVIEW_FRAME::OnShowGerberSourceFile( wxCommandEvent& event )
{
int layer = getActiveLayer();
LAYER_NUM layer = getActiveLayer();
GERBER_IMAGE* gerber_layer = g_GERBER_List[layer];
if( gerber_layer )
......
......@@ -78,13 +78,13 @@ extern double ReadDouble( char*& text, bool aSkipSeparator = true );
extern void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
APERTURE_T aAperture,
int Dcode_index,
int aLayer,
LAYER_NUM aLayer,
const wxPoint& aPos,
wxSize aSize,
bool aLayerNegative );
void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
int Dcode_index,
int aLayer,
LAYER_NUM aLayer,
const wxPoint& aStart,
const wxPoint& aEnd,
wxSize aPenSize,
......@@ -153,7 +153,7 @@ static EXCELLON_CMD excellon_G_CmdList[] =
bool GERBVIEW_FRAME::Read_EXCELLON_File( const wxString& aFullFileName )
{
wxString msg;
int layer = getActiveLayer(); // current layer used in GerbView
LAYER_NUM layer = getActiveLayer(); // current layer used in GerbView
if( g_GERBER_List[layer] == NULL )
{
......
......@@ -44,7 +44,7 @@ public:
* Function ExportPcb
* saves a board from a set of Gerber images.
*/
bool ExportPcb( int* LayerLookUpTable );
bool ExportPcb( LAYER_NUM* LayerLookUpTable );
private:
/**
......@@ -53,7 +53,7 @@ private:
* @param aGbrItem = the Gerber item (line, arc) to export
* @param aLayer = the technical layer to use
*/
void export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
void export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer );
/**
* Function export_copper_item
......@@ -61,7 +61,7 @@ private:
* @param aGbrItem = the Gerber item (line, arc, flashed) to export
* @param aLayer = the copper layer to use
*/
void export_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
void export_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer );
/**
* Function export_flashed_copper_item
......@@ -76,7 +76,7 @@ private:
* @param aGbrItem = the Gerber item (line only) to export
* @param aLayer = the copper layer to use
*/
void export_segline_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
void export_segline_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer );
/**
* Function export_segarc_copper_item
......@@ -85,7 +85,7 @@ private:
* @param aGbrItem = the Gerber item (arc only) to export
* @param aLayer = the copper layer to use
*/
void export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
void export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer );
/**
* function writePcbLineItem
......@@ -93,7 +93,7 @@ private:
* to the board file
*/
void writePcbLineItem( int aShape, int aType, wxPoint& aStart, wxPoint& aEnd,
int aWidth, int aLayer, int aDrill, int aAngle = 0 );
int aWidth, LAYER_NUM aLayer, int aDrill, int aAngle = 0 );
/**
* function writePcbHeader
......@@ -123,7 +123,7 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event )
int layercount = 0;
// Count the Gerber layers which are actually currently used
for( int ii = 0; ii < GERBVIEW_LAYER_COUNT; ii++ )
for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii )
{
if( g_GERBER_List[ii] != NULL )
layercount++;
......@@ -170,7 +170,7 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event )
}
bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable )
bool GBR_TO_PCB_EXPORTER::ExportPcb( LAYER_NUM* LayerLookUpTable )
{
m_fp = wxFopen( m_pcb_file_name, wxT( "wt" ) );
......@@ -182,7 +182,7 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable )
return false;
}
m_pcbCopperLayersCount = LayerLookUpTable[GERBVIEW_LAYER_COUNT];
m_pcbCopperLayersCount = LayerLookUpTable[NB_GERBER_LAYERS];
writePcbHeader();
......@@ -192,10 +192,10 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable )
for( ; gerb_item; gerb_item = gerb_item->Next() )
{
int layer = gerb_item->GetLayer();
int pcb_layer_number = LayerLookUpTable[layer];
LAYER_NUM layer = gerb_item->GetLayer();
LAYER_NUM pcb_layer_number = LayerLookUpTable[layer];
if( pcb_layer_number < 0 || pcb_layer_number > LAST_NO_COPPER_LAYER )
if( pcb_layer_number < FIRST_LAYER || pcb_layer_number > LAST_NON_COPPER_LAYER )
continue;
if( pcb_layer_number > LAST_COPPER_LAYER )
......@@ -208,8 +208,8 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable )
for( ; gerb_item; gerb_item = gerb_item->Next() )
{
int layer = gerb_item->GetLayer();
int pcb_layer_number = LayerLookUpTable[layer];
LAYER_NUM layer = gerb_item->GetLayer();
LAYER_NUM pcb_layer_number = LayerLookUpTable[layer];
if( pcb_layer_number < 0 || pcb_layer_number > LAST_COPPER_LAYER )
continue;
......@@ -227,7 +227,7 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable )
}
void GBR_TO_PCB_EXPORTER::export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer )
void GBR_TO_PCB_EXPORTER::export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer )
{
#define SEG_SHAPE 0
#define ARC_SHAPE 2
......@@ -263,7 +263,7 @@ void GBR_TO_PCB_EXPORTER::export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, in
}
void GBR_TO_PCB_EXPORTER::export_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer )
void GBR_TO_PCB_EXPORTER::export_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer )
{
switch( aGbrItem->m_Shape )
{
......@@ -285,7 +285,7 @@ void GBR_TO_PCB_EXPORTER::export_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aL
}
void GBR_TO_PCB_EXPORTER::export_segline_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer )
void GBR_TO_PCB_EXPORTER::export_segline_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer )
{
wxPoint seg_start, seg_end;
......@@ -300,7 +300,7 @@ void GBR_TO_PCB_EXPORTER::export_segline_copper_item( GERBER_DRAW_ITEM* aGbrItem
}
void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer )
void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer )
{
double a = atan2( (double) ( aGbrItem->m_Start.y - aGbrItem->m_ArcCentre.y ),
(double) ( aGbrItem->m_Start.x - aGbrItem->m_ArcCentre.x ) );
......@@ -378,7 +378,9 @@ void GBR_TO_PCB_EXPORTER::export_flashed_copper_item( GERBER_DRAW_ITEM* aGbrItem
// Layers are 0 to 15 (Cu/Cmp) = 0x0F
#define IS_VIA 1
#define SHAPE_VIA_THROUGH 3
writePcbLineItem( SHAPE_VIA_THROUGH, IS_VIA, via_pos, via_pos, width, 0x0F, -1 );
// XXX EVIL usage of LAYER
writePcbLineItem( SHAPE_VIA_THROUGH, IS_VIA, via_pos, via_pos, width,
0x0F, -1 );
}
......@@ -408,7 +410,7 @@ void GBR_TO_PCB_EXPORTER::writePcbHeader()
void GBR_TO_PCB_EXPORTER::writePcbLineItem( int aShape, int aType, wxPoint& aStart, wxPoint& aEnd,
int aWidth, int aLayer, int aDrill, int aAngle )
int aWidth, LAYER_NUM aLayer, int aDrill, int aAngle )
{
if( aDrill <= -2 )
fprintf( m_fp, "$DRAWSEGMENT\n" );
......
......@@ -168,7 +168,7 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName )
}
// Read gerber files: each file is loaded on a new GerbView layer
int layer = getActiveLayer();
LAYER_NUM layer = getActiveLayer();
for( unsigned ii = 0; ii < filenamesList.GetCount(); ii++ )
{
......@@ -249,7 +249,7 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName )
}
// Read gerber files: each file is loaded on a new GerbView layer
int layer = getActiveLayer();
LAYER_NUM layer = getActiveLayer();
for( unsigned ii = 0; ii < filenamesList.GetCount(); ii++ )
{
......
......@@ -126,15 +126,16 @@ bool EDA_APP::OnInit()
wxSetWorkingDirectory( fn.GetPath() );
// Load all files specified on the command line.
int jj = 0;
LAYER_NUM jj = FIRST_LAYER;
for( int ii = 1; ii < argc && ii <= GERBVIEW_LAYER_COUNT; ++ii )
for( LAYER_NUM ii = LAYER_N_2; ii < argc && ii <= NB_GERBER_LAYERS; ++ii )
{
fn = wxFileName( argv[ii] );
if( fn.FileExists() )
{
frame->setActiveLayer( jj++ );
frame->setActiveLayer( jj );
++jj;
frame->LoadGerberFiles( fn.GetFullPath() );
}
}
......
......@@ -24,8 +24,6 @@ class PAGE_INFO;
*/
#define GERBER_BUFZ 4000
#define GERBVIEW_LAYER_COUNT 32 // Number of different layers shown by GerbView
/// List of page sizes
extern const wxChar* g_GerberPageSizeList[8];
......
......@@ -92,7 +92,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* aParent, const wxString& aTitle,
SetLayout( new GBR_LAYOUT() );
SetVisibleLayers( -1 ); // All 32 layers visible.
SetVisibleLayers( FULL_LAYERS ); // All 32 layers visible.
SetScreen( new GBR_SCREEN( GetLayout()->GetPageSettings().GetSizeIU() ) );
......@@ -325,21 +325,21 @@ void GERBVIEW_FRAME::SetElementVisibility( GERBER_VISIBLE_ID aItemIdVisible,
}
int GERBVIEW_FRAME::getNextAvailableLayer( int aLayer ) const
LAYER_NUM GERBVIEW_FRAME::getNextAvailableLayer( LAYER_NUM aLayer ) const
{
int layer = aLayer;
LAYER_NUM layer = aLayer;
for( int i = 0; i < GERBVIEW_LAYER_COUNT; i++ )
for( LAYER_NUM i = FIRST_LAYER; i < NB_GERBER_LAYERS; ++i )
{
GERBER_IMAGE* gerber = g_GERBER_List[ layer ];
if( gerber == NULL || gerber->m_FileName.IsEmpty() )
return layer;
layer++;
++layer;
if( layer >= GERBVIEW_LAYER_COUNT )
layer = 0;
if( layer >= NB_GERBER_LAYERS )
layer = FIRST_LAYER;
}
return NO_AVAILABLE_LAYERS;
......@@ -385,9 +385,9 @@ void GERBVIEW_FRAME::Liste_D_Codes()
wxString Line;
wxArrayString list;
double scale = IU_PER_MILS * 1000;
int curr_layer = getActiveLayer();
LAYER_NUM curr_layer = getActiveLayer();
for( int layer = 0; layer < 32; layer++ )
for( LAYER_NUM layer = FIRST_LAYER; layer < NB_LAYERS; ++layer )
{
GERBER_IMAGE* gerber = g_GERBER_List[layer];
......@@ -539,7 +539,7 @@ void GERBVIEW_FRAME::SetVisibleAlls()
*/
LAYER_MSK GERBVIEW_FRAME::GetVisibleLayers() const
{
return -1; // TODO
return FULL_LAYERS; // TODO
}
......@@ -561,7 +561,7 @@ void GERBVIEW_FRAME::SetVisibleLayers( LAYER_MSK aLayerMask )
* @param aLayerIndex = The index of the layer to be tested
* @return bool - true if the layer is visible.
*/
bool GERBVIEW_FRAME::IsLayerVisible( int aLayerIndex ) const
bool GERBVIEW_FRAME::IsLayerVisible( LAYER_NUM aLayerIndex ) const
{
if( ! m_DisplayOptions.m_IsPrinting )
return m_LayersManager->IsLayerVisible( aLayerIndex );
......@@ -650,7 +650,7 @@ EDA_COLOR_T GERBVIEW_FRAME::GetNegativeItemsColor() const
* Function GetLayerColor
* gets a layer color for any valid layer.
*/
EDA_COLOR_T GERBVIEW_FRAME::GetLayerColor( int aLayer ) const
EDA_COLOR_T GERBVIEW_FRAME::GetLayerColor( LAYER_NUM aLayer ) const
{
return m_colorsSettings->GetLayerColor( aLayer );
}
......@@ -660,7 +660,7 @@ EDA_COLOR_T GERBVIEW_FRAME::GetLayerColor( int aLayer ) const
* Function SetLayerColor
* changes a layer color for any valid layer.
*/
void GERBVIEW_FRAME::SetLayerColor( int aLayer, EDA_COLOR_T aColor )
void GERBVIEW_FRAME::SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor )
{
m_colorsSettings->SetLayerColor( aLayer, aColor );
}
......@@ -670,7 +670,7 @@ void GERBVIEW_FRAME::SetLayerColor( int aLayer, EDA_COLOR_T aColor )
* Function getActiveLayer
* returns the active layer
*/
int GERBVIEW_FRAME::getActiveLayer()
LAYER_NUM GERBVIEW_FRAME::getActiveLayer()
{
return ( (GBR_SCREEN*) GetScreen() )->m_Active_Layer;
}
......@@ -681,7 +681,7 @@ int GERBVIEW_FRAME::getActiveLayer()
* will change the currently active layer to \a aLayer and also
* update the PCB_LAYER_WIDGET.
*/
void GERBVIEW_FRAME::setActiveLayer( int aLayer, bool doLayerWidgetUpdate )
void GERBVIEW_FRAME::setActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate )
{
( (GBR_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;
......
......@@ -39,7 +39,7 @@
#include <class_gbr_screen.h>
#include <layers_id_colors_and_visibility.h>
#define NO_AVAILABLE_LAYERS -1
#define NO_AVAILABLE_LAYERS UNDEFINED_LAYER
class DCODE_SELECTION_BOX;
class GERBER_LAYER_WIDGET;
......@@ -145,10 +145,10 @@ public:
void SetCurItem( GERBER_DRAW_ITEM* aItem, bool aDisplayInfo = true );
/** Install the dialog box for layer selection
* @param aDefaultLayer = Preselection (NB_LAYERS for "(Deselect)" layer)
* @param aDefaultLayer = Preselection (NB_PCB_LAYERS for "(Deselect)" layer)
* @param aCopperLayerCount = number of copper layers
* @param aShowDeselectOption = display a "(Deselect)" radiobutton (when set to true)
* @return new layer value (NB_LAYERS when "(Deselect)" radiobutton selected),
* @return new layer value (NB_PCB_LAYERS when "(Deselect)" radiobutton selected),
* or -1 if canceled
*
* Providing the option to also display a "(Deselect)" radiobutton makes the
......@@ -159,7 +159,7 @@ public:
* different radiobutton is clicked on) prior to then clicking on the "Deselect"
* button provided within the "Layer selection:" dialog box).
*/
int SelectPCBLayer( int aDefaultLayer, int aOpperLayerCount, bool aNullLayer = false );
LAYER_NUM SelectPCBLayer( LAYER_NUM aDefaultLayer, int aOpperLayerCount, bool aNullLayer = false );
protected:
GERBER_LAYER_WIDGET* m_LayersManager;
......@@ -316,7 +316,7 @@ public:
* @param aLayerIndex = The index of the layer to be tested
* @return bool - true if the layer is visible.
*/
bool IsLayerVisible( int aLayerIndex ) const;
bool IsLayerVisible( LAYER_NUM aLayerIndex ) const;
/**
* Function GetVisibleElementColor
......@@ -330,13 +330,13 @@ public:
* Function GetLayerColor
* gets a layer color for any valid layer.
*/
EDA_COLOR_T GetLayerColor( int aLayer ) const;
EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const;
/**
* Function SetLayerColor
* changes a layer color for any valid layer.
*/
void SetLayerColor( int aLayer, EDA_COLOR_T aColor );
void SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor );
/**
* Function GetNegativeItemsColor
......@@ -388,13 +388,13 @@ public:
* will change the currently active layer to \a aLayer and also
* update the PCB_LAYER_WIDGET.
*/
void setActiveLayer( int aLayer, bool doLayerWidgetUpdate = true );
void setActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate = true );
/**
* Function getActiveLayer
* returns the active layer
*/
int getActiveLayer();
LAYER_NUM getActiveLayer();
/**
* Function getNextAvailableLayer
......@@ -403,7 +403,7 @@ public:
* @param aLayer The first layer to search.
* @return The first empty layer found or NO_AVAILABLE_LAYERS.
*/
int getNextAvailableLayer( int aLayer = 0 ) const;
LAYER_NUM getNextAvailableLayer( LAYER_NUM aLayer = FIRST_LAYER ) const;
bool hasAvailableLayers() const
{
......
......@@ -39,7 +39,7 @@
bool GERBVIEW_FRAME::Clear_Pcb( bool query )
{
int layer;
LAYER_NUM layer;
if( GetLayout() == NULL )
return false;
......@@ -52,7 +52,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query )
GetLayout()->m_Drawings.DeleteAll();
for( layer = 0; layer < GERBVIEW_LAYER_COUNT; layer++ )
for( layer = FIRST_LAYER; layer < NB_GERBER_LAYERS; ++layer )
{
if( g_GERBER_List[layer] )
{
......@@ -65,7 +65,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query )
SetScreen( new GBR_SCREEN( GetPageSettings().GetSizeIU() ) );
setActiveLayer(0);
setActiveLayer( FIRST_LAYER );
m_LayersManager->UpdateLayerIcons();
syncLayerBox();
return true;
......@@ -74,7 +74,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query )
void GERBVIEW_FRAME::Erase_Current_Layer( bool query )
{
int layer = getActiveLayer();
LAYER_NUM layer = getActiveLayer();
wxString msg;
msg.Printf( _( "Clear layer %d?" ), layer + 1 );
......
......@@ -46,7 +46,7 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc
if( aTypeloc == CURSEUR_ON_GRILLE )
ref = GetScreen()->GetNearestGridPosition( ref );
int layer = getActiveLayer();
LAYER_NUM layer = getActiveLayer();
// Search first on active layer
GERBER_DRAW_ITEM* gerb_item = GetItemsList();
......
......@@ -24,7 +24,7 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName,
wxString msg;
char* text;
int layer; /* current layer used in GerbView */
LAYER_NUM layer; // current layer used in GerbView
layer = getActiveLayer();
......
......@@ -88,7 +88,7 @@
void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
APERTURE_T aAperture,
int Dcode_index,
int aLayer,
LAYER_NUM aLayer,
const wxPoint& aPos,
wxSize aSize,
bool aLayerNegative )
......@@ -140,7 +140,7 @@ void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
*/
void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
int Dcode_index,
int aLayer,
LAYER_NUM aLayer,
const wxPoint& aStart,
const wxPoint& aEnd,
wxSize aPenSize,
......@@ -189,7 +189,7 @@ void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
* false when arc is inside one quadrant
* @param aLayerNegative = true if the current layer is negative
*/
static void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, int aLayer,
static void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, LAYER_NUM aLayer,
const wxPoint& aStart, const wxPoint& aEnd,
const wxPoint& aRelCenter, wxSize aPenSize,
bool aClockwise, bool aMultiquadrant,
......@@ -328,7 +328,7 @@ static void fillArcPOLY( GERBER_DRAW_ITEM* aGbrItem,
aGbrItem->SetLayerPolarity( aLayerNegative );
fillArcGBRITEM( &dummyGbrItem, 0, 0,
fillArcGBRITEM( &dummyGbrItem, 0, FIRST_LAYER,
aStart, aEnd, rel_center, wxSize(0, 0),
aClockwise, aMultiquadrant, aLayerNegative );
......@@ -549,7 +549,7 @@ bool GERBER_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
GERBER_DRAW_ITEM* gbritem;
GBR_LAYOUT* layout = m_Parent->GetLayout();
int activeLayer = m_Parent->getActiveLayer();
LAYER_NUM activeLayer = m_Parent->getActiveLayer();
int dcode = 0;
D_CODE* tool = NULL;
......
......@@ -35,12 +35,12 @@
#include <select_layers_to_pcb.h>
// Imported function
extern const wxString GetPCBDefaultLayerName( int aLayerNumber );
extern const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber );
enum swap_layer_id {
ID_LAYERS_MAP_DIALOG = ID_GERBER_END_LIST,
ID_BUTTON_0,
ID_TEXT_0 = ID_BUTTON_0 + GERBVIEW_LAYER_COUNT
ID_TEXT_0 = ID_BUTTON_0 + NB_GERBER_LAYERS
};
......@@ -54,7 +54,7 @@ int LAYERS_MAP_DIALOG::m_exportBoardCopperLayersCount = 2;
BEGIN_EVENT_TABLE( LAYERS_MAP_DIALOG, LAYERS_MAP_DIALOG_BASE )
EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + GERBVIEW_LAYER_COUNT-1,
EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + NB_GERBER_LAYERS-1,
wxEVT_COMMAND_BUTTON_CLICKED,
LAYERS_MAP_DIALOG::OnSelectLayer )
END_EVENT_TABLE()
......@@ -102,11 +102,11 @@ void LAYERS_MAP_DIALOG::initDialog()
// the above code should be modified as required in the event that those
// buttons should be some other size in that version.
for( int ii = 0; ii < GERBVIEW_LAYER_COUNT; ii++ )
for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii )
{
// Specify the default value for each member of these arrays.
m_buttonTable[ii] = -1;
m_layersLookUpTable[ii] = LAYER_UNSELECTED;
m_layersLookUpTable[ii] = UNSELECTED_LAYER;
}
// Ensure we have:
......@@ -118,9 +118,9 @@ void LAYERS_MAP_DIALOG::initDialog()
int idx = ( m_exportBoardCopperLayersCount / 2 ) - 1;
m_comboCopperLayersCount->SetSelection( idx );
int pcb_layer_num = 0;
LAYER_NUM pcb_layer_num = FIRST_LAYER;
m_itemsCount = 0;
for( int ii = 0; ii < GERBVIEW_LAYER_COUNT; ii++ )
for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii )
{
if( g_GERBER_List[ii] == NULL )
continue;
......@@ -132,10 +132,10 @@ void LAYERS_MAP_DIALOG::initDialog()
m_buttonTable[m_itemsCount] = ii;
m_layersLookUpTable[ii] = pcb_layer_num;
m_itemsCount++;
pcb_layer_num++;
++pcb_layer_num;
}
if( m_itemsCount <= GERBVIEW_LAYER_COUNT/2 ) // Only one list is enough
if( m_itemsCount <= NB_GERBER_LAYERS/2 ) // Only one list is enough
{
m_staticlineSep->Hide();
}
......@@ -177,7 +177,7 @@ void LAYERS_MAP_DIALOG::initDialog()
// is nb_items; otherwise, the number of rows is 16 (with two
// separate columns of controls being used if nb_items > 16).
if( ii == GERBVIEW_LAYER_COUNT/2 )
if( ii == NB_GERBER_LAYERS/2 )
flexColumnBoxSizer = m_flexRightColumnBoxSizer;
// Provide a text string to identify the Gerber layer
......@@ -225,7 +225,7 @@ void LAYERS_MAP_DIALOG::initDialog()
wxDefaultSize, 0 );
goodSize = text->GetSize();
for( int jj = 0; jj < BOARD_LAYERS_MAX_COUNT; jj++ )
for( LAYER_NUM jj = FIRST_LAYER; jj < NB_LAYERS; ++jj )
{
text->SetLabel( GetPCBDefaultLayerName( jj ) );
if( goodSize.x < text->GetSize().x )
......@@ -258,8 +258,8 @@ void LAYERS_MAP_DIALOG::normalizeBrdLayersCount()
if( ( m_exportBoardCopperLayersCount & 1 ) )
m_exportBoardCopperLayersCount++;
if( m_exportBoardCopperLayersCount > BOARD_COPPER_LAYERS_MAX_COUNT )
m_exportBoardCopperLayersCount = BOARD_COPPER_LAYERS_MAX_COUNT;
if( m_exportBoardCopperLayersCount > NB_LAYERS )
m_exportBoardCopperLayersCount = NB_LAYERS;
if( m_exportBoardCopperLayersCount < 2 )
m_exportBoardCopperLayersCount = 2;
......@@ -281,8 +281,9 @@ void LAYERS_MAP_DIALOG::OnBrdLayersCountSelection( wxCommandEvent& event )
void LAYERS_MAP_DIALOG::OnResetClick( wxCommandEvent& event )
{
wxString msg;
int ii, layer;
for( ii = 0, layer = 0; ii < m_itemsCount; ii++, layer++ )
int ii;
LAYER_NUM layer;
for( ii = 0, layer = FIRST_LAYER; ii < m_itemsCount; ii++, ++layer )
{
if( (layer == m_exportBoardCopperLayersCount - 1)
&& (m_exportBoardCopperLayersCount > 1) )
......@@ -304,7 +305,7 @@ void LAYERS_MAP_DIALOG::OnStoreSetup( wxCommandEvent& event )
config->Write( wxT("BrdLayersCount"), m_exportBoardCopperLayersCount );
wxString key;
for( int ii = 0; ii < GERBVIEW_LAYER_COUNT; ii++ )
for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii )
{
key.Printf( wxT("GbrLyr%dToPcb"), ii );
config->Write( key, m_layersLookUpTable[ii] );
......@@ -322,16 +323,18 @@ void LAYERS_MAP_DIALOG::OnGetSetup( wxCommandEvent& event )
m_comboCopperLayersCount->SetSelection( idx );
wxString key;
for( int ii = 0; ii < GERBVIEW_LAYER_COUNT; ii++ )
for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii )
{
key.Printf( wxT("GbrLyr%dToPcb"), ii );
config->Read( key, &m_layersLookUpTable[ii] );
int ilayer;
config->Read( key, &ilayer);
m_layersLookUpTable[ii] = ilayer;
}
for( int ii = 0; ii < m_itemsCount; ii++ )
{
int layer = m_layersLookUpTable[ii];
if( layer == LAYER_UNSELECTED )
LAYER_NUM layer = m_layersLookUpTable[ii];
if( layer == UNSELECTED_LAYER )
{
m_layersList[ii]->SetLabel( _( "Do not export" ) );
m_layersList[ii]->SetForegroundColour( *wxBLUE );
......@@ -346,29 +349,29 @@ void LAYERS_MAP_DIALOG::OnGetSetup( wxCommandEvent& event )
void LAYERS_MAP_DIALOG::OnSelectLayer( wxCommandEvent& event )
{
int ii, jj;
int ii;
ii = event.GetId() - ID_BUTTON_0;
if( (ii < 0) || (ii >= GERBVIEW_LAYER_COUNT) )
if( (ii < FIRST_LAYER) || (ii >= NB_GERBER_LAYERS) )
{
wxFAIL_MSG( wxT("Bad layer id") );
return;
}
jj = m_layersLookUpTable[m_buttonTable[ii]];
if( ( jj < 0 ) || ( jj > LAYER_UNSELECTED ) )
LAYER_NUM jj = m_layersLookUpTable[m_buttonTable[ii]];
if( ( jj < FIRST_LAYER ) || ( jj > NB_LAYERS ) )
jj = LAYER_N_BACK; // (Defaults to "Copper" layer.)
jj = m_Parent->SelectPCBLayer( jj, m_exportBoardCopperLayersCount, true );
if( ( jj < 0 ) || ( jj > LAYER_UNSELECTED ) )
if( ( jj < FIRST_LAYER ) || ( jj > NB_LAYERS ) )
return;
if( jj != m_layersLookUpTable[m_buttonTable[ii]] )
{
m_layersLookUpTable[m_buttonTable[ii]] = jj;
if( jj == LAYER_UNSELECTED )
if( jj == UNSELECTED_LAYER )
{
m_layersList[ii]->SetLabel( _( "Do not export" ) );
......@@ -402,7 +405,7 @@ void LAYERS_MAP_DIALOG::OnOkClick( wxCommandEvent& event )
normalizeBrdLayersCount();
int inner_layer_max = 0;
for( int ii = 0; ii < GERBVIEW_LAYER_COUNT; ii++ )
for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii )
{
if( m_layersLookUpTable[ii] < LAYER_N_FRONT )
{
......@@ -420,6 +423,7 @@ void LAYERS_MAP_DIALOG::OnOkClick( wxCommandEvent& event )
_("The exported board has not enough copper layers to handle selected inner layers") );
return;
}
m_layersLookUpTable[GERBVIEW_LAYER_COUNT] = m_exportBoardCopperLayersCount;
// XXX EVIL usage of LAYER
m_layersLookUpTable[NB_GERBER_LAYERS] = m_exportBoardCopperLayersCount;
EndModal( wxID_OK );
}
......@@ -24,7 +24,7 @@ private:
static int m_exportBoardCopperLayersCount;
wxFlexGridSizer* m_flexRightColumnBoxSizer; // An extra wxFlexGridSizer used
// when we have more than 16 gerber files loaded
int m_layersLookUpTable[32+1]; // Indexes Gerber layers to PCB file layers
LAYER_NUM m_layersLookUpTable[int(NB_LAYERS)+1]; // Indexes Gerber layers to PCB file layers
// the last value in table is the number of copper layers
int m_buttonTable[32]; // Indexes buttons to Gerber layers
wxStaticText* m_layersList[32]; // Indexes text strings to buttons
......@@ -32,7 +32,7 @@ private:
public: LAYERS_MAP_DIALOG( GERBVIEW_FRAME* parent );
~LAYERS_MAP_DIALOG() {};
int * GetLayersLookUpTable() { return m_layersLookUpTable; }
LAYER_NUM * GetLayersLookUpTable() { return m_layersLookUpTable; }
int GetCopperLayersCount() { return m_exportBoardCopperLayersCount; }
private:
......
......@@ -291,7 +291,7 @@ void GERBVIEW_FRAME::OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent )
void GERBVIEW_FRAME::OnUpdateSelectDCode( wxUpdateUIEvent& aEvent )
{
int layer = getActiveLayer();
LAYER_NUM layer = getActiveLayer();
GERBER_IMAGE* gerber = g_GERBER_List[layer];
int selected = ( gerber ) ? gerber->m_Selected_Tool : 0;
......
......@@ -78,10 +78,10 @@ public:
* @param aLayerIndex = The index of the layer to be tested
* @return bool - true if the layer is visible.
*/
bool IsLayerVisible( int aLayerIndex ) const
bool IsLayerVisible( LAYER_NUM aLayerIndex ) const
{
// @@IMB: Altough Pcbnew uses only 29, GerbView uses all 32 layers
if( aLayerIndex < 0 || aLayerIndex >= 32 )
if( aLayerIndex < FIRST_LAYER || aLayerIndex >= NB_LAYERS )
return false;
// If a layer is disabled, it is automatically invisible
......@@ -94,7 +94,7 @@ public:
* @param aLayerIndex = The index of the layer to be changed
* @param aNewState = The new visibility state of the layer
*/
void SetLayerVisibility( int aLayerIndex, bool aNewState );
void SetLayerVisibility( LAYER_NUM aLayerIndex, bool aNewState );
/**
* Function GetVisibleElements
......@@ -161,7 +161,7 @@ public:
* @param aLayerIndex = The index of the layer to be tested
* @return bool - true if the layer is enabled
*/
bool IsLayerEnabled( int aLayerIndex ) const
bool IsLayerEnabled( LAYER_NUM aLayerIndex ) const
{
return bool( m_EnabledLayers & GetLayerMask( aLayerIndex ) );
}
......
......@@ -78,13 +78,13 @@ class BOARD_ITEM : public EDA_ITEM
void SetBack( EDA_ITEM* aBack ) { Pback = aBack; }
protected:
int m_Layer;
LAYER_NUM m_Layer;
public:
BOARD_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ) :
EDA_ITEM( aParent, idtype )
, m_Layer( 0 )
, m_Layer( FIRST_LAYER )
{
}
......@@ -103,7 +103,7 @@ public:
* Function GetLayer
* returns the layer this item is on.
*/
int GetLayer() const { return m_Layer; }
LAYER_NUM GetLayer() const { return m_Layer; }
/**
* Function SetLayer
......@@ -112,7 +112,7 @@ public:
* is virtual because some items (in fact: class DIMENSION)
* have a slightly different initialization
*/
virtual void SetLayer( int aLayer ) { m_Layer = aLayer; }
virtual void SetLayer( LAYER_NUM aLayer ) { m_Layer = aLayer; }
/**
* Function Draw
......@@ -129,7 +129,7 @@ public:
* @param aLayer The layer to test for.
* @return bool - true if on given layer, else false.
*/
virtual bool IsOnLayer( int aLayer ) const
virtual bool IsOnLayer( LAYER_NUM aLayer ) const
{
return m_Layer == aLayer;
}
......
......@@ -7,6 +7,7 @@
#define _COLORS_DESIGN_SETTING_H
#include <layers_id_colors_and_visibility.h>
// XXX shouldn't these come from somewhere else?
#define LAYERSCOLORSBUFFERSIZE 32
#define ITEMSCOLORSBUFFERSIZE 32
......@@ -33,14 +34,14 @@ public:
* @return the color for aLayer which is one of the layer indices given
* in pcbstruct.h or in schematic
*/
EDA_COLOR_T GetLayerColor( int aLayer ) const;
EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const;
/**
* Function SetLayerColor
* sets the color for aLayer which is one of the layer indices given
* in pcbstruct.h or in schematic
*/
void SetLayerColor( int aLayer, EDA_COLOR_T aColor );
void SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor );
/**
* Function GetItemColor
......
......@@ -35,24 +35,24 @@ public:
// Returns a color index from the layer id
// Virtual function because GerbView uses its own functions in a derived class
virtual EDA_COLOR_T GetLayerColor( int aLayerIndex ) const = 0;
virtual EDA_COLOR_T GetLayerColor( LAYER_NUM aLayerIndex ) const = 0;
// Returns the name of the layer id
// Virtual pure function because GerbView uses its own functions in a derived class
virtual wxString GetLayerName( int aLayerIndex ) const = 0;
virtual wxString GetLayerName( LAYER_NUM aLayerIndex ) const = 0;
// Returns true if the layer id is enabled (i.e. is it should be displayed)
// Virtual function pure because GerbView uses its own functions in a derived class
virtual bool IsLayerEnabled( int aLayerIndex ) const = 0;
virtual bool IsLayerEnabled( LAYER_NUM aLayerIndex ) const = 0;
// Get Current Item #
int GetChoice();
// Get Current Layer
int GetLayerSelection();
LAYER_NUM GetLayerSelection() const;
// Set Layer #
int SetLayerSelection(int layer);
int SetLayerSelection(LAYER_NUM layer);
// Reload the Layers
// Virtual pure function because GerbView uses its own functions in a derived class
......@@ -66,10 +66,10 @@ public:
protected:
// Fills the layer bitmap aLayerbmp with the layer color
void SetBitmapLayer( wxBitmap& aLayerbmp, int aLayerIndex );
void SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayerIndex );
};
#define DECLARE_LAYERS_HOTKEY(list) int list[LAYER_COUNT] = \
#define DECLARE_LAYERS_HOTKEY(list) int list[NB_LAYERS] = \
{ \
HK_SWITCH_LAYER_TO_COPPER, \
HK_SWITCH_LAYER_TO_INNER1, \
......
......@@ -17,9 +17,9 @@ class UNDO_REDO_CONTAINER;
class PCB_SCREEN : public BASE_SCREEN
{
public:
int m_Active_Layer;
int m_Route_Layer_TOP;
int m_Route_Layer_BOTTOM;
LAYER_NUM m_Active_Layer;
LAYER_NUM m_Route_Layer_TOP;
LAYER_NUM m_Route_Layer_BOTTOM;
public:
......
......@@ -30,10 +30,17 @@
#ifndef _LAYERS_ID_AND_VISIBILITY_H_
#define _LAYERS_ID_AND_VISIBILITY_H_
#include <wx/debug.h> // wxASSERT
/* NOTE: the idea here is to have LAYER_NUM and LAYER_MSK as abstract
* type as possible (even if they're currently implemented as int and
* unsigned int, respectively). In this way it would be reasonably easy
* to overcome the current 32 layer limit. For example switching to a 64
* bit mask or even some kind of bit array */
/* Layer identification (layer number) */
typedef int LAYER_NUM;
#define UNDEFINED_LAYER -1
#define NO_LAYER 0
#define FIRST_LAYER 0
#define FIRST_COPPER_LAYER 0
#define LAYER_N_BACK 0
#define LAYER_N_2 1
......@@ -52,9 +59,9 @@
#define LAYER_N_15 14
#define LAYER_N_FRONT 15
#define LAST_COPPER_LAYER LAYER_N_FRONT
#define NB_COPPER_LAYERS (LAST_COPPER_LAYER + 1)
#define NB_COPPER_LAYERS (LAST_COPPER_LAYER - FIRST_COPPER_LAYER + 1)
#define FIRST_NO_COPPER_LAYER 16
#define FIRST_NON_COPPER_LAYER 16
#define ADHESIVE_N_BACK 16
#define ADHESIVE_N_FRONT 17
#define SOLDERPASTE_N_BACK 18
......@@ -68,13 +75,14 @@
#define ECO1_N 26
#define ECO2_N 27
#define EDGE_N 28
#define LAST_NO_COPPER_LAYER 28
#define LAST_NON_COPPER_LAYER 28
#define NB_PCB_LAYERS (LAST_NON_COPPER_LAYER + 1)
#define UNUSED_LAYER_29 29
#define UNUSED_LAYER_30 30
#define UNUSED_LAYER_31 31
#define NB_LAYERS (LAST_NO_COPPER_LAYER + 1)
#define LAYER_COUNT 32
#define NB_GERBER_LAYERS 32
#define NB_LAYERS 32
#define UNSELECTED_LAYER 32
// Masks to identify a layer by a bit map
typedef unsigned LAYER_MSK;
......@@ -108,9 +116,6 @@ typedef unsigned LAYER_MSK;
#define ECO2_LAYER (1 << ECO2_N)
#define EDGE_LAYER (1 << EDGE_N)
#define FIRST_NON_COPPER_LAYER ADHESIVE_N_BACK
#define LAST_NON_COPPER_LAYER EDGE_N
// extra bits 0xE0000000
/* Helpful global layers mask : */
#define ALL_LAYERS 0x1FFFFFFF // Pcbnew used 29 layers
......@@ -124,9 +129,8 @@ typedef unsigned LAYER_MSK;
/** return a one bit layer mask from a layer number
* aLayerNumber = the layer number to convert (0 .. LAYERS-1)
*/
inline LAYER_MSK GetLayerMask( unsigned aLayerNumber )
inline LAYER_MSK GetLayerMask( LAYER_NUM aLayerNumber )
{
wxASSERT( aLayerNumber < LAYER_COUNT && aLayerNumber >= 0 );
return 1 << aLayerNumber;
}
......@@ -135,7 +139,7 @@ inline LAYER_MSK GetLayerMask( unsigned aLayerNumber )
// layers order in dialogs (plot, print and toolbars)
// in same order than in setup layers dialog
// (Front or Top to Back or Bottom)
#define DECLARE_LAYERS_ORDER_LIST(list) int list[LAYER_COUNT] =\
#define DECLARE_LAYERS_ORDER_LIST(list) LAYER_NUM list[NB_LAYERS] =\
{ LAYER_N_FRONT,\
LAYER_N_15, LAYER_N_14, LAYER_N_13, LAYER_N_12,\
LAYER_N_11, LAYER_N_10, LAYER_N_9, LAYER_N_8,\
......@@ -186,14 +190,14 @@ enum PCB_VISIBLE
/**
* Function IsValidLayerIndex
* Function IsValidPcbLayerIndex
* tests whether a given integer is a valid layer index
* @param aLayerIndex = Layer index to test
* @return true if aLayerIndex is a valid layer index
*/
inline bool IsValidLayerIndex( int aLayerIndex )
inline bool IsValidPcbLayerIndex( LAYER_NUM aLayerIndex )
{
return aLayerIndex >= 0 && aLayerIndex < NB_LAYERS;
return aLayerIndex >= FIRST_LAYER && aLayerIndex < NB_PCB_LAYERS;
}
/**
......@@ -202,7 +206,7 @@ inline bool IsValidLayerIndex( int aLayerIndex )
* @param aLayerIndex = Layer index to test
* @return true if aLayerIndex is a valid copper layer index
*/
inline bool IsValidCopperLayerIndex( int aLayerIndex )
inline bool IsValidCopperLayerIndex( LAYER_NUM aLayerIndex )
{
return aLayerIndex >= FIRST_COPPER_LAYER && aLayerIndex <= LAST_COPPER_LAYER;
}
......@@ -213,10 +217,10 @@ inline bool IsValidCopperLayerIndex( int aLayerIndex )
* @param aLayerIndex = Layer index to test
* @return true if aLayerIndex is a valid non copper layer index
*/
inline bool IsValidNonCopperLayerIndex( int aLayerIndex )
inline bool IsValidNonCopperLayerIndex( LAYER_NUM aLayerIndex )
{
return aLayerIndex >= FIRST_NO_COPPER_LAYER
&& aLayerIndex <= LAST_NO_COPPER_LAYER;
return aLayerIndex >= FIRST_NON_COPPER_LAYER
&& aLayerIndex <= LAST_NON_COPPER_LAYER;
}
#endif // _LAYERS_ID_AND_VISIBILITY_H_
......@@ -17,7 +17,7 @@
#define TO_UTF8( wxstring ) ( (const char*) (wxstring).utf8_str() )
/**
* Macro FROM_UTF8
* function FROM_UTF8
* converts a UTF8 encoded C string to a wxString for all wxWidgets build modes.
*/
//#define FROM_UTF8( cstring ) wxString::FromUTF8( cstring )
......
......@@ -7,7 +7,7 @@
#include <dlist.h>
#include <layers_id_colors_and_visibility.h> // LAYER_COUNT and NB_COPPER_LAYERS definitions.
#include <layers_id_colors_and_visibility.h>
#define MIN_DRAW_WIDTH 1 ///< Minimum trace drawing width.
......
......@@ -83,6 +83,7 @@ enum DANGLING_END_T {
*/
class DANGLING_END_ITEM
{
private:
/// A pointer to the connectable object.
const void* m_item;
......
......@@ -597,9 +597,9 @@ public:
// layerhandling:
// (See pcbnew/sel_layer.cpp for description of why null_layer parameter
// is provided)
int SelectLayer( int default_layer, int min_layer, int max_layer, bool null_layer = false );
LAYER_NUM SelectLayer( LAYER_NUM default_layer, LAYER_NUM min_layer, LAYER_NUM max_layer, bool null_layer = false );
void SelectLayerPair();
virtual void SwitchLayer( wxDC* DC, int layer );
virtual void SwitchLayer( wxDC* DC, LAYER_NUM layer );
void InstallGridFrame( const wxPoint& pos );
......
......@@ -113,7 +113,7 @@ protected:
* will change the currently active layer to \a aLayer and also
* update the PCB_LAYER_WIDGET.
*/
void setActiveLayer( int aLayer, bool doLayerWidgetUpdate = true )
void setActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate = true )
{
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;
......@@ -125,7 +125,7 @@ protected:
* Function getActiveLayer
* returns the active layer
*/
int getActiveLayer()
LAYER_NUM getActiveLayer()
{
return ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer;
}
......@@ -1206,7 +1206,7 @@ public:
bool MergeCollinearTracks( TRACK* track, wxDC* DC, int end );
void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC );
void SwitchLayer( wxDC* DC, int layer );
void SwitchLayer( wxDC* DC, LAYER_NUM layer );
/**
* Function Add45DegreeSegment
......@@ -1406,7 +1406,7 @@ public:
DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T shape, wxDC* DC );
void End_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Delete_Drawings_All_Layer( int aLayer );
void Delete_Drawings_All_Layer( LAYER_NUM aLayer );
// Dimension handling:
void ShowDimensionPropertyDialog( DIMENSION* aDimension, wxDC* aDC );
......
......@@ -99,7 +99,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
wxPoint PosOK;
wxPoint memopos;
int error;
int lay_tmp_TOP, lay_tmp_BOTTOM;
LAYER_NUM lay_tmp_TOP, lay_tmp_BOTTOM;
// Undo: init list
PICKED_ITEMS_LIST newList;
......@@ -457,7 +457,7 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
/* Place the edge layer segments */
TRACK TmpSegm( NULL );
TmpSegm.SetLayer( -1 );
TmpSegm.SetLayer( UNDEFINED_LAYER );
TmpSegm.SetNet( -1 );
TmpSegm.SetWidth( RoutingMatrix.m_GridRouting / 2 );
......
......@@ -240,7 +240,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
tmpSegm.SetLayer( edge->GetLayer() );
if( tmpSegm.GetLayer() == EDGE_N )
tmpSegm.SetLayer( -1 );
tmpSegm.SetLayer( UNDEFINED_LAYER );
tmpSegm.SetStart( edge->GetStart() );
tmpSegm.SetEnd( edge->GetEnd() );
......@@ -275,7 +275,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
if( DrawSegm->GetLayer() == EDGE_N )
{
tmpSegm.SetLayer( -1 );
tmpSegm.SetLayer( UNDEFINED_LAYER );
type_cell |= CELL_is_EDGE;
}
......
......@@ -305,9 +305,9 @@ void PCB_BASE_FRAME::Show3D_Frame( wxCommandEvent& event )
// Note: virtual, overridden in PCB_EDIT_FRAME;
void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, int layer )
void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, LAYER_NUM layer )
{
int preslayer = ((PCB_SCREEN*)GetScreen())->m_Active_Layer;
LAYER_NUM preslayer = ((PCB_SCREEN*)GetScreen())->m_Active_Layer;
// Check if the specified layer matches the present layer
if( layer == preslayer )
......
......@@ -393,7 +393,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
{
for( MODULE* module = m_Pcb->m_Modules; module != NULL; module = module->Next() )
{
int layer = module->GetLayer();
LAYER_NUM layer = module->GetLayer();
if( module->HitTest( GetScreen()->m_BlockLocate )
&& ( !module->IsLocked() || blockIncludeLockedModules ) )
......
......@@ -198,7 +198,7 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
if( aItem->Type() != PCB_MODULE_T && aItem->Type() != PCB_ZONE_AREA_T )
{
// These items have a global swap function.
int layer, layerimg;
LAYER_NUM layer, layerimg;
layer = aItem->GetLayer();
layerimg = aImage->GetLayer();
aItem->SetLayer( layerimg );
......
......@@ -75,7 +75,7 @@ BOARD::BOARD() :
BuildListOfNets(); // prepare pad and netlist containers.
for( int layer = 0; layer < LAYER_COUNT; ++layer )
for( LAYER_NUM layer = FIRST_LAYER; layer < NB_LAYERS; ++layer )
{
m_Layer[layer].m_Name = GetStandardLayerName( layer );
......@@ -344,7 +344,7 @@ int BOARD::GetCurrentMicroViaDrill()
}
bool BOARD::SetLayer( int aIndex, const LAYER& aLayer )
bool BOARD::SetLayer( LAYER_NUM aIndex, const LAYER& aLayer )
{
if( aIndex < NB_COPPER_LAYERS )
{
......@@ -356,9 +356,9 @@ bool BOARD::SetLayer( int aIndex, const LAYER& aLayer )
}
wxString BOARD::GetLayerName( int aLayerIndex ) const
wxString BOARD::GetLayerName( LAYER_NUM aLayerIndex ) const
{
if( !IsValidLayerIndex( aLayerIndex ) )
if( !IsValidPcbLayerIndex( aLayerIndex ) )
return wxEmptyString;
// All layer names are stored in the BOARD.
......@@ -368,7 +368,7 @@ wxString BOARD::GetLayerName( int aLayerIndex ) const
// over-ridden by BOARD::SetLayerName().
// For copper layers, return the actual copper layer name,
// otherwise return the Standard English layer name.
if( aLayerIndex < FIRST_NO_COPPER_LAYER )
if( aLayerIndex < FIRST_NON_COPPER_LAYER )
return m_Layer[aLayerIndex].m_Name;
}
......@@ -376,7 +376,7 @@ wxString BOARD::GetLayerName( int aLayerIndex ) const
}
wxString BOARD::GetStandardLayerName( int aLayerNumber )
wxString BOARD::GetStandardLayerName( LAYER_NUM aLayerNumber )
{
const wxChar* txt;
......@@ -422,7 +422,7 @@ wxString BOARD::GetStandardLayerName( int aLayerNumber )
}
bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName )
bool BOARD::SetLayerName( LAYER_NUM aLayerIndex, const wxString& aLayerName )
{
if( !IsValidCopperLayerIndex( aLayerIndex ) )
return false;
......@@ -441,7 +441,7 @@ bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName )
if( IsLayerEnabled( aLayerIndex ) )
{
for( int i = 0; i < NB_COPPER_LAYERS; i++ )
for( LAYER_NUM i = FIRST_COPPER_LAYER; i < NB_COPPER_LAYERS; ++i )
{
if( i != aLayerIndex && IsLayerEnabled( i ) && NameTemp == m_Layer[i].m_Name )
return false;
......@@ -456,7 +456,7 @@ bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName )
}
LAYER_T BOARD::GetLayerType( int aLayerIndex ) const
LAYER_T BOARD::GetLayerType( LAYER_NUM aLayerIndex ) const
{
if( !IsValidCopperLayerIndex( aLayerIndex ) )
return LT_SIGNAL;
......@@ -470,7 +470,7 @@ LAYER_T BOARD::GetLayerType( int aLayerIndex ) const
}
bool BOARD::SetLayerType( int aLayerIndex, LAYER_T aLayerType )
bool BOARD::SetLayerType( LAYER_NUM aLayerIndex, LAYER_T aLayerType )
{
if( !IsValidCopperLayerIndex( aLayerIndex ) )
return false;
......@@ -574,7 +574,7 @@ void BOARD::SetVisibleElements( int aMask )
for( int ii = 0; ii < PCB_VISIBLE( END_PCB_VISIBLE_LIST ); ii++ )
{
int item_mask = 1 << ii;
SetElementVisibility( ii, bool( aMask & item_mask ) );
SetElementVisibility( ii, aMask & item_mask );
}
}
......@@ -683,19 +683,19 @@ void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, EDA_COLOR_T aColor )
}
void BOARD::SetLayerColor( int aLayer, EDA_COLOR_T aColor )
void BOARD::SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor )
{
GetColorsSettings()->SetLayerColor( aLayer, aColor );
}
EDA_COLOR_T BOARD::GetLayerColor( int aLayer ) const
EDA_COLOR_T BOARD::GetLayerColor( LAYER_NUM aLayer ) const
{
return GetColorsSettings()->GetLayerColor( aLayer );
}
bool BOARD::IsModuleLayerVisible( int layer )
bool BOARD::IsModuleLayerVisible( LAYER_NUM layer )
{
if( layer==LAYER_N_FRONT )
return IsElementVisible( PCB_VISIBLE(MOD_FR_VISIBLE) );
......@@ -1195,16 +1195,16 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
/* now using PcbGeneralLocateAndDisplay(), but this remains a useful example
* of how the INSPECTOR can be used in a lightweight way.
* // see pcbstruct.h
* BOARD_ITEM* BOARD::FindPadOrModule( const wxPoint& refPos, int layer )
* BOARD_ITEM* BOARD::FindPadOrModule( const wxPoint& refPos, LAYER_NUM layer )
* {
* class PadOrModule : public INSPECTOR
* {
* public:
* BOARD_ITEM* found;
* int layer;
* LAYER_NUM layer;
* int layer_mask;
*
* PadOrModule( int alayer ) :
* PadOrModule( LAYER_NUM alayer ) :
* found(0), layer(alayer), layer_mask( g_TabOneLayerMask[alayer] )
* {}
*
......@@ -1437,7 +1437,7 @@ int BOARD::ReturnSortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCoun
}
void BOARD::RedrawAreasOutlines( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, int aLayer )
void BOARD::RedrawAreasOutlines( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, LAYER_NUM aLayer )
{
if( !aDC )
return;
......@@ -1452,7 +1452,7 @@ void BOARD::RedrawAreasOutlines( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE a
}
void BOARD::RedrawFilledAreas( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, int aLayer )
void BOARD::RedrawFilledAreas( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, LAYER_NUM aLayer )
{
if( !aDC )
return;
......@@ -1468,8 +1468,8 @@ void BOARD::RedrawFilledAreas( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDr
ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos,
int aStartLayer,
int aEndLayer )
LAYER_NUM aStartLayer,
LAYER_NUM aEndLayer )
{
if( aEndLayer < 0 )
aEndLayer = aStartLayer;
......@@ -1480,7 +1480,7 @@ ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos,
for( unsigned ia = 0; ia < m_ZoneDescriptorList.size(); ia++ )
{
ZONE_CONTAINER* area = m_ZoneDescriptorList[ia];
int layer = area->GetLayer();
LAYER_NUM layer = area->GetLayer();
if( (layer < aStartLayer) || (layer > aEndLayer) )
continue;
......@@ -1531,7 +1531,7 @@ int BOARD::SetAreasNetCodesFromNetNames( void )
}
TRACK* BOARD::GetViaByPosition( const wxPoint& aPosition, int aLayerMask )
TRACK* BOARD::GetViaByPosition( const wxPoint& aPosition, LAYER_NUM aLayer)
{
TRACK* track;
......@@ -1546,10 +1546,10 @@ TRACK* BOARD::GetViaByPosition( const wxPoint& aPosition, int aLayerMask )
if( track->GetState( BUSY | IS_DELETED ) )
continue;
if( aLayerMask < 0 )
if( aLayer == UNDEFINED_LAYER )
break;
if( track->IsOnLayer( aLayerMask ) )
if( track->IsOnLayer( aLayer ) )
break;
}
......@@ -1751,7 +1751,7 @@ TRACK* BOARD::GetTrace( TRACK* aTrace, const wxPoint& aPosition, LAYER_MSK aLaye
{
for( TRACK* track = aTrace; track; track = track->Next() )
{
int layer = track->GetLayer();
LAYER_NUM layer = track->GetLayer();
if( track->GetState( BUSY | IS_DELETED ) )
continue;
......@@ -1893,7 +1893,7 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount,
* if there are on the same layer, the via is on the selected track
* if there are on different layers, the via is on an other track
*/
int layer = track->GetLayer();
LAYER_NUM layer = track->GetLayer();
while( ( track = ::GetTrace( track->Next(), NULL, via->GetStart(), layerMask ) ) != NULL )
{
......@@ -2018,7 +2018,7 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount,
}
MODULE* BOARD::GetFootprint( const wxPoint& aPosition, int aActiveLayer,
MODULE* BOARD::GetFootprint( const wxPoint& aPosition, LAYER_NUM aActiveLayer,
bool aVisibleOnly, bool aIgnoreLocked )
{
MODULE* pt_module;
......@@ -2026,7 +2026,7 @@ MODULE* BOARD::GetFootprint( const wxPoint& aPosition, int aActiveLayer,
MODULE* Altmodule = NULL;
int min_dim = 0x7FFFFFFF;
int alt_min_dim = 0x7FFFFFFF;
int layer;
LAYER_NUM layer;
for( pt_module = m_Modules; pt_module; pt_module = (MODULE*) pt_module->Next() )
{
......@@ -2213,7 +2213,7 @@ void BOARD::SetTrackWidthIndex( unsigned aIndex )
ZONE_CONTAINER* BOARD::AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode,
int aLayer, wxPoint aStartPointPosition, int aHatch )
LAYER_NUM aLayer, wxPoint aStartPointPosition, int aHatch )
{
ZONE_CONTAINER* new_area = InsertArea( aNetcode,
m_ZoneDescriptorList.size( ) - 1,
......@@ -2248,7 +2248,7 @@ void BOARD::RemoveArea( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_to
}
ZONE_CONTAINER* BOARD::InsertArea( int netcode, int iarea, int layer, int x, int y, int hatch )
ZONE_CONTAINER* BOARD::InsertArea( int netcode, int iarea, LAYER_NUM layer, int x, int y, int hatch )
{
ZONE_CONTAINER* new_area = new ZONE_CONTAINER( this );
......
......@@ -188,7 +188,7 @@ private:
/// edge zone descriptors, owned by pointer.
ZONE_CONTAINERS m_ZoneDescriptorList;
LAYER m_Layer[LAYER_COUNT];
LAYER m_Layer[NB_LAYERS];
// if true m_highLight_NetCode is used
HIGH_LIGHT_INFO m_highLight; // current high light data
HIGH_LIGHT_INFO m_highLightPrevious; // a previously stored high light data
......@@ -442,7 +442,7 @@ public:
* @param aLayer = The layer to be tested
* @return bool - true if the layer is visible.
*/
bool IsLayerEnabled( int aLayer ) const
bool IsLayerEnabled( LAYER_NUM aLayer ) const
{
return m_designSettings.IsLayerEnabled( aLayer );
}
......@@ -454,7 +454,7 @@ public:
* @param aLayerIndex = The index of the layer to be tested
* @return bool - true if the layer is visible.
*/
bool IsLayerVisible( int aLayerIndex ) const
bool IsLayerVisible( LAYER_NUM aLayerIndex ) const
{
return m_designSettings.IsLayerVisible( aLayerIndex );
}
......@@ -529,7 +529,7 @@ public:
* @param layer One of the two allowed layers for modules: LAYER_N_FRONT or LAYER_N_BACK
* @return bool - true if the layer is visible, else false.
*/
bool IsModuleLayerVisible( int layer );
bool IsModuleLayerVisible( LAYER_NUM layer );
/**
* Function GetVisibleElementColor
......@@ -596,7 +596,7 @@ public:
* @return wxString - the layer name, which for copper layers may
* be custom, else standard.
*/
wxString GetLayerName( int aLayerIndex ) const;
wxString GetLayerName( LAYER_NUM aLayerIndex ) const;
/**
* Function SetLayerName
......@@ -607,7 +607,7 @@ public:
* @return bool - true if aLayerName was legal and unique among other
* layer names at other layer indices and aLayerIndex was within range, else false.
*/
bool SetLayerName( int aLayerIndex, const wxString& aLayerName );
bool SetLayerName( LAYER_NUM aLayerIndex, const wxString& aLayerName );
/**
* Function GetStandardLayerName
......@@ -620,9 +620,9 @@ public:
* @return wxString - containing the layer name or "BAD INDEX" if aLayerNumber
* is not legal
*/
static wxString GetStandardLayerName( int aLayerNumber );
static wxString GetStandardLayerName( LAYER_NUM aLayerNumber );
bool SetLayer( int aIndex, const LAYER& aLayer );
bool SetLayer( LAYER_NUM aIndex, const LAYER& aLayer );
/**
* Function GetLayerType
......@@ -632,7 +632,7 @@ public:
* @return LAYER_T - the layer type, or LAYER_T(-1) if the
* index was out of range.
*/
LAYER_T GetLayerType( int aLayerIndex ) const;
LAYER_T GetLayerType( LAYER_NUM aLayerIndex ) const;
/**
* Function SetLayerType
......@@ -642,19 +642,19 @@ public:
* @param aLayerType The new layer type.
* @return bool - true if aLayerType was legal and aLayerIndex was within range, else false.
*/
bool SetLayerType( int aLayerIndex, LAYER_T aLayerType );
bool SetLayerType( LAYER_NUM aLayerIndex, LAYER_T aLayerType );
/**
* Function SetLayerColor
* changes a layer color for any valid layer, including non-copper ones.
*/
void SetLayerColor( int aLayer, EDA_COLOR_T aColor );
void SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor );
/**
* Function GetLayerColor
* gets a layer color for any valid layer, including non-copper ones.
*/
EDA_COLOR_T GetLayerColor( int aLayer ) const;
EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const;
/**
* Function ReturnFlippedLayerNumber
......@@ -662,7 +662,7 @@ public:
* some (not all) layers: external copper, Mask, Paste, and solder
* are swapped between front and back sides
*/
static int ReturnFlippedLayerNumber( int oldlayer );
static LAYER_NUM ReturnFlippedLayerNumber( LAYER_NUM oldlayer );
/** Functions to get some items count */
int GetNumSegmTrack() const;
......@@ -1005,8 +1005,8 @@ public:
* @return ZONE_CONTAINER* return a pointer to the ZONE_CONTAINER found, else NULL
*/
ZONE_CONTAINER* HitTestForAnyFilledArea( const wxPoint& aRefPos,
int aStartLayer,
int aEndLayer = -1 );
LAYER_NUM aStartLayer,
LAYER_NUM aEndLayer = UNDEFINED_LAYER );
/**
* Function RedrawAreasOutlines
......@@ -1015,14 +1015,14 @@ public:
void RedrawAreasOutlines( EDA_DRAW_PANEL* aPanel,
wxDC* aDC,
GR_DRAWMODE aDrawMode,
int aLayer );
LAYER_NUM aLayer );
/**
* Function RedrawFilledAreas
* Redraw all filled areas on layer aLayer ( redraw all if aLayer < 0 )
*/
void RedrawFilledAreas( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
int aLayer );
LAYER_NUM aLayer );
/**
* Function SetAreasNetCodesFromNetNames
......@@ -1090,14 +1090,14 @@ public:
* @return a reference to the new area
*/
ZONE_CONTAINER* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode,
int aLayer, wxPoint aStartPointPosition, int aHatch );
LAYER_NUM aLayer, wxPoint aStartPointPosition, int aHatch );
/**
* Function InsertArea
* add empty copper area to net, inserting after m_ZoneDescriptorList[iarea]
* @return pointer to the new area
*/
ZONE_CONTAINER* InsertArea( int netcode, int iarea, int layer, int x, int y, int hatch );
ZONE_CONTAINER* InsertArea( int netcode, int iarea, LAYER_NUM layer, int x, int y, int hatch );
/**
* Function NormalizeAreaPolygon
......@@ -1210,10 +1210,10 @@ public:
* of the via.
* </p>
* @param aPosition The wxPoint to HitTest() against.
* @param aLayerMask The layers to search. Use -1 for a don't care.
* @param aLayer The layer to search. Use -1 for a don't care.
* @return TRACK* A point a to the SEGVIA object if found, else NULL.
*/
TRACK* GetViaByPosition( const wxPoint& aPosition, int aLayerMask = -1 );
TRACK* GetViaByPosition( const wxPoint& aPosition, LAYER_NUM aLayer = UNDEFINED_LAYER );
/**
* Function GetPad
......@@ -1332,7 +1332,7 @@ public:
* @param aIgnoreLocked Ignore locked modules when true.
* @return MODULE* The best module or NULL if none.
*/
MODULE* GetFootprint( const wxPoint& aPosition, int aActiveLayer,
MODULE* GetFootprint( const wxPoint& aPosition, LAYER_NUM aActiveLayer,
bool aVisibleOnly, bool aIgnoreLocked = false );
/**
......
......@@ -191,7 +191,7 @@ void BOARD_DESIGN_SETTINGS::SetVisibleLayers( LAYER_MSK aMask )
}
void BOARD_DESIGN_SETTINGS::SetLayerVisibility( int aLayerIndex, bool aNewState )
void BOARD_DESIGN_SETTINGS::SetLayerVisibility( LAYER_NUM aLayerIndex, bool aNewState )
{
// Altough Pcbnew uses only 29, GerbView uses all 32 layers
if( aLayerIndex < 0 || aLayerIndex >= 32 )
......@@ -229,7 +229,7 @@ void BOARD_DESIGN_SETTINGS::SetCopperLayerCount( int aNewLayerCount )
if( m_CopperLayerCount > 1 )
m_EnabledLayers |= LAYER_FRONT;
for( int ii = LAYER_N_2; ii < aNewLayerCount - 1; ++ii )
for( LAYER_NUM ii = LAYER_N_2; ii < aNewLayerCount - 1; ++ii )
m_EnabledLayers |= GetLayerMask( ii );
}
......@@ -247,9 +247,10 @@ void BOARD_DESIGN_SETTINGS::SetEnabledLayers( LAYER_MSK aMask )
// update m_CopperLayerCount to ensure its consistency with m_EnabledLayers
m_CopperLayerCount = 0;
for( int ii = 0; aMask && ii < NB_COPPER_LAYERS; ii++, aMask >>= 1 )
unsigned shiftMask = aMask;
for( LAYER_NUM ii = FIRST_LAYER; aMask && ii < NB_COPPER_LAYERS; ++ii, shiftMask >>= 1 )
{
if( aMask & 1 )
if( shiftMask & 1 )
m_CopperLayerCount++;
}
}
......@@ -49,7 +49,7 @@ DIMENSION::DIMENSION( BOARD_ITEM* aParent ) :
BOARD_ITEM( aParent, PCB_DIMENSION_T ),
m_Text( this )
{
m_Layer = DRAW_LAYER;
m_Layer = DRAW_N;
m_Width = Millimeter2iu( 0.2 );
m_Value = 0;
m_Shape = 0;
......@@ -86,7 +86,7 @@ const wxString DIMENSION::GetText() const
}
void DIMENSION::SetLayer( int aLayer )
void DIMENSION::SetLayer( LAYER_NUM aLayer )
{
m_Layer = aLayer;
m_Text.SetLayer( aLayer );
......
......@@ -80,7 +80,7 @@ public:
m_Text.SetSize( aTextSize );
}
void SetLayer( int aLayer );
void SetLayer( LAYER_NUM aLayer );
void SetShape( int aShape ) { m_Shape = aShape; }
int GetShape() const { return m_Shape; }
......
......@@ -55,7 +55,8 @@
DRAWSEGMENT::DRAWSEGMENT( BOARD_ITEM* aParent, KICAD_T idtype ) :
BOARD_ITEM( aParent, idtype )
{
m_Width = m_Flags = m_Type = m_Angle = 0;
m_Width = m_Type = m_Angle = 0;
m_Flags = 0;
m_Shape = S_SEGMENT;
}
......@@ -175,7 +176,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
int l_trace;
int mode;
int radius;
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
EDA_COLOR_T color;
BOARD * brd = GetBoard( );
......
......@@ -103,7 +103,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
int ux0, uy0, dx, dy, radius, StAngle, EndAngle;
int type_trace;
int typeaff;
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
PCB_BASE_FRAME* frame;
MODULE* module = (MODULE*) m_Parent;
......
......@@ -86,7 +86,7 @@ MARKER_PCB::~MARKER_PCB()
* param aLayer The layer to test for.
* return bool - true if on given layer, else false.
*/
bool MARKER_PCB::IsOnLayer( int aLayer ) const
bool MARKER_PCB::IsOnLayer( LAYER_NUM aLayer ) const
{
return IsValidCopperLayerIndex( aLayer );
}
......
......@@ -69,7 +69,7 @@ public:
return HitTestMarker( aPosition );
}
bool IsOnLayer( int aLayer ) const;
bool IsOnLayer( LAYER_NUM aLayer ) const;
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList );
......
......@@ -53,7 +53,7 @@ PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent ) :
m_Size = 5000;
}
PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent, int aShape, int aLayer,
PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent, int aShape, LAYER_NUM aLayer,
const wxPoint& aPos, int aSize, int aWidth ) :
BOARD_ITEM( aParent, PCB_TARGET_T )
{
......
......@@ -51,7 +51,7 @@ public:
// Do not create a copy constructor. The one generated by the compiler is adequate.
PCB_TARGET( BOARD_ITEM* aParent, int aShape, int aLayer,
PCB_TARGET( BOARD_ITEM* aParent, int aShape, LAYER_NUM aLayer,
const wxPoint& aPos, int aSize, int aWidth );
~PCB_TARGET();
......
......@@ -22,9 +22,9 @@
* some layers: external copper, Mask, Paste, and solder
* are swapped between front and back sides
*/
int BOARD::ReturnFlippedLayerNumber( int oldlayer )
LAYER_NUM BOARD::ReturnFlippedLayerNumber( LAYER_NUM oldlayer )
{
int newlayer;
LAYER_NUM newlayer;
switch( oldlayer )
{
......
......@@ -688,7 +688,7 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList )
// see class_pad.h
bool D_PAD::IsOnLayer( int aLayer ) const
bool D_PAD::IsOnLayer( LAYER_NUM aLayer ) const
{
return ::GetLayerMask( aLayer ) & m_layerMask;
}
......
......@@ -345,7 +345,7 @@ public:
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList );
bool IsOnLayer( int aLayer ) const;
bool IsOnLayer( LAYER_NUM aLayer ) const;
bool HitTest( const wxPoint& aPosition );
......
......@@ -240,8 +240,8 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
// when routing tracks
if( frame && frame->GetToolId() == ID_TRACK_BUTT )
{
int routeTop = screen->m_Route_Layer_TOP;
int routeBot = screen->m_Route_Layer_BOTTOM;
LAYER_NUM routeTop = screen->m_Route_Layer_TOP;
LAYER_NUM routeBot = screen->m_Route_Layer_BOTTOM;
// if routing between copper and component layers,
// or the current layer is one of said 2 external copper layers,
......
......@@ -58,11 +58,11 @@ void PCB_LAYER_BOX_SELECTOR::Resync()
static DECLARE_LAYERS_ORDER_LIST( layertranscode );
static DECLARE_LAYERS_HOTKEY( layerhk );
for( int i = 0; i < LAYER_COUNT; i++ )
for( LAYER_NUM i = FIRST_LAYER; i < NB_LAYERS; ++i )
{
wxBitmap layerbmp( 14, 14 );
wxString layername;
int layerid = i;
LAYER_NUM layerid = i;
if( m_layerorder )
layerid = layertranscode[i];
......@@ -83,7 +83,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( int aLayerIndex ) const
bool PCB_LAYER_BOX_SELECTOR::IsLayerEnabled( LAYER_NUM aLayerIndex ) const
{
PCB_BASE_FRAME* pcbFrame = (PCB_BASE_FRAME*) GetParent()->GetParent();
BOARD* board = pcbFrame->GetBoard();
......@@ -94,7 +94,7 @@ bool PCB_LAYER_BOX_SELECTOR::IsLayerEnabled( int aLayerIndex ) const
// Returns a color index from the layer id
EDA_COLOR_T PCB_LAYER_BOX_SELECTOR::GetLayerColor( int aLayerIndex ) const
EDA_COLOR_T PCB_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayerIndex ) const
{
PCB_BASE_FRAME* pcbFrame = (PCB_BASE_FRAME*) GetParent()->GetParent();
BOARD* board = pcbFrame->GetBoard();
......@@ -105,7 +105,7 @@ EDA_COLOR_T PCB_LAYER_BOX_SELECTOR::GetLayerColor( int aLayerIndex ) const
// Returns the name of the layer id
wxString PCB_LAYER_BOX_SELECTOR::GetLayerName( int aLayerIndex ) const
wxString PCB_LAYER_BOX_SELECTOR::GetLayerName( LAYER_NUM aLayerIndex ) const
{
PCB_BASE_FRAME* pcbFrame = (PCB_BASE_FRAME*) GetParent()->GetParent();
BOARD* board = pcbFrame->GetBoard();
......
......@@ -40,34 +40,15 @@ public:
// Returns a color index from the layer id
// Virtual function
EDA_COLOR_T GetLayerColor( int aLayerIndex ) const;
EDA_COLOR_T GetLayerColor( LAYER_NUM aLayerIndex ) const;
// Returns true if the layer id is enabled (i.e. is it should be displayed)
// Virtual function
bool IsLayerEnabled( int aLayerIndex ) const;
bool IsLayerEnabled( LAYER_NUM aLayerIndex ) const;
// Returns the name of the layer id
// Virtual function
wxString GetLayerName( int aLayerIndex ) const;
wxString GetLayerName( LAYER_NUM aLayerIndex ) const;
};
#define DECLARE_LAYERS_HOTKEY(list) int list[LAYER_COUNT] = \
{ \
HK_SWITCH_LAYER_TO_COPPER, \
HK_SWITCH_LAYER_TO_INNER1, \
HK_SWITCH_LAYER_TO_INNER2, \
HK_SWITCH_LAYER_TO_INNER3, \
HK_SWITCH_LAYER_TO_INNER4, \
HK_SWITCH_LAYER_TO_INNER5, \
HK_SWITCH_LAYER_TO_INNER6, \
HK_SWITCH_LAYER_TO_INNER7, \
HK_SWITCH_LAYER_TO_INNER8, \
HK_SWITCH_LAYER_TO_INNER9, \
HK_SWITCH_LAYER_TO_INNER10, \
HK_SWITCH_LAYER_TO_INNER11, \
HK_SWITCH_LAYER_TO_INNER12, \
HK_SWITCH_LAYER_TO_INNER13, \
HK_SWITCH_LAYER_TO_INNER14, \
HK_SWITCH_LAYER_TO_COMPONENT \
};
#endif //CLASS_PCB_PCB_LAYER_BOX_SELECTOR_H
......@@ -151,7 +151,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
for( int row=rowCount-1; row>=0; --row )
{
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 );
int layer = getDecodedId( cb->GetId() );
LAYER_NUM layer = getDecodedId( cb->GetId() );
if( IsValidCopperLayerIndex( layer ) )
{
lastCu = row;
......@@ -162,7 +162,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
for( int row=0; row<rowCount; ++row )
{
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 );
int layer = getDecodedId( cb->GetId() );
LAYER_NUM layer = getDecodedId( cb->GetId() );
if( IsValidCopperLayerIndex( layer ) )
{
......@@ -241,7 +241,7 @@ void PCB_LAYER_WIDGET::SyncLayerVisibilities()
wxWindow* w = getLayerComp( row, 0 );
int layerId = getDecodedId( w->GetId() );
LAYER_NUM layerId = getDecodedId( w->GetId() );
// this does not fire a UI event
SetLayerVisible( layerId, board->IsLayerVisible( layerId ) );
......@@ -252,7 +252,7 @@ void PCB_LAYER_WIDGET::SyncLayerVisibilities()
void PCB_LAYER_WIDGET::ReFill()
{
BOARD* brd = myframe->GetBoard();
int layer;
LAYER_NUM layer;
int enabledLayers = brd->GetEnabledLayers();
......@@ -269,7 +269,7 @@ void PCB_LAYER_WIDGET::ReFill()
brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), _("Front copper layer"), true ) );
}
for( layer = LAYER_N_FRONT-1; layer >= 1; --layer )
for( layer = LAYER_N_FRONT-1; layer >= 1; --layer )
{
if( enabledLayers & GetLayerMask( layer ) )
{
......@@ -287,7 +287,7 @@ void PCB_LAYER_WIDGET::ReFill()
// technical layers are shown in this order:
static const struct {
int layerId;
LAYER_NUM layerId;
wxString tooltip;
} techLayerSeq[] = {
{ ADHESIVE_N_FRONT, _( "Adhesive on board's front" ) },
......@@ -324,7 +324,7 @@ void PCB_LAYER_WIDGET::ReFill()
//-----<LAYER_WIDGET callbacks>-------------------------------------------
void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, EDA_COLOR_T aColor )
void PCB_LAYER_WIDGET::OnLayerColorChange( LAYER_NUM aLayer, EDA_COLOR_T aColor )
{
myframe->GetBoard()->SetLayerColor( aLayer, aColor );
myframe->ReCreateLayerBox( NULL );
......@@ -332,7 +332,7 @@ void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, EDA_COLOR_T aColor )
}
bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer )
bool PCB_LAYER_WIDGET::OnLayerSelect( LAYER_NUM aLayer )
{
// the layer change from the PCB_LAYER_WIDGET can be denied by returning
// false from this function.
......@@ -345,7 +345,7 @@ bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer )
}
void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal )
void PCB_LAYER_WIDGET::OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal )
{
BOARD* brd = myframe->GetBoard();
......
......@@ -82,9 +82,9 @@ public:
void SetLayersManagerTabsText();
//-----<implement LAYER_WIDGET abstract callback functions>-----------
void OnLayerColorChange( int aLayer, EDA_COLOR_T aColor );
bool OnLayerSelect( int aLayer );
void OnLayerVisible( int aLayer, bool isVisible, bool isFinal );
void OnLayerColorChange( LAYER_NUM aLayer, EDA_COLOR_T aColor );
bool OnLayerSelect( LAYER_NUM aLayer );
void OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal );
void OnRenderColorChange( int aId, EDA_COLOR_T aColor );
void OnRenderEnable( int aId, bool isEnabled );
//-----</implement LAYER_WIDGET abstract callback functions>----------
......
......@@ -71,7 +71,7 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) :
{
m_Pos = module->GetPosition();
int moduleLayer = module->GetLayer();
LAYER_NUM moduleLayer = module->GetLayer();
if( moduleLayer == LAYER_N_BACK )
SetLayer( SILKSCREEN_N_BACK );
......@@ -397,7 +397,7 @@ void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
BOARD* board = NULL;
board = (BOARD*) module->GetParent();
if( m_Layer < NB_LAYERS && board )
if( m_Layer < NB_PCB_LAYERS && board )
msg = board->GetLayerName( m_Layer );
else
msg.Printf( wxT( "%d" ), m_Layer );
......@@ -426,7 +426,7 @@ void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
// see class_text_mod.h
bool TEXTE_MODULE::IsOnLayer( int aLayer ) const
bool TEXTE_MODULE::IsOnLayer( LAYER_NUM aLayer ) const
{
if( m_Layer == aLayer )
return true;
......
......@@ -130,7 +130,7 @@ public:
bool HitTest( const wxPoint& aPosition );
bool IsOnLayer( int aLayer ) const;
bool IsOnLayer( LAYER_NUM aLayer ) const;
wxString GetClass() const
......
......@@ -222,8 +222,8 @@ wxString SEGVIA::GetSelectMenuText() const
if( shape != VIA_THROUGH )
{
// say which layers, only two for now
int topLayer;
int botLayer;
LAYER_NUM topLayer;
LAYER_NUM botLayer;
ReturnLayerPair( &topLayer, &botLayer );
text << _( " on " ) << board->GetLayerName( topLayer ).Trim() << wxT( " <-> " )
<< board->GetLayerName( botLayer ).Trim();
......@@ -416,9 +416,9 @@ SEARCH_RESULT TRACK::Visit( INSPECTOR* inspector, const void* testData,
}
bool SEGVIA::IsOnLayer( int layer_number ) const
bool SEGVIA::IsOnLayer( LAYER_NUM layer_number ) const
{
int bottom_layer, top_layer;
LAYER_NUM bottom_layer, top_layer;
ReturnLayerPair( &top_layer, &bottom_layer );
......@@ -440,7 +440,7 @@ LAYER_MSK TRACK::GetLayerMask() const
// VIA_BLIND_BURIED or VIA_MICRVIA:
int bottom_layer, top_layer;
LAYER_NUM bottom_layer, top_layer;
// ReturnLayerPair() knows how layers are stored
( (SEGVIA*) this )->ReturnLayerPair( &top_layer, &bottom_layer );
......@@ -462,7 +462,7 @@ LAYER_MSK TRACK::GetLayerMask() const
}
void SEGVIA::SetLayerPair( int top_layer, int bottom_layer )
void SEGVIA::SetLayerPair( LAYER_NUM top_layer, LAYER_NUM bottom_layer )
{
if( GetShape() == VIA_THROUGH )
{
......@@ -473,17 +473,19 @@ void SEGVIA::SetLayerPair( int top_layer, int bottom_layer )
if( bottom_layer > top_layer )
EXCHG( bottom_layer, top_layer );
// XXX EVIL usage of LAYER
m_Layer = (top_layer & 15) + ( (bottom_layer & 15) << 4 );
}
void SEGVIA::ReturnLayerPair( int* top_layer, int* bottom_layer ) const
void SEGVIA::ReturnLayerPair( LAYER_NUM* top_layer, LAYER_NUM* bottom_layer ) const
{
int b_layer = LAYER_N_BACK;
int t_layer = LAYER_N_FRONT;
LAYER_NUM b_layer = LAYER_N_BACK;
LAYER_NUM t_layer = LAYER_N_FRONT;
if( GetShape() != VIA_THROUGH )
{
// XXX EVIL usage of LAYER
b_layer = (m_Layer >> 4) & 15;
t_layer = m_Layer & 15;
......@@ -586,7 +588,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
{
int l_trace;
int radius;
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
if( Type() == PCB_ZONE_T && DisplayOpt.DisplayZonesMode != 0 )
return;
......@@ -751,7 +753,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
const wxPoint& aOffset )
{
int radius;
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
int fillvia = 0;
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent();
......@@ -906,7 +908,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
if( GetShape() == VIA_BLIND_BURIED )
{
int ax = 0, ay = radius, bx = 0, by = drill_radius;
int layer_top, layer_bottom;
LAYER_NUM layer_top, layer_bottom;
( (SEGVIA*) this )->ReturnLayerPair( &layer_top, &layer_bottom );
......@@ -1114,7 +1116,7 @@ void TRACK::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
if( Type() == PCB_VIA_T )
{
SEGVIA* Via = (SEGVIA*) this;
int top_layer, bottom_layer;
LAYER_NUM top_layer, bottom_layer;
Via->ReturnLayerPair( &top_layer, &bottom_layer );
msg = board->GetLayerName( top_layer ) + wxT( "/" ) + board->GetLayerName( bottom_layer );
......@@ -1191,7 +1193,7 @@ bool TRACK::HitTest( const EDA_RECT& aRect ) const
}
TRACK* TRACK::GetVia( const wxPoint& aPosition, int aLayer )
TRACK* TRACK::GetVia( const wxPoint& aPosition, LAYER_NUM aLayer)
{
TRACK* track;
......@@ -1206,7 +1208,7 @@ TRACK* TRACK::GetVia( const wxPoint& aPosition, int aLayer )
if( track->GetState( BUSY | IS_DELETED ) )
continue;
if( aLayer < 0 )
if( aLayer == UNDEFINED_LAYER )
break;
if( track->IsOnLayer( aLayer ) )
......@@ -1580,8 +1582,8 @@ void SEGVIA::Show( int nestLevel, std::ostream& os ) const
break;
}
int topLayer;
int botLayer;
LAYER_NUM topLayer;
LAYER_NUM botLayer;
BOARD* board = (BOARD*) m_Parent;
......
......@@ -268,7 +268,7 @@ public:
* @param aLayer The layer to match, pass -1 for a don't care.
* @return A pointer to a SEGVIA object if found, else NULL.
*/
TRACK* GetVia( const wxPoint& aPosition, int aLayer = -1 );
TRACK* GetVia( const wxPoint& aPosition, LAYER_NUM aLayer = UNDEFINED_LAYER );
/**
* Function GetVia
......@@ -377,7 +377,7 @@ public:
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
GR_DRAWMODE aDrawMode, const wxPoint& aOffset = ZeroOffset );
bool IsOnLayer( int aLayer ) const;
bool IsOnLayer( LAYER_NUM aLayer ) const;
/**
* Function SetLayerPair
......@@ -389,7 +389,7 @@ public:
* @param top_layer = first layer connected by the via
* @param bottom_layer = last layer connected by the via
*/
void SetLayerPair( int top_layer, int bottom_layer );
void SetLayerPair( LAYER_NUM top_layer, LAYER_NUM bottom_layer );
/**
* Function ReturnLayerPair
......@@ -398,7 +398,7 @@ public:
* @param top_layer = pointer to the first layer (can be null)
* @param bottom_layer = pointer to the last layer (can be null)
*/
void ReturnLayerPair( int* top_layer, int* bottom_layer ) const;
void ReturnLayerPair( LAYER_NUM* top_layer, LAYER_NUM* bottom_layer ) const;
const wxPoint& GetPosition() const { return m_Start; } // was overload
void SetPosition( const wxPoint& aPoint ) { m_Start = aPoint; m_End = aPoint; } // was overload
......
......@@ -170,7 +170,7 @@ void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE aDrawMod
return;
wxPoint seg_start, seg_end;
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
BOARD* brd = GetBoard();
EDA_COLOR_T color = brd->GetLayerColor( m_Layer );
......@@ -255,7 +255,7 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
return;
BOARD* brd = GetBoard();
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
EDA_COLOR_T color = brd->GetLayerColor( m_Layer );
if( brd->IsLayerVisible( m_Layer ) == false && ( color & HIGHLIGHT_FLAG ) != HIGHLIGHT_FLAG )
......@@ -400,7 +400,7 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC,
if( DC == NULL )
return;
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
BOARD* brd = GetBoard();
EDA_COLOR_T color = brd->GetLayerColor( m_Layer );
......
......@@ -183,7 +183,7 @@ public:
*/
bool IsOnCopperLayer( void ) const
{
return ( GetLayer() < FIRST_NO_COPPER_LAYER ) ? true : false;
return ( GetLayer() < FIRST_NON_COPPER_LAYER ) ? true : false;
}
/**
......
......@@ -44,7 +44,7 @@ ZONE_SETTINGS::ZONE_SETTINGS()
// Min thickness value in filled areas (this is the minimum width of copper to fill solid areas) :
m_ZoneMinThickness = Mils2iu( ZONE_THICKNESS_MIL );
m_NetcodeSelection = 0; // Net code selection for the current zone
m_CurrentZone_Layer = 0; // Layer used to create the current zone
m_CurrentZone_Layer = FIRST_LAYER; // Layer used to create the current zone
m_Zone_HatchingStyle = CPolyLine::DIAGONAL_EDGE; // Option to show the zone area (outlines only, short hatches or full hatches
m_ArcToSegmentsCount = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF; // Option to select number of segments to approximate a circle
......
......@@ -39,7 +39,7 @@ public:
int m_ZoneClearance; ///< Clearance value
int m_ZoneMinThickness; ///< Min thickness value in filled areas
int m_NetcodeSelection; ///< Net code selection for the current zone
int m_CurrentZone_Layer; ///< Layer used to create the current zone
LAYER_NUM m_CurrentZone_Layer; ///< Layer used to create the current zone
/// Option to show the zone area (outlines only, short hatches or full hatches
int m_Zone_HatchingStyle;
......
......@@ -182,7 +182,7 @@ void TRACKS_CLEANER::buildTrackConnectionInfo()
track->start = NULL;
track->end = NULL;
track->m_PadsConnected.clear();
track->SetState( START_ON_PAD|END_ON_PAD|BUSY, OFF );
track->SetState( START_ON_PAD|END_ON_PAD|BUSY, false );
}
// Build connections info tracks to pads
......@@ -197,13 +197,13 @@ void TRACKS_CLEANER::buildTrackConnectionInfo()
if( pad->HitTest( track->GetStart() ) )
{
track->start = pad;
track->SetState( START_ON_PAD, ON );
track->SetState( START_ON_PAD, true );
}
if( pad->HitTest( track->GetEnd() ) )
{
track->end = pad;
track->SetState( END_ON_PAD, ON );
track->SetState( END_ON_PAD, true );
}
}
}
......@@ -309,7 +309,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
// For via test, an enhancement could be to test if connected
// to 2 items on different layers.
// Currently a via must be connected to 2 items, that can be on the same layer
int top_layer, bottom_layer;
LAYER_NUM top_layer, bottom_layer;
ZONE_CONTAINER* zone;
if( (type_end & START_ON_PAD ) == 0 )
......
......@@ -350,7 +350,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
if( item->IsOnLayer( m_Guide->GetPreferredLayer() ) || m_Guide->IgnorePreferredLayer() )
{
int layer = item->GetLayer();
LAYER_NUM layer = item->GetLayer();
// Modules and their subcomponents: text and pads are not sensitive to the layer
// visibility controls. They all have their own separate visibility controls
......@@ -378,7 +378,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
// no effect on other criteria, since there is a separate "ignore" control for
// those in the COLLECTORS_GUIDE
int layer = item->GetLayer();
LAYER_NUM layer = item->GetLayer();
// Modules and their subcomponents: text and pads are not sensitive to the layer
// visibility controls. They all have their own separate visibility controls
......
......@@ -71,13 +71,13 @@ public:
* Function IsLayerLocked
* @return bool - true if the given layer is locked, else false.
*/
virtual bool IsLayerLocked( int layer ) const = 0;
virtual bool IsLayerLocked( LAYER_NUM layer ) const = 0;
/**
* Function IsLayerVisible
* @return bool - true if the given layer is visible, else false.
*/
virtual bool IsLayerVisible( int layer ) const = 0;
virtual bool IsLayerVisible( LAYER_NUM layer ) const = 0;
/**
* Function IgnoreLockedLayers
......@@ -95,7 +95,7 @@ public:
* Function GetPreferredLayer
* @return int - the preferred layer for HitTest()ing.
*/
virtual int GetPreferredLayer() const = 0;
virtual LAYER_NUM GetPreferredLayer() const = 0;
/**
* Function IgnorePreferredLayer
......@@ -376,7 +376,7 @@ private:
// the storage architecture here is not important, since this is only
// a carrier object and its functions are what is used, and data only indirectly.
int m_PreferredLayer;
LAYER_NUM m_PreferredLayer;
bool m_IgnorePreferredLayer;
LAYER_MSK m_LayerLocked; ///< bit-mapped layer locked bits
......@@ -407,7 +407,7 @@ public:
* @param aVisibleLayerMask = current visible layers (bit mask)
* @param aPreferredLayer = the layer to search first
*/
GENERAL_COLLECTORS_GUIDE( LAYER_MSK aVisibleLayerMask, int aPreferredLayer )
GENERAL_COLLECTORS_GUIDE( LAYER_MSK aVisibleLayerMask, LAYER_NUM aPreferredLayer )
{
m_PreferredLayer = LAYER_N_FRONT;
m_IgnorePreferredLayer = false;
......@@ -443,11 +443,11 @@ public:
* Function IsLayerLocked
* @return bool - true if the given layer is locked, else false.
*/
bool IsLayerLocked( int aLayer ) const
bool IsLayerLocked( LAYER_NUM aLayer ) const
{
return GetLayerMask( aLayer ) & m_LayerLocked;
}
void SetLayerLocked( int aLayer, bool isLocked )
void SetLayerLocked( LAYER_NUM aLayer, bool isLocked )
{
if( isLocked )
m_LayerLocked |= GetLayerMask( aLayer );
......@@ -460,11 +460,11 @@ public:
* Function IsLayerVisible
* @return bool - true if the given layer is visible, else false.
*/
bool IsLayerVisible( int aLayer ) const
bool IsLayerVisible( LAYER_NUM aLayer ) const
{
return GetLayerMask( aLayer ) & m_LayerVisible;
}
void SetLayerVisible( int aLayer, bool isVisible )
void SetLayerVisible( LAYER_NUM aLayer, bool isVisible )
{
if( isVisible )
m_LayerVisible |= GetLayerMask( aLayer );
......@@ -494,8 +494,8 @@ public:
* Function GetPreferredLayer
* @return int - the preferred layer for HitTest()ing.
*/
int GetPreferredLayer() const { return m_PreferredLayer; }
void SetPreferredLayer( int aLayer ) { m_PreferredLayer = aLayer; }
LAYER_NUM GetPreferredLayer() const { return m_PreferredLayer; }
void SetPreferredLayer( LAYER_NUM aLayer ) { m_PreferredLayer = aLayer; }
/**
......
......@@ -53,7 +53,7 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack )
{
if( g_CurrentTrackList.GetCount() > 0 )
{
int previous_layer = getActiveLayer();
LAYER_NUM previous_layer = getActiveLayer();
D( g_CurrentTrackList.VerifyListIntegrity(); )
......@@ -216,7 +216,7 @@ void PCB_EDIT_FRAME::Remove_One_Track( wxDC* DC, TRACK* pt_segm )
tracksegment->SetState( BUSY, false );
D( std::cout << __func__ << ": track " << tracksegment << " status=" \
<< TO_UTF8( TRACK::ShowState( tracksegment->GetState( -1 ) ) ) \
<< TO_UTF8( TRACK::ShowState( tracksegment->GetStatus() ) ) \
<< std::endl; )
GetBoard()->m_Track.Remove( tracksegment );
......
......@@ -103,8 +103,8 @@ void DIALOG_SVG_PRINT::initDialog()
ReturnStringFromValue( g_UserUnit, g_DrawDefaultLineThickness ) );
// Create layers list
int layer;
for( layer = 0; layer < NB_LAYERS; ++layer )
LAYER_NUM layer;
for( layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer )
{
if( !m_board->IsLayerEnabled( layer ) )
m_boxSelectLayer[layer] = NULL;
......@@ -118,7 +118,7 @@ void DIALOG_SVG_PRINT::initDialog()
// (Front or Top to Back or Bottom)
DECLARE_LAYERS_ORDER_LIST( layersOrder );
for( int layer_idx = 0; layer_idx < NB_LAYERS; ++layer_idx )
for( LAYER_NUM layer_idx = FIRST_LAYER; layer_idx < NB_LAYERS; ++layer_idx )
{
layer = layersOrder[layer_idx];
......@@ -132,7 +132,7 @@ void DIALOG_SVG_PRINT::initDialog()
if( mask & s_SelectedLayers )
m_boxSelectLayer[layer]->SetValue( true );
if( layer < 16 )
if( layer <= LAST_COPPER_LAYER )
m_CopperLayersBoxSizer->Add( m_boxSelectLayer[layer],
0,
wxGROW | wxALL,
......@@ -148,7 +148,7 @@ void DIALOG_SVG_PRINT::initDialog()
{
wxString layerKey;
for( int layer = 0; layer<NB_LAYERS; ++layer )
for( LAYER_NUM layer = FIRST_LAYER; layer < NB_LAYERS; ++layer )
{
bool option;
......@@ -237,14 +237,14 @@ void DIALOG_SVG_PRINT::ExportSVGFile( bool aOnlyOneFile )
// Build layers mask
LAYER_MSK printMaskLayer = NO_LAYERS;
for( int layer = 0; layer<NB_LAYERS; layer++ )
for( LAYER_NUM layer = FIRST_LAYER; layer < NB_LAYERS; ++layer )
{
if( m_boxSelectLayer[layer] && m_boxSelectLayer[layer]->GetValue() )
printMaskLayer |= 1 << layer;
printMaskLayer |= GetLayerMask( layer );
}
wxString msg;
for( int layer = 0; layer<NB_LAYERS; layer++ )
for( LAYER_NUM layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer )
{
LAYER_MSK currlayer_mask = GetLayerMask( layer );
if( (printMaskLayer & currlayer_mask ) == 0 )
......@@ -363,7 +363,7 @@ void DIALOG_SVG_PRINT::OnCloseWindow( wxCloseEvent& event )
wxString layerKey;
for( int layer = 0; layer<NB_LAYERS; ++layer )
for( LAYER_NUM layer = FIRST_LAYER; layer<NB_LAYERS; ++layer )
{
if( m_boxSelectLayer[layer] == NULL )
continue;
......
......@@ -43,7 +43,7 @@
#include <wx/imaglist.h> // needed for wx/listctrl.h, in wxGTK 2.8.12
#include <wx/listctrl.h>
#include <layers_id_colors_and_visibility.h>
/**
......@@ -70,7 +70,7 @@ private:
///< true = pad count sort.
long m_NetFiltering;
std::vector<int> m_LayerId; ///< Handle the real layer number from layer
std::vector<LAYER_NUM> m_LayerId; ///< Handle the real layer number from layer
///< name position in m_LayerSelectionCtrl
static wxString m_netNameShowFilter; ///< the filter to show nets (default * "*").
......@@ -250,9 +250,9 @@ void DIALOG_COPPER_ZONE::initDialog()
int layerCount = board->GetCopperLayerCount();
wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL );
for( int ii = 0; ii < layerCount; ii++ )
for( LAYER_NUM ii = FIRST_LAYER; ii < layerCount; ++ii )
{
int layerNumber = LAYER_N_BACK;
LAYER_NUM layerNumber = LAYER_N_BACK;
if( layerCount <= 1 || ii < layerCount - 1 )
layerNumber = ii;
......
......@@ -22,7 +22,7 @@ DIALOG_GLOBAL_DELETION::DIALOG_GLOBAL_DELETION( PCB_EDIT_FRAME* parent )
: DIALOG_GLOBAL_DELETION_BASE( parent )
{
m_Parent = parent;
m_currentLayer = 0;
m_currentLayer = FIRST_LAYER;
m_TrackFilterAR->Enable( m_DelTracks->GetValue() );
m_TrackFilterLocked->Enable( m_DelTracks->GetValue() );
m_TrackFilterNormal->Enable( m_DelTracks->GetValue() );
......@@ -42,7 +42,7 @@ void PCB_EDIT_FRAME::InstallPcbGlobalDeleteFrame( const wxPoint& pos )
dlg.ShowModal();
}
void DIALOG_GLOBAL_DELETION::SetCurrentLayer( int aLayer )
void DIALOG_GLOBAL_DELETION::SetCurrentLayer( LAYER_NUM aLayer )
{
m_currentLayer = aLayer;
m_textCtrlCurrLayer->SetValue( m_Parent->GetBoard()->GetLayerName( aLayer ) );
......
......@@ -11,11 +11,11 @@ class DIALOG_GLOBAL_DELETION: public DIALOG_GLOBAL_DELETION_BASE
{
private:
PCB_EDIT_FRAME * m_Parent;
int m_currentLayer;
LAYER_NUM m_currentLayer;
public:
DIALOG_GLOBAL_DELETION( PCB_EDIT_FRAME* parent );
void SetCurrentLayer( int aLayer );
void SetCurrentLayer( LAYER_NUM aLayer );
private:
void OnOkClick( wxCommandEvent& event )
......
......@@ -156,18 +156,18 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::initDlg( )
PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness );
for( int layer=FIRST_NO_COPPER_LAYER; layer <= LAST_NO_COPPER_LAYER; ++layer )
for( LAYER_NUM layer=FIRST_NON_COPPER_LAYER; layer <= LAST_NON_COPPER_LAYER; ++layer )
{
m_LayerSelectionCtrl->Append( m_parent->GetBoard()->GetLayerName( layer ) );
}
int layer = m_Item->GetLayer();
LAYER_NUM layer = m_Item->GetLayer();
// Control:
if ( layer < FIRST_NO_COPPER_LAYER )
layer = FIRST_NO_COPPER_LAYER;
if ( layer > LAST_NO_COPPER_LAYER )
layer = LAST_NO_COPPER_LAYER;
m_LayerSelectionCtrl->SetSelection( layer - FIRST_NO_COPPER_LAYER );
if ( layer < FIRST_NON_COPPER_LAYER )
layer = FIRST_NON_COPPER_LAYER;
if ( layer > LAST_NON_COPPER_LAYER )
layer = LAST_NON_COPPER_LAYER;
m_LayerSelectionCtrl->SetSelection( layer - FIRST_NON_COPPER_LAYER );
}
......@@ -177,7 +177,7 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnLayerChoice( wxCommandEvent& event )
{
int thickness;
if( (m_LayerSelectionCtrl->GetCurrentSelection() + FIRST_NO_COPPER_LAYER) == EDGE_N )
if( (m_LayerSelectionCtrl->GetCurrentSelection() + FIRST_NON_COPPER_LAYER) == EDGE_N )
thickness = m_brdSettings.m_EdgeSegmentWidth;
else
thickness = m_brdSettings.m_DrawSegmentWidth;
......@@ -216,7 +216,7 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event )
msg = m_DefaultThicknessCtrl->GetValue();
int thickness = ReturnValueFromString( g_UserUnit, msg );
m_Item->SetLayer( m_LayerSelectionCtrl->GetCurrentSelection() + FIRST_NO_COPPER_LAYER);
m_Item->SetLayer( FIRST_NON_COPPER_LAYER + m_LayerSelectionCtrl->GetCurrentSelection() );
if( m_Item->GetLayer() == EDGE_N )
m_brdSettings.m_EdgeSegmentWidth = thickness;
......
......@@ -32,7 +32,7 @@ private:
EDGE_MODULE* m_item;
BOARD_DESIGN_SETTINGS m_brdSettings;
MODULE * m_module;
std::vector<int> m_layerId; // the layer Id with the same order as m_LayerSelectionCtrl widget
std::vector<LAYER_NUM> m_layerId; // the layer Id with the same order as m_LayerSelectionCtrl widget
public:
DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES( FOOTPRINT_EDIT_FRAME* aParent,
......@@ -155,7 +155,7 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::initDlg()
m_layerId.push_back( LAYER_N_BACK );
m_LayerSelectionCtrl->Append( m_parent->GetBoard()->GetLayerName( LAYER_N_FRONT ) );
m_layerId.push_back( LAYER_N_FRONT );
for( int layer = FIRST_NO_COPPER_LAYER; layer <= LAST_NO_COPPER_LAYER; ++layer )
for( LAYER_NUM layer = FIRST_NON_COPPER_LAYER; layer <= LAST_NON_COPPER_LAYER; ++layer )
{
if( layer == EDGE_N )
// Do not use pcb edge layer for footprints, this is a special layer
......@@ -195,7 +195,7 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event )
return;
}
int layer = m_layerId[idx];
LAYER_NUM layer = m_layerId[idx];
if( IsValidCopperLayerIndex( layer ) )
{
/* an edge is put on a copper layer, and it is very dangerous. a
......
......@@ -60,7 +60,7 @@ private:
ZONE_SETTINGS m_zonesettings;
ZONE_SETTINGS* m_ptr;
std::vector<int> m_layerId; ///< Handle the real layer number from layer
std::vector<LAYER_NUM> m_layerId; ///< Handle the real layer number from layer
///< name position in m_LayerSelectionCtrl
/**
......@@ -153,7 +153,7 @@ void DIALOG_KEEPOUT_AREA_PROPERTIES::initDialog()
m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL );
for( int ii = 0; ii < layerCount; ii++ )
{
int layerNumber = LAYER_N_BACK;
LAYER_NUM layerNumber = LAYER_N_BACK;
if( layerCount <= 1 || ii < layerCount - 1 )
layerNumber = ii;
......
......@@ -85,7 +85,7 @@ private:
wxStaticText* m_TypeStaticText;
void setLayerCheckBox( int layer, bool isChecked );
void setLayerCheckBox( LAYER_NUM layer, bool isChecked );
void setCopperLayerCheckBoxes( int copperCount );
void showCopperChoice( int copperCount );
......@@ -96,8 +96,8 @@ private:
/** return the selected layer mask within the UI checkboxes */
LAYER_MSK getUILayerMask();
wxString getLayerName( int layer );
int getLayerTypeIndex( int layer );
wxString getLayerName( LAYER_NUM layer );
int getLayerTypeIndex( LAYER_NUM layer );
void OnCancelButtonClick( wxCommandEvent& event );
......@@ -114,19 +114,19 @@ private:
* maps \a aLayerNumber to the wx IDs for that layer which are
* the layer name control ID, checkbox control ID, and choice control ID
*/
CTLs getCTLs( int aLayerNumber );
CTLs getCTLs( LAYER_NUM aLayerNumber );
wxControl* getName( int aLayer )
wxControl* getName( LAYER_NUM aLayer )
{
return getCTLs( aLayer ).name;
}
wxCheckBox* getCheckBox( int aLayer )
wxCheckBox* getCheckBox( LAYER_NUM aLayer )
{
return getCTLs( aLayer ).checkbox;
}
wxChoice* getChoice( int aLayer )
wxChoice* getChoice( LAYER_NUM aLayer )
{
return (wxChoice*) getCTLs( aLayer ).choice;
}
......@@ -198,7 +198,7 @@ static const LAYER_MSK presets[] =
};
CTLs DIALOG_LAYERS_SETUP::getCTLs( int aLayerNumber )
CTLs DIALOG_LAYERS_SETUP::getCTLs( LAYER_NUM aLayerNumber )
{
#define RETCOP(x) return CTLs( x##Name, x##CheckBox, x##Choice, x##Panel );
#define RETAUX(x) return CTLs( x##Name, x##CheckBox, x##StaticText, x##Panel );
......@@ -327,7 +327,7 @@ void DIALOG_LAYERS_SETUP::showBoardLayerNames()
// obtaining them from BOARD::GetLayerName() which calls
// BOARD::GetStandardLayerName() for non-coppers.
for( int layer=0; layer<NB_LAYERS; ++layer )
for( LAYER_NUM layer=FIRST_LAYER; layer<NB_PCB_LAYERS; ++layer )
{
wxControl* ctl = getName( layer );
......@@ -350,7 +350,7 @@ void DIALOG_LAYERS_SETUP::showBoardLayerNames()
void DIALOG_LAYERS_SETUP::showSelectedLayerCheckBoxes( LAYER_MSK enabledLayers )
{
for( int layer=0; layer<NB_LAYERS; ++layer )
for( LAYER_NUM layer=FIRST_LAYER; layer<NB_PCB_LAYERS; ++layer )
{
setLayerCheckBox( layer, GetLayerMask( layer ) & enabledLayers );
}
......@@ -376,7 +376,7 @@ void DIALOG_LAYERS_SETUP::showPresets( LAYER_MSK enabledLayers )
void DIALOG_LAYERS_SETUP::showLayerTypes()
{
for( int copperLayer = FIRST_COPPER_LAYER;
for( LAYER_NUM copperLayer = FIRST_COPPER_LAYER;
copperLayer <= LAST_COPPER_LAYER; ++copperLayer )
{
wxChoice* ctl = getChoice( copperLayer );
......@@ -389,7 +389,7 @@ LAYER_MSK DIALOG_LAYERS_SETUP::getUILayerMask()
{
LAYER_MSK layerMaskResult = NO_LAYERS;
for( int layer=0; layer<NB_LAYERS; ++layer )
for( LAYER_NUM layer=FIRST_LAYER; layer<NB_PCB_LAYERS; ++layer )
{
wxCheckBox* ctl = getCheckBox( layer );
if( ctl->GetValue() )
......@@ -402,7 +402,7 @@ LAYER_MSK DIALOG_LAYERS_SETUP::getUILayerMask()
}
void DIALOG_LAYERS_SETUP::setLayerCheckBox( int aLayer, bool isChecked )
void DIALOG_LAYERS_SETUP::setLayerCheckBox( LAYER_NUM aLayer, bool isChecked )
{
wxCheckBox* ctl = getCheckBox( aLayer );
ctl->SetValue( isChecked );
......@@ -427,8 +427,7 @@ void DIALOG_LAYERS_SETUP::setCopperLayerCheckBoxes( int copperCount )
setLayerCheckBox( LAYER_N_FRONT, false );
}
int layer;
for( layer=LAYER_N_2; layer < NB_COPPER_LAYERS-1; ++layer, --copperCount )
for( LAYER_NUM layer=LAYER_N_2; layer < NB_COPPER_LAYERS-1; ++layer, --copperCount )
{
bool state = copperCount > 0;
......@@ -548,10 +547,10 @@ void DIALOG_LAYERS_SETUP::OnOkButtonClick( wxCommandEvent& event )
*/
m_Pcb->SetVisibleLayers( m_EnabledLayers );
for( int layer = FIRST_COPPER_LAYER;
for( LAYER_NUM layer = FIRST_COPPER_LAYER;
layer <= LAST_COPPER_LAYER; ++layer )
{
if( (1<<layer) & m_EnabledLayers )
if( GetLayerMask( layer ) & m_EnabledLayers )
{
name = getLayerName( layer );
......@@ -571,7 +570,7 @@ void DIALOG_LAYERS_SETUP::OnOkButtonClick( wxCommandEvent& event )
}
}
int DIALOG_LAYERS_SETUP::getLayerTypeIndex( int aLayer )
int DIALOG_LAYERS_SETUP::getLayerTypeIndex( LAYER_NUM aLayer )
{
wxChoice* ctl = getChoice( aLayer );
......@@ -580,7 +579,7 @@ int DIALOG_LAYERS_SETUP::getLayerTypeIndex( int aLayer )
return ret;
}
wxString DIALOG_LAYERS_SETUP::getLayerName( int aLayer )
wxString DIALOG_LAYERS_SETUP::getLayerName( LAYER_NUM aLayer )
{
wxString ret;
......@@ -607,10 +606,10 @@ bool DIALOG_LAYERS_SETUP::testLayerNames()
wxTextCtrl* ctl;
for( int layer=0; layer<=LAST_COPPER_LAYER; ++layer )
for( LAYER_NUM layer=FIRST_LAYER; layer<=LAST_COPPER_LAYER; ++layer )
{
// we _can_ rely on m_EnabledLayers being current here:
if( !(m_EnabledLayers & (1<<layer)) )
if( !(m_EnabledLayers & GetLayerMask( layer )) )
continue;
wxString name = getLayerName( layer );
......@@ -677,16 +676,16 @@ void PCB_EDIT_FRAME::InstallDialogLayerSetup()
// If the current active layer was removed, find the next avaiable layer to set as the
// active layer.
if( ( ( 1 << getActiveLayer() ) & GetBoard()->GetEnabledLayers() ) == 0 )
if( !( GetLayerMask( getActiveLayer() ) & GetBoard()->GetEnabledLayers() ) )
{
for( int i = 0; i < LAYER_COUNT; i++ )
for( LAYER_NUM i = FIRST_LAYER; i < NB_LAYERS; ++i )
{
int tmp = i;
LAYER_NUM tmp = i;
if( i >= LAYER_COUNT )
tmp = i - LAYER_COUNT;
if( i >= NB_LAYERS )
tmp = i - NB_LAYERS;
if( ( 1 << tmp ) & GetBoard()->GetEnabledLayers() )
if( GetLayerMask( tmp ) & GetBoard()->GetEnabledLayers() )
{
wxLogDebug( wxT( "Setting current layer to %d." ), getActiveLayer() );
setActiveLayer( tmp, true );
......
......@@ -56,7 +56,7 @@ private:
PCB_EDIT_FRAME* m_Parent;
wxDC* m_DC;
TEXTE_PCB* m_SelectedPCBText;
std::vector<int> layerList;
std::vector<LAYER_NUM> layerList;
void MyInit();
......@@ -128,7 +128,7 @@ void DIALOG_PCB_TEXT_PROPERTIES::MyInit()
LAYER_MSK enabledLayers = m_Parent->GetBoard()->GetEnabledLayers();
for( int layer = 0; layer < NB_LAYERS; ++layer )
for( LAYER_NUM layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer )
{
if( enabledLayers & GetLayerMask( layer ) )
{
......
......@@ -148,7 +148,8 @@ void DIALOG_PLOT::Init_Dialog()
// List layers in same order than in setup layers dialog
// (Front or Top to Back or Bottom)
DECLARE_LAYERS_ORDER_LIST( layersOrder );
int layerIndex, checkIndex, layer;
int layerIndex, checkIndex;
LAYER_NUM layer;
for( layerIndex = 0; layerIndex < NB_LAYERS; layerIndex++ )
{
......
......@@ -144,16 +144,16 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( PCB_EDIT_FRAME* parent )
void DIALOG_PRINT_USING_PRINTER::InitValues( )
{
int layer_max = NB_LAYERS;
LAYER_NUM layer_max = NB_PCB_LAYERS;
wxString msg;
BOARD* board = m_parent->GetBoard();
s_Parameters.m_PageSetupData = s_pageSetupData;
// Create layer list.
int layer;
LAYER_NUM layer;
wxString layerKey;
for( layer = 0; layer < NB_LAYERS; ++layer )
for( layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer )
{
if( !board->IsLayerEnabled( layer ) )
m_BoxSelectLayer[layer] = NULL;
......@@ -166,16 +166,16 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
// List layers in same order than in setup layers dialog
// (Front or Top to Back or Bottom)
DECLARE_LAYERS_ORDER_LIST(layersOrder);
for( int layer_idx = 0; layer_idx < NB_LAYERS; ++layer_idx )
for( LAYER_NUM layer_idx = FIRST_LAYER; layer_idx < NB_PCB_LAYERS; ++layer_idx )
{
layer = layersOrder[layer_idx];
wxASSERT(layer < NB_LAYERS);
wxASSERT(layer < NB_PCB_LAYERS);
if( m_BoxSelectLayer[layer] == NULL )
continue;
if( layer < NB_COPPER_LAYERS )
if( layer <= LAST_COPPER_LAYER )
m_CopperLayersBoxSizer->Add( m_BoxSelectLayer[layer],
0, wxGROW | wxALL, 1 );
else
......@@ -280,11 +280,10 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection()
{
int page_count;
int layers_count = NB_LAYERS;
s_Parameters.m_PrintMaskLayer = NO_LAYERS;
int ii;
for( ii = 0, page_count = 0; ii < layers_count; ii++ )
LAYER_NUM ii;
for( ii = FIRST_LAYER, page_count = 0; ii < NB_PCB_LAYERS; ++ii )
{
if( m_BoxSelectLayer[ii] == NULL )
continue;
......@@ -324,7 +323,7 @@ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
m_config->Write( OPTKEY_PRINT_PAGE_PER_LAYER, s_Parameters.m_OptionPrintPage );
m_config->Write( OPTKEY_PRINT_PADS_DRILL, (long) s_Parameters.m_DrillShapeOpt );
wxString layerKey;
for( int layer = 0; layer < NB_LAYERS; ++layer )
for( LAYER_NUM layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer )
{
if( m_BoxSelectLayer[layer] == NULL )
continue;
......
......@@ -132,12 +132,12 @@ DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR( PCB_EDIT_FRAME* aParent,
PutValueInLocalUnits( *m_textCtrlPosY, aDimension->Text().GetTextPosition().y );
AddUnitSymbol( *m_staticTextPosY );
for( int layer = FIRST_NO_COPPER_LAYER; layer<NB_LAYERS; layer++ )
for( LAYER_NUM layer = FIRST_NON_COPPER_LAYER; layer < NB_PCB_LAYERS; ++layer )
{
m_SelLayerBox->Append( aParent->GetBoard()->GetLayerName( layer ) );
}
m_SelLayerBox->SetSelection( aDimension->GetLayer() - FIRST_NO_COPPER_LAYER );
m_SelLayerBox->SetSelection( aDimension->GetLayer() - FIRST_NON_COPPER_LAYER );
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
......@@ -199,7 +199,7 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event )
CurrentDimension->Text().SetMirrored( ( m_rbMirror->GetSelection() == 1 ) ? true : false );
CurrentDimension->SetLayer( m_SelLayerBox->GetCurrentSelection() + FIRST_NO_COPPER_LAYER );
CurrentDimension->SetLayer( FIRST_NON_COPPER_LAYER + m_SelLayerBox->GetCurrentSelection() );
if( m_DC ) // Display new text
{
......
......@@ -205,7 +205,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
// and **only one layer** can be drilled
if( aRefSeg->GetShape() == VIA_MICROVIA )
{
int layer1, layer2;
LAYER_NUM layer1, layer2;
bool err = true;
( (SEGVIA*) aRefSeg )->ReturnLayerPair( &layer1, &layer2 );
......
......@@ -256,7 +256,7 @@ struct EWIRE
double x2;
double y2;
double width;
int layer;
LAYER_NUM layer;
// for style: (continuous | longdash | shortdash | dashdot)
enum {
......@@ -388,7 +388,7 @@ struct ECIRCLE
double y;
double radius;
double width;
int layer;
LAYER_NUM layer;
ECIRCLE( CPTREE& aCircle );
};
......@@ -1312,7 +1312,7 @@ void EAGLE_PLUGIN::loadLayerDefs( CPTREE& aLayers )
for( EITER it = cu.begin(); it != cu.end(); ++it )
{
int layer = kicad_layer( it->number );
LAYER_NUM layer = kicad_layer( it->number );
m_board->SetLayerName( layer, FROM_UTF8( it->name.c_str() ) );
m_board->SetLayerType( layer, LT_SIGNAL );
......@@ -1333,9 +1333,9 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics )
{
m_xpath->push( "wire" );
EWIRE w( gr->second );
int layer = kicad_layer( w.layer );
LAYER_NUM layer = kicad_layer( w.layer );
if( layer != -1 )
if( layer != UNDEFINED_LAYER )
{
DRAWSEGMENT* dseg = new DRAWSEGMENT( m_board );
m_board->Add( dseg, ADD_APPEND );
......@@ -1360,7 +1360,7 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics )
#endif
m_xpath->push( "text" );
ETEXT t( gr->second );
int layer = kicad_layer( t.layer );
LAYER_NUM layer = kicad_layer( t.layer );
if( layer != -1 ) // supported layer
{
......@@ -1450,9 +1450,9 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics )
{
m_xpath->push( "circle" );
ECIRCLE c( gr->second );
int layer = kicad_layer( c.layer );
LAYER_NUM layer = kicad_layer( c.layer );
if( layer != -1 ) // unsupported layer
if( layer != UNDEFINED_LAYER ) // unsupported layer
{
DRAWSEGMENT* dseg = new DRAWSEGMENT( m_board );
m_board->Add( dseg, ADD_APPEND );
......@@ -1473,7 +1473,7 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics )
{
m_xpath->push( "rectangle" );
ERECT r( gr->second );
int layer = kicad_layer( r.layer );
LAYER_NUM layer = kicad_layer( r.layer );
if( IsValidCopperLayerIndex( layer ) )
{
......@@ -1908,7 +1908,7 @@ MODULE* EAGLE_PLUGIN::makeModule( CPTREE& aPackage, const std::string& aPkgName
void EAGLE_PLUGIN::packageWire( MODULE* aModule, CPTREE& aTree ) const
{
EWIRE w( aTree );
int layer = kicad_layer( w.layer );
LAYER_NUM layer = kicad_layer( w.layer );
if( IsValidNonCopperLayerIndex( layer ) ) // skip copper package wires
{
......@@ -2015,7 +2015,7 @@ void EAGLE_PLUGIN::packagePad( MODULE* aModule, CPTREE& aTree ) const
void EAGLE_PLUGIN::packageText( MODULE* aModule, CPTREE& aTree ) const
{
ETEXT t( aTree );
int layer = kicad_layer( t.layer );
LAYER_NUM layer = kicad_layer( t.layer );
TEXTE_MODULE* txt;
......@@ -2118,7 +2118,7 @@ void EAGLE_PLUGIN::packageText( MODULE* aModule, CPTREE& aTree ) const
void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, CPTREE& aTree ) const
{
ERECT r( aTree );
int layer = kicad_layer( r.layer );
LAYER_NUM layer = kicad_layer( r.layer );
if( IsValidNonCopperLayerIndex( layer ) ) // skip copper "package.rectangle"s
{
......@@ -2151,7 +2151,7 @@ void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, CPTREE& aTree ) const
void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, CPTREE& aTree ) const
{
EPOLYGON p( aTree );
int layer = kicad_layer( p.layer );
LAYER_NUM layer = kicad_layer( p.layer );
if( IsValidNonCopperLayerIndex( layer ) ) // skip copper "package.rectangle"s
{
......@@ -2200,7 +2200,7 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, CPTREE& aTree ) const
void EAGLE_PLUGIN::packageCircle( MODULE* aModule, CPTREE& aTree ) const
{
ECIRCLE e( aTree );
int layer = kicad_layer( e.layer );
LAYER_NUM layer = kicad_layer( e.layer );
EDGE_MODULE* gr = new EDGE_MODULE( aModule, S_CIRCLE );
aModule->GraphicalItems().PushBack( gr );
......@@ -2257,7 +2257,7 @@ void EAGLE_PLUGIN::packageHole( MODULE* aModule, CPTREE& aTree ) const
void EAGLE_PLUGIN::packageSMD( MODULE* aModule, CPTREE& aTree ) const
{
ESMD e( aTree );
int layer = kicad_layer( e.layer );
LAYER_NUM layer = kicad_layer( e.layer );
if( !IsValidCopperLayerIndex( layer ) )
{
......@@ -2349,7 +2349,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
{
m_xpath->push( "wire" );
EWIRE w( it->second );
int layer = kicad_layer( w.layer );
LAYER_NUM layer = kicad_layer( w.layer );
if( IsValidCopperLayerIndex( layer ) )
{
......@@ -2383,8 +2383,8 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
m_xpath->push( "via" );
EVIA v( it->second );
int layer_front_most = kicad_layer( v.layer_front_most );
int layer_back_most = kicad_layer( v.layer_back_most );
LAYER_NUM layer_front_most = kicad_layer( v.layer_front_most );
LAYER_NUM layer_back_most = kicad_layer( v.layer_back_most );
if( IsValidCopperLayerIndex( layer_front_most ) &&
IsValidCopperLayerIndex( layer_back_most ) )
......@@ -2462,7 +2462,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
{
m_xpath->push( "polygon" );
EPOLYGON p( it->second );
int layer = kicad_layer( p.layer );
LAYER_NUM layer = kicad_layer( p.layer );
if( IsValidCopperLayerIndex( layer ) )
{
......@@ -2545,7 +2545,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
}
int EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) const
LAYER_NUM EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) const
{
/* will assume this is a valid mapping for all eagle boards until I get paid more:
......@@ -2625,7 +2625,7 @@ int EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) const
else
{
/*
#define FIRST_NO_COPPER_LAYER 16
#define FIRST_NON_COPPER_LAYER 16
#define ADHESIVE_N_BACK 16
#define ADHESIVE_N_FRONT 17
#define SOLDERPASTE_N_BACK 18
......@@ -2639,7 +2639,7 @@ int EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) const
#define ECO1_N 26
#define ECO2_N 27
#define EDGE_N 28
#define LAST_NO_COPPER_LAYER 28
#define LAST_NON_COPPER_LAYER 28
#define UNUSED_LAYER_29 29
#define UNUSED_LAYER_30 30
#define UNUSED_LAYER_31 31
......
......@@ -159,7 +159,7 @@ private:
wxSize kicad_fontz( double d ) const;
/// Convert an Eagle layer to a KiCad layer.
int kicad_layer( int aLayer ) const;
LAYER_NUM kicad_layer( int aLayer ) const;
/// Convert a KiCad distance to an Eagle distance.
double eagle( BIU d ) const { return mm_per_biu * d; }
......
......@@ -191,7 +191,7 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Width( EDGE_MODULE* aEdge )
void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* aEdge )
{
MODULE* module = GetBoard()->m_Modules;
int new_layer = SILKSCREEN_N_FRONT;
LAYER_NUM new_layer = SILKSCREEN_N_FRONT;
if( aEdge )
new_layer = aEdge->GetLayer();
......
......@@ -62,7 +62,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
int id = event.GetId();
wxPoint pos;
int itmp;
LAYER_NUM itmp;
INSTALL_UNBUFFERED_DC( dc, m_canvas );
MODULE* module;
......@@ -916,7 +916,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_PCB_SELECT_LAYER:
itmp = SelectLayer( getActiveLayer(), -1, -1 );
itmp = SelectLayer( getActiveLayer(), UNDEFINED_LAYER, UNDEFINED_LAYER );
if( itmp >= 0 )
setActiveLayer( itmp );
......@@ -929,7 +929,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_PCB_SELECT_NO_CU_LAYER:
itmp = SelectLayer( getActiveLayer(), FIRST_NO_COPPER_LAYER, -1 );
itmp = SelectLayer( getActiveLayer(), FIRST_NON_COPPER_LAYER, UNDEFINED_LAYER );
if( itmp >= 0 )
setActiveLayer( itmp );
......@@ -938,7 +938,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_PCB_SELECT_CU_LAYER:
itmp = SelectLayer( getActiveLayer(), -1, LAST_COPPER_LAYER );
itmp = SelectLayer( getActiveLayer(), UNDEFINED_LAYER, LAST_COPPER_LAYER );
if( itmp >= 0 )
setActiveLayer( itmp );
......@@ -951,7 +951,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_TOOLBARH_PCB_SELECT_LAYER:
setActiveLayer( (size_t) m_SelLayerBox->GetLayerSelection());
setActiveLayer( m_SelLayerBox->GetLayerSelection() );
if( DisplayOpt.ContrastModeDisplay )
m_canvas->Refresh( true );
......@@ -1238,9 +1238,9 @@ void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
}
void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, int layer )
void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, LAYER_NUM layer )
{
int curLayer = getActiveLayer();
LAYER_NUM curLayer = getActiveLayer();
// Check if the specified layer matches the present layer
if( layer == curLayer )
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment