LibrePCB Developers Documentation
Loading...
Searching...
No Matches
graphicsexportsettings.h
Go to the documentation of this file.
1/*
2 * LibrePCB - Professional EDA for everyone!
3 * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4 * https://librepcb.org/
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (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 <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef LIBREPCB_CORE_GRAPHICSEXPORTSETTINGS_H
21#define LIBREPCB_CORE_GRAPHICSEXPORTSETTINGS_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../types/length.h"
27#include "../types/ratio.h"
28
29#include <QtCore>
30#include <QtGui>
31
32#include <optional>
33
34/*******************************************************************************
35 * Namespace / Forward Declarations
36 ******************************************************************************/
37namespace librepcb {
38
39class Theme;
40
41/*******************************************************************************
42 * Class GraphicsExportSettings
43 ******************************************************************************/
44
52public:
53 // Types
54 enum class Orientation {
57 Auto,
58 };
59
60 // Constructors / Destructor
61 GraphicsExportSettings() noexcept;
63 ~GraphicsExportSettings() noexcept;
64
65 // Getters
66 const std::optional<QPageSize>& getPageSize() const noexcept {
67 return mPageSize;
68 }
69 Orientation getOrientation() const noexcept { return mOrientation; }
70 const UnsignedLength& getMarginLeft() const noexcept { return mMarginLeft; }
71 const UnsignedLength& getMarginTop() const noexcept { return mMarginTop; }
72 const UnsignedLength& getMarginRight() const noexcept { return mMarginRight; }
73 const UnsignedLength& getMarginBottom() const noexcept {
74 return mMarginBottom;
75 }
76 bool getRotate() const noexcept { return mRotate; }
77 bool getMirror() const noexcept { return mMirror; }
78 const std::optional<UnsignedRatio>& getScale() const noexcept {
79 return mScale;
80 }
81 int getPixmapDpi() const noexcept { return mPixmapDpi; }
82 bool getBlackWhite() const noexcept { return mBlackWhite; }
83 const QColor& getBackgroundColor() const noexcept { return mBackgroundColor; }
84 const UnsignedLength& getMinLineWidth() const noexcept {
85 return mMinLineWidth;
86 }
87 const QList<std::pair<QString, QColor>>& getColors() const noexcept {
88 return mColors;
89 }
90 QStringList getPaintOrder() const noexcept;
91 QColor getColor(const QString& colorName) const noexcept;
92 QColor getFillColor(const QString& colorName, bool isFilled,
93 bool isGrabArea) const noexcept;
94
95 // Setters
96 void setPageSize(const std::optional<QPageSize>& size) noexcept {
97 mPageSize = size;
98 }
99 void setOrientation(Orientation orientation) noexcept {
100 mOrientation = orientation;
101 }
102 void setMarginLeft(const librepcb::UnsignedLength& margin) noexcept {
103 mMarginLeft = margin;
104 }
105 void setMarginTop(const librepcb::UnsignedLength& margin) noexcept {
106 mMarginTop = margin;
107 }
108 void setMarginRight(const librepcb::UnsignedLength& margin) noexcept {
109 mMarginRight = margin;
110 }
111 void setMarginBottom(const librepcb::UnsignedLength& margin) noexcept {
112 mMarginBottom = margin;
113 }
114 void setRotate(bool rotate) noexcept { mRotate = rotate; }
115 void setMirror(bool mirror) noexcept { mMirror = mirror; }
116 void setScale(std::optional<UnsignedRatio> scale) noexcept { mScale = scale; }
117 void setPixmapDpi(int dpi) noexcept { mPixmapDpi = dpi; }
118 void setBlackWhite(bool blackWhite) noexcept { mBlackWhite = blackWhite; }
119 void setBackgroundColor(const QColor& c) noexcept { mBackgroundColor = c; }
120 void setMinLineWidth(const UnsignedLength& width) noexcept {
121 mMinLineWidth = width;
122 }
123 void setColors(const QList<std::pair<QString, QColor>>& colors) noexcept {
124 mColors = colors;
125 }
126
127 // General Methods
128 void loadColorsFromTheme(const Theme& theme, bool schematic = true,
129 bool board = true,
130 int innerLayerCount = -1) noexcept;
131
132 // Operator Overloadings
133 GraphicsExportSettings& operator=(const GraphicsExportSettings& rhs) noexcept;
134 bool operator==(const GraphicsExportSettings& rhs) const noexcept;
135 bool operator!=(const GraphicsExportSettings& rhs) const noexcept;
136
137private: // Methods
138 QColor getColorImpl(const QString& name) const noexcept;
139
140private: // Data
141 std::optional<QPageSize> mPageSize;
154 QList<std::pair<QString, QColor>> mColors;
155};
156
157/*******************************************************************************
158 * End of File
159 ******************************************************************************/
160
161} // namespace librepcb
162
163#endif
Settings for librepcb::GraphicsExport.
Definition graphicsexportsettings.h:51
UnsignedLength mMarginBottom
Definition graphicsexportsettings.h:146
QColor getFillColor(const QString &colorName, bool isFilled, bool isGrabArea) const noexcept
Definition graphicsexportsettings.cpp:140
UnsignedLength mMarginLeft
Definition graphicsexportsettings.h:143
void setMinLineWidth(const UnsignedLength &width) noexcept
Definition graphicsexportsettings.h:120
bool getBlackWhite() const noexcept
Definition graphicsexportsettings.h:82
const QList< std::pair< QString, QColor > > & getColors() const noexcept
Definition graphicsexportsettings.h:87
void setMarginTop(const librepcb::UnsignedLength &margin) noexcept
Definition graphicsexportsettings.h:105
bool getRotate() const noexcept
Definition graphicsexportsettings.h:76
void setMirror(bool mirror) noexcept
Definition graphicsexportsettings.h:115
Orientation getOrientation() const noexcept
Definition graphicsexportsettings.h:69
UnsignedLength mMinLineWidth
Definition graphicsexportsettings.h:153
bool mBlackWhite
Definition graphicsexportsettings.h:151
QStringList getPaintOrder() const noexcept
Definition graphicsexportsettings.cpp:123
const UnsignedLength & getMinLineWidth() const noexcept
Definition graphicsexportsettings.h:84
std::optional< QPageSize > mPageSize
Definition graphicsexportsettings.h:141
const UnsignedLength & getMarginBottom() const noexcept
Definition graphicsexportsettings.h:73
bool getMirror() const noexcept
Definition graphicsexportsettings.h:77
UnsignedLength mMarginRight
Definition graphicsexportsettings.h:145
void setPageSize(const std::optional< QPageSize > &size) noexcept
Definition graphicsexportsettings.h:96
void setBackgroundColor(const QColor &c) noexcept
Definition graphicsexportsettings.h:119
const std::optional< QPageSize > & getPageSize() const noexcept
Definition graphicsexportsettings.h:66
void setPixmapDpi(int dpi) noexcept
Definition graphicsexportsettings.h:117
std::optional< UnsignedRatio > mScale
Definition graphicsexportsettings.h:149
bool mMirror
Definition graphicsexportsettings.h:148
int getPixmapDpi() const noexcept
Definition graphicsexportsettings.h:81
bool mRotate
Definition graphicsexportsettings.h:147
const QColor & getBackgroundColor() const noexcept
Definition graphicsexportsettings.h:83
void setMarginRight(const librepcb::UnsignedLength &margin) noexcept
Definition graphicsexportsettings.h:108
Orientation
Definition graphicsexportsettings.h:54
const UnsignedLength & getMarginLeft() const noexcept
Definition graphicsexportsettings.h:70
QColor getColor(const QString &colorName) const noexcept
Definition graphicsexportsettings.cpp:131
void setRotate(bool rotate) noexcept
Definition graphicsexportsettings.h:114
UnsignedLength mMarginTop
Definition graphicsexportsettings.h:144
void setMarginLeft(const librepcb::UnsignedLength &margin) noexcept
Definition graphicsexportsettings.h:102
QList< std::pair< QString, QColor > > mColors
Definition graphicsexportsettings.h:154
Orientation mOrientation
Definition graphicsexportsettings.h:142
void setBlackWhite(bool blackWhite) noexcept
Definition graphicsexportsettings.h:118
QColor getColorImpl(const QString &name) const noexcept
Definition graphicsexportsettings.cpp:291
void loadColorsFromTheme(const Theme &theme, bool schematic=true, bool board=true, int innerLayerCount=-1) noexcept
Definition graphicsexportsettings.cpp:162
void setColors(const QList< std::pair< QString, QColor > > &colors) noexcept
Definition graphicsexportsettings.h:123
const std::optional< UnsignedRatio > & getScale() const noexcept
Definition graphicsexportsettings.h:78
int mPixmapDpi
Definition graphicsexportsettings.h:150
const UnsignedLength & getMarginTop() const noexcept
Definition graphicsexportsettings.h:71
void setOrientation(Orientation orientation) noexcept
Definition graphicsexportsettings.h:99
const UnsignedLength & getMarginRight() const noexcept
Definition graphicsexportsettings.h:72
QColor mBackgroundColor
Definition graphicsexportsettings.h:152
void setMarginBottom(const librepcb::UnsignedLength &margin) noexcept
Definition graphicsexportsettings.h:111
void setScale(std::optional< UnsignedRatio > scale) noexcept
Definition graphicsexportsettings.h:116
GraphicsExportSettings() noexcept
Definition graphicsexportsettings.cpp:92
Theme class as used by librepcb::WorkspaceSettingsItem_Themes.
Definition theme.h:44
Definition occmodel.cpp:76
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition length.h:694
type_safe::constrained_type< Ratio, UnsignedRatioConstraint, UnsignedRatioVerifier > UnsignedRatio
Definition ratio.h:328
Definition uuid.h:186