kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #28648
[PATCH] Refactor LAYER_ID to be the one and only layer definition
Hi all,
Per the other thread, this patch unifies the layer definitions between
Pcbnew, GerbView, and Eeschema. It removes the need for ITEM_GAL_LAYER and
some other macros, and it will simplify the implementation of
cross-application color themes and using GAL in multiple applications.
Note that this patch introduces some temporary weirdness in a few places,
such as in COLORS_DESIGN_SETTINGS (there is now a single array for color
storage, but it's still referred to by two sets of getters/setters). This
is because I wanted to keep this refactor as simple as possible, as I plan
to follow it up with an overhaul of color settings when I share my color
themes work. I didn't want to do work that I would soon end up getting rid
of anyway.
Best,
Jon
From e60c4667e12d57374e5c68604fe1c33340e78418 Mon Sep 17 00:00:00 2001
From: Jon Evans <jon@xxxxxxxxxxxxx>
Date: Sun, 12 Mar 2017 23:19:33 -0400
Subject: [PATCH] Refactor LAYER_ID to be the one and only layer definition
---
3d-viewer/3d_canvas/cinfo3d_visu.cpp | 6 +-
3d-viewer/3d_canvas/cinfo3d_visu.h | 4 +-
.../c3d_render_createscene.cpp | 4 +-
common/class_colors_design_settings.cpp | 48 ++--
common/draw_panel_gal.cpp | 2 +-
common/lset.cpp | 9 +-
common/painter.cpp | 2 +-
common/preview_items/ruler_item.cpp | 2 +-
common/preview_items/simple_overlay_item.cpp | 3 +-
common/swig/kicad.i | 2 +-
common/view/view_group.cpp | 2 +-
common/worksheet_viewitem.cpp | 2 +-
eeschema/eeschema.cpp | 77 +++---
eeschema/eeschema_config.cpp | 8 +-
eeschema/general.h | 47 +---
eeschema/sch_base_frame.cpp | 4 +-
eeschema/sch_item_struct.h | 6 +-
eeschema/sch_legacy_plugin.cpp | 4 +-
eeschema/sch_screen.cpp | 2 +-
eeschema/viewlib_frame.cpp | 4 +-
eeschema/widgets/widget_eeschema_color_config.cpp | 22 +-
gerbview/class_gerbview_layer_widget.cpp | 16 +-
gerbview/dialogs/dialog_select_one_pcb_layer.cpp | 2 +-
.../gerbview_dialog_display_options_frame.cpp | 4 +-
gerbview/draw_gerber_screen.cpp | 2 +-
gerbview/events_called_functions.cpp | 4 +-
gerbview/export_to_pcbnew.cpp | 2 +-
gerbview/gerbview.h | 14 --
gerbview/gerbview_config.cpp | 8 +-
gerbview/gerbview_frame.cpp | 46 ++--
gerbview/gerbview_frame.h | 15 +-
gerbview/hotkeys.cpp | 4 +-
gerbview/toolbars_gerber.cpp | 4 +-
include/class_board_design_settings.h | 8 +-
include/class_colors_design_settings.h | 7 +-
include/layers_id_colors_and_visibility.h | 271 +++++++++++----------
include/origin_viewitem.h | 2 +-
include/painter.h | 8 +-
include/preview_items/bright_box.h | 2 +-
include/preview_items/selection_area.h | 1 +
include/preview_items/simple_overlay_item.h | 1 +
include/view/view.h | 3 +-
include/wxPcbStruct.h | 4 +-
.../autorouter/move_and_route_event_functions.cpp | 2 +-
pcbnew/basepcbframe.cpp | 18 +-
pcbnew/class_board.cpp | 94 +++----
pcbnew/class_board.h | 32 +--
pcbnew/class_board_design_settings.cpp | 10 +-
pcbnew/class_marker_pcb.cpp | 2 +-
pcbnew/class_module.cpp | 20 +-
pcbnew/class_netinfo_item.cpp | 2 +-
pcbnew/class_pad.cpp | 14 +-
pcbnew/class_pad_draw_functions.cpp | 14 +-
pcbnew/class_pcb_layer_widget.cpp | 50 ++--
pcbnew/class_pcb_text.cpp | 4 +-
pcbnew/class_text_mod.cpp | 32 +--
pcbnew/class_track.cpp | 12 +-
pcbnew/dialogs/dialog_SVG_print.cpp | 2 +-
pcbnew/dialogs/dialog_display_options.cpp | 4 +-
pcbnew/dialogs/dialog_exchange_modules.cpp | 2 +-
pcbnew/dialogs/dialog_general_options.cpp | 6 +-
pcbnew/dialogs/dialog_pad_properties.cpp | 4 +-
pcbnew/dialogs/dialog_print_using_printer.cpp | 2 +-
pcbnew/editrack-part2.cpp | 2 +-
pcbnew/exporters/export_vrml.cpp | 2 +-
pcbnew/files.cpp | 2 +-
pcbnew/footprint_wizard_frame.cpp | 2 +-
pcbnew/initpcb.cpp | 8 +-
pcbnew/kicad_plugin.cpp | 2 +-
pcbnew/modedit.cpp | 2 +-
pcbnew/module_editor_frame.h | 4 +-
pcbnew/moduleframe.cpp | 6 +-
pcbnew/modules.cpp | 16 +-
pcbnew/modview_frame.cpp | 2 +-
pcbnew/pcb_draw_panel_gal.cpp | 142 +++++------
pcbnew/pcb_painter.cpp | 87 +++----
pcbnew/pcb_painter.h | 2 +-
pcbnew/pcb_parser.cpp | 2 +-
pcbnew/pcbframe.cpp | 22 +-
pcbnew/pcbnew_config.cpp | 26 +-
pcbnew/pcbnew_config.h | 2 +-
pcbnew/plot_board_layers.cpp | 6 +-
pcbnew/plot_brditems_plotter.cpp | 6 +-
pcbnew/print_board_functions.cpp | 22 +-
pcbnew/ratsnest.cpp | 12 +-
pcbnew/ratsnest_viewitem.cpp | 4 +-
pcbnew/router/pns_kicad_iface.cpp | 4 +-
pcbnew/router/router_preview_item.cpp | 4 +-
pcbnew/swap_layers.cpp | 12 +-
pcbnew/swig/board.i | 2 +
pcbnew/tool_pcb.cpp | 4 +-
pcbnew/toolbars_update_user_interface.cpp | 4 +-
pcbnew/tools/edit_points.h | 2 +-
pcbnew/tools/module_editor_tools.cpp | 10 +-
pcbnew/tools/selection_tool.cpp | 4 +-
pcbnew/tracepcb.cpp | 4 +-
96 files changed, 704 insertions(+), 741 deletions(-)
diff --git a/3d-viewer/3d_canvas/cinfo3d_visu.cpp b/3d-viewer/3d_canvas/cinfo3d_visu.cpp
index 088f580..68095f2 100644
--- a/3d-viewer/3d_canvas/cinfo3d_visu.cpp
+++ b/3d-viewer/3d_canvas/cinfo3d_visu.cpp
@@ -122,7 +122,7 @@ CINFO3D_VISU::~CINFO3D_VISU()
bool CINFO3D_VISU::Is3DLayerEnabled( LAYER_ID aLayer ) const
{
- wxASSERT( aLayer < LAYER_ID_COUNT );
+ wxASSERT( aLayer < PCB_LAYER_ID_COUNT );
DISPLAY3D_FLG flg;
@@ -372,7 +372,7 @@ void CINFO3D_VISU::InitSettings( REPORTER *aStatusTextReporter )
// calculate z position for each non copper layer
// Solder mask and Solder paste have the same Z position
- for( int layer_id = MAX_CU_LAYERS; layer_id < LAYER_ID_COUNT; ++layer_id )
+ for( int layer_id = MAX_CU_LAYERS; layer_id < PCB_LAYER_ID_COUNT; ++layer_id )
{
float zposTop;
float zposBottom;
@@ -530,7 +530,7 @@ void CINFO3D_VISU::CameraSetType( CAMERA_TYPE aCameraType )
SFVEC3F CINFO3D_VISU::GetLayerColor( LAYER_ID aLayerId ) const
{
- wxASSERT( aLayerId < LAYER_ID_COUNT );
+ wxASSERT( aLayerId < PCB_LAYER_ID_COUNT );
const COLOR4D color = g_ColorsSettings.GetLayerColor( aLayerId );
diff --git a/3d-viewer/3d_canvas/cinfo3d_visu.h b/3d-viewer/3d_canvas/cinfo3d_visu.h
index 90db438..136c12b 100644
--- a/3d-viewer/3d_canvas/cinfo3d_visu.h
+++ b/3d-viewer/3d_canvas/cinfo3d_visu.h
@@ -616,10 +616,10 @@ class CINFO3D_VISU
double m_biuTo3Dunits;
/// Top (End) Z position of each layer (normalized)
- float m_layerZcoordTop[LAYER_ID_COUNT];
+ float m_layerZcoordTop[PCB_LAYER_ID_COUNT];
/// Bottom (Start) Z position of each layer (normalized)
- float m_layerZcoordBottom[LAYER_ID_COUNT];
+ float m_layerZcoordBottom[PCB_LAYER_ID_COUNT];
/// Copper thickness (normalized)
float m_copperThickness3DU;
diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp
index c9968ff..cd6b142 100644
--- a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp
+++ b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp
@@ -1001,7 +1001,7 @@ void C3D_RENDER_RAYTRACING::insert3DViaHole( const VIA* aVia )
if( m_settings.GetFlag( FL_USE_REALISTIC_MODE ) )
objPtr->SetColor( ConvertSRGBToLinear( (SFVEC3F)m_settings.m_CopperColor ) );
else
- objPtr->SetColor( ConvertSRGBToLinear( m_settings.GetItemColor( VIAS_VISIBLE + aVia->GetViaType() ) ) );
+ objPtr->SetColor( ConvertSRGBToLinear( m_settings.GetItemColor( LAYER_VIAS + aVia->GetViaType() ) ) );
m_object_container.Add( objPtr );
}
@@ -1018,7 +1018,7 @@ void C3D_RENDER_RAYTRACING::insert3DPadHole( const D_PAD* aPad )
if( m_settings.GetFlag( FL_USE_REALISTIC_MODE ) )
objColor = (SFVEC3F)m_settings.m_CopperColor;
else
- objColor = m_settings.GetItemColor( PADS_VISIBLE );
+ objColor = m_settings.GetItemColor( LAYER_PADS );
const wxSize drillsize = aPad->GetDrillSize();
const bool hasHole = drillsize.x && drillsize.y;
diff --git a/common/class_colors_design_settings.cpp b/common/class_colors_design_settings.cpp
index 3e996da..38deb2b 100644
--- a/common/class_colors_design_settings.cpp
+++ b/common/class_colors_design_settings.cpp
@@ -66,18 +66,18 @@ static const EDA_COLOR_T default_layer_color[] = {
static const EDA_COLOR_T default_items_color[] = {
LIGHTGRAY, // unused
- CYAN, // VIA_MICROVIA_VISIBLE
- BROWN, // VIA_BBLIND_VISIBLE
- LIGHTGRAY, // VIA_THROUGH_VISIBLE
- YELLOW, // NON_PLATED_VISIBLE
- LIGHTGRAY, // MOD_TEXT_FR_VISIBLE
- BLUE, // MOD_TEXT_BK_VISIBLE
- DARKGRAY, // MOD_TEXT_INVISIBLE
- BLUE, // ANCHOR_VISIBLE
- RED, // PAD_FR_VISIBLE
- GREEN, // PAD_BK_VISIBLE
- LIGHTGRAY, // RATSNEST_VISIBLE
- DARKGRAY, // GRID_VISIBLE
+ CYAN, // LAYER_VIA_MICROVIA
+ BROWN, // LAYER_VIA_BBLIND
+ LIGHTGRAY, // LAYER_VIA_THROUGH
+ YELLOW, // LAYER_NON_PLATED
+ LIGHTGRAY, // LAYER_MOD_TEXT_FR
+ BLUE, // LAYER_MOD_TEXT_BK
+ DARKGRAY, // LAYER_MOD_TEXT_INVISIBLE
+ BLUE, // LAYER_ANCHOR
+ RED, // LAYER_PAD_FR
+ GREEN, // LAYER_PAD_BK
+ LIGHTGRAY, // LAYER_RATSNEST
+ DARKGRAY, // LAYER_GRID
LIGHTRED, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
@@ -88,7 +88,7 @@ static const EDA_COLOR_T default_items_color[] = {
COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS()
{
- for( unsigned src = 0, dst = 0; dst < DIM(m_LayersColors); ++dst )
+ for( unsigned src = 0, dst = 0; dst < DIM( m_LayersColors ); ++dst )
{
m_LayersColors[dst] = COLOR4D( default_layer_color[src++] );
@@ -96,19 +96,16 @@ COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS()
src = 0; // wrap the source.
}
- for( unsigned src = 0, dst = 0; dst < DIM(m_ItemsColors); ++dst )
+ for( unsigned src = 0, dst = LAYER_VIAS; dst < DIM( default_items_color ); ++dst )
{
- m_ItemsColors[dst] = COLOR4D( default_items_color[src++] );
-
- if( src >= DIM( default_items_color ) )
- src = 0;
+ m_LayersColors[dst] = COLOR4D( default_items_color[src++] );
}
}
COLOR4D COLORS_DESIGN_SETTINGS::GetLayerColor( LAYER_NUM aLayer ) const
{
- if( (unsigned) aLayer < DIM(m_LayersColors) )
+ if( (unsigned) aLayer < DIM( m_LayersColors ) )
{
return m_LayersColors[aLayer];
}
@@ -118,7 +115,7 @@ COLOR4D COLORS_DESIGN_SETTINGS::GetLayerColor( LAYER_NUM aLayer ) const
void COLORS_DESIGN_SETTINGS::SetLayerColor( LAYER_NUM aLayer, COLOR4D aColor )
{
- if( (unsigned) aLayer < DIM(m_LayersColors) )
+ if( (unsigned) aLayer < DIM( m_LayersColors ) )
{
m_LayersColors[aLayer] = aColor;
}
@@ -127,9 +124,9 @@ void COLORS_DESIGN_SETTINGS::SetLayerColor( LAYER_NUM aLayer, COLOR4D aColor )
COLOR4D COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx ) const
{
- if( (unsigned) aItemIdx < DIM( m_ItemsColors ) )
+ if( (unsigned) aItemIdx < DIM( m_LayersColors ) )
{
- return m_ItemsColors[aItemIdx];
+ return m_LayersColors[aItemIdx];
}
return COLOR4D::UNSPECIFIED;
@@ -138,9 +135,9 @@ COLOR4D COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx ) const
void COLORS_DESIGN_SETTINGS::SetItemColor( int aItemIdx, COLOR4D aColor )
{
- if( (unsigned) aItemIdx < DIM(m_ItemsColors) )
+ if( (unsigned) aItemIdx < DIM( m_LayersColors ) )
{
- m_ItemsColors[aItemIdx] = aColor;
+ m_LayersColors[aItemIdx] = aColor;
}
}
@@ -149,7 +146,4 @@ void COLORS_DESIGN_SETTINGS::SetAllColorsAs( COLOR4D aColor )
{
for( unsigned ii = 0; ii < DIM(m_LayersColors); ii++ )
m_LayersColors[ii] = aColor;
-
- for( unsigned ii = 0; ii < DIM(m_ItemsColors); ii++ )
- m_ItemsColors[ii] = aColor;
}
diff --git a/common/draw_panel_gal.cpp b/common/draw_panel_gal.cpp
index 76af622..52524e4 100644
--- a/common/draw_panel_gal.cpp
+++ b/common/draw_panel_gal.cpp
@@ -175,7 +175,7 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
m_gal->BeginDrawing();
m_gal->ClearScreen( settings->GetBackgroundColor() );
- KIGFX::COLOR4D gridColor = settings->GetLayerColor( ITEM_GAL_LAYER( GRID_VISIBLE ) );
+ KIGFX::COLOR4D gridColor = settings->GetLayerColor( LAYER_GRID );
m_gal->SetGridColor( gridColor );
if( m_view->IsDirty() )
diff --git a/common/lset.cpp b/common/lset.cpp
index a6f8c2e..81aa905 100644
--- a/common/lset.cpp
+++ b/common/lset.cpp
@@ -58,9 +58,9 @@ LSET::LSET( unsigned aIdCount, LAYER_ID aFirst, ... ) :
{
LAYER_ID id = (LAYER_ID) va_arg( ap, int );
- // printf( "%s: id:%d LAYER_ID_COUNT:%d\n", __func__, id, LAYER_ID_COUNT );
+ // printf( "%s: id:%d PCB_LAYER_ID_COUNT:%d\n", __func__, id, PCB_LAYER_ID_COUNT );
- assert( unsigned( id ) < LAYER_ID_COUNT );
+ assert( unsigned( id ) < PCB_LAYER_ID_COUNT );
set( id );
}
@@ -135,6 +135,7 @@ const wxChar* LSET::Name( LAYER_ID aLayerId )
case B_Fab: txt = wxT( "B.Fab" ); break;
default:
+ std::cout << aLayerId << std::endl;
wxASSERT_MSG( 0, wxT( "aLayerId out of range" ) );
txt = wxT( "BAD INDEX!" ); break;
}
@@ -750,7 +751,7 @@ LSET LSET::BackMask()
LSEQ LSET::UIOrder() const
{
- LAYER_ID order[LAYER_ID_COUNT];
+ LAYER_ID order[PCB_LAYER_ID_COUNT];
// Assmuming that the LAYER_ID order is according to preferred UI order, as of
// today this is true. When that becomes not true, its easy to change the order
@@ -765,7 +766,7 @@ LSEQ LSET::UIOrder() const
LAYER_ID ToLAYER_ID( int aLayer )
{
- wxASSERT( unsigned( aLayer ) < LAYER_ID_COUNT );
+ wxASSERT( unsigned( aLayer ) < PCB_LAYER_ID_COUNT );
return LAYER_ID( aLayer );
}
diff --git a/common/painter.cpp b/common/painter.cpp
index 3ee4c43..0c4e4d2 100644
--- a/common/painter.cpp
+++ b/common/painter.cpp
@@ -55,7 +55,7 @@ void RENDER_SETTINGS::update()
m_layerOpacity );
// Calculate darkened/highlighted variants of layer colors
- for( int i = 0; i < TOTAL_LAYER_COUNT; i++ )
+ for( int i = 0; i < LAYER_ID_COUNT; i++ )
{
m_layerColorsHi[i] = m_layerColors[i].Brightened( m_highlightFactor );
m_layerColorsDark[i] = m_layerColors[i].Darkened( 1.0 - m_highlightFactor );
diff --git a/common/preview_items/ruler_item.cpp b/common/preview_items/ruler_item.cpp
index 331fc45..df45129 100644
--- a/common/preview_items/ruler_item.cpp
+++ b/common/preview_items/ruler_item.cpp
@@ -221,7 +221,7 @@ const BOX2I RULER_ITEM::ViewBBox() const
void RULER_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
{
- aLayers[0] = ITEM_GAL_LAYER( GP_OVERLAY );
+ aLayers[0] = LAYER_GP_OVERLAY;
aCount = 1;
}
diff --git a/common/preview_items/simple_overlay_item.cpp b/common/preview_items/simple_overlay_item.cpp
index d8726d0..32b1de5 100644
--- a/common/preview_items/simple_overlay_item.cpp
+++ b/common/preview_items/simple_overlay_item.cpp
@@ -25,7 +25,6 @@
#include <gal/graphics_abstraction_layer.h>
#include <view/view.h>
-#include <layers_id_colors_and_visibility.h>
using namespace KIGFX::PREVIEW;
@@ -51,7 +50,7 @@ void SIMPLE_OVERLAY_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
void SIMPLE_OVERLAY_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
{
- static const int SelectionLayer = ITEM_GAL_LAYER( GP_OVERLAY );
+ static const int SelectionLayer = LAYER_GP_OVERLAY;
aLayers[0] = SelectionLayer;
aCount = 1;
diff --git a/common/swig/kicad.i b/common/swig/kicad.i
index 768b9b6..7753c36 100644
--- a/common/swig/kicad.i
+++ b/common/swig/kicad.i
@@ -119,7 +119,7 @@ principle should be easily implemented by adapting the current STL containers.
// wrapper of BASE_SEQ (see typedef std::vector<LAYER_ID> BASE_SEQ;)
%template(base_seqVect) std::vector<enum LAYER_ID>;
-// TODO: wrapper of BASE_SET (see std::bitset<LAYER_ID_COUNT> BASE_SET;)
+// TODO: wrapper of BASE_SET (see std::bitset<PCB_LAYER_ID_COUNT> BASE_SET;)
// KiCad plugin handling
diff --git a/common/view/view_group.cpp b/common/view/view_group.cpp
index cb11c61..ba87fe9 100644
--- a/common/view/view_group.cpp
+++ b/common/view/view_group.cpp
@@ -41,7 +41,7 @@
using namespace KIGFX;
VIEW_GROUP::VIEW_GROUP( VIEW* aView ) :
- m_layer( ITEM_GAL_LAYER( GP_OVERLAY ) )
+ m_layer( LAYER_GP_OVERLAY )
{
}
diff --git a/common/worksheet_viewitem.cpp b/common/worksheet_viewitem.cpp
index 18f8fb9..8b7b148 100644
--- a/common/worksheet_viewitem.cpp
+++ b/common/worksheet_viewitem.cpp
@@ -131,7 +131,7 @@ void WORKSHEET_VIEWITEM::ViewDraw( int aLayer, VIEW* aView ) const
void WORKSHEET_VIEWITEM::ViewGetLayers( int aLayers[], int& aCount ) const
{
aCount = 1;
- aLayers[0] = ITEM_GAL_LAYER( WORKSHEET );
+ aLayers[0] = LAYER_WORKSHEET;
}
diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp
index d0141cf..d0300d8 100644
--- a/eeschema/eeschema.cpp
+++ b/eeschema/eeschema.cpp
@@ -163,16 +163,20 @@ PGM_BASE& Pgm()
static COLOR4D s_layerColor[LAYERSCH_ID_COUNT];
-COLOR4D GetLayerColor( LAYERSCH_ID aLayer )
+COLOR4D GetLayerColor( LAYER_ID aLayer )
{
- wxASSERT( unsigned( aLayer ) < DIM( s_layerColor ) );
- return s_layerColor[aLayer];
+ wxASSERT( aLayer >= LAYER_ID_EESCHEMA_BEGIN && aLayer < LAYER_ID_EESCHEMA_END );
+ unsigned layer = aLayer - LAYER_ID_EESCHEMA_BEGIN;
+ wxASSERT( layer < DIM( s_layerColor ) );
+ return s_layerColor[layer];
}
-void SetLayerColor( COLOR4D aColor, LAYERSCH_ID aLayer )
+void SetLayerColor( COLOR4D aColor, LAYER_ID aLayer )
{
- wxASSERT( unsigned( aLayer ) < DIM( s_layerColor ) );
- s_layerColor[aLayer] = aColor;
+ wxASSERT( aLayer >= LAYER_ID_EESCHEMA_BEGIN && aLayer < LAYER_ID_EESCHEMA_END );
+ unsigned layer = aLayer - LAYER_ID_EESCHEMA_BEGIN;
+ wxASSERT( layer < DIM( s_layerColor ) );
+ s_layerColor[layer] = aColor;
}
@@ -186,34 +190,35 @@ static PARAM_CFG_ARRAY& cfg_params()
// eeschema KIFACE comes in.
#define CLR(x, y, z)\
- ca.push_back( new PARAM_CFG_SETCOLOR( true, wxT( x ), &s_layerColor[y], z ) );
-
- CLR( "ColorWireEx", LAYER_WIRE, COLOR4D( GREEN ) )
- CLR( "ColorBusEx", LAYER_BUS, COLOR4D( BLUE ) )
- CLR( "ColorConnEx", LAYER_JUNCTION, COLOR4D( GREEN ) )
- CLR( "ColorLLabelEx", LAYER_LOCLABEL, COLOR4D( BLACK ) )
- CLR( "ColorHLabelEx", LAYER_HIERLABEL, COLOR4D( BROWN ) )
- CLR( "ColorGLabelEx", LAYER_GLOBLABEL, COLOR4D( RED ) )
- CLR( "ColorPinNumEx", LAYER_PINNUM, COLOR4D( RED ) )
- CLR( "ColorPinNameEx", LAYER_PINNAM, COLOR4D( CYAN ) )
- CLR( "ColorFieldEx", LAYER_FIELDS, COLOR4D( MAGENTA ) )
- CLR( "ColorReferenceEx", LAYER_REFERENCEPART, COLOR4D( CYAN ) )
- CLR( "ColorValueEx", LAYER_VALUEPART, COLOR4D( CYAN ) )
- CLR( "ColorNoteEx", LAYER_NOTES, COLOR4D( LIGHTBLUE ) )
- CLR( "ColorBodyEx", LAYER_DEVICE, COLOR4D( RED ) )
- CLR( "ColorBodyBgEx", LAYER_DEVICE_BACKGROUND, COLOR4D( LIGHTYELLOW ) )
- CLR( "ColorNetNameEx", LAYER_NETNAM, COLOR4D( DARKGRAY ) )
- CLR( "ColorPinEx", LAYER_PIN, COLOR4D( RED ) )
- CLR( "ColorSheetEx", LAYER_SHEET, COLOR4D( MAGENTA ) )
- CLR( "ColorSheetFileNameEx", LAYER_SHEETFILENAME, COLOR4D( BROWN ) )
- CLR( "ColorSheetNameEx", LAYER_SHEETNAME, COLOR4D( CYAN ) )
- CLR( "ColorSheetLabelEx", LAYER_SHEETLABEL, COLOR4D( BROWN ) )
- CLR( "ColorNoConnectEx", LAYER_NOCONNECT, COLOR4D( BLUE ) )
- CLR( "ColorErcWEx", LAYER_ERC_WARN, COLOR4D( GREEN ) )
- CLR( "ColorErcEEx", LAYER_ERC_ERR, COLOR4D( RED ) )
- CLR( "ColorGridEx", LAYER_GRID, COLOR4D( DARKGRAY ) )
- CLR( "ColorBgCanvasEx", LAYER_BACKGROUND, COLOR4D( WHITE ) )
- CLR( "ColorBrighenedEx", LAYER_BRIGHTENED, COLOR4D( PUREMAGENTA ) )
+ ca.push_back( new PARAM_CFG_SETCOLOR( true, wxT( x ),\
+ &s_layerColor[EESCHEMA_LAYER_INDEX( y )], z ) );
+
+ CLR( "ColorWireEx", LAYER_WIRE, COLOR4D( GREEN ) )
+ CLR( "ColorBusEx", LAYER_BUS, COLOR4D( BLUE ) )
+ CLR( "ColorConnEx", LAYER_JUNCTION, COLOR4D( GREEN ) )
+ CLR( "ColorLLabelEx", LAYER_LOCLABEL, COLOR4D( BLACK ) )
+ CLR( "ColorHLabelEx", LAYER_HIERLABEL, COLOR4D( BROWN ) )
+ CLR( "ColorGLabelEx", LAYER_GLOBLABEL, COLOR4D( RED ) )
+ CLR( "ColorPinNumEx", LAYER_PINNUM, COLOR4D( RED ) )
+ CLR( "ColorPinNameEx", LAYER_PINNAM, COLOR4D( CYAN ) )
+ CLR( "ColorFieldEx", LAYER_FIELDS, COLOR4D( MAGENTA ) )
+ CLR( "ColorReferenceEx", LAYER_REFERENCEPART, COLOR4D( CYAN ) )
+ CLR( "ColorValueEx", LAYER_VALUEPART, COLOR4D( CYAN ) )
+ CLR( "ColorNoteEx", LAYER_NOTES, COLOR4D( LIGHTBLUE ) )
+ CLR( "ColorBodyEx", LAYER_DEVICE, COLOR4D( RED ) )
+ CLR( "ColorBodyBgEx", LAYER_DEVICE_BACKGROUND, COLOR4D( LIGHTYELLOW ) )
+ CLR( "ColorNetNameEx", LAYER_NETNAM, COLOR4D( DARKGRAY ) )
+ CLR( "ColorPinEx", LAYER_PIN, COLOR4D( RED ) )
+ CLR( "ColorSheetEx", LAYER_SHEET, COLOR4D( MAGENTA ) )
+ CLR( "ColorSheetFileNameEx", LAYER_SHEETFILENAME, COLOR4D( BROWN ) )
+ CLR( "ColorSheetNameEx", LAYER_SHEETNAME, COLOR4D( CYAN ) )
+ CLR( "ColorSheetLabelEx", LAYER_SHEETLABEL, COLOR4D( BROWN ) )
+ CLR( "ColorNoConnectEx", LAYER_NOCONNECT, COLOR4D( BLUE ) )
+ CLR( "ColorErcWEx", LAYER_ERC_WARN, COLOR4D( GREEN ) )
+ CLR( "ColorErcEEx", LAYER_ERC_ERR, COLOR4D( RED ) )
+ CLR( "ColorGridEx", LAYER_SCHEMATIC_GRID, COLOR4D( DARKGRAY ) )
+ CLR( "ColorBgCanvasEx", LAYER_SCHEMATIC_BACKGROUND, COLOR4D( WHITE ) )
+ CLR( "ColorBrighenedEx", LAYER_BRIGHTENED, COLOR4D( PUREMAGENTA ) )
}
return ca;
@@ -230,10 +235,10 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
// Give a default colour for all layers
// (actual color will be initialized by config)
- for( LAYERSCH_ID ii = LAYER_FIRST; ii < LAYERSCH_ID_COUNT; ++ii )
+ for( LAYER_ID ii = LAYER_ID_EESCHEMA_BEGIN; ii < LAYER_ID_EESCHEMA_END; ++ii )
SetLayerColor( COLOR4D( DARKGRAY ), ii );
- SetLayerColor( COLOR4D::WHITE, LAYER_BACKGROUND );
+ SetLayerColor( COLOR4D::WHITE, LAYER_SCHEMATIC_BACKGROUND );
// Must be called before creating the main frame in order to
// display the real hotkeys in menus or tool tips
diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp
index 18d2764..79b2321 100644
--- a/eeschema/eeschema_config.cpp
+++ b/eeschema/eeschema_config.cpp
@@ -595,8 +595,8 @@ void SCH_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
wxConfigLoadSetups( aCfg, GetConfigurationSettings() );
- SetGridColor( GetLayerColor( LAYER_GRID ) );
- SetDrawBgColor( GetLayerColor( LAYER_BACKGROUND ) );
+ SetGridColor( GetLayerColor( LAYER_SCHEMATIC_GRID ) );
+ SetDrawBgColor( GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
SetDefaultBusThickness( aCfg->Read( DefaultBusWidthEntry, DEFAULTBUSTHICKNESS ) );
SetDefaultLineThickness( aCfg->Read( DefaultDrawLineWidthEntry, DEFAULTDRAWLINETHICKNESS ) );
@@ -759,8 +759,8 @@ void LIB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
{
EDA_DRAW_FRAME::LoadSettings( aCfg );
- SetGridColor( GetLayerColor( LAYER_GRID ) );
- SetDrawBgColor( GetLayerColor( LAYER_BACKGROUND ) );
+ SetGridColor( GetLayerColor( LAYER_SCHEMATIC_GRID ) );
+ SetDrawBgColor( GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
SetDefaultLineThickness( aCfg->Read( DefaultDrawLineWidthEntry, DEFAULTDRAWLINETHICKNESS ) );
SetDefaultPinLength( aCfg->Read( DefaultPinLengthEntry, DEFAULTPINLENGTH ) );
diff --git a/eeschema/general.h b/eeschema/general.h
index 6a094dc..437d881 100644
--- a/eeschema/general.h
+++ b/eeschema/general.h
@@ -30,6 +30,7 @@
#define _GENERAL_H_
#include <gal/color4d.h>
+#include <layers_id_colors_and_visibility.h>
using KIGFX::COLOR4D;
@@ -68,48 +69,6 @@ class SCH_SHEET;
#define GR_DEFAULT_DRAWMODE GR_COPY
-// this enum is for color management
-// Using here "LAYER" in name is due to historical reasons.
-// Eeschema does not actually use layers. It just uses "LAYER_XX" as identifier
-// mainly for item color
-typedef enum {
- LAYER_FIRST,
- LAYER_WIRE = LAYER_FIRST,
- LAYER_BUS,
- LAYER_JUNCTION,
- LAYER_LOCLABEL,
- LAYER_GLOBLABEL,
- LAYER_HIERLABEL,
- LAYER_PINNUM,
- LAYER_PINNAM,
- LAYER_REFERENCEPART,
- LAYER_VALUEPART,
- LAYER_FIELDS,
- LAYER_DEVICE,
- LAYER_NOTES,
- LAYER_NETNAM,
- LAYER_PIN,
- LAYER_SHEET,
- LAYER_SHEETNAME,
- LAYER_SHEETFILENAME,
- LAYER_SHEETLABEL,
- LAYER_NOCONNECT,
- LAYER_ERC_WARN,
- LAYER_ERC_ERR,
- LAYER_DEVICE_BACKGROUND,
- LAYER_GRID,
- LAYER_BACKGROUND,
- LAYER_BRIGHTENED,
- LAYERSCH_ID_COUNT
-} LAYERSCH_ID;
-
-inline LAYERSCH_ID operator++( LAYERSCH_ID& a )
-{
- a = LAYERSCH_ID( int( a ) + 1 );
- return a;
-}
-
-
/* Rotation, mirror of graphic items in components bodies are handled by a
* transform matrix. The default matrix is useful to draw lib entries with
* using this default matrix ( no rotation, no mirror but Y axis is bottom to top, and
@@ -140,8 +99,8 @@ void SetDefaultTextSize( int aSize );
int GetDefaultBusThickness();
void SetDefaultBusThickness( int aThickness );
-COLOR4D GetLayerColor( LAYERSCH_ID aLayer );
-void SetLayerColor( COLOR4D aColor, LAYERSCH_ID aLayer );
+COLOR4D GetLayerColor( LAYER_ID aLayer );
+void SetLayerColor( COLOR4D aColor, LAYER_ID aLayer );
// Color to draw selected items
COLOR4D GetItemSelectedColor();
diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp
index bd434c1..8a0d957 100644
--- a/eeschema/sch_base_frame.cpp
+++ b/eeschema/sch_base_frame.cpp
@@ -65,13 +65,13 @@ void SCH_BASE_FRAME::OnOpenLibraryViewer( wxCommandEvent& event )
// Virtual from EDA_DRAW_FRAME
COLOR4D SCH_BASE_FRAME::GetDrawBgColor() const
{
- return GetLayerColor( LAYER_BACKGROUND );
+ return GetLayerColor( LAYER_SCHEMATIC_BACKGROUND );
}
void SCH_BASE_FRAME::SetDrawBgColor( COLOR4D aColor)
{
m_drawBgColor= aColor;
- SetLayerColor( aColor, LAYER_BACKGROUND );
+ SetLayerColor( aColor, LAYER_SCHEMATIC_BACKGROUND );
}
diff --git a/eeschema/sch_item_struct.h b/eeschema/sch_item_struct.h
index 7f5dc1f..aa41c58 100644
--- a/eeschema/sch_item_struct.h
+++ b/eeschema/sch_item_struct.h
@@ -116,7 +116,7 @@ public:
class SCH_ITEM : public EDA_ITEM
{
protected:
- LAYERSCH_ID m_Layer;
+ LAYER_ID m_Layer;
EDA_ITEMS m_connections; ///< List of items connected to this item.
wxPoint m_storedPos; ///< a temporary variable used in some move commands
///> to store a initial pos (of the item or mouse cursor)
@@ -161,14 +161,14 @@ public:
* Function GetLayer
* returns the layer this item is on.
*/
- LAYERSCH_ID GetLayer() const { return m_Layer; }
+ LAYER_ID GetLayer() const { return m_Layer; }
/**
* Function SetLayer
* sets the layer this item is on.
* @param aLayer The layer number.
*/
- void SetLayer( LAYERSCH_ID aLayer ) { m_Layer = aLayer; }
+ void SetLayer( LAYER_ID aLayer ) { m_Layer = aLayer; }
/**
* Function GetPenSize virtual pure
diff --git a/eeschema/sch_legacy_plugin.cpp b/eeschema/sch_legacy_plugin.cpp
index 2d4eaf8..6544b0d 100644
--- a/eeschema/sch_legacy_plugin.cpp
+++ b/eeschema/sch_legacy_plugin.cpp
@@ -1578,7 +1578,7 @@ void SCH_LEGACY_PLUGIN::Format( SCH_SCREEN* aScreen )
m_out->Print( 0, "LIBS:%s\n", TO_UTF8( lib.GetName() ) );
// This section is not used, but written for file compatibility
- m_out->Print( 0, "EELAYER %d %d\n", LAYERSCH_ID_COUNT, 0 );
+ m_out->Print( 0, "EELAYER %d %d\n", LAYER_ID_EESCHEMA_END, 0 );
m_out->Print( 0, "EELAYER END\n" );
/* Write page info, ScreenNumber and NumberOfScreen; not very meaningful for
@@ -1959,7 +1959,7 @@ void SCH_LEGACY_PLUGIN::saveText( SCH_TEXT* aText )
wxString text = aText->GetText();
- LAYERSCH_ID layer = aText->GetLayer();
+ LAYER_ID layer = aText->GetLayer();
if( layer == LAYER_NOTES || layer == LAYER_LOCLABEL )
{
diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp
index 6f48374..a3bd188 100644
--- a/eeschema/sch_screen.cpp
+++ b/eeschema/sch_screen.cpp
@@ -486,7 +486,7 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
}
// This section is not used, but written for file compatibility
- if( fprintf( aFile, "EELAYER %d %d\n", LAYERSCH_ID_COUNT, 0 ) < 0
+ if( fprintf( aFile, "EELAYER %d %d\n", LAYER_ID_EESCHEMA_END, 0 ) < 0
|| fprintf( aFile, "EELAYER END\n" ) < 0 )
return false;
diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp
index 31dac55..802f469 100644
--- a/eeschema/viewlib_frame.cpp
+++ b/eeschema/viewlib_frame.cpp
@@ -629,8 +629,8 @@ void LIB_VIEW_FRAME::LoadSettings( wxConfigBase* aCfg )
{
EDA_DRAW_FRAME::LoadSettings( aCfg );
- SetGridColor( GetLayerColor( LAYER_GRID ) );
- SetDrawBgColor( GetLayerColor( LAYER_BACKGROUND ) );
+ SetGridColor( GetLayerColor( LAYER_SCHEMATIC_GRID ) );
+ SetDrawBgColor( GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
aCfg->Read( LIBLIST_WIDTH_KEY, &m_libListWidth, 150 );
aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 150 );
diff --git a/eeschema/widgets/widget_eeschema_color_config.cpp b/eeschema/widgets/widget_eeschema_color_config.cpp
index f8eabad..d81ab8b 100644
--- a/eeschema/widgets/widget_eeschema_color_config.cpp
+++ b/eeschema/widgets/widget_eeschema_color_config.cpp
@@ -90,7 +90,7 @@ static COLORBUTTON sheetColorButtons[] = {
static COLORBUTTON miscColorButtons[] = {
{ _( "ERC warning" ), LAYER_ERC_WARN },
{ _( "ERC error" ), LAYER_ERC_ERR },
- { _( "Grid" ), LAYER_GRID },
+ { _( "Grid" ), LAYER_SCHEMATIC_GRID },
{ _( "Brightened" ), LAYER_BRIGHTENED },
{ wxT( "" ), -1 } // Sentinel marking end of list.
};
@@ -104,9 +104,9 @@ static BUTTONINDEX buttonGroups[] = {
{ wxT( "" ), NULL }
};
-static COLORBUTTON bgColorButton = { "", LAYER_BACKGROUND };
+static COLORBUTTON bgColorButton = { "", LAYER_SCHEMATIC_BACKGROUND };
-static COLOR4D currentColors[ LAYERSCH_ID_COUNT ];
+static COLOR4D currentColors[ LAYER_ID_EESCHEMA_END ];
WIDGET_EESCHEMA_COLOR_CONFIG::WIDGET_EESCHEMA_COLOR_CONFIG( wxWindow* aParent, EDA_DRAW_FRAME* aDrawFrame ) :
@@ -151,7 +151,7 @@ void WIDGET_EESCHEMA_COLOR_CONFIG::CreateControls()
rowBoxSizer = new wxBoxSizer( wxHORIZONTAL );
columnBoxSizer->Add( rowBoxSizer, 0, wxGROW | wxALL, 0 );
- COLOR4D color = GetLayerColor( LAYERSCH_ID( buttons->m_Layer ) );
+ COLOR4D color = GetLayerColor( LAYER_ID( buttons->m_Layer ) );
currentColors[ buttons->m_Layer ] = color;
wxMemoryDC iconDC;
@@ -217,7 +217,7 @@ void WIDGET_EESCHEMA_COLOR_CONFIG::CreateControls()
columnBoxSizer->Add( selBgColorBtn, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, 5 );
}
- currentColors[ LAYER_BACKGROUND ] = bgColor;
+ currentColors[ LAYER_SCHEMATIC_BACKGROUND ] = bgColor;
// Dialog now needs to be resized, but the associated command is found elsewhere.
}
@@ -275,11 +275,11 @@ bool WIDGET_EESCHEMA_COLOR_CONFIG::TransferDataFromControl()
// Check for color conflicts with background color to give user a chance to bail
// out before making changes.
- COLOR4D bgcolor = currentColors[LAYER_BACKGROUND];
+ COLOR4D bgcolor = currentColors[LAYER_SCHEMATIC_BACKGROUND];
- for( LAYERSCH_ID clyr = LAYER_WIRE; clyr < LAYERSCH_ID_COUNT; ++clyr )
+ for( LAYER_ID clyr = LAYER_WIRE; clyr < LAYER_ID_EESCHEMA_END; ++clyr )
{
- if( bgcolor == currentColors[ clyr ] && clyr != LAYER_BACKGROUND )
+ if( bgcolor == currentColors[ clyr ] && clyr != LAYER_SCHEMATIC_BACKGROUND )
{
warning = true;
break;
@@ -300,15 +300,15 @@ bool WIDGET_EESCHEMA_COLOR_CONFIG::TransferDataFromControl()
// Update color of background
GetDrawFrame()->SetDrawBgColor( bgcolor );
- currentColors[ LAYER_BACKGROUND ] = bgcolor;
+ currentColors[ LAYER_SCHEMATIC_BACKGROUND ] = bgcolor;
- for( LAYERSCH_ID clyr = LAYER_WIRE; clyr < LAYERSCH_ID_COUNT; ++clyr )
+ for( LAYER_ID clyr = LAYER_WIRE; clyr < LAYER_ID_EESCHEMA_END; ++clyr )
{
SetLayerColor( currentColors[ clyr ], clyr );
}
- GetDrawFrame()->SetGridColor( GetLayerColor( LAYER_GRID ) );
+ GetDrawFrame()->SetGridColor( GetLayerColor( LAYER_SCHEMATIC_GRID ) );
GetDrawFrame()->GetCanvas()->Refresh();
return true;
diff --git a/gerbview/class_gerbview_layer_widget.cpp b/gerbview/class_gerbview_layer_widget.cpp
index 1470417..9ae6217 100644
--- a/gerbview/class_gerbview_layer_widget.cpp
+++ b/gerbview/class_gerbview_layer_widget.cpp
@@ -105,10 +105,10 @@ void GERBER_LAYER_WIDGET::ReFillRender()
#define RR LAYER_WIDGET::ROW // Render Row abreviation to reduce source width
- // text id color tooltip checked
- RR( _( "Grid" ), GERBER_GRID_VISIBLE, WHITE, _( "Show the (x,y) grid dots" ) ),
- RR( _( "DCodes" ), DCODES_VISIBLE, WHITE, _( "Show DCodes identification" ) ),
- RR( _( "Neg. Obj." ), NEGATIVE_OBJECTS_VISIBLE, DARKGRAY,
+ // text id color tooltip checked
+ RR( _( "Grid" ), LAYER_GRID, WHITE, _( "Show the (x,y) grid dots" ) ),
+ RR( _( "DCodes" ), LAYER_DCODES, WHITE, _( "Show DCodes identification" ) ),
+ RR( _( "Neg. Obj." ), LAYER_NEGATIVE_OBJECTS, DARKGRAY,
_( "Show negative objects in this color" ) ),
};
@@ -117,10 +117,10 @@ void GERBER_LAYER_WIDGET::ReFillRender()
if( renderRows[row].color != COLOR4D::UNSPECIFIED ) // does this row show a color?
{
renderRows[row].color = myframe->GetVisibleElementColor(
- (GERBER_VISIBLE_ID)renderRows[row].id );
+ ( LAYER_ID )renderRows[row].id );
}
renderRows[row].state = myframe->IsElementVisible(
- (GERBER_VISIBLE_ID)renderRows[row].id );
+ ( LAYER_ID )renderRows[row].id );
}
AppendRenderRows( renderRows, DIM(renderRows) );
@@ -293,13 +293,13 @@ void GERBER_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFin
void GERBER_LAYER_WIDGET::OnRenderColorChange( int aId, COLOR4D aColor )
{
- myframe->SetVisibleElementColor( (GERBER_VISIBLE_ID)aId, aColor );
+ myframe->SetVisibleElementColor( ( LAYER_ID )aId, aColor );
myframe->GetCanvas()->Refresh();
}
void GERBER_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
{
- myframe->SetElementVisibility( (GERBER_VISIBLE_ID)aId, isEnabled );
+ myframe->SetElementVisibility( ( LAYER_ID )aId, isEnabled );
myframe->GetCanvas()->Refresh();
}
diff --git a/gerbview/dialogs/dialog_select_one_pcb_layer.cpp b/gerbview/dialogs/dialog_select_one_pcb_layer.cpp
index 1a847ce..1f49cb2 100644
--- a/gerbview/dialogs/dialog_select_one_pcb_layer.cpp
+++ b/gerbview/dialogs/dialog_select_one_pcb_layer.cpp
@@ -31,7 +31,7 @@
#include <gerbview_frame.h>
#include <select_layers_to_pcb.h>
-#define NB_PCB_LAYERS LAYER_ID_COUNT
+#define NB_PCB_LAYERS PCB_LAYER_ID_COUNT
#define FIRST_COPPER_LAYER 0
#define LAST_COPPER_LAYER 31
diff --git a/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp b/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp
index 41ace4a..c1794fb 100644
--- a/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp
+++ b/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp
@@ -123,7 +123,7 @@ void DIALOG_DISPLAY_OPTIONS::initOptDialog( )
}
}
- m_OptDisplayDCodes->SetValue( m_Parent->IsElementVisible( DCODES_VISIBLE ) );
+ m_OptDisplayDCodes->SetValue( m_Parent->IsElementVisible( LAYER_DCODES ) );
m_OptZoomNoCenter->SetValue( m_Parent->GetCanvas()->GetEnableZoomNoCenter() );
@@ -161,7 +161,7 @@ void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event )
else
m_Parent->m_DisplayOptions.m_DisplayPolygonsFill = true;
- m_Parent->SetElementVisibility( DCODES_VISIBLE, m_OptDisplayDCodes->GetValue() );
+ m_Parent->SetElementVisibility( LAYER_DCODES, m_OptDisplayDCodes->GetValue() );
int idx = m_ShowPageLimits->GetSelection();
diff --git a/gerbview/draw_gerber_screen.cpp b/gerbview/draw_gerber_screen.cpp
index 022db48..64c630c 100644
--- a/gerbview/draw_gerber_screen.cpp
+++ b/gerbview/draw_gerber_screen.cpp
@@ -120,7 +120,7 @@ void GERBVIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
if( m_DisplayOptions.m_DisplayDCodes )
{
- COLOR4D dcode_color = GetVisibleElementColor( DCODES_VISIBLE );
+ COLOR4D dcode_color = GetVisibleElementColor( LAYER_DCODES );
GetGerberLayout()->DrawItemsDCodeID( m_canvas, DC, GR_COPY, dcode_color );
}
diff --git a/gerbview/events_called_functions.cpp b/gerbview/events_called_functions.cpp
index 37f6cbe..df964f7 100644
--- a/gerbview/events_called_functions.cpp
+++ b/gerbview/events_called_functions.cpp
@@ -433,12 +433,12 @@ void GERBVIEW_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
break;
case ID_TB_OPTIONS_SHOW_DCODES:
- SetElementVisibility( DCODES_VISIBLE, state );
+ SetElementVisibility( LAYER_DCODES, state );
m_canvas->Refresh( true );
break;
case ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS:
- SetElementVisibility( NEGATIVE_OBJECTS_VISIBLE, state );
+ SetElementVisibility( LAYER_NEGATIVE_OBJECTS, state );
m_canvas->Refresh( true );
break;
diff --git a/gerbview/export_to_pcbnew.cpp b/gerbview/export_to_pcbnew.cpp
index ab23594..c444799 100644
--- a/gerbview/export_to_pcbnew.cpp
+++ b/gerbview/export_to_pcbnew.cpp
@@ -456,7 +456,7 @@ void GBR_TO_PCB_EXPORTER::writePcbHeader( LAYER_NUM* aLayerLookUpTable )
fprintf( m_fp, " (%d %s signal)\n", id, TO_UTF8( GetPCBDefaultLayerName( id ) ) );
}
- for( int ii = B_Adhes; ii < LAYER_ID_COUNT; ii++ )
+ for( int ii = B_Adhes; ii < PCB_LAYER_ID_COUNT; ii++ )
{
fprintf( m_fp, " (%d %s user)\n", ii, TO_UTF8( GetPCBDefaultLayerName( ii ) ) );
}
diff --git a/gerbview/gerbview.h b/gerbview/gerbview.h
index a1e81f3..7920925 100644
--- a/gerbview/gerbview.h
+++ b/gerbview/gerbview.h
@@ -44,20 +44,6 @@ extern const wxChar* g_GerberPageSizeList[8];
// number fo draw layers in Gerbview
#define GERBER_DRAWLAYERS_COUNT 32
-/**
- * Enum GERBER_VISIBLE_ID
- * is a set of visible GERBVIEW elements.
- */
-enum GERBER_VISIBLE_ID
-{
- DCODES_VISIBLE = 1, // visible item id cannot be 0
- // because this id is used as wxWidget id
- GERBER_GRID_VISIBLE,
- NEGATIVE_OBJECTS_VISIBLE, // use the selected color to draw negative objects
- // instaed of background color, to make them visible
- END_GERBER_VISIBLE_LIST // sentinel
-};
-
// Interpolation type
enum Gerb_Interpolation
{
diff --git a/gerbview/gerbview_config.cpp b/gerbview/gerbview_config.cpp
index d53b028..2d7b4b4 100644
--- a/gerbview/gerbview_config.cpp
+++ b/gerbview/gerbview_config.cpp
@@ -89,13 +89,13 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings()
&m_displayMode, 2, 0, 2 ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true,
wxT( "DCodeColorEx" ),
- &g_ColorsSettings.m_ItemsColors[
- DCODES_VISIBLE],
+ &g_ColorsSettings.m_LayersColors[
+ LAYER_DCODES],
WHITE ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true,
wxT( "NegativeObjectsColorEx" ),
- &g_ColorsSettings.m_ItemsColors[
- NEGATIVE_OBJECTS_VISIBLE],
+ &g_ColorsSettings.m_LayersColors[
+ LAYER_NEGATIVE_OBJECTS],
DARKGRAY ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true,
wxT( "DisplayPolarCoordinates" ),
diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp
index 7404f06..6fa0af5 100644
--- a/gerbview/gerbview_frame.cpp
+++ b/gerbview/gerbview_frame.cpp
@@ -293,9 +293,9 @@ void GERBVIEW_FRAME::LoadSettings( wxConfigBase* aCfg )
bool tmp;
aCfg->Read( cfgShowDCodes, &tmp, true );
- SetElementVisibility( DCODES_VISIBLE, tmp );
+ SetElementVisibility( LAYER_DCODES, tmp );
aCfg->Read( cfgShowNegativeObjects, &tmp, false );
- SetElementVisibility( NEGATIVE_OBJECTS_VISIBLE, tmp );
+ SetElementVisibility( LAYER_NEGATIVE_OBJECTS, tmp );
// because we have more than one file history, we must read this one
// using a specific path
@@ -320,9 +320,9 @@ void GERBVIEW_FRAME::SaveSettings( wxConfigBase* aCfg )
aCfg->Write( cfgShowPageSizeOption, GetPageSettings().GetType() );
aCfg->Write( cfgShowBorderAndTitleBlock, m_showBorderAndTitleBlock );
- aCfg->Write( cfgShowDCodes, IsElementVisible( DCODES_VISIBLE ) );
+ aCfg->Write( cfgShowDCodes, IsElementVisible( LAYER_DCODES ) );
aCfg->Write( cfgShowNegativeObjects,
- IsElementVisible( NEGATIVE_OBJECTS_VISIBLE ) );
+ IsElementVisible( LAYER_NEGATIVE_OBJECTS ) );
// Save the drill file history list.
// Because we have more than one file history, we must save this one
@@ -362,20 +362,20 @@ void GERBVIEW_FRAME::ReFillLayerWidget()
}
-void GERBVIEW_FRAME::SetElementVisibility( GERBER_VISIBLE_ID aItemIdVisible,
+void GERBVIEW_FRAME::SetElementVisibility( LAYER_ID aItemIdVisible,
bool aNewState )
{
switch( aItemIdVisible )
{
- case DCODES_VISIBLE:
+ case LAYER_DCODES:
m_DisplayOptions.m_DisplayDCodes = aNewState;
break;
- case NEGATIVE_OBJECTS_VISIBLE:
+ case LAYER_NEGATIVE_OBJECTS:
m_DisplayOptions.m_DisplayNegativeObjects = aNewState;
break;
- case GERBER_GRID_VISIBLE:
+ case LAYER_GRID:
SetGridVisibility( aNewState );
break;
@@ -562,19 +562,19 @@ void GERBVIEW_FRAME::UpdateTitleAndInfo()
}
-bool GERBVIEW_FRAME::IsElementVisible( GERBER_VISIBLE_ID aItemIdVisible ) const
+bool GERBVIEW_FRAME::IsElementVisible( LAYER_ID aItemIdVisible ) const
{
switch( aItemIdVisible )
{
- case DCODES_VISIBLE:
+ case LAYER_DCODES:
return m_DisplayOptions.m_DisplayDCodes;
break;
- case NEGATIVE_OBJECTS_VISIBLE:
+ case LAYER_NEGATIVE_OBJECTS:
return m_DisplayOptions.m_DisplayNegativeObjects;
break;
- case GERBER_GRID_VISIBLE:
+ case LAYER_GRID:
return IsGridVisible();
break;
@@ -607,18 +607,18 @@ bool GERBVIEW_FRAME::IsLayerVisible( int aLayer ) const
}
-COLOR4D GERBVIEW_FRAME::GetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible ) const
+COLOR4D GERBVIEW_FRAME::GetVisibleElementColor( LAYER_ID aItemIdVisible ) const
{
COLOR4D color = COLOR4D::UNSPECIFIED;
switch( aItemIdVisible )
{
- case NEGATIVE_OBJECTS_VISIBLE:
- case DCODES_VISIBLE:
+ case LAYER_NEGATIVE_OBJECTS:
+ case LAYER_DCODES:
color = m_colorsSettings->GetItemColor( aItemIdVisible );
break;
- case GERBER_GRID_VISIBLE:
+ case LAYER_GRID:
color = GetGridColor();
break;
@@ -634,21 +634,21 @@ COLOR4D GERBVIEW_FRAME::GetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible
void GERBVIEW_FRAME::SetGridVisibility( bool aVisible )
{
EDA_DRAW_FRAME::SetGridVisibility( aVisible );
- m_LayersManager->SetRenderState( GERBER_GRID_VISIBLE, aVisible );
+ m_LayersManager->SetRenderState( LAYER_GRID, aVisible );
}
-void GERBVIEW_FRAME::SetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible,
+void GERBVIEW_FRAME::SetVisibleElementColor( LAYER_ID aItemIdVisible,
COLOR4D aColor )
{
switch( aItemIdVisible )
{
- case NEGATIVE_OBJECTS_VISIBLE:
- case DCODES_VISIBLE:
+ case LAYER_NEGATIVE_OBJECTS:
+ case LAYER_DCODES:
m_colorsSettings->SetItemColor( aItemIdVisible, aColor );
break;
- case GERBER_GRID_VISIBLE:
+ case LAYER_GRID:
SetGridColor( aColor );
m_colorsSettings->SetItemColor( aItemIdVisible, aColor );
break;
@@ -661,8 +661,8 @@ void GERBVIEW_FRAME::SetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible,
COLOR4D GERBVIEW_FRAME::GetNegativeItemsColor() const
{
- if( IsElementVisible( NEGATIVE_OBJECTS_VISIBLE ) )
- return GetVisibleElementColor( NEGATIVE_OBJECTS_VISIBLE );
+ if( IsElementVisible( LAYER_NEGATIVE_OBJECTS ) )
+ return GetVisibleElementColor( LAYER_NEGATIVE_OBJECTS );
else
return GetDrawBgColor();
}
diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h
index 8646ff8..fc79b51 100644
--- a/gerbview/gerbview_frame.h
+++ b/gerbview/gerbview_frame.h
@@ -33,6 +33,7 @@
#include <config_params.h>
#include <draw_frame.h>
+#include <layers_id_colors_and_visibility.h>
#include <gerbview.h>
#include <class_gbr_layout.h>
@@ -285,19 +286,19 @@ public:
* Function IsElementVisible
* tests whether a given element category is visible. Keep this as an
* inline function.
- * @param aItemIdVisible is an item id from the enum GERBER_VISIBLE_ID
+ * @param aItemIdVisible is an item id from the enum LAYER_ID
* @return bool - true if the element is visible.
*/
- bool IsElementVisible( GERBER_VISIBLE_ID aItemIdVisible ) const;
+ bool IsElementVisible( LAYER_ID aItemIdVisible ) const;
/**
* Function SetElementVisibility
* changes the visibility of an element category
- * @param aItemIdVisible is an item id from the enum GERBER_VISIBLE_ID
+ * @param aItemIdVisible is an item id from the enum LAYER_ID
* @param aNewState = The new visibility state of the element category
- * (see enum PCB_VISIBLE)
+ * (see enum PCB)
*/
- void SetElementVisibility( GERBER_VISIBLE_ID aItemIdVisible, bool aNewState );
+ void SetElementVisibility( LAYER_ID aItemIdVisible, bool aNewState );
/**
* Function SetGridVisibility(), virtual from EDA_DRAW_FRAME
@@ -334,9 +335,9 @@ public:
* Function GetVisibleElementColor
* returns the color of a gerber visible element.
*/
- COLOR4D GetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible ) const;
+ COLOR4D GetVisibleElementColor( LAYER_ID aItemIdVisible ) const;
- void SetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible, COLOR4D aColor );
+ void SetVisibleElementColor( LAYER_ID aItemIdVisible, COLOR4D aColor );
/**
* Function GetLayerColor
diff --git a/gerbview/hotkeys.cpp b/gerbview/hotkeys.cpp
index ce9c169..e95cade 100644
--- a/gerbview/hotkeys.cpp
+++ b/gerbview/hotkeys.cpp
@@ -185,12 +185,12 @@ bool GERBVIEW_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
break;
case HK_GBR_NEGATIVE_DISPLAY_ONOFF:
- SetElementVisibility( NEGATIVE_OBJECTS_VISIBLE, not IsElementVisible( NEGATIVE_OBJECTS_VISIBLE ) );
+ SetElementVisibility( LAYER_NEGATIVE_OBJECTS, not IsElementVisible( LAYER_NEGATIVE_OBJECTS ) );
m_canvas->Refresh();
break;
case HK_GBR_DCODE_DISPLAY_ONOFF:
- SetElementVisibility( DCODES_VISIBLE, not IsElementVisible( DCODES_VISIBLE ) );
+ SetElementVisibility( LAYER_DCODES, not IsElementVisible( LAYER_DCODES ) );
m_canvas->Refresh();
break;
diff --git a/gerbview/toolbars_gerber.cpp b/gerbview/toolbars_gerber.cpp
index 23802f9..6d77c26 100644
--- a/gerbview/toolbars_gerber.cpp
+++ b/gerbview/toolbars_gerber.cpp
@@ -505,13 +505,13 @@ void GERBVIEW_FRAME::OnUpdatePolygonsDrawMode( wxUpdateUIEvent& aEvent )
void GERBVIEW_FRAME::OnUpdateShowDCodes( wxUpdateUIEvent& aEvent )
{
- aEvent.Check( IsElementVisible( DCODES_VISIBLE ) );
+ aEvent.Check( IsElementVisible( LAYER_DCODES ) );
}
void GERBVIEW_FRAME::OnUpdateShowNegativeItems( wxUpdateUIEvent& aEvent )
{
- aEvent.Check( IsElementVisible( NEGATIVE_OBJECTS_VISIBLE ) );
+ aEvent.Check( IsElementVisible( LAYER_NEGATIVE_OBJECTS ) );
}
diff --git a/include/class_board_design_settings.h b/include/class_board_design_settings.h
index a7b200e..7b8999d 100644
--- a/include/class_board_design_settings.h
+++ b/include/class_board_design_settings.h
@@ -487,13 +487,13 @@ public:
* inline function.
* @param aElementCategory is from the enum by the same name
* @return bool - true if the element is visible.
- * @see enum PCB_VISIBLE
+ * @see enum LAYER_ID
*/
inline bool IsElementVisible( int aElementCategory ) const
{
- assert( aElementCategory >= 0 && aElementCategory < END_PCB_VISIBLE_LIST );
+ assert( aElementCategory > LAYER_ID_GAL_START && aElementCategory < LAYER_ID_GAL_END );
- return ( m_visibleElements & ( 1 << aElementCategory ) );
+ return ( m_visibleElements & ( 1 << PCB_LAYER_INDEX( aElementCategory ) ) );
}
/**
@@ -501,7 +501,7 @@ public:
* changes the visibility of an element category
* @param aElementCategory is from the enum by the same name
* @param aNewState = The new visibility state of the element category
- * @see enum PCB_VISIBLE
+ * @see enum LAYER_ID
*/
void SetElementVisibility( int aElementCategory, bool aNewState );
diff --git a/include/class_colors_design_settings.h b/include/class_colors_design_settings.h
index 1ba91e4..2afeed7 100644
--- a/include/class_colors_design_settings.h
+++ b/include/class_colors_design_settings.h
@@ -46,9 +46,6 @@ public:
// Common to Eeschema, Pcbnew, GerbView
COLOR4D m_LayersColors[LAYER_ID_COUNT]; ///< Layer colors (tracks and graphic items)
- // Common to Eeschema, Pcbnew
- COLOR4D m_ItemsColors[32]; ///< All others items but layers
-
public:
COLORS_DESIGN_SETTINGS();
@@ -69,14 +66,14 @@ public:
/**
* Function GetItemColor
* @return the color for an item which is one of the item indices given
- * in pcbstruct.h, enum PCB_VISIBLE or in schematic
+ * in enum LAYER_ID
*/
COLOR4D GetItemColor( int aItemIdx ) const;
/**
* Function SetItemColor
* sets the color for an item which is one of the item indices given
- * in pcbstruct.h, enum PCB_VISIBLE or in schematic
+ * in enum LAYER_ID
*/
void SetItemColor( int aItemIdx, COLOR4D aColor );
diff --git a/include/layers_id_colors_and_visibility.h b/include/layers_id_colors_and_visibility.h
index 3aa84af..5404ac6 100644
--- a/include/layers_id_colors_and_visibility.h
+++ b/include/layers_id_colors_and_visibility.h
@@ -50,12 +50,21 @@ typedef int LAYER_NUM;
/**
* Enum LAYER_ID
- * is the set of PCB layers. It has nothing to do with gerbers or view layers.
- * One of these cannot be "incremented".
+ * This is the definition of all layers used in Pcbnew and GerbView,
+ * and might eventually include layer definitions for Eeschema.
+ *
+ * The PCB layer types are fixed at value 0 through LAYER_ID_COUNT,
+ * to ensure compatibility with legacy board files.
+ *
+ * GAL layers (starting at LAYER_ID_GAL_START) are used for color settings
+ *
*/
enum LAYER_ID
{
- F_Cu, // 0
+ UNDEFINED_LAYER = -1,
+ UNSELECTED_LAYER = -2,
+
+ F_Cu = 0, // 0
In1_Cu,
In2_Cu,
In3_Cu,
@@ -113,15 +122,136 @@ enum LAYER_ID
B_Fab,
F_Fab,
- LAYER_ID_COUNT,
-
- UNDEFINED_LAYER = -1,
- UNSELECTED_LAYER = -2,
+ PCB_LAYER_ID_COUNT,
+
+ LAYER_ID_NETNAMES_START = 100,
+
+ /// Reserved space for board layer netnames in 101-199
+
+ LAYER_PAD_FR_NETNAMES = 200,
+ LAYER_PAD_BK_NETNAMES,
+ LAYER_PADS_NETNAMES,
+
+ LAYER_ID_NETNAMES_END,
+
+ /// Start of GAL layers; this is probably where you want to add new layers if needed.
+ LAYER_ID_GAL_START = 300,
+
+ LAYER_VIAS = LAYER_ID_GAL_START,
+ LAYER_VIA_MICROVIA,
+ LAYER_VIA_BBLIND,
+ LAYER_VIA_THROUGH,
+ LAYER_NON_PLATED,
+ LAYER_MOD_TEXT_FR,
+ LAYER_MOD_TEXT_BK,
+ LAYER_MOD_TEXT_INVISIBLE,
+ LAYER_ANCHOR,
+ LAYER_PAD_FR,
+ LAYER_PAD_BK,
+ LAYER_RATSNEST,
+ LAYER_GRID,
+ LAYER_GRID_AXES,
+ LAYER_NO_CONNECTS,
+ LAYER_MOD_FR,
+ LAYER_MOD_BK,
+ LAYER_MOD_VALUES,
+ LAYER_MOD_REFERENCES,
+ LAYER_TRACKS,
+ LAYER_PADS,
+ LAYER_PADS_HOLES,
+ LAYER_VIAS_HOLES,
+ LAYER_DRC,
+ LAYER_WORKSHEET,
+ LAYER_GP_OVERLAY,
+
+ /// This is the end of the layers used for visibility bitmasks in Pcbnew
+ LAYER_ID_PCB_GAL_END,
+
+ /// Add new GAL layers here
+
+ LAYER_ID_GAL_END,
+
+ /// Eeschema layers below
+
+ LAYER_ID_EESCHEMA_BEGIN = 400,
+
+ LAYER_WIRE = LAYER_ID_EESCHEMA_BEGIN,
+ LAYER_BUS,
+ LAYER_JUNCTION,
+ LAYER_LOCLABEL,
+ LAYER_GLOBLABEL,
+ LAYER_HIERLABEL,
+ LAYER_PINNUM,
+ LAYER_PINNAM,
+ LAYER_REFERENCEPART,
+ LAYER_VALUEPART,
+ LAYER_FIELDS,
+ LAYER_DEVICE,
+ LAYER_NOTES,
+ LAYER_NETNAM,
+ LAYER_PIN,
+ LAYER_SHEET,
+ LAYER_SHEETNAME,
+ LAYER_SHEETFILENAME,
+ LAYER_SHEETLABEL,
+ LAYER_NOCONNECT,
+ LAYER_ERC_WARN,
+ LAYER_ERC_ERR,
+ LAYER_DEVICE_BACKGROUND,
+ LAYER_SCHEMATIC_GRID,
+ LAYER_SCHEMATIC_BACKGROUND,
+ LAYER_BRIGHTENED,
+
+ LAYER_ID_EESCHEMA_END,
+
+ /// GerbView layers below
+
+ LAYER_ID_GERBVIEW_BEGIN,
+
+ LAYER_DCODES,
+ LAYER_NEGATIVE_OBJECTS,
+
+ LAYER_ID_GERBVIEW_END,
+
+ /// Sentinel for total layer count
+ LAYER_ID_COUNT
};
#define MAX_CU_LAYERS (B_Cu - F_Cu + 1)
+/// Subtract this from a GAL layer to get the 0-indexed version of the layer (for masking)
+#define GAL_LAYER_OFFSET ( LAYER_ID_GAL_START + 1 )
+
+/// Use this macro to convert a GAL layer to a 0-indexed offset from LAYER_VIAS
+#define PCB_LAYER_INDEX( x ) ( x - GAL_LAYER_OFFSET )
+
+#define PCB_GAL_LAYER_COUNT ( LAYER_ID_PCB_GAL_END - LAYER_ID_GAL_START )
+
+/// These layers should always be visible
+#define MIN_VISIBILITY_MASK int( (1 << PCB_LAYER_INDEX( LAYER_TRACKS ) ) +\
+ ( 1 << PCB_LAYER_INDEX( LAYER_PADS ) ) +\
+ ( 1 << PCB_LAYER_INDEX( LAYER_PADS_HOLES ) ) +\
+ ( 1 << PCB_LAYER_INDEX( LAYER_VIAS_HOLES ) ) +\
+ ( 1 << PCB_LAYER_INDEX( LAYER_DRC ) ) +\
+ ( 1 << PCB_LAYER_INDEX( LAYER_WORKSHEET ) ) +\
+ ( 1 << PCB_LAYER_INDEX( LAYER_GP_OVERLAY ) ) )
+
+/// Macro for obtaining netname layer for a given
+#define NETNAMES_GAL_LAYER( layer ) ( LAYER_ID_NETNAMES_START + layer )
+
+/// Used in Eeschema
+#define LAYERSCH_ID_COUNT ( LAYER_ID_EESCHEMA_END - LAYER_ID_EESCHEMA_BEGIN )
+
+#define EESCHEMA_LAYER_INDEX( x ) ( x - LAYER_ID_EESCHEMA_BEGIN )
+
+/// Used in Eeschema
+inline LAYER_ID operator++( LAYER_ID& a )
+{
+ a = LAYER_ID( int( a ) + 1 );
+ return a;
+}
+
/// A sequence of layers, a sequence provides a certain order.
typedef std::vector<LAYER_ID> BASE_SEQ;
@@ -173,7 +303,7 @@ public:
};
-typedef std::bitset<LAYER_ID_COUNT> BASE_SET;
+typedef std::bitset<PCB_LAYER_ID_COUNT> BASE_SET;
/**
@@ -420,113 +550,6 @@ private:
}
};
-
-/**
- * Enum PCB_VISIBLE
- * is a set of visible PCB elements.
- * @see BOARD::SetVisibleElementColor()
- * @see BOARD::SetVisibleElement()
- */
-enum PCB_VISIBLE
-{
- VIAS_VISIBLE,
- VIA_MICROVIA_VISIBLE,
- VIA_BBLIND_VISIBLE,
- VIA_THROUGH_VISIBLE,
- NON_PLATED_VISIBLE,
- MOD_TEXT_FR_VISIBLE,
- MOD_TEXT_BK_VISIBLE,
- MOD_TEXT_INVISIBLE, ///< text marked as invisible
- ANCHOR_VISIBLE,
- PAD_FR_VISIBLE,
- PAD_BK_VISIBLE,
- RATSNEST_VISIBLE,
- GRID_VISIBLE,
-
- // the rest of these do not currently support color changes:
- NO_CONNECTS_VISIBLE, ///< show a marker on pads with no nets
- MOD_FR_VISIBLE, ///< show modules on front
- MOD_BK_VISIBLE, ///< show modules on back
- MOD_VALUES_VISIBLE, ///< show modules values (when texts are visibles)
- MOD_REFERENCES_VISIBLE, ///< show modules references (when texts are visibles)
-
- TRACKS_VISIBLE,
- PADS_VISIBLE, ///< multilayer pads, usually with holes
- PADS_HOLES_VISIBLE,
- VIAS_HOLES_VISIBLE,
-
- DRC_VISIBLE, ///< drc markers
- WORKSHEET, ///< worksheet frame
- GP_OVERLAY, ///< general purpose overlay
-
- END_PCB_VISIBLE_LIST // sentinel
-};
-
-// Some elements do not have yet a visibility control
-// from a dialog, but have a visibility control flag.
-// Here is a mask to set them visible, to be sure they are displayed
-// after loading a board for instance
-#define MIN_VISIBILITY_MASK int( (1 << TRACKS_VISIBLE) +\
- (1 << PADS_VISIBLE) +\
- (1 << PADS_HOLES_VISIBLE) +\
- (1 << VIAS_HOLES_VISIBLE) +\
- (1 << DRC_VISIBLE) +\
- (1 << WORKSHEET) +\
- (1 << GP_OVERLAY) )
-
-/**
- * Enum NETNAMES_VISIBLE
- * is a set of layers specific for displaying net names.
- * Their visiblity is not supposed to be saved in a board file,
- * they are only to be used by the GAL.
- */
-#if 0
-// was:
-enum NETNAMES_VISIBLE
-{
- LAYER_1_NETNAMES_VISIBLE, // bottom layer
- LAYER_2_NETNAMES_VISIBLE,
- LAYER_3_NETNAMES_VISIBLE,
- LAYER_4_NETNAMES_VISIBLE,
- LAYER_5_NETNAMES_VISIBLE,
- LAYER_6_NETNAMES_VISIBLE,
- LAYER_7_NETNAMES_VISIBLE,
- LAYER_8_NETNAMES_VISIBLE,
- LAYER_9_NETNAMES_VISIBLE,
- LAYER_10_NETNAMES_VISIBLE,
- LAYER_11_NETNAMES_VISIBLE,
- LAYER_12_NETNAMES_VISIBLE,
- LAYER_13_NETNAMES_VISIBLE,
- LAYER_14_NETNAMES_VISIBLE,
- LAYER_15_NETNAMES_VISIBLE,
- LAYER_16_NETNAMES_VISIBLE, // top layer
-
- PAD_FR_NETNAMES_VISIBLE,
- PAD_BK_NETNAMES_VISIBLE,
- PADS_NETNAMES_VISIBLE,
-
- END_NETNAMES_VISIBLE_LIST // sentinel
-};
-#else
-enum NETNAMES_VISIBLE
-{
- PAD_FR_NETNAMES_VISIBLE = B_Cu+1,
- PAD_BK_NETNAMES_VISIBLE,
- PADS_NETNAMES_VISIBLE,
-
- END_NETNAMES_VISIBLE_LIST // sentinel
-};
-#endif
-
-
-/// macro for obtaining layer number for specific item (eg. pad or text)
-#define ITEM_GAL_LAYER(layer) (LAYER_ID_COUNT + layer)
-
-#define NETNAMES_GAL_LAYER(layer) (LAYER_ID_COUNT + END_PCB_VISIBLE_LIST + layer )
-
-/// number of *all* GAL layers including PCB and item layers
-#define TOTAL_LAYER_COUNT (LAYER_ID_COUNT + END_PCB_VISIBLE_LIST + END_NETNAMES_VISIBLE_LIST)
-
/**
* Function IsValidLayer
* tests whether a given integer is a valid layer index, i.e. can
@@ -548,7 +571,7 @@ inline bool IsValidLayer( LAYER_NUM aLayerId )
*/
inline bool IsPcbLayer( LAYER_NUM aLayer )
{
- return aLayer >= F_Cu && aLayer < LAYER_ID_COUNT;
+ return aLayer >= F_Cu && aLayer < PCB_LAYER_ID_COUNT;
}
/**
@@ -570,7 +593,7 @@ inline bool IsCopperLayer( LAYER_NUM aLayerId )
*/
inline bool IsNonCopperLayer( LAYER_NUM aLayerId )
{
- return aLayerId > B_Cu && aLayerId <= LAYER_ID_COUNT;
+ return aLayerId > B_Cu && aLayerId <= PCB_LAYER_ID_COUNT;
}
/**
@@ -670,12 +693,12 @@ inline int GetNetnameLayer( int aLayer )
{
if( IsCopperLayer( aLayer ) )
return NETNAMES_GAL_LAYER( aLayer );
- else if( aLayer == ITEM_GAL_LAYER( PADS_VISIBLE ) )
- return NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE );
- else if( aLayer == ITEM_GAL_LAYER( PAD_FR_VISIBLE ) )
- return NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE );
- else if( aLayer == ITEM_GAL_LAYER( PAD_BK_VISIBLE ) )
- return NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE );
+ else if( aLayer == LAYER_PADS )
+ return LAYER_PADS_NETNAMES;
+ else if( aLayer == LAYER_PAD_FR )
+ return LAYER_PAD_FR_NETNAMES;
+ else if( aLayer == LAYER_PAD_BK )
+ return LAYER_PAD_BK_NETNAMES;
// Fallback
return Cmts_User;
@@ -690,7 +713,7 @@ inline int GetNetnameLayer( int aLayer )
inline bool IsNetnameLayer( LAYER_NUM aLayer )
{
return aLayer >= NETNAMES_GAL_LAYER( F_Cu ) &&
- aLayer < NETNAMES_GAL_LAYER( END_NETNAMES_VISIBLE_LIST );
+ aLayer < LAYER_ID_NETNAMES_END;
}
diff --git a/include/origin_viewitem.h b/include/origin_viewitem.h
index 1e55611..4cec850 100644
--- a/include/origin_viewitem.h
+++ b/include/origin_viewitem.h
@@ -54,7 +54,7 @@ public:
void ViewGetLayers( int aLayers[], int& aCount ) const override
{
- aLayers[0] = ITEM_GAL_LAYER( GP_OVERLAY );
+ aLayers[0] = LAYER_GP_OVERLAY;
aCount = 1;
}
diff --git a/include/painter.h b/include/painter.h
index 3d52b86..4f0df3d 100644
--- a/include/painter.h
+++ b/include/painter.h
@@ -231,16 +231,16 @@ protected:
std::set<unsigned int> m_activeLayers; ///< Stores active layers number
///> Colors for all layers (normal)
- COLOR4D m_layerColors[TOTAL_LAYER_COUNT];
+ COLOR4D m_layerColors[LAYER_ID_COUNT];
///> Colors for all layers (highlighted)
- COLOR4D m_layerColorsHi[TOTAL_LAYER_COUNT];
+ COLOR4D m_layerColorsHi[LAYER_ID_COUNT];
///> Colors for all layers (selected)
- COLOR4D m_layerColorsSel[TOTAL_LAYER_COUNT];
+ COLOR4D m_layerColorsSel[LAYER_ID_COUNT];
///> Colors for all layers (darkened)
- COLOR4D m_layerColorsDark[TOTAL_LAYER_COUNT];
+ COLOR4D m_layerColorsDark[LAYER_ID_COUNT];
/// Parameters for display modes
bool m_hiContrastEnabled; ///< High contrast display mode on/off
diff --git a/include/preview_items/bright_box.h b/include/preview_items/bright_box.h
index bb2ec9c..2af9bee 100644
--- a/include/preview_items/bright_box.h
+++ b/include/preview_items/bright_box.h
@@ -58,7 +58,7 @@ public:
void ViewGetLayers( int aLayers[], int& aCount ) const override
{
- aLayers[0] = ITEM_GAL_LAYER( GP_OVERLAY );
+ aLayers[0] = LAYER_GP_OVERLAY ;
aCount = 1;
}
diff --git a/include/preview_items/selection_area.h b/include/preview_items/selection_area.h
index 9c274c8..c860ee4 100644
--- a/include/preview_items/selection_area.h
+++ b/include/preview_items/selection_area.h
@@ -46,6 +46,7 @@ namespace PREVIEW
class SELECTION_AREA : public SIMPLE_OVERLAY_ITEM
{
public:
+ static const int SelectionLayer = LAYER_GP_OVERLAY;
SELECTION_AREA();
diff --git a/include/preview_items/simple_overlay_item.h b/include/preview_items/simple_overlay_item.h
index b2d673d..37f3581 100644
--- a/include/preview_items/simple_overlay_item.h
+++ b/include/preview_items/simple_overlay_item.h
@@ -26,6 +26,7 @@
#include <base_struct.h>
+#include <layers_id_colors_and_visibility.h>
#include <gal/color4d.h>
namespace KIGFX
diff --git a/include/view/view.h b/include/view/view.h
index 108b2df..6f436fb 100644
--- a/include/view/view.h
+++ b/include/view/view.h
@@ -637,7 +637,8 @@ public:
m_useDrawPriority = aFlag;
}
- static const int VIEW_MAX_LAYERS = 256; ///< maximum number of layers that may be shown
+ static const int VIEW_MAX_LAYERS = 512; ///< maximum number of layers that may be shown
+
private:
struct VIEW_LAYER
diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h
index b6c0766..7754b8b 100644
--- a/include/wxPcbStruct.h
+++ b/include/wxPcbStruct.h
@@ -614,7 +614,7 @@ public:
* inline function.
* @param aElement is from the enum by the same name
* @return bool - true if the element is visible.
- * @see enum PCB_VISIBLE
+ * @see enum LAYER_ID
*/
bool IsElementVisible( int aElement ) const;
@@ -623,7 +623,7 @@ public:
* changes the visibility of an element category
* @param aElement is from the enum by the same name
* @param aNewState = The new visibility state of the element category
- * @see enum PCB_VISIBLE
+ * @see enum LAYER_ID
*/
void SetElementVisibility( int aElement, bool aNewState );
diff --git a/pcbnew/autorouter/move_and_route_event_functions.cpp b/pcbnew/autorouter/move_and_route_event_functions.cpp
index 90aad41..6adf7cc 100644
--- a/pcbnew/autorouter/move_and_route_event_functions.cpp
+++ b/pcbnew/autorouter/move_and_route_event_functions.cpp
@@ -105,7 +105,7 @@ void PCB_EDIT_FRAME::OnPlaceOrRouteFootprints( wxCommandEvent& event )
}
// Erase ratsnest if needed
- if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) )
+ if( GetBoard()->IsElementVisible( LAYER_RATSNEST ) )
DrawGeneralRatsnest( &dc );
GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST;
diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp
index d192bb2..7da791a 100644
--- a/pcbnew/basepcbframe.cpp
+++ b/pcbnew/basepcbframe.cpp
@@ -595,15 +595,15 @@ GENERAL_COLLECTORS_GUIDE PCB_BASE_FRAME::GetCollectorsGuide()
GetActiveLayer() );
// account for the globals
- guide.SetIgnoreMTextsMarkedNoShow( ! m_Pcb->IsElementVisible( MOD_TEXT_INVISIBLE ));
- guide.SetIgnoreMTextsOnBack( ! m_Pcb->IsElementVisible( MOD_TEXT_BK_VISIBLE ));
- guide.SetIgnoreMTextsOnFront( ! m_Pcb->IsElementVisible( MOD_TEXT_FR_VISIBLE ));
- guide.SetIgnoreModulesOnBack( ! m_Pcb->IsElementVisible( MOD_BK_VISIBLE ) );
- guide.SetIgnoreModulesOnFront( ! m_Pcb->IsElementVisible( MOD_FR_VISIBLE ) );
- guide.SetIgnorePadsOnBack( ! m_Pcb->IsElementVisible( PAD_BK_VISIBLE ) );
- guide.SetIgnorePadsOnFront( ! m_Pcb->IsElementVisible( PAD_FR_VISIBLE ) );
- guide.SetIgnoreModulesVals( ! m_Pcb->IsElementVisible( MOD_VALUES_VISIBLE ) );
- guide.SetIgnoreModulesRefs( ! m_Pcb->IsElementVisible( MOD_REFERENCES_VISIBLE ) );
+ guide.SetIgnoreMTextsMarkedNoShow( ! m_Pcb->IsElementVisible( LAYER_MOD_TEXT_INVISIBLE ) );
+ guide.SetIgnoreMTextsOnBack( ! m_Pcb->IsElementVisible( LAYER_MOD_TEXT_BK ) );
+ guide.SetIgnoreMTextsOnFront( ! m_Pcb->IsElementVisible( LAYER_MOD_TEXT_FR ) );
+ guide.SetIgnoreModulesOnBack( ! m_Pcb->IsElementVisible( LAYER_MOD_BK ) );
+ guide.SetIgnoreModulesOnFront( ! m_Pcb->IsElementVisible( LAYER_MOD_FR ) );
+ guide.SetIgnorePadsOnBack( ! m_Pcb->IsElementVisible( LAYER_PAD_BK ) );
+ guide.SetIgnorePadsOnFront( ! m_Pcb->IsElementVisible( LAYER_PAD_FR ) );
+ guide.SetIgnoreModulesVals( ! m_Pcb->IsElementVisible( LAYER_MOD_VALUES ) );
+ guide.SetIgnoreModulesRefs( ! m_Pcb->IsElementVisible( LAYER_MOD_REFERENCES ) );
return guide;
}
diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp
index f32c0bf..551d91f 100644
--- a/pcbnew/class_board.cpp
+++ b/pcbnew/class_board.cpp
@@ -84,7 +84,7 @@ BOARD::BOARD() :
BuildListOfNets(); // prepare pad and netlist containers.
- for( LAYER_NUM layer = 0; layer < LAYER_ID_COUNT; ++layer )
+ for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
{
m_Layer[layer].m_name = GetStandardLayerName( ToLAYER_ID( layer ) );
@@ -520,7 +520,7 @@ const LAYER_ID BOARD::GetLayerID( const wxString& aLayerName ) const
{
// Look for the BOARD specific copper layer names
- for( LAYER_NUM layer = 0; layer < LAYER_ID_COUNT; ++layer )
+ for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
{
if ( IsCopperLayer( layer ) && ( m_Layer[ layer ].m_name == aLayerName ) )
{
@@ -529,7 +529,7 @@ const LAYER_ID BOARD::GetLayerID( const wxString& aLayerName ) const
}
// Otherwise fall back to the system standard layer names
- for( LAYER_NUM layer = 0; layer < LAYER_ID_COUNT; ++layer )
+ for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
{
if( GetStandardLayerName( ToLAYER_ID( layer ) ) == aLayerName )
{
@@ -717,7 +717,7 @@ void BOARD::SetVisibleElements( int aMask )
// Call SetElementVisibility for each item
// to ensure specific calculations that can be needed by some items,
// just changing the visibility flags could be not sufficient.
- for( int ii = 0; ii < PCB_VISIBLE( END_PCB_VISIBLE_LIST ); ii++ )
+ for( int ii = 0; ii < PCB_LAYER_INDEX( LAYER_ID_PCB_GAL_END ); ii++ )
{
int item_mask = 1 << ii;
SetElementVisibility( ii, aMask & item_mask );
@@ -731,7 +731,7 @@ void BOARD::SetVisibleAlls()
// Call SetElementVisibility for each item,
// to ensure specific calculations that can be needed by some items
- for( int ii = 0; ii < PCB_VISIBLE(END_PCB_VISIBLE_LIST); ii++ )
+ for( int ii = 0; ii < PCB_LAYER_INDEX( LAYER_ID_PCB_GAL_END ); ii++ )
SetElementVisibility( ii, true );
}
@@ -742,24 +742,24 @@ int BOARD::GetVisibleElements() const
}
-bool BOARD::IsElementVisible( int aPCB_VISIBLE ) const
+bool BOARD::IsElementVisible( int LAYER_aPCB ) const
{
- return m_designSettings.IsElementVisible( aPCB_VISIBLE );
+ return m_designSettings.IsElementVisible( LAYER_aPCB );
}
-void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled )
+void BOARD::SetElementVisibility( int LAYER_aPCB, bool isEnabled )
{
- m_designSettings.SetElementVisibility( aPCB_VISIBLE, isEnabled );
+ m_designSettings.SetElementVisibility( LAYER_aPCB, isEnabled );
- switch( aPCB_VISIBLE )
+ switch( LAYER_aPCB )
{
- case RATSNEST_VISIBLE:
+ case LAYER_RATSNEST:
// we must clear or set the CH_VISIBLE flags to hide/show ratsnest
// because we have a tool to show/hide ratsnest relative to a pad or a module
// so the hide/show option is a per item selection
- if( IsElementVisible( RATSNEST_VISIBLE ) )
+ if( IsElementVisible( LAYER_RATSNEST ) )
{
for( unsigned ii = 0; ii < GetRatsnestsCount(); ii++ )
m_FullRatsnest[ii].m_Status |= CH_VISIBLE;
@@ -777,56 +777,56 @@ void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled )
}
-COLOR4D BOARD::GetVisibleElementColor( int aPCB_VISIBLE )
+COLOR4D BOARD::GetVisibleElementColor( int aLayerId )
{
COLOR4D color = COLOR4D::UNSPECIFIED;
- switch( aPCB_VISIBLE )
- {
- case NON_PLATED_VISIBLE:
- case VIA_THROUGH_VISIBLE:
- case VIA_MICROVIA_VISIBLE:
- case VIA_BBLIND_VISIBLE:
- case MOD_TEXT_FR_VISIBLE:
- case MOD_TEXT_BK_VISIBLE:
- case MOD_TEXT_INVISIBLE:
- case ANCHOR_VISIBLE:
- case PAD_FR_VISIBLE:
- case PAD_BK_VISIBLE:
- case RATSNEST_VISIBLE:
- case GRID_VISIBLE:
- color = GetColorsSettings()->GetItemColor( aPCB_VISIBLE );
+ switch( aLayerId )
+ {
+ case LAYER_NON_PLATED:
+ case LAYER_VIA_THROUGH:
+ case LAYER_VIA_MICROVIA:
+ case LAYER_VIA_BBLIND:
+ case LAYER_MOD_TEXT_FR:
+ case LAYER_MOD_TEXT_BK:
+ case LAYER_MOD_TEXT_INVISIBLE:
+ case LAYER_ANCHOR:
+ case LAYER_PAD_FR:
+ case LAYER_PAD_BK:
+ case LAYER_RATSNEST:
+ case LAYER_GRID:
+ color = GetColorsSettings()->GetItemColor( aLayerId );
break;
default:
- wxLogDebug( wxT( "BOARD::GetVisibleElementColor(): bad arg %d" ), aPCB_VISIBLE );
+ wxLogDebug( wxT( "BOARD::GetVisibleElementColor(): bad arg %d" ), aLayerId );
}
return color;
}
-void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, COLOR4D aColor )
+void BOARD::SetVisibleElementColor( int aLayerId, COLOR4D aColor )
{
- switch( aPCB_VISIBLE )
+ switch( aLayerId )
{
- case NON_PLATED_VISIBLE:
- case VIA_THROUGH_VISIBLE:
- case VIA_MICROVIA_VISIBLE:
- case VIA_BBLIND_VISIBLE:
- case MOD_TEXT_FR_VISIBLE:
- case MOD_TEXT_BK_VISIBLE:
- case MOD_TEXT_INVISIBLE:
- case ANCHOR_VISIBLE:
- case PAD_FR_VISIBLE:
- case PAD_BK_VISIBLE:
- case GRID_VISIBLE:
- case RATSNEST_VISIBLE:
- GetColorsSettings()->SetItemColor( aPCB_VISIBLE, aColor );
+ case LAYER_NON_PLATED:
+ case LAYER_VIA_THROUGH:
+ case LAYER_VIA_MICROVIA:
+ case LAYER_VIA_BBLIND:
+ case LAYER_MOD_TEXT_FR:
+ case LAYER_MOD_TEXT_BK:
+ case LAYER_MOD_TEXT_INVISIBLE:
+ case LAYER_ANCHOR:
+ case LAYER_PAD_FR:
+ case LAYER_PAD_BK:
+ case LAYER_GRID:
+ case LAYER_RATSNEST:
+ GetColorsSettings()->SetItemColor( aLayerId, aColor );
break;
default:
- wxLogDebug( wxT( "BOARD::SetVisibleElementColor(): bad arg %d" ), aPCB_VISIBLE );
+ wxLogDebug( wxT( "BOARD::SetVisibleElementColor(): bad arg %d" ), aLayerId );
}
}
@@ -848,10 +848,10 @@ bool BOARD::IsModuleLayerVisible( LAYER_ID layer )
switch( layer )
{
case F_Cu:
- return IsElementVisible( PCB_VISIBLE(MOD_FR_VISIBLE) );
+ return IsElementVisible( LAYER_MOD_FR );
case B_Cu:
- return IsElementVisible( PCB_VISIBLE(MOD_BK_VISIBLE) );
+ return IsElementVisible( LAYER_MOD_BK );
default:
wxFAIL_MSG( wxT( "BOARD::IsModuleLayerVisible() param error: bad layer" ) );
diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h
index bff0513..92bb6f2 100644
--- a/pcbnew/class_board.h
+++ b/pcbnew/class_board.h
@@ -177,7 +177,7 @@ private:
/// edge zone descriptors, owned by pointer.
ZONE_CONTAINERS m_ZoneDescriptorList;
- LAYER m_Layer[LAYER_ID_COUNT];
+ LAYER m_Layer[PCB_LAYER_ID_COUNT];
// if true m_highLight_NetCode is used
HIGH_LIGHT_INFO m_highLight; // current high light data
@@ -458,15 +458,15 @@ public:
*/
void SetVisibleLayers( LSET aLayerMask );
- // these 2 functions are not tidy at this time, since there are PCB_VISIBLEs that
+ // these 2 functions are not tidy at this time, since there are LAYER_IDs that
// are not stored in the bitmap.
/**
* Function GetVisibleElements
* is a proxy function that calls the correspondent function in m_BoardSettings
* returns a bit-mask of all the element categories that are visible
- * @return int - the visible element bitmap or-ed from enum PCB_VISIBLE
- * @see enum PCB_VISIBLE
+ * @return int - the visible element bitmap or-ed from enum LAYER_ID
+ * @see enum LAYER_ID
*/
int GetVisibleElements() const;
@@ -474,15 +474,15 @@ public:
* Function SetVisibleElements
* is a proxy function that calls the correspondent function in m_BoardSettings
* changes the bit-mask of visible element categories
- * @param aMask = The new bit-mask of visible element bitmap or-ed from enum PCB_VISIBLE
- * @see enum PCB_VISIBLE
+ * @param aMask = The new bit-mask of visible element bitmap or-ed from enum LAYER_ID
+ * @see enum LAYER_ID
*/
void SetVisibleElements( int aMask );
/**
* Function SetVisibleAlls
* changes the bit-mask of visible element categories and layers
- * @see enum PCB_VISIBLE
+ * @see enum LAYER_ID
*/
void SetVisibleAlls();
@@ -490,20 +490,20 @@ public:
* Function IsElementVisible
* tests whether a given element category is visible. Keep this as an
* inline function.
- * @param aPCB_VISIBLE is from the enum by the same name
+ * @param LAYER_aPCB is from the enum by the same name
* @return bool - true if the element is visible.
- * @see enum PCB_VISIBLE
+ * @see enum LAYER_ID
*/
- bool IsElementVisible( int aPCB_VISIBLE ) const;
+ bool IsElementVisible( int LAYER_aPCB ) const;
/**
* Function SetElementVisibility
* changes the visibility of an element category
- * @param aPCB_VISIBLE is from the enum by the same name
+ * @param LAYER_aPCB is from the enum by the same name
* @param aNewState = The new visibility state of the element category
- * @see enum PCB_VISIBLE
+ * @see enum LAYER_ID
*/
- void SetElementVisibility( int aPCB_VISIBLE, bool aNewState );
+ void SetElementVisibility( int LAYER_aPCB, bool aNewState );
/**
* Function IsModuleLayerVisible
@@ -517,11 +517,11 @@ public:
/**
* Function GetVisibleElementColor
* returns the color of a pcb visible element.
- * @see enum PCB_VISIBLE
+ * @see enum LAYER_ID
*/
- COLOR4D GetVisibleElementColor( int aPCB_VISIBLE );
+ COLOR4D GetVisibleElementColor( int LAYER_aPCB );
- void SetVisibleElementColor( int aPCB_VISIBLE, COLOR4D aColor );
+ void SetVisibleElementColor( int LAYER_aPCB, COLOR4D aColor );
/**
* Function GetDesignSettings
diff --git a/pcbnew/class_board_design_settings.cpp b/pcbnew/class_board_design_settings.cpp
index d53a208..0941ed9 100644
--- a/pcbnew/class_board_design_settings.cpp
+++ b/pcbnew/class_board_design_settings.cpp
@@ -47,7 +47,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
SetVisibleLayers( all_set );
// set all but hidden text as visible.
- m_visibleElements = ~( 1 << MOD_TEXT_INVISIBLE );
+ m_visibleElements = ~( 1 << PCB_LAYER_INDEX( LAYER_MOD_TEXT_INVISIBLE ) );
SetCopperLayerCount( 2 ); // Default design is a double sided board
@@ -333,13 +333,13 @@ void BOARD_DESIGN_SETTINGS::SetLayerVisibility( LAYER_ID aLayer, bool aNewState
void BOARD_DESIGN_SETTINGS::SetElementVisibility( int aElementCategory, bool aNewState )
{
- if( aElementCategory < 0 || aElementCategory >= END_PCB_VISIBLE_LIST )
+ if( aElementCategory <= LAYER_ID_GAL_START || aElementCategory >= LAYER_ID_GAL_END )
return;
if( aNewState )
- m_visibleElements |= 1 << aElementCategory;
+ m_visibleElements |= 1 << PCB_LAYER_INDEX( aElementCategory );
else
- m_visibleElements &= ~( 1 << aElementCategory );
+ m_visibleElements &= ~( 1 << PCB_LAYER_INDEX( aElementCategory ) );
}
@@ -389,7 +389,7 @@ struct list_size_check {
{
// Int (the type used for saving visibility settings) is only 32 bits guaranteed,
// be sure that we do not cross the limit
- assert( END_PCB_VISIBLE_LIST <= 32 );
+ assert( PCB_LAYER_INDEX( LAYER_ID_PCB_GAL_END ) <= 32 );
};
};
static list_size_check check;
diff --git a/pcbnew/class_marker_pcb.cpp b/pcbnew/class_marker_pcb.cpp
index 6c3f583..ae25e05 100644
--- a/pcbnew/class_marker_pcb.cpp
+++ b/pcbnew/class_marker_pcb.cpp
@@ -147,7 +147,7 @@ BITMAP_DEF MARKER_PCB::GetMenuImage() const
void MARKER_PCB::ViewGetLayers( int aLayers[], int& aCount ) const
{
aCount = 1;
- aLayers[0] = ITEM_GAL_LAYER( DRC_VISIBLE );
+ aLayers[0] = LAYER_DRC;
}
const EDA_RECT MARKER_PCB::GetBoundingBox() const
diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp
index 07b9923..39bddb2 100644
--- a/pcbnew/class_module.cpp
+++ b/pcbnew/class_module.cpp
@@ -238,11 +238,11 @@ void MODULE::DrawAncre( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
{
GRSetDrawMode( DC, draw_mode );
- if( GetBoard()->IsElementVisible( ANCHOR_VISIBLE ) )
+ if( GetBoard()->IsElementVisible( LAYER_ANCHOR ) )
{
GRDrawAnchor( panel->GetClipBox(), DC, m_Pos.x, m_Pos.y,
dim_ancre,
- g_ColorsSettings.GetItemColor( ANCHOR_VISIBLE ) );
+ g_ColorsSettings.GetItemColor( LAYER_ANCHOR ) );
}
}
@@ -403,13 +403,13 @@ void MODULE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
DrawAncre( aPanel, aDC, aOffset, DIM_ANCRE_MODULE, aDrawMode );
// Draw graphic items
- if( brd->IsElementVisible( MOD_REFERENCES_VISIBLE ) )
+ if( brd->IsElementVisible( LAYER_MOD_REFERENCES ) )
{
if( !(m_Reference->IsMoving()) )
m_Reference->Draw( aPanel, aDC, aDrawMode, aOffset );
}
- if( brd->IsElementVisible( MOD_VALUES_VISIBLE ) )
+ if( brd->IsElementVisible( LAYER_MOD_VALUES ) )
{
if( !(m_Value->IsMoving()) )
m_Value->Draw( aPanel, aDC, aDrawMode, aOffset );
@@ -836,7 +836,7 @@ void MODULE::RunOnChildren( std::function<void (BOARD_ITEM*)> aFunction )
void MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
{
aCount = 2;
- aLayers[0] = ITEM_GAL_LAYER( ANCHOR_VISIBLE );
+ aLayers[0] = LAYER_ANCHOR;
switch( m_Layer )
{
@@ -845,11 +845,11 @@ void MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
wxASSERT_MSG( false, "Illegal layer" ); // do you really have modules placed on other layers?
// pass through
case F_Cu:
- aLayers[1] = ITEM_GAL_LAYER( MOD_FR_VISIBLE );
+ aLayers[1] = LAYER_MOD_FR;
break;
case B_Cu:
- aLayers[1] = ITEM_GAL_LAYER( MOD_BK_VISIBLE );
+ aLayers[1] = LAYER_MOD_BK;
break;
}
}
@@ -857,11 +857,11 @@ void MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
unsigned int MODULE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
{
- int layer = ( m_Layer == F_Cu ) ? MOD_FR_VISIBLE :
- ( m_Layer == B_Cu ) ? MOD_BK_VISIBLE : ANCHOR_VISIBLE;
+ int layer = ( m_Layer == F_Cu ) ? LAYER_MOD_FR :
+ ( m_Layer == B_Cu ) ? LAYER_MOD_BK : LAYER_ANCHOR;
// Currently it is only for anchor layer
- if( aView->IsLayerVisible( ITEM_GAL_LAYER( layer ) ) )
+ if( aView->IsLayerVisible( layer ) )
return 30;
return std::numeric_limits<unsigned int>::max();
diff --git a/pcbnew/class_netinfo_item.cpp b/pcbnew/class_netinfo_item.cpp
index 53cfe66..8566083 100644
--- a/pcbnew/class_netinfo_item.cpp
+++ b/pcbnew/class_netinfo_item.cpp
@@ -174,7 +174,7 @@ void RATSNEST_ITEM::Draw( EDA_DRAW_PANEL* panel,
{
GRSetDrawMode( DC, aDrawMode );
- COLOR4D color = g_ColorsSettings.GetItemColor(RATSNEST_VISIBLE);
+ COLOR4D color = g_ColorsSettings.GetItemColor( LAYER_RATSNEST );
GRLine( panel->GetClipBox(), DC,
m_PadStart->GetPosition() - aOffset,
diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp
index 7b50e45..903fe19 100644
--- a/pcbnew/class_pad.cpp
+++ b/pcbnew/class_pad.cpp
@@ -931,23 +931,23 @@ void D_PAD::ViewGetLayers( int aLayers[], int& aCount ) const
// These types of pads contain a hole
if( m_Attribute == PAD_ATTRIB_STANDARD || m_Attribute == PAD_ATTRIB_HOLE_NOT_PLATED )
- aLayers[aCount++] = ITEM_GAL_LAYER( PADS_HOLES_VISIBLE );
+ aLayers[aCount++] = LAYER_PADS_HOLES;
if( IsOnLayer( F_Cu ) && IsOnLayer( B_Cu ) )
{
// Multi layer pad
- aLayers[aCount++] = ITEM_GAL_LAYER( PADS_VISIBLE );
- aLayers[aCount++] = NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE );
+ aLayers[aCount++] = LAYER_PADS;
+ aLayers[aCount++] = LAYER_PADS_NETNAMES;
}
else if( IsOnLayer( F_Cu ) )
{
- aLayers[aCount++] = ITEM_GAL_LAYER( PAD_FR_VISIBLE );
- aLayers[aCount++] = NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE );
+ aLayers[aCount++] = LAYER_PAD_FR;
+ aLayers[aCount++] = LAYER_PAD_FR_NETNAMES;
}
else if( IsOnLayer( B_Cu ) )
{
- aLayers[aCount++] = ITEM_GAL_LAYER( PAD_BK_VISIBLE );
- aLayers[aCount++] = NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE );
+ aLayers[aCount++] = LAYER_PAD_BK;
+ aLayers[aCount++] = LAYER_PAD_BK_NETNAMES;
}
// Check non-copper layers. This list should include all the layers that the
diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp
index 86fba2b..d16ffc4 100644
--- a/pcbnew/class_pad_draw_functions.cpp
+++ b/pcbnew/class_pad_draw_functions.cpp
@@ -102,8 +102,8 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
*/
BOARD* brd = GetBoard();
- bool frontVisible = brd->IsElementVisible( PCB_VISIBLE( PAD_FR_VISIBLE ) );
- bool backVisible = brd->IsElementVisible( PCB_VISIBLE( PAD_BK_VISIBLE ) );
+ bool frontVisible = brd->IsElementVisible( LAYER_PAD_FR );
+ bool backVisible = brd->IsElementVisible( LAYER_PAD_BK );
if( !frontVisible && !backVisible )
return;
@@ -134,12 +134,12 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
if( m_layerMask[F_Cu] )
{
- color = brd->GetVisibleElementColor( PAD_FR_VISIBLE );
+ color = brd->GetVisibleElementColor( LAYER_PAD_FR );
}
if( m_layerMask[B_Cu] )
{
- color = color.LegacyMix( brd->GetVisibleElementColor( PAD_BK_VISIBLE ) );
+ color = color.LegacyMix( brd->GetVisibleElementColor( LAYER_PAD_BK ) );
}
if( color == BLACK ) // Not on a visible copper layer (i.e. still nothing to show)
@@ -273,17 +273,17 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
DisplayIsol = false;
if( ( GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED ) &&
- brd->IsElementVisible( NON_PLATED_VISIBLE ) )
+ brd->IsElementVisible( LAYER_NON_PLATED ) )
{
drawInfo.m_ShowNotPlatedHole = true;
- drawInfo.m_NPHoleColor = brd->GetVisibleElementColor( NON_PLATED_VISIBLE );
+ drawInfo.m_NPHoleColor = brd->GetVisibleElementColor( LAYER_NON_PLATED );
}
drawInfo.m_DrawMode = aDraw_mode;
drawInfo.m_Color = color;
drawInfo.m_DrawPanel = aPanel;
drawInfo.m_Mask_margin = mask_margin;
- drawInfo.m_ShowNCMark = brd->IsElementVisible( PCB_VISIBLE( NO_CONNECTS_VISIBLE ) );
+ drawInfo.m_ShowNCMark = brd->IsElementVisible( LAYER_NO_CONNECTS );
drawInfo.m_IsPrinting = screen->m_IsPrinting;
color.a = 0.666;
diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp
index b9ada86..c90d9b6 100644
--- a/pcbnew/class_pcb_layer_widget.cpp
+++ b/pcbnew/class_pcb_layer_widget.cpp
@@ -37,7 +37,7 @@
#include <confirm.h>
#include <wxPcbStruct.h>
-#include <pcbstruct.h> // enum PCB_VISIBLE
+#include <pcbstruct.h>
#include <layer_widget.h>
#include <macros.h>
#include <menus_helpers.h>
@@ -58,32 +58,32 @@ const LAYER_WIDGET::ROW PCB_LAYER_WIDGET::s_render_rows[] = {
#define RR LAYER_WIDGET::ROW // Render Row abbreviation to reduce source width
// text id color tooltip
- RR( _( "Through Via" ), VIA_THROUGH_VISIBLE, WHITE, _( "Show through vias" ) ),
- RR( _( "Bl/Buried Via" ), VIA_BBLIND_VISIBLE, WHITE, _( "Show blind or buried vias" ) ),
- RR( _( "Micro Via" ), VIA_MICROVIA_VISIBLE, WHITE, _( "Show micro vias") ),
- RR( _( "Non Plated" ), NON_PLATED_VISIBLE, WHITE, _( "Show non plated holes") ),
- RR( _( "Ratsnest" ), RATSNEST_VISIBLE, WHITE, _( "Show unconnected nets as a ratsnest") ),
-
- RR( _( "Pads Front" ), PAD_FR_VISIBLE, WHITE, _( "Show footprint pads on board's front" ) ),
- RR( _( "Pads Back" ), PAD_BK_VISIBLE, WHITE, _( "Show footprint pads on board's back" ) ),
-
- RR( _( "Text Front" ), MOD_TEXT_FR_VISIBLE, COLOR4D::UNSPECIFIED, _( "Show footprint text on board's front" ) ),
- RR( _( "Text Back" ), MOD_TEXT_BK_VISIBLE, COLOR4D::UNSPECIFIED, _( "Show footprint text on board's back" ) ),
- RR( _( "Hidden Text" ), MOD_TEXT_INVISIBLE, WHITE, _( "Show footprint text marked as invisible" ) ),
-
- RR( _( "Anchors" ), ANCHOR_VISIBLE, WHITE, _( "Show footprint and text origins as a cross" ) ),
- RR( _( "Grid" ), GRID_VISIBLE, WHITE, _( "Show the (x,y) grid dots" ) ),
- RR( _( "No-Connects" ), NO_CONNECTS_VISIBLE, COLOR4D::UNSPECIFIED, _( "Show a marker on pads which have no net connected" ) ),
- RR( _( "Footprints Front" ), MOD_FR_VISIBLE, COLOR4D::UNSPECIFIED, _( "Show footprints that are on board's front") ),
- RR( _( "Footprints Back" ), MOD_BK_VISIBLE, COLOR4D::UNSPECIFIED, _( "Show footprints that are on board's back") ),
- RR( _( "Values" ), MOD_VALUES_VISIBLE, COLOR4D::UNSPECIFIED, _( "Show footprint's values") ),
- RR( _( "References" ), MOD_REFERENCES_VISIBLE, COLOR4D::UNSPECIFIED, _( "Show footprint's references") ),
+ RR( _( "Through Via" ), LAYER_VIA_THROUGH, WHITE, _( "Show through vias" ) ),
+ RR( _( "Bl/Buried Via" ), LAYER_VIA_BBLIND, WHITE, _( "Show blind or buried vias" ) ),
+ RR( _( "Micro Via" ), LAYER_VIA_MICROVIA, WHITE, _( "Show micro vias") ),
+ RR( _( "Non Plated" ), LAYER_NON_PLATED, WHITE, _( "Show non plated holes") ),
+ RR( _( "Ratsnest" ), LAYER_RATSNEST, WHITE, _( "Show unconnected nets as a ratsnest") ),
+
+ RR( _( "Pads Front" ), LAYER_PAD_FR, WHITE, _( "Show footprint pads on board's front" ) ),
+ RR( _( "Pads Back" ), LAYER_PAD_BK, WHITE, _( "Show footprint pads on board's back" ) ),
+
+ RR( _( "Text Front" ), LAYER_MOD_TEXT_FR, COLOR4D::UNSPECIFIED, _( "Show footprint text on board's front" ) ),
+ RR( _( "Text Back" ), LAYER_MOD_TEXT_BK, COLOR4D::UNSPECIFIED, _( "Show footprint text on board's back" ) ),
+ RR( _( "Hidden Text" ), LAYER_MOD_TEXT_INVISIBLE, WHITE, _( "Show footprint text marked as invisible" ) ),
+
+ RR( _( "Anchors" ), LAYER_ANCHOR, WHITE, _( "Show footprint and text origins as a cross" ) ),
+ RR( _( "Grid" ), LAYER_GRID, WHITE, _( "Show the (x,y) grid dots" ) ),
+ RR( _( "No-Connects" ), LAYER_NO_CONNECTS, COLOR4D::UNSPECIFIED, _( "Show a marker on pads which have no net connected" ) ),
+ RR( _( "Footprints Front" ),LAYER_MOD_FR, COLOR4D::UNSPECIFIED, _( "Show footprints that are on board's front") ),
+ RR( _( "Footprints Back" ), LAYER_MOD_BK, COLOR4D::UNSPECIFIED, _( "Show footprints that are on board's back") ),
+ RR( _( "Values" ), LAYER_MOD_VALUES, COLOR4D::UNSPECIFIED, _( "Show footprint's values") ),
+ RR( _( "References" ), LAYER_MOD_REFERENCES, COLOR4D::UNSPECIFIED, _( "Show footprint's references") ),
};
static int s_allowed_in_FpEditor[] =
{
- MOD_TEXT_INVISIBLE, PAD_FR_VISIBLE, PAD_BK_VISIBLE,
- GRID_VISIBLE, MOD_VALUES_VISIBLE, MOD_REFERENCES_VISIBLE
+ LAYER_MOD_TEXT_INVISIBLE, LAYER_PAD_FR, LAYER_PAD_BK,
+ LAYER_GRID, LAYER_MOD_VALUES, LAYER_MOD_REFERENCES
};
@@ -548,13 +548,13 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
if( galCanvas )
{
- if( aId == GRID_VISIBLE )
+ if( aId == LAYER_GRID )
{
galCanvas->GetGAL()->SetGridVisibility( myframe->IsGridVisible() );
galCanvas->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
}
else
- galCanvas->GetView()->SetLayerVisible( ITEM_GAL_LAYER( aId ), isEnabled );
+ galCanvas->GetView()->SetLayerVisible( aId , isEnabled );
}
if( galCanvas && myframe->IsGalCanvasActive() )
diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp
index e7f7fec..8c10334 100644
--- a/pcbnew/class_pcb_text.cpp
+++ b/pcbnew/class_pcb_text.cpp
@@ -95,8 +95,8 @@ void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
COLOR4D anchor_color = COLOR4D::UNSPECIFIED;
- if( brd->IsElementVisible( ANCHOR_VISIBLE ) )
- anchor_color = brd->GetVisibleElementColor( ANCHOR_VISIBLE );
+ if( brd->IsElementVisible( LAYER_ANCHOR ) )
+ anchor_color = brd->GetVisibleElementColor( LAYER_ANCHOR );
EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
EDA_TEXT::Draw( clipbox, DC, offset, color,
diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp
index 460ce0a..44c95eb 100644
--- a/pcbnew/class_text_mod.cpp
+++ b/pcbnew/class_text_mod.cpp
@@ -227,18 +227,18 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMod
LAYER_ID text_layer = GetLayer();
if( !brd->IsLayerVisible( m_Layer )
- || (IsFrontLayer( text_layer ) && !brd->IsElementVisible( MOD_TEXT_FR_VISIBLE ))
- || (IsBackLayer( text_layer ) && !brd->IsElementVisible( MOD_TEXT_BK_VISIBLE )) )
+ || ( IsFrontLayer( text_layer ) && !brd->IsElementVisible( LAYER_MOD_TEXT_FR ) )
+ || ( IsBackLayer( text_layer ) && !brd->IsElementVisible( LAYER_MOD_TEXT_BK ) ) )
return;
- // Invisible texts are still drawn (not plotted) in MOD_TEXT_INVISIBLE
+ // Invisible texts are still drawn (not plotted) in LAYER_MOD_TEXT_INVISIBLE
// Just because we must have to edit them (at least to make them visible)
if( !IsVisible() )
{
- if( !brd->IsElementVisible( MOD_TEXT_INVISIBLE ) )
+ if( !brd->IsElementVisible( LAYER_MOD_TEXT_INVISIBLE ) )
return;
- color = brd->GetVisibleElementColor( MOD_TEXT_INVISIBLE );
+ color = brd->GetVisibleElementColor( LAYER_MOD_TEXT_INVISIBLE );
}
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)aPanel->GetDisplayOptions();
@@ -262,9 +262,9 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMod
wxPoint pos = GetTextPos() - aOffset;
// Draw the text anchor point
- if( brd->IsElementVisible( ANCHOR_VISIBLE ) )
+ if( brd->IsElementVisible( LAYER_ANCHOR ) )
{
- COLOR4D anchor_color = brd->GetVisibleElementColor(ANCHOR_VISIBLE);
+ COLOR4D anchor_color = brd->GetVisibleElementColor( LAYER_ANCHOR );
GRDrawAnchor( aPanel->GetClipBox(), aDC, pos.x, pos.y, DIM_ANCRE_TEXTE, anchor_color );
}
@@ -433,11 +433,11 @@ const BOX2I TEXTE_MODULE::ViewBBox() const
void TEXTE_MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
{
if( !IsVisible() ) // Hidden text
- aLayers[0] = ITEM_GAL_LAYER( MOD_TEXT_INVISIBLE );
+ aLayers[0] = LAYER_MOD_TEXT_INVISIBLE;
//else if( IsFrontLayer( m_Layer ) )
- //aLayers[0] = ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE );
+ //aLayers[0] = LAYER_MOD_TEXT_FR;
//else if( IsBackLayer( m_Layer ) )
- //aLayers[0] = ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE );
+ //aLayers[0] = LAYER_MOD_TEXT_BK;
else
aLayers[0] = GetLayer();
@@ -452,18 +452,18 @@ unsigned int TEXTE_MODULE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
if( !aView )
return 0;
- if( m_Type == TEXT_is_VALUE && !aView->IsLayerVisible( ITEM_GAL_LAYER( MOD_VALUES_VISIBLE ) ) )
+ if( m_Type == TEXT_is_VALUE && !aView->IsLayerVisible( LAYER_MOD_VALUES ) )
return MAX;
- if( m_Type == TEXT_is_REFERENCE && !aView->IsLayerVisible( ITEM_GAL_LAYER( MOD_REFERENCES_VISIBLE ) ) )
+ if( m_Type == TEXT_is_REFERENCE && !aView->IsLayerVisible( LAYER_MOD_REFERENCES ) )
return MAX;
- if( IsFrontLayer( m_Layer ) && ( !aView->IsLayerVisible( ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE ) ) ||
- !aView->IsLayerVisible( ITEM_GAL_LAYER( MOD_FR_VISIBLE ) ) ) )
+ if( IsFrontLayer( m_Layer ) && ( !aView->IsLayerVisible( LAYER_MOD_TEXT_FR ) ||
+ !aView->IsLayerVisible( LAYER_MOD_FR ) ) )
return MAX;
- if( IsBackLayer( m_Layer ) && ( !aView->IsLayerVisible( ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE ) ) ||
- !aView->IsLayerVisible( ITEM_GAL_LAYER( MOD_BK_VISIBLE ) ) ) )
+ if( IsBackLayer( m_Layer ) && ( !aView->IsLayerVisible( LAYER_MOD_TEXT_BK ) ||
+ !aView->IsLayerVisible( LAYER_MOD_BK ) ) )
return MAX;
return 0;
diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp
index 4e7774c..0dc53a9 100644
--- a/pcbnew/class_track.cpp
+++ b/pcbnew/class_track.cpp
@@ -796,9 +796,9 @@ void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, const w
GRSetDrawMode( aDC, aDrawMode );
BOARD * brd = GetBoard();
- COLOR4D color = brd->GetVisibleElementColor( VIAS_VISIBLE + GetViaType() );
+ COLOR4D color = brd->GetVisibleElementColor( LAYER_VIAS + GetViaType() );
- if( brd->IsElementVisible( PCB_VISIBLE(VIAS_VISIBLE + GetViaType()) ) == false
+ if( brd->IsElementVisible( LAYER_VIAS + GetViaType() ) == false
&& !( aDrawMode & GR_HIGHLIGHT ) )
return;
@@ -990,25 +990,25 @@ void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, const w
void VIA::ViewGetLayers( int aLayers[], int& aCount ) const
{
- aLayers[0] = ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE );
+ aLayers[0] = LAYER_VIAS_HOLES;
aCount = 2;
// Just show it on common via & via holes layers
switch( GetViaType() )
{
case VIA_THROUGH:
- aLayers[1] = ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE );
+ aLayers[1] = LAYER_VIA_THROUGH;
break;
case VIA_BLIND_BURIED:
- aLayers[1] = ITEM_GAL_LAYER( VIA_BBLIND_VISIBLE );
+ aLayers[1] = LAYER_VIA_BBLIND;
aLayers[2] = m_Layer;
aLayers[3] = m_BottomLayer;
aCount += 2;
break;
case VIA_MICROVIA:
- aLayers[1] = ITEM_GAL_LAYER( VIA_MICROVIA_VISIBLE );
+ aLayers[1] = LAYER_VIA_MICROVIA;
break;
default:
diff --git a/pcbnew/dialogs/dialog_SVG_print.cpp b/pcbnew/dialogs/dialog_SVG_print.cpp
index af39ad8..84d23bf 100644
--- a/pcbnew/dialogs/dialog_SVG_print.cpp
+++ b/pcbnew/dialogs/dialog_SVG_print.cpp
@@ -62,7 +62,7 @@ private:
LSET m_printMaskLayer;
// the list of existing board layers in wxCheckListBox, with the
// board layers id:
- std::pair<wxCheckListBox*, int> m_boxSelectLayer[LAYER_ID_COUNT];
+ std::pair<wxCheckListBox*, int> m_boxSelectLayer[PCB_LAYER_ID_COUNT];
bool m_printBW;
wxString m_outputDirectory;
bool m_printMirror;
diff --git a/pcbnew/dialogs/dialog_display_options.cpp b/pcbnew/dialogs/dialog_display_options.cpp
index 4333c56..526f08a 100644
--- a/pcbnew/dialogs/dialog_display_options.cpp
+++ b/pcbnew/dialogs/dialog_display_options.cpp
@@ -142,7 +142,7 @@ void DIALOG_DISPLAY_OPTIONS::init()
m_OptDisplayModOutlines->SetValue( displ_opts->m_DisplayModEdgeFill == SKETCH );
m_OptDisplayPadClearence->SetValue( displ_opts->m_DisplayPadIsol );
m_OptDisplayPadNumber->SetValue( displ_opts->m_DisplayPadNum );
- m_OptDisplayPadNoConn->SetValue( m_Parent->IsElementVisible( PCB_VISIBLE( NO_CONNECTS_VISIBLE ) ) );
+ m_OptDisplayPadNoConn->SetValue( m_Parent->IsElementVisible( LAYER_NO_CONNECTS ) );
m_OptDisplayDrawings->SetValue( displ_opts->m_DisplayDrawItemsFill == SKETCH );
m_ShowNetNamesOption->SetSelection( displ_opts->m_DisplayNetNamesMode );
@@ -189,7 +189,7 @@ void DIALOG_DISPLAY_OPTIONS::OnOkClick( wxCommandEvent& event )
displ_opts->m_DisplayPadNum = m_OptDisplayPadNumber->GetValue();
- m_Parent->SetElementVisibility( PCB_VISIBLE( NO_CONNECTS_VISIBLE ),
+ m_Parent->SetElementVisibility( LAYER_NO_CONNECTS,
m_OptDisplayPadNoConn->GetValue() );
displ_opts->m_DisplayDrawItemsFill = not m_OptDisplayDrawings->GetValue();
diff --git a/pcbnew/dialogs/dialog_exchange_modules.cpp b/pcbnew/dialogs/dialog_exchange_modules.cpp
index 8004e72..c411ef0 100644
--- a/pcbnew/dialogs/dialog_exchange_modules.cpp
+++ b/pcbnew/dialogs/dialog_exchange_modules.cpp
@@ -123,7 +123,7 @@ void DIALOG_EXCHANGE_MODULE::OnOkClick( wxCommandEvent& event )
if( result )
{
- if( m_parent->GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) )
+ if( m_parent->GetBoard()->IsElementVisible( LAYER_RATSNEST ) )
m_parent->Compile_Ratsnest( NULL, true );
m_parent->GetCanvas()->Refresh();
diff --git a/pcbnew/dialogs/dialog_general_options.cpp b/pcbnew/dialogs/dialog_general_options.cpp
index 8f2b0fb..4ecae6c 100644
--- a/pcbnew/dialogs/dialog_general_options.cpp
+++ b/pcbnew/dialogs/dialog_general_options.cpp
@@ -83,7 +83,7 @@ void DIALOG_GENERALOPTIONS::init()
m_MaxShowLinks->SetValue( displ_opts->m_MaxLinksShowed );
m_DrcOn->SetValue( g_Drc_On );
- m_ShowGlobalRatsnest->SetValue( m_Board->IsElementVisible( RATSNEST_VISIBLE ) );
+ m_ShowGlobalRatsnest->SetValue( m_Board->IsElementVisible( LAYER_RATSNEST ) );
m_TrackAutodel->SetValue( g_AutoDeleteOldTrack );
m_Track_45_Only_Ctrl->SetValue( g_Track_45_Only_Allowed );
m_Segments_45_Only_Ctrl->SetValue( g_Segments_45_Only );
@@ -124,9 +124,9 @@ void DIALOG_GENERALOPTIONS::OnOkClick( wxCommandEvent& event )
displ_opts->m_MaxLinksShowed = m_MaxShowLinks->GetValue();
g_Drc_On = m_DrcOn->GetValue();
- if( m_Board->IsElementVisible(RATSNEST_VISIBLE) != m_ShowGlobalRatsnest->GetValue() )
+ if( m_Board->IsElementVisible( LAYER_RATSNEST ) != m_ShowGlobalRatsnest->GetValue() )
{
- GetParent()->SetElementVisibility( RATSNEST_VISIBLE, m_ShowGlobalRatsnest->GetValue() );
+ GetParent()->SetElementVisibility( LAYER_RATSNEST, m_ShowGlobalRatsnest->GetValue() );
GetParent()->GetCanvas()->Refresh();
GetParent()->OnModify();
}
diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp
index 3e127b5..321cabe 100644
--- a/pcbnew/dialogs/dialog_pad_properties.cpp
+++ b/pcbnew/dialogs/dialog_pad_properties.cpp
@@ -171,12 +171,12 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
if( m_dummyPad->GetLayerSet()[F_Cu] )
{
- color = m_board->GetVisibleElementColor( PAD_FR_VISIBLE );
+ color = m_board->GetVisibleElementColor( LAYER_PAD_FR );
}
if( m_dummyPad->GetLayerSet()[B_Cu] )
{
- color = color.LegacyMix( m_board->GetVisibleElementColor( PAD_BK_VISIBLE ) );
+ color = color.LegacyMix( m_board->GetVisibleElementColor( LAYER_PAD_BK ) );
}
// What could happen: the pad color is *actually* black, or no
diff --git a/pcbnew/dialogs/dialog_print_using_printer.cpp b/pcbnew/dialogs/dialog_print_using_printer.cpp
index 93f1eb4..e8b0055 100644
--- a/pcbnew/dialogs/dialog_print_using_printer.cpp
+++ b/pcbnew/dialogs/dialog_print_using_printer.cpp
@@ -83,7 +83,7 @@ private:
wxConfigBase* m_config;
// the list of existing board layers in wxCheckListBox, with the
// board layers id:
- std::pair<wxCheckListBox*, int> m_boxSelectLayer[LAYER_ID_COUNT];
+ std::pair<wxCheckListBox*, int> m_boxSelectLayer[PCB_LAYER_ID_COUNT];
static bool m_ExcludeEdgeLayer;
void OnCloseWindow( wxCloseEvent& event ) override;
diff --git a/pcbnew/editrack-part2.cpp b/pcbnew/editrack-part2.cpp
index 0d114f1..9750f01 100644
--- a/pcbnew/editrack-part2.cpp
+++ b/pcbnew/editrack-part2.cpp
@@ -224,7 +224,7 @@ void PCB_EDIT_FRAME::Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC )
D_PAD* pt_pad = NULL;
MODULE* Module = NULL;
- if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) )
+ if( GetBoard()->IsElementVisible( LAYER_RATSNEST ) )
return;
if( ( GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK ) == 0 )
diff --git a/pcbnew/exporters/export_vrml.cpp b/pcbnew/exporters/export_vrml.cpp
index b09e1d6..2b12f05 100644
--- a/pcbnew/exporters/export_vrml.cpp
+++ b/pcbnew/exporters/export_vrml.cpp
@@ -140,7 +140,7 @@ static SGNODE* sgmaterial[VRML_COLOR_LAST] = { NULL };
class MODEL_VRML
{
private:
- double m_layer_z[LAYER_ID_COUNT];
+ double m_layer_z[PCB_LAYER_ID_COUNT];
int m_iMaxSeg; // max. sides to a small circle
double m_arcMinLen, m_arcMaxLen; // min and max lengths of an arc chord
diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp
index 4790a57..b6a1583 100644
--- a/pcbnew/files.cpp
+++ b/pcbnew/files.cpp
@@ -601,7 +601,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
// Update the RATSNEST items, which were not loaded at the time
// BOARD::SetVisibleElements() was called from within any PLUGIN.
- // See case RATSNEST_VISIBLE: in BOARD::SetElementVisibility()
+ // See case LAYER_RATSNEST: in BOARD::SetElementVisibility()
GetBoard()->SetVisibleElements( GetBoard()->GetVisibleElements() );
// Display the loaded board:
diff --git a/pcbnew/footprint_wizard_frame.cpp b/pcbnew/footprint_wizard_frame.cpp
index 0c025c1..3238903 100644
--- a/pcbnew/footprint_wizard_frame.cpp
+++ b/pcbnew/footprint_wizard_frame.cpp
@@ -146,7 +146,7 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway,
DISPLAY_OPTIONS* disp_opts = (DISPLAY_OPTIONS*) GetDisplayOptions();
disp_opts->m_DisplayPadIsol = false;
disp_opts->m_DisplayPadNum = true;
- GetBoard()->SetElementVisibility( PCB_VISIBLE(NO_CONNECTS_VISIBLE), false );
+ GetBoard()->SetElementVisibility( LAYER_NO_CONNECTS, false );
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
diff --git a/pcbnew/initpcb.cpp b/pcbnew/initpcb.cpp
index a614e84..11fe793 100644
--- a/pcbnew/initpcb.cpp
+++ b/pcbnew/initpcb.cpp
@@ -54,14 +54,14 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
// Items visibility flags will be set because a new board will be created.
// Grid and ratsnest can be left to their previous state
- bool showGrid = IsElementVisible( GRID_VISIBLE );
- bool showRats = IsElementVisible( RATSNEST_VISIBLE );
+ bool showGrid = IsElementVisible( LAYER_GRID );
+ bool showRats = IsElementVisible( LAYER_RATSNEST );
// delete the old BOARD and create a new BOARD so that the default
// layer names are put into the BOARD.
SetBoard( new BOARD() );
- SetElementVisibility( GRID_VISIBLE, showGrid );
- SetElementVisibility( RATSNEST_VISIBLE, showRats );
+ SetElementVisibility( LAYER_GRID, showGrid );
+ SetElementVisibility( LAYER_RATSNEST, showRats );
SetCurItem( NULL );
diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp
index eedff9e..6cac518 100644
--- a/pcbnew/kicad_plugin.cpp
+++ b/pcbnew/kicad_plugin.cpp
@@ -1211,7 +1211,7 @@ void PCB_IO::formatLayers( LSET aLayerMask, int aNestLevel ) const
wxString layerName;
- for( LAYER_NUM layer = 0; layer < LAYER_ID_COUNT; ++layer )
+ for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
{
if( aLayerMask[layer] )
{
diff --git a/pcbnew/modedit.cpp b/pcbnew/modedit.cpp
index ddf9681..37ab36e 100644
--- a/pcbnew/modedit.cpp
+++ b/pcbnew/modedit.cpp
@@ -976,7 +976,7 @@ void FOOTPRINT_EDIT_FRAME::OnVerticalToolbar( wxCommandEvent& aEvent )
COLOR4D FOOTPRINT_EDIT_FRAME::GetGridColor() const
{
- return g_ColorsSettings.GetItemColor( GRID_VISIBLE );
+ return g_ColorsSettings.GetItemColor( LAYER_GRID );
}
diff --git a/pcbnew/module_editor_frame.h b/pcbnew/module_editor_frame.h
index d89a701..7f51e55 100644
--- a/pcbnew/module_editor_frame.h
+++ b/pcbnew/module_editor_frame.h
@@ -417,7 +417,7 @@ public:
* inline function.
* @param aElement is from the enum by the same name
* @return bool - true if the element is visible.
- * @see enum PCB_VISIBLE
+ * @see enum LAYER_ID
*/
bool IsElementVisible( int aElement ) const;
@@ -426,7 +426,7 @@ public:
* changes the visibility of an element category
* @param aElement is from the enum by the same name
* @param aNewState = The new visibility state of the element category
- * @see enum PCB_VISIBLE
+ * @see enum LAYER_ID
*/
void SetElementVisibility( int aElement, bool aNewState );
diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp
index 2255d1f..4098e2a 100644
--- a/pcbnew/moduleframe.cpp
+++ b/pcbnew/moduleframe.cpp
@@ -818,13 +818,13 @@ void FOOTPRINT_EDIT_FRAME::updateView()
bool FOOTPRINT_EDIT_FRAME::IsGridVisible() const
{
- return IsElementVisible( GRID_VISIBLE );
+ return IsElementVisible( LAYER_GRID );
}
void FOOTPRINT_EDIT_FRAME::SetGridVisibility(bool aVisible)
{
- SetElementVisibility( GRID_VISIBLE, aVisible );
+ SetElementVisibility( LAYER_GRID, aVisible );
}
@@ -836,7 +836,7 @@ bool FOOTPRINT_EDIT_FRAME::IsElementVisible( int aElement ) const
void FOOTPRINT_EDIT_FRAME::SetElementVisibility( int aElement, bool aNewState )
{
- GetGalCanvas()->GetView()->SetLayerVisible( ITEM_GAL_LAYER( aElement ), aNewState );
+ GetGalCanvas()->GetView()->SetLayerVisible( aElement , aNewState );
GetBoard()->SetElementVisibility( aElement, aNewState );
m_Layers->SetRenderState( aElement, aNewState );
}
diff --git a/pcbnew/modules.cpp b/pcbnew/modules.cpp
index a31a2e6..fc09aa6 100644
--- a/pcbnew/modules.cpp
+++ b/pcbnew/modules.cpp
@@ -116,7 +116,7 @@ void PCB_EDIT_FRAME::StartMoveModule( MODULE* aModule, wxDC* aDC,
aModule->SetFlags( IS_MOVED );
/* Show ratsnest. */
- if( GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) )
+ if( GetBoard()->IsElementVisible( LAYER_RATSNEST ) )
DrawGeneralRatsnest( aDC );
EraseDragList();
@@ -223,7 +223,7 @@ void Abort_MoveOrCopyModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
// Display ratsnest is allowed
pcbframe->GetBoard()->m_Status_Pcb &= ~DO_NOT_SHOW_GENERAL_RASTNEST;
- if( pcbframe->GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) )
+ if( pcbframe->GetBoard()->IsElementVisible( LAYER_RATSNEST ) )
pcbframe->DrawGeneralRatsnest( DC );
#ifdef __WXMAC__
@@ -269,7 +269,7 @@ bool PCB_EDIT_FRAME::Delete_Module( MODULE* aModule, wxDC* aDC )
aModule->SetState( IS_DELETED, true );
SaveCopyInUndoList( aModule, UR_DELETED );
- if( aDC && GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) )
+ if( aDC && GetBoard()->IsElementVisible( LAYER_RATSNEST ) )
Compile_Ratsnest( aDC, true );
// Redraw the full screen to ensure perfect display of board and ratsnest.
@@ -304,7 +304,7 @@ void PCB_EDIT_FRAME::Change_Side_Module( MODULE* Module, wxDC* DC )
}
/* Show ratsnest if necessary. */
- if( DC && GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) )
+ if( DC && GetBoard()->IsElementVisible( LAYER_RATSNEST ) )
DrawGeneralRatsnest( DC );
g_Offset_Module.x = 0;
@@ -331,7 +331,7 @@ void PCB_EDIT_FRAME::Change_Side_Module( MODULE* Module, wxDC* DC )
{
Module->Draw( m_canvas, DC, GR_OR );
- if( GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) )
+ if( GetBoard()->IsElementVisible( LAYER_RATSNEST ) )
Compile_Ratsnest( DC, true );
}
}
@@ -410,7 +410,7 @@ void PCB_BASE_FRAME::PlaceModule( MODULE* aModule, wxDC* aDC, bool aDoNotRecreat
m_canvas->SetMouseCapture( NULL, NULL );
- if( GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) && !aDoNotRecreateRatsnest )
+ if( GetBoard()->IsElementVisible( LAYER_RATSNEST ) && !aDoNotRecreateRatsnest )
Compile_Ratsnest( aDC, true );
if( aDC )
@@ -443,7 +443,7 @@ void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, double angle, bool
m_canvas->RefreshDrawingRect( module->GetBoundingBox() );
module->ClearFlags( DO_NOT_DRAW );
- if( GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) )
+ if( GetBoard()->IsElementVisible( LAYER_RATSNEST ) )
DrawGeneralRatsnest( DC );
}
}
@@ -472,7 +472,7 @@ void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, double angle, bool
// not beiing moved: redraw the module and update ratsnest
module->Draw( m_canvas, DC, GR_OR );
- if( GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) )
+ if( GetBoard()->IsElementVisible( LAYER_RATSNEST ) )
Compile_Ratsnest( DC, true );
}
else
diff --git a/pcbnew/modview_frame.cpp b/pcbnew/modview_frame.cpp
index 7cb3695..03e0880 100644
--- a/pcbnew/modview_frame.cpp
+++ b/pcbnew/modview_frame.cpp
@@ -684,7 +684,7 @@ void FOOTPRINT_VIEWER_FRAME::Update3D_Frame( bool aForceReloadFootprint )
COLOR4D FOOTPRINT_VIEWER_FRAME::GetGridColor() const
{
- return g_ColorsSettings.GetItemColor( GRID_VISIBLE );
+ return g_ColorsSettings.GetItemColor( LAYER_GRID );
}
diff --git a/pcbnew/pcb_draw_panel_gal.cpp b/pcbnew/pcb_draw_panel_gal.cpp
index 7eeefad..2e41152 100644
--- a/pcbnew/pcb_draw_panel_gal.cpp
+++ b/pcbnew/pcb_draw_panel_gal.cpp
@@ -41,20 +41,20 @@ using namespace std::placeholders;
const LAYER_NUM GAL_LAYER_ORDER[] =
{
- ITEM_GAL_LAYER( GP_OVERLAY ),
- ITEM_GAL_LAYER( DRC_VISIBLE ),
- NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ),
+ LAYER_GP_OVERLAY ,
+ LAYER_DRC,
+ LAYER_PADS_NETNAMES,
Dwgs_User, Cmts_User, Eco1_User, Eco2_User, Edge_Cuts,
- ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE ),
- ITEM_GAL_LAYER( MOD_REFERENCES_VISIBLE), ITEM_GAL_LAYER( MOD_VALUES_VISIBLE ),
+ LAYER_MOD_TEXT_FR,
+ LAYER_MOD_REFERENCES, LAYER_MOD_VALUES,
- ITEM_GAL_LAYER( RATSNEST_VISIBLE ), ITEM_GAL_LAYER( ANCHOR_VISIBLE ),
- ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ),
- ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ), ITEM_GAL_LAYER( VIA_BBLIND_VISIBLE ),
- ITEM_GAL_LAYER( VIA_MICROVIA_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),
+ LAYER_RATSNEST, LAYER_ANCHOR,
+ LAYER_VIAS_HOLES, LAYER_PADS_HOLES,
+ LAYER_VIA_THROUGH, LAYER_VIA_BBLIND,
+ LAYER_VIA_MICROVIA, LAYER_PADS,
- NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ),
+ NETNAMES_GAL_LAYER( LAYER_PAD_FR_NETNAMES ), LAYER_PAD_FR,
NETNAMES_GAL_LAYER( F_Cu ), F_Cu, F_Mask, F_SilkS, F_Paste, F_Adhes,
NETNAMES_GAL_LAYER( In1_Cu ), In1_Cu,
@@ -88,11 +88,11 @@ const LAYER_NUM GAL_LAYER_ORDER[] =
NETNAMES_GAL_LAYER( In29_Cu ), In29_Cu,
NETNAMES_GAL_LAYER( In30_Cu ), In30_Cu,
- NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ),
+ NETNAMES_GAL_LAYER( LAYER_PAD_BK_NETNAMES ), LAYER_PAD_BK,
NETNAMES_GAL_LAYER( B_Cu ), B_Cu, B_Mask, B_Adhes, B_Paste, B_SilkS,
- ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE ),
- ITEM_GAL_LAYER( WORKSHEET )
+ LAYER_MOD_TEXT_BK,
+ LAYER_WORKSHEET
};
@@ -193,10 +193,10 @@ void PCB_DRAW_PANEL_GAL::SetHighContrastLayer( LAYER_ID aLayer )
// fixme do not like the idea of storing the list of layers here,
// should be done in some other way I guess..
LAYER_NUM layers[] = {
- GetNetnameLayer( aLayer ), ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ),
- ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),
- ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ),
- ITEM_GAL_LAYER( GP_OVERLAY ), ITEM_GAL_LAYER( RATSNEST_VISIBLE )
+ GetNetnameLayer( aLayer ), LAYER_VIA_THROUGH,
+ LAYER_VIAS_HOLES, LAYER_PADS,
+ LAYER_PADS_HOLES, LAYER_PADS_NETNAMES,
+ LAYER_GP_OVERLAY, LAYER_RATSNEST
};
for( unsigned int i = 0; i < sizeof( layers ) / sizeof( LAYER_NUM ); ++i )
@@ -205,15 +205,15 @@ void PCB_DRAW_PANEL_GAL::SetHighContrastLayer( LAYER_ID aLayer )
// Pads should be shown too
if( aLayer == B_Cu )
{
- rSettings->SetActiveLayer( ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
- rSettings->SetActiveLayer( ITEM_GAL_LAYER( MOD_BK_VISIBLE ) );
- rSettings->SetActiveLayer( NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ) );
+ rSettings->SetActiveLayer( LAYER_PAD_BK );
+ rSettings->SetActiveLayer( LAYER_MOD_BK );
+ rSettings->SetActiveLayer( LAYER_PAD_BK_NETNAMES );
}
else if( aLayer == F_Cu )
{
- rSettings->SetActiveLayer( ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
- rSettings->SetActiveLayer( ITEM_GAL_LAYER( MOD_FR_VISIBLE ) );
- rSettings->SetActiveLayer( NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ) );
+ rSettings->SetActiveLayer( LAYER_PAD_FR );
+ rSettings->SetActiveLayer( LAYER_MOD_FR );
+ rSettings->SetActiveLayer( LAYER_PAD_FR_NETNAMES );
}
}
@@ -229,11 +229,11 @@ void PCB_DRAW_PANEL_GAL::SetTopLayer( LAYER_ID aLayer )
// Layers that should always have on-top attribute enabled
const LAYER_NUM layers[] = {
- ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ),
- ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),
- ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ),
- ITEM_GAL_LAYER( GP_OVERLAY ), ITEM_GAL_LAYER( RATSNEST_VISIBLE ), Dwgs_User,
- ITEM_GAL_LAYER( DRC_VISIBLE )
+ LAYER_VIA_THROUGH,
+ LAYER_VIAS_HOLES, LAYER_PADS,
+ LAYER_PADS_HOLES, LAYER_PADS_NETNAMES,
+ LAYER_GP_OVERLAY, LAYER_RATSNEST, Dwgs_User,
+ LAYER_DRC
};
for( unsigned int i = 0; i < sizeof( layers ) / sizeof( LAYER_NUM ); ++i )
@@ -241,13 +241,13 @@ void PCB_DRAW_PANEL_GAL::SetTopLayer( LAYER_ID aLayer )
// Extra layers that are brought to the top if a F.* or B.* is selected
const LAYER_NUM frontLayers[] = {
- F_Cu, F_Adhes, F_Paste, F_SilkS, F_Mask, F_CrtYd, F_Fab, ITEM_GAL_LAYER( PAD_FR_VISIBLE ),
- NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), NETNAMES_GAL_LAYER( F_Cu ), -1
+ F_Cu, F_Adhes, F_Paste, F_SilkS, F_Mask, F_CrtYd, F_Fab, LAYER_PAD_FR,
+ LAYER_PAD_FR_NETNAMES, NETNAMES_GAL_LAYER( F_Cu ), -1
};
const LAYER_NUM backLayers[] = {
- B_Cu, B_Adhes, B_Paste, B_SilkS, B_Mask, B_CrtYd, B_Fab, ITEM_GAL_LAYER( PAD_BK_VISIBLE ),
- NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), NETNAMES_GAL_LAYER( B_Cu ), -1
+ B_Cu, B_Adhes, B_Paste, B_SilkS, B_Mask, B_CrtYd, B_Fab, LAYER_PAD_BK,
+ LAYER_PAD_BK_NETNAMES, NETNAMES_GAL_LAYER( B_Cu ), -1
};
const LAYER_NUM* extraLayers = NULL;
@@ -282,7 +282,7 @@ void PCB_DRAW_PANEL_GAL::SetTopLayer( LAYER_ID aLayer )
void PCB_DRAW_PANEL_GAL::SyncLayersVisibility( const BOARD* aBoard )
{
// Load layer & elements visibility settings
- for( LAYER_NUM i = 0; i < LAYER_ID_COUNT; ++i )
+ for( LAYER_NUM i = 0; i < PCB_LAYER_ID_COUNT; ++i )
{
m_view->SetLayerVisible( i, aBoard->IsLayerVisible( LAYER_ID( i ) ) );
@@ -291,16 +291,16 @@ void PCB_DRAW_PANEL_GAL::SyncLayersVisibility( const BOARD* aBoard )
m_view->SetLayerVisible( GetNetnameLayer( i ), aBoard->IsLayerVisible( LAYER_ID( i ) ) );
}
- for( LAYER_NUM i = 0; i < END_PCB_VISIBLE_LIST; ++i )
+ for( LAYER_NUM i = GAL_LAYER_OFFSET; i < LAYER_ID_PCB_GAL_END; ++i )
{
- m_view->SetLayerVisible( ITEM_GAL_LAYER( i ), aBoard->IsElementVisible( i ) );
+ m_view->SetLayerVisible( i , aBoard->IsElementVisible( i ) );
}
// Enable some layers that are GAL specific
- m_view->SetLayerVisible( ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), true );
- m_view->SetLayerVisible( ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), true );
- m_view->SetLayerVisible( ITEM_GAL_LAYER( WORKSHEET ), true );
- m_view->SetLayerVisible( ITEM_GAL_LAYER( GP_OVERLAY ), true );
+ m_view->SetLayerVisible( LAYER_PADS_HOLES, true );
+ m_view->SetLayerVisible( LAYER_VIAS_HOLES, true );
+ m_view->SetLayerVisible( LAYER_WORKSHEET , true );
+ m_view->SetLayerVisible( LAYER_GP_OVERLAY , true );
}
@@ -395,42 +395,42 @@ void PCB_DRAW_PANEL_GAL::setDefaultLayerDeps()
m_view->SetLayerDisplayOnly( layer );
}
- m_view->SetLayerTarget( ITEM_GAL_LAYER( ANCHOR_VISIBLE ), KIGFX::TARGET_NONCACHED );
- m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( ANCHOR_VISIBLE ) );
+ m_view->SetLayerTarget( LAYER_ANCHOR, KIGFX::TARGET_NONCACHED );
+ m_view->SetLayerDisplayOnly( LAYER_ANCHOR );
// Some more required layers settings
- m_view->SetRequired( ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ) );
- m_view->SetRequired( ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) );
- m_view->SetRequired( NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) );
+ m_view->SetRequired( LAYER_VIAS_HOLES, LAYER_VIA_THROUGH );
+ m_view->SetRequired( LAYER_PADS_HOLES, LAYER_PADS );
+ m_view->SetRequired( LAYER_PADS_NETNAMES, LAYER_PADS );
// Front modules
- m_view->SetRequired( ITEM_GAL_LAYER( PAD_FR_VISIBLE ), ITEM_GAL_LAYER( MOD_FR_VISIBLE ) );
- m_view->SetRequired( ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE ), ITEM_GAL_LAYER( MOD_FR_VISIBLE ) );
- m_view->SetRequired( NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
- m_view->SetRequired( F_Adhes, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
- m_view->SetRequired( F_Paste, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
- m_view->SetRequired( F_Mask, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
- m_view->SetRequired( F_CrtYd, ITEM_GAL_LAYER( MOD_FR_VISIBLE ) );
- m_view->SetRequired( F_Fab, ITEM_GAL_LAYER( MOD_FR_VISIBLE ) );
- m_view->SetRequired( F_SilkS, ITEM_GAL_LAYER( MOD_FR_VISIBLE ) );
+ m_view->SetRequired( LAYER_PAD_FR, LAYER_MOD_FR );
+ m_view->SetRequired( LAYER_MOD_TEXT_FR, LAYER_MOD_FR );
+ m_view->SetRequired( LAYER_PAD_FR_NETNAMES, LAYER_PAD_FR );
+ m_view->SetRequired( F_Adhes, LAYER_PAD_FR );
+ m_view->SetRequired( F_Paste, LAYER_PAD_FR );
+ m_view->SetRequired( F_Mask, LAYER_PAD_FR );
+ m_view->SetRequired( F_CrtYd, LAYER_MOD_FR );
+ m_view->SetRequired( F_Fab, LAYER_MOD_FR );
+ m_view->SetRequired( F_SilkS, LAYER_MOD_FR );
// Back modules
- m_view->SetRequired( ITEM_GAL_LAYER( PAD_BK_VISIBLE ), ITEM_GAL_LAYER( MOD_BK_VISIBLE ) );
- m_view->SetRequired( ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE ), ITEM_GAL_LAYER( MOD_BK_VISIBLE ) );
- m_view->SetRequired( NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
- m_view->SetRequired( B_Adhes, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
- m_view->SetRequired( B_Paste, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
- m_view->SetRequired( B_Mask, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
- m_view->SetRequired( B_CrtYd, ITEM_GAL_LAYER( MOD_BK_VISIBLE ) );
- m_view->SetRequired( B_Fab, ITEM_GAL_LAYER( MOD_BK_VISIBLE ) );
- m_view->SetRequired( B_SilkS, ITEM_GAL_LAYER( MOD_BK_VISIBLE ) );
-
- m_view->SetLayerTarget( ITEM_GAL_LAYER( GP_OVERLAY ), KIGFX::TARGET_OVERLAY );
- m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( GP_OVERLAY ) );
- m_view->SetLayerTarget( ITEM_GAL_LAYER( RATSNEST_VISIBLE ), KIGFX::TARGET_OVERLAY );
- m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( RATSNEST_VISIBLE ) );
-
- m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( WORKSHEET ) );
- m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( GRID_VISIBLE ) );
- m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( DRC_VISIBLE ) );
+ m_view->SetRequired( LAYER_PAD_BK, LAYER_MOD_BK );
+ m_view->SetRequired( LAYER_MOD_TEXT_BK, LAYER_MOD_BK );
+ m_view->SetRequired( LAYER_PAD_BK_NETNAMES, LAYER_PAD_BK );
+ m_view->SetRequired( B_Adhes, LAYER_PAD_BK );
+ m_view->SetRequired( B_Paste, LAYER_PAD_BK );
+ m_view->SetRequired( B_Mask, LAYER_PAD_BK );
+ m_view->SetRequired( B_CrtYd, LAYER_MOD_BK );
+ m_view->SetRequired( B_Fab, LAYER_MOD_BK );
+ m_view->SetRequired( B_SilkS, LAYER_MOD_BK );
+
+ m_view->SetLayerTarget( LAYER_GP_OVERLAY , KIGFX::TARGET_OVERLAY );
+ m_view->SetLayerDisplayOnly( LAYER_GP_OVERLAY ) ;
+ m_view->SetLayerTarget( LAYER_RATSNEST, KIGFX::TARGET_OVERLAY );
+ m_view->SetLayerDisplayOnly( LAYER_RATSNEST );
+
+ m_view->SetLayerDisplayOnly( LAYER_WORKSHEET ) ;
+ m_view->SetLayerDisplayOnly( LAYER_GRID );
+ m_view->SetLayerDisplayOnly( LAYER_DRC );
}
diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp
index 3783d63..8221459 100644
--- a/pcbnew/pcb_painter.cpp
+++ b/pcbnew/pcb_painter.cpp
@@ -54,7 +54,7 @@ PCB_RENDER_SETTINGS::PCB_RENDER_SETTINGS()
m_sketchFpGfx = false;
// By default everything should be displayed as filled
- for( unsigned int i = 0; i < TOTAL_LAYER_COUNT; ++i )
+ for( unsigned int i = 0; i < PCB_LAYER_ID_COUNT; ++i )
{
m_sketchMode[i] = false;
}
@@ -65,34 +65,35 @@ PCB_RENDER_SETTINGS::PCB_RENDER_SETTINGS()
void PCB_RENDER_SETTINGS::ImportLegacyColors( const COLORS_DESIGN_SETTINGS* aSettings )
{
- for( int i = 0; i < LAYER_ID_COUNT; i++ )
+ for( int i = 0; i < PCB_LAYER_ID_COUNT; i++ )
{
m_layerColors[i] = aSettings->GetLayerColor( i );
m_layerColors[i].a = 0.8; // slightly transparent
}
- for( int i = 0; i < END_PCB_VISIBLE_LIST; i++ )
- m_layerColors[ITEM_GAL_LAYER( i )] = aSettings->GetItemColor( i );
+ for( int i = LAYER_ID_GAL_START; i < LAYER_ID_PCB_GAL_END; i++ )
+ m_layerColors[i] = aSettings->GetItemColor( i );
- m_layerColors[ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE )] = m_layerColors[F_SilkS];
- m_layerColors[ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE )] = m_layerColors[B_SilkS];
+ m_layerColors[LAYER_MOD_TEXT_FR] = m_layerColors[F_SilkS];
+ m_layerColors[LAYER_MOD_TEXT_BK] = m_layerColors[B_SilkS];
// Default colors for specific layers
- m_layerColors[ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE )] = COLOR4D( 0.5, 0.4, 0.0, 0.8 );
- m_layerColors[ITEM_GAL_LAYER( PADS_HOLES_VISIBLE )] = COLOR4D( 0.0, 0.5, 0.5, 0.8 );
- m_layerColors[ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE )] = COLOR4D( 0.6, 0.6, 0.6, 0.8 );
- m_layerColors[ITEM_GAL_LAYER( VIA_BBLIND_VISIBLE )] = COLOR4D( 0.6, 0.6, 0.6, 0.8 );
- m_layerColors[ITEM_GAL_LAYER( VIA_MICROVIA_VISIBLE )] = COLOR4D( 0.4, 0.4, 0.8, 0.8 );
- m_layerColors[ITEM_GAL_LAYER( PADS_VISIBLE )] = COLOR4D( 0.6, 0.6, 0.6, 0.8 );
- m_layerColors[NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE )] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
- m_layerColors[NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE )] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
- m_layerColors[NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE )] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
- m_layerColors[ITEM_GAL_LAYER( ANCHOR_VISIBLE )] = COLOR4D( 0.3, 0.3, 1.0, 0.9 );
- m_layerColors[ITEM_GAL_LAYER( WORKSHEET )] = COLOR4D( 0.5, 0.0, 0.0, 0.8 );
- m_layerColors[ITEM_GAL_LAYER( DRC_VISIBLE )] = COLOR4D( 1.0, 0.0, 0.0, 0.8 );
+ m_layerColors[LAYER_VIAS_HOLES] = COLOR4D( 0.5, 0.4, 0.0, 0.8 );
+ m_layerColors[LAYER_PADS_HOLES] = COLOR4D( 0.0, 0.5, 0.5, 0.8 );
+ m_layerColors[LAYER_VIA_THROUGH] = COLOR4D( 0.6, 0.6, 0.6, 0.8 );
+ m_layerColors[LAYER_VIA_BBLIND] = COLOR4D( 0.6, 0.6, 0.6, 0.8 );
+ m_layerColors[LAYER_VIA_MICROVIA] = COLOR4D( 0.4, 0.4, 0.8, 0.8 );
+ m_layerColors[LAYER_PADS] = COLOR4D( 0.6, 0.6, 0.6, 0.8 );
+ m_layerColors[LAYER_PADS_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
+ m_layerColors[LAYER_PAD_FR_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
+ m_layerColors[LAYER_PAD_BK_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
+ m_layerColors[LAYER_ANCHOR] = COLOR4D( 0.3, 0.3, 1.0, 0.9 );
+ m_layerColors[LAYER_RATSNEST] = COLOR4D( 0.4, 0.4, 0.4, 0.8 );
+ m_layerColors[LAYER_WORKSHEET] = COLOR4D( 0.5, 0.0, 0.0, 0.8 );
+ m_layerColors[LAYER_DRC] = COLOR4D( 1.0, 0.0, 0.0, 0.8 );
// Make ratsnest lines slightly transparent
- m_layerColors[ITEM_GAL_LAYER( RATSNEST_VISIBLE )].a = 0.8;
+ m_layerColors[LAYER_RATSNEST].a = 0.8;
// Netnames for copper layers
for( LSEQ cu = LSET::AllCuMask().CuStack(); cu; ++cu )
@@ -122,11 +123,11 @@ void PCB_RENDER_SETTINGS::LoadDisplayOptions( const DISPLAY_OPTIONS* aOptions )
m_sketchFpGfx = !aOptions->m_DisplayModEdgeFill;
// Whether to draw tracks, vias & pads filled or as outlines
- m_sketchMode[ITEM_GAL_LAYER( PADS_VISIBLE )] = !aOptions->m_DisplayPadFill;
- m_sketchMode[ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE )] = !aOptions->m_DisplayViaFill;
- m_sketchMode[ITEM_GAL_LAYER( VIA_BBLIND_VISIBLE )] = !aOptions->m_DisplayViaFill;
- m_sketchMode[ITEM_GAL_LAYER( VIA_MICROVIA_VISIBLE )] = !aOptions->m_DisplayViaFill;
- m_sketchMode[ITEM_GAL_LAYER( TRACKS_VISIBLE )] = !aOptions->m_DisplayPcbTrackFill;
+ m_sketchMode[LAYER_PADS] = !aOptions->m_DisplayPadFill;
+ m_sketchMode[LAYER_VIA_THROUGH] = !aOptions->m_DisplayViaFill;
+ m_sketchMode[LAYER_VIA_BBLIND] = !aOptions->m_DisplayViaFill;
+ m_sketchMode[LAYER_VIA_MICROVIA] = !aOptions->m_DisplayViaFill;
+ m_sketchMode[LAYER_TRACKS] = !aOptions->m_DisplayPcbTrackFill;
// Net names display settings
switch( aOptions->m_DisplayNetNamesMode )
@@ -355,7 +356,7 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
m_gal->SetStrokeColor( color );
m_gal->SetIsStroke( true );
- if( m_pcbSettings.m_sketchMode[ITEM_GAL_LAYER( TRACKS_VISIBLE )] )
+ if( m_pcbSettings.m_sketchMode[LAYER_TRACKS] )
{
// Outline mode
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
@@ -396,7 +397,7 @@ void PCB_PAINTER::draw( const VIA* aVia, int aLayer )
return;
// Choose drawing settings depending on if we are drawing via's pad or hole
- if( aLayer == ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ) )
+ if( aLayer == LAYER_VIAS_HOLES )
radius = aVia->GetDrillValue() / 2.0;
else
radius = aVia->GetWidth() / 2.0;
@@ -407,15 +408,15 @@ void PCB_PAINTER::draw( const VIA* aVia, int aLayer )
switch( aVia->GetViaType() )
{
case VIA_THROUGH:
- sketchMode = m_pcbSettings.m_sketchMode[ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE )];
+ sketchMode = m_pcbSettings.m_sketchMode[LAYER_VIA_THROUGH];
break;
case VIA_BLIND_BURIED:
- sketchMode = m_pcbSettings.m_sketchMode[ITEM_GAL_LAYER( VIA_BBLIND_VISIBLE )];
+ sketchMode = m_pcbSettings.m_sketchMode[LAYER_VIA_BBLIND];
break;
case VIA_MICROVIA:
- sketchMode = m_pcbSettings.m_sketchMode[ITEM_GAL_LAYER( VIA_MICROVIA_VISIBLE )];
+ sketchMode = m_pcbSettings.m_sketchMode[LAYER_VIA_MICROVIA];
break;
default:
@@ -429,7 +430,7 @@ void PCB_PAINTER::draw( const VIA* aVia, int aLayer )
LAYER_ID layerTop, layerBottom;
aVia->LayerPair( &layerTop, &layerBottom );
- if( aLayer == ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ) )
+ if( aLayer == LAYER_VIAS_HOLES )
{ // TODO outline mode
m_gal->SetIsFill( true );
m_gal->SetIsStroke( false );
@@ -453,7 +454,7 @@ void PCB_PAINTER::draw( const VIA* aVia, int aLayer )
{
m_gal->DrawArc( center, radius, M_PI, 3.0 * M_PI / 2.0 );
}
- else if( aLayer == ITEM_GAL_LAYER( VIA_BBLIND_VISIBLE ) )
+ else if( aLayer == LAYER_VIA_BBLIND )
{
m_gal->DrawArc( center, radius, M_PI / 2.0, M_PI );
m_gal->DrawArc( center, radius, 3.0 * M_PI / 2.0, 2.0 * M_PI );
@@ -485,7 +486,7 @@ void PCB_PAINTER::draw( const VIA* aVia, int aLayer )
constexpr int clearanceFlags = PCB_RENDER_SETTINGS::CL_EXISTING | PCB_RENDER_SETTINGS::CL_VIAS;
if( ( m_pcbSettings.m_clearance & clearanceFlags ) == clearanceFlags
- && aLayer != ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ) )
+ && aLayer != LAYER_VIAS_HOLES )
{
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
m_gal->SetIsFill( false );
@@ -601,7 +602,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
const COLOR4D& color = m_pcbSettings.GetColor( aPad, aLayer );
VECTOR2D size;
- if( m_pcbSettings.m_sketchMode[ITEM_GAL_LAYER( PADS_VISIBLE )] )
+ if( m_pcbSettings.m_sketchMode[LAYER_PADS] )
{
// Outline mode
m_gal->SetIsFill( false );
@@ -622,7 +623,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
m_gal->Rotate( -aPad->GetOrientationRadians() );
// Choose drawing settings depending on if we are drawing a pad itself or a hole
- if( aLayer == ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ) )
+ if( aLayer == LAYER_PADS_HOLES )
{
// Drawing hole: has same shape as PAD_CIRCLE or PAD_OVAL
size = VECTOR2D( aPad->GetDrillSize() ) / 2.0;
@@ -664,7 +665,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
m = ( size.y - size.x );
n = size.x;
- if( m_pcbSettings.m_sketchMode[ITEM_GAL_LAYER( PADS_VISIBLE )] )
+ if( m_pcbSettings.m_sketchMode[LAYER_PADS] )
{
// Outline mode
m_gal->DrawArc( VECTOR2D( 0, -m ), n, -M_PI, 0 );
@@ -685,7 +686,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
m = ( size.x - size.y );
n = size.y;
- if( m_pcbSettings.m_sketchMode[ITEM_GAL_LAYER( PADS_VISIBLE )] )
+ if( m_pcbSettings.m_sketchMode[LAYER_PADS] )
{
// Outline mode
m_gal->DrawArc( VECTOR2D( -m, 0 ), n, M_PI / 2, 3 * M_PI / 2 );
@@ -716,7 +717,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
TransformRoundRectToPolygon( polySet, wxPoint( 0, 0 ), prsize,
0.0, corner_radius, segmentToCircleCount );
- if( m_pcbSettings.m_sketchMode[ITEM_GAL_LAYER( PADS_VISIBLE )] )
+ if( m_pcbSettings.m_sketchMode[LAYER_PADS] )
{
if( polySet.OutlineCount() > 0 )
m_gal->DrawPolyline( polySet.Outline( 0 ) );
@@ -744,7 +745,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
polySet.Append( VECTOR2I( corners[2] ) );
polySet.Append( VECTOR2I( corners[3] ) );
- if( m_pcbSettings.m_sketchMode[ITEM_GAL_LAYER( PADS_VISIBLE )] )
+ if( m_pcbSettings.m_sketchMode[LAYER_PADS] )
m_gal->DrawPolyline( polySet.COutline( 0 ) );
else
m_gal->DrawPolygon( polySet );
@@ -764,9 +765,9 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
constexpr int clearanceFlags = /*PCB_RENDER_SETTINGS::CL_EXISTING |*/ PCB_RENDER_SETTINGS::CL_PADS;
if( ( m_pcbSettings.m_clearance & clearanceFlags ) == clearanceFlags
- && ( aLayer == ITEM_GAL_LAYER( PAD_FR_VISIBLE )
- || aLayer == ITEM_GAL_LAYER( PAD_BK_VISIBLE )
- || aLayer == ITEM_GAL_LAYER( PADS_VISIBLE ) ) )
+ && ( aLayer == LAYER_PAD_FR
+ || aLayer == LAYER_PAD_BK
+ || aLayer == LAYER_PADS ) )
{
SHAPE_POLY_SET polySet;
constexpr int SEGCOUNT = 64;
@@ -943,9 +944,9 @@ void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer )
void PCB_PAINTER::draw( const MODULE* aModule, int aLayer )
{
- if( aLayer == ITEM_GAL_LAYER( ANCHOR_VISIBLE ) )
+ if( aLayer == LAYER_ANCHOR )
{
- const COLOR4D color = m_pcbSettings.GetColor( aModule, ITEM_GAL_LAYER( ANCHOR_VISIBLE ) );
+ const COLOR4D color = m_pcbSettings.GetColor( aModule, LAYER_ANCHOR );
// Draw anchor
m_gal->SetStrokeColor( color );
diff --git a/pcbnew/pcb_painter.h b/pcbnew/pcb_painter.h
index 2363500..e98334f 100644
--- a/pcbnew/pcb_painter.h
+++ b/pcbnew/pcb_painter.h
@@ -128,7 +128,7 @@ public:
protected:
///> Flag determining if items on a given layer should be drawn as an outline or a filled item
- bool m_sketchMode[TOTAL_LAYER_COUNT];
+ bool m_sketchMode[LAYER_ID_PCB_GAL_END];
///> Flag determining if board graphic items should be outlined or stroked
bool m_sketchBoardGfx;
diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp
index d8e5e1c..e92dceb 100644
--- a/pcbnew/pcb_parser.cpp
+++ b/pcbnew/pcb_parser.cpp
@@ -63,7 +63,7 @@ void PCB_PARSER::init()
// Add untranslated default (i.e. english) layernames.
// Some may be overridden later if parsing a board rather than a footprint.
// The english name will survive if parsing only a footprint.
- for( LAYER_NUM layer = 0; layer < LAYER_ID_COUNT; ++layer )
+ for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
{
std::string untranslated = TO_UTF8( wxString( LSET::Name( LAYER_ID( layer ) ) ) );
diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp
index 4927fdc..1d381d5 100644
--- a/pcbnew/pcbframe.cpp
+++ b/pcbnew/pcbframe.cpp
@@ -736,21 +736,13 @@ void PCB_EDIT_FRAME::forceColorsToLegacy()
{
COLORS_DESIGN_SETTINGS* cds = GetBoard()->GetColorsSettings();
- for( int i = 0; i < LAYER_ID_COUNT; i++ )
+ for( unsigned i = 0; i < DIM( cds->m_LayersColors ); i++ )
{
COLOR4D c = cds->GetLayerColor( i );
c.SetToNearestLegacyColor();
c.a = 0.8;
cds->SetLayerColor( i, c );
}
-
- for( unsigned int i = 0; i < DIM( cds->m_ItemsColors ); i++ )
- {
- COLOR4D c = cds->GetItemColor( i );
- c.SetToNearestLegacyColor();
- c.a = 0.8;
- cds->SetItemColor( i, c );
- }
}
@@ -841,26 +833,26 @@ void PCB_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg )
bool PCB_EDIT_FRAME::IsGridVisible() const
{
- return IsElementVisible( GRID_VISIBLE );
+ return IsElementVisible( LAYER_GRID );
}
void PCB_EDIT_FRAME::SetGridVisibility(bool aVisible)
{
- SetElementVisibility( GRID_VISIBLE, aVisible );
+ SetElementVisibility( LAYER_GRID, aVisible );
}
COLOR4D PCB_EDIT_FRAME::GetGridColor() const
{
- return GetBoard()->GetVisibleElementColor( GRID_VISIBLE );
+ return GetBoard()->GetVisibleElementColor( LAYER_GRID );
}
void PCB_EDIT_FRAME::SetGridColor( COLOR4D aColor )
{
- GetBoard()->SetVisibleElementColor( GRID_VISIBLE, aColor );
+ GetBoard()->SetVisibleElementColor( LAYER_GRID, aColor );
if( IsGalCanvasActive() )
{
@@ -956,7 +948,7 @@ bool PCB_EDIT_FRAME::IsElementVisible( int aElement ) const
void PCB_EDIT_FRAME::SetElementVisibility( int aElement, bool aNewState )
{
- GetGalCanvas()->GetView()->SetLayerVisible( ITEM_GAL_LAYER( aElement ), aNewState );
+ GetGalCanvas()->GetView()->SetLayerVisible( aElement , aNewState );
GetBoard()->SetElementVisibility( aElement, aNewState );
m_Layers->SetRenderState( aElement, aNewState );
}
@@ -966,7 +958,7 @@ void PCB_EDIT_FRAME::SetVisibleAlls()
{
GetBoard()->SetVisibleAlls();
- for( int ii = 0; ii < PCB_VISIBLE( END_PCB_VISIBLE_LIST ); ii++ )
+ for( int ii = 0; ii < PCB_LAYER_INDEX( LAYER_ID_PCB_GAL_END ); ii++ )
m_Layers->SetRenderState( ii, true );
}
diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp
index da954bc..27606c3 100644
--- a/pcbnew/pcbnew_config.cpp
+++ b/pcbnew/pcbnew_config.cpp
@@ -362,8 +362,8 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings()
&displ_opts->m_DisplayZonesMode, 0, 0, 2 ) );
// layer colors:
- wxASSERT( DIM( cds.m_LayersColors ) == LAYER_ID_COUNT );
- for( int i = 0; i<LAYER_ID_COUNT; ++i )
+ wxASSERT( DIM( cds.m_LayersColors ) >= PCB_LAYER_ID_COUNT );
+ for( int i = 0; i<PCB_LAYER_ID_COUNT; ++i )
{
wxString vn = wxString::Format(
wxT( "ColorPCBLayer_%s" ),
@@ -373,34 +373,34 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings()
}
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorTxtFrontEx" ),
- ITEM_COLOR( MOD_TEXT_FR_VISIBLE ),
+ ITEM_COLOR( LAYER_MOD_TEXT_FR ),
LIGHTGRAY ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorTxtBackEx" ),
- ITEM_COLOR( MOD_TEXT_BK_VISIBLE ),
+ ITEM_COLOR( LAYER_MOD_TEXT_BK ),
BLUE ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorTxtInvisEx" ),
- ITEM_COLOR( MOD_TEXT_INVISIBLE ),
+ ITEM_COLOR( LAYER_MOD_TEXT_INVISIBLE ),
DARKGRAY ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorAnchorEx" ),
- ITEM_COLOR( ANCHOR_VISIBLE ), BLUE ) );
+ ITEM_COLOR( LAYER_ANCHOR ), BLUE ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPadBackEx" ),
- ITEM_COLOR( PAD_BK_VISIBLE ), GREEN ) );
+ ITEM_COLOR( LAYER_PAD_BK ), GREEN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPadFrontEx" ),
- ITEM_COLOR( PAD_FR_VISIBLE ), RED ) );
+ ITEM_COLOR( LAYER_PAD_FR ), RED ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorViaThruEx" ),
- ITEM_COLOR( VIA_THROUGH_VISIBLE ),
+ ITEM_COLOR( LAYER_VIA_THROUGH ),
LIGHTGRAY ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorViaBBlindEx" ),
- ITEM_COLOR( VIA_BBLIND_VISIBLE ),
+ ITEM_COLOR( LAYER_VIA_BBLIND ),
BROWN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorViaMicroEx" ),
- ITEM_COLOR( VIA_MICROVIA_VISIBLE ),
+ ITEM_COLOR( LAYER_VIA_MICROVIA ),
CYAN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNonPlatedEx" ),
- ITEM_COLOR( NON_PLATED_VISIBLE ),
+ ITEM_COLOR( LAYER_NON_PLATED ),
YELLOW ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorRatsEx" ),
- ITEM_COLOR( RATSNEST_VISIBLE ),
+ ITEM_COLOR( LAYER_RATSNEST ),
WHITE ) );
// Miscellaneous:
diff --git a/pcbnew/pcbnew_config.h b/pcbnew/pcbnew_config.h
index f4c153e..e2f9ac3 100644
--- a/pcbnew/pcbnew_config.h
+++ b/pcbnew/pcbnew_config.h
@@ -11,7 +11,7 @@
/* Useful macro : */
#define LOC_COLOR(layer) &g_ColorsSettings.m_LayersColors[layer]
-#define ITEM_COLOR(item_visible) &g_ColorsSettings.m_ItemsColors[item_visible]
+#define ITEM_COLOR(item_visible) &g_ColorsSettings.m_LayersColors[item_visible]
#endif // _PCBNEW_CONFIG_H_
diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp
index be39fc2..48dc8b1 100644
--- a/pcbnew/plot_board_layers.cpp
+++ b/pcbnew/plot_board_layers.cpp
@@ -411,10 +411,10 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
COLOR4D color = COLOR4D::BLACK;
if( pad->GetLayerSet()[B_Cu] )
- color = aBoard->GetVisibleElementColor( PAD_BK_VISIBLE );
+ color = aBoard->GetVisibleElementColor( LAYER_PAD_BK );
if( pad->GetLayerSet()[F_Cu] )
- color = color.LegacyMix( aBoard->GetVisibleElementColor( PAD_FR_VISIBLE ) );
+ color = color.LegacyMix( aBoard->GetVisibleElementColor( LAYER_PAD_FR ) );
// Temporary set the pad size to the required plot size:
wxSize tmppadsize = pad->GetSize();
@@ -507,7 +507,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
gbr_metadata.SetNetName( Via->GetNetname() );
- COLOR4D color = aBoard->GetVisibleElementColor( VIAS_VISIBLE + Via->GetViaType() );
+ COLOR4D color = aBoard->GetVisibleElementColor( LAYER_VIAS + Via->GetViaType() );
// Set plot color (change WHITE to LIGHTGRAY because
// the white items are not seen on a white paper or screen
aPlotter->SetColor( color != WHITE ? color : LIGHTGRAY);
diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp
index 704f0c3..6e0b7f0 100644
--- a/pcbnew/plot_brditems_plotter.cpp
+++ b/pcbnew/plot_brditems_plotter.cpp
@@ -199,7 +199,7 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule )
TEXTE_MODULE* textModule = &aModule->Reference();
LAYER_NUM textLayer = textModule->GetLayer();
- if( textLayer >= LAYER_ID_COUNT ) // how will this ever be true?
+ if( textLayer >= PCB_LAYER_ID_COUNT ) // how will this ever be true?
return false;
if( !m_layerMask[textLayer] )
@@ -211,7 +211,7 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule )
textModule = &aModule->Value();
textLayer = textModule->GetLayer();
- if( textLayer > LAYER_ID_COUNT ) // how will this ever be true?
+ if( textLayer > PCB_LAYER_ID_COUNT ) // how will this ever be true?
return false;
if( !m_layerMask[textLayer] )
@@ -249,7 +249,7 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule )
textLayer = textModule->GetLayer();
- if( textLayer >= LAYER_ID_COUNT )
+ if( textLayer >= PCB_LAYER_ID_COUNT )
return false;
if( !m_layerMask[textLayer] )
diff --git a/pcbnew/print_board_functions.cpp b/pcbnew/print_board_functions.cpp
index 016688c..3903cec 100644
--- a/pcbnew/print_board_functions.cpp
+++ b/pcbnew/print_board_functions.cpp
@@ -68,8 +68,8 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
displ_opts->m_DisplayPadFill = true;
displ_opts->m_DisplayViaFill = true;
displ_opts->m_DisplayPadNum = false;
- bool nctmp = GetBoard()->IsElementVisible(NO_CONNECTS_VISIBLE);
- GetBoard()->SetElementVisibility(NO_CONNECTS_VISIBLE, false);
+ bool nctmp = GetBoard()->IsElementVisible( LAYER_NO_CONNECTS );
+ GetBoard()->SetElementVisibility( LAYER_NO_CONNECTS, false );
displ_opts->m_DisplayPadIsol = false;
displ_opts->m_DisplayModEdgeFill = FILLED;
displ_opts->m_DisplayModTextFill = FILLED;
@@ -101,7 +101,7 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
m_canvas->SetPrintMirrored( false );
*displ_opts = save_opt;
- GetBoard()->SetElementVisibility( NO_CONNECTS_VISIBLE, nctmp );
+ GetBoard()->SetElementVisibility( LAYER_NO_CONNECTS, nctmp );
}
@@ -151,7 +151,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
// Calculate the active layer number to print from its mask layer:
GetScreen()->m_Active_Layer = B_Cu;
- for( LAYER_NUM id = LAYER_ID_COUNT-1; id >= 0; --id )
+ for( LAYER_NUM id = PCB_LAYER_ID_COUNT-1; id >= 0; --id )
{
if( aPrintMask[id] )
{
@@ -175,13 +175,13 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
displ_opts->m_DisplayPadNum = false;
- bool nctmp = GetBoard()->IsElementVisible( NO_CONNECTS_VISIBLE );
+ bool nctmp = GetBoard()->IsElementVisible( LAYER_NO_CONNECTS );
- GetBoard()->SetElementVisibility( NO_CONNECTS_VISIBLE, false );
+ GetBoard()->SetElementVisibility( LAYER_NO_CONNECTS, false );
- bool anchorsTmp = GetBoard()->IsElementVisible( ANCHOR_VISIBLE );
+ bool anchorsTmp = GetBoard()->IsElementVisible( LAYER_ANCHOR );
- GetBoard()->SetElementVisibility( ANCHOR_VISIBLE, false );
+ GetBoard()->SetElementVisibility( LAYER_ANCHOR, false );
displ_opts->m_DisplayPadIsol = false;
displ_opts->m_DisplayModEdgeFill = FILLED;
@@ -223,7 +223,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
int radius = track->GetWidth() / 2;
const VIA* via = static_cast<const VIA*>( track );
- COLOR4D color = g_ColorsSettings.GetItemColor( VIAS_VISIBLE + via->GetViaType() );
+ COLOR4D color = g_ColorsSettings.GetItemColor( LAYER_VIAS + via->GetViaType() );
GRFilledCircle( m_canvas->GetClipBox(), aDC,
via->GetStart().x,
@@ -308,8 +308,8 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
*displ_opts = save_opt;
GetScreen()->m_Active_Layer = activeLayer;
- GetBoard()->SetElementVisibility( NO_CONNECTS_VISIBLE, nctmp );
- GetBoard()->SetElementVisibility( ANCHOR_VISIBLE, anchorsTmp );
+ GetBoard()->SetElementVisibility( LAYER_NO_CONNECTS, nctmp );
+ GetBoard()->SetElementVisibility( LAYER_ANCHOR, anchorsTmp );
}
diff --git a/pcbnew/ratsnest.cpp b/pcbnew/ratsnest.cpp
index 0015185..21126fe 100644
--- a/pcbnew/ratsnest.cpp
+++ b/pcbnew/ratsnest.cpp
@@ -197,7 +197,7 @@ void PCB_BASE_FRAME::Compile_Ratsnest( wxDC* aDC, bool aDisplayStatus )
TestForActiveLinksInRatsnest( 0 );
// Redraw the active ratsnest ( if enabled )
- if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) && aDC )
+ if( GetBoard()->IsElementVisible( LAYER_RATSNEST ) && aDC )
DrawGeneralRatsnest( aDC, 0 );
if( aDisplayStatus )
@@ -284,7 +284,7 @@ void PCB_BASE_FRAME::Build_Board_Ratsnest()
// Update the ratsnest display option (visible/invisible) flag
for( unsigned ii = 0; ii < m_Pcb->GetRatsnestsCount(); ii++ )
{
- if( !GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) ) // Clear VISIBLE flag
+ if( !GetBoard()->IsElementVisible( LAYER_RATSNEST ) ) // Clear VISIBLE flag
m_Pcb->m_FullRatsnest[ii].m_Status &= ~CH_VISIBLE;
}
}
@@ -756,7 +756,7 @@ void PCB_BASE_FRAME::TraceModuleRatsNest( wxDC* DC )
if( ( m_Pcb->m_Status_Pcb & RATSNEST_ITEM_LOCAL_OK ) == 0 )
return;
- COLOR4D tmpcolor = g_ColorsSettings.GetItemColor( RATSNEST_VISIBLE );
+ COLOR4D tmpcolor = g_ColorsSettings.GetItemColor( LAYER_RATSNEST );
for( unsigned ii = 0; ii < m_Pcb->m_LocalRatsnest.size(); ii++ )
{
@@ -764,12 +764,12 @@ void PCB_BASE_FRAME::TraceModuleRatsNest( wxDC* DC )
if( rats->m_Status & LOCAL_RATSNEST_ITEM )
{
- g_ColorsSettings.SetItemColor(RATSNEST_VISIBLE, YELLOW);
+ g_ColorsSettings.SetItemColor( LAYER_RATSNEST, YELLOW );
rats->Draw( m_canvas, DC, GR_XOR, g_Offset_Module );
}
else
{
- g_ColorsSettings.SetItemColor(RATSNEST_VISIBLE, tmpcolor);
+ g_ColorsSettings.SetItemColor( LAYER_RATSNEST, tmpcolor );
wxPoint tmp = rats->m_PadStart->GetPosition();
@@ -780,7 +780,7 @@ void PCB_BASE_FRAME::TraceModuleRatsNest( wxDC* DC )
}
}
- g_ColorsSettings.SetItemColor( RATSNEST_VISIBLE, tmpcolor );
+ g_ColorsSettings.SetItemColor( LAYER_RATSNEST, tmpcolor );
}
diff --git a/pcbnew/ratsnest_viewitem.cpp b/pcbnew/ratsnest_viewitem.cpp
index cdeba78..2d8fff6 100644
--- a/pcbnew/ratsnest_viewitem.cpp
+++ b/pcbnew/ratsnest_viewitem.cpp
@@ -60,7 +60,7 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
gal->SetIsFill( false );
gal->SetLineWidth( 1.0 );
auto rs = aView->GetPainter()->GetSettings();
- auto color = rs->GetColor( NULL, ITEM_GAL_LAYER( RATSNEST_VISIBLE ) );
+ auto color = rs->GetColor( NULL, LAYER_RATSNEST );
int highlightedNet = rs->GetHighlightNetCode();
// Dynamic ratsnest (for e.g. dragged items)
@@ -117,7 +117,7 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
void RATSNEST_VIEWITEM::ViewGetLayers( int aLayers[], int& aCount ) const
{
aCount = 1;
- aLayers[0] = ITEM_GAL_LAYER( RATSNEST_VISIBLE );
+ aLayers[0] = LAYER_RATSNEST;
}
}
diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp
index b6b6520..e1dd884 100644
--- a/pcbnew/router/pns_kicad_iface.cpp
+++ b/pcbnew/router/pns_kicad_iface.cpp
@@ -353,7 +353,7 @@ public:
return;
m_items = new KIGFX::VIEW_GROUP( m_view );
- m_items->SetLayer( ITEM_GAL_LAYER( GP_OVERLAY ) );
+ m_items->SetLayer( LAYER_GP_OVERLAY ) ;
m_view->Add( m_items );
}
@@ -943,7 +943,7 @@ void PNS_KICAD_IFACE::SetView( KIGFX::VIEW* aView )
m_view = aView;
m_previewItems = new KIGFX::VIEW_GROUP( m_view );
- m_previewItems->SetLayer( ITEM_GAL_LAYER( GP_OVERLAY ) );
+ m_previewItems->SetLayer( LAYER_GP_OVERLAY ) ;
m_view->Add( m_previewItems );
delete m_debugDecorator;
diff --git a/pcbnew/router/router_preview_item.cpp b/pcbnew/router/router_preview_item.cpp
index abd4609..a8bf217 100644
--- a/pcbnew/router/router_preview_item.cpp
+++ b/pcbnew/router/router_preview_item.cpp
@@ -43,7 +43,7 @@ ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM( const PNS::ITEM* aItem, KIGFX::VIEW* a
m_shape = NULL;
m_clearance = -1;
- m_originLayer = m_layer = ITEM_GAL_LAYER( GP_OVERLAY );
+ m_originLayer = m_layer = LAYER_GP_OVERLAY ;
m_showTrackClearance = false;
m_showViaClearance = false;
@@ -102,7 +102,7 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS::ITEM* aItem )
}
case PNS::ITEM::VIA_T:
- m_originLayer = m_layer = ITEM_GAL_LAYER( VIAS_VISIBLE );
+ m_originLayer = m_layer = LAYER_VIAS;
m_type = PR_SHAPE;
m_width = 0;
m_color = COLOR4D( 0.7, 0.7, 0.7, 0.8 );
diff --git a/pcbnew/swap_layers.cpp b/pcbnew/swap_layers.cpp
index f27fe8e..a4b3360 100644
--- a/pcbnew/swap_layers.cpp
+++ b/pcbnew/swap_layers.cpp
@@ -47,7 +47,7 @@
enum swap_layer_id {
ID_WINEDA_SWAPLAYERFRAME = 1800,
ID_BUTTON_0,
- ID_TEXT_0 = ID_BUTTON_0 + LAYER_ID_COUNT
+ ID_TEXT_0 = ID_BUTTON_0 + PCB_LAYER_ID_COUNT
};
@@ -68,8 +68,8 @@ private:
wxStaticLine* Line;
wxStdDialogButtonSizer* StdDialogButtonSizer;
- LAYER_ID* m_callers_nlayers; // DIM() is LAYER_ID_COUNT
- wxStaticText* layer_list[LAYER_ID_COUNT];
+ LAYER_ID* m_callers_nlayers; // DIM() is PCB_LAYER_ID_COUNT
+ wxStaticText* layer_list[PCB_LAYER_ID_COUNT];
void Sel_Layer( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event );
@@ -80,7 +80,7 @@ private:
BEGIN_EVENT_TABLE( SWAP_LAYERS_DIALOG, wxDialog )
- EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + LAYER_ID_COUNT - 1,
+ EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + PCB_LAYER_ID_COUNT - 1,
wxEVT_COMMAND_BUTTON_CLICKED, SWAP_LAYERS_DIALOG::Sel_Layer )
EVT_BUTTON( wxID_OK, SWAP_LAYERS_DIALOG::OnOkClick )
@@ -306,7 +306,7 @@ void SWAP_LAYERS_DIALOG::Sel_Layer( wxCommandEvent& event )
ii = event.GetId();
- if( ii < ID_BUTTON_0 || ii >= ID_BUTTON_0 + LAYER_ID_COUNT )
+ if( ii < ID_BUTTON_0 || ii >= ID_BUTTON_0 + PCB_LAYER_ID_COUNT )
return;
ii = event.GetId() - ID_BUTTON_0;
@@ -358,7 +358,7 @@ void SWAP_LAYERS_DIALOG::OnOkClick( wxCommandEvent& event )
void PCB_EDIT_FRAME::Swap_Layers( wxCommandEvent& event )
{
- LAYER_ID new_layer[LAYER_ID_COUNT];
+ LAYER_ID new_layer[PCB_LAYER_ID_COUNT];
for( unsigned i = 0; i < DIM( new_layer ); ++i )
new_layer[i] = NO_CHANGE;
diff --git a/pcbnew/swig/board.i b/pcbnew/swig/board.i
index 244f7f8..f9f9f46 100644
--- a/pcbnew/swig/board.i
+++ b/pcbnew/swig/board.i
@@ -62,8 +62,10 @@ HANDLE_EXCEPTIONS(BOARD::TracksInNetBetweenPoints)
%include netinfo.i
%include netclass.i
+%ignore operator++(LAYER_ID&);
%include layers_id_colors_and_visibility.h
+
// Extend LSET by 2 methods to add or remove layers from the layer list
// Mainly used to add or remove layers of a pad layer list
%extend LSET
diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp
index d51bd21..f547f6e 100644
--- a/pcbnew/tool_pcb.cpp
+++ b/pcbnew/tool_pcb.cpp
@@ -129,7 +129,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator()
}
int via_type = GetDesignSettings().m_CurrentViaType;
- via_color = GetBoard()->GetVisibleElementColor(VIAS_VISIBLE+via_type);
+ via_color = GetBoard()->GetVisibleElementColor( LAYER_VIAS + via_type );
if( previous_via_color != via_color )
{
@@ -745,7 +745,7 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
break;
case ID_TB_OPTIONS_SHOW_RATSNEST:
- SetElementVisibility( RATSNEST_VISIBLE, state );
+ SetElementVisibility( LAYER_RATSNEST, state );
OnModify();
if( state && (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
diff --git a/pcbnew/toolbars_update_user_interface.cpp b/pcbnew/toolbars_update_user_interface.cpp
index 95b38a2..4ccc686 100644
--- a/pcbnew/toolbars_update_user_interface.cpp
+++ b/pcbnew/toolbars_update_user_interface.cpp
@@ -141,9 +141,9 @@ void PCB_EDIT_FRAME::OnUpdateDrcEnable( wxUpdateUIEvent& aEvent )
void PCB_EDIT_FRAME::OnUpdateShowBoardRatsnest( wxUpdateUIEvent& aEvent )
{
- aEvent.Check( GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) );
+ aEvent.Check( GetBoard()->IsElementVisible( LAYER_RATSNEST ) );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_RATSNEST,
- GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) ?
+ GetBoard()->IsElementVisible( LAYER_RATSNEST ) ?
_( "Hide board ratsnest" ) :
_( "Show board ratsnest" ) );
}
diff --git a/pcbnew/tools/edit_points.h b/pcbnew/tools/edit_points.h
index dab5d78..f4d925f 100644
--- a/pcbnew/tools/edit_points.h
+++ b/pcbnew/tools/edit_points.h
@@ -502,7 +502,7 @@ public:
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override
{
aCount = 1;
- aLayers[0] = ITEM_GAL_LAYER( GP_OVERLAY );
+ aLayers[0] = LAYER_GP_OVERLAY ;
}
#if defined(DEBUG)
diff --git a/pcbnew/tools/module_editor_tools.cpp b/pcbnew/tools/module_editor_tools.cpp
index e82a89c..d3baba8 100644
--- a/pcbnew/tools/module_editor_tools.cpp
+++ b/pcbnew/tools/module_editor_tools.cpp
@@ -518,11 +518,11 @@ int MODULE_EDITOR_TOOLS::ModuleTextOutlines( const TOOL_EVENT& aEvent )
KIGFX::PCB_RENDER_SETTINGS* settings =
static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
- const LAYER_NUM layers[] = { ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE ),
- ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE ),
- ITEM_GAL_LAYER( MOD_TEXT_INVISIBLE ),
- ITEM_GAL_LAYER( MOD_REFERENCES_VISIBLE ),
- ITEM_GAL_LAYER( MOD_VALUES_VISIBLE ) };
+ const LAYER_NUM layers[] = { LAYER_MOD_TEXT_BK,
+ LAYER_MOD_TEXT_FR,
+ LAYER_MOD_TEXT_INVISIBLE,
+ LAYER_MOD_REFERENCES,
+ LAYER_MOD_VALUES };
bool enable = !settings->GetSketchMode( layers[0] );
diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp
index b3e85dc..d97d806 100644
--- a/pcbnew/tools/selection_tool.cpp
+++ b/pcbnew/tools/selection_tool.cpp
@@ -1285,10 +1285,10 @@ bool SELECTION_TOOL::selectable( const BOARD_ITEM* aItem ) const
break;
case PCB_MODULE_T:
- if( aItem->IsOnLayer( F_Cu ) && board()->IsElementVisible( MOD_FR_VISIBLE ) )
+ if( aItem->IsOnLayer( F_Cu ) && board()->IsElementVisible( LAYER_MOD_FR ) )
return !m_editModules;
- if( aItem->IsOnLayer( B_Cu ) && board()->IsElementVisible( MOD_BK_VISIBLE ) )
+ if( aItem->IsOnLayer( B_Cu ) && board()->IsElementVisible( LAYER_MOD_BK ) )
return !m_editModules;
return false;
diff --git a/pcbnew/tracepcb.cpp b/pcbnew/tracepcb.cpp
index 56b3a8b..dc11079 100644
--- a/pcbnew/tracepcb.cpp
+++ b/pcbnew/tracepcb.cpp
@@ -211,7 +211,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, GR_DRAWMODE aDrawMode, const
if( module->IsMoving() )
continue;
- if( !IsElementVisible( PCB_VISIBLE( MOD_FR_VISIBLE ) ) )
+ if( !IsElementVisible( LAYER_MOD_FR ) )
{
if( module->GetLayer() == F_Cu )
display = false;
@@ -219,7 +219,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, GR_DRAWMODE aDrawMode, const
layerMask.set( F_Cu, false );
}
- if( !IsElementVisible( PCB_VISIBLE( MOD_BK_VISIBLE ) ) )
+ if( !IsElementVisible( LAYER_MOD_BK ) )
{
if( module->GetLayer() == B_Cu )
display = false;
--
2.7.4
Follow ups