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 pcbstruct.h, enum PCB_VISIBLE or in schematic. 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...
 
COLOR4D m_ItemsColors [32]
 All others items but layers. 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, m_ItemsColors, 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 = 0; dst < DIM(m_ItemsColors); ++dst )
100  {
101  m_ItemsColors[dst] = COLOR4D( default_items_color[src++] );
102 
103  if( src >= DIM( default_items_color ) )
104  src = 0;
105  }
106 }
#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)
COLOR4D m_ItemsColors[32]
All others items but layers.
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 pcbstruct.h, enum PCB_VISIBLE or in schematic

Definition at line 128 of file class_colors_design_settings.cpp.

References DIM, and m_ItemsColors.

Referenced by RATSNEST_ITEM::Draw(), MODULE::DrawAncre(), PCB_EDIT_FRAME::forceColorsToLegacy(), 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().

129 {
130  if( (unsigned) aItemIdx < DIM( m_ItemsColors ) )
131  {
132  return m_ItemsColors[aItemIdx];
133  }
134 
135  return COLOR4D::UNSPECIFIED;
136 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
COLOR4D m_ItemsColors[32]
All others items but layers.
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 109 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().

110 {
111  if( (unsigned) aLayer < DIM(m_LayersColors) )
112  {
113  return m_LayersColors[aLayer];
114  }
115  return COLOR4D::UNSPECIFIED;
116 }
#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 148 of file class_colors_design_settings.cpp.

References DIM, m_ItemsColors, and m_LayersColors.

149 {
150  for( unsigned ii = 0; ii < DIM(m_LayersColors); ii++ )
151  m_LayersColors[ii] = aColor;
152 
153  for( unsigned ii = 0; ii < DIM(m_ItemsColors); ii++ )
154  m_ItemsColors[ii] = aColor;
155 }
#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 m_ItemsColors[32]
All others items but layers.
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 pcbstruct.h, enum PCB_VISIBLE or in schematic.

Definition at line 139 of file class_colors_design_settings.cpp.

References DIM, and m_ItemsColors.

Referenced by PCB_EDIT_FRAME::forceColorsToLegacy(), GERBVIEW_FRAME::SetVisibleElementColor(), BOARD::SetVisibleElementColor(), and PCB_BASE_FRAME::TraceModuleRatsNest().

140 {
141  if( (unsigned) aItemIdx < DIM(m_ItemsColors) )
142  {
143  m_ItemsColors[aItemIdx] = aColor;
144  }
145 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
COLOR4D m_ItemsColors[32]
All others items but layers.
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 119 of file class_colors_design_settings.cpp.

References DIM, and m_LayersColors.

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

120 {
121  if( (unsigned) aLayer < DIM(m_LayersColors) )
122  {
123  m_LayersColors[aLayer] = aColor;
124  }
125 }
#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

COLOR4D COLORS_DESIGN_SETTINGS::m_ItemsColors[32]
COLOR4D COLORS_DESIGN_SETTINGS::m_LayersColors[LAYER_ID_COUNT]

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