diff --git a/src/app/valentina/core/vtooloptionspropertybrowser.cpp b/src/app/valentina/core/vtooloptionspropertybrowser.cpp index 8e0e356bd..09e22849e 100644 --- a/src/app/valentina/core/vtooloptionspropertybrowser.cpp +++ b/src/app/valentina/core/vtooloptionspropertybrowser.cpp @@ -76,7 +76,7 @@ void VToolOptionsPropertyBrowser::ClearPropertyBrowser() void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item) { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used in switch."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were used in switch."); switch (item->type()) { @@ -203,7 +203,7 @@ void VToolOptionsPropertyBrowser::UpdateOptions() } // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used in switch."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were used in switch."); switch (currentItem->type()) { @@ -348,7 +348,7 @@ void VToolOptionsPropertyBrowser::userChangedData(VPE::VProperty *property) } // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used in switch."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were used in switch."); switch (currentItem->type()) { diff --git a/src/app/valentina/dialogs/dialoghistory.cpp b/src/app/valentina/dialogs/dialoghistory.cpp index ae3f66b62..a168827b8 100644 --- a/src/app/valentina/dialogs/dialoghistory.cpp +++ b/src/app/valentina/dialogs/dialoghistory.cpp @@ -212,7 +212,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default") QString DialogHistory::Record(const VToolRecord &tool) { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used in history."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were used in history."); const QDomElement domElem = doc->elementById(tool.getId()); if (domElem.isElement() == false) @@ -392,7 +392,6 @@ 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::Detail: case Tool::Piece: case Tool::UnionDetails: case Tool::NodeArc: diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 8823c0370..e15949234 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -51,7 +51,6 @@ #include "../vwidgets/vmaingraphicsscene.h" #include "tools/drawTools/drawtools.h" #include "../vtools/dialogs/tooldialogs.h" -#include "tools/vtooldetail.h" #include "tools/vtoolseamallowance.h" #include "tools/nodeDetails/vtoolpiecepath.h" #include "tools/vtooluniondetails.h" @@ -990,21 +989,6 @@ void MainWindow::ToolPiecePath(bool checked) &MainWindow::ClosedDialogPiecePath); } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ClosedDialogDetail actions after closing DialogDetail. - * @param result result of dialog working. - */ -void MainWindow::ClosedDialogDetail(int result) -{ - if (result == QDialog::Accepted) - { - VToolDetail::Create(dialogTool, sceneDetails, doc, pattern); - } - ArrowTool(); - doc->LiteParseTree(Document::LiteParse); -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief ToolHeight handler tool height. @@ -1772,7 +1756,7 @@ void MainWindow::InitToolButtons() } // This check helps to find missed tools - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52, "Check if all tools were connected."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51, "Check if all tools were connected."); connect(ui->toolButtonEndLine, &QToolButton::clicked, this, &MainWindow::ToolEndLine); connect(ui->toolButtonLine, &QToolButton::clicked, this, &MainWindow::ToolLine); @@ -1845,7 +1829,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default") void MainWindow::CancelTool() { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were handled."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were handled."); qCDebug(vMainWindow, "Canceling tool."); delete dialogTool; @@ -1929,9 +1913,6 @@ void MainWindow::CancelTool() case Tool::PointOfContact: ui->toolButtonPointOfContact->setChecked(false); break; - case Tool::Detail: - ui->toolButtonNewDetail->setChecked(false); - break; case Tool::Piece: ui->toolButtonNewDetail->setChecked(false); break; @@ -3055,7 +3036,7 @@ void MainWindow::SetEnableTool(bool enable) } // This check helps to find missed tools - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were handled."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were handled."); //Drawing Tools ui->toolButtonEndLine->setEnabled(drawTools); @@ -3377,7 +3358,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default") void MainWindow::LastUsedTool() { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were handled."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were handled."); if (currentTool == lastUsedTool) { @@ -3464,10 +3445,6 @@ void MainWindow::LastUsedTool() ui->toolButtonPointOfContact->setChecked(true); ToolPointOfContact(true); break; - case Tool::Detail: - ui->toolButtonNewDetail->setChecked(true); - ToolDetail(true); - break; case Tool::Piece: ui->toolButtonNewDetail->setChecked(true); ToolDetail(true); diff --git a/src/app/valentina/mainwindow.h b/src/app/valentina/mainwindow.h index fed8ae7e0..7b6277533 100644 --- a/src/app/valentina/mainwindow.h +++ b/src/app/valentina/mainwindow.h @@ -168,7 +168,6 @@ private slots: bool Save(); void Open(); - void ClosedDialogDetail(int result); void ClosedDialogUnionDetails(int result); void ClosedDialogGroup(int result); void ClosedDialogPiecePath(int result); diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 6bee26a2b..3b2855a4e 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -29,7 +29,6 @@ #include "vpattern.h" #include "../vwidgets/vabstractmainwindow.h" #include "../vtools/tools/vdatatool.h" -#include "../vtools/tools/vtooldetail.h" #include "../vtools/tools/vtoolseamallowance.h" #include "../vtools/tools/vtooluniondetails.h" #include "../vtools/tools/drawTools/drawtools.h" @@ -812,13 +811,13 @@ void VPattern::ParsePieceDataTag(const QDomElement &domElement, VPiece &detail) ptPos.setX(GetParametrDouble(domElement, AttrMx, "0")); ptPos.setY(GetParametrDouble(domElement, AttrMy, "0")); detail.GetPatternPieceData().SetPos(ptPos); - qreal dLW = GetParametrDouble(domElement, VToolDetail::AttrWidth, "0"); + qreal dLW = GetParametrDouble(domElement, VToolSeamAllowance::AttrWidth, "0"); detail.GetPatternPieceData().SetLabelWidth(dLW); - qreal dLH = GetParametrDouble(domElement, VToolDetail::AttrHeight, "0"); + qreal dLH = GetParametrDouble(domElement, VToolSeamAllowance::AttrHeight, "0"); detail.GetPatternPieceData().SetLabelHeight(dLH); - int iFS = static_cast(GetParametrUInt(domElement, VToolDetail::AttrFont, "0")); + int iFS = static_cast(GetParametrUInt(domElement, VToolSeamAllowance::AttrFont, "0")); detail.GetPatternPieceData().SetFontSize(iFS); - qreal dRot = GetParametrDouble(domElement, VToolDetail::AttrRotation, "0"); + qreal dRot = GetParametrDouble(domElement, VToolSeamAllowance::AttrRotation, "0"); detail.GetPatternPieceData().SetRotation(dRot); QDomNodeList nodeListMCP = domElement.childNodes(); @@ -845,13 +844,13 @@ void VPattern::ParsePiecePatternInfo(const QDomElement &domElement, VPiece &deta ptPos.setX(GetParametrDouble(domElement, AttrMx, "0")); ptPos.setY(GetParametrDouble(domElement, AttrMy, "0")); detail.GetPatternInfo().SetPos(ptPos); - qreal dLW = GetParametrDouble(domElement, VToolDetail::AttrWidth, "0"); + qreal dLW = GetParametrDouble(domElement, VToolSeamAllowance::AttrWidth, "0"); detail.GetPatternInfo().SetLabelWidth(dLW); - qreal dLH = GetParametrDouble(domElement, VToolDetail::AttrHeight, "0"); + qreal dLH = GetParametrDouble(domElement, VToolSeamAllowance::AttrHeight, "0"); detail.GetPatternInfo().SetLabelHeight(dLH); - int iFS = static_cast(GetParametrUInt(domElement, VToolDetail::AttrFont, "0")); + int iFS = static_cast(GetParametrUInt(domElement, VToolSeamAllowance::AttrFont, "0")); detail.GetPatternInfo().SetFontSize(iFS); - qreal dRot = GetParametrDouble(domElement, VToolDetail::AttrRotation, "0"); + qreal dRot = GetParametrDouble(domElement, VToolSeamAllowance::AttrRotation, "0"); detail.GetPatternInfo().SetRotation(dRot); } @@ -865,7 +864,7 @@ void VPattern::ParsePieceGrainline(const QDomElement &domElement, VPiece &detail detail.GetGrainlineGeometry().SetPos(ptPos); QString qsLength = GetParametrString(domElement, AttrLength, "0"); detail.GetGrainlineGeometry().SetLength(qsLength); - QString qsRot = GetParametrString(domElement, VToolDetail::AttrRotation, "90"); + QString qsRot = GetParametrString(domElement, VToolSeamAllowance::AttrRotation, "90"); detail.GetGrainlineGeometry().SetRotation(qsRot); VGrainlineGeometry::ArrowType eAT = VGrainlineGeometry::ArrowType(GetParametrUInt(domElement, AttrArrows, "0")); @@ -3737,7 +3736,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default") QRectF VPattern::ActiveDrawBoundingRect() const { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were used."); QRectF rec; @@ -3862,7 +3861,6 @@ QRectF VPattern::ActiveDrawBoundingRect() const rec = ToolBoundingRect(rec, tool.getId()); break; //These tools are not accesseble in Draw mode, but still 'history' contains them. - case Tool::Detail: case Tool::Piece: case Tool::UnionDetails: case Tool::NodeArc: diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index 87755a387..c344bc12e 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -774,7 +774,7 @@ quint32 VAbstractPattern::SiblingNodeId(const quint32 &nodeId) const const VToolRecord tool = history.at(j-1); switch ( tool.getTypeTool() ) { - case Tool::Detail: + case Tool::Piece: case Tool::UnionDetails: case Tool::NodeArc: case Tool::NodeElArc: @@ -1566,7 +1566,7 @@ QStringList VAbstractPattern::ListPointExpressions() const // Check if new tool doesn't bring new attribute with a formula. // If no just increment a number. // If new tool bring absolutely new type and has formula(s) create new method to cover it. - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51); QStringList expressions; const QDomNodeList list = elementsByTagName(TagPoint); @@ -1638,7 +1638,7 @@ QStringList VAbstractPattern::ListArcExpressions() const // Check if new tool doesn't bring new attribute with a formula. // If no just increment number. // If new tool bring absolutely new type and has formula(s) create new method to cover it. - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51); QStringList expressions; const QDomNodeList list = elementsByTagName(TagArc); @@ -1692,7 +1692,7 @@ QStringList VAbstractPattern::ListElArcExpressions() const // Check if new tool doesn't bring new attribute with a formula. // If no just increment number. // If new tool bring absolutely new type and has formula(s) create new method to cover it. - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51); QStringList expressions; const QDomNodeList list = elementsByTagName(TagElArc); @@ -1763,7 +1763,7 @@ QStringList VAbstractPattern::ListPathPointExpressions() const // Check if new tool doesn't bring new attribute with a formula. // If no just increment number. // If new tool bring absolutely new type and has formula(s) create new method to cover it. - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51); QStringList expressions; const QDomNodeList list = elementsByTagName(AttrPathPoint); @@ -1830,7 +1830,7 @@ QStringList VAbstractPattern::ListOperationExpressions() const // Check if new tool doesn't bring new attribute with a formula. // If no just increment number. // If new tool bring absolutely new type and has formula(s) create new method to cover it. - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51); QStringList expressions; const QDomNodeList list = elementsByTagName(TagOperation); diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index 8ef847585..15a5ef7aa 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -120,7 +120,6 @@ enum class Tool : ToolVisHolderType CubicBezierPath, CutSplinePath, PointOfContact, - Detail, Piece, PiecePath, NodePoint, diff --git a/src/libs/vtools/tools/tools.pri b/src/libs/vtools/tools/tools.pri index 99d8e4bcb..2b755c117 100644 --- a/src/libs/vtools/tools/tools.pri +++ b/src/libs/vtools/tools/tools.pri @@ -2,7 +2,6 @@ # This need for corect working file translations.pro HEADERS += \ - $$PWD/vtooldetail.h \ $$PWD/vdatatool.h \ $$PWD/vabstracttool.h \ $$PWD/tools.h \ @@ -62,7 +61,6 @@ HEADERS += \ $$PWD/nodeDetails/vtoolpiecepath.h SOURCES += \ - $$PWD/vtooldetail.cpp \ $$PWD/vdatatool.cpp \ $$PWD/vabstracttool.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp \ diff --git a/src/libs/vtools/tools/vtooldetail.cpp b/src/libs/vtools/tools/vtooldetail.cpp deleted file mode 100644 index 5a4abc1b0..000000000 --- a/src/libs/vtools/tools/vtooldetail.cpp +++ /dev/null @@ -1,1327 +0,0 @@ -/************************************************************************ - ** - ** @file vtooldetail.cpp - ** @author Roman Telezhynskyi - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013-2015 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#include "vtooldetail.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../dialogs/tools/dialogtool.h" -#include "../ifc/exception/vexception.h" -#include "../ifc/xml/vdomdocument.h" -#include "../ifc/xml/vabstractpattern.h" -#include "../ifc/ifcdef.h" -#include "../undocommands/adddet.h" -#include "../undocommands/deletedetail.h" -#include "../undocommands/movepiece.h" -#include "../undocommands/savedetailoptions.h" -#include "../undocommands/togglepieceinlayout.h" -#include "../vgeometry/varc.h" -#include "../vgeometry/vellipticalarc.h" -#include "../vgeometry/vcubicbezier.h" -#include "../vgeometry/vcubicbezierpath.h" -#include "../vgeometry/vgeometrydef.h" -#include "../vgeometry/vgobject.h" -#include "../vgeometry/vpointf.h" -#include "../vgeometry/vspline.h" -#include "../vgeometry/vsplinepath.h" -#include "../vmisc/vabstractapplication.h" -#include "../vpatterndb/vcontainer.h" -#include "../vpatterndb/vdetail.h" -#include "../vpatterndb/vpatterninfogeometry.h" -#include "../vpatterndb/vpatternpiecedata.h" -#include "../vpatterndb/calculator.h" -#include "../vmisc/def.h" -#include "../vwidgets/vmaingraphicsscene.h" -#include "../vwidgets/vmaingraphicsview.h" -#include "../vwidgets/vnobrushscalepathitem.h" -#include "../tools/vtooldetail.h" -#include "vabstracttool.h" -#include "nodeDetails/vabstractnode.h" -#include "nodeDetails/vnodearc.h" -#include "nodeDetails/vnodeellipticalarc.h" -#include "nodeDetails/vnodepoint.h" -#include "nodeDetails/vnodespline.h" -#include "nodeDetails/vnodesplinepath.h" -#include "vtextgraphicsitem.h" -#include "vnodedetail.h" - -class QDomElement; -class QGraphicsSceneContextMenuEvent; -class QGraphicsSceneHoverEvent; -class QGraphicsSceneMouseEvent; -class QKeyEvent; -class QStyleOptionGraphicsItem; -class QWidget; -class VDataTool; - -const QString VToolDetail::TagNode = QStringLiteral("node"); - -const QString VToolDetail::AttrSupplement = QStringLiteral("supplement"); -const QString VToolDetail::AttrClosed = QStringLiteral("closed"); -const QString VToolDetail::AttrForbidFlipping = QStringLiteral("forbidFlipping"); -const QString VToolDetail::AttrWidth = QStringLiteral("width"); -const QString VToolDetail::AttrHeight = QStringLiteral("height"); -const QString VToolDetail::AttrNodeType = QStringLiteral("nodeType"); -const QString VToolDetail::AttrReverse = QStringLiteral("reverse"); -const QString VToolDetail::AttrFont = QStringLiteral("fontSize"); -const QString VToolDetail::AttrRotation = QStringLiteral("rotation"); - -const QString VToolDetail::NodeTypeContour = QStringLiteral("Contour"); -const QString VToolDetail::NodeTypeModeling = QStringLiteral("Modeling"); - -const QString VToolDetail::NodeArc = QStringLiteral("NodeArc"); -const QString VToolDetail::NodeElArc = QStringLiteral("NodeElArc"); -const QString VToolDetail::NodePoint = QStringLiteral("NodePoint"); -const QString VToolDetail::NodeSpline = QStringLiteral("NodeSpline"); -const QString VToolDetail::NodeSplinePath = QStringLiteral("NodeSplinePath"); - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief VToolDetail constructor. - * @param doc dom document container - * @param data container with variables - * @param id object id in container - * @param typeCreation way we create this tool. - * @param scene pointer to scene. - * @param parent parent object - */ -VToolDetail::VToolDetail(VAbstractPattern *doc, VContainer *data, const quint32 &id, const Source &typeCreation, - VMainGraphicsScene *scene, const QString &drawName, QGraphicsItem *parent) - :VAbstractTool(doc, data, id), VNoBrushScalePathItem(parent), dialog(nullptr), sceneDetails(scene), - drawName(drawName), seamAllowance(new VNoBrushScalePathItem(this)), dataLabel(new VTextGraphicsItem(this)), - patternInfo(new VTextGraphicsItem(this)), grainLine(new VGrainlineItem(this)) -{ - VDetail detail = data->GetDetail(id); - for (int i = 0; i< detail.CountNode(); ++i) - { - switch (detail.at(i).getTypeTool()) - { - case (Tool::NodePoint): - { - VNodePoint *tool = InitTool(scene, detail.at(i)); - connect(tool, &VNodePoint::ShowContextMenu, this, &VToolDetail::contextMenuEvent); - break; - } - case (Tool::NodeArc): - case (Tool::NodeElArc): - case (Tool::NodeSpline): - case (Tool::NodeSplinePath): - doc->IncrementReferens(detail.at(i).getId()); - break; - default: - qDebug()<<"Get wrong tool type. Ignore."; - break; - } - } - this->setFlag(QGraphicsItem::ItemIsMovable, true); - this->setFlag(QGraphicsItem::ItemIsSelectable, true); - RefreshGeometry(); - - this->setBrush(QBrush(Qt::Dense7Pattern)); - seamAllowance->setBrush(QBrush(Qt::FDiagPattern)); - - this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); - this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus - - connect(scene, &VMainGraphicsScene::EnableToolMove, this, &VToolDetail::EnableToolMove); - connect(scene, &VMainGraphicsScene::ItemClicked, this, &VToolDetail::ResetChildren); - if (typeCreation == Source::FromGui || typeCreation == Source::FromTool) - { - AddToFile(); - if (typeCreation != Source::FromTool) - { - qApp->getUndoStack()->endMacro(); - } - } - setAcceptHoverEvents(true); - - connect(dataLabel, &VTextGraphicsItem::SignalMoved, this, &VToolDetail::SaveMoveDetail); - connect(dataLabel, &VTextGraphicsItem::SignalResized, this, &VToolDetail::SaveResizeDetail); - connect(dataLabel, &VTextGraphicsItem::SignalRotated, this, &VToolDetail::SaveRotationDetail); - - connect(patternInfo, &VTextGraphicsItem::SignalMoved, this, &VToolDetail::SaveMovePattern); - connect(patternInfo, &VTextGraphicsItem::SignalResized, this, &VToolDetail::SaveResizePattern); - connect(patternInfo, &VTextGraphicsItem::SignalRotated, this, &VToolDetail::SaveRotationPattern); - - connect(grainLine, &VGrainlineItem::SignalMoved, this, &VToolDetail::SaveMoveGrainline); - connect(grainLine, &VGrainlineItem::SignalResized, this, &VToolDetail::SaveResizeGrainline); - connect(grainLine, &VGrainlineItem::SignalRotated, this, &VToolDetail::SaveRotateGrainline); - - connect(doc, &VAbstractPattern::patternChanged, this, &VToolDetail::UpdatePatternInfo); - connect(doc, &VAbstractPattern::CheckLayout, this, &VToolDetail::UpdateLabel); - connect(doc, &VAbstractPattern::CheckLayout, this, &VToolDetail::UpdatePatternInfo); - connect(doc, &VAbstractPattern::CheckLayout, this, &VToolDetail::UpdateGrainline); - - connect(sceneDetails, &VMainGraphicsScene::DimensionsChanged, this, &VToolDetail::UpdateLabel); - connect(sceneDetails, &VMainGraphicsScene::DimensionsChanged, this, &VToolDetail::UpdatePatternInfo); - connect(sceneDetails, &VMainGraphicsScene::LanguageChanged, this, &VToolDetail::retranslateUi); - - UpdateLabel(); - UpdatePatternInfo(); - UpdateGrainline(); -} - -//--------------------------------------------------------------------------------------------------------------------- -VToolDetail::~VToolDetail() -{ - delete dialog; -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief setDialog set dialog when user want change tool option. - */ -void VToolDetail::setDialog() -{ - SCASSERT(dialog != nullptr) -// DialogDetail *dialogTool = qobject_cast(dialog); -// SCASSERT(dialogTool != nullptr) -// dialogTool->setDetail(VAbstractTool::data.GetDetail(id)); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief Create help create tool from GUI. - * @param dialog dialog. - * @param scene pointer to scene. - * @param doc dom document container. - * @param data container with variables. - */ -void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) -{ - SCASSERT(dialog != nullptr) -// DialogDetail *dialogTool = qobject_cast(dialog); -// SCASSERT(dialogTool != nullptr) -// VDetail detail = dialogTool->getDetail(); -// VDetail det; -// qApp->getUndoStack()->beginMacro("add detail"); -// for (int i = 0; i< detail.CountNode(); ++i) -// { -// quint32 id = 0; -// const VNodeDetail &nodeD = detail.at(i); -// switch (nodeD.getTypeTool()) -// { -// case (Tool::NodePoint): -// { -// id = CreateNode(data, nodeD.getId()); -// VNodePoint::Create(doc, data, scene, id, nodeD.getId(), Document::FullParse, Source::FromGui); -// } -// break; -// case (Tool::NodeArc): -// { -// id = CreateNode(data, nodeD.getId()); -// VNodeArc::Create(doc, data, id, nodeD.getId(), Document::FullParse, Source::FromGui); -// } -// break; -// case (Tool::NodeElArc): -// { -// id = CreateNode(data, nodeD.getId()); -// VNodeEllipticalArc::Create(doc, data, id, nodeD.getId(), Document::FullParse, Source::FromGui); -// } -// break; -// case (Tool::NodeSpline): -// { -// const auto obj = data->GetGObject(nodeD.getId()); -// if (obj->getType() == GOType::Spline) -// { -// id = CreateNode(data, nodeD.getId()); -// } -// else -// { -// id = CreateNode(data, nodeD.getId()); -// } -// VNodeSpline::Create(doc, data, id, nodeD.getId(), Document::FullParse, Source::FromGui); -// } -// break; -// case (Tool::NodeSplinePath): -// { -// const auto obj = data->GetGObject(nodeD.getId()); -// if (obj->getType() == GOType::SplinePath) -// { -// id = CreateNode(data, nodeD.getId()); -// } -// else -// { -// id = CreateNode(data, nodeD.getId()); -// } -// VNodeSplinePath::Create(doc, data, id, nodeD.getId(), Document::FullParse, Source::FromGui); -// } -// break; -// default: -// qDebug()<<"May be wrong tool type!!! Ignoring."<AddDetail(newDetail); - } - else - { - data->UpdateDetail(id, newDetail); - if (parse != Document::FullParse) - { - doc->UpdateToolData(id, data); - } - } - VAbstractTool::AddRecord(id, Tool::Detail, doc); - if (parse == Document::FullParse) - { - VToolDetail *detail = new VToolDetail(doc, data, id, typeCreation, scene, drawName); - scene->addItem(detail); - connect(detail, &VToolDetail::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - connect(scene, &VMainGraphicsScene::EnableDetailItemHover, detail, &VToolDetail::AllowHover); - connect(scene, &VMainGraphicsScene::EnableDetailItemSelection, detail, &VToolDetail::AllowSelecting); - connect(scene, &VMainGraphicsScene::HighlightDetail, detail, &VToolDetail::Highlight); - doc->AddTool(id, detail); - } -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief Remove full delete detail. - */ -void VToolDetail::Remove(bool ask) -{ - try - { - DeleteTool(ask); - } - catch(const VExceptionToolWasDeleted &e) - { - Q_UNUSED(e) - return;//Leave this method immediately!!! - } -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief FullUpdateFromFile update tool data form file. - */ -void VToolDetail::FullUpdateFromFile() -{ - RefreshGeometry(); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief FullUpdateFromGuiOk refresh tool data after change in options. - * @param result keep result working dialog. - */ -void VToolDetail::FullUpdateFromGuiOk(int result) -{ - if (result == QDialog::Accepted) - { - SCASSERT(dialog != nullptr) -// DialogDetail *dialogTool = qobject_cast(dialog); -// SCASSERT(dialogTool != nullptr) -// const VDetail newDet = dialogTool->getDetail(); -// const VDetail oldDet = VAbstractTool::data.GetDetail(id); - -// qDebug() << "VToolDetail Position" << newDet.GetPatternPieceData().GetPos(); -// SaveDetailOptions *saveCommand = new SaveDetailOptions(oldDet, newDet, doc, id, this->scene()); -// connect(saveCommand, &SaveDetailOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); -// qApp->getUndoStack()->push(saveCommand); -// UpdateLabel(); - } - delete dialog; - dialog = nullptr; -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief VToolDetail::paint draws a bounding box around detail, if one of its text or grainline items is not idle. - */ -void VToolDetail::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -{ - if (scene()->views().count() > 0) - { - const QPoint pt0 = scene()->views().at(0)->mapFromScene(0, 0); - const QPoint pt = scene()->views().at(0)->mapFromScene(0, 100); - - const QPoint p = pt - pt0; - -#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) - const qreal dScale = qSqrt(QPoint::dotProduct(p, p)); -#else - const qreal dScale = qSqrt(p.x() * p.x() + p.y() * p.y()); -#endif //QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) - grainLine->SetScale(100/dScale); - //qDebug() << "SCALE" << dScale << 10/dScale; - } - - if (dataLabel->IsIdle() == false || patternInfo->IsIdle() == false || grainLine->IsIdle() == false) - { - painter->save(); - painter->setPen(QPen(Qt::black, 3, Qt::DashLine)); - painter->drawRect(boundingRect().adjusted(1, 1, -1, -1)); - painter->restore(); - } - VNoBrushScalePathItem::paint(painter, option, widget); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief AddToFile add tag with informations about tool into file. - */ -void VToolDetail::AddToFile() -{ - const VDetail detail = VAbstractTool::data.GetDetail(id); - QDomElement domElement = doc->createElement(getTagName()); - - doc->SetAttribute(domElement, VDomDocument::AttrId, id); - doc->SetAttribute(domElement, AttrName, detail.getName()); - doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(detail.getMx())); - doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(detail.getMy())); - doc->SetAttribute(domElement, AttrSupplement, static_cast(detail.getSeamAllowance())); - doc->SetAttribute(domElement, AttrClosed, static_cast(detail.getClosed())); - doc->SetAttribute(domElement, AttrWidth, detail.getWidth()); - doc->SetAttribute(domElement, AttrForbidFlipping, static_cast(detail.getForbidFlipping())); - - // detail data - QDomElement domData = doc->createElement(VAbstractPattern::TagData); - const VPatternPieceData& data = detail.GetPatternPieceData(); - doc->SetAttribute(domData, VAbstractPattern::AttrLetter, data.GetLetter()); - doc->SetAttribute(domData, VAbstractPattern::AttrVisible, data.IsVisible() == true? trueStr : falseStr); - doc->SetAttribute(domData, AttrMx, data.GetPos().x()); - doc->SetAttribute(domData, AttrMy, data.GetPos().y()); - doc->SetAttribute(domData, AttrWidth, data.GetLabelWidth()); - doc->SetAttribute(domData, AttrHeight, data.GetLabelHeight()); - doc->SetAttribute(domData, AttrFont, data.GetFontSize()); - doc->SetAttribute(domData, AttrRotation, data.GetRotation()); - - for (int i = 0; i < data.GetMCPCount(); ++i) - { - MaterialCutPlacement mcp = data.GetMCP(i); - QDomElement domMCP = doc->createElement(VAbstractPattern::TagMCP); - doc->SetAttribute(domMCP, VAbstractPattern::AttrMaterial, int(mcp.m_eMaterial)); - if (mcp.m_eMaterial == MaterialType::mtUserDefined) - { - doc->SetAttribute(domMCP, VAbstractPattern::AttrUserDefined, mcp.m_qsMaterialUserDef); - } - doc->SetAttribute(domMCP, VAbstractPattern::AttrCutNumber, mcp.m_iCutNumber); - doc->SetAttribute(domMCP, VAbstractPattern::AttrPlacement, int(mcp.m_ePlacement)); - domData.appendChild(domMCP); - } - domElement.appendChild(domData); - - // pattern info - domData = doc->createElement(VAbstractPattern::TagPatternInfo); - const VPatternInfoGeometry& geom = detail.GetPatternInfo(); - doc->SetAttribute(domData, VAbstractPattern::AttrVisible, geom.IsVisible() == true? trueStr : falseStr); - doc->SetAttribute(domData, AttrMx, geom.GetPos().x()); - doc->SetAttribute(domData, AttrMy, geom.GetPos().y()); - doc->SetAttribute(domData, AttrWidth, geom.GetLabelWidth()); - doc->SetAttribute(domData, AttrHeight, geom.GetLabelHeight()); - doc->SetAttribute(domData, AttrFont, geom.GetFontSize()); - doc->SetAttribute(domData, AttrRotation, geom.GetRotation()); - domElement.appendChild(domData); - - // grainline - domData = doc->createElement(VAbstractPattern::TagGrainline); - const VGrainlineGeometry& glGeom = detail.GetGrainlineGeometry(); - doc->SetAttribute(domData, VAbstractPattern::AttrVisible, glGeom.IsVisible() == true? trueStr : falseStr); - doc->SetAttribute(domData, AttrMx, glGeom.GetPos().x()); - doc->SetAttribute(domData, AttrMy, glGeom.GetPos().y()); - doc->SetAttribute(domData, AttrLength, glGeom.GetLength()); - doc->SetAttribute(domData, AttrRotation, glGeom.GetRotation()); - doc->SetAttribute(domData, VAbstractPattern::AttrArrows, int(glGeom.GetArrowType())); - qDebug() << "XML ROTATION" << glGeom.GetRotation(); - - // nodes - for (int i = 0; i < detail.CountNode(); ++i) - { - AddNode(doc, domElement, detail.at(i)); - } - - AddDet *addDet = new AddDet(domElement, doc, detail, drawName); - connect(addDet, &AddDet::NeedFullParsing, doc, &VAbstractPattern::NeedFullParsing); - qApp->getUndoStack()->push(addDet); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them. - */ -void VToolDetail::RefreshDataInFile() -{ - QDomElement domElement = doc->elementById(id); - if (domElement.isElement()) - { - VDetail det = VAbstractTool::data.GetDetail(id); - doc->SetAttribute(domElement, AttrName, det.getName()); - doc->SetAttribute(domElement, AttrSupplement, QString().setNum(static_cast(det.getSeamAllowance()))); - doc->SetAttribute(domElement, AttrClosed, QString().setNum(static_cast(det.getClosed()))); - doc->SetAttribute(domElement, AttrWidth, QString().setNum(det.getWidth())); - doc->RemoveAllChildren(domElement); - - // detail data - QDomElement domData = doc->createElement(VAbstractPattern::TagData); - const VPatternPieceData& data = det.GetPatternPieceData(); - doc->SetAttribute(domData, VAbstractPattern::AttrLetter, data.GetLetter()); - doc->SetAttribute(domData, VAbstractPattern::AttrVisible, data.IsVisible() == true? trueStr : falseStr); - doc->SetAttribute(domData, AttrMx, data.GetPos().x()); - doc->SetAttribute(domData, AttrMy, data.GetPos().y()); - doc->SetAttribute(domData, AttrWidth, data.GetLabelWidth()); - doc->SetAttribute(domData, AttrHeight, data.GetLabelHeight()); - doc->SetAttribute(domData, AttrFont, data.GetFontSize()); - doc->SetAttribute(domData, AttrRotation, data.GetRotation()); - - for (int i = 0; i < data.GetMCPCount(); ++i) - { - MaterialCutPlacement mcp = data.GetMCP(i); - QDomElement domMCP = doc->createElement(VAbstractPattern::TagMCP); - doc->SetAttribute(domMCP, VAbstractPattern::AttrMaterial, int(mcp.m_eMaterial)); - if (mcp.m_eMaterial == MaterialType::mtUserDefined) - { - doc->SetAttribute(domMCP, VAbstractPattern::AttrUserDefined, mcp.m_qsMaterialUserDef); - } - else - { - domMCP.removeAttribute(VAbstractPattern::AttrUserDefined); - } - doc->SetAttribute(domMCP, VAbstractPattern::AttrCutNumber, mcp.m_iCutNumber); - doc->SetAttribute(domMCP, VAbstractPattern::AttrPlacement, int(mcp.m_ePlacement)); - domData.appendChild(domMCP); - } - domElement.appendChild(domData); - - // pattern info - domData = doc->createElement(VAbstractPattern::TagPatternInfo); - const VPatternInfoGeometry& geom = det.GetPatternInfo(); - doc->SetAttribute(domData, VAbstractPattern::AttrVisible, geom.IsVisible() == true? trueStr : falseStr); - doc->SetAttribute(domData, AttrMx, geom.GetPos().x()); - doc->SetAttribute(domData, AttrMy, geom.GetPos().y()); - doc->SetAttribute(domData, AttrWidth, geom.GetLabelWidth()); - doc->SetAttribute(domData, AttrHeight, geom.GetLabelHeight()); - doc->SetAttribute(domData, AttrFont, geom.GetFontSize()); - doc->SetAttribute(domData, AttrRotation, geom.GetRotation()); - - // grainline - domData = doc->createElement(VAbstractPattern::TagGrainline); - const VGrainlineGeometry& glGeom = det.GetGrainlineGeometry(); - doc->SetAttribute(domData, VAbstractPattern::AttrVisible, glGeom.IsVisible() == true? trueStr : falseStr); - doc->SetAttribute(domData, AttrMx, glGeom.GetPos().x()); - doc->SetAttribute(domData, AttrMy, glGeom.GetPos().y()); - doc->SetAttribute(domData, AttrLength, glGeom.GetLength()); - doc->SetAttribute(domData, AttrRotation, glGeom.GetRotation()); - doc->SetAttribute(domData, VAbstractPattern::AttrArrows, int(glGeom.GetArrowType())); - - // nodes - for (int i = 0; i < det.CountNode(); ++i) - { - AddNode(doc, domElement, det.at(i)); - } - } -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief itemChange handle detail change. - * @param change change - * @param value value - * @return new value. - */ -QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) -{ - if (change == ItemPositionChange && scene()) - { - // Each time we move something we call recalculation scene rect. In some cases this can cause moving - // objects positions. And this cause infinite redrawing. That's why we wait the finish of saving the last move. - static bool changeFinished = true; - if (changeFinished) - { - changeFinished = false; - - // value - this is new position. - const QPointF newPos = value.toPointF(); - - MovePiece *moveDet = new MovePiece(doc, newPos.x(), newPos.y(), id, scene()); - connect(moveDet, &MovePiece::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); - qApp->getUndoStack()->push(moveDet); - - const QList viewList = scene()->views(); - if (not viewList.isEmpty()) - { - if (QGraphicsView *view = viewList.at(0)) - { - const int xmargin = 50; - const int ymargin = 50; - - const QRectF viewRect = VMainGraphicsView::SceneVisibleArea(view); - const QRectF itemRect = mapToScene(boundingRect()|childrenBoundingRect()).boundingRect(); - - // If item's rect is bigger than view's rect ensureVisible works very unstable. - if (itemRect.height() + 2*ymargin < viewRect.height() && - itemRect.width() + 2*xmargin < viewRect.width()) - { - view->ensureVisible(itemRect, xmargin, ymargin); - } - else - { - // Ensure visible only small rect around a cursor - VMainGraphicsScene *currentScene = qobject_cast(scene()); - SCASSERT(currentScene) - const QPointF cursorPosition = currentScene->getScenePos(); - view->ensureVisible(QRectF(cursorPosition.x()-5, cursorPosition.y()-5, 10, 10)); - } - } - } - // Don't forget to update geometry, because first change never call full parse - RefreshGeometry(); - changeFinished = true; - } - } - - if (change == QGraphicsItem::ItemSelectedChange) - { - if (value == true) - { - // do stuff if selected - this->setFocus(); - } - else - { - // do stuff if not selected - } - } - - return VNoBrushScalePathItem::itemChange(change, value); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief keyReleaseEvent handle key release events. - * @param event key release event. - */ -void VToolDetail::keyReleaseEvent(QKeyEvent *event) -{ - switch (event->key()) - { - case Qt::Key_Delete: - try - { - DeleteTool(); - } - catch(const VExceptionToolWasDeleted &e) - { - Q_UNUSED(e) - return;//Leave this method immediately!!! - } - break; - default: - break; - } - VNoBrushScalePathItem::keyReleaseEvent ( event ); -} - -//--------------------------------------------------------------------------------------------------------------------- -void VToolDetail::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - // Special for not selectable item first need to call standard mousePressEvent then accept event - VNoBrushScalePathItem::mousePressEvent(event); - - // Somehow clicking on notselectable object do not clean previous selections. - if (not (flags() & ItemIsSelectable) && scene()) - { - scene()->clearSelection(); - } - - if (flags() & QGraphicsItem::ItemIsMovable) - { - if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick) - { - SetOverrideCursor(cursorArrowCloseHand, 1, 1); - } - } - - if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick) - { - doc->SelectedDetail(id); - emit ChoosedTool(id, SceneObject::Detail); - } - - event->accept();// Special for not selectable item first need to call standard mousePressEvent then accept event -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief mouseReleaseEvent handle mouse release events. - * @param event mouse release event. - */ -void VToolDetail::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) -{ - if (event->button() == Qt::LeftButton) - { - //Disable cursor-arrow-closehand - RestoreOverrideCursor(cursorArrowCloseHand); - } - VNoBrushScalePathItem::mouseReleaseEvent(event); -} - -//--------------------------------------------------------------------------------------------------------------------- -void VToolDetail::hoverMoveEvent(QGraphicsSceneHoverEvent *event) -{ - Q_UNUSED(event) - if (flags() & QGraphicsItem::ItemIsMovable) - { - SetOverrideCursor(cursorArrowOpenHand, 1, 1); - } -} - -//--------------------------------------------------------------------------------------------------------------------- -void VToolDetail::hoverEnterEvent(QGraphicsSceneHoverEvent *event) -{ - Q_UNUSED(event) - if (flags() & QGraphicsItem::ItemIsMovable) - { - SetOverrideCursor(cursorArrowOpenHand, 1, 1); - } -} - -//--------------------------------------------------------------------------------------------------------------------- -void VToolDetail::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) -{ - Q_UNUSED(event) - //Disable cursor-arrow-openhand - if (flags() & QGraphicsItem::ItemIsMovable) - { - RestoreOverrideCursor(cursorArrowOpenHand); - } -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief contextMenuEvent handle context menu events. - * @param event context menu event. - */ -void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - QMenu menu; - QAction *actionOption = menu.addAction(QIcon::fromTheme("preferences-other"), tr("Options")); - - QAction *inLayoutOption = menu.addAction(tr("In layout")); - inLayoutOption->setCheckable(true); - const VDetail detail = VAbstractTool::data.GetDetail(id); - inLayoutOption->setChecked(detail.IsInLayout()); - - QAction *actionRemove = menu.addAction(QIcon::fromTheme("edit-delete"), tr("Delete")); - _referens > 1 ? actionRemove->setEnabled(false) : actionRemove->setEnabled(true); - - QAction *selectedAction = menu.exec(event->screenPos()); - if (selectedAction == actionOption) - { -// dialog = new DialogDetail(getData(), id, qApp->getMainWindow()); -// dialog->setModal(true); -// connect(qobject_cast< VMainGraphicsScene * >(this->scene()), &VMainGraphicsScene::ChoosedObject, -// dialog, &DialogTool::ChosenObject); -// connect(dialog, &DialogTool::DialogClosed, this, &VToolDetail::FullUpdateFromGuiOk); -// setDialog(); -// dialog->show(); - } - else if (selectedAction == inLayoutOption) - { - TogglePieceInLayout *togglePrint = new TogglePieceInLayout(id, selectedAction->isChecked(), - &(VAbstractTool::data), doc); - connect(togglePrint, &TogglePieceInLayout::UpdateList, doc, &VAbstractPattern::CheckInLayoutList); - qApp->getUndoStack()->push(togglePrint); - } - else if (selectedAction == actionRemove) - { - try - { - DeleteTool(); - } - catch(const VExceptionToolWasDeleted &e) - { - Q_UNUSED(e) - return;//Leave this method immediately!!! - } - return; //Leave this method immediately after call!!! - } -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief UpdateLabel updates the text label, making it just big enough for the text to fit it - */ -void VToolDetail::UpdateLabel() -{ - const VDetail detail = VAbstractTool::data.GetDetail(id); - const VPatternPieceData& data = detail.GetPatternPieceData(); - - if (data.IsVisible() == true) - { - QFont fnt = qApp->font(); - { - const int iFS = data.GetFontSize(); - iFS < MIN_FONT_SIZE ? fnt.setPixelSize(MIN_FONT_SIZE) : fnt.setPixelSize(iFS); - } - dataLabel->SetFont(fnt); - dataLabel->SetSize(data.GetLabelWidth(), data.GetLabelHeight()); - dataLabel->UpdateData(detail.getName(), data); - QPointF pt = data.GetPos(); - QRectF rectBB; - rectBB.setTopLeft(pt); - rectBB.setWidth(dataLabel->boundingRect().width()); - rectBB.setHeight(dataLabel->boundingRect().height()); - qreal dX; - qreal dY; - if (dataLabel->IsContained(rectBB, data.GetRotation(), dX, dY) == false) - { - pt.setX(pt.x() + dX); - pt.setY(pt.y() + dY); - } - - dataLabel->setPos(pt); - dataLabel->setRotation(data.GetRotation()); - dataLabel->Update(); - dataLabel->show(); - } - else - { - dataLabel->hide(); - } -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief UpdatePatternInfo updates the pattern info label - */ -void VToolDetail::UpdatePatternInfo() -{ - const VDetail detail = VAbstractTool::data.GetDetail(id); - const VPatternInfoGeometry& geom = detail.GetPatternInfo(); - - if (geom.IsVisible() == true) - { - QFont fnt = qApp->font(); - int iFS = geom.GetFontSize(); - if (iFS < MIN_FONT_SIZE) - { - iFS = MIN_FONT_SIZE; - } - fnt.setPixelSize(iFS); - patternInfo->SetFont(fnt); - patternInfo->SetSize(geom.GetLabelWidth(), geom.GetLabelHeight()); - patternInfo->UpdateData(doc, getData()->size(), getData()->height()); - - QPointF pt = geom.GetPos(); - QRectF rectBB; - rectBB.setTopLeft(pt); - rectBB.setWidth(patternInfo->boundingRect().width()); - rectBB.setHeight(patternInfo->boundingRect().height()); - qreal dX; - qreal dY; - if (patternInfo->IsContained(rectBB, geom.GetRotation(), dX, dY) == false) - { - pt.setX(pt.x() + dX); - pt.setY(pt.y() + dY); - } - - patternInfo->setPos(pt); - patternInfo->setRotation(geom.GetRotation()); - patternInfo->Update(); - if (patternInfo->GetTextLines() > 0) - { - patternInfo->show(); - } - else - { - patternInfo->hide(); - } - } - else - { - patternInfo->hide(); - } -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief VToolDetail::UpdateGrainline updates the grain line item - */ -void VToolDetail::UpdateGrainline() -{ - const VDetail detail = VAbstractTool::data.GetDetail(id); - const VGrainlineGeometry& geom = detail.GetGrainlineGeometry(); - - if (geom.IsVisible() == true) - { - qreal dRotation; - qreal dLength; - try - { - QString qsFormula; - qsFormula = geom.GetRotation().replace("\n", " "); - qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator()); - - Calculator cal1; - dRotation = cal1.EvalFormula(VDataTool::data.PlainVariables(), qsFormula); - - qsFormula = geom.GetLength().replace("\n", " "); - qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator()); - Calculator cal2; - dLength = cal2.EvalFormula(VDataTool::data.PlainVariables(), qsFormula); - } - catch(...) - { - grainLine->hide(); - return; - } - - grainLine->UpdateGeometry(geom.GetPos(), dRotation, ToPixel(dLength, *VDataTool::data.GetPatternUnit()), - geom.GetArrowType()); - grainLine->show(); - } - else - { - grainLine->hide(); - } -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief SaveMoveDetail saves the move detail operation to the undo stack - */ -void VToolDetail::SaveMoveDetail(const QPointF& ptPos) -{ - VDetail oldDet = VAbstractTool::data.GetDetail(id); - VDetail newDet = oldDet; - newDet.GetPatternPieceData().SetPos(ptPos); - newDet.GetPatternPieceData().SetLabelWidth(dataLabel->boundingRect().width()); - newDet.GetPatternPieceData().SetLabelHeight(dataLabel->boundingRect().height()); - newDet.GetPatternPieceData().SetFontSize(dataLabel->GetFontSize()); - newDet.GetPatternPieceData().SetRotation(dataLabel->rotation()); - - SaveDetailOptions* moveCommand = new SaveDetailOptions(oldDet, newDet, doc, id, this->scene()); - moveCommand->setText(tr("move pattern piece label")); - connect(moveCommand, &SaveDetailOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); - qApp->getUndoStack()->push(moveCommand); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief SaveResizeDetail saves the resize detail label operation to the undo stack - */ -void VToolDetail::SaveResizeDetail(qreal dLabelW, int iFontSize) -{ - VDetail oldDet = VAbstractTool::data.GetDetail(id); - VDetail newDet = oldDet; - newDet.GetPatternPieceData().SetLabelWidth(dLabelW); - newDet.GetPatternPieceData().SetLabelHeight(dataLabel->boundingRect().height()); - newDet.GetPatternPieceData().SetFontSize(iFontSize); - newDet.GetPatternPieceData().SetRotation(dataLabel->rotation()); - SaveDetailOptions* resizeCommand = new SaveDetailOptions(oldDet, newDet, doc, id, this->scene()); - resizeCommand->setText(tr("resize pattern piece label")); - connect(resizeCommand, &SaveDetailOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); - qApp->getUndoStack()->push(resizeCommand); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief SaveRotationDetail saves the rotation detail label operation to the undo stack - */ -void VToolDetail::SaveRotationDetail(qreal dRot) -{ - VDetail oldDet = VAbstractTool::data.GetDetail(id); - VDetail newDet = oldDet; - newDet.GetPatternPieceData().SetPos(dataLabel->pos()); - newDet.GetPatternPieceData().SetLabelWidth(dataLabel->boundingRect().width()); - newDet.GetPatternPieceData().SetLabelHeight(dataLabel->boundingRect().height()); - newDet.GetPatternPieceData().SetFontSize(dataLabel->GetFontSize()); - newDet.GetPatternPieceData().SetRotation(dRot); - - SaveDetailOptions* rotateCommand = new SaveDetailOptions(oldDet, newDet, doc, id, this->scene()); - rotateCommand->setText(tr("rotate pattern piece label")); - connect(rotateCommand, &SaveDetailOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); - qApp->getUndoStack()->push(rotateCommand); -} - - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief SaveMovePattern saves the pattern label position - */ -void VToolDetail::SaveMovePattern(const QPointF &ptPos) -{ - VDetail oldDet = VAbstractTool::data.GetDetail(id); - VDetail newDet = oldDet; - newDet.GetPatternInfo().SetPos(ptPos); - newDet.GetPatternInfo().SetLabelWidth(patternInfo->boundingRect().width()); - newDet.GetPatternInfo().SetLabelHeight(patternInfo->boundingRect().height()); - newDet.GetPatternInfo().SetFontSize(patternInfo->GetFontSize()); - newDet.GetPatternInfo().SetRotation(patternInfo->rotation()); - - SaveDetailOptions* moveCommand = new SaveDetailOptions(oldDet, newDet, doc, id, this->scene()); - moveCommand->setText(tr("move pattern info label")); - connect(moveCommand, &SaveDetailOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); - qApp->getUndoStack()->push(moveCommand); - -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief: SaveResizePattern saves the pattern label width and font size - */ -void VToolDetail::SaveResizePattern(qreal dLabelW, int iFontSize) -{ - VDetail oldDet = VAbstractTool::data.GetDetail(id); - VDetail newDet = oldDet; - newDet.GetPatternInfo().SetLabelWidth(dLabelW); - newDet.GetPatternInfo().SetLabelHeight(patternInfo->boundingRect().height()); - newDet.GetPatternInfo().SetFontSize(iFontSize); - newDet.GetPatternInfo().SetRotation(patternInfo->rotation()); - SaveDetailOptions* resizeCommand = new SaveDetailOptions(oldDet, newDet, doc, id, this->scene()); - resizeCommand->setText(tr("resize pattern info label")); - connect(resizeCommand, &SaveDetailOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); - qApp->getUndoStack()->push(resizeCommand); -} - -//--------------------------------------------------------------------------------------------------------------------- -void VToolDetail::SaveRotationPattern(qreal dRot) -{ - VDetail oldDet = VAbstractTool::data.GetDetail(id); - VDetail newDet = oldDet; - newDet.GetPatternInfo().SetPos(patternInfo->pos()); - newDet.GetPatternInfo().SetLabelWidth(patternInfo->boundingRect().width()); - newDet.GetPatternInfo().SetLabelHeight(patternInfo->boundingRect().height()); - newDet.GetPatternInfo().SetFontSize(patternInfo->GetFontSize()); - newDet.GetPatternInfo().SetRotation(dRot); - - SaveDetailOptions* rotateCommand = new SaveDetailOptions(oldDet, newDet, doc, id, this->scene()); - rotateCommand->setText(tr("rotate pattern info label")); - connect(rotateCommand, &SaveDetailOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); - qApp->getUndoStack()->push(rotateCommand); -} - - -//--------------------------------------------------------------------------------------------------------------------- -void VToolDetail::SaveMoveGrainline(const QPointF& ptPos) -{ - VDetail oldDet = VAbstractTool::data.GetDetail(id); - VDetail newDet = oldDet; - newDet.GetGrainlineGeometry().SetPos(ptPos); - qDebug() << "******* new grainline pos" << ptPos; - - SaveDetailOptions* moveCommand = new SaveDetailOptions(oldDet, newDet, doc, id, this->scene()); - moveCommand->setText(tr("move grainline")); - connect(moveCommand, &SaveDetailOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); - qApp->getUndoStack()->push(moveCommand); -} - -//--------------------------------------------------------------------------------------------------------------------- -void VToolDetail::SaveResizeGrainline(qreal dLength) -{ - VDetail oldDet = VAbstractTool::data.GetDetail(id); - VDetail newDet = oldDet; - - dLength = FromPixel(dLength, *VDataTool::data.GetPatternUnit()); - newDet.GetGrainlineGeometry().SetLength(qApp->LocaleToString(dLength)); - SaveDetailOptions* resizeCommand = new SaveDetailOptions(oldDet, newDet, doc, id, this->scene()); - resizeCommand->setText(tr("resize grainline")); - connect(resizeCommand, &SaveDetailOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); - qApp->getUndoStack()->push(resizeCommand); -} - -//--------------------------------------------------------------------------------------------------------------------- -void VToolDetail::SaveRotateGrainline(qreal dRot, const QPointF& ptPos) -{ - VDetail oldDet = VAbstractTool::data.GetDetail(id); - VDetail newDet = oldDet; - - dRot = qRadiansToDegrees(dRot); - newDet.GetGrainlineGeometry().SetRotation(qApp->LocaleToString(dRot)); - newDet.GetGrainlineGeometry().SetPos(ptPos); - SaveDetailOptions* rotateCommand = new SaveDetailOptions(oldDet, newDet, doc, id, this->scene()); - rotateCommand->setText(tr("rotate grainline")); - connect(rotateCommand, &SaveDetailOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); - qApp->getUndoStack()->push(rotateCommand); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief AddNode add node to the file. - * @param domElement tag in xml tree. - * @param node node of detail. - */ -void VToolDetail::AddNode(VAbstractPattern *doc, QDomElement &domElement, const VNodeDetail &node) -{ - QDomElement nod = doc->createElement(TagNode); - - doc->SetAttribute(nod, AttrIdObject, node.getId()); - doc->SetAttribute(nod, AttrMx, qApp->fromPixel(node.getMx())); - doc->SetAttribute(nod, AttrMy, qApp->fromPixel(node.getMy())); - - if (node.getTypeTool() != Tool::NodePoint) - { - doc->SetAttribute(nod, AttrReverse, static_cast(node.getReverse())); - } - - if (node.getTypeNode() == NodeDetail::Contour) - { - doc->SetAttribute(nod, AttrNodeType, NodeTypeContour); - } - else - { - doc->SetAttribute(nod, AttrNodeType, NodeTypeModeling); - } - switch (node.getTypeTool()) - { - case (Tool::NodeArc): - doc->SetAttribute(nod, AttrType, NodeArc); - break; - case (Tool::NodeElArc): - doc->SetAttribute(nod, AttrType, NodeElArc); - break; - case (Tool::NodePoint): - doc->SetAttribute(nod, AttrType, NodePoint); - break; - case (Tool::NodeSpline): - doc->SetAttribute(nod, AttrType, NodeSpline); - break; - case (Tool::NodeSplinePath): - doc->SetAttribute(nod, AttrType, NodeSplinePath); - break; - default: - qDebug()<<"May be wrong tool type!!! Ignoring."<setFlag(QGraphicsItem::ItemSendsGeometryChanges, false); - - const VDetail detail = VAbstractTool::data.GetDetail(id); - QPainterPath mainPath = detail.ContourPath(this->getData()); - this->setPath(mainPath); - this->setPos(detail.getMx(), detail.getMy()); - - if (detail.getSeamAllowance()) - { - mainPath.addPath(detail.SeamAllowancePath(this->getData())); - mainPath.setFillRule(Qt::OddEvenFill); - seamAllowance->setPath(mainPath); - } - else - { - seamAllowance->setPath(QPainterPath()); - } - - this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); -} - -//--------------------------------------------------------------------------------------------------------------------- -void VToolDetail::DeleteTool(bool ask) -{ - QScopedPointer delDet(new DeleteDetail(doc, id, VAbstractTool::data.GetDetail(id))); - if (ask) - { - if (ConfirmDeletion() == QMessageBox::No) - { - return; - } - /* If UnionDetails tool delete detail no need emit FullParsing.*/ - connect(delDet.data(), &DeleteDetail::NeedFullParsing, doc, &VAbstractPattern::NeedFullParsing); - } - qApp->getUndoStack()->push(delDet.take()); - - // Throw exception, this will help prevent case when we forget to immediately quit function. - VExceptionToolWasDeleted e("Tool was used after deleting."); - throw e; -} - -//--------------------------------------------------------------------------------------------------------------------- -template -//cppcheck-suppress unusedFunction -Tool* VToolDetail::InitTool(VMainGraphicsScene *scene, const VNodeDetail &node) -{ - Tool *tool = qobject_cast(doc->getTool(node.getId())); - SCASSERT(tool != nullptr) - connect(tool, &Tool::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - tool->setParentItem(this); - tool->SetParentType(ParentType::Item); - doc->IncrementReferens(node.getId()); - return tool; -} - -//--------------------------------------------------------------------------------------------------------------------- -void VToolDetail::EnableToolMove(bool move) -{ - setFlag(QGraphicsItem::ItemIsMovable, move); -} - -//--------------------------------------------------------------------------------------------------------------------- -void VToolDetail::AllowHover(bool enabled) -{ - setAcceptHoverEvents(enabled); -} - -//--------------------------------------------------------------------------------------------------------------------- -void VToolDetail::AllowSelecting(bool enabled) -{ - setFlag(QGraphicsItem::ItemIsSelectable, enabled); -} - -//--------------------------------------------------------------------------------------------------------------------- -void VToolDetail::ResetChildren(QGraphicsItem *pItem) -{ - const VDetail detail = VAbstractTool::data.GetDetail(id); - VTextGraphicsItem* pVGI = dynamic_cast(pItem); - if (pVGI != dataLabel) - { - if (detail.GetPatternPieceData().IsVisible()) - { - dataLabel->Reset(); - } - } - if (pVGI != patternInfo) - { - if (detail.GetPatternInfo().IsVisible()) - { - patternInfo->Reset(); - } - } - VGrainlineItem* pGLI = dynamic_cast(pItem); - if (pGLI != grainLine) - { - if (detail.GetGrainlineGeometry().IsVisible()) - { - grainLine->Reset(); - } - } -} - -//--------------------------------------------------------------------------------------------------------------------- -void VToolDetail::UpdateAll() -{ - sceneDetails->update(); - update(); -} - -//--------------------------------------------------------------------------------------------------------------------- -void VToolDetail::retranslateUi() -{ - UpdateLabel(); - UpdatePatternInfo(); -} - -//--------------------------------------------------------------------------------------------------------------------- -void VToolDetail::Highlight(quint32 id) -{ - setSelected(this->id == id); -} diff --git a/src/libs/vtools/tools/vtooldetail.h b/src/libs/vtools/tools/vtooldetail.h deleted file mode 100644 index d46b144e6..000000000 --- a/src/libs/vtools/tools/vtooldetail.h +++ /dev/null @@ -1,164 +0,0 @@ -/************************************************************************ - ** - ** @file vtooldetail.h - ** @author Roman Telezhynskyi - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013-2015 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#ifndef VTOOLDETAIL_H -#define VTOOLDETAIL_H - -#include -#include -#include - -#include "../vwidgets/vnobrushscalepathitem.h" -#include "vabstracttool.h" -#include "vtextgraphicsitem.h" -#include "vgrainlineitem.h" - -class VMainGraphicsScene; -class DialogTool; - -/** - * @brief The VToolDetail class for working with detail. - */ -class VToolDetail: public VAbstractTool, public VNoBrushScalePathItem -{ - Q_OBJECT -public: - ~VToolDetail(); - - virtual void setDialog(); - template - /** - * @brief CreateNode create new node for detail. - * @param data container. - * @param id id parent object. - * @return id for new object. - */ - static quint32 CreateNode(VContainer *data, const quint32 &id) - { - //We can't use exist object. Need create new. - T *node = new T(*data->GeometricObject(id).data()); - node->setMode(Draw::Modeling); - return data->AddGObject(node); - } - - static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); - static void Create(const quint32 &_id, const VDetail &newDetail, VMainGraphicsScene *scene, - VAbstractPattern *doc, VContainer *data, const Document &parse, - const Source &typeCreation, const QString &drawName = QString()); - static const QString TagNode; - static const QString AttrSupplement; - static const QString AttrClosed; - static const QString AttrForbidFlipping; - static const QString AttrWidth; - static const QString AttrHeight; - static const QString AttrNodeType; - static const QString AttrReverse; - static const QString AttrFont; - static const QString AttrRotation; - static const QString NodeTypeContour; - static const QString NodeTypeModeling; - static const QString NodeArc; - static const QString NodeElArc; - static const QString NodePoint; - static const QString NodeSpline; - static const QString NodeSplinePath; - void Remove(bool ask); - static void AddNode(VAbstractPattern *doc, QDomElement &domElement, const VNodeDetail &node); - virtual int type() const Q_DECL_OVERRIDE {return Type;} - enum { Type = UserType + static_cast(Tool::Detail)}; - virtual QString getTagName() const Q_DECL_OVERRIDE; - virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; - virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE; -public slots: - virtual void FullUpdateFromFile () Q_DECL_OVERRIDE; - virtual void FullUpdateFromGuiOk(int result); - void EnableToolMove(bool move); - virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE; - virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE; - virtual void ResetChildren(QGraphicsItem* pItem); - virtual void UpdateAll(); - virtual void retranslateUi(); - void Highlight(quint32 id); -protected: - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget) Q_DECL_OVERRIDE; - virtual void AddToFile () Q_DECL_OVERRIDE; - virtual void RefreshDataInFile() Q_DECL_OVERRIDE; - virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ) Q_DECL_OVERRIDE; - virtual void mousePressEvent( QGraphicsSceneMouseEvent * event) Q_DECL_OVERRIDE; - virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE; - virtual void hoverMoveEvent( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE; - virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE; - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE; - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; - virtual void keyReleaseEvent(QKeyEvent * event) Q_DECL_OVERRIDE; - virtual void SetVisualization() Q_DECL_OVERRIDE {} - -protected slots: - virtual void UpdateLabel(); - virtual void UpdatePatternInfo(); - virtual void UpdateGrainline(); - virtual void SaveMoveDetail(const QPointF &ptPos); - virtual void SaveResizeDetail(qreal dLabelW, int iFontSize); - virtual void SaveRotationDetail(qreal dRot); - virtual void SaveMovePattern(const QPointF& ptPos); - virtual void SaveResizePattern(qreal dLabelW, int iFontSize); - virtual void SaveRotationPattern(qreal dRot); - virtual void SaveMoveGrainline(const QPointF& ptPos); - virtual void SaveResizeGrainline(qreal dLength); - virtual void SaveRotateGrainline(qreal dRot, const QPointF& ptPos); - -private: - Q_DISABLE_COPY(VToolDetail) - /** @brief dialog dialog options. */ - DialogTool *dialog; - - /** @brief sceneDetails pointer to the scene. */ - VMainGraphicsScene *sceneDetails; - QString drawName; - - VNoBrushScalePathItem *seamAllowance; - VTextGraphicsItem *dataLabel; - VTextGraphicsItem *patternInfo; - VGrainlineItem *grainLine; - - VToolDetail(VAbstractPattern *doc, VContainer *data, const quint32 &id, const Source &typeCreation, - VMainGraphicsScene *scene, const QString &drawName, QGraphicsItem * parent = nullptr); - - void RefreshGeometry (); - template - /** - * @brief InitTool initial node item on scene - * @param scene pointer to scene. - * @param node node of detail. - */ - Tool* InitTool(VMainGraphicsScene *scene, const VNodeDetail &node); - virtual void DeleteTool(bool ask = true) Q_DECL_OVERRIDE; -}; - -#endif // VTOOLDETAIL_H diff --git a/src/libs/vtools/undocommands/adddet.cpp b/src/libs/vtools/undocommands/adddet.cpp deleted file mode 100644 index c2b9d4efe..000000000 --- a/src/libs/vtools/undocommands/adddet.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/************************************************************************ - ** - ** @file adddet.cpp - ** @author Roman Telezhynskyi - ** @date 15 6, 2014 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013-2015 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#include "adddet.h" - -#include -#include - -#include "../ifc/xml/vabstractpattern.h" -#include "../vmisc/logging.h" -#include "vundocommand.h" - -class QDomElement; -class QUndoCommand; - -//--------------------------------------------------------------------------------------------------------------------- -AddDet::AddDet(const QDomElement &xml, VAbstractPattern *doc, const VDetail &detail, const QString &drawName, - QUndoCommand *parent) - : VUndoCommand(xml, doc, parent), detail(detail), drawName(drawName) -{ - setText(tr("add detail")); - nodeId = doc->GetParametrId(xml); -} - -//--------------------------------------------------------------------------------------------------------------------- -AddDet::~AddDet() -{} - -//--------------------------------------------------------------------------------------------------------------------- -// cppcheck-suppress unusedFunction -void AddDet::undo() -{ - qCDebug(vUndo, "Undo."); - - QDomElement details = GetDetailsSection(); - if (not details.isNull()) - { - QDomElement domElement = doc->elementById(nodeId); - if (domElement.isElement()) - { - if (details.removeChild(domElement).isNull()) - { - qCDebug(vUndo, "Can't delete node"); - return; - } - - DecrementReferences(detail.getNodes()); - } - else - { - qCDebug(vUndo, "Can't get node by id = %u.", nodeId); - return; - } - } - else - { - qCDebug(vUndo, "Can't find tag %s.", qUtf8Printable(VAbstractPattern::TagDetails)); - return; - } - emit NeedFullParsing(); -} - -//--------------------------------------------------------------------------------------------------------------------- -// cppcheck-suppress unusedFunction -void AddDet::redo() -{ - qCDebug(vUndo, "Redo."); - - QDomElement details = GetDetailsSection(); - if (not details.isNull()) - { - details.appendChild(xml); - } - else - { - qCDebug(vUndo, "Can't find tag %s.", qUtf8Printable(VAbstractPattern::TagDetails)); - return; - } - RedoFullParsing(); -} - -//--------------------------------------------------------------------------------------------------------------------- -QDomElement AddDet::GetDetailsSection() const -{ - QDomElement details; - if (drawName.isEmpty()) - { - doc->GetActivNodeElement(VAbstractPattern::TagDetails, details); - } - else - { - details = doc->GetDraw(drawName).firstChildElement(VAbstractPattern::TagDetails); - } - return details; -} diff --git a/src/libs/vtools/undocommands/adddet.h b/src/libs/vtools/undocommands/adddet.h deleted file mode 100644 index a6583cf6e..000000000 --- a/src/libs/vtools/undocommands/adddet.h +++ /dev/null @@ -1,66 +0,0 @@ -/************************************************************************ - ** - ** @file adddet.h - ** @author Roman Telezhynskyi - ** @date 15 6, 2014 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013-2015 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#ifndef ADDDET_H -#define ADDDET_H - -#include -#include -#include -#include -#include -#include - -#include "../tools/vtooldetail.h" -#include "vdetail.h" -#include "vundocommand.h" - -class QDomElement; -class QUndoCommand; -class VAbstractPattern; - -class AddDet : public VUndoCommand -{ - Q_OBJECT -public: - AddDet(const QDomElement &xml, VAbstractPattern *doc, const VDetail &detail, const QString &drawName = QString(), - QUndoCommand *parent = 0); - virtual ~AddDet() Q_DECL_OVERRIDE; - // cppcheck-suppress unusedFunction - virtual void undo() Q_DECL_OVERRIDE; - // cppcheck-suppress unusedFunction - virtual void redo() Q_DECL_OVERRIDE; -private: - Q_DISABLE_COPY(AddDet) - VDetail detail; - QString drawName; - - QDomElement GetDetailsSection() const; -}; - -#endif // ADDDET_H diff --git a/src/libs/vtools/undocommands/deletedetail.cpp b/src/libs/vtools/undocommands/deletedetail.cpp deleted file mode 100644 index b663df944..000000000 --- a/src/libs/vtools/undocommands/deletedetail.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/************************************************************************ - ** - ** @file deletedetail.cpp - ** @author Roman Telezhynskyi - ** @date 16 6, 2014 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013-2015 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#include "deletedetail.h" - -#include -#include - -#include "../tools/vtooldetail.h" -#include "../ifc/ifcdef.h" -#include "../ifc/xml/vabstractpattern.h" -#include "../ifc/xml/vdomdocument.h" -#include "../vmisc/logging.h" -#include "../vmisc/def.h" -#include "../tools/vdatatool.h" -#include "vundocommand.h" - -class QUndoCommand; - -//--------------------------------------------------------------------------------------------------------------------- -DeleteDetail::DeleteDetail(VAbstractPattern *doc, quint32 id, const VDetail &detail, QUndoCommand *parent) - : VUndoCommand(QDomElement(), doc, parent), parentNode(QDomNode()), siblingId(NULL_ID), detail(detail) -{ - setText(tr("delete tool")); - nodeId = id; - QDomElement domElement = doc->elementById(id); - if (domElement.isElement()) - { - xml = domElement.cloneNode().toElement(); - parentNode = domElement.parentNode(); - QDomNode previousDetail = domElement.previousSibling(); - if (previousDetail.isNull()) - { - siblingId = NULL_ID; - } - else - { - // Better save id of previous detail instead of reference to node. - siblingId = doc->GetParametrUInt(previousDetail.toElement(), VAbstractPattern::AttrId, NULL_ID_STR); - } - } - else - { - qCDebug(vUndo, "Can't get detail by id = %u.", nodeId); - return; - } -} - -//--------------------------------------------------------------------------------------------------------------------- -DeleteDetail::~DeleteDetail() -{} - -//--------------------------------------------------------------------------------------------------------------------- -void DeleteDetail::undo() -{ - qCDebug(vUndo, "Undo."); - - UndoDeleteAfterSibling(parentNode, siblingId); - emit NeedFullParsing(); -} - -//--------------------------------------------------------------------------------------------------------------------- -void DeleteDetail::redo() -{ - qCDebug(vUndo, "Redo."); - - QDomElement domElement = doc->elementById(nodeId); - if (domElement.isElement()) - { - parentNode.removeChild(domElement); - - // UnionDetails delete two old details and create one new. - // So when UnionDetail delete detail we can't use FullParsing. So we hide detail on scene directly. - VToolDetail *toolDet = qobject_cast(doc->getTool(nodeId)); - SCASSERT(toolDet != nullptr) - toolDet->hide(); - - DecrementReferences(detail.getNodes()); - emit NeedFullParsing(); // Doesn't work when UnionDetail delete detail. - } - else - { - qCDebug(vUndo, "Can't get detail by id = %u.", nodeId); - return; - } -} diff --git a/src/libs/vtools/undocommands/deletedetail.h b/src/libs/vtools/undocommands/deletedetail.h deleted file mode 100644 index abbe30b7e..000000000 --- a/src/libs/vtools/undocommands/deletedetail.h +++ /dev/null @@ -1,62 +0,0 @@ -/************************************************************************ - ** - ** @file deletedetail.h - ** @author Roman Telezhynskyi - ** @date 16 6, 2014 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013-2015 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#ifndef DELETEDETAIL_H -#define DELETEDETAIL_H - -#include -#include -#include -#include -#include -#include - -#include "../tools/vtooldetail.h" -#include "vdetail.h" -#include "vundocommand.h" - -class QGraphicsItem; -class QUndoCommand; -class VAbstractPattern; - -class DeleteDetail : public VUndoCommand -{ - Q_OBJECT -public: - DeleteDetail(VAbstractPattern *doc, quint32 id, const VDetail &detail, QUndoCommand *parent = 0); - virtual ~DeleteDetail() Q_DECL_OVERRIDE; - virtual void undo() Q_DECL_OVERRIDE; - virtual void redo() Q_DECL_OVERRIDE; -private: - Q_DISABLE_COPY(DeleteDetail) - QDomNode parentNode; - quint32 siblingId; - VDetail detail; -}; - -#endif // DELETEDETAIL_H diff --git a/src/libs/vtools/undocommands/savedetailoptions.cpp b/src/libs/vtools/undocommands/savedetailoptions.cpp deleted file mode 100644 index fa8ae38e9..000000000 --- a/src/libs/vtools/undocommands/savedetailoptions.cpp +++ /dev/null @@ -1,216 +0,0 @@ -/************************************************************************ - ** - ** @file savedetailoptions.cpp - ** @author Roman Telezhynskyi - ** @date 12 6, 2014 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013-2015 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#include "savedetailoptions.h" - -#include -#include -#include -#include - -#include "../ifc/xml/vabstractpattern.h" -#include "../ifc/ifcdef.h" -#include "../vmisc/logging.h" -#include "../vmisc/def.h" -#include "../vpatterndb/vpatterninfogeometry.h" -#include "../vpatterndb/vpatternpiecedata.h" -#include "../vpatterndb/vgrainlinegeometry.h" -#include "../tools/vtooldetail.h" -#include "vundocommand.h" - -class QDomElement; -class QUndoCommand; - -//--------------------------------------------------------------------------------------------------------------------- -SaveDetailOptions::SaveDetailOptions(const VDetail &oldDet, const VDetail &newDet, VAbstractPattern *doc, - const quint32 &id, QGraphicsScene *scene, QUndoCommand *parent) - : VUndoCommand(QDomElement(), doc, parent), oldDet(oldDet), newDet(newDet), scene(scene) -{ - setText(tr("save detail option")); - nodeId = id; -} - -//--------------------------------------------------------------------------------------------------------------------- -SaveDetailOptions::~SaveDetailOptions() -{} - -//--------------------------------------------------------------------------------------------------------------------- -void SaveDetailOptions::undo() -{ - qCDebug(vUndo, "Undo."); - - QDomElement domElement = doc->elementById(nodeId); - if (domElement.isElement()) - { - SaveDet(domElement, oldDet); - doc->RemoveAllChildren(domElement); - SavePatternPieceData(domElement, oldDet); - SavePatternInfo(domElement, oldDet); - SaveGrainline(domElement, oldDet); - - for (int i = 0; i < oldDet.CountNode(); ++i) - { - VToolDetail::AddNode(doc, domElement, oldDet.at(i)); - } - IncrementReferences(oldDet.Missing(newDet)); - emit NeedLiteParsing(Document::LiteParse); - } - else - { - qCDebug(vUndo, "Can't find detail with id = %u.", nodeId); - return; - } -} - -//--------------------------------------------------------------------------------------------------------------------- -void SaveDetailOptions::redo() -{ - qCDebug(vUndo, "Redo."); - - QDomElement domElement = doc->elementById(nodeId); - if (domElement.isElement()) - { - SaveDet(domElement, newDet); - doc->RemoveAllChildren(domElement); - SavePatternPieceData(domElement, newDet); - SavePatternInfo(domElement, newDet); - SaveGrainline(domElement, newDet); - - for (int i = 0; i < newDet.CountNode(); ++i) - { - VToolDetail::AddNode(doc, domElement, newDet.at(i)); - } - - DecrementReferences(oldDet.Missing(newDet)); - emit NeedLiteParsing(Document::LiteParse); - } - else - { - qCDebug(vUndo, "Can't find detail with id = %u.", nodeId); - return; - } -} - -//--------------------------------------------------------------------------------------------------------------------- -bool SaveDetailOptions::mergeWith(const QUndoCommand *command) -{ - const SaveDetailOptions *saveCommand = static_cast(command); - SCASSERT(saveCommand != nullptr) - const quint32 id = saveCommand->getDetId(); - - if (id != nodeId || text() != command->text()) - { - return false; - } - - newDet = saveCommand->getNewDet(); - return true; -} - -//--------------------------------------------------------------------------------------------------------------------- -int SaveDetailOptions::id() const -{ - return static_cast(UndoCommand::SaveDetailOptions); -} - -//--------------------------------------------------------------------------------------------------------------------- -void SaveDetailOptions::SaveDet(QDomElement &domElement, const VDetail &det) -{ - doc->SetAttribute(domElement, AttrName, det.getName()); - doc->SetAttribute(domElement, VToolDetail::AttrSupplement, QString().setNum(det.getSeamAllowance())); - doc->SetAttribute(domElement, VToolDetail::AttrClosed, QString().setNum(det.getClosed())); - doc->SetAttribute(domElement, VToolDetail::AttrWidth, QString().setNum(det.getWidth())); - doc->SetAttribute(domElement, VToolDetail::AttrForbidFlipping, QString().setNum(det.getForbidFlipping())); -} - -//--------------------------------------------------------------------------------------------------------------------- -void SaveDetailOptions::SavePatternPieceData(QDomElement &domElement, const VDetail &det) -{ - QDomElement domData = doc->createElement(VAbstractPattern::TagData); - const VPatternPieceData& data = det.GetPatternPieceData(); - doc->SetAttribute(domData, VAbstractPattern::AttrLetter, data.GetLetter()); - doc->SetAttribute(domData, VAbstractPattern::AttrVisible, data.IsVisible() == true? trueStr : falseStr); - doc->SetAttribute(domData, AttrMx, data.GetPos().x()); - doc->SetAttribute(domData, AttrMy, data.GetPos().y()); - doc->SetAttribute(domData, VToolDetail::AttrWidth, data.GetLabelWidth()); - doc->SetAttribute(domData, VToolDetail::AttrHeight, data.GetLabelHeight()); - doc->SetAttribute(domData, VToolDetail::AttrFont, data.GetFontSize()); - doc->SetAttribute(domData, VToolDetail::AttrRotation, data.GetRotation()); - - for (int i = 0; i < data.GetMCPCount(); ++i) - { - MaterialCutPlacement mcp = data.GetMCP(i); - QDomElement domMCP = doc->createElement(VAbstractPattern::TagMCP); - doc->SetAttribute(domMCP, VAbstractPattern::AttrMaterial, int(mcp.m_eMaterial)); - if (mcp.m_eMaterial == MaterialType::mtUserDefined) - { - qDebug() << "USER DEFINED MATERIAL"; - doc->SetAttribute(domMCP, VAbstractPattern::AttrUserDefined, mcp.m_qsMaterialUserDef); - } - else - { - qDebug() << "PREDEFINED MATERIAL"; - domMCP.removeAttribute(VAbstractPattern::AttrUserDefined); - } - doc->SetAttribute(domMCP, VAbstractPattern::AttrCutNumber, mcp.m_iCutNumber); - doc->SetAttribute(domMCP, VAbstractPattern::AttrPlacement, int(mcp.m_ePlacement)); - domData.appendChild(domMCP); - } - domElement.appendChild(domData); -} - -//--------------------------------------------------------------------------------------------------------------------- -void SaveDetailOptions::SavePatternInfo(QDomElement &domElement, const VDetail &det) -{ - QDomElement domData = doc->createElement(VAbstractPattern::TagPatternInfo); - const VPatternInfoGeometry& data = det.GetPatternInfo(); - doc->SetAttribute(domData, VAbstractPattern::AttrVisible, data.IsVisible() == true? trueStr : falseStr); - doc->SetAttribute(domData, AttrMx, data.GetPos().x()); - doc->SetAttribute(domData, AttrMy, data.GetPos().y()); - doc->SetAttribute(domData, VToolDetail::AttrWidth, data.GetLabelWidth()); - doc->SetAttribute(domData, VToolDetail::AttrHeight, data.GetLabelHeight()); - doc->SetAttribute(domData, VToolDetail::AttrFont, data.GetFontSize()); - doc->SetAttribute(domData, VToolDetail::AttrRotation, data.GetRotation()); - - domElement.appendChild(domData); -} - -//--------------------------------------------------------------------------------------------------------------------- -void SaveDetailOptions::SaveGrainline(QDomElement &domElement, const VDetail &det) -{ - QDomElement domData = doc->createElement(VAbstractPattern::TagGrainline); - const VGrainlineGeometry& glGeom = det.GetGrainlineGeometry(); - doc->SetAttribute(domData, VAbstractPattern::AttrVisible, glGeom.IsVisible() == true? trueStr : falseStr); - doc->SetAttribute(domData, AttrMx, glGeom.GetPos().x()); - doc->SetAttribute(domData, AttrMy, glGeom.GetPos().y()); - doc->SetAttribute(domData, AttrLength, glGeom.GetLength()); - doc->SetAttribute(domData, VToolDetail::AttrRotation, glGeom.GetRotation()); - doc->SetAttribute(domData, VAbstractPattern::AttrArrows, int(glGeom.GetArrowType())); - - domElement.appendChild(domData); -} diff --git a/src/libs/vtools/undocommands/savedetailoptions.h b/src/libs/vtools/undocommands/savedetailoptions.h deleted file mode 100644 index 5b4cbc058..000000000 --- a/src/libs/vtools/undocommands/savedetailoptions.h +++ /dev/null @@ -1,83 +0,0 @@ -/************************************************************************ - ** - ** @file savedetailoptions.h - ** @author Roman Telezhynskyi - ** @date 12 6, 2014 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013-2015 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ - -#ifndef SAVEDETAILOPTIONS_H -#define SAVEDETAILOPTIONS_H - -#include -#include -#include -#include -#include - -#include "../tools/vtooldetail.h" -#include "vdetail.h" -#include "vundocommand.h" - -class QDomElement; -class QGraphicsScene; -class QUndoCommand; -class VAbstractPattern; - -class SaveDetailOptions : public VUndoCommand -{ - Q_OBJECT -public: - SaveDetailOptions(const VDetail &oldDet, const VDetail &newDet, VAbstractPattern *doc, const quint32 &id, - QGraphicsScene *scene, QUndoCommand *parent = 0); - virtual ~SaveDetailOptions() Q_DECL_OVERRIDE; - virtual void undo() Q_DECL_OVERRIDE; - virtual void redo() Q_DECL_OVERRIDE; - virtual bool mergeWith(const QUndoCommand *command) Q_DECL_OVERRIDE; - virtual int id() const Q_DECL_OVERRIDE; - quint32 getDetId() const; - VDetail getNewDet() const; -private: - Q_DISABLE_COPY(SaveDetailOptions) - const VDetail oldDet; - VDetail newDet; - QGraphicsScene *scene; - void SaveDet(QDomElement &domElement, const VDetail &det); - void SavePatternPieceData(QDomElement &domElement, const VDetail &det); - void SavePatternInfo(QDomElement &domElement, const VDetail &det); - void SaveGrainline(QDomElement &domElement, const VDetail &det); -}; - -//--------------------------------------------------------------------------------------------------------------------- -inline quint32 SaveDetailOptions::getDetId() const -{ - return nodeId; -} - -//--------------------------------------------------------------------------------------------------------------------- -inline VDetail SaveDetailOptions::getNewDet() const -{ - return newDet; -} - -#endif // SAVEDETAILOPTIONS_H diff --git a/src/libs/vtools/undocommands/undocommands.pri b/src/libs/vtools/undocommands/undocommands.pri index a682f0e26..b77b22ae9 100644 --- a/src/libs/vtools/undocommands/undocommands.pri +++ b/src/libs/vtools/undocommands/undocommands.pri @@ -8,12 +8,9 @@ HEADERS += \ $$PWD/movespline.h \ $$PWD/movesplinepath.h \ $$PWD/savetooloptions.h \ - $$PWD/savedetailoptions.h \ $$PWD/deltool.h \ $$PWD/deletepatternpiece.h \ $$PWD/adddetnode.h \ - $$PWD/adddet.h \ - $$PWD/deletedetail.h \ $$PWD/vundocommand.h \ $$PWD/renamepp.h \ $$PWD/label/movelabel.h \ @@ -36,12 +33,9 @@ SOURCES += \ $$PWD/movespline.cpp \ $$PWD/movesplinepath.cpp \ $$PWD/savetooloptions.cpp \ - $$PWD/savedetailoptions.cpp \ $$PWD/deltool.cpp \ $$PWD/deletepatternpiece.cpp \ $$PWD/adddetnode.cpp \ - $$PWD/adddet.cpp \ - $$PWD/deletedetail.cpp \ $$PWD/vundocommand.cpp \ $$PWD/renamepp.cpp \ $$PWD/label/movelabel.cpp \