Commit 57463862 authored by g_harland's avatar g_harland

Added definitions for FIRST_COPPER_LAYER and LAST_COPPER_LAYER

parent 74b4e032
This diff is collapsed.
......@@ -4,6 +4,14 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2007-Nov-01 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
================================================================================
+ pcbnew
* Provided new definitions of FIRST_COPPER_LAYER and LAST_COPPER_LAYER within
include/pcbstruct.h, and used those definitions within various other files.
Beautified and generally refined 3d-viewer/3d_draw.cpp and pcbnew/plotgerb.cpp.
2007-Oct-31 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+kicad:
......@@ -401,8 +409,8 @@ email address.
field. (Refer to 2007-Oct-2 UPDATE notes for the relevance of this.)
* Beautification and house keeping.
+ eeschema
* The editpart.cpp and editpart.cpp files (which are no longer used) have been
removed, and replaced with editpart.cpp.notused and editpart.cpp.notused
* The editpart.cpp and libedpart.cpp files (which are no longer used) have been
removed, and replaced with editpart.cpp.notused and libedpart.cpp.notused
+ cvpcb
* Additional "OK", "Cancel", and "Apply" buttons have now been provided for the
"Options" dialog box which lists various display options for footprints.
......
......@@ -153,7 +153,7 @@ static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, FILE* aFile,
if( pcb_layer_number < 0 )
continue;
if( pcb_layer_number > CMP_N )
if( pcb_layer_number > LAST_COPPER_LAYER )
{
DRAWSEGMENT* drawitem = new DRAWSEGMENT( pcb, TYPEDRAWSEGMENT );
......@@ -169,7 +169,7 @@ static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, FILE* aFile,
TRACK* newtrack;
// replace spots with vias when possible
if( track->m_Shape == S_SPOT_CIRCLE
if( track->m_Shape == S_SPOT_CIRCLE
|| track->m_Shape == S_SPOT_RECT
|| track->m_Shape == S_SPOT_OVALE )
{
......
......@@ -266,7 +266,7 @@ bool AsCmpLayer = false;
AsCmpLayer = true;
else
{
if( LayerLookUpTable[ii] >= CMP_N )
if( LayerLookUpTable[ii] >= LAST_COPPER_LAYER )
continue; // not a copper layer
if( LayerLookUpTable[ii] >= g_DesignSettings.m_CopperLayerCount )
g_DesignSettings.m_CopperLayerCount++;
......@@ -275,8 +275,8 @@ bool AsCmpLayer = false;
if( AsCmpLayer )
g_DesignSettings.m_CopperLayerCount++;
if( g_DesignSettings.m_CopperLayerCount > CMP_N + 1 ) // should not occur.
g_DesignSettings.m_CopperLayerCount = CMP_N + 1;
if( g_DesignSettings.m_CopperLayerCount > NB_COPPER_LAYERS ) // should not occur.
g_DesignSettings.m_CopperLayerCount = NB_COPPER_LAYERS;
EndModal( 1 );
}
......@@ -35,6 +35,7 @@
/* Layer identification (layer number) */
#define FIRST_COPPER_LAYER 0
#define COPPER_LAYER_N 0
#define LAYER_N_2 1 /* Numero layer 2 */
#define LAYER_N_3 2 /* Numero layer 3 */
......@@ -52,7 +53,8 @@
#define LAYER_N_15 14 /* Numero layer 15 */
#define LAYER_CMP_N 15
#define CMP_N 15
#define NB_COPPER_LAYERS (CMP_N + 1)
#define LAST_COPPER_LAYER 15
#define NB_COPPER_LAYERS (LAST_COPPER_LAYER + 1)
#define FIRST_NO_COPPER_LAYER 16
#define ADHESIVE_N_CU 16
......
......@@ -181,7 +181,7 @@ void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
// Copper layers cannot be selected unconditionally; how many
// of those layers are currently enabled needs to be checked.
if( (layer >= COPPER_LAYER_N) && (layer <= CMP_N) )
if( (layer >= FIRST_COPPER_LAYER) && (layer <= LAST_COPPER_LAYER) )
{
// If only one copper layer is enabled, the only such layer
// that can be selected to is the "Copper" layer (so the
......
......@@ -173,7 +173,7 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
GRSetDrawMode( DC, draw_mode );
typeaff = frame->m_DisplayModEdge;
if( m_Layer <= CMP_N )
if( m_Layer <= LAST_COPPER_LAYER )
{
typeaff = frame->m_DisplayPcbTrackFill;
if( !typeaff )
......
......@@ -99,8 +99,8 @@ int TEXTE_PCB::ReadTextePcbDescr( FILE* File, int* LineNum )
{
sscanf( Line + 2, " %d %d %lX %d\n", &m_Layer, &m_Miroir,
&m_TimeStamp, &dummy );
if( m_Layer < COPPER_LAYER_N )
m_Layer = COPPER_LAYER_N;
if( m_Layer < FIRST_COPPER_LAYER )
m_Layer = FIRST_COPPER_LAYER;
if( m_Layer > LAST_NO_COPPER_LAYER )
m_Layer = LAST_NO_COPPER_LAYER;
......
......@@ -268,7 +268,7 @@ int TRACK::ReturnMaskLayer()
if( via_type == VIA_THROUGH )
return ALL_CU_LAYERS;
// VIA_BLIND ou VIA_BURIED:
// VIA_BLIND or VIA_BURIED:
int bottom_layer, top_layer;
......@@ -720,7 +720,7 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode )
}
/* Shows clearance (for tracks and vias, not for zone segments */
if( DisplayOpt.DisplayTrackIsol && ( m_Layer <= CMP_N )
if( DisplayOpt.DisplayTrackIsol && ( m_Layer <= LAST_COPPER_LAYER )
&& ( Type() == TYPETRACK || Type() == TYPEVIA) )
{
GRCSegm( &panel->m_ClipBox, DC, m_Start.x, m_Start.y,
......
......@@ -136,12 +136,12 @@ WinEDA_CotationPropertiesFrame::WinEDA_CotationPropertiesFrame( WinEDA_PcbFrame*
wxDefaultPosition, wxDefaultSize );
LeftBoxSizer->Add( m_SelLayerBox, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
int ii;
for( ii = CMP_N + 1; ii < NB_LAYERS; ii++ )
for( ii = FIRST_NO_COPPER_LAYER; ii < NB_LAYERS; ii++ )
{
m_SelLayerBox->Append( ReturnPcbLayerName( ii ) );
}
m_SelLayerBox->SetSelection( Cotation->GetLayer() - (CMP_N + 1) );
m_SelLayerBox->SetSelection( Cotation->GetLayer() - FIRST_NO_COPPER_LAYER );
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
......@@ -175,8 +175,8 @@ void WinEDA_CotationPropertiesFrame::OnOkClick( wxCommandEvent& event )
m_TxtWidthCtrl->GetValue();
CurrentCotation->m_Text->m_Miroir = (m_Mirror->GetSelection() == 0) ? 1 : 0;
CurrentCotation->SetLayer( m_SelLayerBox->GetChoice() + CMP_N + 1 );
CurrentCotation->m_Text->SetLayer( m_SelLayerBox->GetChoice() + CMP_N + 1 );
CurrentCotation->SetLayer( m_SelLayerBox->GetChoice() + FIRST_NO_COPPER_LAYER );
CurrentCotation->m_Text->SetLayer( m_SelLayerBox->GetChoice() + FIRST_NO_COPPER_LAYER );
CurrentCotation->m_Text->CreateDrawData();
......
......@@ -194,11 +194,11 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Layer( EDGE_MODULE* Edge, wxDC* DC )
/* Ask for the new layer */
new_layer = SelectLayer( new_layer, COPPER_LAYER_N, LAST_NO_COPPER_LAYER );
new_layer = SelectLayer( new_layer, FIRST_COPPER_LAYER, LAST_NO_COPPER_LAYER );
if( new_layer < 0 )
return;
if ( new_layer >= COPPER_LAYER_N && new_layer <= LAYER_CMP_N )
if ( new_layer >= FIRST_COPPER_LAYER && new_layer <= LAST_COPPER_LAYER )
/* an edge is put on a copper layer, and it is very dangerous. a confirmation is requested */
{
if ( ! IsOK(this, _("The graphic item will be on a copper layer.It is very dangerous. Are you sure") ) )
......
......@@ -632,7 +632,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_PCB_SELECT_CU_LAYER:
itmp = SelectLayer( GetScreen()->m_Active_Layer, -1, CMP_N );
itmp = SelectLayer( GetScreen()->m_Active_Layer, -1, LAST_COPPER_LAYER );
if( itmp >= 0 )
GetScreen()->m_Active_Layer = itmp;
break;
......@@ -1005,7 +1005,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
// Copper layers cannot be selected unconditionally; how many
// of those layers are currently enabled needs to be checked.
if( (layer >= COPPER_LAYER_N) && (layer <= CMP_N) )
if( (layer >= FIRST_COPPER_LAYER) && (layer <= LAST_COPPER_LAYER) )
{
// If only one copper layer is enabled, the only such layer
// that can be selected to is the "Copper" layer (so the
......
......@@ -162,7 +162,7 @@ void WinEDA_PcbFrame::Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC
COTATION* Cotation;
int layer = Segment->GetLayer();
if( layer <= CMP_N )
if( layer <= LAST_COPPER_LAYER )
{
DisplayError( this, _( "Copper layer global delete not allowed!" ), 20 );
return;
......
......@@ -202,12 +202,12 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
case HK_SWITCH_LAYER_TO_PREVIOUS:
ll = GetScreen()->m_Active_Layer;
if( (ll <= COPPER_LAYER_N) || (ll > CMP_N) )
if( (ll <= FIRST_COPPER_LAYER) || (ll > LAST_COPPER_LAYER) )
break;
if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 ) // Single layer
ll = COPPER_LAYER_N;
else if( ll == CMP_N )
ll = MAX( COPPER_LAYER_N, m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 );
else if( ll == LAST_COPPER_LAYER )
ll = MAX( FIRST_COPPER_LAYER, m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 );
else
ll--;
SwitchLayer( DC, ll );
......@@ -215,12 +215,12 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
case HK_SWITCH_LAYER_TO_NEXT:
ll = GetScreen()->m_Active_Layer;
if( (ll < COPPER_LAYER_N) || (ll >= CMP_N) )
if( (ll < FIRST_COPPER_LAYER) || (ll >= LAST_COPPER_LAYER) )
break;
if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 ) // Single layer
ll = COPPER_LAYER_N;
else if( ll >= m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 )
ll = CMP_N;
ll = LAST_COPPER_LAYER;
else
ll++;
SwitchLayer( DC, ll );
......@@ -299,7 +299,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
break;
case HK_BACK_SPACE:
if( m_ID_current_state == ID_TRACK_BUTT && GetScreen()->m_Active_Layer <= CMP_N )
if( m_ID_current_state == ID_TRACK_BUTT && GetScreen()->m_Active_Layer <= LAST_COPPER_LAYER )
{
if( ItemFree )
{
......@@ -570,7 +570,7 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct )
switch( m_ID_current_state )
{
case ID_TRACK_BUTT:
if( GetScreen()->m_Active_Layer > CMP_N )
if( GetScreen()->m_Active_Layer > LAST_COPPER_LAYER )
return FALSE;
if( ItemFree )
{
......
......@@ -163,9 +163,9 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( m_ID_current_state == ID_PCB_ARC_BUTT )
shape = S_ARC;
if( GetScreen()->m_Active_Layer <= CMP_N )
if( GetScreen()->m_Active_Layer <= LAST_COPPER_LAYER )
{
DisplayError( this, _( "Graphic not autorized on Copper layers" ) );
DisplayError( this, _( "Graphic not authorized on Copper layers" ) );
break;
}
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
......@@ -186,7 +186,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
}
case ID_TRACK_BUTT:
if( GetScreen()->m_Active_Layer > CMP_N )
if( GetScreen()->m_Active_Layer > LAST_COPPER_LAYER )
{
DisplayError( this, _( "Tracks on Copper layers only " ) );
break;
......@@ -262,9 +262,9 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break;
case ID_PCB_COTATION_BUTT:
if( GetScreen()->m_Active_Layer <= CMP_N )
if( GetScreen()->m_Active_Layer <= LAST_COPPER_LAYER )
{
DisplayError( this, _( "Cotation not autorized on Copper layers" ) );
DisplayError( this, _( "Cotation not authorized on Copper layers" ) );
break;
}
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
......@@ -426,4 +426,3 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
break;
}
}
This diff is collapsed.
......@@ -136,7 +136,7 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer )
switch( Layer )
{
case COPPER_LAYER_N:
case FIRST_COPPER_LAYER:
case LAYER_N_2:
case LAYER_N_3:
case LAYER_N_4:
......@@ -151,7 +151,7 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer )
case LAYER_N_13:
case LAYER_N_14:
case LAYER_N_15:
case CMP_N:
case LAST_COPPER_LAYER:
Plot_Layer_HPGL( dest, layer_mask, 0, 1, modetrace );
break;
......
......@@ -178,7 +178,7 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer )
Plot_Layer_PS( dest, layer_mask, 0, 1, modetrace );
break;
case COPPER_LAYER_N:
case FIRST_COPPER_LAYER:
case LAYER_N_2:
case LAYER_N_3:
case LAYER_N_4:
......@@ -193,7 +193,7 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer )
case LAYER_N_13:
case LAYER_N_14:
case LAYER_N_15:
case CMP_N:
case LAST_COPPER_LAYER:
Plot_Layer_PS( dest, layer_mask, 0, 1, modetrace );
break;
......
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