From bdfd2923869676c758dd7351b80637cfd96bce7c Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 26 Aug 2014 21:31:28 +0300 Subject: [PATCH] First build. --HG-- branch : feature --- src/app/dialogs/app/dialoghistory.cpp | 32 ++++----- src/app/mainwindow.cpp | 66 +++++++++---------- src/app/tools/drawTools/vabstractspline.h | 2 + src/app/tools/drawTools/vtoolalongline.cpp | 2 +- src/app/tools/drawTools/vtoolalongline.h | 2 + src/app/tools/drawTools/vtoolarc.cpp | 2 +- src/app/tools/drawTools/vtoolarc.h | 2 + src/app/tools/drawTools/vtoolbisector.cpp | 2 +- src/app/tools/drawTools/vtoolbisector.h | 2 + src/app/tools/drawTools/vtoolcut.h | 2 + src/app/tools/drawTools/vtoolcutarc.cpp | 2 +- src/app/tools/drawTools/vtoolcutarc.h | 2 + src/app/tools/drawTools/vtoolcutspline.cpp | 2 +- src/app/tools/drawTools/vtoolcutspline.h | 2 + .../tools/drawTools/vtoolcutsplinepath.cpp | 2 +- src/app/tools/drawTools/vtoolcutsplinepath.h | 2 + src/app/tools/drawTools/vtoolendline.cpp | 2 +- src/app/tools/drawTools/vtoolendline.h | 2 + src/app/tools/drawTools/vtoolheight.h | 2 + src/app/tools/drawTools/vtoolline.cpp | 2 +- src/app/tools/drawTools/vtoolline.h | 2 + .../tools/drawTools/vtoollineintersect.cpp | 2 +- src/app/tools/drawTools/vtoollineintersect.h | 2 + src/app/tools/drawTools/vtoollinepoint.h | 2 + src/app/tools/drawTools/vtoolnormal.cpp | 2 +- src/app/tools/drawTools/vtoolnormal.h | 2 + src/app/tools/drawTools/vtoolpointofcontact.h | 2 + .../drawTools/vtoolpointofintersection.h | 2 + .../tools/drawTools/vtoolshoulderpoint.cpp | 2 +- src/app/tools/drawTools/vtoolshoulderpoint.h | 2 + src/app/tools/drawTools/vtoolsinglepoint.cpp | 18 +++++ src/app/tools/drawTools/vtoolsinglepoint.h | 4 ++ src/app/tools/drawTools/vtoolspline.cpp | 2 +- src/app/tools/drawTools/vtoolspline.h | 2 + src/app/tools/drawTools/vtoolsplinepath.cpp | 2 +- src/app/tools/drawTools/vtoolsplinepath.h | 2 + src/app/tools/drawTools/vtooltriangle.h | 2 + src/app/tools/nodeDetails/vnodearc.h | 2 + src/app/tools/nodeDetails/vnodepoint.h | 2 + src/app/tools/nodeDetails/vnodespline.h | 2 + src/app/tools/nodeDetails/vnodesplinepath.h | 2 + src/app/tools/vtooldetail.cpp | 2 +- src/app/tools/vtooldetail.h | 2 + src/app/visualization/vcontrolpointspline.h | 2 + .../visualization/vgraphicssimpletextitem.h | 3 + src/app/visualization/visline.h | 2 + src/app/visualization/vispath.h | 2 + src/app/visualization/vistoolalongline.h | 2 + src/app/visualization/vistoolarc.h | 2 + src/app/visualization/vistoolbisector.h | 2 + src/app/visualization/vistoolcutarc.h | 2 + src/app/visualization/vistoolendline.h | 2 + src/app/visualization/vistoolheight.h | 2 + src/app/visualization/vistoolline.h | 2 + src/app/visualization/vistoollineintersect.h | 2 + src/app/visualization/vistoolnormal.h | 2 + src/app/visualization/vistoolpointofcontact.h | 2 + .../vistoolpointofintersection.h | 2 + src/app/visualization/vistoolshoulderpoint.h | 2 + src/app/visualization/vistoolspline.h | 3 + src/app/visualization/vistooltriangle.h | 3 + src/app/visualization/vsimplecurve.h | 3 + src/app/visualization/vsimplesplinepath.h | 3 + .../widgets/vtooloptionspropertybrowser.cpp | 16 +++-- src/app/xml/vpattern.cpp | 34 +++++----- src/app/xml/vtoolrecord.cpp | 2 +- .../vpropertyexplorer/vpropertyexplorer.pro | 11 ++++ 67 files changed, 218 insertions(+), 88 deletions(-) diff --git a/src/app/dialogs/app/dialoghistory.cpp b/src/app/dialogs/app/dialoghistory.cpp index 188efdb7a..d0950ed16 100644 --- a/src/app/dialogs/app/dialoghistory.cpp +++ b/src/app/dialogs/app/dialoghistory.cpp @@ -213,44 +213,44 @@ QString DialogHistory::Record(const VToolRecord &tool) { switch ( tool.getTypeTool() ) { - case Tool::ArrowTool: + case Tool::Arrow: Q_UNREACHABLE(); break; - case Tool::SinglePointTool: + case Tool::SinglePoint: { return QString(tr("%1 - Base point")).arg(PointName(tool.getId())); } - case Tool::EndLineTool: + case Tool::EndLine: { return QString(tr("%1_%2 - Line from point %1 to point %2")) .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrBasePoint))) .arg(PointName(tool.getId())); } - case Tool::LineTool: + case Tool::Line: { return QString(tr("%1_%2 - Line from point %1 to point %2")) .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrFirstPoint))) .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrSecondPoint))); } - case Tool::AlongLineTool: + case Tool::AlongLine: { return QString(tr("%3 - Point along line %1_%2")) .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrFirstPoint))) .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrSecondPoint))) .arg(PointName(tool.getId())); } - case Tool::ShoulderPointTool: + case Tool::ShoulderPoint: { return QString(tr("%1 - Point of shoulder")).arg(PointName(tool.getId())); } - case Tool::NormalTool: + case Tool::Normal: { return QString(tr("%3 - normal to line %1_%2")) .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrFirstPoint))) .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrSecondPoint))) .arg(PointName(tool.getId())); } - case Tool::BisectorTool: + case Tool::Bisector: { return QString(tr("%4 - bisector of angle %1_%2_%3")) .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrFirstPoint))) @@ -258,7 +258,7 @@ QString DialogHistory::Record(const VToolRecord &tool) .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrThirdPoint))) .arg(PointName(tool.getId())); } - case Tool::LineIntersectTool: + case Tool::LineIntersect: { return QString(tr("%5 - intersection of lines %1_%2 and %3_%4")) .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrP1Line1))) @@ -267,19 +267,19 @@ QString DialogHistory::Record(const VToolRecord &tool) .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrP2Line2))) .arg(PointName(tool.getId())); } - case Tool::SplineTool: + case Tool::Spline: { const QSharedPointer spl = data->GeometricObject(tool.getId()); SCASSERT(spl != nullptr); return QString(tr("Curve %1_%2")).arg(PointName(spl->GetP1().id())).arg(PointName(spl->GetP4().id())); } - case Tool::ArcTool: + case Tool::Arc: { const QSharedPointer arc = data->GeometricObject(tool.getId()); SCASSERT(arc != nullptr); return QString(tr("Arc with center in point %1")).arg(PointName(arc->GetCenter().id())); } - case Tool::SplinePathTool: + case Tool::SplinePath: { const QSharedPointer splPath = data->GeometricObject(tool.getId()); SCASSERT(splPath != nullptr); @@ -331,7 +331,7 @@ QString DialogHistory::Record(const VToolRecord &tool) .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrFirstPoint))) .arg(PointName(AttrUInt(domElem, VAbstractTool::AttrSecondPoint))); } - case Tool::CutArcTool: + case Tool::CutArc: { const QSharedPointer arc = data->GeometricObject(AttrUInt(domElem, VToolCutArc::AttrArc)); SCASSERT(arc != nullptr); @@ -339,7 +339,7 @@ QString DialogHistory::Record(const VToolRecord &tool) .arg(PointName(tool.getId())) .arg(PointName(arc->GetCenter().id())); } - case Tool::CutSplineTool: + case Tool::CutSpline: { const quint32 splineId = AttrUInt(domElem, VToolCutSpline::AttrSpline); const QSharedPointer spl = data->GeometricObject(splineId); @@ -349,7 +349,7 @@ QString DialogHistory::Record(const VToolRecord &tool) .arg(PointName(spl->GetP1().id())) .arg(PointName(spl->GetP4().id())); } - case Tool::CutSplinePathTool: + case Tool::CutSplinePath: { const quint32 splinePathId = AttrUInt(domElem, VToolCutSplinePath::AttrSplinePath); const QSharedPointer splPath = data->GeometricObject(splinePathId); @@ -375,7 +375,7 @@ QString DialogHistory::Record(const VToolRecord &tool) } //Because "history" not only show history of pattern, but help restore current data for each pattern's //piece, we need add record about details and nodes, but don't show them. - case Tool::DetailTool: + case Tool::Detail: break; case Tool::UnionDetails: break; diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp index 4f282b910..ef80a0c92 100644 --- a/src/app/mainwindow.cpp +++ b/src/app/mainwindow.cpp @@ -61,7 +61,7 @@ * @param parent parent widget. */ MainWindow::MainWindow(QWidget *parent) - :QMainWindow(parent), ui(new Ui::MainWindow), pattern(nullptr), doc(nullptr), tool(Tool::ArrowTool), + :QMainWindow(parent), ui(new Ui::MainWindow), pattern(nullptr), doc(nullptr), tool(Tool::Arrow), currentScene(nullptr), sceneDraw(nullptr), sceneDetails(nullptr), mouseCoordinate(nullptr), helpLabel(nullptr), isInitialized(false), dialogTable(nullptr), dialogTool(nullptr), dialogHistory(nullptr), comboBoxDraws(nullptr), curFile(QString()), mode(Draw::Calculation), currentDrawIndex(0), @@ -202,7 +202,7 @@ void MainWindow::ActionNewPP() QHash* tools = doc->getTools(); SCASSERT(tools != nullptr); tools->insert(id, spoint); - VDrawTool::AddRecord(id, Tool::SinglePointTool, doc); + VDrawTool::AddRecord(id, Tool::SinglePoint, doc); SetEnableTool(true); SetEnableWidgets(true); @@ -387,7 +387,7 @@ void MainWindow::ApplyDialog() */ void MainWindow::ToolEndLine(bool checked) { - SetToolButtonWithApply(checked, Tool::EndLineTool, ":/cursor/endline_cursor.png", tr("Select point"), + SetToolButtonWithApply(checked, Tool::EndLine, ":/cursor/endline_cursor.png", tr("Select point"), &MainWindow::ClosedDialogWithApply, &MainWindow::ApplyDialog); } @@ -399,7 +399,7 @@ void MainWindow::ToolEndLine(bool checked) */ void MainWindow::ToolLine(bool checked) { - SetToolButtonWithApply(checked, Tool::LineTool, ":/cursor/line_cursor.png", tr("Select first point"), + SetToolButtonWithApply(checked, Tool::Line, ":/cursor/line_cursor.png", tr("Select first point"), &MainWindow::ClosedDialogWithApply, &MainWindow::ApplyDialog); } @@ -411,7 +411,7 @@ void MainWindow::ToolLine(bool checked) */ void MainWindow::ToolAlongLine(bool checked) { - SetToolButtonWithApply(checked, Tool::AlongLineTool, ":/cursor/alongline_cursor.png", + SetToolButtonWithApply(checked, Tool::AlongLine, ":/cursor/alongline_cursor.png", tr("Select point"), &MainWindow::ClosedDialogWithApply, &MainWindow::ApplyDialog); } @@ -423,7 +423,7 @@ void MainWindow::ToolAlongLine(bool checked) */ void MainWindow::ToolShoulderPoint(bool checked) { - SetToolButtonWithApply(checked, Tool::ShoulderPointTool, ":/cursor/shoulder_cursor.png", + SetToolButtonWithApply(checked, Tool::ShoulderPoint, ":/cursor/shoulder_cursor.png", tr("Select point of shoulder"), &MainWindow::ClosedDialogWithApply, &MainWindow::ApplyDialog); @@ -436,7 +436,7 @@ void MainWindow::ToolShoulderPoint(bool checked) */ void MainWindow::ToolNormal(bool checked) { - SetToolButtonWithApply(checked, Tool::NormalTool, ":/cursor/normal_cursor.png", + SetToolButtonWithApply(checked, Tool::Normal, ":/cursor/normal_cursor.png", tr("Select first point of line"), &MainWindow::ClosedDialogWithApply, &MainWindow::ApplyDialog); @@ -449,7 +449,7 @@ void MainWindow::ToolNormal(bool checked) */ void MainWindow::ToolBisector(bool checked) { - SetToolButtonWithApply(checked, Tool::BisectorTool, ":/cursor/bisector_cursor.png", + SetToolButtonWithApply(checked, Tool::Bisector, ":/cursor/bisector_cursor.png", tr("Select first point of angle"), &MainWindow::ClosedDialogWithApply, &MainWindow::ApplyDialog); @@ -462,7 +462,7 @@ void MainWindow::ToolBisector(bool checked) */ void MainWindow::ToolLineIntersect(bool checked) { - SetToolButtonWithApply(checked, Tool::LineIntersectTool, ":/cursor/intersect_cursor.png", + SetToolButtonWithApply(checked, Tool::LineIntersect, ":/cursor/intersect_cursor.png", tr("Select first point of first line"), &MainWindow::ClosedDialogWithApply, &MainWindow::ApplyDialog); @@ -475,7 +475,7 @@ void MainWindow::ToolLineIntersect(bool checked) */ void MainWindow::ToolSpline(bool checked) { - SetToolButtonWithApply(checked, Tool::SplineTool, ":/cursor/spline_cursor.png", + SetToolButtonWithApply(checked, Tool::Spline, ":/cursor/spline_cursor.png", tr("Select first point curve"), &MainWindow::ClosedDialogWithApply, &MainWindow::ApplyDialog); @@ -488,7 +488,7 @@ void MainWindow::ToolSpline(bool checked) */ void MainWindow::ToolCutSpline(bool checked) { - SetToolButton(checked, Tool::CutSplineTool, ":/cursor/spline_cut_point_cursor.png", + SetToolButton(checked, Tool::CutSpline, ":/cursor/spline_cut_point_cursor.png", tr("Select simple curve"), &MainWindow::ClosedDialog); } @@ -499,7 +499,7 @@ void MainWindow::ToolCutSpline(bool checked) */ void MainWindow::ToolArc(bool checked) { - SetToolButtonWithApply(checked, Tool::ArcTool, ":/cursor/arc_cursor.png", + SetToolButtonWithApply(checked, Tool::Arc, ":/cursor/arc_cursor.png", tr("Select point of center of arc"), &MainWindow::ClosedDialogWithApply, &MainWindow::ApplyDialog); } @@ -511,7 +511,7 @@ void MainWindow::ToolArc(bool checked) */ void MainWindow::ToolSplinePath(bool checked) { - SetToolButton(checked, Tool::SplinePathTool, ":/cursor/splinepath_cursor.png", + SetToolButton(checked, Tool::SplinePath, ":/cursor/splinepath_cursor.png", tr("Select point of curve path"), &MainWindow::ClosedDialog); } @@ -522,7 +522,7 @@ void MainWindow::ToolSplinePath(bool checked) */ void MainWindow::ToolCutSplinePath(bool checked) { - SetToolButton(checked, Tool::CutSplinePathTool, + SetToolButton(checked, Tool::CutSplinePath, ":/cursor/splinepath_cut_point_cursor.png", tr("Select curve path"), &MainWindow::ClosedDialog); } @@ -547,7 +547,7 @@ void MainWindow::ToolPointOfContact(bool checked) */ void MainWindow::ToolDetail(bool checked) { - SetToolButton(checked, Tool::DetailTool, "://cursor/new_detail_cursor.png", + SetToolButton(checked, Tool::Detail, "://cursor/new_detail_cursor.png", tr("Select points, arcs, curves clockwise."), &MainWindow::ClosedDialogDetail); } @@ -636,7 +636,7 @@ void MainWindow::ClosedDialogUnionDetails(int result) */ void MainWindow::ToolCutArc(bool checked) { - SetToolButtonWithApply(checked, Tool::CutArcTool, ":/cursor/arc_cut_cursor.png", + SetToolButtonWithApply(checked, Tool::CutArc, ":/cursor/arc_cut_cursor.png", tr("Select arc"), &MainWindow::ClosedDialogWithApply, &MainWindow::ApplyDialog); } @@ -944,60 +944,60 @@ void MainWindow::CancelTool() dialogTool = nullptr; switch ( tool ) { - case Tool::ArrowTool: + case Tool::Arrow: ui->actionArrowTool->setChecked(false); helpLabel->setText(""); break; - case Tool::SinglePointTool: + case Tool::SinglePoint: Q_UNREACHABLE(); //Nothing to do here because we can't create this tool from main window. break; - case Tool::EndLineTool: + case Tool::EndLine: ui->toolButtonEndLine->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::LineTool: + case Tool::Line: ui->toolButtonLine->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearFocus(); break; - case Tool::AlongLineTool: + case Tool::AlongLine: ui->toolButtonAlongLine->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::ShoulderPointTool: + case Tool::ShoulderPoint: ui->toolButtonShoulderPoint->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::NormalTool: + case Tool::Normal: ui->toolButtonNormal->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::BisectorTool: + case Tool::Bisector: ui->toolButtonBisector->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::LineIntersectTool: + case Tool::LineIntersect: ui->toolButtonLineIntersect->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::SplineTool: + case Tool::Spline: ui->toolButtonSpline->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::ArcTool: + case Tool::Arc: ui->toolButtonArc->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::SplinePathTool: + case Tool::SplinePath: ui->toolButtonSplinePath->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); @@ -1007,7 +1007,7 @@ void MainWindow::CancelTool() currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::DetailTool: + case Tool::Detail: ui->toolButtonNewDetail->setChecked(false); break; case Tool::Height: @@ -1025,12 +1025,12 @@ void MainWindow::CancelTool() currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::CutSplineTool: + case Tool::CutSpline: ui->toolButtonSplineCutPoint->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::CutSplinePathTool: + case Tool::CutSplinePath: ui->toolButtonSplinePathCutPoint->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); @@ -1040,7 +1040,7 @@ void MainWindow::CancelTool() currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::CutArcTool: + case Tool::CutArc: ui->toolButtonArcCutPoint->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); @@ -1063,7 +1063,7 @@ void MainWindow::ArrowTool() { CancelTool(); ui->actionArrowTool->setChecked(true); - tool = Tool::ArrowTool; + tool = Tool::Arrow; QCursor cur(Qt::ArrowCursor); ui->view->setCursor(cur); helpLabel->setText(""); diff --git a/src/app/tools/drawTools/vabstractspline.h b/src/app/tools/drawTools/vabstractspline.h index 2dfe1fa88..1b5f10b0a 100644 --- a/src/app/tools/drawTools/vabstractspline.h +++ b/src/app/tools/drawTools/vabstractspline.h @@ -40,6 +40,8 @@ public: VAbstractSpline(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem * parent = nullptr); static const QString TagName; virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::AbstractSpline)}; public slots: virtual void FullUpdateFromFile (); void Disable(bool disable); diff --git a/src/app/tools/drawTools/vtoolalongline.cpp b/src/app/tools/drawTools/vtoolalongline.cpp index 1840e143e..411039c70 100644 --- a/src/app/tools/drawTools/vtoolalongline.cpp +++ b/src/app/tools/drawTools/vtoolalongline.cpp @@ -272,7 +272,7 @@ VToolAlongLine* VToolAlongLine::Create(const quint32 _id, const QString &pointNa doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::AlongLineTool, doc); + VDrawTool::AddRecord(id, Tool::AlongLine, doc); if (parse == Document::FullParse) { VToolAlongLine *point = new VToolAlongLine(doc, data, id, formula, firstPointId, diff --git a/src/app/tools/drawTools/vtoolalongline.h b/src/app/tools/drawTools/vtoolalongline.h index 1b2218604..7708abca5 100644 --- a/src/app/tools/drawTools/vtoolalongline.h +++ b/src/app/tools/drawTools/vtoolalongline.h @@ -49,6 +49,8 @@ public: const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation); static const QString ToolType; + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::AlongLine)}; public slots: virtual void FullUpdateFromFile(); virtual void SetFactor(qreal factor); diff --git a/src/app/tools/drawTools/vtoolarc.cpp b/src/app/tools/drawTools/vtoolarc.cpp index 1bbd344fe..c7f4a6b07 100644 --- a/src/app/tools/drawTools/vtoolarc.cpp +++ b/src/app/tools/drawTools/vtoolarc.cpp @@ -149,7 +149,7 @@ VToolArc* VToolArc::Create(const quint32 _id, const quint32 ¢er, QString &ra doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::ArcTool, doc); + VDrawTool::AddRecord(id, Tool::Arc, doc); if (parse == Document::FullParse) { VToolArc *toolArc = new VToolArc(doc, data, id, typeCreation); diff --git a/src/app/tools/drawTools/vtoolarc.h b/src/app/tools/drawTools/vtoolarc.h index 6e943e7d2..6417cf8c0 100644 --- a/src/app/tools/drawTools/vtoolarc.h +++ b/src/app/tools/drawTools/vtoolarc.h @@ -46,6 +46,8 @@ public: const Source &typeCreation); static const QString TagName; static const QString ToolType; + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::Arc)}; public slots: virtual void FullUpdateFromFile(); protected: diff --git a/src/app/tools/drawTools/vtoolbisector.cpp b/src/app/tools/drawTools/vtoolbisector.cpp index d6ff4d469..69116db27 100644 --- a/src/app/tools/drawTools/vtoolbisector.cpp +++ b/src/app/tools/drawTools/vtoolbisector.cpp @@ -196,7 +196,7 @@ VToolBisector* VToolBisector::Create(const quint32 _id, QString &formula, const doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::BisectorTool, doc); + VDrawTool::AddRecord(id, Tool::Bisector, doc); if (parse == Document::FullParse) { VToolBisector *point = new VToolBisector(doc, data, id, typeLine, formula, firstPointId, secondPointId, diff --git a/src/app/tools/drawTools/vtoolbisector.h b/src/app/tools/drawTools/vtoolbisector.h index 1b6bf211a..f824fd5bf 100644 --- a/src/app/tools/drawTools/vtoolbisector.h +++ b/src/app/tools/drawTools/vtoolbisector.h @@ -53,6 +53,8 @@ public: VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation); static const QString ToolType; + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::Bisector)}; public slots: virtual void FullUpdateFromFile(); virtual void SetFactor(qreal factor); diff --git a/src/app/tools/drawTools/vtoolcut.h b/src/app/tools/drawTools/vtoolcut.h index d4bd20487..838b58fed 100644 --- a/src/app/tools/drawTools/vtoolcut.h +++ b/src/app/tools/drawTools/vtoolcut.h @@ -38,6 +38,8 @@ class VToolCut : public VToolPoint public: VToolCut(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, const quint32 &curveCutId, const quint32 &curve1id, const quint32 &curve2id, QGraphicsItem * parent = nullptr); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::Cut)}; public slots: virtual void ChangedActivDraw(const QString &newName); virtual void CurveChoosed(quint32 id)=0; diff --git a/src/app/tools/drawTools/vtoolcutarc.cpp b/src/app/tools/drawTools/vtoolcutarc.cpp index b89cdcdad..75f432d5a 100644 --- a/src/app/tools/drawTools/vtoolcutarc.cpp +++ b/src/app/tools/drawTools/vtoolcutarc.cpp @@ -163,7 +163,7 @@ VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QS } } - VDrawTool::AddRecord(id, Tool::CutArcTool, doc); + VDrawTool::AddRecord(id, Tool::CutArc, doc); if (parse == Document::FullParse) { VToolCutArc *point = new VToolCutArc(doc, data, id, formula, arcId, arc1id, arc2id, typeCreation); diff --git a/src/app/tools/drawTools/vtoolcutarc.h b/src/app/tools/drawTools/vtoolcutarc.h index a7a762bef..a64e4eff5 100644 --- a/src/app/tools/drawTools/vtoolcutarc.h +++ b/src/app/tools/drawTools/vtoolcutarc.h @@ -48,6 +48,8 @@ public: VContainer *data, const Document &parse, const Source &typeCreation); static const QString ToolType; static const QString AttrArc; + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::CutArc)}; public slots: virtual void FullUpdateFromFile(); virtual void CurveChoosed(quint32 id); diff --git a/src/app/tools/drawTools/vtoolcutspline.cpp b/src/app/tools/drawTools/vtoolcutspline.cpp index 7ab7352e5..95a5aaee2 100644 --- a/src/app/tools/drawTools/vtoolcutspline.cpp +++ b/src/app/tools/drawTools/vtoolcutspline.cpp @@ -163,7 +163,7 @@ void VToolCutSpline::Create(const quint32 _id, const QString &pointName, QString doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::CutSplineTool, doc); + VDrawTool::AddRecord(id, Tool::CutSpline, doc); if (parse == Document::FullParse) { VToolCutSpline *point = new VToolCutSpline(doc, data, id, formula, splineId, spl1id, spl2id, typeCreation); diff --git a/src/app/tools/drawTools/vtoolcutspline.h b/src/app/tools/drawTools/vtoolcutspline.h index 318851ab4..221b0a278 100644 --- a/src/app/tools/drawTools/vtoolcutspline.h +++ b/src/app/tools/drawTools/vtoolcutspline.h @@ -49,6 +49,8 @@ public: const Document &parse, const Source &typeCreation); static const QString ToolType; static const QString AttrSpline; + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::CutSpline)}; public slots: virtual void FullUpdateFromFile(); virtual void CurveChoosed(quint32 id); diff --git a/src/app/tools/drawTools/vtoolcutsplinepath.cpp b/src/app/tools/drawTools/vtoolcutsplinepath.cpp index 5148330a2..c252f325a 100644 --- a/src/app/tools/drawTools/vtoolcutsplinepath.cpp +++ b/src/app/tools/drawTools/vtoolcutsplinepath.cpp @@ -217,7 +217,7 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QSt } } - VDrawTool::AddRecord(id, Tool::CutSplinePathTool, doc); + VDrawTool::AddRecord(id, Tool::CutSplinePath, doc); if (parse == Document::FullParse) { VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, splPath1id, diff --git a/src/app/tools/drawTools/vtoolcutsplinepath.h b/src/app/tools/drawTools/vtoolcutsplinepath.h index 9bb29913c..7a0c0050c 100644 --- a/src/app/tools/drawTools/vtoolcutsplinepath.h +++ b/src/app/tools/drawTools/vtoolcutsplinepath.h @@ -50,6 +50,8 @@ public: const Document &parse, const Source &typeCreation); static const QString ToolType; static const QString AttrSplinePath; + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::CutSplinePath)}; public slots: virtual void FullUpdateFromFile(); virtual void CurveChoosed(quint32 id); diff --git a/src/app/tools/drawTools/vtoolendline.cpp b/src/app/tools/drawTools/vtoolendline.cpp index b77479a13..a5cc6650b 100644 --- a/src/app/tools/drawTools/vtoolendline.cpp +++ b/src/app/tools/drawTools/vtoolendline.cpp @@ -154,7 +154,7 @@ VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName, doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::EndLineTool, doc); + VDrawTool::AddRecord(id, Tool::EndLine, doc); if (parse == Document::FullParse) { VToolEndLine *point = new VToolEndLine(doc, data, id, typeLine, formulaLength, formulaAngle, basePointId, diff --git a/src/app/tools/drawTools/vtoolendline.h b/src/app/tools/drawTools/vtoolendline.h index 22798fcb4..414ba671d 100644 --- a/src/app/tools/drawTools/vtoolendline.h +++ b/src/app/tools/drawTools/vtoolendline.h @@ -49,6 +49,8 @@ public: const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation); static const QString ToolType; + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::EndLine)}; public slots: virtual void FullUpdateFromFile(); virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); diff --git a/src/app/tools/drawTools/vtoolheight.h b/src/app/tools/drawTools/vtoolheight.h index b8e680930..c7fb5b146 100644 --- a/src/app/tools/drawTools/vtoolheight.h +++ b/src/app/tools/drawTools/vtoolheight.h @@ -50,6 +50,8 @@ public: VContainer *data, const Document &parse, const Source &typeCreation); static QPointF FindPoint(const QLineF &line, const QPointF &point); static const QString ToolType; + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::Height)}; public slots: virtual void FullUpdateFromFile(); virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); diff --git a/src/app/tools/drawTools/vtoolline.cpp b/src/app/tools/drawTools/vtoolline.cpp index ef718f501..d05b337e5 100644 --- a/src/app/tools/drawTools/vtoolline.cpp +++ b/src/app/tools/drawTools/vtoolline.cpp @@ -147,7 +147,7 @@ VToolLine * VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, con doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::LineTool, doc); + VDrawTool::AddRecord(id, Tool::Line, doc); if (parse == Document::FullParse) { VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeLine, typeCreation); diff --git a/src/app/tools/drawTools/vtoolline.h b/src/app/tools/drawTools/vtoolline.h index 74ef14a59..8dfbd4c0e 100644 --- a/src/app/tools/drawTools/vtoolline.h +++ b/src/app/tools/drawTools/vtoolline.h @@ -48,6 +48,8 @@ public: const Document &parse, const Source &typeCreation); static const QString TagName; virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::Line)}; public slots: virtual void FullUpdateFromFile(); virtual void ChangedActivDraw(const QString &newName); diff --git a/src/app/tools/drawTools/vtoollineintersect.cpp b/src/app/tools/drawTools/vtoollineintersect.cpp index 84c594214..1a83b0013 100644 --- a/src/app/tools/drawTools/vtoollineintersect.cpp +++ b/src/app/tools/drawTools/vtoollineintersect.cpp @@ -166,7 +166,7 @@ VToolLineIntersect* VToolLineIntersect::Create(const quint32 _id, const quint32 doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::LineIntersectTool, doc); + VDrawTool::AddRecord(id, Tool::LineIntersect, doc); if (parse == Document::FullParse) { VToolLineIntersect *point = new VToolLineIntersect(doc, data, id, p1Line1Id, p2Line1Id, p1Line2Id, diff --git a/src/app/tools/drawTools/vtoollineintersect.h b/src/app/tools/drawTools/vtoollineintersect.h index 7a8e3fd1c..fe1802353 100644 --- a/src/app/tools/drawTools/vtoollineintersect.h +++ b/src/app/tools/drawTools/vtoollineintersect.h @@ -48,6 +48,8 @@ public: const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation); static const QString ToolType; + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::LineIntersect)}; public slots: virtual void FullUpdateFromFile(); virtual void SetFactor(qreal factor); diff --git a/src/app/tools/drawTools/vtoollinepoint.h b/src/app/tools/drawTools/vtoollinepoint.h index 08a0e34f9..6ba31b80a 100644 --- a/src/app/tools/drawTools/vtoollinepoint.h +++ b/src/app/tools/drawTools/vtoollinepoint.h @@ -40,6 +40,8 @@ class VToolLinePoint : public VToolPoint public: VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula, const quint32 &basePointId, const qreal &angle, QGraphicsItem * parent = nullptr); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::LinePoint)}; public slots: virtual void ChangedActivDraw(const QString &newName); virtual void SetFactor(qreal factor); diff --git a/src/app/tools/drawTools/vtoolnormal.cpp b/src/app/tools/drawTools/vtoolnormal.cpp index 41ea76357..4359363ae 100644 --- a/src/app/tools/drawTools/vtoolnormal.cpp +++ b/src/app/tools/drawTools/vtoolnormal.cpp @@ -157,7 +157,7 @@ VToolNormal* VToolNormal::Create(const quint32 _id, QString &formula, const quin doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::NormalTool, doc); + VDrawTool::AddRecord(id, Tool::Normal, doc); if (parse == Document::FullParse) { VToolNormal *point = new VToolNormal(doc, data, id, typeLine, formula, angle, diff --git a/src/app/tools/drawTools/vtoolnormal.h b/src/app/tools/drawTools/vtoolnormal.h index e1e65921e..c5b1f8d0b 100644 --- a/src/app/tools/drawTools/vtoolnormal.h +++ b/src/app/tools/drawTools/vtoolnormal.h @@ -50,6 +50,8 @@ public: static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const qreal &length, const qreal &angle = 0); static const QString ToolType; + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::Normal)}; public slots: virtual void FullUpdateFromFile(); virtual void SetFactor(qreal factor); diff --git a/src/app/tools/drawTools/vtoolpointofcontact.h b/src/app/tools/drawTools/vtoolpointofcontact.h index 942378c17..7bdb63e8b 100644 --- a/src/app/tools/drawTools/vtoolpointofcontact.h +++ b/src/app/tools/drawTools/vtoolpointofcontact.h @@ -51,6 +51,8 @@ public: const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation); static const QString ToolType; + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::PointOfContact) }; public slots: virtual void FullUpdateFromFile(); virtual void SetFactor(qreal factor); diff --git a/src/app/tools/drawTools/vtoolpointofintersection.h b/src/app/tools/drawTools/vtoolpointofintersection.h index ef8518dce..55dcd021f 100644 --- a/src/app/tools/drawTools/vtoolpointofintersection.h +++ b/src/app/tools/drawTools/vtoolpointofintersection.h @@ -49,6 +49,8 @@ public: VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation); static const QString ToolType; + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::PointOfIntersection) }; public slots: virtual void FullUpdateFromFile(); virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); diff --git a/src/app/tools/drawTools/vtoolshoulderpoint.cpp b/src/app/tools/drawTools/vtoolshoulderpoint.cpp index da67ecb83..5221a18de 100644 --- a/src/app/tools/drawTools/vtoolshoulderpoint.cpp +++ b/src/app/tools/drawTools/vtoolshoulderpoint.cpp @@ -199,7 +199,7 @@ VToolShoulderPoint* VToolShoulderPoint::Create(const quint32 _id, QString &formu doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::ShoulderPointTool, doc); + VDrawTool::AddRecord(id, Tool::ShoulderPoint, doc); if (parse == Document::FullParse) { VToolShoulderPoint *point = new VToolShoulderPoint(doc, data, id, typeLine, formula, diff --git a/src/app/tools/drawTools/vtoolshoulderpoint.h b/src/app/tools/drawTools/vtoolshoulderpoint.h index c6acd946e..f1592ed2a 100644 --- a/src/app/tools/drawTools/vtoolshoulderpoint.h +++ b/src/app/tools/drawTools/vtoolshoulderpoint.h @@ -51,6 +51,8 @@ public: const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation); static const QString ToolType; + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::ShoulderPoint) }; public slots: virtual void FullUpdateFromFile(); virtual void SetFactor(qreal factor); diff --git a/src/app/tools/drawTools/vtoolsinglepoint.cpp b/src/app/tools/drawTools/vtoolsinglepoint.cpp index 408af790e..b888bd27e 100644 --- a/src/app/tools/drawTools/vtoolsinglepoint.cpp +++ b/src/app/tools/drawTools/vtoolsinglepoint.cpp @@ -82,6 +82,24 @@ void VToolSinglePoint::setDialog() dialogTool->setData(p->name(), p->toQPointF()); } +//--------------------------------------------------------------------------------------------------------------------- +QString VToolSinglePoint::name() const +{ + return VAbstractTool::data.GeometricObject(id)->name(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolSinglePoint::setName(const QString &name) +{ + +} + +//--------------------------------------------------------------------------------------------------------------------- +int VToolSinglePoint::type() const +{ + return Type; +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief AddToFile add tag with informations about tool into file. diff --git a/src/app/tools/drawTools/vtoolsinglepoint.h b/src/app/tools/drawTools/vtoolsinglepoint.h index c3b34f9d5..d66deaed4 100644 --- a/src/app/tools/drawTools/vtoolsinglepoint.h +++ b/src/app/tools/drawTools/vtoolsinglepoint.h @@ -43,6 +43,10 @@ public: const QString &namePP, const QString &mPath, QGraphicsItem * parent = nullptr ); virtual void setDialog(); static const QString ToolType; + QString name() const; + void setName(const QString &name); + virtual int type()const; + enum { Type = UserType + static_cast(Tool::SinglePoint)}; public slots: virtual void FullUpdateFromFile(); virtual void ChangedActivDraw(const QString &newName); diff --git a/src/app/tools/drawTools/vtoolspline.cpp b/src/app/tools/drawTools/vtoolspline.cpp index 47e71f20d..9ddabb672 100644 --- a/src/app/tools/drawTools/vtoolspline.cpp +++ b/src/app/tools/drawTools/vtoolspline.cpp @@ -172,7 +172,7 @@ VToolSpline* VToolSpline::Create(const quint32 _id, const quint32 &p1, const qui doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::SplineTool, doc); + VDrawTool::AddRecord(id, Tool::Spline, doc); if (parse == Document::FullParse) { VToolSpline *spl = new VToolSpline(doc, data, id, typeCreation); diff --git a/src/app/tools/drawTools/vtoolspline.h b/src/app/tools/drawTools/vtoolspline.h index 153d4f917..f1607e17a 100644 --- a/src/app/tools/drawTools/vtoolspline.h +++ b/src/app/tools/drawTools/vtoolspline.h @@ -48,6 +48,8 @@ public: VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation); static const QString ToolType; + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::Spline)}; public slots: void ControlPointChangePosition (const qint32 &indexSpline, const SplinePointPosition &position, const QPointF &pos); diff --git a/src/app/tools/drawTools/vtoolsplinepath.cpp b/src/app/tools/drawTools/vtoolsplinepath.cpp index d66847b4e..c3e25c609 100644 --- a/src/app/tools/drawTools/vtoolsplinepath.cpp +++ b/src/app/tools/drawTools/vtoolsplinepath.cpp @@ -146,7 +146,7 @@ void VToolSplinePath::Create(const quint32 _id, VSplinePath *path, VMainGraphics doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::SplinePathTool, doc); + VDrawTool::AddRecord(id, Tool::SplinePath, doc); if (parse == Document::FullParse) { VToolSplinePath *spl = new VToolSplinePath(doc, data, id, typeCreation); diff --git a/src/app/tools/drawTools/vtoolsplinepath.h b/src/app/tools/drawTools/vtoolsplinepath.h index c5e39955c..b94ffc919 100644 --- a/src/app/tools/drawTools/vtoolsplinepath.h +++ b/src/app/tools/drawTools/vtoolsplinepath.h @@ -46,6 +46,8 @@ public: VContainer *data, const Document &parse, const Source &typeCreation); static const QString ToolType; static void UpdatePathPoint(VPattern *doc, QDomNode& node, const VSplinePath &path); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::SplinePath)}; signals: /** * @brief RefreshLine refresh control line. diff --git a/src/app/tools/drawTools/vtooltriangle.h b/src/app/tools/drawTools/vtooltriangle.h index f845c4786..d8cca4530 100644 --- a/src/app/tools/drawTools/vtooltriangle.h +++ b/src/app/tools/drawTools/vtooltriangle.h @@ -51,6 +51,8 @@ public: static QPointF FindPoint(const QPointF &axisP1, const QPointF &axisP2, const QPointF &firstPoint, const QPointF &secondPoint); static const QString ToolType; + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::Triangle)}; public slots: virtual void FullUpdateFromFile(); virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); diff --git a/src/app/tools/nodeDetails/vnodearc.h b/src/app/tools/nodeDetails/vnodearc.h index f0bd899be..b199855cb 100644 --- a/src/app/tools/nodeDetails/vnodearc.h +++ b/src/app/tools/nodeDetails/vnodearc.h @@ -49,6 +49,8 @@ public: static const QString ToolType; virtual void DeleteNode(); virtual void RestoreNode(); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::NodeArc)}; public slots: virtual void FullUpdateFromFile(); protected: diff --git a/src/app/tools/nodeDetails/vnodepoint.h b/src/app/tools/nodeDetails/vnodepoint.h index 2e3a7f535..0201af254 100644 --- a/src/app/tools/nodeDetails/vnodepoint.h +++ b/src/app/tools/nodeDetails/vnodepoint.h @@ -55,6 +55,8 @@ public: static const QString ToolType; virtual void DeleteNode(); virtual void RestoreNode(); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::NodePoint)}; public slots: virtual void FullUpdateFromFile(); void NameChangePosition(const QPointF &pos); diff --git a/src/app/tools/nodeDetails/vnodespline.h b/src/app/tools/nodeDetails/vnodespline.h index 0492d9381..ea29108a2 100644 --- a/src/app/tools/nodeDetails/vnodespline.h +++ b/src/app/tools/nodeDetails/vnodespline.h @@ -49,6 +49,8 @@ public: static const QString ToolType; virtual void DeleteNode(); virtual void RestoreNode(); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::NodeSpline)}; public slots: virtual void FullUpdateFromFile (); protected: diff --git a/src/app/tools/nodeDetails/vnodesplinepath.h b/src/app/tools/nodeDetails/vnodesplinepath.h index 91026e642..7be54d734 100644 --- a/src/app/tools/nodeDetails/vnodesplinepath.h +++ b/src/app/tools/nodeDetails/vnodesplinepath.h @@ -48,6 +48,8 @@ public: static const QString ToolType; virtual void DeleteNode(); virtual void RestoreNode(); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::SplinePath)}; public slots: virtual void FullUpdateFromFile(); protected: diff --git a/src/app/tools/vtooldetail.cpp b/src/app/tools/vtooldetail.cpp index 747b3f185..d93488eaf 100644 --- a/src/app/tools/vtooldetail.cpp +++ b/src/app/tools/vtooldetail.cpp @@ -216,7 +216,7 @@ void VToolDetail::Create(const quint32 &_id, const VDetail &newDetail, VMainGrap doc->UpdateToolData(id, data); } } - VAbstractTool::AddRecord(id, Tool::DetailTool, doc); + VAbstractTool::AddRecord(id, Tool::Detail, doc); if (parse == Document::FullParse) { VToolDetail *detail = new VToolDetail(doc, data, id, typeCreation, scene); diff --git a/src/app/tools/vtooldetail.h b/src/app/tools/vtooldetail.h index df90ad8e5..cd0c9bec8 100644 --- a/src/app/tools/vtooldetail.h +++ b/src/app/tools/vtooldetail.h @@ -82,6 +82,8 @@ public: static const QString NodeSplinePath; void Remove(bool ask); static void AddNode(VPattern *doc, QDomElement &domElement, const VNodeDetail &node); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Tool::Detail)}; public slots: virtual void FullUpdateFromFile (); virtual void FullUpdateFromGuiOk(int result); diff --git a/src/app/visualization/vcontrolpointspline.h b/src/app/visualization/vcontrolpointspline.h index 0ae115fc7..e72c78951 100644 --- a/src/app/visualization/vcontrolpointspline.h +++ b/src/app/visualization/vcontrolpointspline.h @@ -43,6 +43,8 @@ public: VControlPointSpline(const qint32 &indexSpline, SplinePointPosition position, const QPointF &controlPoint, const QPointF &splinePoint, QGraphicsItem * parent = nullptr); virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Vis::ControlPointSpline)}; signals: /** * @brief ControlPointChangePosition emit when control point change position. diff --git a/src/app/visualization/vgraphicssimpletextitem.h b/src/app/visualization/vgraphicssimpletextitem.h index b6622feda..122b02b20 100644 --- a/src/app/visualization/vgraphicssimpletextitem.h +++ b/src/app/visualization/vgraphicssimpletextitem.h @@ -31,6 +31,7 @@ #include #include +#include "../options.h" /** * @brief The VGraphicsSimpleTextItem class pointer label. @@ -44,6 +45,8 @@ public: qint32 FontSize()const; virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Vis::GraphicsSimpleTextItem)}; signals: /** * @brief NameChangePosition emit when label change position. diff --git a/src/app/visualization/visline.h b/src/app/visualization/visline.h index ec7933a1f..8f8c4d884 100644 --- a/src/app/visualization/visline.h +++ b/src/app/visualization/visline.h @@ -42,6 +42,8 @@ public: VisLine(const VContainer *data, QGraphicsItem *parent = 0); virtual ~VisLine(); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Vis::Line)}; protected: QLineF Line(const QPointF &p1, const qreal& length, const qreal &angle); qreal CorrectAngle(const qreal &angle) const; diff --git a/src/app/visualization/vispath.h b/src/app/visualization/vispath.h index 67ef9974a..54d226863 100644 --- a/src/app/visualization/vispath.h +++ b/src/app/visualization/vispath.h @@ -39,6 +39,8 @@ public: VisPath(const VContainer *data, QGraphicsItem *parent = 0); virtual ~VisPath(); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Vis::Path)}; protected: virtual void InitPen(); virtual void AddOnScene(); diff --git a/src/app/visualization/vistoolalongline.h b/src/app/visualization/vistoolalongline.h index 791d2cf1d..45d6d61e3 100644 --- a/src/app/visualization/vistoolalongline.h +++ b/src/app/visualization/vistoolalongline.h @@ -43,6 +43,8 @@ public: virtual void RefreshGeometry(); void setPoint2Id(const quint32 &value); void setLength(const QString &expression); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Vis::ToolAlongLine)}; private: Q_DISABLE_COPY(VisToolAlongLine) quint32 point2Id; diff --git a/src/app/visualization/vistoolarc.h b/src/app/visualization/vistoolarc.h index 3c06737c8..5e44d0f1a 100644 --- a/src/app/visualization/vistoolarc.h +++ b/src/app/visualization/vistoolarc.h @@ -43,6 +43,8 @@ public: void setRadius(const QString &expression); void setF1(const QString &expression); void setF2(const QString &expression); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Vis::ToolArc)}; private: Q_DISABLE_COPY(VisToolArc) QGraphicsEllipseItem *arcCenter; diff --git a/src/app/visualization/vistoolbisector.h b/src/app/visualization/vistoolbisector.h index 9b8aade23..be85db27b 100644 --- a/src/app/visualization/vistoolbisector.h +++ b/src/app/visualization/vistoolbisector.h @@ -42,6 +42,8 @@ public: void setPoint2Id(const quint32 &value); void setPoint3Id(const quint32 &value); void setLength(const QString &expression); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Vis::ToolBisector)}; private: Q_DISABLE_COPY(VisToolBisector) quint32 point2Id; diff --git a/src/app/visualization/vistoolcutarc.h b/src/app/visualization/vistoolcutarc.h index a97b7d5bb..84aa695be 100644 --- a/src/app/visualization/vistoolcutarc.h +++ b/src/app/visualization/vistoolcutarc.h @@ -40,6 +40,8 @@ public: virtual void RefreshGeometry(); void setLength(const QString &expression); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Vis::ToolCutArc)}; protected: Q_DISABLE_COPY(VisToolCutArc) QGraphicsEllipseItem *point; diff --git a/src/app/visualization/vistoolendline.h b/src/app/visualization/vistoolendline.h index 288dbde67..7b44f697f 100644 --- a/src/app/visualization/vistoolendline.h +++ b/src/app/visualization/vistoolendline.h @@ -44,6 +44,8 @@ public: QString Angle() const; void setAngle(const QString &expression); void setLength(const QString &expression); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Vis::ToolEndLine)}; private: Q_DISABLE_COPY(VisToolEndLine) qreal length; diff --git a/src/app/visualization/vistoolheight.h b/src/app/visualization/vistoolheight.h index 07b0bcd28..0b17b78bb 100644 --- a/src/app/visualization/vistoolheight.h +++ b/src/app/visualization/vistoolheight.h @@ -42,6 +42,8 @@ public: void setLineP1Id(const quint32 &value); void setLineP2Id(const quint32 &value); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Vis::ToolHeight)}; private: Q_DISABLE_COPY(VisToolHeight) //base point in parent class diff --git a/src/app/visualization/vistoolline.h b/src/app/visualization/vistoolline.h index d28e6be49..48347dbe7 100644 --- a/src/app/visualization/vistoolline.h +++ b/src/app/visualization/vistoolline.h @@ -40,6 +40,8 @@ public: virtual void RefreshGeometry(); void setPoint2Id(const quint32 &value); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Vis::ToolLine)}; private: Q_DISABLE_COPY(VisToolLine) quint32 point2Id; diff --git a/src/app/visualization/vistoollineintersect.h b/src/app/visualization/vistoollineintersect.h index 568c4c242..b69d03ff7 100644 --- a/src/app/visualization/vistoollineintersect.h +++ b/src/app/visualization/vistoollineintersect.h @@ -43,6 +43,8 @@ public: void setLine1P2Id(const quint32 &value); void setLine2P1Id(const quint32 &value); void setLine2P2Id(const quint32 &value); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Vis::ToolLineIntersect)}; private: Q_DISABLE_COPY(VisToolLineIntersect) quint32 line1P2Id; diff --git a/src/app/visualization/vistoolnormal.h b/src/app/visualization/vistoolnormal.h index 649164851..1593d03f5 100644 --- a/src/app/visualization/vistoolnormal.h +++ b/src/app/visualization/vistoolnormal.h @@ -44,6 +44,8 @@ public: void setLength(const QString &expression); qreal getAngle() const; void setAngle(const qreal &value); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Vis::ToolNormal)}; private: Q_DISABLE_COPY(VisToolNormal) quint32 point2Id; diff --git a/src/app/visualization/vistoolpointofcontact.h b/src/app/visualization/vistoolpointofcontact.h index bb638790d..4edc79ea0 100644 --- a/src/app/visualization/vistoolpointofcontact.h +++ b/src/app/visualization/vistoolpointofcontact.h @@ -42,6 +42,8 @@ public: void setLineP2Id(const quint32 &value); void setRadiusId(const quint32 &value); void setRadius(const QString &expression); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Vis::ToolPointOfContact)}; private: Q_DISABLE_COPY(VisToolPointOfContact) quint32 lineP2Id; diff --git a/src/app/visualization/vistoolpointofintersection.h b/src/app/visualization/vistoolpointofintersection.h index e17c1ee05..a2c594f75 100644 --- a/src/app/visualization/vistoolpointofintersection.h +++ b/src/app/visualization/vistoolpointofintersection.h @@ -41,6 +41,8 @@ public: virtual void RefreshGeometry(); void setPoint2Id(const quint32 &value); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Vis::ToolPointOfIntersection)}; private: Q_DISABLE_COPY(VisToolPointOfIntersection) quint32 point2Id; diff --git a/src/app/visualization/vistoolshoulderpoint.h b/src/app/visualization/vistoolshoulderpoint.h index 6511f253b..bfda38bc5 100644 --- a/src/app/visualization/vistoolshoulderpoint.h +++ b/src/app/visualization/vistoolshoulderpoint.h @@ -42,6 +42,8 @@ public: void setLineP1Id(const quint32 &value); void setLineP2Id(const quint32 &value); void setLength(const QString &expression); + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Vis::ToolShoulderPoint)}; private: Q_DISABLE_COPY(VisToolShoulderPoint) quint32 lineP1Id; diff --git a/src/app/visualization/vistoolspline.h b/src/app/visualization/vistoolspline.h index 1a2c9f9f9..56c12d021 100644 --- a/src/app/visualization/vistoolspline.h +++ b/src/app/visualization/vistoolspline.h @@ -46,6 +46,9 @@ public: void setKAsm1(const qreal &value); void setKAsm2(const qreal &value); void setKCurve(const qreal &value); + + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Vis::ToolSpline)}; protected: Q_DISABLE_COPY(VisToolSpline) quint32 point4Id; diff --git a/src/app/visualization/vistooltriangle.h b/src/app/visualization/vistooltriangle.h index b34b5cd0e..a15defaf7 100644 --- a/src/app/visualization/vistooltriangle.h +++ b/src/app/visualization/vistooltriangle.h @@ -43,6 +43,9 @@ public: void setPoint2Id(const quint32 &value); void setHypotenuseP1Id(const quint32 &value); void setHypotenuseP2Id(const quint32 &value); + + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Vis::ToolTriangle)}; private: Q_DISABLE_COPY(VisToolTriangle) quint32 point2Id;//axis second point diff --git a/src/app/visualization/vsimplecurve.h b/src/app/visualization/vsimplecurve.h index 4fb9a8704..bf6cb6683 100644 --- a/src/app/visualization/vsimplecurve.h +++ b/src/app/visualization/vsimplecurve.h @@ -45,6 +45,9 @@ public: qreal *factor = nullptr, QObject *parent = 0); void ChangedActivDraw(const bool &flag); virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0); + + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Vis::SimpleCurvePoint)}; signals: /** * @brief Choosed send id when clicked. diff --git a/src/app/visualization/vsimplesplinepath.h b/src/app/visualization/vsimplesplinepath.h index 50fe8ec67..3ff124b0a 100644 --- a/src/app/visualization/vsimplesplinepath.h +++ b/src/app/visualization/vsimplesplinepath.h @@ -42,6 +42,9 @@ class VSimpleSplinePath : public VAbstractTool, public QGraphicsPathItem public: VSimpleSplinePath(VPattern *doc, VContainer *data, quint32 id, qreal *factor); virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0); + + virtual int type() const {return Type;} + enum { Type = UserType + static_cast(Vis::SimpleSplinePath)}; protected: virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); diff --git a/src/app/widgets/vtooloptionspropertybrowser.cpp b/src/app/widgets/vtooloptionspropertybrowser.cpp index dbd56109e..bfe5d341d 100644 --- a/src/app/widgets/vtooloptionspropertybrowser.cpp +++ b/src/app/widgets/vtooloptionspropertybrowser.cpp @@ -46,18 +46,20 @@ VToolOptionsPropertyBrowser::VToolOptionsPropertyBrowser(QDockWidget *parent) idToProperty(QMap()) { PropertyModel = new VPropertyModel(this); - TreeView = new VPropertyFormView(PropertyModel); + TreeView = new VPropertyFormView(PropertyModel, parent); TreeView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - QScrollArea *scroll = new QScrollArea(); + QScrollArea *scroll = new QScrollArea(parent); scroll->setWidgetResizable(true); scroll->setWidget(TreeView); - QHBoxLayout* layout = new QHBoxLayout(); - parent->setLayout(layout); - layout->setSpacing(5); - layout->setMargin(0); - layout->addWidget(scroll); +// QLayout* layout = parent->layout(); +// layout->setSpacing(5); +// layout->setMargin(0); +// layout->addWidget(scroll); +// parent->setLayout(layout); + + parent->setWidget(scroll); connect(PropertyModel, SIGNAL(onDataChangedByEditor(VProperty*)), this, SLOT(userChangedData(VProperty*))); } diff --git a/src/app/xml/vpattern.cpp b/src/app/xml/vpattern.cpp index 33edc92a2..9142e6e4e 100644 --- a/src/app/xml/vpattern.cpp +++ b/src/app/xml/vpattern.cpp @@ -1095,7 +1095,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem const qreal y = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrY, "10.0")); data->UpdateGObject(id, new VPointF(x, y, name, mx, my)); - VDrawTool::AddRecord(id, Tool::SinglePointTool, this); + VDrawTool::AddRecord(id, Tool::SinglePoint, this); if (parse != Document::FullParse) { UpdateToolData(id, data); @@ -2424,40 +2424,40 @@ QRectF VPattern::ActiveDrawBoundingRect() const { switch ( tool.getTypeTool() ) { - case Tool::ArrowTool: + case Tool::Arrow: Q_UNREACHABLE(); break; - case Tool::SinglePointTool: + case Tool::SinglePoint: rec = ToolBoundingRect(rec, tool.getId()); break; - case Tool::EndLineTool: + case Tool::EndLine: rec = ToolBoundingRect(rec, tool.getId()); break; - case Tool::LineTool: + case Tool::Line: rec = ToolBoundingRect(rec, tool.getId()); break; - case Tool::AlongLineTool: + case Tool::AlongLine: rec = ToolBoundingRect(rec, tool.getId()); break; - case Tool::ShoulderPointTool: + case Tool::ShoulderPoint: rec = ToolBoundingRect(rec, tool.getId()); break; - case Tool::NormalTool: + case Tool::Normal: rec = ToolBoundingRect(rec, tool.getId()); break; - case Tool::BisectorTool: + case Tool::Bisector: rec = ToolBoundingRect(rec, tool.getId()); break; - case Tool::LineIntersectTool: + case Tool::LineIntersect: rec = ToolBoundingRect(rec, tool.getId()); break; - case Tool::SplineTool: + case Tool::Spline: rec = ToolBoundingRect(rec, tool.getId()); break; - case Tool::ArcTool: + case Tool::Arc: rec = ToolBoundingRect(rec, tool.getId()); break; - case Tool::SplinePathTool: + case Tool::SplinePath: rec = ToolBoundingRect(rec, tool.getId()); break; case Tool::PointOfContact: @@ -2472,18 +2472,18 @@ QRectF VPattern::ActiveDrawBoundingRect() const case Tool::PointOfIntersection: rec = ToolBoundingRect(rec, tool.getId()); break; - case Tool::CutArcTool: + case Tool::CutArc: rec = ToolBoundingRect(rec, tool.getId()); break; - case Tool::CutSplineTool: + case Tool::CutSpline: rec = ToolBoundingRect(rec, tool.getId()); break; - case Tool::CutSplinePathTool: + case Tool::CutSplinePath: rec = ToolBoundingRect(rec, tool.getId()); break; //Because "history" not only show history of pattern, but help restore current data for each pattern's //piece, we need add record about details and nodes, but don't show them. - case Tool::DetailTool: + case Tool::Detail: break; case Tool::UnionDetails: break; diff --git a/src/app/xml/vtoolrecord.cpp b/src/app/xml/vtoolrecord.cpp index 1b6fcbd19..046334f14 100644 --- a/src/app/xml/vtoolrecord.cpp +++ b/src/app/xml/vtoolrecord.cpp @@ -33,7 +33,7 @@ * @brief VToolRecord default constructor. */ VToolRecord::VToolRecord() - :id(NULL_ID), typeTool(Tool::ArrowTool), nameDraw(QString()) + :id(NULL_ID), typeTool(Tool::Arrow), nameDraw(QString()) {} //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vpropertyexplorer/vpropertyexplorer.pro b/src/libs/vpropertyexplorer/vpropertyexplorer.pro index ee82ff976..4c998c79a 100644 --- a/src/libs/vpropertyexplorer/vpropertyexplorer.pro +++ b/src/libs/vpropertyexplorer/vpropertyexplorer.pro @@ -15,6 +15,15 @@ CONFIG += c++11 DEFINES += VPROPERTYEXPLORER_LIBRARY +# directory for executable file +DESTDIR = bin + +# files created moc +MOC_DIR = moc + +# objecs files +OBJECTS_DIR = obj + SOURCES += \ vproperty.cpp \ vpropertydelegate.cpp \ @@ -78,3 +87,5 @@ unix { target.path = /usr/lib INSTALLS += target } + +QMAKE_CXXFLAGS += -gdwarf-3