KiCad PCB EDA Suite
KIGFX::PCB_RENDER_SETTINGS Class Reference

Class PCB_RENDER_SETTINGS Stores PCB specific render settings. More...

#include <pcb_painter.h>

Inheritance diagram for KIGFX::PCB_RENDER_SETTINGS:
KIGFX::RENDER_SETTINGS

Public Types

enum  CLEARANCE_MODE {
  CL_NONE = 0x00, CL_PADS = 0x01, CL_VIAS = 0x02, CL_TRACKS = 0x04,
  CL_NEW = 0x08, CL_EDITED = 0x10, CL_EXISTING = 0x20
}
 

Flags to control clearance lines visibility

More...
 
enum  DISPLAY_ZONE_MODE { DZ_HIDE_FILLED = 0, DZ_SHOW_FILLED, DZ_SHOW_OUTLINED }
 

Determines how zones should be displayed

More...
 

Public Member Functions

 PCB_RENDER_SETTINGS ()
 
void ImportLegacyColors (const COLORS_DESIGN_SETTINGS *aSettings) override
 Function ImportLegacyColors Loads a list of color settings for layers. More...
 
void LoadDisplayOptions (const PCB_DISPLAY_OPTIONS *aOptions, bool aShowPageLimits)
 Function LoadDisplayOptions Loads settings related to display options (high-contrast mode, full or outline modes for vias/pads/tracks and so on). More...
 
virtual const COLOR4DGetColor (const VIEW_ITEM *aItem, int aLayer) const override
 Function GetColor Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using currently used render settings. More...
 
void SetSketchMode (int aItemLayer, bool aEnabled)
 Function SetSketchMode Turns on/off sketch mode for given item layer. More...
 
bool GetSketchMode (int aItemLayer) const
 Function GetSketchMode Returns sketch mode setting for a given item layer. More...
 
void SetSketchModeGraphicItems (bool aEnabled)
 Turns on/off sketch mode for graphic items (DRAWSEGMENTs, texts). More...
 
bool IsBackgroundDark () const override
 
const COLOR4DGetBackgroundColor () override
 Function GetBackgroundColor Returns current background color settings. More...
 
const COLOR4DGetGridColor () override
 Function GetGridColor Returns current grid color settings. More...
 
const COLOR4DGetCursorColor () override
 Function GetCursorColor Returns current cursor color settings. More...
 
