KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_render_settings.cpp
Go to the documentation of this file.
1
/*
2
* This program source code file is part of KiCad, a free EDA CAD application.
3
*
4
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <https://www.gnu.org/licenses/>.
18
*/
19
20
#include <
pgm_base.h
>
21
#include <
kiface_base.h
>
22
#include <
advanced_config.h
>
23
#include <
settings/color_settings.h
>
24
#include <
settings/settings_manager.h
>
25
#include <
eeschema_settings.h
>
26
#include <
default_values.h
>
27
#include <
sch_render_settings.h
>
28
29
30
SCH_RENDER_SETTINGS::SCH_RENDER_SETTINGS
() :
31
m_IsSymbolEditor
( false ),
32
m_ShowUnit
( 0 ),
33
m_ShowBodyStyle
( 0 ),
34
m_ShowPinsElectricalType
( true ),
35
m_ShowHiddenPins
( true ),
36
m_ShowHiddenFields
( true ),
37
m_ShowVisibleFields
( true ),
38
m_ShowPinNumbers
( false ),
39
m_ShowPinNames
( false ),
40
m_ShowPinAltIcons
( false ),
41
m_ShowDisabled
( false ),
42
m_ShowGraphicsDisabled
( false ),
43
m_ShowConnectionPoints
( false ),
44
m_OverrideItemColors
( false ),
45
m_LabelSizeRatio
(
DEFAULT_LABEL_SIZE_RATIO
),
46
m_TextOffsetRatio
(
DEFAULT_TEXT_OFFSET_RATIO
),
47
m_PinSymbolSize
(
DEFAULT_TEXT_SIZE
*
schIUScale
.
IU_PER_MILS
/ 2 ),
48
m_SymbolLineWidth
(
DEFAULT_LINE_WIDTH_MILS
*
schIUScale
.
IU_PER_MILS
),
49
m_Transform
()
50
{
51
SetDefaultPenWidth
(
DEFAULT_LINE_WIDTH_MILS
*
schIUScale
.IU_PER_MILS );
52
SetDashLengthRatio
( 12 );
// From ISO 128-2
53
SetGapLengthRatio
( 3 );
// From ISO 128-2
54
55
m_minPenWidth
=
KiROUND
(
ADVANCED_CFG::GetCfg
().m_MinPlotPenWidth *
schIUScale
.IU_PER_MM );
56
}
57
58
59
void
SCH_RENDER_SETTINGS::LoadColors
(
const
COLOR_SETTINGS
* aSettings )
60
{
61
for
(
int
layer =
SCH_LAYER_ID_START
; layer <
SCH_LAYER_ID_END
; layer ++)
62
m_layerColors
[ layer ] = aSettings->
GetColor
( layer );
63
64
for
(
int
layer =
GAL_LAYER_ID_START
; layer <
GAL_LAYER_ID_END
; layer ++)
65
m_layerColors
[ layer ] = aSettings->
GetColor
( layer );
66
67
m_backgroundColor
= aSettings->
GetColor
(
LAYER_SCHEMATIC_BACKGROUND
);
68
69
m_layerColors
[
LAYER_AUX_ITEMS
] =
m_layerColors
[
LAYER_SCHEMATIC_AUX_ITEMS
];
70
71
m_OverrideItemColors
= aSettings->
GetOverrideSchItemColors
();
72
}
73
74
75
bool
SCH_RENDER_SETTINGS::GetShowPageLimits
()
const
76
{
77
EESCHEMA_SETTINGS
* cfg =
dynamic_cast<
EESCHEMA_SETTINGS
*
>
(
Kiface
().
KifaceSettings
() );
78
return
cfg && cfg->
m_Appearance
.
show_page_limits
&& !
IsPrinting
();
79
}
80
advanced_config.h
schIUScale
constexpr EDA_IU_SCALE schIUScale
Definition
base_units.h:123
Kiface
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
Definition
bitmap2cmp_main.cpp:69
KiROUND
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition
box2.h:986
ADVANCED_CFG::GetCfg
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
Definition
advanced_config.cpp:368
COLOR_SETTINGS
Color settings are a bit different than most of the settings objects in that there can be more than o...
Definition
color_settings.h:52
COLOR_SETTINGS::GetOverrideSchItemColors
bool GetOverrideSchItemColors() const
Definition
color_settings.h:78
COLOR_SETTINGS::GetColor
COLOR4D GetColor(int aLayer) const
Definition
color_settings.cpp:410
EESCHEMA_SETTINGS
Definition
eeschema_settings.h:59
EESCHEMA_SETTINGS::m_Appearance
APPEARANCE m_Appearance
Definition
eeschema_settings.h:328
KIFACE_BASE::KifaceSettings
APP_SETTINGS_BASE * KifaceSettings() const
Definition
kiface_base.h:91
KIGFX::RENDER_SETTINGS::m_backgroundColor
COLOR4D m_backgroundColor
Definition
render_settings.h:324
KIGFX::RENDER_SETTINGS::IsPrinting
bool IsPrinting() const
Definition
render_settings.h:223
KIGFX::RENDER_SETTINGS::SetDefaultPenWidth
void SetDefaultPenWidth(int aWidth)
Definition
render_settings.h:207
KIGFX::RENDER_SETTINGS::SetGapLengthRatio
void SetGapLengthRatio(double aRatio)
Definition
render_settings.h:218
KIGFX::RENDER_SETTINGS::m_minPenWidth
int m_minPenWidth
Definition
render_settings.h:341
KIGFX::RENDER_SETTINGS::SetDashLengthRatio
void SetDashLengthRatio(double aRatio)
Definition
render_settings.h:213
KIGFX::RENDER_SETTINGS::m_layerColors
std::map< int, COLOR4D > m_layerColors
Definition
render_settings.h:318
SCH_RENDER_SETTINGS::m_IsSymbolEditor
bool m_IsSymbolEditor
Definition
sch_render_settings.h:77
SCH_RENDER_SETTINGS::m_PinSymbolSize
int m_PinSymbolSize
Definition
sch_render_settings.h:98
SCH_RENDER_SETTINGS::m_LabelSizeRatio
double m_LabelSizeRatio
Definition
sch_render_settings.h:95
SCH_RENDER_SETTINGS::m_ShowBodyStyle
int m_ShowBodyStyle
Definition
sch_render_settings.h:80
SCH_RENDER_SETTINGS::m_SymbolLineWidth
int m_SymbolLineWidth
Override line widths for symbol drawing objects set to default line width.
Definition
sch_render_settings.h:99
SCH_RENDER_SETTINGS::m_OverrideItemColors
bool m_OverrideItemColors
Definition
sch_render_settings.h:93
SCH_RENDER_SETTINGS::m_ShowPinNames
bool m_ShowPinNames
Definition
sch_render_settings.h:87
SCH_RENDER_SETTINGS::m_ShowDisabled
bool m_ShowDisabled
Definition
sch_render_settings.h:89
SCH_RENDER_SETTINGS::m_ShowHiddenPins
bool m_ShowHiddenPins
Definition
sch_render_settings.h:83
SCH_RENDER_SETTINGS::m_ShowPinsElectricalType
bool m_ShowPinsElectricalType
Definition
sch_render_settings.h:82
SCH_RENDER_SETTINGS::m_ShowPinNumbers
bool m_ShowPinNumbers
Definition
sch_render_settings.h:86
SCH_RENDER_SETTINGS::m_ShowHiddenFields
bool m_ShowHiddenFields
Definition
sch_render_settings.h:84
SCH_RENDER_SETTINGS::m_Transform
TRANSFORM m_Transform
Definition
sch_render_settings.h:101
SCH_RENDER_SETTINGS::LoadColors
void LoadColors(const COLOR_SETTINGS *aSettings) override
Definition
sch_render_settings.cpp:59
SCH_RENDER_SETTINGS::m_ShowGraphicsDisabled
bool m_ShowGraphicsDisabled
Definition
sch_render_settings.h:90
SCH_RENDER_SETTINGS::m_ShowPinAltIcons
bool m_ShowPinAltIcons
Definition
sch_render_settings.h:88
SCH_RENDER_SETTINGS::SCH_RENDER_SETTINGS
SCH_RENDER_SETTINGS()
Definition
sch_render_settings.cpp:30
SCH_RENDER_SETTINGS::m_TextOffsetRatio
double m_TextOffsetRatio
Definition
sch_render_settings.h:96
SCH_RENDER_SETTINGS::m_ShowConnectionPoints
bool m_ShowConnectionPoints
Definition
sch_render_settings.h:91
SCH_RENDER_SETTINGS::GetShowPageLimits
bool GetShowPageLimits() const override
Definition
sch_render_settings.cpp:75
SCH_RENDER_SETTINGS::m_ShowVisibleFields
bool m_ShowVisibleFields
Definition
sch_render_settings.h:85
SCH_RENDER_SETTINGS::m_ShowUnit
int m_ShowUnit
Definition
sch_render_settings.h:79
color_settings.h
default_values.h
DEFAULT_LABEL_SIZE_RATIO
#define DEFAULT_LABEL_SIZE_RATIO
The offset of the pin name string from the end of the pin in mils.
Definition
default_values.h:71
DEFAULT_LINE_WIDTH_MILS
#define DEFAULT_LINE_WIDTH_MILS
The default wire width in mils. (can be changed in preference menu)
Definition
default_values.h:47
DEFAULT_TEXT_OFFSET_RATIO
#define DEFAULT_TEXT_OFFSET_RATIO
Ratio of the font height to space around global labels.
Definition
default_values.h:68
DEFAULT_TEXT_SIZE
#define DEFAULT_TEXT_SIZE
Ratio of the font height to the baseline of the text above the wire.
Definition
default_values.h:65
eeschema_settings.h
kiface_base.h
GAL_LAYER_ID_START
@ GAL_LAYER_ID_START
Definition
layer_ids.h:225
GAL_LAYER_ID_END
@ GAL_LAYER_ID_END
Definition
layer_ids.h:358
LAYER_AUX_ITEMS
@ LAYER_AUX_ITEMS
Auxiliary items (guides, rule, etc).
Definition
layer_ids.h:279
SCH_LAYER_ID_END
@ SCH_LAYER_ID_END
Definition
layer_ids.h:503
SCH_LAYER_ID_START
@ SCH_LAYER_ID_START
Definition
layer_ids.h:448
LAYER_SCHEMATIC_BACKGROUND
@ LAYER_SCHEMATIC_BACKGROUND
Definition
layer_ids.h:486
LAYER_SCHEMATIC_AUX_ITEMS
@ LAYER_SCHEMATIC_AUX_ITEMS
Definition
layer_ids.h:497
pgm_base.h
see class PGM_BASE
IU_PER_MILS
#define IU_PER_MILS
Definition
plotter.cpp:127
sch_render_settings.h
settings_manager.h
EESCHEMA_SETTINGS::APPEARANCE::show_page_limits
bool show_page_limits
Definition
eeschema_settings.h:77
src
eeschema
sch_render_settings.cpp
Generated on Fri Jun 26 2026 00:05:35 for KiCad PCB EDA Suite by
1.13.2