7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-07 20:15:14 +00:00

Implemented the LAYER_NUM typedef (LAYER was already taken as a class name...) to represent a layer number.

This commit is contained in:
Lorenzo Marcantonio 2013-03-31 15:27:46 +02:00
parent 8e09679437
commit 9fd79dfa91
147 changed files with 782 additions and 782 deletions
3d-viewer
bitmap2component
common
eeschema/dialogs
gerbview
include
pcbnew
autorouter
basepcbframe.cppblock.cppboard_undo_redo.cppclass_board.cppclass_board.hclass_board_design_settings.cppclass_dimension.cppclass_dimension.hclass_drawsegment.cppclass_edge_mod.cppclass_marker_pcb.cppclass_marker_pcb.hclass_mire.cppclass_mire.hclass_module_transform_functions.cppclass_pad.cppclass_pad.hclass_pad_draw_functions.cppclass_pcb_layer_box_selector.cppclass_pcb_layer_box_selector.hclass_pcb_layer_widget.cppclass_pcb_layer_widget.hclass_text_mod.cppclass_text_mod.hclass_track.cppclass_track.hclass_zone.cppclass_zone.hclass_zone_settings.cppclass_zone_settings.hclean.cppcollectors.cppcollectors.hdeltrack.cpp
dialogs
dimension.cppdrc_clearance_test_functions.cppeagle_plugin.cppeagle_plugin.hedgemod.cppedit.cppedit_pcb_text.cppeditedge.cppeditrack-part2.cppeditrack.cppexport_gencad.cppexport_vrml.cppgen_drill_report_files.cppgen_modules_placefile.cppgendrill_Excellon_writer.hhotkeys_board_editor.cppkicad_plugin.cpplayer_widget.cpplayer_widget.hlegacy_plugin.cppmagnetic_tracks_functions.cpp
pcad2kicadpcb_plugin
pcb_parser.cpppcb_parser.hpcbframe.cpppcbnew.cpppcbnew.hpcbplot.cpppcbplot.hplot_board_layers.cppplot_brditems_plotter.cppplotcontroller.hprint_board_functions.cppprintout_controler.cppprotos.hsel_layer.cppspecctra.cppspecctra.hspecctra_export.cppspecctra_import.cppspecctra_test.cppswap_layers.cppzones_by_polygon.cppzones_functions_for_undo_redo.cppzones_functions_for_undo_redo.hzones_non_copper_type_functions.cppzones_test_and_combine_areas.cpp
polygon

View File

@ -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;

View File

@ -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;
}

View File

@ -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();
}

View File

@ -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,

View File

@ -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) )
{

View File

@ -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;

View File

@ -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 );

View File

@ -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;

View File

@ -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 );

View File

@ -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

View File

@ -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 );
}

View File

@ -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

View File

@ -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.

View File

@ -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;

View File

@ -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()
{

View File

@ -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();

View File

@ -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 );
/**

View File

@ -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 )

View File

@ -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() );

View File

@ -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;

View File

@ -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;

View File

@ -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 )

View File

@ -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 )
{

View File

@ -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" );

View File

@ -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++ )
{

Some files were not shown because too many files have changed in this diff Show More