KiCad PCB EDA Suite
KIGFX::RENDER_SETTINGS Class Referenceabstract

RENDER_SETTINGS Contains all the knowledge about how graphical objects are drawn on any output surface/device. More...

#include <render_settings.h>

Inheritance diagram for KIGFX::RENDER_SETTINGS:
KIGFX::GERBVIEW_RENDER_SETTINGS KIGFX::PCB_RENDER_SETTINGS KIGFX::SCH_RENDER_SETTINGS KIGFX::WS_RENDER_SETTINGS

Public Member Functions

 RENDER_SETTINGS ()
 
virtual ~RENDER_SETTINGS ()
 
virtual void LoadColors (const COLOR_SETTINGS *aSettings)
 
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 () const
 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...
 
const std::set< int > & GetHighlightNetCodes () const
 Function GetHighlightNetCode Returns netcode of currently highlighted net. More...
 
void SetHighlight (bool aEnabled, int aNetcode=-1, bool aMulti=false)
 Function SetHighlight Turns on/off highlighting - it may be done for the active layer or the specified net(s). More...
 
void SetHighContrast (bool aEnabled)
 Function SetHighContrast Turns on/off high contrast display mode. More...
 
bool GetHighContrast () const
 
virtual const COLOR4DGetColor (const VIEW_ITEM *aItem, int aLayer) const =0
 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...
 
float GetWorksheetLineWidth () const
 
int GetDefaultPenWidth () const
 
void SetDefaultPenWidth (int aWidth)
 
bool GetShowPageLimits () const
 
void SetShowPageLimits (bool aDraw)
 
virtual const COLOR4DGetBackgroundColor ()=0
 Function GetBackgroundColor Returns current background color settings. More...
 
virtual void SetBackgroundColor (const COLOR4D &aColor)=0
 Sets the background color. More...
 
virtual const COLOR4DGetGridColor ()=0
 Function GetGridColor Returns current grid color settings. More...
 
virtual const COLOR4DGetCursorColor ()=0
 Function GetCursorColor Returns current cursor color settings. More...
 
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...
 
virtual bool IsBackgroundDark () const
 
void SetOutlineWidth (float aWidth)
 Set line width used for drawing outlines. More...
 
wxDC * GetPrintDC ()
 
void SetPrintDC (wxDC *aDC)
 

Protected Member Functions

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

Protected Attributes

std::set< unsigned int > m_activeLayers
 Stores active layers number. More...
 
COLOR4D m_layerColors [LAYER_ID_COUNT]
 
COLOR4D m_layerColorsHi [LAYER_ID_COUNT]
 
COLOR4D m_layerColorsSel [LAYER_ID_COUNT]
 
COLOR4D m_hiContrastColor [LAYER_ID_COUNT]
 
COLOR4D m_layerColorsDark [LAYER_ID_COUNT]
 
COLOR4D m_backgroundColor
 
bool m_hiContrastEnabled
 Parameters for display modes. More...
 
float m_hiContrastFactor
 
bool m_highlightEnabled
 
std::set< int > m_highlightNetcodes
 
float m_highlightFactor
 
float m_selectFactor
 
float m_outlineWidth
 
float m_worksheetLineWidth
 
int m_defaultPenWidth
 
bool m_showPageLimits
 
wxDC * m_printDC
 

Detailed Description

RENDER_SETTINGS Contains all the knowledge about how graphical objects are drawn on any output surface/device.

This includes:

  • color/transparency settings
  • highlighting and high contrast mode control
  • drawing quality control (sketch/outline mode)
  • text processing flags The class acts as an interface between the PAINTER object and the GUI (i.e. Layers/Items widget or display options dialog).

Definition at line 52 of file render_settings.h.

Constructor & Destructor Documentation

◆ RENDER_SETTINGS()

RENDER_SETTINGS::RENDER_SETTINGS ( )

Definition at line 29 of file render_settings.cpp.

