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>

Public Member Functions

 COLORS_DESIGN_SETTINGS ()
 
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...
 

Public Attributes

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

Detailed Description

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

Definition at line 41 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 default_items_color, default_layer_color, DIM, LAYER_VIAS, and m_LayersColors.

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 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
static const EDA_COLOR_T default_layer_color[]
static const EDA_COLOR_T default_items_color[]
COLOR4D m_LayersColors[LAYER_ID_COUNT]
Layer colors (tracks and graphic items)
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

Member Function Documentation

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 125 of file class_colors_design_settings.cpp.

References DIM, and m_LayersColors.

Referenced by MODULE::DrawAncre(), PCB_BASE_FRAME::DrawGeneralRatsnest(), FOOTPRINT_VIEWER_FRAME::GetGridColor(), FOOTPRINT_EDIT_FRAME::GetGridColor(), CINFO3D_VISU::GetItemColor(), GERBVIEW_FRAME::GetVisibleElementColor(), BOARD::GetVisibleElementColor(), KIGFX::PCB_RENDER_SETTINGS::ImportLegacyColors(), PCB_EDIT_FRAME::PrintPage(), and PCB_BASE_FRAME::TraceModuleRatsNest().

126 {
127  if( (unsigned) aItemIdx < DIM( m_LayersColors ) )
128  {
129  return m_LayersColors[aItemIdx];
130  }
131 
132  return COLOR4D::UNSPECIFIED;
133 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
COLOR4D m_LayersColors[LAYER_ID_COUNT]
Layer colors (tracks and graphic items)
COLOR4D COLORS_DESIGN_SETTINGS::GetLayerColor ( LAYER_NUM  aLayer) const

Function GetLayerColor.

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

Definition at line 106 of file class_colors_design_settings.cpp.

References DIM, and m_LayersColors.

Referenced by PCB_EDIT_FRAME::forceColorsToLegacy(), CINFO3D_VISU::GetLayerColor(), GERBVIEW_FRAME::GetLayerColor(), BOARD::GetLayerColor(), KIGFX::PCB_RENDER_SETTINGS::ImportLegacyColors(), PCB_EDIT_FRAME::PrepareLayerIndicator(), and ShowNewTrackWhenMovingCursor().

107 {
108  if( (unsigned) aLayer < DIM( m_LayersColors ) )
109  {
110  return m_LayersColors[aLayer];
111  }
112  return COLOR4D::UNSPECIFIED;
113 }
#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::SetAllColorsAs ( COLOR4D  aColor)

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

Definition at line 145 of file class_colors_design_settings.cpp.

References DIM, and m_LayersColors.

146 {
147  for( unsigned ii = 0; ii < DIM(m_LayersColors); ii++ )
148  m_LayersColors[ii] = aColor;
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::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 136 of file class_colors_design_settings.cpp.

References DIM, and m_LayersColors.

Referenced by GERBVIEW_FRAME::SetVisibleElementColor(), and BOARD::SetVisibleElementColor().

137 {
138  if( (unsigned) aItemIdx < DIM( m_LayersColors ) )
139  {
140  m_LayersColors[aItemIdx] = aColor;
141  }
142 }
#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 116 of file class_colors_design_settings.cpp.

References DIM, and m_LayersColors.

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

117 {
118  if( (unsigned) aLayer < DIM( m_LayersColors ) )
119  {
120  m_LayersColors[aLayer] = aColor;
121  }
122 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
COLOR4D m_LayersColors[LAYER_ID_COUNT]
Layer colors (tracks and graphic items)

Member Data Documentation


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