void SetActiveLayer (int aLayerId, bool aEnabled=true)
 Function SetActiveLayer Sets the specified layer as active - it means that it can be drawn in a specific mode (eg. More...
 
const std::set< unsigned int > GetActiveLayers ()
 Function GetActiveLayers() Returns the set of currently active layers. More...
 
void ClearActiveLayers ()
 Function ClearActiveLayers Clears the list of active layers. More...
 
bool IsActiveLayer (int aLayerId) const
 Function IsActiveLayer Returns information whether the queried layer is marked as active. More...
 
bool IsHighlightEnabled () const
 Function IsHighlightEnabled Returns current highlight setting. More...
 
int GetHighlightNetCode () const
 Function GetHighlightNetCode Returns netcode of currently highlighted net. More...
 
void SetHighlight (bool aEnabled, int aNetcode=-1)
 Function SetHighlight Turns on/off highlighting - it may be done for the active layer or the specified net. More...
 
void SetHighContrast (bool aEnabled)
 Function SetHighContrast Turns on/off high contrast display mode. More...
 
bool GetHighContrast () const
 Function GetHighContrast Returns information about high contrast display mode. More...
 
float GetWorksheetLineWidth () const
 
bool GetShowPageLimits () const
 
void SetShowPageLimits (bool aDraw)
 
const COLOR4DGetLayerColor (int aLayer) const
 Function GetLayerColor Returns the color used to draw a layer. More...
 
void SetLayerColor (int aLayer, const COLOR4D &aColor)
 Function SetLayerColor Changes the color used to draw a layer. More...
 

Protected Member Functions

virtual void update ()
 Function update Precalculates extra colors for layers (e.g. More...
 

Protected Attributes

bool m_sketchMode [GAL_LAYER_ID_END]
 

Flag determining if items on a given layer should be drawn as an outline or a filled item

More...
 
bool m_sketchBoardGfx
 

Flag determining if board graphic items should be outlined or stroked

More...
 
bool m_sketchFpGfx
 

Flag determining if footprint graphic items should be outlined or stroked

More...
 
bool m_sketchFpTxtfx
 

Flag determining if footprint text items should be outlined or stroked

More...
 
bool m_padNumbers
 

Flag determining if pad numbers should be visible

More...
 
bool m_netNamesOnPads
 

Flag determining if net names should be visible for pads

More...
 
bool m_netNamesOnTracks
 

Flag determining if net names should be visible for tracks

More...
 
bool m_netNamesOnVias = true
 

Flag determining if net names should be visible for vias

More...
 
DISPLAY_ZONE_MODE m_displayZone
 

Option for different display modes for zones

More...
 
int m_clearance
 

Clearance visibility settings

More...
 
COLOR4D m_selectionCandidateColor
 

Color used for highlighting selection candidates

More...
 
std::set< unsigned int > m_activeLayers
 Stores active layers number. More...
 
COLOR4D m_layerColors [LAYER_ID_COUNT]
 

Colors for all layers (normal)

More...
 
COLOR4D m_layerColorsHi [LAYER_ID_COUNT]
 

Colors for all layers (highlighted)

More...
 
COLOR4D m_layerColorsSel [LAYER_ID_COUNT]
 

Colors for all layers (selected)

More...
 
COLOR4D m_layerColorsDark [LAYER_ID_COUNT]
 

Colors for all layers (darkened)

More...
 
bool m_hiContrastEnabled
 Parameters for display modes. More...
 
COLOR4D m_hiContrastColor
 Color used for high contrast display mode. More...
 
float m_hiContrastFactor
 Factor used for computing high contrast color. More...
 
bool m_highlightEnabled
 Highlight display mode on/off. More...
 
int m_highlightNetcode
 Net number that is displayed in highlight -1 means that there is no specific net, and whole active layer is highlighted. More...
 
float m_highlightFactor
 Factor used for computing hightlight color. More...
 
float m_selectFactor
 Specifies how color of selected items is changed. More...
 
float m_layerOpacity
 Determines opacity of all layers. More...
 
float m_outlineWidth
 Line width used when drawing outlines. More...
 
float m_worksheetLineWidth
 Line width used when drawing worksheet. More...
 
bool m_showPageLimits
 
COLOR4D m_backgroundColor
 The background color. More...
 

Static Protected Attributes

static const double MAX_FONT_SIZE = Millimeter2iu( 10.0 )
 

Maximum font size for netnames (and other dynamically shown strings)

More...
 

Friends

class PCB_PAINTER
 

Detailed Description

Class PCB_RENDER_SETTINGS Stores PCB specific render settings.

Definition at line 62 of file pcb_painter.h.

Member Enumeration Documentation

Flags to control clearance lines visibility

Enumerator
CL_NONE 
CL_PADS 
CL_VIAS 
CL_TRACKS 
CL_NEW 
CL_EDITED 
CL_EXISTING 

Definition at line 68 of file pcb_painter.h.

Determines how zones should be displayed

Enumerator
DZ_HIDE_FILLED 
DZ_SHOW_FILLED 
DZ_SHOW_OUTLINED 

Definition at line 84 of file pcb_painter.h.

Constructor & Destructor Documentation

PCB_RENDER_SETTINGS::PCB_RENDER_SETTINGS ( )

Definition at line 48 of file pcb_painter.cpp.

References CL_NONE, DZ_SHOW_FILLED, FRAME_PCB, i, ImportLegacyColors(), KIGFX::RENDER_SETTINGS::m_backgroundColor, m_clearance, m_displayZone, m_netNamesOnPads, m_netNamesOnTracks, m_padNumbers, m_selectionCandidateColor, m_sketchBoardGfx, m_sketchFpGfx, m_sketchFpTxtfx, m_sketchMode, PCB_LAYER_ID_COUNT, and KIGFX::RENDER_SETTINGS::update().

49 {
50  m_backgroundColor = COLOR4D( 0.0, 0.0, 0.0, 1.0 );
51  m_padNumbers = true;
52  m_netNamesOnPads = true;
53  m_netNamesOnTracks = true;
56  m_sketchBoardGfx = false;
57  m_sketchFpGfx = false;
58  m_sketchFpTxtfx = false;
59  m_selectionCandidateColor = COLOR4D( 0.0, 1.0, 0.0, 0.75 );
60 
61  // By default everything should be displayed as filled
62  for( unsigned int i = 0; i < PCB_LAYER_ID_COUNT; ++i )
63  {
64  m_sketchMode[i] = false;
65  }
66 
68  ImportLegacyColors( &dummyCds );
69 
70  update();
71 }
bool m_sketchMode[GAL_LAYER_ID_END]
Flag determining if items on a given layer should be drawn as an outline or a filled item ...
Definition: pcb_painter.h:154
bool m_padNumbers
Flag determining if pad numbers should be visible
Definition: pcb_painter.h:166
bool m_sketchBoardGfx
Flag determining if board graphic items should be outlined or stroked
Definition: pcb_painter.h:157
DISPLAY_ZONE_MODE m_displayZone
Option for different display modes for zones
Definition: pcb_painter.h:181
bool m_sketchFpTxtfx
Flag determining if footprint text items should be outlined or stroked
Definition: pcb_painter.h:163
COLOR4D m_selectionCandidateColor
Color used for highlighting selection candidates
Definition: pcb_painter.h:187
void ImportLegacyColors(const COLORS_DESIGN_SETTINGS *aSettings) override
Function ImportLegacyColors Loads a list of color settings for layers.
Definition: pcb_painter.cpp:74
bool m_netNamesOnPads
Flag determining if net names should be visible for pads
Definition: pcb_painter.h:169
virtual void update()
Function update Precalculates extra colors for layers (e.g.
Definition: painter.cpp:53
bool m_sketchFpGfx
Flag determining if footprint graphic items should be outlined or stroked
Definition: pcb_painter.h:160
bool m_netNamesOnTracks
Flag determining if net names should be visible for tracks
Definition: pcb_painter.h:172
COLOR4D m_backgroundColor
The background color.
Definition: painter.h:277
int m_clearance
Clearance visibility settings
Definition: pcb_painter.h:184
size_t i
Definition: json11.cpp:597
Class COLORS_DESIGN_SETTINGS is a list of color settings for designs in Pcbnew.
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

Member Function Documentation

void KIGFX::RENDER_SETTINGS::ClearActiveLayers ( )
inlineinherited

Function ClearActiveLayers Clears the list of active layers.

Definition at line 98 of file painter.h.

References KIGFX::RENDER_SETTINGS::m_activeLayers.

Referenced by GERBVIEW_DRAW_PANEL_GAL::SetHighContrastLayer(), PCB_DRAW_PANEL_GAL::SetHighContrastLayer(), and EDA_DRAW_PANEL_GAL::SetHighContrastLayer().

99  {
100  m_activeLayers.clear();
101  }
std::set< unsigned int > m_activeLayers
Stores active layers number.
Definition: painter.h:245
const std::set<unsigned int> KIGFX::RENDER_SETTINGS::GetActiveLayers ( )
inlineinherited

Function GetActiveLayers() Returns the set of currently active layers.

Returns
The set of currently active layers.

Definition at line 89 of file painter.h.

References KIGFX::RENDER_SETTINGS::m_activeLayers.

Referenced by GRID_HELPER::queryVisible(), and SELECTION_TOOL::selectable().

90  {
91  return m_activeLayers;
92  }
std::set< unsigned int > m_activeLayers
Stores active layers number.
Definition: painter.h:245
const COLOR4D& KIGFX::PCB_RENDER_SETTINGS::GetBackgroundColor ( )
inlineoverridevirtual

Function GetBackgroundColor Returns current background color settings.

Implements KIGFX::RENDER_SETTINGS.

Definition at line 146 of file pcb_painter.h.

References LAYER_PCB_BACKGROUND, and KIGFX::RENDER_SETTINGS::m_layerColors.

Referenced by KIGFX::PCB_PAINTER::draw().

146 { return m_layerColors[ LAYER_PCB_BACKGROUND ]; }
COLOR4D m_layerColors[LAYER_ID_COUNT]
Colors for all layers (normal)
Definition: painter.h:248
const COLOR4D & PCB_RENDER_SETTINGS::GetColor ( const VIEW_ITEM aItem,
int  aLayer 
) const
overridevirtual

Function GetColor Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using currently used render settings.

Parameters
aItemis the VIEW_ITEM.
aLayeris the layer.
Returns
The color.

Implements KIGFX::RENDER_SETTINGS.

Definition at line 215 of file pcb_painter.cpp.

References dyn_cast(), EDA_ITEM::IsBrightened(), EDA_ITEM::IsSelected(), LAYER_MOD_TEXT_INVISIBLE, KIGFX::RENDER_SETTINGS::m_activeLayers, KIGFX::RENDER_SETTINGS::m_hiContrastColor, KIGFX::RENDER_SETTINGS::m_hiContrastEnabled, KIGFX::RENDER_SETTINGS::m_highlightEnabled, KIGFX::RENDER_SETTINGS::m_highlightNetcode, KIGFX::RENDER_SETTINGS::m_layerColors, KIGFX::RENDER_SETTINGS::m_layerColorsDark, KIGFX::RENDER_SETTINGS::m_layerColorsHi, KIGFX::RENDER_SETTINGS::m_layerColorsSel, m_selectionCandidateColor, PCB_MARKER_T, PCB_PAD_T, and EDA_ITEM::Type().

Referenced by KIGFX::PCB_PAINTER::draw().

216 {
217  int netCode = -1;
218  const EDA_ITEM* item = dynamic_cast<const EDA_ITEM*>( aItem );
219 
220  if( item )
221  {
222  // Selection disambiguation
223  if( item->IsBrightened() )
224  {
226  }
227 
228  // Don't let pads that *should* be NPTHs get lost
229  if( item->Type() == PCB_PAD_T && dyn_cast<const D_PAD*>( item )->PadShouldBeNPTH() )
230  aLayer = LAYER_MOD_TEXT_INVISIBLE;
231 
232  if( item->IsSelected() )
233  {
234  return m_layerColorsSel[aLayer];
235  }
236 
237  // Try to obtain the netcode for the item
238  if( const BOARD_CONNECTED_ITEM* conItem = dyn_cast<const BOARD_CONNECTED_ITEM*> ( item ) )
239  netCode = conItem->GetNetCode();
240 
241  if( item->Type() == PCB_MARKER_T )
242  return m_layerColors[aLayer];
243  }
244 
245  // Single net highlight mode
246  if( m_highlightEnabled && netCode == m_highlightNetcode )
247  return m_layerColorsHi[aLayer];
248 
249  // Return grayish color for non-highlighted layers in the high contrast mode
250  if( m_hiContrastEnabled && m_activeLayers.count( aLayer ) == 0 )
251  return m_hiContrastColor;
252 
253  // Catch the case when highlight and high-contraste modes are enabled
254  // and we are drawing a not highlighted track
255  if( m_highlightEnabled )
256  return m_layerColorsDark[aLayer];
257 
258  // No special modificators enabled
259  return m_layerColors[aLayer];
260 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
COLOR4D m_hiContrastColor
Color used for high contrast display mode.
Definition: painter.h:261
bool IsBrightened() const
Definition: base_struct.h:224
COLOR4D m_layerColorsHi[LAYER_ID_COUNT]
Colors for all layers (highlighted)
Definition: painter.h:251
COLOR4D m_layerColors[LAYER_ID_COUNT]
Colors for all layers (normal)
Definition: painter.h:248
bool IsSelected() const
Definition: base_struct.h:221
bool m_highlightEnabled
Highlight display mode on/off.
Definition: painter.h:264
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
COLOR4D m_selectionCandidateColor
Color used for highlighting selection candidates
Definition: pcb_painter.h:187
Class BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected an...
Casted dyn_cast(From aObject)
Function dyn_cast()
Definition: typeinfo.h:61
std::set< unsigned int > m_activeLayers
Stores active layers number.
Definition: painter.h:245
COLOR4D m_layerColorsDark[LAYER_ID_COUNT]
Colors for all layers (darkened)
Definition: painter.h:257
bool m_hiContrastEnabled
Parameters for display modes.
Definition: painter.h:260
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:99
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:151
int m_highlightNetcode
Net number that is displayed in highlight -1 means that there is no specific net, and whole active la...
Definition: painter.h:265
COLOR4D m_layerColorsSel[LAYER_ID_COUNT]
Colors for all layers (selected)
Definition: painter.h:254
const COLOR4D& KIGFX::PCB_RENDER_SETTINGS::GetCursorColor ( )
inlineoverridevirtual

Function GetCursorColor Returns current cursor color settings.

Implements KIGFX::RENDER_SETTINGS.

Definition at line 150 of file pcb_painter.h.

References LAYER_CURSOR, and KIGFX::RENDER_SETTINGS::m_layerColors.

150 { return m_layerColors[ LAYER_CURSOR ]; }
COLOR4D m_layerColors[LAYER_ID_COUNT]
Colors for all layers (normal)
Definition: painter.h:248
const COLOR4D& KIGFX::PCB_RENDER_SETTINGS::GetGridColor ( )
inlineoverridevirtual

Function GetGridColor Returns current grid color settings.

Implements KIGFX::RENDER_SETTINGS.

Definition at line 148 of file pcb_painter.h.

References LAYER_GRID, and KIGFX::RENDER_SETTINGS::m_layerColors.

148 { return m_layerColors[ LAYER_GRID ]; }
COLOR4D m_layerColors[LAYER_ID_COUNT]
Colors for all layers (normal)
Definition: painter.h:248
bool KIGFX::RENDER_SETTINGS::GetHighContrast ( ) const
inlineinherited

Function GetHighContrast Returns information about high contrast display mode.

Returns
True if the high contrast mode is on, false otherwise.

Definition at line 161 of file painter.h.

References KIGFX::RENDER_SETTINGS::GetColor(), and KIGFX::RENDER_SETTINGS::m_hiContrastEnabled.

Referenced by SELECTION_TOOL::selectable().

162  {
163  return m_hiContrastEnabled;
164  }
bool m_hiContrastEnabled
Parameters for display modes.
Definition: painter.h:260
int KIGFX::RENDER_SETTINGS::GetHighlightNetCode ( ) const
inlineinherited

Function GetHighlightNetCode Returns netcode of currently highlighted net.

Returns
Netcode of currently highlighted net.

Definition at line 128 of file painter.h.

References KIGFX::RENDER_SETTINGS::m_highlightNetcode.

129  {
130  return m_highlightNetcode;
131  }
int m_highlightNetcode
Net number that is displayed in highlight -1 means that there is no specific net, and whole active la...
Definition: painter.h:265
const COLOR4D& KIGFX::RENDER_SETTINGS::GetLayerColor ( int  aLayer) const
inlineinherited

Function GetLayerColor Returns the color used to draw a layer.

Parameters
aLayeris the layer number.

Definition at line 214 of file painter.h.

References KIGFX::RENDER_SETTINGS::m_layerColors.

Referenced by KIGFX::SCH_PAINTER::draw(), ROUTER_PREVIEW_ITEM::getLayerColor(), KIGFX::SCH_RENDER_SETTINGS::ImportLegacyColors(), KIGFX::SCH_PAINTER::setColors(), and PCB_LAYER_WIDGET::SyncLayerAlphaIndicators().

215  {
216  return m_layerColors[aLayer];
217  }
COLOR4D m_layerColors[LAYER_ID_COUNT]
Colors for all layers (normal)
Definition: painter.h:248
bool KIGFX::RENDER_SETTINGS::GetShowPageLimits ( ) const
inlineinherited

Definition at line 181 of file painter.h.

References KIGFX::RENDER_SETTINGS::m_showPageLimits.

182  {
183  return m_showPageLimits;
184  }
bool KIGFX::PCB_RENDER_SETTINGS::GetSketchMode ( int  aItemLayer) const
inline

Function GetSketchMode Returns sketch mode setting for a given item layer.

Parameters
aItemLayeris the item layer that is changed.

Definition at line 124 of file pcb_painter.h.

References m_sketchMode.

125  {
126  return m_sketchMode[aItemLayer];
127  }
bool m_sketchMode[GAL_LAYER_ID_END]
Flag determining if items on a given layer should be drawn as an outline or a filled item ...
Definition: pcb_painter.h:154
float KIGFX::RENDER_SETTINGS::GetWorksheetLineWidth ( ) const
inlineinherited

Definition at line 176 of file painter.h.

References KIGFX::RENDER_SETTINGS::m_worksheetLineWidth.

177  {
178  return m_worksheetLineWidth;
179  }
float m_worksheetLineWidth
Line width used when drawing worksheet.
Definition: painter.h:273
void PCB_RENDER_SETTINGS::ImportLegacyColors ( const COLORS_DESIGN_SETTINGS aSettings)
overridevirtual

Function ImportLegacyColors Loads a list of color settings for layers.

Parameters
aSettingsis a list of color settings.

Implements KIGFX::RENDER_SETTINGS.

Definition at line 74 of file pcb_painter.cpp.

References KIGFX::COLOR4D::a, LSET::AllCuMask(), B_SilkS, cu, F_SilkS, GAL_LAYER_ID_END, GAL_LAYER_ID_START, COLORS_DESIGN_SETTINGS::GetItemColor(), COLORS_DESIGN_SETTINGS::GetLayerColor(), GetNetnameLayer(), i, KIGFX::COLOR4D::Inverted(), LAYER_DRC, LAYER_MOD_TEXT_BK, LAYER_MOD_TEXT_FR, LAYER_PAD_BK_NETNAMES, LAYER_PAD_FR_NETNAMES, LAYER_PADS_NETNAMES, LAYER_PADS_PLATEDHOLES, LAYER_PCB_BACKGROUND, LAYER_VIAS_HOLES, LAYER_VIAS_NETNAMES, KIGFX::RENDER_SETTINGS::m_layerColors, PCB_LAYER_ID_COUNT, and KIGFX::RENDER_SETTINGS::update().

Referenced by PCB_RENDER_SETTINGS(), and PCB_DRAW_PANEL_GAL::UseColorScheme().

75 {
76  // Init board layers colors:
77  for( int i = 0; i < PCB_LAYER_ID_COUNT; i++ )
78  {
79  m_layerColors[i] = aSettings->GetLayerColor( i );
80 
81  // Guard: if the alpah channel is too small, the layer is not visible.
82  // clamp it to 0.2
83  if( m_layerColors[i].a < 0.2 )
84  m_layerColors[i].a = 0.2;
85  }
86 
87  // Init specific graphic layers colors:
88  for( int i = GAL_LAYER_ID_START; i < GAL_LAYER_ID_END; i++ )
89  m_layerColors[i] = aSettings->GetItemColor( i );
90 
91  // Default colors for specific layers (not really board layers).
92  m_layerColors[LAYER_VIAS_HOLES] = COLOR4D( 0.5, 0.4, 0.0, 0.8 );
94  m_layerColors[LAYER_VIAS_NETNAMES] = COLOR4D( 0.2, 0.2, 0.2, 0.9 );
95  m_layerColors[LAYER_PADS_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
96  m_layerColors[LAYER_PAD_FR_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
97  m_layerColors[LAYER_PAD_BK_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
98  m_layerColors[LAYER_DRC] = COLOR4D( 1.0, 0.0, 0.0, 0.8 );
99 
100  // LAYER_PADS_TH, LAYER_NON_PLATEDHOLES, LAYER_ANCHOR ,LAYER_RATSNEST,
101  // LAYER_VIA_THROUGH, LAYER_VIA_BBLIND, LAYER_VIA_MICROVIA
102  // are initialized from aSettings
103 
104  // These colors are not actually used. Set just in case...
107 
108  // Netnames for copper layers
109  for( LSEQ cu = LSET::AllCuMask().CuStack(); cu; ++cu )
110  {
111  const COLOR4D lightLabel( 0.8, 0.8, 0.8, 0.7 );
112  const COLOR4D darkLabel = lightLabel.Inverted();
113  PCB_LAYER_ID layer = *cu;
114 
115  if( m_layerColors[layer].GetBrightness() > 0.5 )
116  m_layerColors[GetNetnameLayer( layer )] = darkLabel;
117  else
118  m_layerColors[GetNetnameLayer( layer )] = lightLabel;
119  }
120 
121  update();
122 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:673
int GetNetnameLayer(int aLayer)
Returns a netname layer corresponding to the given layer.
COLOR4D m_layerColors[LAYER_ID_COUNT]
Colors for all layers (normal)
Definition: painter.h:248
to draw via holes (pad holes do not use this layer)
Add new GAL layers here.
#define cu(a)
Definition: auxiliary.h:88
COLOR4D GetItemColor(int aItemIdx) const
Function GetItemColor.
PCB_LAYER_ID
A quick note on layer IDs:
double a
Alpha component.
Definition: color4d.h:294
virtual void update()
Function update Precalculates extra colors for layers (e.g.
Definition: painter.cpp:53
Class LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
COLOR4D Inverted() const
Function Inverted Returns an inverted color, alpha remains the same.
Definition: color4d.h:249
size_t i
Definition: json11.cpp:597
COLOR4D GetLayerColor(LAYER_NUM aLayer) const
Function GetLayerColor.
Additional netnames layers (not associated with a PCB layer)
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
bool KIGFX::RENDER_SETTINGS::IsActiveLayer ( int  aLayerId) const
inlineinherited

Function IsActiveLayer Returns information whether the queried layer is marked as active.

Returns
True if the queried layer is marked as active.

Definition at line 108 of file painter.h.

References KIGFX::RENDER_SETTINGS::m_activeLayers.

109  {
110  return ( m_activeLayers.count( aLayerId ) > 0 );
111  }
std::set< unsigned int > m_activeLayers
Stores active layers number.
Definition: painter.h:245
bool KIGFX::PCB_RENDER_SETTINGS::IsBackgroundDark ( ) const
inlineoverridevirtual

Reimplemented from KIGFX::RENDER_SETTINGS.

Definition at line 139 of file pcb_painter.h.

References KIGFX::COLOR4D::GetBrightness(), LAYER_PCB_BACKGROUND, and KIGFX::RENDER_SETTINGS::m_layerColors.

140  {
142 
143  return luma < 0.5;
144  }
COLOR4D m_layerColors[LAYER_ID_COUNT]
Colors for all layers (normal)
Definition: painter.h:248
double GetBrightness() const
Function GetBrightness Returns the brightness value of the color ranged from 0.0 to 1...
Definition: color4d.h:259
bool KIGFX::RENDER_SETTINGS::IsHighlightEnabled ( ) const
inlineinherited

Function IsHighlightEnabled Returns current highlight setting.

Returns
True if highlight is enabled, false otherwise.

Definition at line 118 of file painter.h.

References KIGFX::RENDER_SETTINGS::m_highlightEnabled.

119  {
120  return m_highlightEnabled;
121  }
bool m_highlightEnabled
Highlight display mode on/off.
Definition: painter.h:264
void PCB_RENDER_SETTINGS::LoadDisplayOptions ( const PCB_DISPLAY_OPTIONS aOptions,
bool  aShowPageLimits 
)

Function LoadDisplayOptions Loads settings related to display options (high-contrast mode, full or outline modes for vias/pads/tracks and so on).

Parameters
aOptionsare settings that you want to use for displaying items.

Definition at line 125 of file pcb_painter.cpp.

References CL_EDITED, CL_EXISTING, CL_NEW, CL_NONE, CL_PADS, CL_TRACKS, CL_VIAS, PCB_DISPLAY_OPTIONS::DO_NOT_SHOW_CLEARANCE, DZ_HIDE_FILLED, DZ_SHOW_FILLED, DZ_SHOW_OUTLINED, LAYER_PADS_TH, LAYER_TRACKS, LAYER_VIA_BBLIND, LAYER_VIA_MICROVIA, LAYER_VIA_THROUGH, m_clearance, PCB_DISPLAY_OPTIONS::m_ContrastModeDisplay, PCB_DISPLAY_OPTIONS::m_DisplayDrawItemsFill, PCB_DISPLAY_OPTIONS::m_DisplayModEdgeFill, PCB_DISPLAY_OPTIONS::m_DisplayModTextFill, PCB_DISPLAY_OPTIONS::m_DisplayNetNamesMode, PCB_DISPLAY_OPTIONS::m_DisplayPadFill, PCB_DISPLAY_OPTIONS::m_DisplayPadIsol, PCB_DISPLAY_OPTIONS::m_DisplayPadNum, PCB_DISPLAY_OPTIONS::m_DisplayPcbTrackFill, PCB_DISPLAY_OPTIONS::m_DisplayViaFill, m_displayZone, PCB_DISPLAY_OPTIONS::m_DisplayZonesMode, KIGFX::RENDER_SETTINGS::m_hiContrastEnabled, m_netNamesOnPads, m_netNamesOnTracks, m_padNumbers, KIGFX::RENDER_SETTINGS::m_showPageLimits, PCB_DISPLAY_OPTIONS::m_ShowTrackClearanceMode, m_sketchBoardGfx, m_sketchFpGfx, m_sketchFpTxtfx, m_sketchMode, PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_ALWAYS, PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS, PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_TRACKS, and PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS.

Referenced by FOOTPRINT_VIEWER_FRAME::ApplyDisplaySettingsToGAL(), DISPLAY_FOOTPRINTS_FRAME::ApplyDisplaySettingsToGAL(), PCB_DRAW_PANEL_GAL::OnShow(), PANEL_PCBNEW_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_PCBNEW_SETTINGS::TransferDataFromWindow(), and KIGFX::PCB_VIEW::UpdateDisplayOptions().

127 {
128  if( aOptions == NULL )
129  return;
130 
132  m_padNumbers = aOptions->m_DisplayPadNum;
134  m_sketchFpGfx = !aOptions->m_DisplayModEdgeFill;
136 
137  // Whether to draw tracks, vias & pads filled or as outlines
143 
144  // Net names display settings
145  switch( aOptions->m_DisplayNetNamesMode )
146  {
147  case 0:
148  m_netNamesOnPads = false;
149  m_netNamesOnTracks = false;
150  break;
151 
152  case 1:
153  m_netNamesOnPads = true;
154  m_netNamesOnTracks = false;
155  break;
156 
157  case 2:
158  m_netNamesOnPads = false;
159  m_netNamesOnTracks = true;
160  break;
161 
162  case 3:
163  m_netNamesOnPads = true;
164  m_netNamesOnTracks = true;
165  break;
166  }
167 
168  // Zone display settings
169  switch( aOptions->m_DisplayZonesMode )
170  {
171  case 0:
173  break;
174 
175  case 1:
177  break;
178 
179  case 2:
181  break;
182  }
183 
184  // Clearance settings
185  switch( aOptions->m_ShowTrackClearanceMode )
186  {
189  break;
190 
193  break;
194 
197  break;
198 
201  break;
202 
205  break;
206  }
207 
208  if( aOptions->m_DisplayPadIsol )
209  m_clearance |= CL_PADS;
210 
211  m_showPageLimits = aShowPageLimits;
212 }
to draw blind/buried vias
multilayer pads, usually with holes
bool m_sketchMode[GAL_LAYER_ID_END]
Flag determining if items on a given layer should be drawn as an outline or a filled item ...
Definition: pcb_painter.h:154
bool m_padNumbers
Flag determining if pad numbers should be visible
Definition: pcb_painter.h:166
bool m_sketchBoardGfx
Flag determining if board graphic items should be outlined or stroked
Definition: pcb_painter.h:157
DISPLAY_ZONE_MODE m_displayZone
Option for different display modes for zones
Definition: pcb_painter.h:181
bool m_sketchFpTxtfx
Flag determining if footprint text items should be outlined or stroked
Definition: pcb_painter.h:163
bool m_netNamesOnPads
Flag determining if net names should be visible for pads
Definition: pcb_painter.h:169
TRACE_CLEARANCE_DISPLAY_MODE_T m_ShowTrackClearanceMode
How trace clearances are displayed.
bool m_hiContrastEnabled
Parameters for display modes.
Definition: painter.h:260
to draw usual through hole vias
bool m_sketchFpGfx
Flag determining if footprint graphic items should be outlined or stroked
Definition: pcb_painter.h:160
bool m_netNamesOnTracks
Flag determining if net names should be visible for tracks
Definition: pcb_painter.h:172
int m_clearance
Clearance visibility settings
Definition: pcb_painter.h:184
void KIGFX::RENDER_SETTINGS::SetActiveLayer ( int  aLayerId,
bool  aEnabled = true 
)
inlineinherited

Function SetActiveLayer Sets the specified layer as active - it means that it can be drawn in a specific mode (eg.

highlighted, so it differs from other layers).

Parameters
aLayerIdis a layer number that should be displayed in a specific mode.
aEnabledis the new layer state ( true = active or false = not active).

Definition at line 76 of file painter.h.

References KIGFX::RENDER_SETTINGS::m_activeLayers.

Referenced by GERBVIEW_DRAW_PANEL_GAL::SetHighContrastLayer(), PCB_DRAW_PANEL_GAL::SetHighContrastLayer(), and EDA_DRAW_PANEL_GAL::SetHighContrastLayer().

77  {
78  if( aEnabled )
79  m_activeLayers.insert( aLayerId );
80  else
81  m_activeLayers.erase( aLayerId );
82  }
std::set< unsigned int > m_activeLayers
Stores active layers number.
Definition: painter.h:245
void KIGFX::RENDER_SETTINGS::SetHighContrast ( bool  aEnabled)
inlineinherited

Function SetHighContrast Turns on/off high contrast display mode.

Parameters
aEnableddetermines if high contrast display mode should be enabled or not.

Definition at line 151 of file painter.h.

References KIGFX::RENDER_SETTINGS::m_hiContrastEnabled.

152  {
153  m_hiContrastEnabled = aEnabled;
154  }
bool m_hiContrastEnabled
Parameters for display modes.
Definition: painter.h:260
void KIGFX::RENDER_SETTINGS::SetHighlight ( bool  aEnabled,
int  aNetcode = -1 
)
inlineinherited

Function SetHighlight Turns on/off highlighting - it may be done for the active layer or the specified net.

Parameters
aEnabledtells if highlighting should be enabled.
aNetcodeis optional and if specified, turns on higlighting only for the net with number given as the parameter.

Definition at line 140 of file painter.h.

References KIGFX::RENDER_SETTINGS::m_highlightEnabled, and KIGFX::RENDER_SETTINGS::m_highlightNetcode.

Referenced by PCB_EDITOR_CONTROL::ClearHighlight(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), PNS::TOOL_BASE::highlightNet(), DIALOG_SELECT_NET_FROM_LIST::HighlightNet(), PCB_EDITOR_CONTROL::HighlightNet(), GERBVIEW_SELECTION_TOOL::Reset(), and SELECTION_TOOL::Reset().

141  {
142  m_highlightEnabled = aEnabled;
143  m_highlightNetcode = aEnabled ? aNetcode : -1;
144  }
bool m_highlightEnabled
Highlight display mode on/off.
Definition: painter.h:264
int m_highlightNetcode
Net number that is displayed in highlight -1 means that there is no specific net, and whole active la...
Definition: painter.h:265
void KIGFX::RENDER_SETTINGS::SetLayerColor ( int  aLayer,
const COLOR4D aColor 
)
inlineinherited

Function SetLayerColor Changes the color used to draw a layer.

Parameters
aLayeris the layer number.
aColoris the new color.

Definition at line 225 of file painter.h.

References KIGFX::RENDER_SETTINGS::m_layerColors, and KIGFX::RENDER_SETTINGS::update().

Referenced by DIALOG_PAD_PROPERTIES::redraw().

226  {
227  m_layerColors[aLayer] = aColor;
228 
229  update(); // recompute other shades of the color
230  }
COLOR4D m_layerColors[LAYER_ID_COUNT]
Colors for all layers (normal)
Definition: painter.h:248
virtual void update()
Function update Precalculates extra colors for layers (e.g.
Definition: painter.cpp:53
void KIGFX::RENDER_SETTINGS::SetShowPageLimits ( bool  aDraw)
inlineinherited
void KIGFX::PCB_RENDER_SETTINGS::SetSketchMode ( int  aItemLayer,
bool  aEnabled 
)
inline

Function SetSketchMode Turns on/off sketch mode for given item layer.

Parameters
aItemLayeris the item layer that is changed.
aEnableddecides if it is drawn in sketch mode (true for sketched mode, false for filled mode).

Definition at line 114 of file pcb_painter.h.

References m_sketchMode.

Referenced by DIALOG_PAD_PROPERTIES::onChangePadMode().

115  {
116  m_sketchMode[aItemLayer] = aEnabled;
117  }
bool m_sketchMode[GAL_LAYER_ID_END]
Flag determining if items on a given layer should be drawn as an outline or a filled item ...
Definition: pcb_painter.h:154
void KIGFX::PCB_RENDER_SETTINGS::SetSketchModeGraphicItems ( bool  aEnabled)
inline

Turns on/off sketch mode for graphic items (DRAWSEGMENTs, texts).

Parameters
aEnableddecides if it is drawn in sketch mode (true for sketched mode, false for filled mode).

Definition at line 134 of file pcb_painter.h.

References m_sketchBoardGfx.

Referenced by DIALOG_PAD_PROPERTIES::onChangePadMode().

135  {
136  m_sketchBoardGfx = aEnabled;
137  }
bool m_sketchBoardGfx
Flag determining if board graphic items should be outlined or stroked
Definition: pcb_painter.h:157
void RENDER_SETTINGS::update ( )
protectedvirtualinherited

Function update Precalculates extra colors for layers (e.g.

highlighted, darkened and any needed version of base colors).

Definition at line 53 of file painter.cpp.

References KIGFX::COLOR4D::Brightened(), KIGFX::COLOR4D::Darkened(), i, LAYER_ID_COUNT, KIGFX::RENDER_SETTINGS::m_hiContrastColor, KIGFX::RENDER_SETTINGS::m_hiContrastFactor, KIGFX::RENDER_SETTINGS::m_highlightFactor, KIGFX::RENDER_SETTINGS::m_layerColors, KIGFX::RENDER_SETTINGS::m_layerColorsDark, KIGFX::RENDER_SETTINGS::m_layerColorsHi, KIGFX::RENDER_SETTINGS::m_layerColorsSel, KIGFX::RENDER_SETTINGS::m_layerOpacity, and KIGFX::RENDER_SETTINGS::m_selectFactor.

Referenced by KIGFX::GERBVIEW_RENDER_SETTINGS::GERBVIEW_RENDER_SETTINGS(), KIGFX::GERBVIEW_RENDER_SETTINGS::ImportLegacyColors(), ImportLegacyColors(), KIGFX::RENDER_SETTINGS::IsBackgroundDark(), KIGFX::GERBVIEW_RENDER_SETTINGS::LoadDisplayOptions(), PCB_RENDER_SETTINGS(), KIGFX::GERBVIEW_RENDER_SETTINGS::SetLayerColor(), and KIGFX::RENDER_SETTINGS::SetLayerColor().

54 {
57 
58  // Calculate darkened/highlighted variants of layer colors
59  for( int i = 0; i < LAYER_ID_COUNT; i++ )
60  {
64  }
65 }
COLOR4D m_hiContrastColor
Color used for high contrast display mode.
Definition: painter.h:261
COLOR4D m_layerColorsHi[LAYER_ID_COUNT]
Colors for all layers (highlighted)
Definition: painter.h:251
COLOR4D m_layerColors[LAYER_ID_COUNT]
Colors for all layers (normal)
Definition: painter.h:248
float m_highlightFactor
Factor used for computing hightlight color.
Definition: painter.h:268
COLOR4D Brightened(double aFactor) const
Function Brightened Returns a color that is brighter by a given factor, without modifying object...
Definition: color4d.h:205
COLOR4D m_layerColorsDark[LAYER_ID_COUNT]
Colors for all layers (darkened)
Definition: painter.h:257
float m_layerOpacity
Determines opacity of all layers.
Definition: painter.h:271
#define LAYER_ID_COUNT
Must update this if you add any enums after GerbView!
float m_hiContrastFactor
Factor used for computing high contrast color.
Definition: painter.h:262
size_t i
Definition: json11.cpp:597
COLOR4D Darkened(double aFactor) const
Function Darkened Returns a color that is darker by a given factor, without modifying object...
Definition: color4d.h:221
float m_selectFactor
Specifies how color of selected items is changed.
Definition: painter.h:270
COLOR4D m_layerColorsSel[LAYER_ID_COUNT]
Colors for all layers (selected)
Definition: painter.h:254
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

Friends And Related Function Documentation

friend class PCB_PAINTER
friend

Definition at line 65 of file pcb_painter.h.

Member Data Documentation

std::set<unsigned int> KIGFX::RENDER_SETTINGS::m_activeLayers
protectedinherited
COLOR4D KIGFX::RENDER_SETTINGS::m_backgroundColor
protectedinherited
int KIGFX::PCB_RENDER_SETTINGS::m_clearance
protected

Clearance visibility settings

Definition at line 184 of file pcb_painter.h.

Referenced by KIGFX::PCB_PAINTER::draw(), LoadDisplayOptions(), and PCB_RENDER_SETTINGS().

DISPLAY_ZONE_MODE KIGFX::PCB_RENDER_SETTINGS::m_displayZone
protected

Option for different display modes for zones

Definition at line 181 of file pcb_painter.h.

Referenced by KIGFX::PCB_PAINTER::draw(), LoadDisplayOptions(), and PCB_RENDER_SETTINGS().

COLOR4D KIGFX::RENDER_SETTINGS::m_hiContrastColor
protectedinherited

Color used for high contrast display mode.

Definition at line 261 of file painter.h.

Referenced by KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), GetColor(), and KIGFX::RENDER_SETTINGS::update().

bool KIGFX::RENDER_SETTINGS::m_hiContrastEnabled
protectedinherited
float KIGFX::RENDER_SETTINGS::m_hiContrastFactor
protectedinherited

Factor used for computing high contrast color.

Definition at line 262 of file painter.h.

Referenced by KIGFX::RENDER_SETTINGS::RENDER_SETTINGS(), and KIGFX::RENDER_SETTINGS::update().

bool KIGFX::RENDER_SETTINGS::m_highlightEnabled
protectedinherited
float KIGFX::RENDER_SETTINGS::m_highlightFactor
protectedinherited

Factor used for computing hightlight color.

Definition at line 268 of file painter.h.

Referenced by KIGFX::RENDER_SETTINGS::RENDER_SETTINGS(), and KIGFX::RENDER_SETTINGS::update().

int KIGFX::RENDER_SETTINGS::m_highlightNetcode
protectedinherited

Net number that is displayed in highlight -1 means that there is no specific net, and whole active layer is highlighted.

Definition at line 265 of file painter.h.

Referenced by GetColor(), KIGFX::RENDER_SETTINGS::GetHighlightNetCode(), KIGFX::RENDER_SETTINGS::RENDER_SETTINGS(), and KIGFX::RENDER_SETTINGS::SetHighlight().

COLOR4D KIGFX::RENDER_SETTINGS::m_layerColorsDark[LAYER_ID_COUNT]
protectedinherited
COLOR4D KIGFX::RENDER_SETTINGS::m_layerColorsHi[LAYER_ID_COUNT]
protectedinherited
COLOR4D KIGFX::RENDER_SETTINGS::m_layerColorsSel[LAYER_ID_COUNT]
protectedinherited
float KIGFX::RENDER_SETTINGS::m_layerOpacity
protectedinherited

Determines opacity of all layers.

Definition at line 271 of file painter.h.

Referenced by KIGFX::RENDER_SETTINGS::RENDER_SETTINGS(), and KIGFX::RENDER_SETTINGS::update().

bool KIGFX::PCB_RENDER_SETTINGS::m_netNamesOnPads
protected

Flag determining if net names should be visible for pads

Definition at line 169 of file pcb_painter.h.

Referenced by KIGFX::PCB_PAINTER::draw(), LoadDisplayOptions(), and PCB_RENDER_SETTINGS().

bool KIGFX::PCB_RENDER_SETTINGS::m_netNamesOnTracks
protected

Flag determining if net names should be visible for tracks

Definition at line 172 of file pcb_painter.h.

Referenced by KIGFX::PCB_PAINTER::draw(), LoadDisplayOptions(), and PCB_RENDER_SETTINGS().

bool KIGFX::PCB_RENDER_SETTINGS::m_netNamesOnVias = true
protected

Flag determining if net names should be visible for vias

Definition at line 175 of file pcb_painter.h.

Referenced by KIGFX::PCB_PAINTER::draw().

bool KIGFX::PCB_RENDER_SETTINGS::m_padNumbers
protected

Flag determining if pad numbers should be visible

Definition at line 166 of file pcb_painter.h.

Referenced by KIGFX::PCB_PAINTER::draw(), LoadDisplayOptions(), and PCB_RENDER_SETTINGS().

float KIGFX::RENDER_SETTINGS::m_selectFactor
protectedinherited

Specifies how color of selected items is changed.

Definition at line 270 of file painter.h.

Referenced by KIGFX::RENDER_SETTINGS::RENDER_SETTINGS(), and KIGFX::RENDER_SETTINGS::update().

COLOR4D KIGFX::PCB_RENDER_SETTINGS::m_selectionCandidateColor
protected

Color used for highlighting selection candidates

Definition at line 187 of file pcb_painter.h.

Referenced by GetColor(), and PCB_RENDER_SETTINGS().

bool KIGFX::PCB_RENDER_SETTINGS::m_sketchBoardGfx
protected

Flag determining if board graphic items should be outlined or stroked

Definition at line 157 of file pcb_painter.h.

Referenced by KIGFX::PCB_PAINTER::draw(), LoadDisplayOptions(), PCB_RENDER_SETTINGS(), and SetSketchModeGraphicItems().

bool KIGFX::PCB_RENDER_SETTINGS::m_sketchFpGfx
protected

Flag determining if footprint graphic items should be outlined or stroked

Definition at line 160 of file pcb_painter.h.

Referenced by KIGFX::PCB_PAINTER::draw(), LoadDisplayOptions(), and PCB_RENDER_SETTINGS().

bool KIGFX::PCB_RENDER_SETTINGS::m_sketchFpTxtfx
protected

Flag determining if footprint text items should be outlined or stroked

Definition at line 163 of file pcb_painter.h.

Referenced by KIGFX::PCB_PAINTER::draw(), LoadDisplayOptions(), and PCB_RENDER_SETTINGS().

bool KIGFX::PCB_RENDER_SETTINGS::m_sketchMode[GAL_LAYER_ID_END]
protected

Flag determining if items on a given layer should be drawn as an outline or a filled item

Definition at line 154 of file pcb_painter.h.

Referenced by KIGFX::PCB_PAINTER::draw(), GetSketchMode(), LoadDisplayOptions(), PCB_RENDER_SETTINGS(), and SetSketchMode().

float KIGFX::RENDER_SETTINGS::m_worksheetLineWidth
protectedinherited

Line width used when drawing worksheet.

Definition at line 273 of file painter.h.

Referenced by KIGFX::RENDER_SETTINGS::GetWorksheetLineWidth(), and KIGFX::RENDER_SETTINGS::RENDER_SETTINGS().

const double PCB_RENDER_SETTINGS::MAX_FONT_SIZE = Millimeter2iu( 10.0 )
staticprotected

Maximum font size for netnames (and other dynamically shown strings)

Definition at line 178 of file pcb_painter.h.

Referenced by KIGFX::PCB_PAINTER::draw().


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