29  :
31  m_printDC( nullptr )
32 {
33  // Set the default initial values
34  m_highlightFactor = 0.5f;
35  m_selectFactor = 0.5f;
36  m_highlightEnabled = false;
37  m_hiContrastEnabled = false;
38  m_hiContrastFactor = 0.2f; //TODO: Make this user-configurable
39  m_outlineWidth = 1;
40  m_worksheetLineWidth = 100000;
42  m_showPageLimits = false;
43 }
bool m_hiContrastEnabled
Parameters for display modes.
std::set< int > m_highlightNetcodes

References m_defaultPenWidth, m_hiContrastEnabled, m_hiContrastFactor, m_highlightEnabled, m_highlightFactor, m_outlineWidth, m_selectFactor, m_showPageLimits, and m_worksheetLineWidth.

◆ ~RENDER_SETTINGS()

RENDER_SETTINGS::~RENDER_SETTINGS ( )
virtual

Definition at line 46 of file render_settings.cpp.

47 {
48 }

Member Function Documentation

◆ ClearActiveLayers()

void KIGFX::RENDER_SETTINGS::ClearActiveLayers ( )
inline

Function ClearActiveLayers Clears the list of active layers.

Definition at line 89 of file render_settings.h.

90  {
91  m_activeLayers.clear();
92  }
std::set< unsigned int > m_activeLayers
Stores active layers number.

References m_activeLayers.

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

◆ GetActiveLayers()

const std::set<unsigned int> KIGFX::RENDER_SETTINGS::GetActiveLayers ( ) const
inline

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

Returns
The set of currently active layers.

Definition at line 80 of file render_settings.h.

81  {
82  return m_activeLayers;
83  }
std::set< unsigned int > m_activeLayers
Stores active layers number.

References m_activeLayers.

Referenced by GRID_HELPER::computeAnchors(), PNS_KICAD_IFACE::IsItemVisible(), GRID_HELPER::queryVisible(), and SELECTION_TOOL::Selectable().

◆ GetBackgroundColor()

virtual const COLOR4D& KIGFX::RENDER_SETTINGS::GetBackgroundColor ( )
pure virtual

Function GetBackgroundColor Returns current background color settings.

Implemented in KIGFX::PCB_RENDER_SETTINGS, KIGFX::SCH_RENDER_SETTINGS, KIGFX::GERBVIEW_RENDER_SETTINGS, and KIGFX::WS_RENDER_SETTINGS.

Referenced by EDA_DRAW_PANEL_GAL::onPaint(), and DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF().

◆ GetColor()

virtual const COLOR4D& KIGFX::RENDER_SETTINGS::GetColor ( const VIEW_ITEM aItem,
int  aLayer 
) const
pure virtual

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.

Implemented in KIGFX::PCB_RENDER_SETTINGS, KIGFX::SCH_RENDER_SETTINGS, KIGFX::GERBVIEW_RENDER_SETTINGS, and KIGFX::WS_RENDER_SETTINGS.

Referenced by KIGFX::VIEW::updateItemsColor::operator()(), KIGFX::VIEW::UpdateAllLayersColor(), and KIGFX::VIEW::updateItemColor().

◆ GetCursorColor()

virtual const COLOR4D& KIGFX::RENDER_SETTINGS::GetCursorColor ( )
pure virtual

Function GetCursorColor Returns current cursor color settings.

Implemented in KIGFX::PCB_RENDER_SETTINGS, KIGFX::SCH_RENDER_SETTINGS, KIGFX::GERBVIEW_RENDER_SETTINGS, and KIGFX::WS_RENDER_SETTINGS.

Referenced by EDA_DRAW_PANEL_GAL::onPaint().

◆ GetDefaultPenWidth()

◆ GetGridColor()

virtual const COLOR4D& KIGFX::RENDER_SETTINGS::GetGridColor ( )
pure virtual

Function GetGridColor Returns current grid color settings.

Implemented in KIGFX::PCB_RENDER_SETTINGS, KIGFX::SCH_RENDER_SETTINGS, KIGFX::GERBVIEW_RENDER_SETTINGS, and KIGFX::WS_RENDER_SETTINGS.

Referenced by EDA_DRAW_PANEL_GAL::onPaint().

◆ GetHighContrast()

bool KIGFX::RENDER_SETTINGS::GetHighContrast ( ) const
inline

◆ GetHighlightNetCodes()

const std::set<int>& KIGFX::RENDER_SETTINGS::GetHighlightNetCodes ( ) const
inline

Function GetHighlightNetCode Returns netcode of currently highlighted net.

Returns
Netcode of currently highlighted net.

Definition at line 119 of file render_settings.h.

120  {
121  return m_highlightNetcodes;
122  }
std::set< int > m_highlightNetcodes

References m_highlightNetcodes.

Referenced by PNS::TOOL_BASE::highlightNet().

◆ GetLayerColor()

const COLOR4D& KIGFX::RENDER_SETTINGS::GetLayerColor ( int  aLayer) const
inline

Function GetLayerColor Returns the color used to draw a layer.

Parameters
aLayeris the layer number.

Definition at line 199 of file render_settings.h.

200  {
201  return m_layerColors[aLayer];
202  }
COLOR4D m_layerColors[LAYER_ID_COUNT]

References m_layerColors.

Referenced by DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), KIGFX::SCH_PAINTER::draw(), KIGFX::PREVIEW::DRAW_CONTEXT::DrawArcWithAngleHighlight(), KIGFX::PREVIEW::DRAW_CONTEXT::DrawCircle(), KIGFX::PREVIEW::DRAW_CONTEXT::DrawLine(), KIGFX::PREVIEW::DRAW_CONTEXT::DrawLineWithAngleHighlight(), KIGFX::SCH_PAINTER::getRenderColor(), LIB_CIRCLE::Plot(), LIB_RECTANGLE::Plot(), LIB_BEZIER::Plot(), LIB_TEXT::Plot(), LIB_ARC::Plot(), LIB_POLYLINE::Plot(), SCH_NO_CONNECT::Plot(), SCH_BITMAP::Plot(), LIB_FIELD::Plot(), SCH_FIELD::Plot(), LIB_PART::Plot(), SCH_TEXT::Plot(), SCH_SHEET::Plot(), LIB_PART::PlotLibFields(), DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF(), DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF(), DIALOG_PLOT_SCHEMATIC::plotOneSheetPS(), DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG(), LIB_PIN::PlotPinTexts(), LIB_PIN::PlotSymbol(), LIB_POLYLINE::print(), LIB_RECTANGLE::print(), LIB_TEXT::print(), LIB_ARC::print(), SCH_JUNCTION::Print(), LIB_FIELD::print(), SCH_NO_CONNECT::Print(), SCH_BUS_ENTRY_BASE::Print(), LIB_BEZIER::print(), LIB_CIRCLE::print(), SCH_FIELD::Print(), SCH_LINE::Print(), SCH_TEXT::Print(), SCH_GLOBALLABEL::Print(), SCH_HIERLABEL::Print(), LIB_PIN::PrintPinElectricalTypeName(), LIB_PIN::PrintPinSymbol(), LIB_PIN::PrintPinTexts(), WS_DRAW_ITEM_LINE::PrintWsItem(), WS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem(), WS_DRAW_ITEM_RECT::PrintWsItem(), WS_DRAW_ITEM_TEXT::PrintWsItem(), KIGFX::WS_PROXY_VIEW_ITEM::ViewDraw(), and EDIT_POINTS::ViewDraw().

◆ GetPrintDC()

◆ GetShowPageLimits()

bool KIGFX::RENDER_SETTINGS::GetShowPageLimits ( ) const
inline

Definition at line 168 of file render_settings.h.

168 { return m_showPageLimits; }

References m_showPageLimits.

Referenced by KIGFX::WS_PROXY_VIEW_ITEM::ViewDraw().

◆ GetWorksheetLineWidth()

float KIGFX::RENDER_SETTINGS::GetWorksheetLineWidth ( ) const
inline

Definition at line 163 of file render_settings.h.

163 { return m_worksheetLineWidth; }

References m_worksheetLineWidth.

Referenced by KIGFX::WS_PROXY_VIEW_ITEM::buildDrawList().

◆ IsActiveLayer()

bool KIGFX::RENDER_SETTINGS::IsActiveLayer ( int  aLayerId) const
inline

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 99 of file render_settings.h.

100  {
101  return ( m_activeLayers.count( aLayerId ) > 0 );
102  }
std::set< unsigned int > m_activeLayers
Stores active layers number.

References m_activeLayers.

◆ IsBackgroundDark()

virtual bool KIGFX::RENDER_SETTINGS::IsBackgroundDark ( ) const
inlinevirtual

◆ IsHighlightEnabled()

bool KIGFX::RENDER_SETTINGS::IsHighlightEnabled ( ) const
inline

Function IsHighlightEnabled Returns current highlight setting.

Returns
True if highlight is enabled, false otherwise.

Definition at line 109 of file render_settings.h.

110  {
111  return m_highlightEnabled;
112  }

References m_highlightEnabled.

Referenced by PCB_EDIT_FRAME::ExecuteRemoteCommand(), and PNS::TOOL_BASE::highlightNet().

◆ LoadColors()

◆ SetActiveLayer()

void KIGFX::RENDER_SETTINGS::SetActiveLayer ( int  aLayerId,
bool  aEnabled = true 
)
inline

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 67 of file render_settings.h.

68  {
69  if( aEnabled )
70  m_activeLayers.insert( aLayerId );
71  else
72  m_activeLayers.erase( aLayerId );
73  }
std::set< unsigned int > m_activeLayers
Stores active layers number.

References m_activeLayers.

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

◆ SetBackgroundColor()

virtual void KIGFX::RENDER_SETTINGS::SetBackgroundColor ( const COLOR4D aColor)
pure virtual

◆ SetDefaultPenWidth()

◆ SetHighContrast()

void KIGFX::RENDER_SETTINGS::SetHighContrast ( bool  aEnabled)
inline

Function SetHighContrast Turns on/off high contrast display mode.

Definition at line 150 of file render_settings.h.

150 { m_hiContrastEnabled = aEnabled; }
bool m_hiContrastEnabled
Parameters for display modes.

References m_hiContrastEnabled.

◆ SetHighlight()

void KIGFX::RENDER_SETTINGS::SetHighlight ( bool  aEnabled,
int  aNetcode = -1,
bool  aMulti = false 
)
inline

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

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 131 of file render_settings.h.

132  {
133  m_highlightEnabled = aEnabled;
134 
135  if( aEnabled )
136  {
137  if( !aMulti )
138  m_highlightNetcodes.clear();
139 
140  m_highlightNetcodes.insert( aNetcode );
141  }
142  else
143  m_highlightNetcodes.clear();
144  }
std::set< int > m_highlightNetcodes

References m_highlightEnabled, and m_highlightNetcodes.

Referenced by PCB_EDIT_FRAME::ExecuteRemoteCommand(), PNS::TOOL_BASE::highlightNet(), DIALOG_SELECT_NET_FROM_LIST::highlightNetOnBoard(), GERBVIEW_SELECTION_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), and SELECTION_TOOL::Reset().

◆ SetLayerColor()

void KIGFX::RENDER_SETTINGS::SetLayerColor ( int  aLayer,
const COLOR4D aColor 
)
inline

Function SetLayerColor Changes the color used to draw a layer.

Parameters
aLayeris the layer number.
aColoris the new color.

Definition at line 210 of file render_settings.h.

211  {
212  m_layerColors[aLayer] = aColor;
213 
214  update(); // recompute other shades of the color
215  }
COLOR4D m_layerColors[LAYER_ID_COUNT]
virtual void update()
Function update Precalculates extra colors for layers (e.g.

References m_layerColors, and update().

Referenced by PLEDITOR_PRINTOUT::PrintPage(), DIALOG_PAD_PROPERTIES::redraw(), PCBNEW_PRINTOUT::setupPainter(), and DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample().

◆ SetOutlineWidth()

void KIGFX::RENDER_SETTINGS::SetOutlineWidth ( float  aWidth)
inline

Set line width used for drawing outlines.

Parameters
aWidthis the new width.

Definition at line 227 of file render_settings.h.

228  {
229  m_outlineWidth = aWidth;
230  }

References m_outlineWidth.

◆ SetPrintDC()

◆ SetShowPageLimits()

void KIGFX::RENDER_SETTINGS::SetShowPageLimits ( bool  aDraw)
inline

◆ update()

void RENDER_SETTINGS::update ( )
protectedvirtual

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

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

Definition at line 51 of file render_settings.cpp.

52 {
53  // Calculate darkened/highlighted variants of layer colors
54  for( int i = 0; i < LAYER_ID_COUNT; i++ )
55  {
61  }
62 }
COLOR4D m_layerColorsHi[LAYER_ID_COUNT]
COLOR4D m_layerColors[LAYER_ID_COUNT]
COLOR4D Darkened(double aFactor) const
Function Darkened Returns a color that is darker by a given factor, without modifying object.
Definition: color4d.h:275
COLOR4D m_hiContrastColor[LAYER_ID_COUNT]
COLOR4D Brightened(double aFactor) const
Function Brightened Returns a color that is brighter by a given factor, without modifying object.
Definition: color4d.h:259
COLOR4D m_layerColorsDark[LAYER_ID_COUNT]
#define LAYER_ID_COUNT
Must update this if you add any enums after GerbView!
COLOR4D Mix(const COLOR4D &aColor, double aFactor) const
Function Mix Returns a color that is mixed with the input by a factor.
Definition: color4d.h:291
COLOR4D m_layerColorsSel[LAYER_ID_COUNT]

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

Referenced by KIGFX::GERBVIEW_RENDER_SETTINGS::GERBVIEW_RENDER_SETTINGS(), KIGFX::GERBVIEW_RENDER_SETTINGS::LoadColors(), KIGFX::PCB_RENDER_SETTINGS::LoadColors(), KIGFX::GERBVIEW_RENDER_SETTINGS::LoadDisplayOptions(), KIGFX::PCB_RENDER_SETTINGS::PCB_RENDER_SETTINGS(), KIGFX::GERBVIEW_RENDER_SETTINGS::SetLayerColor(), SetLayerColor(), and KIGFX::WS_RENDER_SETTINGS::WS_RENDER_SETTINGS().

Member Data Documentation

◆ m_activeLayers

std::set<unsigned int> KIGFX::RENDER_SETTINGS::m_activeLayers
protected

◆ m_backgroundColor

◆ m_defaultPenWidth

int KIGFX::RENDER_SETTINGS::m_defaultPenWidth
protected

Definition at line 267 of file render_settings.h.

Referenced by GetDefaultPenWidth(), RENDER_SETTINGS(), and SetDefaultPenWidth().

◆ m_hiContrastColor

COLOR4D KIGFX::RENDER_SETTINGS::m_hiContrastColor[LAYER_ID_COUNT]
protected

◆ m_hiContrastEnabled

◆ m_hiContrastFactor

float KIGFX::RENDER_SETTINGS::m_hiContrastFactor
protected

Definition at line 257 of file render_settings.h.

Referenced by RENDER_SETTINGS(), and update().

◆ m_highlightEnabled

bool KIGFX::RENDER_SETTINGS::m_highlightEnabled
protected

◆ m_highlightFactor

float KIGFX::RENDER_SETTINGS::m_highlightFactor
protected

Definition at line 261 of file render_settings.h.

Referenced by RENDER_SETTINGS(), and update().

◆ m_highlightNetcodes

std::set<int> KIGFX::RENDER_SETTINGS::m_highlightNetcodes
protected

◆ m_layerColors

◆ m_layerColorsDark

◆ m_layerColorsHi

◆ m_layerColorsSel

◆ m_outlineWidth

◆ m_printDC

wxDC* KIGFX::RENDER_SETTINGS::m_printDC
protected

Definition at line 270 of file render_settings.h.

Referenced by GetPrintDC(), and SetPrintDC().

◆ m_selectFactor

float KIGFX::RENDER_SETTINGS::m_selectFactor
protected

Definition at line 263 of file render_settings.h.

Referenced by RENDER_SETTINGS(), and update().

◆ m_showPageLimits

◆ m_worksheetLineWidth

float KIGFX::RENDER_SETTINGS::m_worksheetLineWidth
protected

Definition at line 265 of file render_settings.h.

Referenced by GetWorksheetLineWidth(), and RENDER_SETTINGS().


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