Commit 1e7495e6 authored by Dick Hollenbeck's avatar Dick Hollenbeck

merge

parents 33776f28 575f13d8
This diff is collapsed.
......@@ -132,53 +132,52 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
// Fill remaining unused copper layers and front layer zpos
// with m_EpoxyThickness
// Solder mask and Solder paste have the same Z position
for( ; layer <= LAST_COPPER_LAYER; layer++ )
for( ; layer < MAX_CU_LAYERS; layer++ )
{
m_LayerZcoord[layer] = m_EpoxyThickness;
}
// calculate z position for each non copper layer
for( int layer_id = FIRST_NON_COPPER_LAYER; layer_id < NB_PCB_LAYERS; layer_id++ )
for( int layer_id = MAX_CU_LAYERS; layer_id < LAYER_ID_COUNT; layer_id++ )
{
double zpos;
switch( layer_id )
{
case ADHESIVE_N_BACK:
case B_Adhes:
zpos = zpos_copper_back - 3 * zpos_offset;
break;
case ADHESIVE_N_FRONT:
case F_Adhes:
zpos = zpos_copper_front + 3 * zpos_offset;
break;
case SOLDERPASTE_N_BACK:
case B_Paste:
zpos = zpos_copper_back - 1 * zpos_offset;
break;
case SOLDERPASTE_N_FRONT:
case F_Paste:
zpos = zpos_copper_front + 1 * zpos_offset;
break;
case SOLDERMASK_N_BACK:
case B_Mask:
zpos = zpos_copper_back - 1 * zpos_offset;
break;
case SOLDERMASK_N_FRONT:
case F_Mask:
zpos = zpos_copper_front + 1 * zpos_offset;
break;
case SILKSCREEN_N_BACK:
case B_SilkS:
zpos = zpos_copper_back - 2 * zpos_offset;
break;
case SILKSCREEN_N_FRONT:
case F_SilkS:
zpos = zpos_copper_front + 2 * zpos_offset;
break;
default:
zpos = zpos_copper_front +
(layer_id - FIRST_NON_COPPER_LAYER + 4) * zpos_offset;
zpos = zpos_copper_front + (layer_id - MAX_CU_LAYERS + 4) * zpos_offset;
break;
}
......@@ -196,8 +195,8 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
double INFO3D_VISU::GetModulesZcoord3DIU( bool aIsFlipped )
{
if( aIsFlipped )
return m_LayerZcoord[LAYER_N_BACK] - ( m_CopperThickness / 2 );
return m_LayerZcoord[B_Cu] - ( m_CopperThickness / 2 );
else
return m_LayerZcoord[LAYER_N_FRONT] + ( m_CopperThickness / 2 );
return m_LayerZcoord[F_Cu] + ( m_CopperThickness / 2 );
}
......@@ -95,7 +95,7 @@ public:
double m_CurrentZpos; // temporary storage of current value of Z position,
// used in some calculation
private:
double m_LayerZcoord[NB_LAYERS]; // Z position of each layer (normalized)
double m_LayerZcoord[LAYER_ID_COUNT]; // 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
......@@ -188,11 +188,12 @@ public: INFO3D_VISU();
*
* Note: if m_drawFlags[FL_USE_COPPER_THICKNESS] is not set, returns 0
*/
int GetLayerObjectThicknessBIU( int aLayerId) const
int GetLayerObjectThicknessBIU( int aLayerId ) const
{
return aLayerId >= FIRST_NON_COPPER_LAYER ?
GetNonCopperLayerThicknessBIU() :
GetCopperThicknessBIU();
return IsCopperLayer( aLayerId ) ?
GetCopperThicknessBIU() :
GetNonCopperLayerThicknessBIU()
;
}
bool IsRealisticMode() { return GetFlag( FL_USE_REALISTIC_MODE ); }
......
......@@ -60,6 +60,8 @@ PCBNew
*) Paste (module ...) from clipboard into module editor.
Dick's Final TODO List:
======================
*) Get licensing cleaned up.
......@@ -75,3 +77,10 @@ Dick's Final TODO List:
* Clear all/some? retained strings on project change.
* Clear the FP_LIB_TABLE when the last KIWAY_PLAYER using it is closed.
Known Cu32 problems:
*) layer combo box does not show the first layer numbered 0.
*) ratsnest is broken
......@@ -355,7 +355,7 @@ void BITMAPCONV_INFO::OuputOnePolygon( KPolygon & aPolygon )
case PCBNEW_LEGACY_EMP:
{
LAYER_NUM layer = SILKSCREEN_N_FRONT;
LAYER_NUM layer = F_SilkS;
int width = 1;
fprintf( m_Outfile, "DP %d %d %d %d %d %d %d\n",
0, 0, 0, 0,
......
......@@ -250,6 +250,7 @@ set( PCB_COMMON_SRCS
eda_text.cpp
class_page_info.cpp
pcbcommon.cpp
lset.cpp
footprint_info.cpp
../pcbnew/basepcbframe.cpp
../pcbnew/class_board.cpp
......
......@@ -15,8 +15,7 @@
/* Initial colors values: optimized for Pcbnew, but are also Ok for Eeschema
* these values are superseded by config reading
*/
static const EDA_COLOR_T default_layer_color[LAYERSCOLORSBUFFERSIZE] =
{
static const EDA_COLOR_T default_layer_color[] = {
GREEN, BLUE, LIGHTGRAY, BROWN,
RED, MAGENTA, LIGHTGRAY, MAGENTA,
DARKGRAY, BLUE, GREEN, CYAN,
......@@ -34,8 +33,8 @@ static const EDA_COLOR_T default_layer_color[LAYERSCOLORSBUFFERSIZE] =
DARKGRAY
};
static const EDA_COLOR_T default_items_color[LAYERSCOLORSBUFFERSIZE] =
{
static const EDA_COLOR_T default_items_color[] = {
LIGHTGRAY, // unused
CYAN, // VIA_MICROVIA_VISIBLE
BROWN, // VIA_BBLIND_VISIBLE
......@@ -56,13 +55,24 @@ static const EDA_COLOR_T default_items_color[LAYERSCOLORSBUFFERSIZE] =
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY
};
COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS()
{
for( unsigned ii = 0; ii < DIM(m_LayersColors); ii++ )
m_LayersColors[ii] = default_layer_color[ii];
for( unsigned src = 0, dst = 0; dst < DIM(m_LayersColors); ++dst )
{
m_LayersColors[dst] = default_layer_color[src++];
for( unsigned ii = 0; ii < DIM(m_ItemsColors); ii++ )
m_ItemsColors[ii] = default_items_color[ii];
if( src >= DIM( default_layer_color ) )
src = 0; // wrap the source.
}
for( unsigned src = 0, dst = 0; dst < DIM(m_ItemsColors); ++dst )
{
m_ItemsColors[dst] = default_items_color[src++];
if( src >= DIM( default_items_color ) )
src = 0;
}
}
......
......@@ -13,19 +13,11 @@
LAYER_SELECTOR::LAYER_SELECTOR()
{
m_layerorder = true;
m_layerhotkeys = true;
m_hotkeys = NULL;
}
bool LAYER_SELECTOR::SetLayersOrdered( bool value )
{
m_layerorder = value;
return m_layerorder;
}
bool LAYER_SELECTOR::SetLayersHotkeys( bool value )
{
m_layerhotkeys = value;
......@@ -120,12 +112,15 @@ int LAYER_BOX_SELECTOR::SetLayerSelection( LAYER_NUM layer )
return -1;
}
void LAYER_BOX_SELECTOR::ResyncBitmapOnly()
{
LAYER_NUM elements = GetCount();
for( LAYER_NUM i = FIRST_LAYER; i < elements; ++i )
int elements = GetCount();
for( LAYER_NUM i = 0; i < elements; ++i )
{
wxBitmap layerbmp( 14, 14 );
SetBitmapLayer( layerbmp, i );
}
}
......@@ -47,7 +47,7 @@ void wxConfigSaveParams( wxConfigBase* aCfg,
BOOST_FOREACH( const PARAM_CFG_BASE& param, aList )
{
if( param.m_Group )
if( !!param.m_Group )
aCfg->SetPath( param.m_Group );
else
aCfg->SetPath( aGroup );
......@@ -57,7 +57,7 @@ void wxConfigSaveParams( wxConfigBase* aCfg,
if( param.m_Type == PARAM_COMMAND_ERASE ) // Erase all data
{
if( param.m_Ident )
if( !!param.m_Ident )
aCfg->DeleteGroup( param.m_Ident );
}
else
......@@ -75,7 +75,7 @@ void wxConfigLoadParams( wxConfigBase* aCfg,
BOOST_FOREACH( const PARAM_CFG_BASE& param, aList )
{
if( param.m_Group )
if( !!param.m_Group )
aCfg->SetPath( param.m_Group );
else
aCfg->SetPath( aGroup );
......@@ -99,7 +99,7 @@ void wxConfigSaveSetups( wxConfigBase* aCfg, const PARAM_CFG_ARRAY& aList )
if( param.m_Type == PARAM_COMMAND_ERASE ) // Erase all data
{
if( param.m_Ident )
if( !!param.m_Ident )
aCfg->DeleteGroup( param.m_Ident );
}
else
......@@ -137,7 +137,7 @@ void ConfigBaseWriteDouble( wxConfigBase* aConfig, const wxString& aKey, double
}
PARAM_CFG_BASE::PARAM_CFG_BASE( const wxChar* ident, const paramcfg_id type,
PARAM_CFG_BASE::PARAM_CFG_BASE( const wxString& ident, const paramcfg_id type,
const wxChar* group )
{
m_Ident = ident;
......@@ -147,7 +147,7 @@ PARAM_CFG_BASE::PARAM_CFG_BASE( const wxChar* ident, const paramcfg_id type,
}
PARAM_CFG_INT::PARAM_CFG_INT( const wxChar* ident, int* ptparam,
PARAM_CFG_INT::PARAM_CFG_INT( const wxString& ident, int* ptparam,
int default_val, int min, int max,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_INT, group )
......@@ -159,7 +159,7 @@ PARAM_CFG_INT::PARAM_CFG_INT( const wxChar* ident, int* ptparam,
}
PARAM_CFG_INT::PARAM_CFG_INT( bool Insetup, const wxChar* ident, int* ptparam,
PARAM_CFG_INT::PARAM_CFG_INT( bool Insetup, const wxString& ident, int* ptparam,
int default_val, int min, int max,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_INT, group )
......@@ -195,7 +195,7 @@ void PARAM_CFG_INT::SaveParam( wxConfigBase* aConfig ) const
}
PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE( const wxChar* ident, int* ptparam,
PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE( const wxString& ident, int* ptparam,
int default_val, int min, int max,
const wxChar* group, double aBiu2cfgunit ) :
PARAM_CFG_INT( ident, ptparam, default_val, min, max, group )
......@@ -206,7 +206,7 @@ PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE( const wxChar* ident, int* pt
PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE( bool Insetup,
const wxChar* ident, int* ptparam,
const wxString& ident, int* ptparam,
int default_val, int min, int max,
const wxChar* group, double aBiu2cfgunit ) :
PARAM_CFG_INT( Insetup, ident, ptparam, default_val, min, max, group )
......@@ -246,7 +246,7 @@ void PARAM_CFG_INT_WITH_SCALE::SaveParam( wxConfigBase* aConfig ) const
}
PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( const wxChar* ident, EDA_COLOR_T* ptparam,
PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( const wxString& ident, EDA_COLOR_T* ptparam,
EDA_COLOR_T default_val,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_SETCOLOR, group )
......@@ -257,7 +257,7 @@ PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( const wxChar* ident, EDA_COLOR_T* ptpara
PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( bool Insetup,
const wxChar* ident,
const wxString& ident,
EDA_COLOR_T* ptparam,
EDA_COLOR_T default_val,
const wxChar* group ) :
......@@ -291,7 +291,7 @@ void PARAM_CFG_SETCOLOR::SaveParam( wxConfigBase* aConfig ) const
}
PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( const wxChar* ident, double* ptparam,
PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( const wxString& ident, double* ptparam,
double default_val, double min, double max,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_DOUBLE, group )
......@@ -304,7 +304,7 @@ PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( const wxChar* ident, double* ptparam,
PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( bool Insetup,
const wxChar* ident,
const wxString& ident,
double* ptparam,
double default_val,
double min,
......@@ -348,7 +348,7 @@ void PARAM_CFG_DOUBLE::SaveParam( wxConfigBase* aConfig ) const
}
PARAM_CFG_BOOL::PARAM_CFG_BOOL( const wxChar* ident, bool* ptparam,
PARAM_CFG_BOOL::PARAM_CFG_BOOL( const wxString& ident, bool* ptparam,
int default_val, const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_BOOL, group )
{
......@@ -358,7 +358,7 @@ PARAM_CFG_BOOL::PARAM_CFG_BOOL( const wxChar* ident, bool* ptparam,
PARAM_CFG_BOOL::PARAM_CFG_BOOL( bool Insetup,
const wxChar* ident,
const wxString& ident,
bool* ptparam,
int default_val,
const wxChar* group ) :
......@@ -390,7 +390,7 @@ void PARAM_CFG_BOOL::SaveParam( wxConfigBase* aConfig ) const
}
PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( const wxChar* ident,
PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( const wxString& ident,
wxString* ptparam,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_WXSTRING, group )
......@@ -399,7 +399,7 @@ PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( const wxChar* ident,
}
PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( bool Insetup, const wxChar* ident,
PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( bool Insetup, const wxString& ident,
wxString* ptparam,
const wxString& default_val,
const wxChar* group ) :
......@@ -429,7 +429,7 @@ void PARAM_CFG_WXSTRING::SaveParam( wxConfigBase* aConfig ) const
}
PARAM_CFG_FILENAME::PARAM_CFG_FILENAME( const wxChar* ident,
PARAM_CFG_FILENAME::PARAM_CFG_FILENAME( const wxString& ident,
wxString* ptparam,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_FILENAME, group )
......
......@@ -109,7 +109,8 @@ bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame )
dc.SetClippingRegion( DrawArea );
}
aFrame->PrintPage( &dc, FULL_LAYERS, false );
const LSET allLayersMask = LSET().set();
aFrame->PrintPage( &dc, allLayersMask, false );
screen->m_IsPrinting = false;
aFrame->GetCanvas()->SetClipBox( tmp );
wxMetafile* mf = dc.Close();
......
......@@ -331,7 +331,7 @@ void EDA_DRAW_FRAME::ToolOnRightClick( wxCommandEvent& event )
}
void EDA_DRAW_FRAME::PrintPage( wxDC* aDC,LAYER_MSK aPrintMask, bool aPrintMirrorMode, void* aData )
void EDA_DRAW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode, void* aData )
{
wxMessageBox( wxT("EDA_DRAW_FRAME::PrintPage() error") );
}
......
This diff is collapsed.
......@@ -43,16 +43,6 @@
class MODULE;
/* Look up Table for conversion copper layer count -> general copper layer
* mask: */
LAYER_MSK g_TabAllCopperLayerMask[NB_COPPER_LAYERS] = {
0x0001, 0x8001, 0x8003, 0x8007,
0x800F, 0x801F, 0x803F, 0x807F,
0x80FF, 0x81FF, 0x83FF, 0x87FF,
0x8FFF, 0x9FFF, 0xCFFF, 0xFFFF
};
DISPLAY_OPTIONS DisplayOpt; // Display options for board items
int g_AnchorColor = BLUE;
......@@ -71,124 +61,20 @@ int g_PadCMPColor = RED;
*/
DLIST<TRACK> g_CurrentTrackList;
LAYER_NUM FlipLayer( LAYER_NUM oldlayer )
{
switch( oldlayer )
{
case LAYER_N_BACK:
return LAYER_N_FRONT;
case LAYER_N_FRONT:
return LAYER_N_BACK;
case SILKSCREEN_N_BACK:
return SILKSCREEN_N_FRONT;
case SILKSCREEN_N_FRONT:
return SILKSCREEN_N_BACK;
case ADHESIVE_N_BACK:
return ADHESIVE_N_FRONT;
case ADHESIVE_N_FRONT:
return ADHESIVE_N_BACK;
case SOLDERMASK_N_BACK:
return SOLDERMASK_N_FRONT;
case SOLDERMASK_N_FRONT:
return SOLDERMASK_N_BACK;
case SOLDERPASTE_N_BACK:
return SOLDERPASTE_N_FRONT;
case SOLDERPASTE_N_FRONT:
return SOLDERPASTE_N_BACK;
// No change for the other layers
default:
return oldlayer;
}
}
LAYER_MSK FlipLayerMask( LAYER_MSK aMask )
void AccumulateDescription( wxString &aDesc, const wxString &aItem )
{
LAYER_MSK newMask;
newMask = aMask & ~(LAYER_BACK | LAYER_FRONT |
SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT |
ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT |
SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT |
SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT |
ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT);
if( aMask & LAYER_BACK )
newMask |= LAYER_FRONT;
if( aMask & LAYER_FRONT )
newMask |= LAYER_BACK;
if( aMask & SILKSCREEN_LAYER_BACK )
newMask |= SILKSCREEN_LAYER_FRONT;
if( aMask & SILKSCREEN_LAYER_FRONT )
newMask |= SILKSCREEN_LAYER_BACK;
if( aMask & ADHESIVE_LAYER_BACK )
newMask |= ADHESIVE_LAYER_FRONT;
if( aMask & ADHESIVE_LAYER_FRONT )
newMask |= ADHESIVE_LAYER_BACK;
if( aMask & SOLDERMASK_LAYER_BACK )
newMask |= SOLDERMASK_LAYER_FRONT;
if( aMask & SOLDERMASK_LAYER_FRONT )
newMask |= SOLDERMASK_LAYER_BACK;
if( aMask & SOLDERPASTE_LAYER_BACK )
newMask |= SOLDERPASTE_LAYER_FRONT;
if( aMask & SOLDERPASTE_LAYER_FRONT )
newMask |= SOLDERPASTE_LAYER_BACK;
if( aMask & ADHESIVE_LAYER_BACK )
newMask |= ADHESIVE_LAYER_FRONT;
if( aMask & ADHESIVE_LAYER_FRONT )
newMask |= ADHESIVE_LAYER_BACK;
return newMask;
if( !aDesc.IsEmpty() )
aDesc << wxT(", ");
aDesc << aItem;
}
LAYER_NUM ExtractLayer( LAYER_MSK aMask )
{
if( aMask == NO_LAYERS )
return UNSELECTED_LAYER;
LAYER_NUM candidate = UNDEFINED_LAYER;
// Scan all the layers and take note of the first set; if other are
// then found return UNDEFINED_LAYER
for( LAYER_NUM i = FIRST_LAYER; i < NB_LAYERS; ++i )
{
if( aMask & GetLayerMask( i ) )
{
if( candidate == UNDEFINED_LAYER )
candidate = i;
else
return UNDEFINED_LAYER;
}
}
return candidate;
}
wxString LayerMaskDescribe( const BOARD *aBoard, LAYER_MSK aMask )
wxString LayerMaskDescribe( const BOARD *aBoard, LSET aMask )
{
// Try the single or no- layer case (easy)
LAYER_NUM layer = ExtractLayer( aMask );
switch( layer )
LAYER_ID layer = aMask.ExtractLayer();
switch( (int) layer )
{
case UNSELECTED_LAYER:
return _( "No layers" );
......@@ -203,24 +89,19 @@ wxString LayerMaskDescribe( const BOARD *aBoard, LAYER_MSK aMask )
// Try to be smart and useful, starting with outer copper
// (which are more important than internal ones)
wxString layerInfo;
if( aMask & LAYER_FRONT )
AccumulateDescription( layerInfo, aBoard->GetLayerName( LAYER_N_FRONT ) );
if( aMask & LAYER_BACK )
AccumulateDescription( layerInfo, aBoard->GetLayerName( LAYER_N_BACK ) );
if( aMask[F_Cu] )
AccumulateDescription( layerInfo, aBoard->GetLayerName( F_Cu ) );
if( aMask[B_Cu] )
AccumulateDescription( layerInfo, aBoard->GetLayerName( B_Cu ) );
if( aMask & INTERNAL_CU_LAYERS )
if( ( aMask & LSET::InternalCuMask() ).any() )
AccumulateDescription( layerInfo, _("Internal" ) );
if( aMask & ALL_NO_CU_LAYERS )
if( ( aMask & LSET::AllNonCuMask() ).any() )
AccumulateDescription( layerInfo, _("Non-copper" ) );
return layerInfo;
}
void AccumulateDescription( wxString &aDesc, const wxString &aItem )
{
if( !aDesc.IsEmpty() )
aDesc << wxT(", ");
aDesc << aItem;
}
......@@ -183,7 +183,7 @@ void LIB_EDIT_FRAME::SVG_PlotComponent( const wxString& aFullFileName )
delete plotter;
}
void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMask, bool aPrintMirrorMode, void* aData)
void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode, void* aData)
{
if( ! m_component )
return;
......
......@@ -608,7 +608,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMask,
virtual void PrintPage( wxDC* aDC, LSET aPrintMask,
bool aPrintMirrorMode, void* aData = NULL );
/**
......
......@@ -934,7 +934,7 @@ void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event )
}
void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMask, bool aPrintMirrorMode,
void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode,
void* aData )
{
GetScreen()->Draw( m_canvas, aDC, GR_DEFAULT_DRAWMODE );
......
......@@ -35,6 +35,7 @@
#include <gr_basic.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <class_gerber_draw_item.h>
#include <wx/debug.h>
......
......@@ -7,6 +7,7 @@
#include <wxstruct.h>
#include <class_drawpanel.h>
#include <gerbview.h>
#include <dcode.h>
#include <class_DCodeSelectionbox.h>
......
......@@ -34,6 +34,7 @@
#include <macros.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <class_GERBER.h>
......
......@@ -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, LAYER_NUM layer ) :
public: EXCELLON_IMAGE( GERBVIEW_FRAME* aParent, int layer ) :
GERBER_IMAGE( aParent, layer )
{
m_State = READ_HEADER_STATE;
......
......@@ -40,7 +40,7 @@ void GBR_LAYER_BOX_SELECTOR::Resync()
{
Clear();
for( LAYER_NUM layerid = FIRST_LAYER; layerid < NB_LAYERS; ++layerid )
for( int layerid = 0; layerid < GERBER_DRAWLAYERS_COUNT; ++layerid )
{
wxBitmap layerbmp( 14, 14 );
wxString layername;
......@@ -59,7 +59,7 @@ void GBR_LAYER_BOX_SELECTOR::Resync()
// Returns a color index from the layer id
EDA_COLOR_T GBR_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayer ) const
EDA_COLOR_T GBR_LAYER_BOX_SELECTOR::GetLayerColor( int aLayer ) const
{
GERBVIEW_FRAME* frame = (GERBVIEW_FRAME*) GetParent()->GetParent();
......@@ -68,7 +68,7 @@ EDA_COLOR_T GBR_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayer ) const
// Returns the name of the layer id
wxString GBR_LAYER_BOX_SELECTOR::GetLayerName( LAYER_NUM aLayer ) const
wxString GBR_LAYER_BOX_SELECTOR::GetLayerName( int aLayer ) const
{
wxString name;
name.Printf( _( "Layer %d" ), aLayer + 1 );
......
......@@ -9,13 +9,11 @@ class GBR_LAYER_BOX_SELECTOR : public LAYER_BOX_SELECTOR
{
public:
GBR_LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL )
:LAYER_BOX_SELECTOR( parent, id, pos, size, n, choices )
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL ) :
LAYER_BOX_SELECTOR( parent, id, pos, size, n, choices )
{
m_layerhotkeys = false;
m_layerorder = false;
}
// Reload the Layers names and bitmaps
......@@ -24,15 +22,14 @@ public:
// Returns a color index from the layer id
// Virtual function
EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const;
EDA_COLOR_T GetLayerColor( int aLayer ) const;
// Returns true if the layer id is enabled (i.e. is it should be displayed)
// Virtual function
bool IsLayerEnabled( LAYER_NUM aLayer ) const { return true; };
bool IsLayerEnabled( int aLayer ) const { return true; };
// Returns the name of the layer id
// Virtual function
wxString GetLayerName( LAYER_NUM aLayer ) const;
wxString GetLayerName( int aLayer ) const;
};
#endif //CLASS_GBR_LAYER_BOX_SELECTOR_H
......@@ -14,7 +14,9 @@ GBR_LAYOUT::GBR_LAYOUT()
{
PAGE_INFO pageInfo( wxT( "GERBER" ) );
SetPageSettings( pageInfo );
m_printLayersMask = FULL_LAYERS;
// no m_printLayersMask = -1;
m_printLayersMask.set();
}
......@@ -22,16 +24,6 @@ GBR_LAYOUT::~GBR_LAYOUT()
{
}
/* Function IsLayerVisible
* tests whether a given layer is visible
* param aLayer = The layer to be tested
* return bool - true if the layer is visible.
*/
bool GBR_LAYOUT::IsLayerVisible( LAYER_NUM aLayer ) const
{
return m_printLayersMask & GetLayerMask( aLayer );
}
EDA_RECT GBR_LAYOUT::ComputeBoundingBox()
{
......
......@@ -11,6 +11,7 @@
#include <class_colors_design_settings.h>
#include <common.h> // PAGE_INFO
#include <gerbview.h> // GERBER_DRAWLAYERS_COUNT
#include <class_title_block.h>
#include <class_gerber_draw_item.h>
......@@ -27,7 +28,7 @@ private:
PAGE_INFO m_paper;
TITLE_BLOCK m_titles;
wxPoint m_originAxisPosition;
LAYER_MSK m_printLayersMask; // When printing: the list of layers to print
std::bitset <GERBER_DRAWLAYERS_COUNT> m_printLayersMask; // When printing: the list of layers to print
public:
DLIST<GERBER_DRAW_ITEM> m_Drawings; // linked list of Gerber Items
......@@ -87,24 +88,35 @@ public:
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
GR_DRAWMODE aDrawMode, const wxPoint& aOffset,
bool aPrintBlackAndWhite = false );
/**
* Function SetVisibleLayers
* changes the bit-mask of visible layers
* @param aLayerMask = The new bit-mask of visible layers
* Function SetPrintableLayers
* changes the list of printable layers
* @param aLayerMask = The new bit-mask of printable layers
*/
void SetVisibleLayers( LAYER_MSK aLayerMask )
void SetPrintableLayers( const std::bitset <GERBER_DRAWLAYERS_COUNT>& aLayerMask )
{
m_printLayersMask = aLayerMask;
}
/**
* Function IsLayerVisible
* Function GetPrintableLayers
* @return the bit-mask of printable layers
*/
std::bitset <GERBER_DRAWLAYERS_COUNT> GetPrintableLayers()
{
return m_printLayersMask;
}
/**
* Function IsLayerPrintable
* tests whether a given layer is visible
* @param aLayer = The layer to be tested
* @return bool - true if the layer is visible.
*/
bool IsLayerVisible( LAYER_NUM aLayer ) const;
bool IsLayerPrintable( int aLayer ) const
{
return m_printLayersMask[ aLayer ];
}
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // overload
......
......@@ -86,7 +86,7 @@ GBR_SCREEN::GBR_SCREEN( const wxSize& aPageSizeIU ) :
// Set the working grid size to a reasonable value (in 1/10000 inch)
SetGrid( DMIL_GRID( 500 ) );
m_Active_Layer = LAYER_N_BACK; // default active layer = bottom layer
m_Active_Layer = B_Cu; // default active layer = bottom layer
SetZoom( ZOOM_FACTOR( 350 ) ); // a default value for zoom
......
......@@ -36,6 +36,7 @@
#include <msgpanel.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <class_gerber_draw_item.h>
#include <class_GERBER.h>
......@@ -44,7 +45,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 = FIRST_LAYER;
m_Layer = 0;
m_Shape = GBR_SEGMENT;
m_Flashed = false;
m_DCode = 0;
......
......@@ -90,7 +90,7 @@ public:
* redundancy for these parameters
*/
private:
LAYER_NUM m_Layer;
int 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.
*/
LAYER_NUM GetLayer() const { return m_Layer; }
int GetLayer() const { return m_Layer; }
/**
* Function SetLayer
......@@ -132,12 +132,7 @@ public:
* is virtual because some items (in fact: class DIMENSION)
* have a slightly different initialization
*/
void SetLayer( LAYER_NUM aLayer ) { m_Layer = aLayer; }
LAYER_MSK GetLayerMask()
{
return ::GetLayerMask( m_Layer );
}
void SetLayer( int aLayer ) { m_Layer = aLayer; }
bool GetLayerPolarity()
{
......
......@@ -37,6 +37,7 @@
#include <class_gbr_layer_box_selector.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <class_GERBER.h>
#include <layer_widget.h>
#include <class_gerbview_layer_widget.h>
......@@ -169,7 +170,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
int rowCount;
int menuId = event.GetId();
bool visible = (menuId == ID_SHOW_ALL_LAYERS) ? true : false;;
LAYER_MSK visibleLayers = NO_LAYERS;
long visibleLayers = 0;
bool force_active_layer_visible;
m_alwaysShowActiveLayer = ( menuId == ID_ALWAYS_SHOW_NO_LAYERS_BUT_ACTIVE );
......@@ -186,7 +187,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
for( int row=0; row < rowCount; ++row )
{
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 );
LAYER_NUM layer = getDecodedId( cb->GetId() );
int layer = getDecodedId( cb->GetId() );
bool loc_visible = visible;
if( force_active_layer_visible && (layer == myframe->getActiveLayer() ) )
......@@ -195,9 +196,9 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
cb->SetValue( loc_visible );
if( loc_visible )
visibleLayers |= GetLayerMask( row );
visibleLayers |= 1 << row;
else
visibleLayers &= ~GetLayerMask( row );
visibleLayers &= ~( 1 << row );
}
myframe->SetVisibleLayers( visibleLayers );
......@@ -224,7 +225,7 @@ void GERBER_LAYER_WIDGET::ReFill()
{
ClearLayerRows();
for( LAYER_NUM layer = FIRST_LAYER; layer < NB_GERBER_LAYERS; ++layer )
for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
{
wxString msg;
msg.Printf( _("Layer %d"), layer+1 );
......@@ -237,18 +238,18 @@ void GERBER_LAYER_WIDGET::ReFill()
//-----<LAYER_WIDGET callbacks>-------------------------------------------
void GERBER_LAYER_WIDGET::OnLayerColorChange( LAYER_NUM aLayer, EDA_COLOR_T aColor )
void GERBER_LAYER_WIDGET::OnLayerColorChange( int aLayer, EDA_COLOR_T aColor )
{
myframe->SetLayerColor( aLayer, aColor );
myframe->m_SelLayerBox->ResyncBitmapOnly();
myframe->GetCanvas()->Refresh();
}
bool GERBER_LAYER_WIDGET::OnLayerSelect( LAYER_NUM aLayer )
bool GERBER_LAYER_WIDGET::OnLayerSelect( int aLayer )
{
// the layer change from the GERBER_LAYER_WIDGET can be denied by returning
// false from this function.
LAYER_NUM layer = myframe->getActiveLayer( );
int layer = myframe->getActiveLayer( );
myframe->setActiveLayer( aLayer, false );
myframe->syncLayerBox();
......@@ -261,14 +262,14 @@ bool GERBER_LAYER_WIDGET::OnLayerSelect( LAYER_NUM aLayer )
return true;
}
void GERBER_LAYER_WIDGET::OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal )
void GERBER_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal )
{
LAYER_MSK visibleLayers = myframe->GetVisibleLayers();
long visibleLayers = myframe->GetVisibleLayers();
if( isVisible )
visibleLayers |= GetLayerMask( aLayer );
visibleLayers |= 1 << aLayer;
else
visibleLayers &= ~GetLayerMask( aLayer );
visibleLayers &= ~( 1 << aLayer );
myframe->SetVisibleLayers( visibleLayers );
......
......@@ -91,9 +91,9 @@ public:
void ReFillRender();
//-----<implement LAYER_WIDGET abstract callback functions>-----------
void OnLayerColorChange( LAYER_NUM aLayer, EDA_COLOR_T aColor );
bool OnLayerSelect( LAYER_NUM aLayer );
void OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal );
void OnLayerColorChange( int aLayer, EDA_COLOR_T aColor );
bool OnLayerSelect( int aLayer );
void OnLayerVisible( int aLayer, bool isVisible, bool isFinal );
void OnRenderColorChange( int aId, EDA_COLOR_T aColor );
void OnRenderEnable( int aId, bool isEnabled );
/**
......
......@@ -30,6 +30,7 @@
#include <common.h>
#include <class_drawpanel.h>
#include <gerbview.h>
#include <gerbview_frame.h>
void GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
......
......@@ -38,6 +38,7 @@
#include <base_units.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <class_gerber_draw_item.h>
#include <class_GERBER.h>
......
......@@ -8,7 +8,7 @@
#include <select_layers_to_pcb.h>
// Exported function
const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber );
const wxString GetPCBDefaultLayerName( int aLayerNumber );
enum layer_sel_id {
......@@ -23,11 +23,11 @@ class SELECT_LAYER_DIALOG : public wxDialog
private:
GERBVIEW_FRAME* m_Parent;
wxRadioBox* m_LayerList;
LAYER_NUM m_LayerId[int(NB_LAYERS) + 1]; // One extra element for "(Deselect)" radiobutton
int m_LayerId[int(GERBER_DRAWLAYERS_COUNT) + 1]; // One extra element for "(Deselect)" radiobutton
public:
// Constructor and destructor
SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent, LAYER_NUM aDefaultLayer,
SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent, int aDefaultLayer,
int aCopperLayerCount, bool aShowDeselectOption );
~SELECT_LAYER_DIALOG() { };
......@@ -47,10 +47,10 @@ END_EVENT_TABLE()
/** Install the dialog box for layer selection
* @param aDefaultLayer = Preselection (NB_LAYERS for "(Deselect)" layer)
* @param aDefaultLayer = Preselection (GERBER_DRAWLAYERS_COUNT 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 (GERBER_DRAWLAYERS_COUNT when "(Deselect)" radiobutton selected),
* or -1 if canceled
*
* Providing the option to also display a "(Deselect)" radiobutton makes the
......@@ -61,10 +61,10 @@ END_EVENT_TABLE()
* different radiobutton is clicked on) prior to then clicking on the "Deselect"
* button provided within the "Layer selection:" dialog box).
*/
LAYER_NUM GERBVIEW_FRAME::SelectPCBLayer( LAYER_NUM aDefaultLayer, int aCopperLayerCount,
int GERBVIEW_FRAME::SelectPCBLayer( int aDefaultLayer, int aCopperLayerCount,
bool aShowDeselectOption )
{
LAYER_NUM layer;
int layer;
SELECT_LAYER_DIALOG* frame = new SELECT_LAYER_DIALOG( this, aDefaultLayer,
aCopperLayerCount,
aShowDeselectOption );
......@@ -82,14 +82,17 @@ LAYER_NUM GERBVIEW_FRAME::SelectPCBLayer( LAYER_NUM aDefaultLayer, int aCopperLa
* to the right of that radiobox.
*/
SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent,
LAYER_NUM aDefaultLayer, int aCopperLayerCount,
int aDefaultLayer, int aCopperLayerCount,
bool aShowDeselectOption ) :
wxDialog( parent, -1, _( "Select Layer:" ), wxPoint( -1, -1 ),
wxSize( 470, 250 ),
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )
{
#define NB_PCB_LAYERS 64
#define FIRST_COPPER_LAYER 0
#define LAST_COPPER_LAYER 31
wxButton* Button;
LAYER_NUM ii;
int ii;
wxString LayerList[NB_PCB_LAYERS + 1]; // One extra element for "(Deselect)"
// radiobutton
int LayerCount, LayerSelect = -1;
......@@ -98,9 +101,10 @@ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent,
// Build the layer list; first build copper layers list
LayerCount = 0;
for( ii = FIRST_COPPER_LAYER; ii < NB_COPPER_LAYERS; ++ii )
for( ii = FIRST_COPPER_LAYER; ii <= LAST_COPPER_LAYER; ++ii )
{
m_LayerId[ii] = FIRST_LAYER;
m_LayerId[ii] = 0;
if( ii == FIRST_COPPER_LAYER || ii == LAST_COPPER_LAYER || ii < aCopperLayerCount-1 )
{
......@@ -113,10 +117,11 @@ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent,
LayerCount++;
}
}
// Build the layer list; build non copper layers list
for( ; ii < NB_PCB_LAYERS; ++ii )
{
m_LayerId[ii] = FIRST_LAYER;
m_LayerId[ii] = 0;
LayerList[LayerCount] = GetPCBDefaultLayerName( ii );
......@@ -182,42 +187,42 @@ void SELECT_LAYER_DIALOG::OnCancelClick( wxCommandEvent& event )
EndModal( -1 );
}
const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber )
const wxString GetPCBDefaultLayerName( int aLayerNumber )
{
const wxChar* txt;
// Use a switch to explicitly show the mapping more clearly
switch( aLayerNumber )
{
case LAYER_N_FRONT: txt = wxT( "F.Cu" ); break;
case LAYER_N_2: txt = wxT( "Inner1.Cu" ); break;
case LAYER_N_3: txt = wxT( "Inner2.Cu" ); break;
case LAYER_N_4: txt = wxT( "Inner3.Cu" ); break;
case LAYER_N_5: txt = wxT( "Inner4.Cu" ); break;
case LAYER_N_6: txt = wxT( "Inner5.Cu" ); break;
case LAYER_N_7: txt = wxT( "Inner6.Cu" ); break;
case LAYER_N_8: txt = wxT( "Inner7.Cu" ); break;
case LAYER_N_9: txt = wxT( "Inner8.Cu" ); break;
case LAYER_N_10: txt = wxT( "Inner9.Cu" ); break;
case LAYER_N_11: txt = wxT( "Inner10.Cu" ); break;
case LAYER_N_12: txt = wxT( "Inner11.Cu" ); break;
case LAYER_N_13: txt = wxT( "Inner12.Cu" ); break;
case LAYER_N_14: txt = wxT( "Inner13.Cu" ); break;
case LAYER_N_15: txt = wxT( "Inner14.Cu" ); break;
case LAYER_N_BACK: txt = wxT( "B.Cu" ); break;
case ADHESIVE_N_BACK: txt = wxT( "B.Adhes" ); break;
case ADHESIVE_N_FRONT: txt = wxT( "F.Adhes" ); break;
case SOLDERPASTE_N_BACK: txt = wxT( "B.Paste" ); break;
case SOLDERPASTE_N_FRONT: txt = wxT( "F.Paste" ); break;
case SILKSCREEN_N_BACK: txt = wxT( "B.SilkS" ); break;
case SILKSCREEN_N_FRONT: txt = wxT( "F.SilkS" ); break;
case SOLDERMASK_N_BACK: txt = wxT( "B.Mask" ); break;
case SOLDERMASK_N_FRONT: txt = wxT( "F.Mask" ); break;
case DRAW_N: txt = wxT( "Dwgs.User" ); break;
case COMMENT_N: txt = wxT( "Cmts.User" ); break;
case ECO1_N: txt = wxT( "Eco1.User" ); break;
case ECO2_N: txt = wxT( "Eco2.User" ); break;
case EDGE_N: txt = wxT( "Edge.Cuts" ); break;
case F_Cu: txt = wxT( "F.Cu" ); break;
case In1_Cu: txt = wxT( "In1.Cu" ); break;
case In2_Cu: txt = wxT( "In2.Cu" ); break;
case In3_Cu: txt = wxT( "In3.Cu" ); break;
case In4_Cu: txt = wxT( "In4.Cu" ); break;
case In5_Cu: txt = wxT( "In5.Cu" ); break;
case In6_Cu: txt = wxT( "In6.Cu" ); break;
case In7_Cu: txt = wxT( "In7.Cu" ); break;
case In8_Cu: txt = wxT( "In8.Cu" ); break;
case In9_Cu: txt = wxT( "In9.Cu" ); break;
case In10_Cu: txt = wxT( "In10.Cu" ); break;
case In11_Cu: txt = wxT( "In11.Cu" ); break;
case In12_Cu: txt = wxT( "In12.Cu" ); break;
case In13_Cu: txt = wxT( "In13.Cu" ); break;
case In14_Cu: txt = wxT( "In14.Cu" ); break;
case B_Cu: txt = wxT( "B.Cu" ); break;
case B_Adhes: txt = wxT( "B.Adhes" ); break;
case F_Adhes: txt = wxT( "F.Adhes" ); break;
case B_Paste: txt = wxT( "B.Paste" ); break;
case F_Paste: txt = wxT( "F.Paste" ); break;
case B_SilkS: txt = wxT( "B.SilkS" ); break;
case F_SilkS: txt = wxT( "F.SilkS" ); break;
case B_Mask: txt = wxT( "B.Mask" ); break;
case F_Mask: txt = wxT( "F.Mask" ); break;
case Dwgs_User: txt = wxT( "Dwgs.User" ); break;
case Cmts_User: txt = wxT( "Cmts.User" ); break;
case Eco1_User: txt = wxT( "Eco1.User" ); break;
case Eco2_User: txt = wxT( "Eco2.User" ); break;
case Edge_Cuts: txt = wxT( "Edge.Cuts" ); break;
default: txt = wxT( "BAD_INDEX" ); break;
}
......
......@@ -32,6 +32,7 @@
#include <macros.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <dialog_show_page_borders.h>
......
......@@ -11,6 +11,7 @@
#include <pcbplot.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <gerbview_dialog_display_options_frame_base.h>
......
......@@ -36,21 +36,21 @@
#include <base_units.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <colors_selection.h>
#include <class_gerber_draw_item.h>
#include <class_GERBER.h>
#include <printout_controler.h>
void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer,
void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMasklayer,
bool aPrintMirrorMode, void* aData )
{
// Save current draw options, because print mode has specific options:
LAYER_MSK visiblemask = GetVisibleLayers();
GBR_DISPLAY_OPTIONS imgDisplayOptions = m_DisplayOptions;
std::bitset <GERBER_DRAWLAYERS_COUNT> printLayersMask = GetGerberLayout()->GetPrintableLayers();
// Set draw options for printing:
SetVisibleLayers( aPrintMasklayer );
m_DisplayOptions.m_DisplayFlashedItemsFill = true;
m_DisplayOptions.m_DisplayLinesFill = true;
m_DisplayOptions.m_DisplayPolygonsFill = true;
......@@ -58,7 +58,10 @@ void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer,
m_DisplayOptions.m_IsPrinting = true;
PRINT_PARAMETERS* printParameters = (PRINT_PARAMETERS*)aData;
std::bitset <GERBER_DRAWLAYERS_COUNT> printCurrLayerMask;
printCurrLayerMask.reset();
printCurrLayerMask.set(printParameters->m_Flags); // m_Flags contains the draw layer number
GetGerberLayout()->SetPrintableLayers( printCurrLayerMask );
m_canvas->SetPrintMirrored( aPrintMirrorMode );
bool printBlackAndWhite = printParameters && printParameters->m_Print_Black_and_White;
......@@ -68,7 +71,7 @@ void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer,
m_canvas->SetPrintMirrored( false );
// Restore draw options:
SetVisibleLayers( visiblemask );
GetGerberLayout()->SetPrintableLayers( printLayersMask );
m_DisplayOptions = imgDisplayOptions;
}
......@@ -211,14 +214,14 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
bool end = false;
for( LAYER_NUM layer = FIRST_LAYER; !end; ++layer )
for( int layer = 0; !end; ++layer )
{
LAYER_NUM active_layer = gerbFrame->getActiveLayer();
int active_layer = gerbFrame->getActiveLayer();
if( layer == active_layer ) // active layer will be drawn after other layers
continue;
if( layer == NB_GERBER_LAYERS ) // last loop: draw active layer
if( layer == GERBER_DRAWLAYERS_COUNT ) // last loop: draw active layer
{
end = true;
layer = active_layer;
......
......@@ -11,6 +11,7 @@
#include <gestfich.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <kicad_device_context.h>
#include <gerbview_id.h>
#include <class_GERBER.h>
......@@ -226,7 +227,7 @@ void GERBVIEW_FRAME::OnSelectActiveDCode( wxCommandEvent& event )
void GERBVIEW_FRAME::OnSelectActiveLayer( wxCommandEvent& event )
{
LAYER_NUM layer = getActiveLayer();
int layer = getActiveLayer();
setActiveLayer( event.GetSelection() );
......@@ -240,7 +241,7 @@ void GERBVIEW_FRAME::OnSelectActiveLayer( wxCommandEvent& event )
void GERBVIEW_FRAME::OnShowGerberSourceFile( wxCommandEvent& event )
{
LAYER_NUM layer = getActiveLayer();
int layer = getActiveLayer();
GERBER_IMAGE* gerber_layer = g_GERBER_List[layer];
if( gerber_layer )
......
......@@ -67,6 +67,7 @@
#include <confirm.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <trigo.h>
#include <macros.h>
#include <base_units.h>
......@@ -92,13 +93,13 @@ extern double ReadDouble( char*& text, bool aSkipSeparator = true );
extern void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
APERTURE_T aAperture,
int Dcode_index,
LAYER_NUM aLayer,
int aLayer,
const wxPoint& aPos,
wxSize aSize,
bool aLayerNegative );
void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
int Dcode_index,
LAYER_NUM aLayer,
int aLayer,
const wxPoint& aStart,
const wxPoint& aEnd,
wxSize aPenSize,
......@@ -167,7 +168,7 @@ static EXCELLON_CMD excellon_G_CmdList[] =
bool GERBVIEW_FRAME::Read_EXCELLON_File( const wxString& aFullFileName )
{
wxString msg;
LAYER_NUM layer = getActiveLayer(); // current layer used in GerbView
int layer = getActiveLayer(); // current layer used in GerbView
if( g_GERBER_List[layer] == NULL )
{
......
......@@ -7,13 +7,13 @@
#include <fctsys.h>
#include <common.h>
// #include <class_drawpanel.h>
#include <confirm.h>
#include <macros.h>
#include <kicad_string.h>
#include <gestfich.h>
#include <trigo.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <class_gerber_draw_item.h>
#include <select_layers_to_pcb.h>
#include <build_version.h>
......@@ -123,7 +123,7 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event )
int layercount = 0;
// Count the Gerber layers which are actually currently used
for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii )
for( LAYER_NUM ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii )
{
if( g_GERBER_List[ii] != NULL )
layercount++;
......@@ -190,16 +190,17 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( LAYER_NUM* LayerLookUpTable, int aCopperLay
// create an image of gerber data
// First: non copper layers:
GERBER_DRAW_ITEM* gerb_item = m_gerbview_frame->GetItemsList();
int pcbCopperLayerMax = 31;
for( ; gerb_item; gerb_item = gerb_item->Next() )
{
LAYER_NUM layer = gerb_item->GetLayer();
int layer = gerb_item->GetLayer();
LAYER_NUM pcb_layer_number = LayerLookUpTable[layer];
if( !IsPcbLayer( pcb_layer_number ) )
continue;
if( pcb_layer_number > LAST_COPPER_LAYER )
if( pcb_layer_number > pcbCopperLayerMax )
export_non_copper_item( gerb_item, pcb_layer_number );
}
......@@ -209,10 +210,10 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( LAYER_NUM* LayerLookUpTable, int aCopperLay
for( ; gerb_item; gerb_item = gerb_item->Next() )
{
LAYER_NUM layer = gerb_item->GetLayer();
int layer = gerb_item->GetLayer();
LAYER_NUM pcb_layer_number = LayerLookUpTable[layer];
if( pcb_layer_number < 0 || pcb_layer_number > LAST_COPPER_LAYER )
if( pcb_layer_number < 0 || pcb_layer_number > pcbCopperLayerMax )
continue;
else
......@@ -398,13 +399,7 @@ void GBR_TO_PCB_EXPORTER::writePcbHeader()
// Write copper layer count
fprintf( m_fp, "LayerCount %d\n", m_pcbCopperLayersCount );
// Write enabled layer mask:
int lmask = ALL_NO_CU_LAYERS | EXTERNAL_CU_LAYERS;
for( int ii = 0; ii < m_pcbCopperLayersCount - 2; ii++ )
lmask |= 2 << ii;
fprintf( m_fp, "EnabledLayers %08X\n", lmask );
fprintf( m_fp, "$EndGENERAL\n\n" );
// Creates void setup
......
......@@ -33,6 +33,7 @@
#include <gestfich.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <gerbview_id.h>
#include <class_gerbview_layer_widget.h>
#include <wildcards_and_files_ext.h>
......@@ -163,7 +164,7 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName )
}
// Read gerber files: each file is loaded on a new GerbView layer
LAYER_NUM layer = getActiveLayer();
int layer = getActiveLayer();
for( unsigned ii = 0; ii < filenamesList.GetCount(); ii++ )
{
......@@ -244,7 +245,7 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName )
}
// Read gerber files: each file is loaded on a new GerbView layer
LAYER_NUM layer = getActiveLayer();
int layer = getActiveLayer();
for( unsigned ii = 0; ii < filenamesList.GetCount(); ii++ )
{
......
......@@ -36,6 +36,7 @@
#include <gerbview.h>
#include <gerbview_id.h>
#include <hotkeys.h>
#include <gerbview_frame.h>
#include <build_version.h>
......
......@@ -8,9 +8,6 @@
#include <vector>
#include <set>
#include <dcode.h>
#include <class_gerber_draw_item.h>
#include <class_aperture_macro.h>
#define CURSEUR_ON_GRILLE 0
#define CURSEUR_OFF_GRILLE 1
......@@ -32,6 +29,8 @@ extern const wxChar* g_GerberPageSizeList[8];
#define GERB_STOP_DRAW 2 // Extinguish light (lift pen)
#define GERB_FLASH 3 // Flash
// number fo draw layers in Gerbview
#define GERBER_DRAWLAYERS_COUNT 32
/**
* Enum GERBER_VISIBLE_ID
......@@ -47,9 +46,6 @@ enum GERBER_VISIBLE_ID
END_GERBER_VISIBLE_LIST // sentinel
};
extern const wxString GerbviewProjectFileExt;
extern const wxString GerbviewProjectFileWildcard;
// Interpolation type
enum Gerb_Interpolation
{
......@@ -93,13 +89,6 @@ enum Gerb_Analyse_Cmd
ENTER_RS274X_CMD
};
/**************/
/* rs274x.cpp */
/**************/
bool GetEndOfBlock( char buff[GERBER_BUFZ], char*& text, FILE* gerber_file );
extern GERBER_IMAGE* g_GERBER_List[32];
#include <gerbview_frame.h>
extern GERBER_IMAGE* g_GERBER_List[GERBER_DRAWLAYERS_COUNT];
#endif // ifndef GERBVIEW_H
......@@ -38,14 +38,13 @@
#include <colors_selection.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <hotkeys.h>
#include <dialog_hotkeys_editor.h>
#define GROUP wxT("/gerbview")
#define INSETUP true
void GERBVIEW_FRAME::Process_Config( wxCommandEvent& event )
{
......
......@@ -27,7 +27,6 @@
*/
#include <fctsys.h>
//#include <pgm_base.h>
#include <kiface_i.h>
#include <wxstruct.h>
#include <class_drawpanel.h>
......@@ -40,6 +39,7 @@
#include <msgpanel.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <class_gerber_draw_item.h>
#include <pcbplot.h>
#include <gerbview_id.h>
......@@ -92,7 +92,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
SetLayout( new GBR_LAYOUT() );
SetVisibleLayers( FULL_LAYERS ); // All 32 layers visible.
SetVisibleLayers( -1 ); // All draw layers visible.
SetScreen( new GBR_SCREEN( GetGerberLayout()->GetPageSettings().GetSizeIU() ) );
......@@ -167,6 +167,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
m_LayersManager->ReFillRender(); // Update colors in Render after the config is read
m_auimgr.Update();
setActiveLayer( 0, true );
Zoom_Automatique( true ); // Gives a default zoom value
}
......@@ -184,9 +185,9 @@ void GERBVIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
bool GERBVIEW_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
{
const unsigned limit = std::min( unsigned( aFileSet.size() ), unsigned( NB_GERBER_LAYERS ) );
const unsigned limit = std::min( unsigned( aFileSet.size() ), unsigned( GERBER_DRAWLAYERS_COUNT ) );
LAYER_NUM layer = FIRST_LAYER;
int layer = 0;
for( unsigned i=0; i<limit; ++i, ++layer )
{
......@@ -338,11 +339,11 @@ void GERBVIEW_FRAME::SetElementVisibility( GERBER_VISIBLE_ID aItemIdVisible,
}
LAYER_NUM GERBVIEW_FRAME::getNextAvailableLayer( LAYER_NUM aLayer ) const
int GERBVIEW_FRAME::getNextAvailableLayer( int aLayer ) const
{
LAYER_NUM layer = aLayer;
int layer = aLayer;
for( LAYER_NUM i = FIRST_LAYER; i < NB_GERBER_LAYERS; ++i )
for( int i = 0; i < GERBER_DRAWLAYERS_COUNT; ++i )
{
GERBER_IMAGE* gerber = g_GERBER_List[ layer ];
......@@ -351,8 +352,8 @@ LAYER_NUM GERBVIEW_FRAME::getNextAvailableLayer( LAYER_NUM aLayer ) const
++layer;
if( layer >= NB_GERBER_LAYERS )
layer = FIRST_LAYER;
if( layer >= GERBER_DRAWLAYERS_COUNT )
layer = 0;
}
return NO_AVAILABLE_LAYERS;
......@@ -398,9 +399,9 @@ void GERBVIEW_FRAME::Liste_D_Codes()
wxArrayString list;
double scale = g_UserUnit == INCHES ? IU_PER_MILS * 1000 :
IU_PER_MM;
LAYER_NUM curr_layer = getActiveLayer();
int curr_layer = getActiveLayer();
for( LAYER_NUM layer = FIRST_LAYER; layer < NB_LAYERS; ++layer )
for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
{
GERBER_IMAGE* gerber = g_GERBER_List[layer];
......@@ -551,9 +552,9 @@ void GERBVIEW_FRAME::SetVisibleAlls()
* Returns a bit-mask of all the layers that are visible
* @return int - the visible layers in bit-mapped form.
*/
LAYER_MSK GERBVIEW_FRAME::GetVisibleLayers() const
long GERBVIEW_FRAME::GetVisibleLayers() const
{
return FULL_LAYERS; // TODO
return -1; // TODO
}
......@@ -563,9 +564,9 @@ LAYER_MSK GERBVIEW_FRAME::GetVisibleLayers() const
* changes the bit-mask of visible layers
* @param aLayerMask = The new bit-mask of visible layers
*/
void GERBVIEW_FRAME::SetVisibleLayers( LAYER_MSK aLayerMask )
void GERBVIEW_FRAME::SetVisibleLayers( long aLayerMask )
{
GetGerberLayout()->SetVisibleLayers( aLayerMask );
// GetGerberLayout()->SetVisibleLayers( aLayerMask );
}
......@@ -575,12 +576,12 @@ void GERBVIEW_FRAME::SetVisibleLayers( LAYER_MSK aLayerMask )
* @param aLayer = The layer to be tested
* @return bool - true if the layer is visible.
*/
bool GERBVIEW_FRAME::IsLayerVisible( LAYER_NUM aLayer ) const
bool GERBVIEW_FRAME::IsLayerVisible( int aLayer ) const
{
if( ! m_DisplayOptions.m_IsPrinting )
return m_LayersManager->IsLayerVisible( aLayer );
else
return GetGerberLayout()->IsLayerVisible( aLayer );
return GetGerberLayout()->IsLayerPrintable( aLayer );
}
......@@ -664,7 +665,7 @@ EDA_COLOR_T GERBVIEW_FRAME::GetNegativeItemsColor() const
* Function GetLayerColor
* gets a layer color for any valid layer.
*/
EDA_COLOR_T GERBVIEW_FRAME::GetLayerColor( LAYER_NUM aLayer ) const
EDA_COLOR_T GERBVIEW_FRAME::GetLayerColor( int aLayer ) const
{
return m_colorsSettings->GetLayerColor( aLayer );
}
......@@ -674,7 +675,7 @@ EDA_COLOR_T GERBVIEW_FRAME::GetLayerColor( LAYER_NUM aLayer ) const
* Function SetLayerColor
* changes a layer color for any valid layer.
*/
void GERBVIEW_FRAME::SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor )
void GERBVIEW_FRAME::SetLayerColor( int aLayer, EDA_COLOR_T aColor )
{
m_colorsSettings->SetLayerColor( aLayer, aColor );
}
......@@ -684,7 +685,7 @@ void GERBVIEW_FRAME::SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor )
* Function getActiveLayer
* returns the active layer
*/
LAYER_NUM GERBVIEW_FRAME::getActiveLayer()
int GERBVIEW_FRAME::getActiveLayer()
{
return ( (GBR_SCREEN*) GetScreen() )->m_Active_Layer;
}
......@@ -695,7 +696,7 @@ LAYER_NUM GERBVIEW_FRAME::getActiveLayer()
* will change the currently active layer to \a aLayer and also
* update the PCB_LAYER_WIDGET.
*/
void GERBVIEW_FRAME::setActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate )
void GERBVIEW_FRAME::setActiveLayer( int aLayer, bool doLayerWidgetUpdate )
{
( (GBR_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;
......
......@@ -37,7 +37,6 @@
#include <gerbview.h>
#include <class_gbr_layout.h>
#include <class_gbr_screen.h>
#include <layers_id_colors_and_visibility.h>
#define NO_AVAILABLE_LAYERS UNDEFINED_LAYER
......@@ -167,7 +166,7 @@ public:
* different radiobutton is clicked on) prior to then clicking on the "Deselect"
* button provided within the "Layer selection:" dialog box).
*/
LAYER_NUM SelectPCBLayer( LAYER_NUM aDefaultLayer, int aOpperLayerCount, bool aNullLayer = false );
int SelectPCBLayer( int aDefaultLayer, int aOpperLayerCount, bool aNullLayer = false );
protected:
GERBER_LAYER_WIDGET* m_LayersManager;
......@@ -306,9 +305,9 @@ public:
* Function GetVisibleLayers
* is a proxy function that calls the correspondent function in m_BoardSettings
* Returns a bit-mask of all the layers that are visible
* @return int - the visible layers in bit-mapped form.
* @return long - the visible layers in bit-mapped form.
*/
LAYER_MSK GetVisibleLayers() const;
long GetVisibleLayers() const;
/**
* Function SetVisibleLayers
......@@ -316,7 +315,7 @@ public:
* changes the bit-mask of visible layers
* @param aLayerMask = The new bit-mask of visible layers
*/
void SetVisibleLayers( LAYER_MSK aLayerMask );
void SetVisibleLayers( long aLayerMask );
/**
* Function IsLayerVisible
......@@ -324,7 +323,7 @@ public:
* @param aLayer = The layer to be tested
* @return bool - true if the layer is visible.
*/
bool IsLayerVisible( LAYER_NUM aLayer ) const;
bool IsLayerVisible( int aLayer ) const;
/**
* Function GetVisibleElementColor
......@@ -338,13 +337,13 @@ public:
* Function GetLayerColor
* gets a layer color for any valid layer.
*/
EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const;
EDA_COLOR_T GetLayerColor( int aLayer ) const;
/**
* Function SetLayerColor
* changes a layer color for any valid layer.
*/
void SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor );
void SetLayerColor( int aLayer, EDA_COLOR_T aColor );
/**
* Function GetNegativeItemsColor
......@@ -396,13 +395,13 @@ public:
* will change the currently active layer to \a aLayer and also
* update the GERBER_LAYER_WIDGET.
*/
void setActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate = true );
void setActiveLayer( int aLayer, bool doLayerWidgetUpdate = true );
/**
* Function getActiveLayer
* returns the active layer
*/
LAYER_NUM getActiveLayer();
int getActiveLayer();
/**
* Function getNextAvailableLayer
......@@ -411,7 +410,7 @@ public:
* @param aLayer The first layer to search.
* @return The first empty layer found or NO_AVAILABLE_LAYERS.
*/
LAYER_NUM getNextAvailableLayer( LAYER_NUM aLayer = FIRST_LAYER ) const;
int getNextAvailableLayer( int aLayer = 0 ) const;
bool hasAvailableLayers() const
{
......@@ -667,7 +666,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer, bool aPrintMirrorMode,
virtual void PrintPage( wxDC* aDC, LSET aPrintMasklayer, bool aPrintMirrorMode,
void* aData = NULL );
/**
......
......@@ -8,6 +8,7 @@
#include <id.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <class_drawpanel.h>
#include <hotkeys.h>
......
......@@ -32,6 +32,7 @@
#include <confirm.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <class_gerber_draw_item.h>
#include <class_GERBER.h>
#include <class_gerbview_layer_widget.h>
......@@ -39,7 +40,7 @@
bool GERBVIEW_FRAME::Clear_Pcb( bool query )
{
LAYER_NUM layer;
int layer;
if( GetGerberLayout() == NULL )
return false;
......@@ -52,7 +53,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query )
GetGerberLayout()->m_Drawings.DeleteAll();
for( layer = FIRST_LAYER; layer < NB_GERBER_LAYERS; ++layer )
for( layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
{
if( g_GERBER_List[layer] )
{
......@@ -65,7 +66,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query )
SetScreen( new GBR_SCREEN( GetPageSettings().GetSizeIU() ) );
setActiveLayer( FIRST_LAYER );
setActiveLayer( 0 );
m_LayersManager->UpdateLayerIcons();
syncLayerBox();
return true;
......@@ -74,7 +75,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query )
void GERBVIEW_FRAME::Erase_Current_Layer( bool query )
{
LAYER_NUM layer = getActiveLayer();
int layer = getActiveLayer();
wxString msg;
msg.Printf( _( "Clear layer %d?" ), layer + 1 );
......
......@@ -31,6 +31,7 @@
#include <msgpanel.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <class_gerber_draw_item.h>
......@@ -46,7 +47,7 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc
if( aTypeloc == CURSEUR_ON_GRILLE )
ref = GetNearestGridPosition( ref );
LAYER_NUM layer = getActiveLayer();
int layer = getActiveLayer();
// Search first on active layer
GERBER_DRAW_ITEM* gerb_item = GetItemsList();
......
......@@ -32,6 +32,7 @@
#include <pgm_base.h>
#include <kiface_i.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <gerbview_id.h>
#include <hotkeys.h>
#include <menus_helpers.h>
......
......@@ -7,6 +7,7 @@
#include <common.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <gerbview_id.h>
#include <class_GERBER.h>
#include <dialog_helpers.h>
......
......@@ -8,6 +8,7 @@
#include <id.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <menus_helpers.h>
......
......@@ -6,6 +6,7 @@
#include <common.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <pcbplot.h>
/** TODO */
......
......@@ -8,6 +8,7 @@
#include <kicad_string.h>
#include <gestfich.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <class_GERBER.h>
#include <html_messagebox.h>
......@@ -25,7 +26,7 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName,
wxString msg;
char* text;
LAYER_NUM layer; // current layer used in GerbView
int layer; // current layer used in GerbView
layer = getActiveLayer();
......
......@@ -30,6 +30,7 @@
#include <common.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <trigo.h>
#include <macros.h>
#include <class_gerber_draw_item.h>
......@@ -107,7 +108,7 @@
void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
APERTURE_T aAperture,
int Dcode_index,
LAYER_NUM aLayer,
int aLayer,
const wxPoint& aPos,
wxSize aSize,
bool aLayerNegative )
......@@ -159,7 +160,7 @@ void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
*/
void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
int Dcode_index,
LAYER_NUM aLayer,
int aLayer,
const wxPoint& aStart,
const wxPoint& aEnd,
wxSize aPenSize,
......@@ -208,7 +209,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, LAYER_NUM aLayer,
static void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, int aLayer,
const wxPoint& aStart, const wxPoint& aEnd,
const wxPoint& aRelCenter, wxSize aPenSize,
bool aClockwise, bool aMultiquadrant,
......@@ -344,10 +345,11 @@ static void fillArcPOLY( GERBER_DRAW_ITEM* aGbrItem,
* so we muse create a dummy track and use its geometric parameters
*/
static GERBER_DRAW_ITEM dummyGbrItem( NULL, NULL );
static const int drawlayer = 0;
aGbrItem->SetLayerPolarity( aLayerNegative );
fillArcGBRITEM( &dummyGbrItem, 0, FIRST_LAYER,
fillArcGBRITEM( &dummyGbrItem, 0, drawlayer,
aStart, aEnd, rel_center, wxSize(0, 0),
aClockwise, aMultiquadrant, aLayerNegative );
......@@ -568,7 +570,7 @@ bool GERBER_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
GERBER_DRAW_ITEM* gbritem;
GBR_LAYOUT* layout = m_Parent->GetGerberLayout();
LAYER_NUM activeLayer = m_Parent->getActiveLayer();
int activeLayer = m_Parent->getActiveLayer();
int dcode = 0;
D_CODE* tool = NULL;
......
......@@ -12,6 +12,7 @@
extern int ReadInt( char*& text, bool aSkipSeparator = true );
extern double ReadDouble( char*& text, bool aSkipSeparator = true );
extern bool GetEndOfBlock( char buff[GERBER_BUFZ], char*& text, FILE* gerber_file );
#define CODE( x, y ) ( ( (x) << 8 ) + (y) )
......
......@@ -27,9 +27,9 @@
*/
#include <fctsys.h>
//#include <pgm_base.h>
#include <kiface_i.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <gerbview_id.h>
#include <class_GERBER.h>
......@@ -41,7 +41,7 @@ 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 + NB_GERBER_LAYERS
ID_TEXT_0 = ID_BUTTON_0 + GERBER_DRAWLAYERS_COUNT
};
......@@ -55,7 +55,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 + NB_GERBER_LAYERS-1,
EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + GERBER_DRAWLAYERS_COUNT-1,
wxEVT_COMMAND_BUTTON_CLICKED,
LAYERS_MAP_DIALOG::OnSelectLayer )
END_EVENT_TABLE()
......@@ -102,8 +102,7 @@ void LAYERS_MAP_DIALOG::initDialog()
// version are also 26 pixels wide and 26 pixels high. If appropriate,
// the above code should be modified as required in the event that those
// buttons should be some other size in that version.
for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii )
for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii )
{
// Specify the default value for each member of these arrays.
m_buttonTable[ii] = -1;
......@@ -111,32 +110,31 @@ void LAYERS_MAP_DIALOG::initDialog()
}
// Ensure we have:
// at least 2 copper layers and BOARD_COPPER_LAYERS_MAX_COUNT copper layers max
// at least 2 copper layers and less than max pacb copper layers count
// and even layers count because a board *must* have even layers count
// and maxi BOARD_COPPER_LAYERS_MAX_COUNT copper layers count
normalizeBrdLayersCount();
int idx = ( m_exportBoardCopperLayersCount / 2 ) - 1;
m_comboCopperLayersCount->SetSelection( idx );
LAYER_NUM pcb_layer_num = FIRST_LAYER;
m_itemsCount = 0;
for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii )
LAYER_NUM pcb_layer_num = 0;
m_gerberActiveLayersCount = 0;
for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii )
{
if( g_GERBER_List[ii] == NULL )
continue;
break;
if( (pcb_layer_num == m_exportBoardCopperLayersCount - 1)
&& (m_exportBoardCopperLayersCount > 1) )
pcb_layer_num = LAYER_N_FRONT;
pcb_layer_num = F_Cu;
m_buttonTable[m_itemsCount] = ii;
m_buttonTable[m_gerberActiveLayersCount] = ii;
m_layersLookUpTable[ii] = pcb_layer_num;
m_itemsCount++;
m_gerberActiveLayersCount++;
++pcb_layer_num;
}
if( m_itemsCount <= NB_GERBER_LAYERS/2 ) // Only one list is enough
if( m_gerberActiveLayersCount <= GERBER_DRAWLAYERS_COUNT/2 ) // Only one list is enough
{
m_staticlineSep->Hide();
}
......@@ -151,7 +149,7 @@ void LAYERS_MAP_DIALOG::initDialog()
}
wxFlexGridSizer* flexColumnBoxSizer = m_flexLeftColumnBoxSizer;
for( int ii = 0; ii < m_itemsCount; ii++ )
for( int ii = 0; ii < m_gerberActiveLayersCount; ii++ )
{
// Each Gerber layer has an associated static text string (to
// identify that layer), a button (for invoking a child dialog
......@@ -178,7 +176,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 == NB_GERBER_LAYERS/2 )
if( ii == GERBER_DRAWLAYERS_COUNT/2 )
flexColumnBoxSizer = m_flexRightColumnBoxSizer;
// Provide a text string to identify the Gerber layer
......@@ -226,7 +224,7 @@ void LAYERS_MAP_DIALOG::initDialog()
wxDefaultSize, 0 );
goodSize = text->GetSize();
for( LAYER_NUM jj = FIRST_LAYER; jj < NB_LAYERS; ++jj )
for( LAYER_NUM jj = 0; jj < GERBER_DRAWLAYERS_COUNT; ++jj )
{
text->SetLabel( GetPCBDefaultLayerName( jj ) );
if( goodSize.x < text->GetSize().x )
......@@ -259,8 +257,8 @@ void LAYERS_MAP_DIALOG::normalizeBrdLayersCount()
if( ( m_exportBoardCopperLayersCount & 1 ) )
m_exportBoardCopperLayersCount++;
if( m_exportBoardCopperLayersCount > NB_LAYERS )
m_exportBoardCopperLayersCount = NB_LAYERS;
if( m_exportBoardCopperLayersCount > GERBER_DRAWLAYERS_COUNT )
m_exportBoardCopperLayersCount = GERBER_DRAWLAYERS_COUNT;
if( m_exportBoardCopperLayersCount < 2 )
m_exportBoardCopperLayersCount = 2;
......@@ -284,11 +282,11 @@ void LAYERS_MAP_DIALOG::OnResetClick( wxCommandEvent& event )
wxString msg;
int ii;
LAYER_NUM layer;
for( ii = 0, layer = FIRST_LAYER; ii < m_itemsCount; ii++, ++layer )
for( ii = 0, layer = 0; ii < m_gerberActiveLayersCount; ii++, ++layer )
{
if( (layer == m_exportBoardCopperLayersCount - 1)
&& (m_exportBoardCopperLayersCount > 1) )
layer = LAYER_N_FRONT;
layer = F_Cu;
m_layersLookUpTable[ii] = layer;
msg = GetPCBDefaultLayerName( layer );
m_layersList[ii]->SetLabel( msg );
......@@ -306,7 +304,7 @@ void LAYERS_MAP_DIALOG::OnStoreSetup( wxCommandEvent& event )
config->Write( wxT("BrdLayersCount"), m_exportBoardCopperLayersCount );
wxString key;
for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii )
for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii )
{
key.Printf( wxT("GbrLyr%dToPcb"), ii );
config->Write( key, m_layersLookUpTable[ii] );
......@@ -324,7 +322,7 @@ void LAYERS_MAP_DIALOG::OnGetSetup( wxCommandEvent& event )
m_comboCopperLayersCount->SetSelection( idx );
wxString key;
for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii )
for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii )
{
key.Printf( wxT("GbrLyr%dToPcb"), ii );
int ilayer;
......@@ -332,7 +330,7 @@ void LAYERS_MAP_DIALOG::OnGetSetup( wxCommandEvent& event )
m_layersLookUpTable[ii] = ilayer;
}
for( int ii = 0; ii < m_itemsCount; ii++ )
for( int ii = 0; ii < m_gerberActiveLayersCount; ii++ )
{
LAYER_NUM layer = m_layersLookUpTable[ii];
if( layer == UNSELECTED_LAYER )
......@@ -354,7 +352,7 @@ void LAYERS_MAP_DIALOG::OnSelectLayer( wxCommandEvent& event )
ii = event.GetId() - ID_BUTTON_0;
if( (ii < FIRST_LAYER) || (ii >= NB_GERBER_LAYERS) )
if( (ii < 0) || (ii >= GERBER_DRAWLAYERS_COUNT) )
{
wxFAIL_MSG( wxT("Bad layer id") );
return;
......@@ -362,7 +360,7 @@ void LAYERS_MAP_DIALOG::OnSelectLayer( wxCommandEvent& event )
LAYER_NUM jj = m_layersLookUpTable[m_buttonTable[ii]];
if( !IsValidLayer( jj ) )
jj = LAYER_N_BACK; // (Defaults to "Copper" layer.)
jj = B_Cu; // (Defaults to "Copper" layer.)
jj = m_Parent->SelectPCBLayer( jj, m_exportBoardCopperLayersCount, true );
......@@ -406,9 +404,9 @@ void LAYERS_MAP_DIALOG::OnOkClick( wxCommandEvent& event )
normalizeBrdLayersCount();
int inner_layer_max = 0;
for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii )
for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii )
{
if( m_layersLookUpTable[ii] < LAYER_N_FRONT )
if( m_layersLookUpTable[ii] < F_Cu )
{
if( m_layersLookUpTable[ii ] > inner_layer_max )
inner_layer_max = m_layersLookUpTable[ii];
......
......@@ -6,24 +6,23 @@
#define _SELECT_LAYERS_TO_PCB_H_
#include <dialogs/dialog_layers_select_to_pcb_base.h>
#include <layers_id_colors_and_visibility.h>
/*
* This dialog shows the gerber files loaded, and allows user to choose
* equivalence tbetween gerber layers and pcb layers
* equivalence between gerber layers and pcb layers
*/
class LAYERS_MAP_DIALOG : public LAYERS_MAP_DIALOG_BASE
{
private:
GERBVIEW_FRAME* m_Parent;
int m_itemsCount;
int m_gerberActiveLayersCount; // Number of initialized gerber layers
static int m_exportBoardCopperLayersCount;
wxFlexGridSizer* m_flexRightColumnBoxSizer; // An extra wxFlexGridSizer used
// when we have more than 16 gerber files loaded
LAYER_NUM m_layersLookUpTable[NB_GERBER_LAYERS]; // Indexes Gerber layers to PCB file layers
LAYER_NUM m_layersLookUpTable[GERBER_DRAWLAYERS_COUNT]; // Indexes Gerber layers to PCB file layers
// the last value in table is the number of copper layers
int m_buttonTable[int(NB_GERBER_LAYERS)+1]; // Indexes buttons to Gerber layers
wxStaticText* m_layersList[int(NB_GERBER_LAYERS)+1]; // Indexes text strings to buttons
int m_buttonTable[int(GERBER_DRAWLAYERS_COUNT)+1]; // Indexes buttons to Gerber layers
wxStaticText* m_layersList[int(GERBER_DRAWLAYERS_COUNT)+1]; // Indexes text strings to buttons
public: LAYERS_MAP_DIALOG( GERBVIEW_FRAME* parent );
~LAYERS_MAP_DIALOG() {};
......
......@@ -33,6 +33,7 @@
#include <common.h>
#include <macros.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <bitmaps.h>
#include <gerbview_id.h>
#include <hotkeys.h>
......@@ -292,7 +293,7 @@ void GERBVIEW_FRAME::OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent )
void GERBVIEW_FRAME::OnUpdateSelectDCode( wxUpdateUIEvent& aEvent )
{
LAYER_NUM layer = getActiveLayer();
int layer = getActiveLayer();
GERBER_IMAGE* gerber = g_GERBER_List[layer];
int selected = ( gerber ) ? gerber->m_Selected_Tool : 0;
......
......@@ -47,6 +47,7 @@ struct VIA_DIMENSION
}
};
/**
* Class BOARD_DESIGN_SETTINGS
* contains design settings for a BOARD object.
......@@ -326,7 +327,7 @@ public:
* returns a bit-mask of all the layers that are visible
* @return int - the visible layers in bit-mapped form.
*/
inline LAYER_MSK GetVisibleLayers() const
inline LSET GetVisibleLayers() const
{
return m_visibleLayers;
}
......@@ -343,30 +344,30 @@ public:
* changes the bit-mask of visible layers
* @param aMask = The new bit-mask of visible layers
*/
inline void SetVisibleLayers( LAYER_MSK aMask )
inline void SetVisibleLayers( LSET aMask )
{
m_visibleLayers = aMask & m_enabledLayers & FULL_LAYERS;
m_visibleLayers = aMask & m_enabledLayers;
}
/**
* Function IsLayerVisible
* tests whether a given layer is visible
* @param aLayer = The layer to be tested
* @param aLayerId = The layer to be tested
* @return bool - true if the layer is visible.
*/
inline bool IsLayerVisible( LAYER_NUM aLayer ) const
inline bool IsLayerVisible( LAYER_ID aLayerId ) const
{
// If a layer is disabled, it is automatically invisible
return m_visibleLayers & m_enabledLayers & GetLayerMask( aLayer );
return (m_visibleLayers & m_enabledLayers)[aLayerId];
}
/**
* Function SetLayerVisibility
* changes the visibility of a given layer
* @param aLayer = The layer to be changed
* @param aLayerId = The layer to be changed
* @param aNewState = The new visibility state of the layer
*/
void SetLayerVisibility( LAYER_NUM aLayer, bool aNewState );
void SetLayerVisibility( LAYER_ID aLayerId, bool aNewState );
/**
* Function GetVisibleElements
......@@ -417,7 +418,7 @@ public:
* returns a bit-mask of all the layers that are enabled
* @return int - the enabled layers in bit-mapped form.
*/
inline LAYER_MSK GetEnabledLayers() const
inline LSET GetEnabledLayers() const
{
return m_enabledLayers;
}
......@@ -427,17 +428,17 @@ public:
* changes the bit-mask of enabled layers
* @param aMask = The new bit-mask of enabled layers
*/
void SetEnabledLayers( LAYER_MSK aMask );
void SetEnabledLayers( LSET aMask );
/**
* Function IsLayerEnabled
* tests whether a given layer is enabled
* @param aLayer = The of the layer to be tested
* @param aLayerId = The layer to be tested
* @return bool - true if the layer is enabled
*/
inline bool IsLayerEnabled( LAYER_NUM aLayer ) const
inline bool IsLayerEnabled( LAYER_ID aLayerId ) const
{
return m_enabledLayers & GetLayerMask( aLayer );
return m_enabledLayers[aLayerId];
}
/**
......@@ -486,8 +487,10 @@ private:
VIA_DIMENSION m_customViaSize;
int m_copperLayerCount; ///< Number of copper layers for this design
LAYER_MSK m_enabledLayers; ///< Bit-mask for layer enabling
LAYER_MSK m_visibleLayers; ///< Bit-mask for layer visibility
LSET m_enabledLayers; ///< Bit-mask for layer enabling
LSET m_visibleLayers; ///< Bit-mask for layer visibility
int m_visibleElements; ///< Bit-mask for element category visibility
int m_boardThickness; ///< Board thickness for 3D viewer
......
......@@ -76,12 +76,12 @@ class BOARD_ITEM : public EDA_ITEM
void SetBack( EDA_ITEM* aBack ) { Pback = aBack; }
protected:
LAYER_NUM m_Layer;
LAYER_ID m_Layer;
public:
BOARD_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ) :
EDA_ITEM( aParent, idtype ), m_Layer( FIRST_LAYER )
EDA_ITEM( aParent, idtype ), m_Layer( F_Cu )
{
}
......@@ -114,7 +114,7 @@ public:
* Function GetLayer
* returns the layer this item is on.
*/
LAYER_NUM GetLayer() const { return m_Layer; }
LAYER_ID GetLayer() const { return m_Layer; }
/**
* Function SetLayer
......@@ -123,7 +123,7 @@ public:
* is virtual because some items (in fact: class DIMENSION)
* have a slightly different initialization
*/
virtual void SetLayer( LAYER_NUM aLayer )
virtual void SetLayer( LAYER_ID aLayer )
{
// trap any invalid layers, then go find the caller and fix it.
// wxASSERT( unsigned( aLayer ) < unsigned( NB_PCB_LAYERS ) );
......@@ -156,7 +156,7 @@ public:
* @param aLayer The layer to test for.
* @return bool - true if on given layer, else false.
*/
virtual bool IsOnLayer( LAYER_NUM aLayer ) const
virtual bool IsOnLayer( LAYER_ID aLayer ) const
{
return m_Layer == aLayer;
}
......
......@@ -7,8 +7,6 @@
#define _COLORS_DESIGN_SETTING_H
#include <layers_id_colors_and_visibility.h>
#define LAYERSCOLORSBUFFERSIZE NB_LAYERS
#define ITEMSCOLORSBUFFERSIZE 32
/**
* Class COLORS_DESIGN_SETTINGS
......@@ -20,10 +18,10 @@ public:
// Color options for screen display of the Printed Board and schematic:
// Common to Eeschema, Pcbnew, GerbView
EDA_COLOR_T m_LayersColors[LAYERSCOLORSBUFFERSIZE]; ///< Layer colors (tracks and graphic items)
EDA_COLOR_T m_LayersColors[LAYER_ID_COUNT]; ///< Layer colors (tracks and graphic items)
// Common to Eeschema, Pcbnew
EDA_COLOR_T m_ItemsColors[ITEMSCOLORSBUFFERSIZE]; ///< All others items but layers
EDA_COLOR_T m_ItemsColors[32]; ///< All others items but layers
public:
COLORS_DESIGN_SETTINGS();
......
......@@ -15,7 +15,6 @@ class LAYER_SELECTOR
{
protected:
bool m_layerhotkeys;
bool m_layerorder;
public:
// Hotkey Info
......@@ -36,17 +35,18 @@ public:
// Virtual function pure because GerbView uses its own functions in a derived class
virtual bool IsLayerEnabled( LAYER_NUM aLayer ) const = 0;
bool SetLayersOrdered(bool value);
bool SetLayersHotkeys(bool value);
bool SetLayersOrdered( bool value );
bool SetLayersHotkeys( bool value );
protected:
// Fills the layer bitmap aLayerbmp with the layer color
void SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer );
};
/* class to display a layer list in a wxBitmapComboBox.
*/
class LAYER_BOX_SELECTOR :public wxBitmapComboBox, public LAYER_SELECTOR
class LAYER_BOX_SELECTOR : public wxBitmapComboBox, public LAYER_SELECTOR
{
public:
// Hotkey Info
......@@ -69,7 +69,7 @@ public:
LAYER_NUM GetLayerSelection() const;
// Set Layer #
int SetLayerSelection(LAYER_NUM layer);
int SetLayerSelection( LAYER_NUM layer );
// Reload the Layers
// Virtual pure function because GerbView uses its own functions in a derived class
......@@ -79,23 +79,4 @@ public:
void ResyncBitmapOnly();
};
#define DECLARE_LAYERS_HOTKEY(list) int list[NB_LAYERS] = \
{ \
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_LAYER_BOX_SELECTOR_H
#endif // CLASS_LAYER_BOX_SELECTOR_H
......@@ -17,9 +17,9 @@ class UNDO_REDO_CONTAINER;
class PCB_SCREEN : public BASE_SCREEN
{
public:
LAYER_NUM m_Active_Layer;
LAYER_NUM m_Route_Layer_TOP;
LAYER_NUM m_Route_Layer_BOTTOM;
LAYER_ID m_Active_Layer;
LAYER_ID m_Route_Layer_TOP;
LAYER_ID m_Route_Layer_BOTTOM;
public:
......
......@@ -89,13 +89,14 @@ enum paramcfg_id {
class PARAM_CFG_BASE
{
public:
const wxChar* m_Ident; ///< Keyword in config data
wxString m_Ident; ///< Keyword in config data
paramcfg_id m_Type; ///< Type of parameter
const wxChar* m_Group; ///< Group name (this is like a path in the config data)
wxString m_Group; ///< Group name (this is like a path in the config data)
bool m_Setup; ///< Install or Project based parameter, true == install
public:
PARAM_CFG_BASE( const wxChar* ident, const paramcfg_id type, const wxChar* group = NULL );
PARAM_CFG_BASE( const wxString& ident, const paramcfg_id type,
const wxChar* group = NULL );
virtual ~PARAM_CFG_BASE() {}
/**
......@@ -126,12 +127,12 @@ public:
int m_Default; ///< The default value of the parameter
public:
PARAM_CFG_INT( const wxChar* ident, int* ptparam,
PARAM_CFG_INT( const wxString& ident, int* ptparam,
int default_val = 0,
int min = std::numeric_limits<int>::min(),
int max = std::numeric_limits<int>::max(),
const wxChar* group = NULL );
PARAM_CFG_INT( bool Insetup, const wxChar* ident, int* ptparam,
PARAM_CFG_INT( bool Insetup, const wxString& ident, int* ptparam,
int default_val = 0,
int min = std::numeric_limits<int>::min(),
int max = std::numeric_limits<int>::max(),
......@@ -154,13 +155,13 @@ public:
double m_BIU_to_cfgunit; ///< the factor to convert the saved value in internal value
public:
PARAM_CFG_INT_WITH_SCALE( const wxChar* ident, int* ptparam,
PARAM_CFG_INT_WITH_SCALE( const wxString& ident, int* ptparam,
int default_val = 0,
int min = std::numeric_limits<int>::min(),
int max = std::numeric_limits<int>::max(),
const wxChar* group = NULL,
double aBiu2cfgunit = 1.0);
PARAM_CFG_INT_WITH_SCALE( bool Insetup, const wxChar* ident, int* ptparam,
PARAM_CFG_INT_WITH_SCALE( bool Insetup, const wxString& ident, int* ptparam,
int default_val = 0,
int min = std::numeric_limits<int>::min(),
int max = std::numeric_limits<int>::max(),
......@@ -183,9 +184,9 @@ public:
EDA_COLOR_T m_Default; ///< The default value of the parameter
public:
PARAM_CFG_SETCOLOR( const wxChar* ident, EDA_COLOR_T* ptparam,
PARAM_CFG_SETCOLOR( const wxString& ident, EDA_COLOR_T* ptparam,
EDA_COLOR_T default_val, const wxChar* group = NULL );
PARAM_CFG_SETCOLOR( bool Insetup, const wxChar* ident, EDA_COLOR_T* ptparam,
PARAM_CFG_SETCOLOR( bool Insetup, const wxString& ident, EDA_COLOR_T* ptparam,
EDA_COLOR_T default_val, const wxChar* group = NULL );
virtual void ReadParam( wxConfigBase* aConfig ) const;
......@@ -205,10 +206,10 @@ public:
double m_Min, m_Max; ///< Minimum and maximum values of the param type
public:
PARAM_CFG_DOUBLE( const wxChar* ident, double* ptparam,
PARAM_CFG_DOUBLE( const wxString& ident, double* ptparam,
double default_val = 0.0, double min = 0.0, double max = 10000.0,
const wxChar* group = NULL );
PARAM_CFG_DOUBLE( bool Insetup, const wxChar* ident, double* ptparam,
PARAM_CFG_DOUBLE( bool Insetup, const wxString& ident, double* ptparam,
double default_val = 0.0, double min = 0.0, double max = 10000.0,
const wxChar* group = NULL );
......@@ -228,9 +229,9 @@ public:
int m_Default; ///< The default value of the parameter
public:
PARAM_CFG_BOOL( const wxChar* ident, bool* ptparam,
PARAM_CFG_BOOL( const wxString& ident, bool* ptparam,
int default_val = false, const wxChar* group = NULL );
PARAM_CFG_BOOL( bool Insetup, const wxChar* ident, bool* ptparam,
PARAM_CFG_BOOL( bool Insetup, const wxString& ident, bool* ptparam,
int default_val = false, const wxChar* group = NULL );
virtual void ReadParam( wxConfigBase* aConfig ) const;
......@@ -249,9 +250,10 @@ public:
wxString m_default; ///< The default value of the parameter
public:
PARAM_CFG_WXSTRING( const wxChar* ident, wxString* ptparam, const wxChar* group = NULL );
PARAM_CFG_WXSTRING( const wxString& ident, wxString* ptparam, const wxChar* group = NULL );
PARAM_CFG_WXSTRING( bool Insetup,
const wxChar* ident,
const wxString& ident,
wxString* ptparam,
const wxString& default_val = wxEmptyString,
const wxChar* group = NULL );
......@@ -273,7 +275,8 @@ public:
wxString* m_Pt_param; ///< Pointer to the parameter value
public:
PARAM_CFG_FILENAME( const wxChar* ident, wxString* ptparam, const wxChar* group = NULL );
PARAM_CFG_FILENAME( const wxString& ident, wxString* ptparam,
const wxChar* group = NULL );
virtual void ReadParam( wxConfigBase* aConfig ) const;
virtual void SaveParam( wxConfigBase* aConfig ) const;
};
......
......@@ -636,7 +636,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMask, bool aPrintMirrorMode, void* aData = NULL );
virtual void PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode, void* aData = NULL );
/**
* Function CoordinateToString
......
This diff is collapsed.
......@@ -18,9 +18,6 @@ class TRACK;
class BOARD;
class DISPLAY_OPTIONS;
/// Look up Table for conversion copper layer count -> general copper layer mask:
extern LAYER_MSK g_TabAllCopperLayerMask[NB_COPPER_LAYERS];
extern DISPLAY_OPTIONS DisplayOpt;
extern int g_CurrentVersionPCB;
......
......@@ -606,8 +606,8 @@ public:
* @param aDlgPosition = position of dialog ( defualt = centered)
* @return the selected layer id
*/
LAYER_NUM SelectLayer( LAYER_NUM aDefaultLayer,
LAYER_MSK aNotAllowedLayersMask = 0,
LAYER_ID SelectLayer( LAYER_ID aDefaultLayer,
LSET aNotAllowedLayersMask = LSET(),
wxPoint aDlgPosition = wxDefaultPosition );
/* Display a list of two copper layers to choose a pair of copper layers
......@@ -615,7 +615,7 @@ public:
*/
void SelectCopperLayerPair();
virtual void SwitchLayer( wxDC* DC, LAYER_NUM layer );
virtual void SwitchLayer( wxDC* DC, LAYER_ID layer );
void LoadSettings( wxConfigBase* aCfg ); // override virtual
void SaveSettings( wxConfigBase* aCfg ); // override virtual
......
......@@ -1264,7 +1264,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMask,
virtual void PrintPage( wxDC* aDC, LSET aPrintMask,
bool aPrintMirrorMode, void* aData = NULL );
void SetSimulatorCommand( const wxString& aCommand ) { m_simulatorCommand = aCommand; }
......
......@@ -283,8 +283,8 @@ public:
* @param aPrintMirrorMode = true to plot mirrored
* @param aData = a pointer on an auxiliary data (NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMaskLayer, bool aPrintMirrorMode,
void * aData = NULL );
virtual void PrintPage( wxDC* aDC, LSET aPrintMaskLayer, bool aPrintMirrorMode,
void* aData = NULL );
void GetKicadAbout( wxCommandEvent& event );
......@@ -535,26 +535,26 @@ public:
* Function SetHighContrastLayer
* takes care of display settings for the given layer to be displayed in high contrast mode.
*/
void SetHighContrastLayer( LAYER_NUM aLayer );
void SetHighContrastLayer( LAYER_ID aLayer );
/**
* Function SetTopLayer
* moves the selected layer to the top, so it is displayed above all others.
*/
void SetTopLayer( LAYER_NUM aLayer );
void SetTopLayer( LAYER_ID aLayer );
/**
* Function SetActiveLayer
* will change the currently active layer to \a aLayer and also
* update the PCB_LAYER_WIDGET.
*/
void SetActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate = true );
void SetActiveLayer( LAYER_ID aLayer, bool doLayerWidgetUpdate = true );
/**
* Function GetActiveLayer
* returns the active layer
*/
LAYER_NUM GetActiveLayer() const
LAYER_ID GetActiveLayer() const
{
return ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer;
}
......@@ -784,8 +784,6 @@ public:
void InstallDisplayOptionsDialog( wxCommandEvent& aEvent );
void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
void InstallDialogLayerSetup();
/**
* Function GenFootprintsPositionFile
* Calls DoGenFootprintsPositionFile to create a footprint position file
......@@ -1263,7 +1261,7 @@ public:
bool MergeCollinearTracks( TRACK* track, wxDC* DC, int end );
void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC );
void SwitchLayer( wxDC* DC, LAYER_NUM layer );
void SwitchLayer( wxDC* DC, LAYER_ID layer );
/**
* Function Add45DegreeSegment
......@@ -1463,7 +1461,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( LAYER_NUM aLayer );
void Delete_Drawings_All_Layer( LAYER_ID aLayer );
// Dimension handling:
void ShowDimensionPropertyDialog( DIMENSION* aDimension, wxDC* aDC );
......
......@@ -503,7 +503,7 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
// Display units
}
void PL_EDITOR_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer,
void PL_EDITOR_FRAME::PrintPage( wxDC* aDC, LSET aPrintMasklayer,
bool aPrintMirrorMode, void * aData )
{
GetScreen()-> m_ScreenNumber = GetPageNumberOption() ? 1 : 2;
......
......@@ -263,7 +263,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer,
virtual void PrintPage( wxDC* aDC, LSET aPrintMasklayer,
bool aPrintMirrorMode, void * aData );
void OnFileHistory( wxCommandEvent& event );
......
......@@ -122,7 +122,7 @@ static void drawPlacementRoutingMatrix( BOARD* aBrd, wxDC* DC );
static int TstModuleOnBoard( BOARD* Pcb, MODULE* Module, bool TstOtherSide );
static void CreateKeepOutRectangle( int ux0, int uy0, int ux1, int uy1,
int marge, int aKeepOut, int aLayerMask );
int marge, int aKeepOut, LSET aLayerMask );
static MODULE* PickModule( PCB_EDIT_FRAME* pcbframe, wxDC* DC );
static int propagate();
......@@ -133,7 +133,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
wxPoint PosOK;
wxPoint memopos;
int error;
LAYER_NUM lay_tmp_TOP, lay_tmp_BOTTOM;
LAYER_ID lay_tmp_TOP, lay_tmp_BOTTOM;
// Undo: init list
PICKED_ITEMS_LIST newList;
......@@ -488,12 +488,12 @@ int genPlacementRoutingMatrix( BOARD* aBrd, EDA_MSG_PANEL* messagePanel )
msg.Printf( wxT( "%d" ), RoutingMatrix.m_MemSize / 1024 );
messagePanel->SetMessage( 24, wxT( "Mem(Kb)" ), msg, CYAN );
g_Route_Layer_BOTTOM = LAYER_N_FRONT;
g_Route_Layer_BOTTOM = F_Cu;
if( RoutingMatrix.m_RoutingLayersCount > 1 )
g_Route_Layer_BOTTOM = LAYER_N_BACK;
g_Route_Layer_BOTTOM = B_Cu;
g_Route_Layer_TOP = LAYER_N_FRONT;
g_Route_Layer_TOP = F_Cu;
// Place the edge layer segments
TRACK TmpSegm( NULL );
......@@ -513,7 +513,7 @@ int genPlacementRoutingMatrix( BOARD* aBrd, EDA_MSG_PANEL* messagePanel )
case PCB_LINE_T:
DrawSegm = (DRAWSEGMENT*) PtStruct;
if( DrawSegm->GetLayer() != EDGE_N )
if( DrawSegm->GetLayer() != Edge_Cuts )
break;
TraceSegmentPcb( DrawSegm, HOLE | CELL_is_EDGE,
......@@ -550,7 +550,7 @@ int genPlacementRoutingMatrix( BOARD* aBrd, EDA_MSG_PANEL* messagePanel )
void genModuleOnRoutingMatrix( MODULE* Module )
{
int ox, oy, fx, fy;
int layerMask;
LSET layerMask;
D_PAD* Pad;
EDA_RECT fpBBox = Module->GetBoundingBox();
......@@ -585,13 +585,11 @@ void genModuleOnRoutingMatrix( MODULE* Module )
if( fy > RoutingMatrix.m_BrdBox.GetBottom() )
fy = RoutingMatrix.m_BrdBox.GetBottom();
layerMask = 0;
if( Module->GetLayer() == F_Cu )
layerMask.set( F_Cu );
if( Module->GetLayer() == LAYER_N_FRONT )
layerMask = LAYER_FRONT;
if( Module->GetLayer() == LAYER_N_BACK )
layerMask = LAYER_BACK;
if( Module->GetLayer() == B_Cu )
layerMask.set( B_Cu );
TraceFilledRectangle( ox, oy, fx, fy, layerMask,
CELL_is_MODULE, WRITE_OR_CELL );
......@@ -666,15 +664,11 @@ int getOptimalModulePlacement( PCB_EDIT_FRAME* aFrame, MODULE* aModule, wxDC* aD
if( RoutingMatrix.m_RoutingLayersCount > 1 )
{
D_PAD* Pad;
int otherLayerMask = LAYER_BACK;
if( aModule->GetLayer() == LAYER_N_BACK )
otherLayerMask = LAYER_FRONT;
LSET other( aModule->GetLayer() == B_Cu ? F_Cu : B_Cu );
for( Pad = aModule->Pads(); Pad != NULL; Pad = Pad->Next() )
for( D_PAD* pad = aModule->Pads(); pad; pad = pad->Next() )
{
if( ( Pad->GetLayerMask() & otherLayerMask ) == 0 )
if( !( pad->GetLayerSet() & other ).any() )
continue;
TstOtherSide = true;
......@@ -875,7 +869,7 @@ int TstModuleOnBoard( BOARD* Pcb, MODULE* aModule, bool TstOtherSide )
int side = TOP;
int otherside = BOTTOM;
if( aModule->GetLayer() == LAYER_N_BACK )
if( aModule->GetLayer() == B_Cu )
{
side = BOTTOM; otherside = TOP;
}
......@@ -966,7 +960,7 @@ double compute_Ratsnest_PlaceModule( BOARD* aBrd )
* Therefore the cost is high in rect x0,y0 to x1,y1, and decrease outside this rectangle
*/
void CreateKeepOutRectangle( int ux0, int uy0, int ux1, int uy1,
int marge, int aKeepOut, int aLayerMask )
int marge, int aKeepOut, LSET aLayerMask )
{
int row, col;
int row_min, row_max, col_min, col_max, pmarge;
......@@ -974,10 +968,10 @@ void CreateKeepOutRectangle( int ux0, int uy0, int ux1, int uy1,
DIST_CELL data, LocalKeepOut;
int lgain, cgain;
if( aLayerMask & GetLayerMask( g_Route_Layer_BOTTOM ) )
if( aLayerMask[g_Route_Layer_BOTTOM] )
trace = 1; // Trace on bottom layer.
if( ( aLayerMask & GetLayerMask( g_Route_Layer_TOP ) ) && RoutingMatrix.m_RoutingLayersCount )
if( aLayerMask[g_Route_Layer_TOP] && RoutingMatrix.m_RoutingLayersCount )
trace |= 2; // Trace on top layer.
if( trace == 0 )
......
......@@ -66,7 +66,7 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode )
}
else
{
g_Route_Layer_TOP = g_Route_Layer_BOTTOM = LAYER_N_BACK;
g_Route_Layer_TOP = g_Route_Layer_BOTTOM = B_Cu;
}
switch( mode )
......
......@@ -206,12 +206,12 @@ void TraceSegmentPcb( DRAWSEGMENT* pt_segm, int type, int marge, int op_logic );
* op_logic = WRITE_CELL, WRITE_OR_CELL, WRITE_XOR_CELL, WRITE_AND_CELL
*/
void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
int side, int color, int op_logic);
LSET side, int color, int op_logic);
/* Same as above, but the rectangle is inclined angle angle. */
void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
double angle, LAYER_MSK masque_layer,
double angle, LSET masque_layer,
int color, int op_logic );
/* QUEUE.CPP */
......
......@@ -59,7 +59,7 @@ static void DrawSegmentQcq( int ux0, int uy0,
int op_logic );
static void TraceFilledCircle( int cx, int cy, int radius,
LAYER_MSK aLayerMask,
LSET aLayerMask,
int color,
int op_logic );
......@@ -96,7 +96,7 @@ void PlacePad( D_PAD* aPad, int color, int marge, int op_logic )
if( aPad->GetShape() == PAD_CIRCLE )
{
TraceFilledCircle( shape_pos.x, shape_pos.y, dx,
aPad->GetLayerMask(), color, op_logic );
aPad->GetLayerSet(), color, op_logic );
return;
}
......@@ -120,14 +120,14 @@ void PlacePad( D_PAD* aPad, int color, int marge, int op_logic )
TraceFilledRectangle( shape_pos.x - dx, shape_pos.y - dy,
shape_pos.x + dx, shape_pos.y + dy,
aPad->GetLayerMask(), color, op_logic );
aPad->GetLayerSet(), color, op_logic );
}
else
{
TraceFilledRectangle( shape_pos.x - dx, shape_pos.y - dy,
shape_pos.x + dx, shape_pos.y + dy,
aPad->GetOrientation(),
aPad->GetLayerMask(), color, op_logic );
aPad->GetLayerSet(), color, op_logic );
}
}
......@@ -141,9 +141,7 @@ void PlacePad( D_PAD* aPad, int color, int marge, int op_logic )
* op_logic: type of writing in the cell (WRITE, OR)
*/
void TraceFilledCircle( int cx, int cy, int radius,
LAYER_MSK aLayerMask,
int color,
int op_logic )
LSET aLayerMask, int color, int op_logic )
{
int row, col;
int ux0, uy0, ux1, uy1;
......@@ -153,10 +151,10 @@ void TraceFilledCircle( int cx, int cy, int radius,
int tstwrite = 0;
int distmin;
if( aLayerMask & GetLayerMask( g_Route_Layer_BOTTOM ) )
if( aLayerMask[g_Route_Layer_BOTTOM] )
trace = 1; // Trace on BOTTOM
if( aLayerMask & GetLayerMask( g_Route_Layer_TOP ) )
if( aLayerMask[g_Route_Layer_TOP] )
if( RoutingMatrix.m_RoutingLayersCount > 1 )
trace |= 2; // Trace on TOP
......@@ -297,23 +295,23 @@ void TraceSegmentPcb( TRACK* aTrack, int color, int marge, int op_logic )
// Test if VIA (filled circle need to be drawn)
if( aTrack->Type() == PCB_VIA_T )
{
LAYER_MSK layer_mask = NO_LAYERS;
LSET layer_mask;
if( aTrack->IsOnLayer( g_Route_Layer_BOTTOM ) )
layer_mask = GetLayerMask( g_Route_Layer_BOTTOM );
layer_mask.set( g_Route_Layer_BOTTOM );
if( aTrack->IsOnLayer( g_Route_Layer_TOP ) )
{
if( layer_mask == 0 )
layer_mask = GetLayerMask( g_Route_Layer_TOP );
if( !layer_mask.any() )
layer_mask = LSET( g_Route_Layer_TOP );
else
layer_mask = FULL_LAYERS;
layer_mask.set();
}
if( color == VIA_IMPOSSIBLE )
layer_mask = FULL_LAYERS;
layer_mask.set();
if( layer_mask )
if( layer_mask.any() )
TraceFilledCircle( aTrack->GetStart().x, aTrack->GetStart().y,
half_width, layer_mask, color, op_logic );
}
......@@ -326,7 +324,7 @@ void TraceSegmentPcb( TRACK* aTrack, int color, int marge, int op_logic )
int uy1 = aTrack->GetEnd().y - RoutingMatrix.GetBrdCoordOrigin().y;
// Ordinary track
LAYER_NUM layer = aTrack->GetLayer();
LAYER_ID layer = aTrack->GetLayer();
if( color == VIA_IMPOSSIBLE )
layer = UNDEFINED_LAYER;
......@@ -478,17 +476,16 @@ void TracePcbLine( int x0, int y0, int x1, int y1, LAYER_NUM layer, int color, i
void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
int aLayerMask, int color, int op_logic )
LSET aLayerMask, int color, int op_logic )
{
int row, col;
int row_min, row_max, col_min, col_max;
int trace = 0;
if( ( aLayerMask & GetLayerMask( g_Route_Layer_BOTTOM ) ) )
if( aLayerMask[g_Route_Layer_BOTTOM] )
trace = 1; // Trace on BOTTOM
if( ( aLayerMask & GetLayerMask( g_Route_Layer_TOP ) ) &&
RoutingMatrix.m_RoutingLayersCount > 1 )
if( aLayerMask[g_Route_Layer_TOP] && RoutingMatrix.m_RoutingLayersCount > 1 )
trace |= 2; // Trace on TOP
if( trace == 0 )
......@@ -541,7 +538,7 @@ void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
double angle, LAYER_MSK aLayerMask, int color, int op_logic )
double angle, LSET aLayerMask, int color, int op_logic )
{
int row, col;
int cx, cy; // Center of rectangle
......@@ -550,10 +547,10 @@ void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
int rotrow, rotcol;
int trace = 0;
if( aLayerMask & GetLayerMask( g_Route_Layer_BOTTOM ) )
if( aLayerMask[g_Route_Layer_BOTTOM] )
trace = 1; // Trace on BOTTOM
if( aLayerMask & GetLayerMask( g_Route_Layer_TOP ) )
if( aLayerMask[g_Route_Layer_TOP] )
{
if( RoutingMatrix.m_RoutingLayersCount > 1 )
trace |= 2; // Trace on TOP
......
......@@ -115,7 +115,7 @@ int MATRIX_ROUTING_HEAD::InitRoutingMatrix()
m_DistSide[side] = NULL;
m_DirSide[side] = NULL;
/* allocate matrix & initialize everything to empty */
// allocate matrix & initialize everything to empty
m_BoardSide[side] = (MATRIX_CELL*) operator new( ii * sizeof(MATRIX_CELL) );
memset( m_BoardSide[side], 0, ii * sizeof(MATRIX_CELL) );
......@@ -198,7 +198,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
{
int ux0 = 0, uy0 = 0, ux1, uy1, dx, dy;
int marge, via_marge;
LAYER_MSK layerMask;
LSET layerMask;
// use the default NETCLASS?
NETCLASSPTR nc = aPcb->GetDesignSettings().GetDefault();
......@@ -237,7 +237,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
EDGE_MODULE* edge = (EDGE_MODULE*) item;
EDGE_MODULE tmpEdge( *edge );
if( tmpEdge.GetLayer() == EDGE_N )
if( tmpEdge.GetLayer() == Edge_Cuts )
tmpEdge.SetLayer( UNDEFINED_LAYER );
TraceSegmentPcb( &tmpEdge, HOLE, marge, WRITE_CELL );
......@@ -264,7 +264,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
DrawSegm = (DRAWSEGMENT*) item;
DRAWSEGMENT tmpSegm( DrawSegm );
if( DrawSegm->GetLayer() == EDGE_N )
if( DrawSegm->GetLayer() == Edge_Cuts )
{
tmpSegm.SetLayer( UNDEFINED_LAYER );
type_cell |= CELL_is_EDGE;
......@@ -276,8 +276,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
case PCB_TEXT_T:
{
TEXTE_PCB* PtText;
PtText = (TEXTE_PCB*) item;
TEXTE_PCB* PtText = (TEXTE_PCB*) item;
if( PtText->GetText().Length() == 0 )
break;
......@@ -288,7 +287,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
dx = textbox.GetWidth();
dy = textbox.GetHeight();
/* Put bounding box (rectangle) on matrix */
// Put bounding box (rectangle) on matrix
dx /= 2;
dy /= 2;
......@@ -298,7 +297,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
ux0 -= dx;
uy0 -= dy;
layerMask = GetLayerMask( PtText->GetLayer() );
layerMask = LSET( PtText->GetLayer() );
TraceFilledRectangle( ux0 - marge, uy0 - marge, ux1 + marge,
uy1 + marge, PtText->GetOrientation(),
......@@ -316,7 +315,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
}
}
/* Put tracks and vias on matrix */
// Put tracks and vias on matrix
for( TRACK* track = aPcb->m_Track; track; track = track->Next() )
{
if( net_code == track->GetNetCode() )
......@@ -337,7 +336,7 @@ int Build_Work( BOARD* Pcb )
int demi_pas = RoutingMatrix.m_GridRouting / 2;
wxString msg;
InitWork(); /* clear work list */
InitWork(); // clear work list
int cellCount = 0;
for( unsigned ii = 0; ii < Pcb->GetRatsnestsCount(); ii++ )
......@@ -509,8 +508,8 @@ void MATRIX_ROUTING_HEAD::AddCell( int aRow, int aCol, int aSide, MATRIX_CELL x
}
/* fetch distance cell */
DIST_CELL MATRIX_ROUTING_HEAD::GetDist( int aRow, int aCol, int aSide ) /* fetch distance cell */
// fetch distance cell
DIST_CELL MATRIX_ROUTING_HEAD::GetDist( int aRow, int aCol, int aSide ) // fetch distance cell
{
DIST_CELL* p;
......@@ -519,7 +518,7 @@ DIST_CELL MATRIX_ROUTING_HEAD::GetDist( int aRow, int aCol, int aSide ) /* fetch
}
/* store distance cell */
// store distance cell
void MATRIX_ROUTING_HEAD::SetDist( int aRow, int aCol, int aSide, DIST_CELL x )
{
DIST_CELL* p;
......@@ -529,7 +528,7 @@ void MATRIX_ROUTING_HEAD::SetDist( int aRow, int aCol, int aSide, DIST_CELL x )
}
/* fetch direction cell */
// fetch direction cell
int MATRIX_ROUTING_HEAD::GetDir( int aRow, int aCol, int aSide )
{
DIR_CELL* p;
......@@ -539,7 +538,7 @@ int MATRIX_ROUTING_HEAD::GetDir( int aRow, int aCol, int aSide )
}
/* store direction cell */
// store direction cell
void MATRIX_ROUTING_HEAD::SetDir( int aRow, int aCol, int aSide, int x )
{
DIR_CELL* p;
......
This diff is collapsed.
This diff is collapsed.
......@@ -381,7 +381,7 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
void PCB_EDIT_FRAME::Block_SelectItems()
{
LAYER_MSK layerMask;
LSET layerMask;
bool selectOnlyComplete = GetScreen()->m_BlockLocate.GetWidth() > 0 ;
GetScreen()->m_BlockLocate.Normalize();
......@@ -392,9 +392,9 @@ void PCB_EDIT_FRAME::Block_SelectItems()
// Add modules
if( blockIncludeModules )
{
for( MODULE* module = m_Pcb->m_Modules; module != NULL; module = module->Next() )
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
{
LAYER_NUM layer = module->GetLayer();
LAYER_ID layer = module->GetLayer();
if( module->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete )
&& ( !module->IsLocked() || blockIncludeLockedModules ) )
......@@ -418,7 +418,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
if( blockIncludeItemsOnInvisibleLayers
|| m_Pcb->IsLayerVisible( track->GetLayer() ) )
{
picker.SetItem ( track );
picker.SetItem( track );
itemsList->PushItem( picker );
}
}
......@@ -426,13 +426,13 @@ void PCB_EDIT_FRAME::Block_SelectItems()
}
// Add graphic items
layerMask = EDGE_LAYER;
layerMask = LSET( Edge_Cuts );
if( blockIncludeItemsOnTechLayers )
layerMask = ALL_LAYERS;
layerMask.set();
if( !blockIncludeBoardOutlineLayer )
layerMask &= ~EDGE_LAYER;
layerMask.set( Edge_Cuts, false );
for( BOARD_ITEM* PtStruct = m_Pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
{
......@@ -444,7 +444,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
switch( PtStruct->Type() )
{
case PCB_LINE_T:
if( (GetLayerMask( PtStruct->GetLayer() ) & layerMask) == 0 )
if( !layerMask[PtStruct->GetLayer()] )
break;
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )
......@@ -464,7 +464,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
break;
case PCB_TARGET_T:
if( ( GetLayerMask( PtStruct->GetLayer() ) & layerMask ) == 0 )
if( !layerMask[PtStruct->GetLayer()] )
break;
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )
......@@ -474,7 +474,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
break;
case PCB_DIMENSION_T:
if( ( GetLayerMask( PtStruct->GetLayer() ) & layerMask ) == 0 )
if( !layerMask[PtStruct->GetLayer()] )
break;
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -49,7 +49,7 @@ DIMENSION::DIMENSION( BOARD_ITEM* aParent ) :
BOARD_ITEM( aParent, PCB_DIMENSION_T ),
m_Width( Millimeter2iu( 0.2 ) ), m_Unit( INCHES ), m_Value( 0 ), m_Height( 0 ), m_Text( this )
{
m_Layer = DRAW_N;
m_Layer = Dwgs_User;
}
......@@ -82,7 +82,7 @@ const wxString DIMENSION::GetText() const
}
void DIMENSION::SetLayer( LAYER_NUM aLayer )
void DIMENSION::SetLayer( LAYER_ID aLayer )
{
m_Layer = aLayer;
m_Text.SetLayer( aLayer );
......
......@@ -95,7 +95,7 @@ public:
m_Text.SetSize( aTextSize );
}
void SetLayer( LAYER_NUM aLayer );
void SetLayer( LAYER_ID aLayer );
void SetShape( int aShape ) { m_Shape = aShape; }
int GetShape() const { return m_Shape; }
......
This diff is collapsed.
This diff is collapsed.
......@@ -85,7 +85,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( LAYER_NUM aLayer ) const
bool MARKER_PCB::IsOnLayer( LAYER_ID aLayer ) const
{
return IsCopperLayer( aLayer );
}
......
......@@ -79,7 +79,7 @@ public:
return HitTestMarker( aPosition );
}
bool IsOnLayer( LAYER_NUM aLayer ) const;
bool IsOnLayer( LAYER_ID aLayer ) const;
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList );
......
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.
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.
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