11#include <QDomDocument>
22 qRegisterMetaType<KisGuidesConfig>(
"KisGuidesConfig");
30 return horzGuideLines == rhs.horzGuideLines &&
31 vertGuideLines == rhs.vertGuideLines &&
32 showGuides == rhs.showGuides &&
33 snapToGuides == rhs.snapToGuides &&
34 lockGuides == rhs.lockGuides &&
35 guidesColor == rhs.guidesColor &&
36 guidesLineType == rhs.guidesLineType &&
37 rulersMultiple2 == rhs.rulersMultiple2 &&
38 unitType == rhs.unitType;
44 bool showGuides {
false};
45 bool snapToGuides {
false};
46 bool lockGuides {
false};
47 bool rulersMultiple2 {
false};
94 d->horzGuideLines = lines;
99 d->vertGuideLines = lines;
104 if (o == Qt::Horizontal) {
105 d->horzGuideLines.append(pos);
107 d->vertGuideLines.append(pos);
120 return d->showGuides;
130 return d->lockGuides;
140 return d->snapToGuides;
150 return d->rulersMultiple2;
155 d->rulersMultiple2 =
value;
171 return d->guidesLineType;
176 d->guidesLineType =
value;
182 return d->guidesColor;
190 Qt::PenStyle KisGuidesConfig::Private::toPenStyle(LineTypeInternal type) {
191 return type == LINE_SOLID ? Qt::SolidLine :
192 type == LINE_DASHED ? Qt::DashLine :
193 type == LINE_DOTTED ? Qt::DotLine :
199 return QPen(
d->guidesColor, 0,
d->toPenStyle(
d->guidesLineType));
204 return d->horzGuideLines;
209 return d->vertGuideLines;
214 return !
d->horzGuideLines.isEmpty() || !
d->vertGuideLines.isEmpty();
233 QDomElement guidesElement = doc.createElement(tag);
247 return guidesElement;
274 d->unitType =
tmp.type();
294 return *
this == defaultObject;
299 if (
transform.type() >= QTransform::TxShear)
return;
305 const qreal
eps = 1e-3;
308 if (wrappedRotation <= eps || wrappedRotation >= 90.0 -
eps) {
319 Q_FOREACH (qreal hRuler,
d->horzGuideLines) {
320 const QPointF pt = t.map(QPointF(0, hRuler));
322 if (numWraps & 0x1) {
323 newVertGuideLines << pt.x();
325 newHorzGuideLines << pt.y();
329 Q_FOREACH (qreal vRuler,
d->vertGuideLines) {
330 const QPointF pt = t.map(QPointF(vRuler, 0));
332 if (!(numWraps & 0x1)) {
333 newVertGuideLines << pt.x();
335 newHorzGuideLines << pt.y();
339 d->horzGuideLines = newHorzGuideLines;
340 d->vertGuideLines = newVertGuideLines;
float value(const T *src, size_t ch)
quint32 guidesLineStyle(bool defaultValue=false) const
QColor guidesColor(bool defaultValue=false) const
void setGuidesLineStyle(quint32 v) const
void setGuidesColor(const QColor &v) const
Qt::PenStyle toPenStyle(LineTypeInternal type)
void setUnitType(KoUnit::Type type)
void setHorizontalGuideLines(const QList< qreal > &lines)
Set the positions of the horizontal guide lines.
void setShowGuides(bool value)
bool operator==(const Private &rhs)
QList< qreal > vertGuideLines
void setSnapToGuides(bool value)
void setGuidesColor(const QColor &value)
const QList< qreal > & verticalGuideLines() const
Returns the list of vertical guide lines.
void setLockGuides(bool value)
void setRulersMultiple2(bool value)
void saveStaticData() const
QDomElement saveToXml(QDomDocument &doc, const QString &tag) const
bool loadFromXml(const QDomElement &parent)
void setVerticalGuideLines(const QList< qreal > &lines)
Set the positions of the vertical guide lines.
bool hasSamePositionAs(const KisGuidesConfig &rhs) const
void addGuideLine(Qt::Orientation orientation, qreal position)
Add a guide line to the canvas.
QList< qreal > horzGuideLines
const QScopedPointer< Private > d
const QList< qreal > & horizontalGuideLines() const
Returns the list of horizontal guide lines.
LineTypeInternal guidesLineType
void setGuidesLineType(LineTypeInternal value)
void transform(const QTransform &transform)
KisGuidesConfig & operator=(const KisGuidesConfig &rhs)
static KoUnit fromSymbol(const QString &symbol, bool *ok=0)
std::enable_if< std::is_floating_point< T >::value, T >::type normalizeAngleDegrees(T a)
KIS_DECLARE_STATIC_INITIALIZER
T wrapValue(T value, T wrapBounds)
void saveValue(QDomElement *parent, const QString &tag, const QSize &size)
bool loadValue(const QDomElement &e, float *v)
QTransform rotateTransform() const
QTransform scaleTransform() const
QTransform translateTransform() const