Commit 74a57d4e authored by Lorenzo Marcantonio's avatar Lorenzo Marcantonio

Cleanup of the eeschema 'layers' i.e. entitity colours. This also fixes

the spurious warning about stuff that couldn't be seen when changing
colours.
NOTE that the 'net name' layer is present and configurable but non used 
anywhere!
parent 00f0e278
......@@ -58,7 +58,7 @@ bool sort_schematic_items( const SCH_ITEM* aItem1, const SCH_ITEM* aItem2 )
SCH_ITEM::SCH_ITEM( EDA_ITEM* aParent, KICAD_T aType ) :
EDA_ITEM( aParent, aType )
{
m_Layer = 0;
m_Layer = LAYER_WIRE; // It's only a default, in fact
}
......
......@@ -67,7 +67,7 @@ static ButtonIndex buttonGroups[] = {
};
static EDA_COLOR_T currentColors[ MAX_LAYER ];
static EDA_COLOR_T currentColors[ NB_SCH_LAYERS ];
IMPLEMENT_DYNAMIC_CLASS( DIALOG_COLOR_CONFIG, wxDialog )
......@@ -167,7 +167,8 @@ void DIALOG_COLOR_CONFIG::CreateControls()
wxBitmap bitmap( BUTT_SIZE_X, BUTT_SIZE_Y );
iconDC.SelectObject( bitmap );
EDA_COLOR_T color = currentColors[ buttons->m_Layer ] = GetLayerColor( buttons->m_Layer );
EDA_COLOR_T color = GetLayerColor( LayerNumber( buttons->m_Layer ) );
currentColors[ buttons->m_Layer ] = color;
iconDC.SetPen( *wxBLACK_PEN );
wxBrush brush;
ColorSetBrush( &brush, color );
......@@ -286,7 +287,7 @@ bool DIALOG_COLOR_CONFIG::UpdateColorsSettings()
bool warning = false;
for( LAYER_NUM ii = FIRST_LAYER; ii < MAX_LAYERS; ++ii )
for( LayerNumber ii = LAYER_WIRE; ii < NB_SCH_LAYERS; ++ii )
{
SetLayerColor( currentColors[ ii ], ii );
......
......@@ -118,7 +118,7 @@ bool EDA_APP::OnInit()
// Give a default colour for all layers
// (actual color will beinitialized by config)
for( int ii = 0; ii < MAX_LAYERS; ii++ )
for( int ii = 0; ii < NB_SCH_LAYERS; ii++ )
SetLayerColor( DARKGRAY, ii );
// read current setup and reopen last directory if no filename to open in
......
......@@ -53,7 +53,7 @@
#define FR_HISTORY_LIST_CNT 10 ///< Maximum number of find and replace strings.
static EDA_COLOR_T s_layerColor[MAX_LAYERS];
static EDA_COLOR_T s_layerColor[NB_SCH_LAYERS];
// The width to draw busses that do not have a specific width
static int s_defaultBusThickness;
......@@ -65,7 +65,7 @@ int GetDefaultBusThickness()
void SetDefaultBusThickness( int aThickness)
{
if( aThickness >=1 )
if( aThickness >= 1 )
s_defaultBusThickness = aThickness;
else
s_defaultBusThickness = 1;
......@@ -90,7 +90,7 @@ void SetDefaultLineThickness( int aThickness)
s_drawDefaultLineThickness = 1;
}
EDA_COLOR_T GetLayerColor( int aLayer )
EDA_COLOR_T GetLayerColor( LayerNumber aLayer )
{
return s_layerColor[aLayer];
}
......@@ -478,9 +478,6 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings( void )
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorGLabelEx" ),
&s_layerColor[LAYER_GLOBLABEL],
RED ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPinFunEx" ),
&s_layerColor[LAYER_PINFUN],
MAGENTA ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPinNumEx" ),
&s_layerColor[LAYER_PINNUM],
RED ) );
......
......@@ -18,8 +18,8 @@ class TRANSFORM;
#define SCHEMATIC_HEAD_STRING "Schematic File Version"
#define TXTMARGE 10 // Offset in mils for placement of labels and pin numbers.
#define DEFAULT_TEXT_SIZE 50 /* Default size for field texts */
#define TXTMARGE 10 // Offset in mils for placement of labels and pin numbers
#define DEFAULT_TEXT_SIZE 50 // Default size for field texts
#define GR_DEFAULT_DRAWMODE GR_COPY
......@@ -33,7 +33,6 @@ typedef enum {
LAYER_LOCLABEL,
LAYER_GLOBLABEL,
LAYER_HIERLABEL,
LAYER_PINFUN,
LAYER_PINNUM,
LAYER_PINNAM,
LAYER_REFERENCEPART,
......@@ -52,12 +51,15 @@ typedef enum {
LAYER_ERC_ERR,
LAYER_DEVICE_BACKGROUND,
LAYER_GRID,
LAYER_ITEM_SELECTED,
LAYER_INVISIBLE_ITEM,
MAX_LAYER // end of list
NB_SCH_LAYERS
} LayerNumber;
inline LayerNumber operator++( LayerNumber& a )
{
a = LayerNumber( 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
......@@ -67,8 +69,6 @@ typedef enum {
*/
extern TRANSFORM DefaultTransform;
#define MAX_LAYERS (int) MAX_LAYER
extern wxSize g_RepeatStep;
extern int g_RepeatDeltaLabel;
......@@ -90,7 +90,7 @@ void SetDefaultLineThickness( int aThickness);
int GetDefaultBusThickness();
void SetDefaultBusThickness( int aThickness );
EDA_COLOR_T GetLayerColor( int aLayer );
EDA_COLOR_T GetLayerColor( LayerNumber aLayer );
// Color to draw selected items
EDA_COLOR_T GetItemSelectedColor();
......
......@@ -218,9 +218,9 @@ void SCH_COMPONENT::Init( const wxPoint& pos )
{
SCH_FIELD field( pos, i, this, TEMPLATE_FIELDNAME::GetDefaultFieldName( i ) );
if( i==REFERENCE )
if( i == REFERENCE )
field.SetLayer( LAYER_REFERENCEPART );
else if( i==VALUE )
else if( i == VALUE )
field.SetLayer( LAYER_VALUEPART );
// else keep LAYER_FIELDS from SCH_FIELD constructor
......
......@@ -508,7 +508,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", MAX_LAYERS, 0 ) < 0
if( fprintf( aFile, "EELAYER %d %d\n", NB_SCH_LAYERS, 0 ) < 0
|| fprintf( aFile, "EELAYER END\n" ) < 0 )
return false;
......
......@@ -31,7 +31,7 @@
#define _BITMAP_BASE_H_
#include <sch_item_struct.h>
#include <plot_common.h>
/**
* This class handle bitmap images in KiCad.
......
......@@ -32,6 +32,7 @@
#include <vector>
#include <class_base_screen.h>
#include <eeschema/general.h>
using namespace std;
......@@ -117,7 +118,7 @@ public:
class SCH_ITEM : public EDA_ITEM
{
protected:
int m_Layer;
LayerNumber m_Layer;
EDA_ITEMS m_connections; ///< List of items connected to this item.
public:
......@@ -147,14 +148,14 @@ public:
* Function GetLayer
* returns the layer this item is on.
*/
int GetLayer() const { return m_Layer; }
LayerNumber GetLayer() const { return m_Layer; }
/**
* Function SetLayer
* sets the layer this item is on.
* @param aLayer The layer number.
*/
void SetLayer( int aLayer ) { m_Layer = aLayer; }
void SetLayer( LayerNumber aLayer ) { m_Layer = aLayer; }
/**
* Function GetPenSize virtual pure
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment