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 DISPLAY_OPTIONS *aOptions)
 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 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
 
const COLOR4DGetBackgroundColor () const
 Function GetBackgroundColor Returns current background color settings. More...
 
void SetBackgroundColor (const COLOR4D &aColor)
 Function SetBackgroundColor Sets new color for background. 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...
 

Protected Member Functions

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

Protected Attributes

bool m_sketchMode [TOTAL_LAYER_COUNT]
 

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_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...
 
DISPLAY_ZONE_MODE m_displayZone
 

Option for different display modes for zones

More...
 
int m_clearance
 

Clearance visibility settings

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

Colors for all layers (normal)

More...
 
COLOR4D m_layerColorsHi [TOTAL_LAYER_COUNT]
 

Colors for all layers (highlighted)

More...
 
COLOR4D m_layerColorsSel [TOTAL_LAYER_COUNT]
 

Colors for all layers (selected)

More...
 
COLOR4D m_layerColorsDark [TOTAL_LAYER_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...
 
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 45 of file pcb_painter.cpp.

References CL_NONE, DZ_SHOW_FILLED, KIGFX::RENDER_SETTINGS::m_backgroundColor, m_clearance, m_displayZone, m_netNamesOnPads, m_netNamesOnTracks, m_padNumbers, m_sketchBoardGfx, m_sketchFpGfx, m_sketchMode, TOTAL_LAYER_COUNT, and KIGFX::RENDER_SETTINGS::update().

46 {
47  m_backgroundColor = COLOR4D( 0.0, 0.0, 0.0, 1.0 );
48  m_padNumbers = true;
49  m_netNamesOnPads = true;
50  m_netNamesOnTracks = true;
53  m_sketchBoardGfx = false;
54  m_sketchFpGfx = false;
55 
56  // By default everything should be displayed as filled
57  for( unsigned int i = 0; i < TOTAL_LAYER_COUNT; ++i )
58  {
59  m_sketchMode[i] = false;
60  }
61 
62  update();
63 }
bool m_sketchMode[TOTAL_LAYER_COUNT]
Flag determining if items on a given layer should be drawn as an outline or a filled item ...
Definition: pcb_painter.h:131
bool m_padNumbers
Flag determining if pad numbers should be visible
Definition: pcb_painter.h:140
bool m_sketchBoardGfx
Flag determining if board graphic items should be outlined or stroked
Definition: pcb_painter.h:134
DISPLAY_ZONE_MODE m_displayZone
Option for different display modes for zones
Definition: pcb_painter.h:152
bool m_netNamesOnPads
Flag determining if net names should be visible for pads
Definition: pcb_painter.h:143
virtual void update()
Function update Precalculates extra colors for layers (e.g.
Definition: painter.cpp:52
bool m_sketchFpGfx
Flag determining if footprint graphic items should be outlined or stroked
Definition: pcb_painter.h:137
bool m_netNamesOnTracks
Flag determining if net names should be visible for tracks
Definition: pcb_painter.h:146
COLOR4D m_backgroundColor
The background color.
Definition: painter.h:261
int m_clearance
Clearance visibility settings
Definition: pcb_painter.h:155
#define TOTAL_LAYER_COUNT
number of all GAL layers including PCB and item layers
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 97 of file painter.h.

References KIGFX::RENDER_SETTINGS::m_activeLayers.

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

98  {
99  m_activeLayers.clear();
100  }
std::set< unsigned int > m_activeLayers
Stores active layers number.
Definition: painter.h:231
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 88 of file painter.h.

References KIGFX::RENDER_SETTINGS::m_activeLayers.

89  {
90  return m_activeLayers;
91  }
std::set< unsigned int > m_activeLayers
Stores active layers number.
Definition: painter.h:231
const COLOR4D& KIGFX::RENDER_SETTINGS::GetBackgroundColor ( ) const
inlineinherited

Function GetBackgroundColor Returns current background color settings.

Returns
Background color.

Definition at line 185 of file painter.h.

References KIGFX::RENDER_SETTINGS::m_backgroundColor.

Referenced by EDA_DRAW_PANEL_GAL::onPaint().

186  {
187  return m_backgroundColor;
188  }
COLOR4D m_backgroundColor
The background color.
Definition: painter.h:261
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 200 of file pcb_painter.cpp.

References EDA_ITEM::IsSelected(), 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, and KIGFX::RENDER_SETTINGS::m_layerColorsSel.

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

201 {
202  int netCode = -1;
203  const EDA_ITEM* item = static_cast<const EDA_ITEM*>( aItem );
204 
205  if( item )
206  {
207  if( item->IsSelected() )
208  {
209  return m_layerColorsSel[aLayer];
210  }
211 
212  // Try to obtain the netcode for the item
213  if( const BOARD_CONNECTED_ITEM* conItem = dyn_cast<const BOARD_CONNECTED_ITEM*> ( item ) )
214  netCode = conItem->GetNetCode();
215  }
216 
217  // Single net highlight mode
218  if( m_highlightEnabled && netCode == m_highlightNetcode )
219  return m_layerColorsHi[aLayer];
220 
221  // Return grayish color for non-highlighted layers in the high contrast mode
222  if( m_hiContrastEnabled && m_activeLayers.count( aLayer ) == 0 )
223  return m_hiContrastColor;
224 
225  // Catch the case when highlight and high-contraste modes are enabled
226  // and we are drawing a not highlighted track
227  if( m_highlightEnabled )
228  return m_layerColorsDark[aLayer];
229 
230  // No special modificators enabled
231  return m_layerColors[aLayer];
232 }
COLOR4D m_hiContrastColor
Color used for high contrast display mode.
Definition: painter.h:247
bool IsSelected() const
Definition: base_struct.h:221
bool m_highlightEnabled
Highlight display mode on/off.
Definition: painter.h:250
Class BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected an...
std::set< unsigned int > m_activeLayers
Stores active layers number.
Definition: painter.h:231
bool m_hiContrastEnabled
Parameters for display modes.
Definition: painter.h:246
COLOR4D m_layerColors[TOTAL_LAYER_COUNT]
Colors for all layers (normal)
Definition: painter.h:234
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:251
COLOR4D m_layerColorsDark[TOTAL_LAYER_COUNT]
Colors for all layers (darkened)
Definition: painter.h:243
COLOR4D m_layerColorsSel[TOTAL_LAYER_COUNT]
Colors for all layers (selected)
Definition: painter.h:240
COLOR4D m_layerColorsHi[TOTAL_LAYER_COUNT]
Colors for all layers (highlighted)
Definition: painter.h:237
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 160 of file painter.h.

References KIGFX::RENDER_SETTINGS::m_hiContrastEnabled.

Referenced by SELECTION_TOOL::selectable().

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

Function GetHighlightNetCode Returns netcode of currently highlighted net.

Returns
Netcode of currently highlighted net.

Definition at line 127 of file painter.h.

References KIGFX::RENDER_SETTINGS::m_highlightNetcode.

128  {
129  return m_highlightNetcode;
130  }
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:251
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 205 of file painter.h.

References KIGFX::RENDER_SETTINGS::m_layerColors.

Referenced by ROUTER_PREVIEW_ITEM::getLayerColor(), and EDA_DRAW_PANEL_GAL::onPaint().

206  {
207  return m_layerColors[aLayer];
208  }
COLOR4D m_layerColors[TOTAL_LAYER_COUNT]
Colors for all layers (normal)
Definition: painter.h:234
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.

Referenced by MODULE_EDITOR_TOOLS::ModuleEdgeOutlines(), and MODULE_EDITOR_TOOLS::ModuleTextOutlines().

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

Definition at line 175 of file painter.h.

References KIGFX::RENDER_SETTINGS::m_worksheetLineWidth.

176  {
177  return m_worksheetLineWidth;
178  }
float m_worksheetLineWidth
Line width used when drawing worksheet.
Definition: painter.h:259
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 66 of file pcb_painter.cpp.

References KIGFX::COLOR4D::a, LSET::AllCuMask(), ANCHOR_VISIBLE, B_SilkS, cu, DRC_VISIBLE, END_PCB_VISIBLE_LIST, F_SilkS, COLORS_DESIGN_SETTINGS::GetItemColor(), COLORS_DESIGN_SETTINGS::GetLayerColor(), GetNetnameLayer(), KIGFX::COLOR4D::Inverted(), ITEM_GAL_LAYER, LAYER_ID_COUNT, KIGFX::RENDER_SETTINGS::m_layerColors, MOD_TEXT_BK_VISIBLE, MOD_TEXT_FR_VISIBLE, NETNAMES_GAL_LAYER, PAD_BK_NETNAMES_VISIBLE, PAD_FR_NETNAMES_VISIBLE, PADS_HOLES_VISIBLE, PADS_NETNAMES_VISIBLE, PADS_VISIBLE, RATSNEST_VISIBLE, KIGFX::RENDER_SETTINGS::update(), VIA_BBLIND_VISIBLE, VIA_MICROVIA_VISIBLE, VIA_THROUGH_VISIBLE, VIAS_HOLES_VISIBLE, and WORKSHEET.

Referenced by PCB_DRAW_PANEL_GAL::UseColorScheme().

67 {
68  for( int i = 0; i < LAYER_ID_COUNT; i++ )
69  {
70  m_layerColors[i] = aSettings->GetLayerColor( i );
71  m_layerColors[i].a = 0.8; // slightly transparent
72  }
73 
74  for( int i = 0; i < END_PCB_VISIBLE_LIST; i++ )
75  m_layerColors[ITEM_GAL_LAYER( i )] = aSettings->GetItemColor( i );
76 
79 
80  // Default colors for specific layers
81  m_layerColors[ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE )] = COLOR4D( 0.5, 0.4, 0.0, 0.8 );
82  m_layerColors[ITEM_GAL_LAYER( PADS_HOLES_VISIBLE )] = COLOR4D( 0.0, 0.5, 0.5, 0.8 );
83  m_layerColors[ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE )] = COLOR4D( 0.6, 0.6, 0.6, 0.8 );
84  m_layerColors[ITEM_GAL_LAYER( VIA_BBLIND_VISIBLE )] = COLOR4D( 0.6, 0.6, 0.6, 0.8 );
85  m_layerColors[ITEM_GAL_LAYER( VIA_MICROVIA_VISIBLE )] = COLOR4D( 0.4, 0.4, 0.8, 0.8 );
86  m_layerColors[ITEM_GAL_LAYER( PADS_VISIBLE )] = COLOR4D( 0.6, 0.6, 0.6, 0.8 );
90  m_layerColors[ITEM_GAL_LAYER( ANCHOR_VISIBLE )] = COLOR4D( 0.3, 0.3, 1.0, 0.9 );
91  m_layerColors[ITEM_GAL_LAYER( WORKSHEET )] = COLOR4D( 0.5, 0.0, 0.0, 0.8 );
92  m_layerColors[ITEM_GAL_LAYER( DRC_VISIBLE )] = COLOR4D( 1.0, 0.0, 0.0, 0.8 );
93 
94  // Make ratsnest lines slightly transparent
96 
97  // Netnames for copper layers
98  for( LSEQ cu = LSET::AllCuMask().CuStack(); cu; ++cu )
99  {
100  const COLOR4D lightLabel( 0.8, 0.8, 0.8, 0.7 );
101  const COLOR4D darkLabel = lightLabel.Inverted();
102  LAYER_ID layer = *cu;
103 
104  if( m_layerColors[layer].GetBrightness() > 0.5 )
105  m_layerColors[GetNetnameLayer( layer )] = darkLabel;
106  else
107  m_layerColors[GetNetnameLayer( layer )] = lightLabel;
108  }
109 
110  update();
111 }
multilayer pads, usually with holes
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu LAYER_IDs.
Definition: lset.cpp:638
int GetNetnameLayer(int aLayer)
Returns a netname layer corresponding to the given layer.
#define cu(a)
Definition: auxiliary.h:88
COLOR4D GetItemColor(int aItemIdx) const
Function GetItemColor.
double a
Alpha component.
Definition: color4d.h:284
virtual void update()
Function update Precalculates extra colors for layers (e.g.
Definition: painter.cpp:52
COLOR4D m_layerColors[TOTAL_LAYER_COUNT]
Colors for all layers (normal)
Definition: painter.h:234
Class LSEQ is a sequence (and therefore also a set) of LAYER_IDs.
#define ITEM_GAL_LAYER(layer)
macro for obtaining layer number for specific item (eg. pad or text)
COLOR4D Inverted() const
Function Inverted Returns an inverted color, alpha remains the same.
Definition: color4d.h:244
LAYER_ID
Enum LAYER_ID is the set of PCB layers.
COLOR4D GetLayerColor(LAYER_NUM aLayer) const
Function GetLayerColor.
#define NETNAMES_GAL_LAYER(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 107 of file painter.h.

References KIGFX::RENDER_SETTINGS::m_activeLayers.

108  {
109  return ( m_activeLayers.count( aLayerId ) > 0 );
110  }
std::set< unsigned int > m_activeLayers
Stores active layers number.
Definition: painter.h:231
bool KIGFX::RENDER_SETTINGS::IsHighlightEnabled ( ) const
inlineinherited

Function IsHighlightEnabled Returns current highlight setting.

Returns
True if highlight is enabled, false otherwise.

Definition at line 117 of file painter.h.

References KIGFX::RENDER_SETTINGS::m_highlightEnabled.

118  {
119  return m_highlightEnabled;
120  }
bool m_highlightEnabled
Highlight display mode on/off.
Definition: painter.h:250
void PCB_RENDER_SETTINGS::LoadDisplayOptions ( const DISPLAY_OPTIONS aOptions)

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 114 of file pcb_painter.cpp.

References CL_EDITED, CL_EXISTING, CL_NEW, CL_NONE, CL_PADS, CL_TRACKS, CL_VIAS, DO_NOT_SHOW_CLEARANCE, DZ_HIDE_FILLED, DZ_SHOW_FILLED, DZ_SHOW_OUTLINED, ITEM_GAL_LAYER, m_clearance, DISPLAY_OPTIONS::m_ContrastModeDisplay, DISPLAY_OPTIONS::m_DisplayDrawItemsFill, DISPLAY_OPTIONS::m_DisplayModEdgeFill, DISPLAY_OPTIONS::m_DisplayNetNamesMode, DISPLAY_OPTIONS::m_DisplayPadFill, DISPLAY_OPTIONS::m_DisplayPadIsol, DISPLAY_OPTIONS::m_DisplayPadNum, DISPLAY_OPTIONS::m_DisplayPcbTrackFill, DISPLAY_OPTIONS::m_DisplayViaFill, m_displayZone, DISPLAY_OPTIONS::m_DisplayZonesMode, KIGFX::RENDER_SETTINGS::m_hiContrastEnabled, m_netNamesOnPads, m_netNamesOnTracks, m_padNumbers, DISPLAY_OPTIONS::m_ShowTrackClearanceMode, m_sketchBoardGfx, m_sketchFpGfx, m_sketchMode, PADS_VISIBLE, SHOW_CLEARANCE_ALWAYS, SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS, SHOW_CLEARANCE_NEW_TRACKS, SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS, TRACKS_VISIBLE, VIA_BBLIND_VISIBLE, VIA_MICROVIA_VISIBLE, and VIA_THROUGH_VISIBLE.

Referenced by PCB_BASE_FRAME::OnTogglePadDrawMode(), and DIALOG_DISPLAY_OPTIONS::TransferDataFromWindow().

115 {
116  if( aOptions == NULL )
117  return;
118 
120  m_padNumbers = aOptions->m_DisplayPadNum;
122  m_sketchFpGfx = !aOptions->m_DisplayModEdgeFill;
123 
124  // Whether to draw tracks, vias & pads filled or as outlines
130 
131  // Net names display settings
132  switch( aOptions->m_DisplayNetNamesMode )
133  {
134  case 0:
135  m_netNamesOnPads = false;
136  m_netNamesOnTracks = false;
137  break;
138 
139  case 1:
140  m_netNamesOnPads = true;
141  m_netNamesOnTracks = false;
142  break;
143 
144  case 2:
145  m_netNamesOnPads = false;
146  m_netNamesOnTracks = true;
147  break;
148 
149  case 3:
150  m_netNamesOnPads = true;
151  m_netNamesOnTracks = true;
152  break;
153  }
154 
155  // Zone display settings
156  switch( aOptions->m_DisplayZonesMode )
157  {
158  case 0:
160  break;
161 
162  case 1:
164  break;
165 
166  case 2:
168  break;
169  }
170 
171  // Clearance settings
172  switch( aOptions->m_ShowTrackClearanceMode )
173  {
176  break;
177 
180  break;
181 
184  break;
185 
188  break;
189 
192  break;
193  }
194 
195  if( aOptions->m_DisplayPadIsol )
196  m_clearance |= CL_PADS;
197 }
multilayer pads, usually with holes
bool m_sketchMode[TOTAL_LAYER_COUNT]
Flag determining if items on a given layer should be drawn as an outline or a filled item ...
Definition: pcb_painter.h:131
bool m_padNumbers
Flag determining if pad numbers should be visible
Definition: pcb_painter.h:140
bool m_sketchBoardGfx
Flag determining if board graphic items should be outlined or stroked
Definition: pcb_painter.h:134
bool m_DisplayModEdgeFill
Definition: pcbstruct.h:69
DISPLAY_ZONE_MODE m_displayZone
Option for different display modes for zones
Definition: pcb_painter.h:152
bool m_netNamesOnPads
Flag determining if net names should be visible for pads
Definition: pcb_painter.h:143
bool m_DisplayPcbTrackFill
Definition: pcbstruct.h:71
bool m_hiContrastEnabled
Parameters for display modes.
Definition: painter.h:246
bool m_ContrastModeDisplay
Definition: pcbstruct.h:85
bool m_DisplayDrawItemsFill
Definition: pcbstruct.h:84
int m_DisplayZonesMode
Definition: pcbstruct.h:77
bool m_sketchFpGfx
Flag determining if footprint graphic items should be outlined or stroked
Definition: pcb_painter.h:137
TRACE_CLEARANCE_DISPLAY_MODE_T m_ShowTrackClearanceMode
How trace clearances are displayed.
Definition: pcbstruct.h:74
bool m_DisplayPadFill
Definition: pcbstruct.h:65
#define ITEM_GAL_LAYER(layer)
macro for obtaining layer number for specific item (eg. pad or text)
bool m_netNamesOnTracks
Flag determining if net names should be visible for tracks
Definition: pcb_painter.h:146
bool m_DisplayPadIsol
Definition: pcbstruct.h:68
int m_clearance
Clearance visibility settings
Definition: pcb_painter.h:155
bool m_DisplayPadNum
Definition: pcbstruct.h:67
int m_DisplayNetNamesMode
Definition: pcbstruct.h:78
bool m_DisplayViaFill
Definition: pcbstruct.h:66
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.

Definition at line 75 of file painter.h.

References KIGFX::RENDER_SETTINGS::m_activeLayers.

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

76  {
77  if( aEnabled )
78  m_activeLayers.insert( aLayerId );
79  else
80  m_activeLayers.erase( aLayerId );
81  }
std::set< unsigned int > m_activeLayers
Stores active layers number.
Definition: painter.h:231
void KIGFX::RENDER_SETTINGS::SetBackgroundColor ( const COLOR4D aColor)
inlineinherited

Function SetBackgroundColor Sets new color for background.

Parameters
aColoris the new background color.

Definition at line 195 of file painter.h.

References KIGFX::RENDER_SETTINGS::m_backgroundColor.

196  {
197  m_backgroundColor = aColor;
198  }
COLOR4D m_backgroundColor
The background color.
Definition: painter.h:261
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 150 of file painter.h.

References KIGFX::RENDER_SETTINGS::m_hiContrastEnabled.

151  {
152  m_hiContrastEnabled = aEnabled;
153  }
bool m_hiContrastEnabled
Parameters for display modes.
Definition: painter.h:246
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 139 of file painter.h.

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

Referenced by PNS::TOOL_BASE::highlightNet(), PCB_EDITOR_CONTROL::HighlightNet(), PCB_EDIT_FRAME::ListNetsAndSelect(), and SELECTION_TOOL::Reset().

140  {
141  m_highlightEnabled = aEnabled;
142  m_highlightNetcode = aEnabled ? aNetcode : -1;
143  }
bool m_highlightEnabled
Highlight display mode on/off.
Definition: painter.h:250
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:251
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 216 of file painter.h.

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

217  {
218  m_layerColors[aLayer] = aColor;
219 
220  update(); // recompute other shades of the color
221  }
virtual void update()
Function update Precalculates extra colors for layers (e.g.
Definition: painter.cpp:52
COLOR4D m_layerColors[TOTAL_LAYER_COUNT]
Colors for all layers (normal)
Definition: painter.h:234
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 MODULE_EDITOR_TOOLS::ModuleEdgeOutlines(), and MODULE_EDITOR_TOOLS::ModuleTextOutlines().

115  {
116  m_sketchMode[aItemLayer] = aEnabled;
117  }
bool m_sketchMode[TOTAL_LAYER_COUNT]
Flag determining if items on a given layer should be drawn as an outline or a filled item ...
Definition: pcb_painter.h:131
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 52 of file painter.cpp.

References KIGFX::COLOR4D::Brightened(), KIGFX::COLOR4D::Darkened(), 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, KIGFX::RENDER_SETTINGS::m_selectFactor, and TOTAL_LAYER_COUNT.

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

53 {
56 
57  // Calculate darkened/highlighted variants of layer colors
58  for( int i = 0; i < TOTAL_LAYER_COUNT; i++ )
59  {
63  }
64 }
COLOR4D m_hiContrastColor
Color used for high contrast display mode.
Definition: painter.h:247
float m_highlightFactor
Factor used for computing hightlight color.
Definition: painter.h:254
COLOR4D Brightened(double aFactor) const
Function Brightened Returns a color that is brighter by a given factor, without modifying object...
Definition: color4d.h:200
COLOR4D m_layerColors[TOTAL_LAYER_COUNT]
Colors for all layers (normal)
Definition: painter.h:234
float m_layerOpacity
Determines opacity of all layers.
Definition: painter.h:257
float m_hiContrastFactor
Factor used for computing high contrast color.
Definition: painter.h:248
#define TOTAL_LAYER_COUNT
number of all GAL layers including PCB and item layers
COLOR4D Darkened(double aFactor) const
Function Darkened Returns a color that is darker by a given factor, without modifying object...
Definition: color4d.h:216
COLOR4D m_layerColorsDark[TOTAL_LAYER_COUNT]
Colors for all layers (darkened)
Definition: painter.h:243
float m_selectFactor
Specifies how color of selected items is changed.
Definition: painter.h:256
COLOR4D m_layerColorsSel[TOTAL_LAYER_COUNT]
Colors for all layers (selected)
Definition: painter.h:240
COLOR4D m_layerColorsHi[TOTAL_LAYER_COUNT]
Colors for all layers (highlighted)
Definition: painter.h:237
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 155 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 152 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 247 of file painter.h.

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

bool KIGFX::RENDER_SETTINGS::m_hiContrastEnabled
protectedinherited

Parameters for display modes.

High contrast display mode on/off

Definition at line 246 of file painter.h.

Referenced by GetColor(), KIGFX::RENDER_SETTINGS::GetHighContrast(), LoadDisplayOptions(), KIGFX::RENDER_SETTINGS::RENDER_SETTINGS(), and KIGFX::RENDER_SETTINGS::SetHighContrast().

float KIGFX::RENDER_SETTINGS::m_hiContrastFactor
protectedinherited

Factor used for computing high contrast color.

Definition at line 248 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 254 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 251 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_layerColors[TOTAL_LAYER_COUNT]
protectedinherited
COLOR4D KIGFX::RENDER_SETTINGS::m_layerColorsDark[TOTAL_LAYER_COUNT]
protectedinherited

Colors for all layers (darkened)

Definition at line 243 of file painter.h.

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

COLOR4D KIGFX::RENDER_SETTINGS::m_layerColorsHi[TOTAL_LAYER_COUNT]
protectedinherited

Colors for all layers (highlighted)

Definition at line 237 of file painter.h.

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

COLOR4D KIGFX::RENDER_SETTINGS::m_layerColorsSel[TOTAL_LAYER_COUNT]
protectedinherited

Colors for all layers (selected)

Definition at line 240 of file painter.h.

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

float KIGFX::RENDER_SETTINGS::m_layerOpacity
protectedinherited

Determines opacity of all layers.

Definition at line 257 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 143 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 146 of file pcb_painter.h.

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

float KIGFX::RENDER_SETTINGS::m_outlineWidth
protectedinherited

Line width used when drawing outlines.

Definition at line 258 of file painter.h.

Referenced by KIGFX::PCB_PAINTER::draw(), KIGFX::PCB_PAINTER::getLineThickness(), and KIGFX::RENDER_SETTINGS::RENDER_SETTINGS().

bool KIGFX::PCB_RENDER_SETTINGS::m_padNumbers
protected

Flag determining if pad numbers should be visible

Definition at line 140 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 256 of file painter.h.

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

bool KIGFX::PCB_RENDER_SETTINGS::m_sketchBoardGfx
protected

Flag determining if board graphic items should be outlined or stroked

Definition at line 134 of file pcb_painter.h.

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

bool KIGFX::PCB_RENDER_SETTINGS::m_sketchFpGfx
protected

Flag determining if footprint graphic items should be outlined or stroked

Definition at line 137 of file pcb_painter.h.

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

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

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

Definition at line 131 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 259 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 149 of file pcb_painter.h.

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


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