KiCad PCB EDA Suite
COLORS_DESIGN_SETTINGS Class Reference

Class COLORS_DESIGN_SETTINGS is a list of color settings for designs in Eeschema, Pcbnew and GerbView. More...

#include <class_colors_design_settings.h>

Inheritance diagram for COLORS_DESIGN_SETTINGS:
SETTINGS

Public Member Functions

 COLORS_DESIGN_SETTINGS ()
 
 ~COLORS_DESIGN_SETTINGS () override
 
virtual void Load (wxConfigBase *aConfig) override
 
virtual void Save (wxConfigBase *aConfig) override
 
COLOR4D GetLayerColor (LAYER_NUM aLayer) const
 Function GetLayerColor. More...
 
void SetLayerColor (LAYER_NUM aLayer, COLOR4D aColor)
 Function SetLayerColor sets the color for aLayer which is one of the layer indices given in pcbstruct.h or in schematic. More...
 
COLOR4D GetItemColor (int aItemIdx) const
 Function GetItemColor. More...
 
void SetItemColor (int aItemIdx, COLOR4D aColor)
 Function SetItemColor sets the color for an item which is one of the item indices given in enum PCB_LAYER_ID. More...
 
void SetAllColorsAs (COLOR4D aColor)
 Function SetAllColorsAs sets alls colors to aColor Usefull to create a monochrome color selection for printing purpose. More...
 
void SetConfigPrefix (const wxString &aPrefix)
 
void Add (const wxString &name, int *aPtr, int aDefaultValue)
 
void Add (const wxString &name, bool *aPtr, bool aDefaultValue)
 
void Add (const wxString &name, KIGFX::COLOR4D *aPtr, KIGFX::COLOR4D aDefaultValue)
 
void Add (const wxString &name, KIGFX::COLOR4D *aPtr, EDA_COLOR_T aDefaultValue)
 

Public Attributes

COLOR4D m_LayersColors [LAYER_ID_COUNT]
 Layer colors (tracks and graphic items) More...
 

Protected Member Functions

virtual wxString getKeyName (const wxString &aEntryName) const
 

Private Member Functions

void setupConfigParams ()
 

Detailed Description

Class COLORS_DESIGN_SETTINGS is a list of color settings for designs in Eeschema, Pcbnew and GerbView.

Definition at line 47 of file class_colors_design_settings.h.

Constructor & Destructor Documentation

COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS ( )

Definition at line 89 of file class_colors_design_settings.cpp.

References BLACK, DARKRED, default_items_color, default_layer_color, DIM, LAYER_AUX_ITEMS, LAYER_CURSOR, LAYER_PCB_BACKGROUND, LAYER_VIAS, LAYER_WORKSHEET, m_LayersColors, setupConfigParams(), and WHITE.

90 {
91  for( unsigned src = 0, dst = 0; dst < DIM( m_LayersColors ); ++dst )
92  {
94 
95  if( src >= DIM( default_layer_color ) )
96  src = 0; // wrap the source.
97  }
98 
99  for( unsigned src = 0, dst = LAYER_VIAS; dst < DIM( default_items_color ); ++dst )
100  {
101  m_LayersColors[dst] = COLOR4D( default_items_color[src++] );
102  }
103 
108 
110 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
static const EDA_COLOR_T default_layer_color[]
Definition: colors.h:54
static const EDA_COLOR_T default_items_color[]
Auxillary items (guides, rulre, etc)
COLOR4D m_LayersColors[LAYER_ID_COUNT]
Layer colors (tracks and graphic items)
Definition: colors.h:49
Definition: colors.h:45
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
COLORS_DESIGN_SETTINGS::~COLORS_DESIGN_SETTINGS ( )
inlineoverride

Definition at line 58 of file class_colors_design_settings.h.

59  {}

Member Function Documentation

void SETTINGS::Add ( const wxString &  name,
int *  aPtr,
int  aDefaultValue 
)
inlineinherited

Definition at line 83 of file settings.h.

References SETTINGS::m_params.

Referenced by PCB_GENERAL_SETTINGS::PCB_GENERAL_SETTINGS(), and setupConfigParams().

84  {
85  m_params.push_back ( new PARAM_CFG_INT ( name, aPtr, aDefaultValue ) );
86  }
PARAM_CFG_ARRAY m_params
Definition: settings.h:113
Configuration parameter - Integer Class.
const char * name
void SETTINGS::Add ( const wxString &  name,
bool *  aPtr,
bool  aDefaultValue 
)
inlineinherited

Definition at line 88 of file settings.h.

References SETTINGS::m_params.

89  {
90  m_params.push_back ( new PARAM_CFG_BOOL ( name, aPtr, aDefaultValue ) );
91  }
PARAM_CFG_ARRAY m_params
Definition: settings.h:113
Configuration parameter - Boolean Class.
const char * name
void SETTINGS::Add ( const wxString &  name,
KIGFX::COLOR4D aPtr,
KIGFX::COLOR4D  aDefaultValue 
)
inlineinherited

Definition at line 93 of file settings.h.

References SETTINGS::m_params.

94  {
95  m_params.push_back ( new PARAM_CFG_SETCOLOR ( name, aPtr, aDefaultValue ) );
96  }
PARAM_CFG_ARRAY m_params
Definition: settings.h:113
Configuration parameter - SetColor Class.
const char * name
void SETTINGS::Add ( const wxString &  name,
KIGFX::COLOR4D aPtr,
EDA_COLOR_T  aDefaultValue 
)
inlineinherited

Definition at line 98 of file settings.h.

References SETTINGS::m_params.

99  {
100  m_params.push_back ( new PARAM_CFG_SETCOLOR ( name, aPtr, aDefaultValue ) );
101  }
PARAM_CFG_ARRAY m_params
Definition: settings.h:113
Configuration parameter - SetColor Class.
const char * name
COLOR4D COLORS_DESIGN_SETTINGS::GetItemColor ( int  aItemIdx) const

Function GetItemColor.

Returns
the color for an item which is one of the item indices given in enum PCB_LAYER_ID

Definition at line 132 of file class_colors_design_settings.cpp.

References DIM, and m_LayersColors.

Referenced by VIA::Draw(), PCB_BASE_FRAME::DrawGeneralRatsnest(), FOOTPRINT_VIEWER_FRAME::GetGridColor(), CINFO3D_VISU::GetItemColor(), GERBVIEW_FRAME::GetVisibleElementColor(), KIGFX::PCB_RENDER_SETTINGS::ImportLegacyColors(), DIALOG_PAD_PROPERTIES::OnPaintShowPanel(), PlotStandardLayer(), PCB_EDIT_FRAME::PrepareLayerIndicator(), PCB_EDIT_FRAME::PrintPage(), PCB_LAYER_WIDGET::ReFillRender(), PCB_BASE_FRAME::TraceModuleRatsNest(), and PCB_DRAW_PANEL_GAL::UseColorScheme().

133 {
134  if( (unsigned) aItemIdx < DIM( m_LayersColors ) )
135  {
136  return m_LayersColors[aItemIdx];
137  }
138 
139  return COLOR4D::UNSPECIFIED;
140 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
COLOR4D m_LayersColors[LAYER_ID_COUNT]
Layer colors (tracks and graphic items)
virtual wxString SETTINGS::getKeyName ( const wxString &  aEntryName) const
inlineprotectedvirtualinherited

Reimplemented in TOOL_SETTINGS.

Definition at line 106 of file settings.h.

107  {
108  return aEntryName;
109  }
COLOR4D COLORS_DESIGN_SETTINGS::GetLayerColor ( LAYER_NUM  aLayer) const
void COLORS_DESIGN_SETTINGS::Load ( wxConfigBase *  aConfig)
overridevirtual

Reimplemented from SETTINGS.

Definition at line 191 of file class_colors_design_settings.cpp.

References SETTINGS::Load().

Referenced by PCB_GENERAL_SETTINGS::Load().

192 {
193  SETTINGS::Load(aConfig);
194 }
virtual void Load(wxConfigBase *aConfig)
Definition: settings.cpp:26
void COLORS_DESIGN_SETTINGS::Save ( wxConfigBase *  aConfig)
overridevirtual

Reimplemented from SETTINGS.

Definition at line 196 of file class_colors_design_settings.cpp.

References SETTINGS::Save().

Referenced by PCB_GENERAL_SETTINGS::Save().

197 {
198  SETTINGS::Save(aConfig);
199 }
virtual void Save(wxConfigBase *aConfig)
Definition: settings.cpp:39
void COLORS_DESIGN_SETTINGS::SetAllColorsAs ( COLOR4D  aColor)

Function SetAllColorsAs sets alls colors to aColor Usefull to create a monochrome color selection for printing purpose.

Definition at line 152 of file class_colors_design_settings.cpp.

References DIM, and m_LayersColors.

153 {
154  for( unsigned ii = 0; ii < DIM(m_LayersColors); ii++ )
155  m_LayersColors[ii] = aColor;
156 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
COLOR4D m_LayersColors[LAYER_ID_COUNT]
Layer colors (tracks and graphic items)
void SETTINGS::SetConfigPrefix ( const wxString &  aPrefix)
inlineinherited

Definition at line 47 of file settings.h.

References SETTINGS::m_prefix.

48  {
49  m_prefix = aPrefix;
50  }
wxString m_prefix
Definition: settings.h:112
void COLORS_DESIGN_SETTINGS::SetItemColor ( int  aItemIdx,
COLOR4D  aColor 
)

Function SetItemColor sets the color for an item which is one of the item indices given in enum PCB_LAYER_ID.

Definition at line 143 of file class_colors_design_settings.cpp.

References DIM, and m_LayersColors.

Referenced by PCB_LAYER_WIDGET::OnRenderColorChange(), and GERBVIEW_FRAME::SetVisibleElementColor().

144 {
145  if( (unsigned) aItemIdx < DIM( m_LayersColors ) )
146  {
147  m_LayersColors[aItemIdx] = aColor;
148  }
149 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
COLOR4D m_LayersColors[LAYER_ID_COUNT]
Layer colors (tracks and graphic items)
void COLORS_DESIGN_SETTINGS::SetLayerColor ( LAYER_NUM  aLayer,
COLOR4D  aColor 
)

Function SetLayerColor sets the color for aLayer which is one of the layer indices given in pcbstruct.h or in schematic.

Definition at line 123 of file class_colors_design_settings.cpp.

References DIM, and m_LayersColors.

Referenced by PCB_EDIT_FRAME::forceColorsToLegacy(), PCB_LAYER_WIDGET::OnLayerColorChange(), and GERBVIEW_FRAME::SetLayerColor().

124 {
125  if( (unsigned) aLayer < DIM( m_LayersColors ) )
126  {
127  m_LayersColors[aLayer] = aColor;
128  }
129 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
COLOR4D m_LayersColors[LAYER_ID_COUNT]
Layer colors (tracks and graphic items)
void COLORS_DESIGN_SETTINGS::setupConfigParams ( )
private

Definition at line 161 of file class_colors_design_settings.cpp.

References SETTINGS::Add(), BLACK, BLUE, BROWN, CYAN, DARKGRAY, DARKRED, DIM, Format(), GREEN, ITEM_COLOR, LAYER_ANCHOR, LAYER_AUX_ITEMS, LAYER_CURSOR, LAYER_MOD_TEXT_BK, LAYER_MOD_TEXT_FR, LAYER_MOD_TEXT_INVISIBLE, LAYER_NON_PLATED, LAYER_PAD_BK, LAYER_PAD_FR, LAYER_PCB_BACKGROUND, LAYER_RATSNEST, LAYER_VIA_BBLIND, LAYER_VIA_MICROVIA, LAYER_VIA_THROUGH, LAYER_WORKSHEET, LIGHTGRAY, LOC_COLOR, m_LayersColors, LSET::Name(), PCB_LAYER_ID_COUNT, RED, WHITE, and YELLOW.

Referenced by COLORS_DESIGN_SETTINGS().

162 {
163  wxASSERT( DIM( m_LayersColors ) >= PCB_LAYER_ID_COUNT );
164  for( int i = 0; i<PCB_LAYER_ID_COUNT; ++i )
165  {
166  wxString vn = wxString::Format(
167  wxT( "ColorPCBLayer_%s" ),
168  LSET::Name( PCB_LAYER_ID( i ) ) );
169 
170  Add( vn, LOC_COLOR(i), m_LayersColors[i] );
171  }
172 
173  Add( wxT( "ColorTxtFrontEx" ), ITEM_COLOR( LAYER_MOD_TEXT_FR ), LIGHTGRAY );
174  Add( wxT( "ColorTxtBackEx" ), ITEM_COLOR( LAYER_MOD_TEXT_BK ), BLUE );
175  Add( wxT( "ColorTxtInvisEx" ), ITEM_COLOR( LAYER_MOD_TEXT_INVISIBLE ), DARKGRAY );
176  Add( wxT( "ColorPadBackEx" ), ITEM_COLOR( LAYER_PAD_BK ), GREEN );
177  Add( wxT( "ColorAnchorEx" ), ITEM_COLOR( LAYER_ANCHOR ), BLUE );
178  Add( wxT( "ColorPadFrontEx" ), ITEM_COLOR( LAYER_PAD_FR ), RED );
179  Add( wxT( "ColorViaThruEx" ), ITEM_COLOR( LAYER_VIA_THROUGH ), LIGHTGRAY );
180  Add( wxT( "ColorViaBBlindEx" ), ITEM_COLOR( LAYER_VIA_BBLIND ), BROWN );
181  Add( wxT( "ColorViaMicroEx" ), ITEM_COLOR( LAYER_VIA_MICROVIA ), CYAN );
182  Add( wxT( "ColorNonPlatedEx" ), ITEM_COLOR( LAYER_NON_PLATED ), YELLOW );
183  Add( wxT( "ColorRatsEx" ), ITEM_COLOR( LAYER_RATSNEST ), WHITE );
184  Add( wxT( "ColorPCBBackground" ), ITEM_COLOR( LAYER_PCB_BACKGROUND ), BLACK );
185  Add( wxT( "ColorPCBCursor" ), ITEM_COLOR( LAYER_CURSOR ), WHITE );
186  Add( wxT( "ColorAuxItems" ), ITEM_COLOR( LAYER_AUX_ITEMS ), WHITE );
187  Add( wxT( "ColorWorksheet" ), ITEM_COLOR( LAYER_WORKSHEET ), DARKRED );
188 
189 }
Definition: colors.h:57
#define DIM(x)
of elements in an array
Definition: macros.h:98
to draw blind/buried vias
anchor of items having an anchor point (texts, footprints)
smd pads, back layer
#define ITEM_COLOR(item_visible)
Definition: colors.h:54
void Add(const wxString &name, int *aPtr, int aDefaultValue)
Definition: settings.h:83
#define LOC_COLOR(layer)
PCB_LAYER_ID
A quick note on layer IDs:
Auxillary items (guides, rulre, etc)
COLOR4D m_LayersColors[LAYER_ID_COUNT]
Layer colors (tracks and graphic items)
static const wxChar * Name(PCB_LAYER_ID aLayerId)
Function Name returns the fixed name association with aLayerId.
Definition: lset.cpp:73
to draw usual through hole vias
Definition: colors.h:59
Definition: colors.h:60
smd pads, front layer
Definition: colors.h:58
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
handle color for not plated holes
Definition: colors.h:49
Definition: colors.h:45
Definition: colors.h:68
Definition: colors.h:62

Member Data Documentation


The documentation for this class was generated from the following files: