diff --git a/src/app/dialogs/tools/dialogcutarc.cpp b/src/app/dialogs/tools/dialogcutarc.cpp
index 935642187..6650a4751 100644
--- a/src/app/dialogs/tools/dialogcutarc.cpp
+++ b/src/app/dialogs/tools/dialogcutarc.cpp
@@ -58,6 +58,7 @@ DialogCutArc::DialogCutArc(const VContainer *data, const quint32 &toolId, QWidge
CheckState();
FillComboBoxArcs(ui->comboBoxArc);
+ FillComboBoxLineColors(ui->comboBoxColor);
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutArc::PutHere);
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutArc::PutVal);
@@ -157,6 +158,18 @@ void DialogCutArc::setArcId(const quint32 &value)
path->setPoint1Id(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/app/dialogs/tools/dialogcutarc.h b/src/app/dialogs/tools/dialogcutarc.h
index 91f8dec79..f9ba4aa07 100644
--- a/src/app/dialogs/tools/dialogcutarc.h
+++ b/src/app/dialogs/tools/dialogcutarc.h
@@ -56,6 +56,9 @@ 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);
/**
diff --git a/src/app/dialogs/tools/dialogcutarc.ui b/src/app/dialogs/tools/dialogcutarc.ui
index 8313e5784..498309600 100644
--- a/src/app/dialogs/tools/dialogcutarc.ui
+++ b/src/app/dialogs/tools/dialogcutarc.ui
@@ -7,7 +7,7 @@
0
0
412
- 433
+ 466
@@ -250,6 +250,16 @@
-
+ -
+
+
+ Color
+
+
+
+ -
+
+
-
diff --git a/src/app/dialogs/tools/dialogcutspline.cpp b/src/app/dialogs/tools/dialogcutspline.cpp
index 2c386cbd3..13a55e935 100644
--- a/src/app/dialogs/tools/dialogcutspline.cpp
+++ b/src/app/dialogs/tools/dialogcutspline.cpp
@@ -57,6 +57,7 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, const quint32 &toolId,
CheckState();
FillComboBoxSplines(ui->comboBoxSpline);
+ FillComboBoxLineColors(ui->comboBoxColor);
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutSpline::PutHere);
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutSpline::PutVal);
@@ -119,6 +120,18 @@ void DialogCutSpline::setSplineId(const quint32 &value)
path->setPoint1Id(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/app/dialogs/tools/dialogcutspline.h b/src/app/dialogs/tools/dialogcutspline.h
index 886860aab..12665a998 100644
--- a/src/app/dialogs/tools/dialogcutspline.h
+++ b/src/app/dialogs/tools/dialogcutspline.h
@@ -55,6 +55,9 @@ 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);
/**
diff --git a/src/app/dialogs/tools/dialogcutspline.ui b/src/app/dialogs/tools/dialogcutspline.ui
index 3107db846..c7df135dc 100644
--- a/src/app/dialogs/tools/dialogcutspline.ui
+++ b/src/app/dialogs/tools/dialogcutspline.ui
@@ -7,7 +7,7 @@
0
0
412
- 433
+ 466
@@ -217,7 +217,7 @@
-
-
+
0
0
@@ -237,7 +237,7 @@
-
-
+
0
0
@@ -250,6 +250,16 @@
-
+ -
+
+
+ Color
+
+
+
+ -
+
+
-
diff --git a/src/app/dialogs/tools/dialogcutsplinepath.cpp b/src/app/dialogs/tools/dialogcutsplinepath.cpp
index 90178bd55..507d53a3e 100644
--- a/src/app/dialogs/tools/dialogcutsplinepath.cpp
+++ b/src/app/dialogs/tools/dialogcutsplinepath.cpp
@@ -57,6 +57,7 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, const quint32 &
CheckState();
FillComboBoxSplinesPath(ui->comboBoxSplinePath);
+ FillComboBoxLineColors(ui->comboBoxColor);
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutSplinePath::PutHere);
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutSplinePath::PutVal);
@@ -119,6 +120,18 @@ void DialogCutSplinePath::setSplinePathId(const quint32 &value)
path->setPoint1Id(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/app/dialogs/tools/dialogcutsplinepath.h b/src/app/dialogs/tools/dialogcutsplinepath.h
index 8de2c016e..340c91fbb 100644
--- a/src/app/dialogs/tools/dialogcutsplinepath.h
+++ b/src/app/dialogs/tools/dialogcutsplinepath.h
@@ -55,6 +55,9 @@ 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);
/**
diff --git a/src/app/dialogs/tools/dialogcutsplinepath.ui b/src/app/dialogs/tools/dialogcutsplinepath.ui
index f5d497074..2312d2eed 100644
--- a/src/app/dialogs/tools/dialogcutsplinepath.ui
+++ b/src/app/dialogs/tools/dialogcutsplinepath.ui
@@ -7,7 +7,7 @@
0
0
412
- 433
+ 466
@@ -217,7 +217,7 @@
-
-
+
0
0
@@ -237,7 +237,7 @@
-
-
+
0
0
@@ -250,6 +250,22 @@
-
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Color
+
+
+
+ -
+
+
-
diff --git a/src/app/tools/drawTools/vtoolcut.cpp b/src/app/tools/drawTools/vtoolcut.cpp
index a7ab6c27a..192fc1e69 100644
--- a/src/app/tools/drawTools/vtoolcut.cpp
+++ b/src/app/tools/drawTools/vtoolcut.cpp
@@ -32,7 +32,7 @@
//---------------------------------------------------------------------------------------------------------------------
VToolCut::VToolCut(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
- const quint32 &curveCutId, const quint32 &curve1id, const quint32 &curve2id,
+ const quint32 &curveCutId, const quint32 &curve1id, const quint32 &curve2id, const QString &color,
QGraphicsItem *parent)
:VToolPoint(doc, data, id, parent), formula(formula), firstCurve(nullptr), secondCurve(nullptr),
curveCutId(curveCutId), curve1id(curve1id), curve2id(curve2id)
@@ -41,6 +41,8 @@ VToolCut::VToolCut(VPattern *doc, VContainer *data, const quint32 &id, const QSt
Q_ASSERT_X(curve1id > 0, Q_FUNC_INFO, "curve1id <= 0");
Q_ASSERT_X(curve2id > 0, Q_FUNC_INFO, "curve2id <= 0");
+ lineColor = color;
+
firstCurve = new VSimpleCurve(curve1id, QColor(lineColor), SimpleCurvePoint::ForthPoint, &factor);
firstCurve->setParentItem(this);
connect(firstCurve, &VSimpleCurve::Choosed, this, &VToolCut::CurveChoosed);
diff --git a/src/app/tools/drawTools/vtoolcut.h b/src/app/tools/drawTools/vtoolcut.h
index c203cc9d3..a815b3017 100644
--- a/src/app/tools/drawTools/vtoolcut.h
+++ b/src/app/tools/drawTools/vtoolcut.h
@@ -39,7 +39,7 @@ class VToolCut : public VToolPoint
Q_OBJECT
public:
VToolCut(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, const quint32 &curveCutId,
- const quint32 &curve1id, const quint32 &curve2id, QGraphicsItem * parent = nullptr);
+ const quint32 &curve1id, const quint32 &curve2id, const QString &color, QGraphicsItem * parent = nullptr);
virtual int type() const {return Type;}
enum { Type = UserType + static_cast(Tool::Cut)};
diff --git a/src/app/tools/drawTools/vtoolcutarc.cpp b/src/app/tools/drawTools/vtoolcutarc.cpp
index fe3c0731e..a2b00da2f 100644
--- a/src/app/tools/drawTools/vtoolcutarc.cpp
+++ b/src/app/tools/drawTools/vtoolcutarc.cpp
@@ -50,9 +50,9 @@ const QString VToolCutArc::AttrArc = QStringLiteral("arc");
* @param parent parent object.
*/
VToolCutArc::VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
- const quint32 &arcId, const quint32 &arc1id, const quint32 &arc2id,
+ const quint32 &arcId, const quint32 &arc1id, const quint32 &arc2id, const QString &color,
const Source &typeCreation, QGraphicsItem * parent)
- :VToolCut(doc, data, id, formula, arcId, arc1id, arc2id, parent)
+ :VToolCut(doc, data, id, formula, arcId, arc1id, arc2id, color, parent)
{
RefreshCurve(firstCurve, curve1id, SimpleCurvePoint::ForthPoint);
RefreshCurve(secondCurve, curve2id, SimpleCurvePoint::FirstPoint);
@@ -80,6 +80,7 @@ void VToolCutArc::setDialog()
dialogTool->SetFormula(formula);
dialogTool->setArcId(curveCutId);
dialogTool->SetPointName(point->name());
+ dialogTool->SetColor(lineColor);
}
//---------------------------------------------------------------------------------------------------------------------
@@ -98,8 +99,9 @@ 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 = nullptr;
- point=Create(0, pointName, formula, arcId, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
+ point=Create(0, pointName, formula, arcId, 5, 10, color, scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
@@ -123,8 +125,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, VMainGraphicsScene *scene, VPattern *doc,
- VContainer *data, const Document &parse, const Source &typeCreation)
+ const qreal &mx, const qreal &my, const QString &color, VMainGraphicsScene *scene,
+ VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation)
{
const QSharedPointer arc = data->GeometricObject(arcId);
@@ -167,7 +169,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, arc1id, arc2id, typeCreation);
+ VToolCutArc *point = new VToolCutArc(doc, data, id, formula, arcId, arc1id, arc2id, color, typeCreation);
scene->addItem(point);
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolCutArc::SetFactor);
@@ -274,6 +276,7 @@ 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());
}
//---------------------------------------------------------------------------------------------------------------------
@@ -312,6 +315,7 @@ void VToolCutArc::SaveOptions(QDomElement &tag, QSharedPointer &obj)
doc->SetAttribute(tag, AttrName, point->name());
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
+ doc->SetAttribute(tag, AttrColor, lineColor);
doc->SetAttribute(tag, AttrLength, formula);
doc->SetAttribute(tag, AttrArc, curveCutId);
@@ -322,4 +326,5 @@ 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/app/tools/drawTools/vtoolcutarc.h b/src/app/tools/drawTools/vtoolcutarc.h
index e8a5cf75f..5a731a43d 100644
--- a/src/app/tools/drawTools/vtoolcutarc.h
+++ b/src/app/tools/drawTools/vtoolcutarc.h
@@ -39,13 +39,13 @@ class VToolCutArc : public VToolCut
Q_OBJECT
public:
VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, const quint32 &arcId,
- const quint32 &arc1id, const quint32 &arc2id, const Source &typeCreation,
+ const quint32 &arc1id, const quint32 &arc2id, const QString &color, const Source &typeCreation,
QGraphicsItem * parent = nullptr);
virtual void setDialog();
static VToolCutArc* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
static VToolCutArc* Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId,
- const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
- VContainer *data, const Document &parse, const Source &typeCreation);
+ const qreal &mx, const qreal &my, const QString &color, VMainGraphicsScene *scene,
+ VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation);
static const QString ToolType;
static const QString AttrArc;
virtual int type() const {return Type;}
diff --git a/src/app/tools/drawTools/vtoolcutspline.cpp b/src/app/tools/drawTools/vtoolcutspline.cpp
index f8ced20b6..24fe69975 100644
--- a/src/app/tools/drawTools/vtoolcutspline.cpp
+++ b/src/app/tools/drawTools/vtoolcutspline.cpp
@@ -50,8 +50,8 @@ const QString VToolCutSpline::AttrSpline = QStringLiteral("spline");
*/
VToolCutSpline::VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
const quint32 &splineId, const quint32 &spl1id, const quint32 &spl2id,
- const Source &typeCreation, QGraphicsItem *parent)
- :VToolCut(doc, data, id, formula, splineId, spl1id, spl2id, parent)
+ const QString &color, const Source &typeCreation, QGraphicsItem *parent)
+ :VToolCut(doc, data, id, formula, splineId, spl1id, spl2id, color, parent)
{
RefreshCurve(firstCurve, curve1id, SimpleCurvePoint::ForthPoint);
RefreshCurve(secondCurve, curve2id, SimpleCurvePoint::FirstPoint);
@@ -79,6 +79,7 @@ void VToolCutSpline::setDialog()
dialogTool->SetFormula(formula);
dialogTool->setSplineId(curveCutId);
dialogTool->SetPointName(point->name());
+ dialogTool->SetColor(lineColor);
}
//---------------------------------------------------------------------------------------------------------------------
@@ -98,8 +99,10 @@ 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 = nullptr;
- point = Create(0, pointName, formula, splineId, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
+ point = Create(0, pointName, formula, splineId, 5, 10, color, scene, doc, data, Document::FullParse,
+ Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
@@ -123,7 +126,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 quint32 &splineId, const qreal &mx, const qreal &my, const QString &color,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
{
@@ -174,7 +177,8 @@ 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, spl1id, spl2id, typeCreation);
+ VToolCutSpline *point = new VToolCutSpline(doc, data, id, formula, splineId, spl1id, spl2id, color,
+ typeCreation);
scene->addItem(point);
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolCutSpline::SetFactor);
@@ -285,6 +289,7 @@ 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());
}
//---------------------------------------------------------------------------------------------------------------------
@@ -323,6 +328,7 @@ void VToolCutSpline::SaveOptions(QDomElement &tag, QSharedPointer &obj
doc->SetAttribute(tag, AttrName, point->name());
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
+ doc->SetAttribute(tag, AttrColor, lineColor);
doc->SetAttribute(tag, AttrLength, formula);
doc->SetAttribute(tag, AttrSpline, curveCutId);
@@ -333,4 +339,5 @@ 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/app/tools/drawTools/vtoolcutspline.h b/src/app/tools/drawTools/vtoolcutspline.h
index 90e576009..94799aa4c 100644
--- a/src/app/tools/drawTools/vtoolcutspline.h
+++ b/src/app/tools/drawTools/vtoolcutspline.h
@@ -40,13 +40,14 @@ class VToolCutSpline : public VToolCut
public:
VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
- const quint32 &splineId, const quint32 &spl1id, const quint32 &spl2id,
+ const quint32 &splineId, const quint32 &spl1id, const quint32 &spl2id, const QString &color,
const Source &typeCreation, QGraphicsItem * parent = nullptr);
virtual void setDialog();
static VToolCutSpline *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
static VToolCutSpline *Create(const quint32 _id, const QString &pointName, QString &formula,
- const quint32 &splineId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
- VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation);
+ const quint32 &splineId, const qreal &mx, const qreal &my, const QString &color,
+ VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse,
+ const Source &typeCreation);
static const QString ToolType;
static const QString AttrSpline;
virtual int type() const {return Type;}
diff --git a/src/app/tools/drawTools/vtoolcutsplinepath.cpp b/src/app/tools/drawTools/vtoolcutsplinepath.cpp
index 605e33f17..f93ae346b 100644
--- a/src/app/tools/drawTools/vtoolcutsplinepath.cpp
+++ b/src/app/tools/drawTools/vtoolcutsplinepath.cpp
@@ -53,9 +53,9 @@ const QString VToolCutSplinePath::AttrSplinePath = QStringLiteral("splinePath");
*/
VToolCutSplinePath::VToolCutSplinePath(VPattern *doc, VContainer *data, const quint32 &id,
const QString &formula, const quint32 &splinePathId,
- const quint32 &splPath1id, const quint32 &splPath2id,
+ const quint32 &splPath1id, const quint32 &splPath2id, const QString &color,
const Source &typeCreation, QGraphicsItem *parent)
- :VToolCut(doc, data, id, formula, splinePathId, splPath1id, splPath2id, parent)
+ :VToolCut(doc, data, id, formula, splinePathId, splPath1id, splPath2id, color, parent)
{
RefreshCurve(firstCurve, curve1id, SimpleCurvePoint::ForthPoint);
RefreshCurve(secondCurve, curve2id, SimpleCurvePoint::FirstPoint);
@@ -83,6 +83,7 @@ void VToolCutSplinePath::setDialog()
dialogTool->SetFormula(formula);
dialogTool->setSplinePathId(curveCutId);
dialogTool->SetPointName(point->name());
+ dialogTool->SetColor(lineColor);
}
//---------------------------------------------------------------------------------------------------------------------
@@ -102,8 +103,10 @@ 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 = nullptr;
- point = Create(0, pointName, formula, splinePathId, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
+ point = Create(0, pointName, formula, splinePathId, 5, 10, color, scene, doc, data, Document::FullParse,
+ Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
@@ -128,8 +131,8 @@ 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,
- VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
- const Document &parse, const Source &typeCreation)
+ const QString &color, VMainGraphicsScene *scene, VPattern *doc,
+ VContainer *data, const Document &parse, const Source &typeCreation)
{
const QSharedPointer splPath = data->GeometricObject(splinePathId);
SCASSERT(splPath != nullptr);
@@ -223,7 +226,7 @@ VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString
if (parse == Document::FullParse)
{
VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, splPath1id,
- splPath2id, typeCreation);
+ splPath2id, color, typeCreation);
scene->addItem(point);
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolCutSplinePath::SetFactor);
@@ -334,6 +337,7 @@ 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());
}
//---------------------------------------------------------------------------------------------------------------------
@@ -374,6 +378,7 @@ void VToolCutSplinePath::SaveOptions(QDomElement &tag, QSharedPointer
doc->SetAttribute(tag, AttrName, point->name());
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
+ doc->SetAttribute(tag, AttrColor, lineColor);
doc->SetAttribute(tag, AttrLength, formula);
doc->SetAttribute(tag, AttrSplinePath, curveCutId);
@@ -384,4 +389,5 @@ 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/app/tools/drawTools/vtoolcutsplinepath.h b/src/app/tools/drawTools/vtoolcutsplinepath.h
index 05cdf22df..1de640cfe 100644
--- a/src/app/tools/drawTools/vtoolcutsplinepath.h
+++ b/src/app/tools/drawTools/vtoolcutsplinepath.h
@@ -42,12 +42,12 @@ public:
VToolCutSplinePath(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
const quint32 &splinePathId, const quint32 &splPath1id, const quint32 &splPath2id,
- const Source &typeCreation, QGraphicsItem * parent = nullptr);
+ const QString &color, const Source &typeCreation, QGraphicsItem * parent = nullptr);
virtual void setDialog();
static VToolCutSplinePath *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
static VToolCutSplinePath *Create(const quint32 _id, const QString &pointName, QString &formula,
const quint32 &splinePathId, const qreal &mx, const qreal &my,
- VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
+ const QString &color, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);
static const QString ToolType;
static const QString AttrSplinePath;
diff --git a/src/app/widgets/vtooloptionspropertybrowser.cpp b/src/app/widgets/vtooloptionspropertybrowser.cpp
index 26178cdb3..78fd8d27b 100644
--- a/src/app/widgets/vtooloptionspropertybrowser.cpp
+++ b/src/app/widgets/vtooloptionspropertybrowser.cpp
@@ -610,6 +610,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCutArc(VProperty *property)
case 4: // VAbstractTool::AttrLength
i->SetFormula(value.value());
break;
+ case 27: // VAbstractTool::AttrTypeColor
+ i->SetLineColor(value.toString());
+ break;
default:
qWarning()<<"Unknown property type. id = "<SetFormula(value.value());
break;
+ case 27: // VAbstractTool::AttrTypeColor
+ i->SetLineColor(value.toString());
+ break;
default:
qWarning()<<"Unknown property type. id = "<SetFormula(value.value());
break;
+ case 27: // VAbstractTool::AttrTypeColor
+ i->SetLineColor(value.toString());
+ break;
default:
qWarning()<<"Unknown property type. id = "<GetFormula(), VAbstractTool::AttrLength);
+ AddPropertyLineColor(i, tr("Color"), VAbstractTool::ColorsList(), VAbstractTool::AttrColor);
}
//---------------------------------------------------------------------------------------------------------------------
@@ -1062,6 +1072,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCutSpline(QGraphicsItem *item)
AddPropertyPointName(i, tr("Point label"));
AddPropertyFormula(tr("Length"), i->GetFormula(), VAbstractTool::AttrLength);
+ AddPropertyLineColor(i, tr("Color"), VAbstractTool::ColorsList(), VAbstractTool::AttrColor);
}
//---------------------------------------------------------------------------------------------------------------------
@@ -1073,6 +1084,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCutSplinePath(QGraphicsItem *it
AddPropertyPointName(i, tr("Point label"));
AddPropertyFormula(tr("Length"), i->GetFormula(), VAbstractTool::AttrLength);
+ AddPropertyLineColor(i, tr("Color"), VAbstractTool::ColorsList(), VAbstractTool::AttrColor);
}
//---------------------------------------------------------------------------------------------------------------------
@@ -1344,6 +1356,9 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCutArc()
QVariant valueFormula;
valueFormula.setValue(i->GetFormula());
idToProperty[VAbstractTool::AttrLength]->setValue(valueFormula);
+
+ const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
+ idToProperty[VAbstractTool::AttrColor]->setValue(index);
}
//---------------------------------------------------------------------------------------------------------------------
@@ -1356,6 +1371,9 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCutSpline()
QVariant valueFormula;
valueFormula.setValue(i->GetFormula());
idToProperty[VAbstractTool::AttrLength]->setValue(valueFormula);
+
+ const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
+ idToProperty[VAbstractTool::AttrColor]->setValue(index);
}
//---------------------------------------------------------------------------------------------------------------------
@@ -1368,6 +1386,9 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCutSplinePath()
QVariant valueFormula;
valueFormula.setValue(i->GetFormula());
idToProperty[VAbstractTool::AttrLength]->setValue(valueFormula);
+
+ const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
+ idToProperty[VAbstractTool::AttrColor]->setValue(index);
}
//---------------------------------------------------------------------------------------------------------------------
diff --git a/src/app/xml/vpattern.cpp b/src/app/xml/vpattern.cpp
index a009a1ec3..5b5d3b4f9 100644
--- a/src/app/xml/vpattern.cpp
+++ b/src/app/xml/vpattern.cpp
@@ -1469,8 +1469,11 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
const QString formula = GetParametrString(domElement, VAbstractTool::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, VAbstractTool::AttrColor,
+ VAbstractTool::ColorBlack);
- VToolCutSpline::Create(id, name, f, splineId, mx, my, scene, this, data, parse, Source::FromFile);
+ VToolCutSpline::Create(id, name, f, splineId, mx, my, color, scene, this, data, parse,
+ Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (f != formula)
{
@@ -1499,8 +1502,10 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
QString f = formula;//need for saving fixed formula;
const quint32 splinePathId = GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath,
NULL_ID_STR);
+ const QString color = GetParametrString(domElement, VAbstractTool::AttrColor,
+ VAbstractTool::ColorBlack);
- VToolCutSplinePath::Create(id, name, f, splinePathId, mx, my, scene, this, data, parse,
+ VToolCutSplinePath::Create(id, name, f, splinePathId, mx, my, color, scene, this, data, parse,
Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (f != formula)
@@ -1529,8 +1534,10 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0");
QString f = formula;//need for saving fixed formula;
const quint32 arcId = GetParametrUInt(domElement, VToolCutArc::AttrArc, NULL_ID_STR);
+ const QString color = GetParametrString(domElement, VAbstractTool::AttrColor,
+ VAbstractTool::ColorBlack);
- VToolCutArc::Create(id, name, f, arcId, mx, my, scene, this, data, parse, Source::FromFile);
+ VToolCutArc::Create(id, name, f, arcId, mx, my, color, scene, this, data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (f != formula)
{