From 0266b27b3691d45f44e436e0bd820de83ebbf9d2 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 19 May 2016 13:11:50 +0300 Subject: [PATCH] Save information about curve color inside geometric objects. Help to copy this data to copy objects after rotation. --HG-- branch : feature --- .../core/vtooloptionspropertybrowser.cpp | 21 ------------ src/app/valentina/xml/vpattern.cpp | 13 ++------ src/libs/vgeometry/vabstractcurve.cpp | 12 +++++++ src/libs/vgeometry/vabstractcurve.h | 3 ++ src/libs/vgeometry/vabstractcurve_p.h | 8 +++-- .../vtools/dialogs/tools/dialogcutarc.cpp | 13 -------- src/libs/vtools/dialogs/tools/dialogcutarc.h | 3 -- src/libs/vtools/dialogs/tools/dialogcutarc.ui | 12 +------ .../vtools/dialogs/tools/dialogcutspline.cpp | 13 -------- .../vtools/dialogs/tools/dialogcutspline.h | 3 -- .../vtools/dialogs/tools/dialogcutspline.ui | 12 +------ .../dialogs/tools/dialogcutsplinepath.cpp | 13 -------- .../dialogs/tools/dialogcutsplinepath.h | 3 -- .../dialogs/tools/dialogcutsplinepath.ui | 18 +--------- .../drawTools/toolcurve/vabstractspline.cpp | 33 +++++++++++++++---- .../drawTools/toolcurve/vabstractspline.h | 3 ++ .../tools/drawTools/toolcurve/vtoolarc.cpp | 12 +++---- .../tools/drawTools/toolcurve/vtoolarc.h | 2 +- .../toolcurve/vtoolarcwithlength.cpp | 13 ++++---- .../drawTools/toolcurve/vtoolarcwithlength.h | 10 +++--- .../drawTools/toolcurve/vtoolcubicbezier.cpp | 11 ++++--- .../drawTools/toolcurve/vtoolcubicbezier.h | 4 +-- .../toolcurve/vtoolcubicbezierpath.cpp | 11 ++++--- .../toolcurve/vtoolcubicbezierpath.h | 2 +- .../tools/drawTools/toolcurve/vtoolspline.cpp | 21 ++++++------ .../tools/drawTools/toolcurve/vtoolspline.h | 2 +- .../drawTools/toolcurve/vtoolsplinepath.cpp | 18 +++++----- .../drawTools/toolcurve/vtoolsplinepath.h | 10 +++--- .../toolsinglepoint/toolcut/vtoolcut.cpp | 12 +------ .../toolsinglepoint/toolcut/vtoolcut.h | 3 +- .../toolsinglepoint/toolcut/vtoolcutarc.cpp | 19 ++++------- .../toolsinglepoint/toolcut/vtoolcutarc.h | 5 ++- .../toolcut/vtoolcutspline.cpp | 16 +++------ .../toolsinglepoint/toolcut/vtoolcutspline.h | 5 ++- .../toolcut/vtoolcutsplinepath.cpp | 15 +++------ .../toolcut/vtoolcutsplinepath.h | 6 ++-- .../toollinepoint/vtoollinepoint.cpp | 17 +++++++++- .../toollinepoint/vtoollinepoint.h | 21 ++++++++---- src/libs/vtools/tools/drawTools/vdrawtool.cpp | 18 +--------- src/libs/vtools/tools/drawTools/vdrawtool.h | 6 ---- src/libs/vtools/tools/drawTools/vtoolline.cpp | 9 ++++- src/libs/vtools/tools/drawTools/vtoolline.h | 7 +++- 42 files changed, 184 insertions(+), 274 deletions(-) diff --git a/src/app/valentina/core/vtooloptionspropertybrowser.cpp b/src/app/valentina/core/vtooloptionspropertybrowser.cpp index b67b0f1d0..c55328f53 100644 --- a/src/app/valentina/core/vtooloptionspropertybrowser.cpp +++ b/src/app/valentina/core/vtooloptionspropertybrowser.cpp @@ -990,9 +990,6 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCutArc(VProperty *property) case 4: // AttrLength i->SetFormula(value.value()); break; - case 27: // AttrTypeColor - i->SetLineColor(value.toString()); - break; default: qWarning()<<"Unknown property type. id = "<SetFormula(value.value()); break; - case 27: // AttrTypeColor - i->SetLineColor(value.toString()); - break; default: qWarning()<<"Unknown property type. id = "<SetFormula(value.value()); break; - case 27: // AttrTypeColor - i->SetLineColor(value.toString()); - break; default: qWarning()<<"Unknown property type. id = "<GetFormula(), AttrLength); - AddPropertyLineColor(i, tr("Color"), VAbstractTool::ColorsList(), AttrColor); } //--------------------------------------------------------------------------------------------------------------------- @@ -1717,7 +1707,6 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCutSpline(QGraphicsItem *item) AddPropertyObjectName(i, tr("Point label")); AddPropertyFormula(tr("Length"), i->GetFormula(), AttrLength); - AddPropertyLineColor(i, tr("Color"), VAbstractTool::ColorsList(), AttrColor); } //--------------------------------------------------------------------------------------------------------------------- @@ -1729,7 +1718,6 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCutSplinePath(QGraphicsItem *it AddPropertyObjectName(i, tr("Point label")); AddPropertyFormula(tr("Length"), i->GetFormula(), AttrLength); - AddPropertyLineColor(i, tr("Color"), VAbstractTool::ColorsList(), AttrColor); } //--------------------------------------------------------------------------------------------------------------------- @@ -2135,9 +2123,6 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCutArc() QVariant valueFormula; valueFormula.setValue(i->GetFormula()); idToProperty[AttrLength]->setValue(valueFormula); - - const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor()); - idToProperty[AttrColor]->setValue(index); } //--------------------------------------------------------------------------------------------------------------------- @@ -2150,9 +2135,6 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCutSpline() QVariant valueFormula; valueFormula.setValue(i->GetFormula()); idToProperty[AttrLength]->setValue(valueFormula); - - const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor()); - idToProperty[AttrColor]->setValue(index); } //--------------------------------------------------------------------------------------------------------------------- @@ -2165,9 +2147,6 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCutSplinePath() QVariant valueFormula; valueFormula.setValue(i->GetFormula()); idToProperty[AttrLength]->setValue(valueFormula); - - const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor()); - idToProperty[AttrColor]->setValue(index); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 1bfdd01af..6f19e9272 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -1412,11 +1412,8 @@ void VPattern::ParseToolCutSpline(VMainGraphicsScene *scene, QDomElement &domEle const QString formula = GetParametrString(domElement, AttrLength, "0"); QString f = formula;//need for saving fixed formula; const quint32 splineId = GetParametrUInt(domElement, VToolCutSpline::AttrSpline, NULL_ID_STR); - const QString color = GetParametrString(domElement, AttrColor, - ColorBlack); - VToolCutSpline::Create(id, name, f, splineId, mx, my, color, scene, this, data, parse, - Source::FromFile); + VToolCutSpline::Create(id, name, f, splineId, mx, my, scene, this, data, parse, Source::FromFile); //Rewrite attribute formula. Need for situation when we have wrong formula. if (f != formula) { @@ -1457,11 +1454,8 @@ void VPattern::ParseToolCutSplinePath(VMainGraphicsScene *scene, QDomElement &do QString f = formula;//need for saving fixed formula; const quint32 splinePathId = GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath, NULL_ID_STR); - const QString color = GetParametrString(domElement, AttrColor, - ColorBlack); - VToolCutSplinePath::Create(id, name, f, splinePathId, mx, my, color, scene, this, data, parse, - Source::FromFile); + VToolCutSplinePath::Create(id, name, f, splinePathId, mx, my, scene, this, data, parse, Source::FromFile); //Rewrite attribute formula. Need for situation when we have wrong formula. if (f != formula) { @@ -1501,9 +1495,8 @@ void VPattern::ParseToolCutArc(VMainGraphicsScene *scene, QDomElement &domElemen const QString formula = GetParametrString(domElement, AttrLength, "0"); QString f = formula;//need for saving fixed formula; const quint32 arcId = GetParametrUInt(domElement, AttrArc, NULL_ID_STR); - const QString color = GetParametrString(domElement, AttrColor, ColorBlack); - VToolCutArc::Create(id, name, f, arcId, mx, my, color, scene, this, data, parse, Source::FromFile); + VToolCutArc::Create(id, name, f, arcId, mx, my, scene, this, data, parse, Source::FromFile); //Rewrite attribute formula. Need for situation when we have wrong formula. if (f != formula) { diff --git a/src/libs/vgeometry/vabstractcurve.cpp b/src/libs/vgeometry/vabstractcurve.cpp index ec79e104c..cca2f7a61 100644 --- a/src/libs/vgeometry/vabstractcurve.cpp +++ b/src/libs/vgeometry/vabstractcurve.cpp @@ -244,6 +244,18 @@ void VAbstractCurve::SetDuplicate(quint32 number) CreateName(); } +//--------------------------------------------------------------------------------------------------------------------- +QString VAbstractCurve::GetColor() const +{ + return d->color; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VAbstractCurve::SetColor(const QString &color) +{ + d->color = color; +} + //--------------------------------------------------------------------------------------------------------------------- QVector VAbstractCurve::CurveIntersectLine(const QVector &points, const QLineF &line) { diff --git a/src/libs/vgeometry/vabstractcurve.h b/src/libs/vgeometry/vabstractcurve.h index 1b3f5c8a5..19ad0331b 100644 --- a/src/libs/vgeometry/vabstractcurve.h +++ b/src/libs/vgeometry/vabstractcurve.h @@ -69,6 +69,9 @@ public: quint32 GetDuplicate() const; void SetDuplicate(quint32 number); + QString GetColor() const; + void SetColor(const QString &color); + static QVector CurveIntersectLine(const QVector &points, const QLineF &line); virtual QString NameForHistory(const QString &toolName) const=0; diff --git a/src/libs/vgeometry/vabstractcurve_p.h b/src/libs/vgeometry/vabstractcurve_p.h index 0bcdbc26c..3d5920bb5 100644 --- a/src/libs/vgeometry/vabstractcurve_p.h +++ b/src/libs/vgeometry/vabstractcurve_p.h @@ -31,6 +31,8 @@ #include +#include "../ifc/ifcdef.h" + #ifdef Q_CC_GNU #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Weffc++" @@ -41,11 +43,11 @@ class VAbstractCurveData : public QSharedData public: VAbstractCurveData () - : duplicate(0) + : duplicate(0), color(ColorBlack) {} VAbstractCurveData(const VAbstractCurveData &curve) - : QSharedData(curve), duplicate(curve.duplicate) + : QSharedData(curve), duplicate(curve.duplicate), color(curve.color) {} virtual ~VAbstractCurveData(); @@ -53,6 +55,8 @@ public: /** @brief duplicate helps create unique name for curves that connects the same start and finish points. */ quint32 duplicate; + QString color; + private: VAbstractCurveData &operator=(const VAbstractCurveData &) Q_DECL_EQ_DELETE; }; diff --git a/src/libs/vtools/dialogs/tools/dialogcutarc.cpp b/src/libs/vtools/dialogs/tools/dialogcutarc.cpp index 03f0cc852..936175f1a 100644 --- a/src/libs/vtools/dialogs/tools/dialogcutarc.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcutarc.cpp @@ -62,7 +62,6 @@ DialogCutArc::DialogCutArc(const VContainer *data, const quint32 &toolId, QWidge CheckState(); FillComboBoxArcs(ui->comboBoxArc); - FillComboBoxLineColors(ui->comboBoxColor); connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogCutArc::FXLength); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutArc::NamePointChanged); @@ -170,18 +169,6 @@ void DialogCutArc::setArcId(const quint32 &value) path->setObject1Id(value); } -//--------------------------------------------------------------------------------------------------------------------- -QString DialogCutArc::GetColor() const -{ - return GetComboBoxCurrentData(ui->comboBoxColor); -} - -//--------------------------------------------------------------------------------------------------------------------- -void DialogCutArc::SetColor(const QString &value) -{ - ChangeCurrentData(ui->comboBoxColor, value); -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief SetFormula set string with formula length diff --git a/src/libs/vtools/dialogs/tools/dialogcutarc.h b/src/libs/vtools/dialogs/tools/dialogcutarc.h index fd219a3f3..28ecd4479 100644 --- a/src/libs/vtools/dialogs/tools/dialogcutarc.h +++ b/src/libs/vtools/dialogs/tools/dialogcutarc.h @@ -54,9 +54,6 @@ public: quint32 getArcId() const; void setArcId(const quint32 &value); - - QString GetColor() const; - void SetColor(const QString &value); public slots: virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE; /** diff --git a/src/libs/vtools/dialogs/tools/dialogcutarc.ui b/src/libs/vtools/dialogs/tools/dialogcutarc.ui index 76379aeab..823af7217 100644 --- a/src/libs/vtools/dialogs/tools/dialogcutarc.ui +++ b/src/libs/vtools/dialogs/tools/dialogcutarc.ui @@ -7,7 +7,7 @@ 0 0 412 - 222 + 189 @@ -246,16 +246,6 @@ - - - - Color: - - - - - - diff --git a/src/libs/vtools/dialogs/tools/dialogcutspline.cpp b/src/libs/vtools/dialogs/tools/dialogcutspline.cpp index a52257a6c..2ab83fc38 100644 --- a/src/libs/vtools/dialogs/tools/dialogcutspline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcutspline.cpp @@ -61,7 +61,6 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, const quint32 &toolId, CheckState(); FillComboBoxSplines(ui->comboBoxSpline); - FillComboBoxLineColors(ui->comboBoxColor); connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogCutSpline::FXLength); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutSpline::NamePointChanged); @@ -126,18 +125,6 @@ void DialogCutSpline::setSplineId(const quint32 &value) path->setObject1Id(value); } -//--------------------------------------------------------------------------------------------------------------------- -QString DialogCutSpline::GetColor() const -{ - return GetComboBoxCurrentData(ui->comboBoxColor); -} - -//--------------------------------------------------------------------------------------------------------------------- -void DialogCutSpline::SetColor(const QString &value) -{ - ChangeCurrentData(ui->comboBoxColor, value); -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong. diff --git a/src/libs/vtools/dialogs/tools/dialogcutspline.h b/src/libs/vtools/dialogs/tools/dialogcutspline.h index ff472d927..e52d505f0 100644 --- a/src/libs/vtools/dialogs/tools/dialogcutspline.h +++ b/src/libs/vtools/dialogs/tools/dialogcutspline.h @@ -53,9 +53,6 @@ public: quint32 getSplineId() const; void setSplineId(const quint32 &value); - - QString GetColor() const; - void SetColor(const QString &value); public slots: virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE; /** diff --git a/src/libs/vtools/dialogs/tools/dialogcutspline.ui b/src/libs/vtools/dialogs/tools/dialogcutspline.ui index 805d4f727..4f792a299 100644 --- a/src/libs/vtools/dialogs/tools/dialogcutspline.ui +++ b/src/libs/vtools/dialogs/tools/dialogcutspline.ui @@ -7,7 +7,7 @@ 0 0 412 - 222 + 189 @@ -246,16 +246,6 @@ - - - - Color: - - - - - - diff --git a/src/libs/vtools/dialogs/tools/dialogcutsplinepath.cpp b/src/libs/vtools/dialogs/tools/dialogcutsplinepath.cpp index 0b94b5fad..116ba4a24 100644 --- a/src/libs/vtools/dialogs/tools/dialogcutsplinepath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcutsplinepath.cpp @@ -61,7 +61,6 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, const quint32 & CheckState(); FillComboBoxSplinesPath(ui->comboBoxSplinePath); - FillComboBoxLineColors(ui->comboBoxColor); connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogCutSplinePath::FXLength); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutSplinePath::NamePointChanged); @@ -126,18 +125,6 @@ void DialogCutSplinePath::setSplinePathId(const quint32 &value) path->setObject1Id(value); } -//--------------------------------------------------------------------------------------------------------------------- -QString DialogCutSplinePath::GetColor() const -{ - return GetComboBoxCurrentData(ui->comboBoxColor); -} - -//--------------------------------------------------------------------------------------------------------------------- -void DialogCutSplinePath::SetColor(const QString &value) -{ - ChangeCurrentData(ui->comboBoxColor, value); -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong. diff --git a/src/libs/vtools/dialogs/tools/dialogcutsplinepath.h b/src/libs/vtools/dialogs/tools/dialogcutsplinepath.h index 167d74eae..5a667e16c 100644 --- a/src/libs/vtools/dialogs/tools/dialogcutsplinepath.h +++ b/src/libs/vtools/dialogs/tools/dialogcutsplinepath.h @@ -53,9 +53,6 @@ public: quint32 getSplinePathId() const; void setSplinePathId(const quint32 &value); - - QString GetColor() const; - void SetColor(const QString &value); public slots: virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE; /** diff --git a/src/libs/vtools/dialogs/tools/dialogcutsplinepath.ui b/src/libs/vtools/dialogs/tools/dialogcutsplinepath.ui index 9fd940a71..e0dc93b76 100644 --- a/src/libs/vtools/dialogs/tools/dialogcutsplinepath.ui +++ b/src/libs/vtools/dialogs/tools/dialogcutsplinepath.ui @@ -7,7 +7,7 @@ 0 0 412 - 222 + 189 @@ -246,22 +246,6 @@ - - - - - 0 - 0 - - - - Color: - - - - - - diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp index 1339e5dec..5a50181b7 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp @@ -65,7 +65,8 @@ void VAbstractSpline::Disable(bool disable, const QString &namePP) { enabled = !CorrectDisable(disable, namePP); this->setEnabled(enabled); - this->setPen(QPen(CorrectColor(lineColor), + const QSharedPointer curve = VAbstractTool::data.GeometricObject(id); + this->setPen(QPen(CorrectColor(curve->GetColor()), qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor, Qt::SolidLine, Qt::RoundCap)); emit setEnabledPoint(enabled); @@ -122,7 +123,8 @@ void VAbstractSpline::SetFactor(qreal factor) void VAbstractSpline::hoverEnterEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(CorrectColor(lineColor), + const QSharedPointer curve = VAbstractTool::data.GeometricObject(id); + this->setPen(QPen(CorrectColor(curve->GetColor()), qApp->toPixel(WidthMainLine(*VAbstractTool::data.GetPatternUnit()))/factor, Qt::SolidLine, Qt::RoundCap)); this->setPath(ToolPath(PathDirection::Show)); @@ -139,7 +141,8 @@ void VAbstractSpline::hoverEnterEvent(QGraphicsSceneHoverEvent *event) void VAbstractSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(CorrectColor(lineColor), + const QSharedPointer curve = VAbstractTool::data.GeometricObject(id); + this->setPen(QPen(CorrectColor(curve->GetColor()), qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor)); if (detailsMode) { @@ -231,7 +234,7 @@ QPainterPath VAbstractSpline::ToolPath(PathDirection direction) const //--------------------------------------------------------------------------------------------------------------------- void VAbstractSpline::ReadToolAttributes(const QDomElement &domElement) { - lineColor = doc->GetParametrString(domElement, AttrColor, ColorBlack); + Q_UNUSED(domElement) } //--------------------------------------------------------------------------------------------------------------------- @@ -239,7 +242,8 @@ void VAbstractSpline::SaveOptions(QDomElement &tag, QSharedPointer &ob { VDrawTool::SaveOptions(tag, obj); - doc->SetAttribute(tag, AttrColor, lineColor); + const QSharedPointer curve = qSharedPointerCast(obj); + doc->SetAttribute(tag, AttrColor, curve->GetColor()); } //--------------------------------------------------------------------------------------------------------------------- @@ -317,7 +321,8 @@ void VAbstractSpline::setEnabled(bool enabled) QGraphicsPathItem::setEnabled(enabled); if (enabled) { - setPen(QPen(QColor(lineColor), + const QSharedPointer curve = VAbstractTool::data.GeometricObject(id); + setPen(QPen(QColor(curve->GetColor()), qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor)); } else @@ -327,6 +332,22 @@ void VAbstractSpline::setEnabled(bool enabled) } } +//--------------------------------------------------------------------------------------------------------------------- +QString VAbstractSpline::GetLineColor() const +{ + const QSharedPointer curve = VAbstractTool::data.GeometricObject(id); + return curve->GetColor(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VAbstractSpline::SetLineColor(const QString &value) +{ + QSharedPointer curve = VAbstractTool::data.GeometricObject(id); + curve->SetColor(value); + QSharedPointer obj = qSharedPointerCast(curve); + SaveOption(obj); +} + //--------------------------------------------------------------------------------------------------------------------- QString VAbstractSpline::name() const { diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.h b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.h index 656e65b50..148d499b0 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.h @@ -50,6 +50,9 @@ public: void setEnabled(bool enabled); + QString GetLineColor() const; + void SetLineColor(const QString &value); + QString name() const; virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp index 9ae207749..11b059691 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp @@ -47,13 +47,11 @@ const QString VToolArc::ToolType = QStringLiteral("simple"); * @param typeCreation way we create this tool. * @param parent parent object */ -VToolArc::VToolArc(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color, - const Source &typeCreation, +VToolArc::VToolArc(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, QGraphicsItem *parent) :VAbstractSpline(doc, data, id, parent) { sceneType = SceneObject::Arc; - lineColor = color; this->setPath(ToolPath()); this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor)); @@ -76,7 +74,7 @@ void VToolArc::setDialog() dialogTool->SetF1(arc->GetFormulaF1()); dialogTool->SetF2(arc->GetFormulaF2()); dialogTool->SetRadius(arc->GetFormulaRadius()); - dialogTool->SetColor(lineColor); + dialogTool->SetColor(arc->GetColor()); } //--------------------------------------------------------------------------------------------------------------------- @@ -133,6 +131,7 @@ VToolArc* VToolArc::Create(const quint32 _id, const quint32 ¢er, QString &ra const VPointF c = *data->GeometricObject(center); VArc *arc = new VArc(c, calcRadius, radius, calcF1, f1, calcF2, f2 ); + arc->SetColor(color); quint32 id = _id; if (typeCreation == Source::FromGui) { @@ -151,7 +150,7 @@ VToolArc* VToolArc::Create(const quint32 _id, const quint32 ¢er, QString &ra VDrawTool::AddRecord(id, Tool::Arc, doc); if (parse == Document::FullParse) { - VToolArc *toolArc = new VToolArc(doc, data, id, color, typeCreation); + VToolArc *toolArc = new VToolArc(doc, data, id, typeCreation); scene->addItem(toolArc); InitArcToolConnections(scene, toolArc); doc->AddTool(id, toolArc); @@ -364,7 +363,8 @@ void VToolArc::SetVisualization() */ void VToolArc::RefreshGeometry() { - this->setPen(QPen(CorrectColor(lineColor), + const QSharedPointer arc = VAbstractTool::data.GeometricObject(id); + this->setPen(QPen(CorrectColor(arc->GetColor()), qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor)); this->setPath(ToolPath()); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.h b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.h index ac513f7c7..27e040b45 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.h @@ -73,7 +73,7 @@ protected: private: Q_DISABLE_COPY(VToolArc) - VToolArc(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color, const Source &typeCreation, + VToolArc(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, QGraphicsItem * parent = nullptr); virtual void RefreshGeometry() Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp index f872705a3..a57d12830 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp @@ -39,12 +39,11 @@ const QString VToolArcWithLength::ToolType = QStringLiteral("arcWithLength"); //--------------------------------------------------------------------------------------------------------------------- -VToolArcWithLength::VToolArcWithLength(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color, - const Source &typeCreation, QGraphicsItem *parent) +VToolArcWithLength::VToolArcWithLength(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, + QGraphicsItem *parent) :VAbstractSpline(doc, data, id, parent) { sceneType = SceneObject::Arc; - lineColor = color; this->setPath(ToolPath()); this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor)); @@ -64,7 +63,7 @@ void VToolArcWithLength::setDialog() dialogTool->SetF1(arc->GetFormulaF1()); dialogTool->SetLength(arc->GetFormulaLength()); dialogTool->SetRadius(arc->GetFormulaRadius()); - dialogTool->SetColor(lineColor); + dialogTool->SetColor(arc->GetColor()); } //--------------------------------------------------------------------------------------------------------------------- @@ -102,6 +101,7 @@ VToolArcWithLength *VToolArcWithLength::Create(const quint32 _id, const quint32 const VPointF c = *data->GeometricObject(center); VArc *arc = new VArc(calcLength, length, c, calcRadius, radius, calcF1, f1); + arc->SetColor(color); quint32 id = _id; if (typeCreation == Source::FromGui) { @@ -120,7 +120,7 @@ VToolArcWithLength *VToolArcWithLength::Create(const quint32 _id, const quint32 VDrawTool::AddRecord(id, Tool::ArcWithLength, doc); if (parse == Document::FullParse) { - VToolArcWithLength *toolArc = new VToolArcWithLength(doc, data, id, color, typeCreation); + VToolArcWithLength *toolArc = new VToolArcWithLength(doc, data, id, typeCreation); scene->addItem(toolArc); InitArcToolConnections(scene, toolArc); doc->AddTool(id, toolArc); @@ -317,7 +317,8 @@ void VToolArcWithLength::SetVisualization() //--------------------------------------------------------------------------------------------------------------------- void VToolArcWithLength::RefreshGeometry() { - this->setPen(QPen(CorrectColor(lineColor), + QSharedPointer arc = VAbstractTool::data.GeometricObject(id); + this->setPen(QPen(CorrectColor(arc->GetColor()), qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor)); this->setPath(ToolPath()); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.h b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.h index 13387a86c..ee0d718e5 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.h @@ -41,9 +41,9 @@ public: static VToolArcWithLength* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolArcWithLength* Create(const quint32 _id, const quint32 ¢er, QString &radius, QString &f1, - QString &length, const QString &color, VMainGraphicsScene *scene, - VAbstractPattern *doc, - VContainer *data, const Document &parse, const Source &typeCreation); + QString &length, const QString &color, VMainGraphicsScene *scene, + VAbstractPattern *doc, VContainer *data, const Document &parse, + const Source &typeCreation); static const QString ToolType; virtual int type() const Q_DECL_OVERRIDE {return Type;} @@ -72,8 +72,8 @@ protected: private: Q_DISABLE_COPY(VToolArcWithLength) - VToolArcWithLength(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color, - const Source &typeCreation, QGraphicsItem * parent = nullptr); + VToolArcWithLength(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, + QGraphicsItem * parent = nullptr); virtual void RefreshGeometry() Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp index 35f000c6a..ab3e81eb6 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp @@ -35,12 +35,11 @@ const QString VToolCubicBezier::ToolType = QStringLiteral("cubicBezier"); //--------------------------------------------------------------------------------------------------------------------- -VToolCubicBezier::VToolCubicBezier(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color, +VToolCubicBezier::VToolCubicBezier(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, QGraphicsItem *parent) :VAbstractSpline(doc, data, id, parent) { sceneType = SceneObject::Spline; - lineColor = color; this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor)); this->setPath(ToolPath()); @@ -62,7 +61,7 @@ void VToolCubicBezier::setDialog() SCASSERT(dialogTool != nullptr); const auto spl = VAbstractTool::data.GeometricObject(id); dialogTool->SetSpline(*spl); - dialogTool->SetColor(lineColor); + dialogTool->SetColor(spl->GetColor()); } //--------------------------------------------------------------------------------------------------------------------- @@ -89,6 +88,7 @@ VToolCubicBezier *VToolCubicBezier::Create(const quint32 _id, VCubicBezier *spli const Document &parse, const Source &typeCreation) { quint32 id = _id; + spline->SetColor(color); if (typeCreation == Source::FromGui) { id = data->AddGObject(spline); @@ -106,7 +106,7 @@ VToolCubicBezier *VToolCubicBezier::Create(const quint32 _id, VCubicBezier *spli VDrawTool::AddRecord(id, Tool::CubicBezier, doc); if (parse == Document::FullParse) { - auto _spl = new VToolCubicBezier(doc, data, id, color, typeCreation); + auto _spl = new VToolCubicBezier(doc, data, id, typeCreation); scene->addItem(_spl); InitSplineToolConnections(scene, _spl); doc->AddTool(id, _spl); @@ -209,7 +209,8 @@ void VToolCubicBezier::SetVisualization() //--------------------------------------------------------------------------------------------------------------------- void VToolCubicBezier::RefreshGeometry() { - this->setPen(QPen(CorrectColor(lineColor), + const QSharedPointer spl = VAbstractTool::data.GeometricObject(id); + this->setPen(QPen(CorrectColor(spl->GetColor()), qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor)); if (isHovered || detailsMode) { diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.h b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.h index aac2d5dcd..53be60915 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.h @@ -61,8 +61,8 @@ protected: private: Q_DISABLE_COPY(VToolCubicBezier) - VToolCubicBezier(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color, - const Source &typeCreation, QGraphicsItem * parent = nullptr); + VToolCubicBezier(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, + QGraphicsItem * parent = nullptr); virtual void RefreshGeometry() Q_DECL_OVERRIDE; void SetSplineAttributes(QDomElement &domElement, const VCubicBezier &spl); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp index a5febd61e..db00f4325 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp @@ -33,12 +33,11 @@ const QString VToolCubicBezierPath::ToolType = QStringLiteral("cubicBezierPath"); //--------------------------------------------------------------------------------------------------------------------- -VToolCubicBezierPath::VToolCubicBezierPath(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color, +VToolCubicBezierPath::VToolCubicBezierPath(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, QGraphicsItem *parent) : VAbstractSpline(doc, data, id, parent) { sceneType = SceneObject::SplinePath; - lineColor = color; this->setPath(ToolPath()); this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor)); @@ -60,7 +59,7 @@ void VToolCubicBezierPath::setDialog() SCASSERT(dialogTool != nullptr); const QSharedPointer splPath = VAbstractTool::data.GeometricObject(id); dialogTool->SetPath(*splPath); - dialogTool->SetColor(lineColor); + dialogTool->SetColor(splPath->GetColor()); } //--------------------------------------------------------------------------------------------------------------------- @@ -90,6 +89,7 @@ VToolCubicBezierPath *VToolCubicBezierPath::Create(const quint32 _id, VCubicBezi const Document &parse, const Source &typeCreation) { quint32 id = _id; + path->SetColor(color); if (typeCreation == Source::FromGui) { id = data->AddGObject(path); @@ -107,7 +107,7 @@ VToolCubicBezierPath *VToolCubicBezierPath::Create(const quint32 _id, VCubicBezi VDrawTool::AddRecord(id, Tool::CubicBezierPath, doc); if (parse == Document::FullParse) { - VToolCubicBezierPath *spl = new VToolCubicBezierPath(doc, data, id, color, typeCreation); + VToolCubicBezierPath *spl = new VToolCubicBezierPath(doc, data, id, typeCreation); scene->addItem(spl); InitSplinePathToolConnections(scene, spl); doc->AddTool(id, spl); @@ -214,7 +214,8 @@ void VToolCubicBezierPath::RefreshGeometry() { isHovered || detailsMode ? setPath(ToolPath(PathDirection::Show)) : setPath(ToolPath()); - this->setPen(QPen(CorrectColor(lineColor), + QSharedPointer splPath = VAbstractTool::data.GeometricObject(id); + this->setPen(QPen(CorrectColor(splPath->GetColor()), qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor)); SetVisualization(); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.h b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.h index 9bb438426..7761f8dee 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.h @@ -63,7 +63,7 @@ protected: private: Q_DISABLE_COPY(VToolCubicBezierPath) - VToolCubicBezierPath(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color, + VToolCubicBezierPath(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, QGraphicsItem * parent = nullptr); virtual void RefreshGeometry() Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp index 79438841d..b074d6260 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp @@ -52,13 +52,11 @@ const QString VToolSpline::OldToolType = QStringLiteral("simple"); * @param typeCreation way we create this tool. * @param parent parent object. */ -VToolSpline::VToolSpline(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color, - const Source &typeCreation, +VToolSpline::VToolSpline(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, QGraphicsItem *parent) :VAbstractSpline(doc, data, id, parent), oldPosition() { sceneType = SceneObject::Spline; - lineColor = color; this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor)); this->setFlag(QGraphicsItem::ItemIsMovable, true); @@ -114,7 +112,7 @@ void VToolSpline::setDialog() SCASSERT(dialogTool != nullptr); const auto spl = VAbstractTool::data.GeometricObject(id); dialogTool->SetSpline(*spl); - dialogTool->SetColor(lineColor); + dialogTool->SetColor(spl->GetColor()); } //--------------------------------------------------------------------------------------------------------------------- @@ -132,8 +130,9 @@ VToolSpline* VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, auto dialogTool = qobject_cast(dialog); SCASSERT(dialogTool != nullptr); - auto spl = Create(0, new VSpline(dialogTool->GetSpline()), dialogTool->GetColor(), scene, doc, data, - Document::FullParse, Source::FromGui); + VSpline *spline = new VSpline(dialogTool->GetSpline()); + + auto spl = Create(0, spline, dialogTool->GetColor(), scene, doc, data, Document::FullParse, Source::FromGui); if (spl != nullptr) { @@ -147,7 +146,6 @@ VToolSpline* VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, * @brief Create help create tool. * @param _id tool id, 0 if tool doesn't exist yet. * @param spline spline. - * @param color spline color. * @param scene pointer to scene. * @param doc dom document container. * @param data container with variables. @@ -160,6 +158,7 @@ VToolSpline* VToolSpline::Create(const quint32 _id, VSpline *spline, const QStri const Source &typeCreation) { quint32 id = _id; + spline->SetColor(color); if (typeCreation == Source::FromGui) { id = data->AddGObject(spline); @@ -177,7 +176,7 @@ VToolSpline* VToolSpline::Create(const quint32 _id, VSpline *spline, const QStri VDrawTool::AddRecord(id, Tool::Spline, doc); if (parse == Document::FullParse) { - auto _spl = new VToolSpline(doc, data, id, color, typeCreation); + auto _spl = new VToolSpline(doc, data, id, typeCreation); scene->addItem(_spl); InitSplineToolConnections(scene, _spl); doc->AddTool(id, _spl); @@ -508,7 +507,9 @@ void VToolSpline::RefreshGeometry() point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false); } - this->setPen(QPen(CorrectColor(lineColor), + const auto spl = VAbstractTool::data.GeometricObject(id); + + this->setPen(QPen(CorrectColor(spl->GetColor()), qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor)); if (isHovered || detailsMode) { @@ -522,8 +523,6 @@ void VToolSpline::RefreshGeometry() controlPoints[0]->blockSignals(true); controlPoints[1]->blockSignals(true); - const auto spl = VAbstractTool::data.GeometricObject(id); - { const bool freeAngle1 = qmu::QmuTokenParser::IsSingle(spl->GetStartAngleFormula()); const bool freeLength1 = qmu::QmuTokenParser::IsSingle(spl->GetC1LengthFormula()); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.h b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.h index 183cbdf47..344e9542f 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.h @@ -78,7 +78,7 @@ private: Q_DISABLE_COPY(VToolSpline) QPointF oldPosition; - VToolSpline (VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color, const Source &typeCreation, + VToolSpline (VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, QGraphicsItem * parent = nullptr ); bool IsMovable() const; diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp index f51dee600..917b2757c 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp @@ -51,14 +51,13 @@ const QString VToolSplinePath::OldToolType = QStringLiteral("path"); * @param typeCreation way we create this tool. * @param parent parent object. */ -VToolSplinePath::VToolSplinePath(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color, - const Source &typeCreation, QGraphicsItem *parent) +VToolSplinePath::VToolSplinePath(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, + QGraphicsItem *parent) : VAbstractSpline(doc, data, id, parent), oldPosition(), splIndex(-1) { sceneType = SceneObject::SplinePath; - lineColor = color; this->setPath(ToolPath()); this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor)); @@ -117,7 +116,7 @@ void VToolSplinePath::setDialog() SCASSERT(dialogTool != nullptr); const QSharedPointer splPath = VAbstractTool::data.GeometricObject(id); dialogTool->SetPath(*splPath); - dialogTool->SetColor(lineColor); + dialogTool->SetColor(splPath->GetColor()); } //--------------------------------------------------------------------------------------------------------------------- @@ -135,12 +134,12 @@ VToolSplinePath* VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene DialogSplinePath *dialogTool = qobject_cast(dialog); SCASSERT(dialogTool != nullptr); VSplinePath *path = new VSplinePath(dialogTool->GetPath()); - const QString color = dialogTool->GetColor(); for (qint32 i = 0; i < path->CountPoints(); ++i) { doc->IncrementReferens((*path)[i].P().getIdTool()); } - VToolSplinePath* spl = Create(0, path, color, scene, doc, data, Document::FullParse, Source::FromGui); + VToolSplinePath* spl = Create(0, path, dialogTool->GetColor(), scene, doc, data, Document::FullParse, + Source::FromGui); if (spl != nullptr) { spl->dialog=dialogTool; @@ -164,6 +163,7 @@ VToolSplinePath* VToolSplinePath::Create(const quint32 _id, VSplinePath *path, c const Document &parse, const Source &typeCreation) { quint32 id = _id; + path->SetColor(color); if (typeCreation == Source::FromGui) { id = data->AddGObject(path); @@ -181,7 +181,7 @@ VToolSplinePath* VToolSplinePath::Create(const quint32 _id, VSplinePath *path, c VDrawTool::AddRecord(id, Tool::SplinePath, doc); if (parse == Document::FullParse) { - VToolSplinePath *spl = new VToolSplinePath(doc, data, id, color, typeCreation); + VToolSplinePath *spl = new VToolSplinePath(doc, data, id, typeCreation); scene->addItem(spl); InitSplinePathToolConnections(scene, spl); doc->AddTool(id, spl); @@ -631,10 +631,10 @@ void VToolSplinePath::RefreshGeometry() this->setPath(ToolPath()); } - this->setPen(QPen(CorrectColor(lineColor), + const auto splPath = VAbstractTool::data.GeometricObject(id); + this->setPen(QPen(CorrectColor(splPath->GetColor()), qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor)); - const auto splPath = VAbstractTool::data.GeometricObject(id); for (qint32 i = 1; i<=splPath->CountSubSpl(); ++i) { const qint32 j = i*2; diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.h b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.h index bb37395f2..b6e963332 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.h @@ -47,10 +47,8 @@ public: static VToolSplinePath *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolSplinePath *Create(const quint32 _id, VSplinePath *path, const QString &color, - VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data, - const Document &parse, - const Source &typeCreation); - + VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data, + const Document &parse, const Source &typeCreation); static VToolSplinePath *Create(const quint32 _id, const QVector &points, QVector &a1, QVector &a2, QVector &l1, QVector &l2, const QString &color, VMainGraphicsScene *scene, VAbstractPattern *doc, @@ -101,8 +99,8 @@ private: QPointF oldPosition; int splIndex; - VToolSplinePath(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color, - const Source &typeCreation, QGraphicsItem * parent = nullptr); + VToolSplinePath(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, + QGraphicsItem *parent = nullptr); bool IsMovable(int index) const; virtual void RefreshGeometry() Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp index d78c488e3..4082a8e76 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp @@ -32,12 +32,10 @@ //--------------------------------------------------------------------------------------------------------------------- VToolCut::VToolCut(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula, - const quint32 &curveCutId, const QString &color, QGraphicsItem *parent) + const quint32 &curveCutId, QGraphicsItem *parent) :VToolSinglePoint(doc, data, id, parent), formula(formula), curveCutId(curveCutId), detailsMode(false) { Q_ASSERT_X(curveCutId != 0, Q_FUNC_INFO, "curveCutId == 0"); //-V654 //-V712 - - lineColor = color; } //--------------------------------------------------------------------------------------------------------------------- @@ -137,11 +135,3 @@ void VToolCut::FullUpdateCurveFromFile(const QString &attrCurve) curveCutId = domElement.attribute(attrCurve, "").toUInt(); } } - -//--------------------------------------------------------------------------------------------------------------------- -void VToolCut::SaveOptions(QDomElement &tag, QSharedPointer &obj) -{ - VToolSinglePoint::SaveOptions(tag, obj); - - doc->SetAttribute(tag, AttrColor, lineColor); -} diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.h index 8e580a250..a44a7a72d 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.h @@ -39,7 +39,7 @@ class VToolCut : public VToolSinglePoint Q_OBJECT public: VToolCut(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula, - const quint32 &curveCutId, const QString &color, QGraphicsItem * parent = nullptr); + const quint32 &curveCutId, QGraphicsItem * parent = nullptr); virtual int type() const Q_DECL_OVERRIDE {return Type;} enum { Type = UserType + static_cast(Tool::Cut)}; @@ -63,7 +63,6 @@ protected: void RefreshGeometry(); virtual void RemoveReferens() Q_DECL_OVERRIDE; void FullUpdateCurveFromFile(const QString &attrCurve); - virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; template void ShowToolVisualization(bool show); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp index 181a464e5..b01ce84ec 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp @@ -44,14 +44,12 @@ const QString VToolCutArc::ToolType = QStringLiteral("cutArc"); * @param id object id in container. * @param formula string with formula length first arc. * @param arcId id arc in data container. - * @param color arc color. * @param typeCreation way we create this tool. * @param parent parent object. */ VToolCutArc::VToolCutArc(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula, - const quint32 &arcId, const QString &color, const Source &typeCreation, - QGraphicsItem * parent) - :VToolCut(doc, data, id, formula, arcId, color, parent) + const quint32 &arcId, const Source &typeCreation, QGraphicsItem * parent) + :VToolCut(doc, data, id, formula, arcId, parent) { ToolCreation(typeCreation); } @@ -69,7 +67,6 @@ void VToolCutArc::setDialog() dialogTool->SetFormula(formula); dialogTool->setArcId(curveCutId); dialogTool->SetPointName(point->name()); - dialogTool->SetColor(lineColor); } //--------------------------------------------------------------------------------------------------------------------- @@ -88,8 +85,7 @@ VToolCutArc* VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, const QString pointName = dialogTool->getPointName(); QString formula = dialogTool->GetFormula(); const quint32 arcId = dialogTool->getArcId(); - const QString color = dialogTool->GetColor(); - VToolCutArc* point = Create(0, pointName, formula, arcId, 5, 10, color, scene, doc, data, Document::FullParse, + VToolCutArc* point = Create(0, pointName, formula, arcId, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui); if (point != nullptr) { @@ -114,9 +110,8 @@ VToolCutArc* VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, * @param typeCreation way we create this tool. */ VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId, - const qreal &mx, const qreal &my, const QString &color, VMainGraphicsScene *scene, - VAbstractPattern *doc, VContainer *data, const Document &parse, - const Source &typeCreation) + const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VAbstractPattern *doc, + VContainer *data, const Document &parse, const Source &typeCreation) { const QSharedPointer arc = data->GeometricObject(arcId); @@ -155,7 +150,7 @@ VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QS VDrawTool::AddRecord(id, Tool::CutArc, doc); if (parse == Document::FullParse) { - VToolCutArc *point = new VToolCutArc(doc, data, id, formula, arcId, color, typeCreation); + VToolCutArc *point = new VToolCutArc(doc, data, id, formula, arcId, typeCreation); scene->addItem(point); InitToolConnections(scene, point); doc->AddTool(id, point); @@ -201,7 +196,6 @@ void VToolCutArc::SaveDialog(QDomElement &domElement) doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula()); doc->SetAttribute(domElement, AttrArc, QString().setNum(dialogTool->getArcId())); - doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor()); } //--------------------------------------------------------------------------------------------------------------------- @@ -219,7 +213,6 @@ void VToolCutArc::ReadToolAttributes(const QDomElement &domElement) { formula = doc->GetParametrString(domElement, AttrLength, ""); curveCutId = doc->GetParametrUInt(domElement, AttrArc, NULL_ID_STR); - lineColor = doc->GetParametrString(domElement, AttrColor, ColorBlack); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h index fbed4e8fa..de0140e92 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h @@ -41,7 +41,7 @@ public: virtual void setDialog() Q_DECL_OVERRIDE; static VToolCutArc* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolCutArc* Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId, - const qreal &mx, const qreal &my, const QString &color, VMainGraphicsScene *scene, + const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation); static const QString ToolType; @@ -58,8 +58,7 @@ private: Q_DISABLE_COPY(VToolCutArc) VToolCutArc(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula, - const quint32 &arcId, const QString &color, const Source &typeCreation, - QGraphicsItem * parent = nullptr); + const quint32 &arcId, const Source &typeCreation, QGraphicsItem * parent = nullptr); }; #endif // VTOOLCUTARC_H diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp index 2f959f3bc..4bcea1f65 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp @@ -45,14 +45,12 @@ const QString VToolCutSpline::AttrSpline = QStringLiteral("spline"); * @param id object id in container. * @param formula string with formula length first spline. * @param splineId id spline in data container. - * @param color spline color. * @param typeCreation way we create this tool. * @param parent parent object. */ VToolCutSpline::VToolCutSpline(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula, - const quint32 &splineId, const QString &color, const Source &typeCreation, - QGraphicsItem *parent) - :VToolCut(doc, data, id, formula, splineId, color, parent) + const quint32 &splineId, const Source &typeCreation, QGraphicsItem *parent) + :VToolCut(doc, data, id, formula, splineId, parent) { ToolCreation(typeCreation); } @@ -70,7 +68,6 @@ void VToolCutSpline::setDialog() dialogTool->SetFormula(formula); dialogTool->setSplineId(curveCutId); dialogTool->SetPointName(point->name()); - dialogTool->SetColor(lineColor); } //--------------------------------------------------------------------------------------------------------------------- @@ -90,8 +87,7 @@ VToolCutSpline* VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *s const QString pointName = dialogTool->getPointName(); QString formula = dialogTool->GetFormula(); const quint32 splineId = dialogTool->getSplineId(); - const QString color = dialogTool->GetColor(); - VToolCutSpline* point = Create(0, pointName, formula, splineId, 5, 10, color, scene, doc, data, Document::FullParse, + VToolCutSpline* point = Create(0, pointName, formula, splineId, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui); if (point != nullptr) { @@ -116,7 +112,7 @@ VToolCutSpline* VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *s * @param typeCreation way we create this tool. */ VToolCutSpline* VToolCutSpline::Create(const quint32 _id, const QString &pointName, QString &formula, - const quint32 &splineId, const qreal &mx, const qreal &my, const QString &color, + const quint32 &splineId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation) { @@ -152,7 +148,7 @@ VToolCutSpline* VToolCutSpline::Create(const quint32 _id, const QString &pointNa VDrawTool::AddRecord(id, Tool::CutSpline, doc); if (parse == Document::FullParse) { - VToolCutSpline *point = new VToolCutSpline(doc, data, id, formula, splineId, color, typeCreation); + VToolCutSpline *point = new VToolCutSpline(doc, data, id, formula, splineId, typeCreation); scene->addItem(point); InitToolConnections(scene, point); doc->AddTool(id, point); @@ -198,7 +194,6 @@ void VToolCutSpline::SaveDialog(QDomElement &domElement) doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula()); doc->SetAttribute(domElement, AttrSpline, QString().setNum(dialogTool->getSplineId())); - doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor()); } //--------------------------------------------------------------------------------------------------------------------- @@ -216,7 +211,6 @@ void VToolCutSpline::ReadToolAttributes(const QDomElement &domElement) { formula = doc->GetParametrString(domElement, AttrLength, ""); curveCutId = doc->GetParametrUInt(domElement, AttrSpline, NULL_ID_STR); - lineColor = doc->GetParametrString(domElement, AttrColor, ColorBlack); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h index dd49e5667..7f614aadf 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h @@ -42,7 +42,7 @@ public: static VToolCutSpline *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolCutSpline *Create(const quint32 _id, const QString &pointName, QString &formula, - const quint32 &splineId, const qreal &mx, const qreal &my, const QString &color, + const quint32 &splineId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation); @@ -61,8 +61,7 @@ private: Q_DISABLE_COPY(VToolCutSpline) VToolCutSpline(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula, - const quint32 &splineId, const QString &color, const Source &typeCreation, - QGraphicsItem * parent = nullptr); + const quint32 &splineId, const Source &typeCreation, QGraphicsItem * parent = nullptr); }; #endif // VTOOLCUTSPLINE_H diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp index dec424071..df8264140 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp @@ -45,14 +45,13 @@ const QString VToolCutSplinePath::AttrSplinePath = QStringLiteral("splinePath"); * @param id object id in container. * @param formula string with formula length first splinePath. * @param splinePathId id splinePath (we cut this splinePath) in data container. - * @param color spline path color. * @param typeCreation way we create this tool. * @param parent parent object. */ VToolCutSplinePath::VToolCutSplinePath(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula, const quint32 &splinePathId, - const QString &color, const Source &typeCreation, QGraphicsItem *parent) - :VToolCut(doc, data, id, formula, splinePathId, color, parent) + const Source &typeCreation, QGraphicsItem *parent) + :VToolCut(doc, data, id, formula, splinePathId, parent) { ToolCreation(typeCreation); } @@ -70,7 +69,6 @@ void VToolCutSplinePath::setDialog() dialogTool->SetFormula(formula); dialogTool->setSplinePathId(curveCutId); dialogTool->SetPointName(point->name()); - dialogTool->SetColor(lineColor); } //--------------------------------------------------------------------------------------------------------------------- @@ -90,8 +88,7 @@ VToolCutSplinePath* VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphics const QString pointName = dialogTool->getPointName(); QString formula = dialogTool->GetFormula(); const quint32 splinePathId = dialogTool->getSplinePathId(); - const QString color = dialogTool->GetColor(); - VToolCutSplinePath* point = Create(0, pointName, formula, splinePathId, 5, 10, color, scene, doc, data, + VToolCutSplinePath* point = Create(0, pointName, formula, splinePathId, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui); if (point != nullptr) { @@ -117,7 +114,7 @@ VToolCutSplinePath* VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphics */ VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &splinePathId, const qreal &mx, const qreal &my, - const QString &color, VMainGraphicsScene *scene, VAbstractPattern *doc, + VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation) { const auto splPath = data->GeometricObject(splinePathId); @@ -160,7 +157,7 @@ VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString VDrawTool::AddRecord(id, Tool::CutSplinePath, doc); if (parse == Document::FullParse) { - VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, color, typeCreation); + VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, typeCreation); scene->addItem(point); InitToolConnections(scene, point); doc->AddTool(id, point); @@ -282,7 +279,6 @@ void VToolCutSplinePath::SaveDialog(QDomElement &domElement) doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula()); doc->SetAttribute(domElement, AttrSplinePath, QString().setNum(dialogTool->getSplinePathId())); - doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor()); } //--------------------------------------------------------------------------------------------------------------------- @@ -300,7 +296,6 @@ void VToolCutSplinePath::ReadToolAttributes(const QDomElement &domElement) { formula = doc->GetParametrString(domElement, AttrLength, ""); curveCutId = doc->GetParametrUInt(domElement, AttrSplinePath, NULL_ID_STR); - lineColor = doc->GetParametrString(domElement, AttrColor, ColorBlack); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h index 09b4a1459..8b5dbb593 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h @@ -47,8 +47,7 @@ public: VContainer *data); static VToolCutSplinePath *Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &splinePathId, const qreal &mx, const qreal &my, - const QString &color, VMainGraphicsScene *scene, VAbstractPattern *doc, - VContainer *data, + VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation); static const QString ToolType; static const QString AttrSplinePath; @@ -69,8 +68,7 @@ private: Q_DISABLE_COPY(VToolCutSplinePath) VToolCutSplinePath(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &formula, - const quint32 &splinePathId, const QString &color, const Source &typeCreation, - QGraphicsItem * parent = nullptr); + const quint32 &splinePathId, const Source &typeCreation, QGraphicsItem * parent = nullptr); }; #endif // VTOOLCUTSPLINEPATH_H diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp index e5396e600..85405cf8e 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp @@ -46,7 +46,7 @@ VToolLinePoint::VToolLinePoint(VAbstractPattern *doc, VContainer *data, const qu const QString &lineColor, const QString &formula, const quint32 &basePointId, const qreal &angle, QGraphicsItem *parent) :VToolSinglePoint(doc, data, id, parent), formulaLength(formula), angle(angle), basePointId(basePointId), - mainLine(nullptr) + mainLine(nullptr), lineColor(ColorBlack) { this->typeLine = typeLine; this->lineColor = lineColor; @@ -145,6 +145,21 @@ void VToolLinePoint::SetAngle(const qreal &value) SaveOption(obj); } +//--------------------------------------------------------------------------------------------------------------------- +QString VToolLinePoint::GetLineColor() const +{ + return lineColor; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolLinePoint::SetLineColor(const QString &value) +{ + lineColor = value; + + QSharedPointer obj = VAbstractTool::data.GetGObject(id); + SaveOption(obj); +} + //--------------------------------------------------------------------------------------------------------------------- quint32 VToolLinePoint::GetBasePointId() const { diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.h index 225691dd7..e9ca4a01b 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.h @@ -45,14 +45,18 @@ public: virtual ~VToolLinePoint() Q_DECL_OVERRIDE; virtual int type() const Q_DECL_OVERRIDE {return Type;} enum { Type = UserType + static_cast(Tool::LinePoint)}; - VFormula GetFormulaLength() const; - void SetFormulaLength(const VFormula &value); - quint32 GetBasePointId() const; - void SetBasePointId(const quint32 &value); + VFormula GetFormulaLength() const; + void SetFormulaLength(const VFormula &value); - qreal GetAngle() const; - void SetAngle(const qreal &value); + quint32 GetBasePointId() const; + void SetBasePointId(const quint32 &value); + + qreal GetAngle() const; + void SetAngle(const qreal &value); + + QString GetLineColor() const; + void SetLineColor(const QString &value); public slots: virtual void SetFactor(qreal factor) Q_DECL_OVERRIDE; @@ -66,11 +70,14 @@ protected: qreal angle; /** @brief basePointId id base line point. */ - quint32 basePointId; + quint32 basePointId; /** @brief mainLine line item. */ QGraphicsLineItem *mainLine; + /** @brief lineColor color of a line. */ + QString lineColor; + virtual void RefreshGeometry(); virtual void RemoveReferens() Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/tools/drawTools/vdrawtool.cpp b/src/libs/vtools/tools/drawTools/vdrawtool.cpp index 96dec91e1..bd4596537 100644 --- a/src/libs/vtools/tools/drawTools/vdrawtool.cpp +++ b/src/libs/vtools/tools/drawTools/vdrawtool.cpp @@ -47,7 +47,7 @@ qreal VDrawTool::factor = 1; */ VDrawTool::VDrawTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent) :VAbstractTool(doc, data, id, parent), nameActivDraw(doc->GetNameActivPP()), - dialog(nullptr), typeLine(TypeLineLine), lineColor(ColorBlack), enabled(true) + dialog(nullptr), typeLine(TypeLineLine), enabled(true) { connect(this->doc, &VAbstractPattern::ChangedActivPP, this, &VDrawTool::ChangedActivDraw); connect(this->doc, &VAbstractPattern::ChangedNameDraw, this, &VDrawTool::ChangedNameDraw); @@ -384,19 +384,3 @@ void VDrawTool::SetTypeLine(const QString &value) QSharedPointer obj = VAbstractTool::data.GetGObject(id); SaveOption(obj); } - -//--------------------------------------------------------------------------------------------------------------------- -QString VDrawTool::GetLineColor() const -{ - return lineColor; -} - - -//--------------------------------------------------------------------------------------------------------------------- -void VDrawTool::SetLineColor(const QString &value) -{ - lineColor = value; - - QSharedPointer obj = VAbstractTool::data.GetGObject(id); - SaveOption(obj); -} diff --git a/src/libs/vtools/tools/drawTools/vdrawtool.h b/src/libs/vtools/tools/drawTools/vdrawtool.h index 76e8adfa3..3d6588eb4 100644 --- a/src/libs/vtools/tools/drawTools/vdrawtool.h +++ b/src/libs/vtools/tools/drawTools/vdrawtool.h @@ -58,9 +58,6 @@ public: QString getLineType() const; virtual void SetTypeLine(const QString &value); - QString GetLineColor() const; - virtual void SetLineColor(const QString &value); - signals: void ChangedToolSelection(bool selected, quint32 object, quint32 tool); @@ -88,9 +85,6 @@ protected: /** @brief typeLine line type. */ QString typeLine; - /** @brief lineColor color line or curve, but not a point. */ - QString lineColor; - bool enabled; void AddToCalculation(const QDomElement &domElement); diff --git a/src/libs/vtools/tools/drawTools/vtoolline.cpp b/src/libs/vtools/tools/drawTools/vtoolline.cpp index 7b3604f8a..2839801dd 100644 --- a/src/libs/vtools/tools/drawTools/vtoolline.cpp +++ b/src/libs/vtools/tools/drawTools/vtoolline.cpp @@ -48,7 +48,8 @@ VToolLine::VToolLine(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint, const QString &typeLine, const QString &lineColor, const Source &typeCreation, QGraphicsItem *parent) - :VDrawTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint) + :VDrawTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint), + lineColor(ColorBlack) { this->typeLine = typeLine; this->lineColor = lineColor; @@ -459,6 +460,12 @@ void VToolLine::SetTypeLine(const QString &value) SaveOption(obj); } +//--------------------------------------------------------------------------------------------------------------------- +QString VToolLine::GetLineColor() const +{ + return lineColor; +} + //--------------------------------------------------------------------------------------------------------------------- void VToolLine::SetLineColor(const QString &value) { diff --git a/src/libs/vtools/tools/drawTools/vtoolline.h b/src/libs/vtools/tools/drawTools/vtoolline.h index 0e06e9777..ebbf96e74 100644 --- a/src/libs/vtools/tools/drawTools/vtoolline.h +++ b/src/libs/vtools/tools/drawTools/vtoolline.h @@ -55,10 +55,12 @@ public: quint32 GetSecondPoint() const; void SetSecondPoint(const quint32 &value); + QString GetLineColor() const; + void SetLineColor(const QString &value); + virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; virtual void SetTypeLine(const QString &value) Q_DECL_OVERRIDE; - virtual void SetLineColor(const QString &value) Q_DECL_OVERRIDE; virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE; public slots: virtual void FullUpdateFromFile() Q_DECL_OVERRIDE; @@ -89,6 +91,9 @@ private: /** @brief secondPoint id second line point. */ quint32 secondPoint; + /** @brief lineColor color of a line. */ + QString lineColor; + VToolLine(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint, const QString &typeLine, const QString &lineColor, const Source &typeCreation, QGraphicsItem * parent = nullptr);