KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_render_settings.h
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#ifndef SCH_RENDER_SETTINGS_H
21#define SCH_RENDER_SETTINGS_H
22
23#include <gal/color4d.h>
24#include <render_settings.h>
25#include <transform.h>
26
27
28using KIGFX::COLOR4D;
29
30
32{
33public:
35
36 void LoadColors( const COLOR_SETTINGS* aSettings ) override;
37
38 virtual COLOR4D GetColor( const KIGFX::VIEW_ITEM* aItem, int aLayer ) const override
39 {
40 auto it = m_layerColors.find( aLayer );
41 return it == m_layerColors.end() ? COLOR4D::WHITE : it->second;
42 }
43
44 bool IsBackgroundDark() const override
45 {
47 return it != m_layerColors.end() && it->second.GetBrightness() < 0.5;
48 }
49
50 const KIGFX::COLOR4D& GetBackgroundColor() const override
51 {
53 return it == m_layerColors.end() ? COLOR4D::BLACK : it->second;
54 }
55
56 void SetBackgroundColor( const COLOR4D& aColor ) override
57 {
59 }
60
62 {
63 return (float) m_defaultPenWidth / 3.0F;
64 }
65
66 const COLOR4D& GetGridColor() override { return m_layerColors[ LAYER_SCHEMATIC_GRID ]; }
68
69 bool GetShowPageLimits() const override;
70
71 VECTOR2I TransformCoordinate( const VECTOR2I& aPoint ) const
72 {
73 return m_Transform.TransformCoordinate( aPoint );
74 }
75
76public:
78
79 int m_ShowUnit; // Show all units if 0
80 int m_ShowBodyStyle; // Show all body styles if 0
81
86 bool m_ShowPinNumbers; // Force showing of pin numbers (normally symbol-specific)
87 bool m_ShowPinNames; // Force showing of pin names (normally symbol-specific)
92
94
95 double m_LabelSizeRatio; // Proportion of font size to label box
96 double m_TextOffsetRatio; // Proportion of font size to offset text above/below
97 // wires, buses, etc.
100
102};
103
104
105#endif /* SCH_RENDER_SETTINGS_H */
static const COLOR4D WHITE
Definition color4d.h:401
static const COLOR4D BLACK
Definition color4d.h:402
Color settings are a bit different than most of the settings objects in that there can be more than o...
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
std::map< int, COLOR4D > m_layerColors
An abstract base class for deriving all objects that can be added to a VIEW.
Definition view_item.h:82
VECTOR2I TransformCoordinate(const VECTOR2I &aPoint) const
virtual COLOR4D GetColor(const KIGFX::VIEW_ITEM *aItem, int aLayer) const override
Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using curr...
bool IsBackgroundDark() const override
int m_SymbolLineWidth
Override line widths for symbol drawing objects set to default line width.
void SetBackgroundColor(const COLOR4D &aColor) override
Set the background color.
const COLOR4D & GetGridColor() override
Return current grid color settings.
const KIGFX::COLOR4D & GetBackgroundColor() const override
Return current background color settings.
float GetDanglingIndicatorThickness() const
void LoadColors(const COLOR_SETTINGS *aSettings) override
const COLOR4D & GetCursorColor() override
Return current cursor color settings.
bool GetShowPageLimits() const override
for transforming drawing coordinates for a wxDC device context.
Definition transform.h:42
@ LAYER_SCHEMATIC_CURSOR
Definition layer_ids.h:487
@ LAYER_SCHEMATIC_BACKGROUND
Definition layer_ids.h:486
@ LAYER_SCHEMATIC_GRID
Definition layer_ids.h:484
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683