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, you may find one here:
18
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19
* or you may search the http://www.gnu.org website for the version 2 license,
20
* or you may write to the Free Software Foundation, Inc.,
21
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22
*/
23
24
#include <
pgm_base.h
>
25
#include <
kiface_base.h
>
26
#include <
advanced_config.h
>
27
#include <
settings/settings_manager.h
>
28
#include <
eeschema_settings.h
>
29
#include <
default_values.h
>
30
#include <
sch_render_settings.h
>
31
32
33
SCH_RENDER_SETTINGS::SCH_RENDER_SETTINGS
() :
34
m_IsSymbolEditor
( false ),
35
m_ShowUnit
( 0 ),
36
m_ShowBodyStyle
( 0 ),
37
m_ShowPinsElectricalType
( true ),
38
m_ShowHiddenPins
( true ),
39
m_ShowHiddenFields
( true ),
40
m_ShowVisibleFields
( true ),
41
m_ShowPinNumbers
( false ),
42
m_ShowPinNames
( false ),
43
m_ShowPinAltIcons
( false ),
44
m_ShowDisabled
( false ),
45
m_ShowGraphicsDisabled
( false ),
46
m_ShowConnectionPoints
( false ),
47
m_OverrideItemColors
( false ),
48
m_LabelSizeRatio
(
DEFAULT_LABEL_SIZE_RATIO
),
49
m_TextOffsetRatio
(
DEFAULT_TEXT_OFFSET_RATIO
),
50
m_PinSymbolSize
(
DEFAULT_TEXT_SIZE
*
schIUScale
.
IU_PER_MILS
/ 2 ),
51
m_SymbolLineWidth
(
DEFAULT_LINE_WIDTH_MILS
*
schIUScale
.
IU_PER_MILS
),
52
m_Transform
()
53
{
54
SetDefaultPenWidth
(
DEFAULT_LINE_WIDTH_MILS
*
schIUScale
.IU_PER_MILS );
55
SetDashLengthRatio
( 12 );
// From ISO 128-2
56
SetGapLengthRatio
( 3 );
// From ISO 128-2
57
58
m_minPenWidth
=
KiROUND
(
ADVANCED_CFG::GetCfg
().m_MinPlotPenWidth *
schIUScale
.IU_PER_MM );
59
}
60
61
62
void
SCH_RENDER_SETTINGS::LoadColors
(
const
COLOR_SETTINGS
* aSettings )
63
{
64
for
(
int
layer =
SCH_LAYER_ID_START
; layer <
SCH_LAYER_ID_END
; layer ++)
65
m_layerColors
[ layer ] = aSettings->
GetColor
( layer );
66
67
for
(
int
layer =
GAL_LAYER_ID_START
; layer <
GAL_LAYER_ID_END
; layer ++)
68
m_layerColors
[ layer ] = aSettings->
GetColor
( layer );
69
70
m_backgroundColor
= aSettings->
GetColor
(
LAYER_SCHEMATIC_BACKGROUND
);
71
72
m_layerColors
[
LAYER_AUX_ITEMS
] =
m_layerColors
[
LAYER_SCHEMATIC_AUX_ITEMS
];
73
74
m_OverrideItemColors
= aSettings->
GetOverrideSchItemColors
();
75
}
76
77
78
bool
SCH_RENDER_SETTINGS::GetShowPageLimits
()
const
79
{
80
EESCHEMA_SETTINGS
* cfg =
dynamic_cast<
EESCHEMA_SETTINGS
*
>
(
Kiface
().
KifaceSettings
() );
81
return
cfg && cfg->
m_Appearance
.
show_page_limits
&& !
IsPrinting
();
82
}
83
advanced_config.h
schIUScale
constexpr EDA_IU_SCALE schIUScale
Definition
base_units.h:114
Kiface
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
Definition
bitmap2cmp_main.cpp:73
KiROUND
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition
box2.h:990
ADVANCED_CFG::GetCfg
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
Definition
advanced_config.cpp:342
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:401
EESCHEMA_SETTINGS
Definition
eeschema_settings.h:59
EESCHEMA_SETTINGS::m_Appearance
APPEARANCE m_Appearance
Definition
eeschema_settings.h:336
KIFACE_BASE::KifaceSettings
APP_SETTINGS_BASE * KifaceSettings() const
Definition
kiface_base.h:95
KIGFX::RENDER_SETTINGS::m_backgroundColor
COLOR4D m_backgroundColor
Definition
render_settings.h:328
KIGFX::RENDER_SETTINGS::IsPrinting
bool IsPrinting() const
Definition
render_settings.h:227
KIGFX::RENDER_SETTINGS::SetDefaultPenWidth
void SetDefaultPenWidth(int aWidth)
Definition
render_settings.h:211
KIGFX::RENDER_SETTINGS::SetGapLengthRatio
void SetGapLengthRatio(double aRatio)
Definition
render_settings.h:222
KIGFX::RENDER_SETTINGS::m_minPenWidth
int m_minPenWidth
Definition
render_settings.h:345
KIGFX::RENDER_SETTINGS::SetDashLengthRatio
void SetDashLengthRatio(double aRatio)
Definition
render_settings.h:217
KIGFX::RENDER_SETTINGS::m_layerColors
std::map< int, COLOR4D > m_layerColors
Definition
render_settings.h:322
SCH_RENDER_SETTINGS::m_IsSymbolEditor
bool m_IsSymbolEditor
Definition
sch_render_settings.h:81
SCH_RENDER_SETTINGS::m_PinSymbolSize
int m_PinSymbolSize
Definition
sch_render_settings.h:102
SCH_RENDER_SETTINGS::m_LabelSizeRatio
double m_LabelSizeRatio
Definition
sch_render_settings.h:99
SCH_RENDER_SETTINGS::m_ShowBodyStyle
int m_ShowBodyStyle
Definition
sch_render_settings.h:84
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:103
SCH_RENDER_SETTINGS::m_OverrideItemColors
bool m_OverrideItemColors
Definition
sch_render_settings.h:97
SCH_RENDER_SETTINGS::m_ShowPinNames
bool m_ShowPinNames
Definition
sch_render_settings.h:91
SCH_RENDER_SETTINGS::m_ShowDisabled
bool m_ShowDisabled
Definition
sch_render_settings.h:93
SCH_RENDER_SETTINGS::m_ShowHiddenPins
bool m_ShowHiddenPins
Definition
sch_render_settings.h:87
SCH_RENDER_SETTINGS::m_ShowPinsElectricalType
bool m_ShowPinsElectricalType
Definition
sch_render_settings.h:86
SCH_RENDER_SETTINGS::m_ShowPinNumbers
bool m_ShowPinNumbers
Definition
sch_render_settings.h:90
SCH_RENDER_SETTINGS::m_ShowHiddenFields
bool m_ShowHiddenFields
Definition
sch_render_settings.h:88
SCH_RENDER_SETTINGS::m_Transform
TRANSFORM m_Transform
Definition
sch_render_settings.h:105
SCH_RENDER_SETTINGS::LoadColors
void LoadColors(const COLOR_SETTINGS *aSettings) override
Definition
sch_render_settings.cpp:62
SCH_RENDER_SETTINGS::m_ShowGraphicsDisabled
bool m_ShowGraphicsDisabled
Definition
sch_render_settings.h:94
SCH_RENDER_SETTINGS::m_ShowPinAltIcons
bool m_ShowPinAltIcons
Definition
sch_render_settings.h:92
SCH_RENDER_SETTINGS::SCH_RENDER_SETTINGS
SCH_RENDER_SETTINGS()
Definition
sch_render_settings.cpp:33
SCH_RENDER_SETTINGS::m_TextOffsetRatio
double m_TextOffsetRatio
Definition
sch_render_settings.h:100
SCH_RENDER_SETTINGS::m_ShowConnectionPoints
bool m_ShowConnectionPoints
Definition
sch_render_settings.h:95
SCH_RENDER_SETTINGS::GetShowPageLimits
bool GetShowPageLimits() const override
Definition
sch_render_settings.cpp:78
SCH_RENDER_SETTINGS::m_ShowVisibleFields
bool m_ShowVisibleFields
Definition
sch_render_settings.h:89
SCH_RENDER_SETTINGS::m_ShowUnit
int m_ShowUnit
Definition
sch_render_settings.h:83
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:75
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:51
DEFAULT_TEXT_OFFSET_RATIO
#define DEFAULT_TEXT_OFFSET_RATIO
Ratio of the font height to space around global labels.
Definition
default_values.h:72
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:69
eeschema_settings.h
kiface_base.h
GAL_LAYER_ID_START
@ GAL_LAYER_ID_START
Definition
layer_ids.h:229
GAL_LAYER_ID_END
@ GAL_LAYER_ID_END
Definition
layer_ids.h:359
LAYER_AUX_ITEMS
@ LAYER_AUX_ITEMS
Auxiliary items (guides, rule, etc).
Definition
layer_ids.h:282
SCH_LAYER_ID_END
@ SCH_LAYER_ID_END
Definition
layer_ids.h:502
SCH_LAYER_ID_START
@ SCH_LAYER_ID_START
Definition
layer_ids.h:449
LAYER_SCHEMATIC_BACKGROUND
@ LAYER_SCHEMATIC_BACKGROUND
Definition
layer_ids.h:487
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:130
sch_render_settings.h
settings_manager.h
EESCHEMA_SETTINGS::APPEARANCE::show_page_limits
bool show_page_limits
Definition
eeschema_settings.h:85
src
eeschema
sch_render_settings.cpp
Generated on Sun Sep 21 2025 01:05:24 for KiCad PCB EDA Suite by
1.13.2