diff --git a/src/app/valentina/core/vtooloptionspropertybrowser.cpp b/src/app/valentina/core/vtooloptionspropertybrowser.cpp index 99434e6d5..7c5dc3dcc 100644 --- a/src/app/valentina/core/vtooloptionspropertybrowser.cpp +++ b/src/app/valentina/core/vtooloptionspropertybrowser.cpp @@ -77,7 +77,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) == 49, "Not all tools was used in switch."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50, "Not all tools were used in switch."); switch (item->type()) { @@ -210,7 +210,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) == 49, "Not all tools was used in switch."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50, "Not all tools were used in switch."); switch (currentItem->type()) { @@ -354,7 +354,7 @@ void VToolOptionsPropertyBrowser::userChangedData(VProperty *property) } // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools was used in switch."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50, "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 8b57fdadf..e394b31b3 100644 --- a/src/app/valentina/dialogs/dialoghistory.cpp +++ b/src/app/valentina/dialogs/dialoghistory.cpp @@ -208,7 +208,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) == 49, "Not all tools was used in history."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50, "Not all tools was used in history."); const QDomElement domElem = doc->elementById(tool.getId()); if (domElem.isElement() == false) @@ -392,6 +392,7 @@ QString DialogHistory::Record(const VToolRecord &tool) case Tool::FlippingByLine: case Tool::FlippingByAxis: case Tool::Move: + case Tool::PiecePath: return QString(); } } diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index c8941b238..de188950a 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -952,6 +952,14 @@ void MainWindow::ToolDetail(bool checked) &MainWindow::ApplyDetailsDialog); } +//--------------------------------------------------------------------------------------------------------------------- +void MainWindow::ToolPiecePath(bool checked) +{ + ToolSelectAllDrawObjects(); + SetToolButton(checked, Tool::PiecePath, "://cursor/path_cursor.png", tr("Select path objects."), + &MainWindow::ClosedDialogPiecePath); +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief ClosedDialogDetail actions after closing DialogDetail. @@ -1104,6 +1112,19 @@ void MainWindow::ClosedDialogGroup(int result) ArrowTool(); } +//--------------------------------------------------------------------------------------------------------------------- +void MainWindow::ClosedDialogPiecePath(int result) +{ + SCASSERT(dialogTool != nullptr); + if (result == QDialog::Accepted) + { + DialogPiecePath *dialog = qobject_cast(dialogTool); + SCASSERT(dialog != nullptr); + + } + ArrowTool(); +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief ToolCutArc handler tool cutArc. @@ -1671,6 +1692,7 @@ void MainWindow::ToolBarDraws() }); } +//--------------------------------------------------------------------------------------------------------------------- void MainWindow::ToolBarTools() { /*First we will try use Standard Shortcuts from Qt, but because keypad "-" and "+" not the same keys like in main @@ -1717,6 +1739,9 @@ void MainWindow::InitToolButtons() connect(pointer, &QToolButton::clicked, this, &MainWindow::ArrowTool); } + // This check helps to find missed tools + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50, "Check if all tools were connected."); + connect(ui->toolButtonEndLine, &QToolButton::clicked, this, &MainWindow::ToolEndLine); connect(ui->toolButtonLine, &QToolButton::clicked, this, &MainWindow::ToolLine); connect(ui->toolButtonAlongLine, &QToolButton::clicked, this, &MainWindow::ToolAlongLine); @@ -1731,6 +1756,7 @@ void MainWindow::InitToolButtons() connect(ui->toolButtonCubicBezierPath, &QToolButton::clicked, this, &MainWindow::ToolCubicBezierPath); connect(ui->toolButtonPointOfContact, &QToolButton::clicked, this, &MainWindow::ToolPointOfContact); connect(ui->toolButtonNewDetail, &QToolButton::clicked, this, &MainWindow::ToolDetail); + connect(ui->toolButtonPiecePath, &QToolButton::clicked, this, &MainWindow::ToolPiecePath); connect(ui->toolButtonHeight, &QToolButton::clicked, this, &MainWindow::ToolHeight); connect(ui->toolButtonTriangle, &QToolButton::clicked, this, &MainWindow::ToolTriangle); connect(ui->toolButtonPointOfIntersection, &QToolButton::clicked, this, &MainWindow::ToolPointOfIntersection); @@ -1786,7 +1812,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) == 49, "Not all tools was handled."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50, "Not all tools was handled."); qCDebug(vMainWindow, "Canceling tool."); delete dialogTool; @@ -1875,6 +1901,9 @@ void MainWindow::CancelTool() case Tool::Piece: ui->toolButtonNewDetail->setChecked(false); break; + case Tool::PiecePath: + ui->toolButtonPiecePath->setChecked(false); + break; case Tool::Height: ui->toolButtonHeight->setChecked(false); break; @@ -2987,7 +3016,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) == 49, "Not all tools were handled."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50, "Not all tools were handled."); //Drawing Tools ui->toolButtonEndLine->setEnabled(drawTools); @@ -3004,6 +3033,7 @@ void MainWindow::SetEnableTool(bool enable) ui->toolButtonCubicBezierPath->setEnabled(drawTools); ui->toolButtonPointOfContact->setEnabled(drawTools); ui->toolButtonNewDetail->setEnabled(drawTools); + ui->toolButtonPiecePath->setEnabled(drawTools); ui->toolButtonHeight->setEnabled(drawTools); ui->toolButtonTriangle->setEnabled(drawTools); ui->toolButtonPointOfIntersection->setEnabled(drawTools); @@ -3307,7 +3337,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) == 49, "Not all tools was handled."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50, "Not all tools were handled."); if (currentTool == lastUsedTool) { @@ -3401,6 +3431,10 @@ void MainWindow::LastUsedTool() ui->toolButtonNewDetail->setChecked(true); ToolDetail(true); break; + case Tool::PiecePath: + ui->toolButtonPiecePath->setChecked(true); + ToolPiecePath(true); + break; case Tool::Height: ui->toolButtonHeight->setChecked(true); ToolHeight(true); diff --git a/src/app/valentina/mainwindow.h b/src/app/valentina/mainwindow.h index 34851eaf5..aed7a8993 100644 --- a/src/app/valentina/mainwindow.h +++ b/src/app/valentina/mainwindow.h @@ -134,6 +134,7 @@ private slots: void ToolCutSplinePath(bool checked); void ToolPointOfContact(bool checked); void ToolDetail(bool checked); + void ToolPiecePath(bool checked); void ToolHeight(bool checked); void ToolTriangle(bool checked); void ToolPointOfIntersection(bool checked); @@ -167,6 +168,7 @@ private slots: void ClosedDialogDetail(int result); void ClosedDialogUnionDetails(int result); void ClosedDialogGroup(int result); + void ClosedDialogPiecePath(int result); void LoadIndividual(); void LoadStandard(); diff --git a/src/app/valentina/mainwindow.ui b/src/app/valentina/mainwindow.ui index 27f576e5e..cfad62823 100644 --- a/src/app/valentina/mainwindow.ui +++ b/src/app/valentina/mainwindow.ui @@ -48,7 +48,7 @@ Tools - 4 + 5 @@ -427,7 +427,7 @@ 0 0 - 117 + 130 110 @@ -536,7 +536,7 @@ 0 0 - 117 + 130 248 @@ -798,7 +798,7 @@ 0 0 - 117 + 130 248 @@ -1241,8 +1241,8 @@ 0 0 - 117 - 104 + 130 + 150 @@ -1343,6 +1343,32 @@ + + + + false + + + Piece path tool + + + ... + + + + :/toolicon/32x32/path.png:/toolicon/32x32/path.png + + + + 32 + 32 + + + + true + + + @@ -2480,8 +2506,8 @@ - + diff --git a/src/app/valentina/share/resources/cursor.qrc b/src/app/valentina/share/resources/cursor.qrc index b2631218b..56f67ddd5 100644 --- a/src/app/valentina/share/resources/cursor.qrc +++ b/src/app/valentina/share/resources/cursor.qrc @@ -76,5 +76,7 @@ cursor/flipping_axis_cursor@2x.png cursor/move_cursor.png cursor/move_cursor@2x.png + cursor/path_cursor.png + cursor/path_cursor@2x.png diff --git a/src/app/valentina/share/resources/cursor/path_cursor.png b/src/app/valentina/share/resources/cursor/path_cursor.png new file mode 100644 index 000000000..2819f260a Binary files /dev/null and b/src/app/valentina/share/resources/cursor/path_cursor.png differ diff --git a/src/app/valentina/share/resources/cursor/path_cursor@2x.png b/src/app/valentina/share/resources/cursor/path_cursor@2x.png new file mode 100644 index 000000000..09c3a01ab Binary files /dev/null and b/src/app/valentina/share/resources/cursor/path_cursor@2x.png differ diff --git a/src/app/valentina/share/resources/toolicon.qrc b/src/app/valentina/share/resources/toolicon.qrc index 675a47d40..e93851223 100644 --- a/src/app/valentina/share/resources/toolicon.qrc +++ b/src/app/valentina/share/resources/toolicon.qrc @@ -74,5 +74,7 @@ toolicon/32x32/flipping_axis@2x.png toolicon/32x32/move.png toolicon/32x32/move@2x.png + toolicon/32x32/path.png + toolicon/32x32/path@2x.png diff --git a/src/app/valentina/share/resources/toolicon/32x32/path.png b/src/app/valentina/share/resources/toolicon/32x32/path.png new file mode 100644 index 000000000..a95d6e90d Binary files /dev/null and b/src/app/valentina/share/resources/toolicon/32x32/path.png differ diff --git a/src/app/valentina/share/resources/toolicon/32x32/path@2x.png b/src/app/valentina/share/resources/toolicon/32x32/path@2x.png new file mode 100644 index 000000000..46efce5f6 Binary files /dev/null and b/src/app/valentina/share/resources/toolicon/32x32/path@2x.png differ diff --git a/src/app/valentina/share/resources/toolicon/svg/path.svg b/src/app/valentina/share/resources/toolicon/svg/path.svg new file mode 100644 index 000000000..fede8eb12 --- /dev/null +++ b/src/app/valentina/share/resources/toolicon/svg/path.svg @@ -0,0 +1,85 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index d397a3434..4f9fd1722 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -3478,7 +3478,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) == 49, "Not all tools was used."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50, "Not all tools were used."); QRectF rec; @@ -3608,6 +3608,7 @@ QRectF VPattern::ActiveDrawBoundingRect() const case Tool::NodeSpline: case Tool::NodeSplinePath: case Tool::Group: + case Tool::PiecePath: break; } } diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index 05076bd9f..974d9f9ce 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -1422,7 +1422,7 @@ QStringList VAbstractPattern::ListPointExpressions() const { // Check if new tool doesn't bring new attribute with a formula. // If no just increment number - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50); QStringList expressions; const QDomNodeList list = elementsByTagName(TagPoint); @@ -1493,7 +1493,7 @@ QStringList VAbstractPattern::ListArcExpressions() const { // Check if new tool doesn't bring new attribute with a formula. // If no just increment number - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50); QStringList expressions; const QDomNodeList list = elementsByTagName(TagArc); @@ -1554,7 +1554,7 @@ QStringList VAbstractPattern::ListPathPointExpressions() const { // Check if new tool doesn't bring new attribute with a formula. // If no just increment number - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50); QStringList expressions; const QDomNodeList list = elementsByTagName(AttrPathPoint); @@ -1620,7 +1620,7 @@ QStringList VAbstractPattern::ListOperationExpressions() const { // Check if new tool doesn't bring new attribute with a formula. // If no just increment number - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 50); QStringList expressions; const QDomNodeList list = elementsByTagName(TagOperation); diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index f8e2655a3..7d680bd38 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -103,6 +103,7 @@ enum class Tool : ToolVisHolderType PointOfContact, Detail, Piece, + PiecePath, NodePoint, NodeArc, NodeSpline, @@ -170,7 +171,8 @@ enum class Vis : ToolVisHolderType ToolFlippingByLine, ToolFlippingByAxis, ToolMove, - ToolPiece + ToolPiece, + ToolPiecePath }; enum class VarType : char { Measurement, Increment, LineLength, CurveLength, CurveCLength, LineAngle, CurveAngle, diff --git a/src/libs/vtools/dialogs/tooldialogs.h b/src/libs/vtools/dialogs/tooldialogs.h index d7f859cc1..07259d6fc 100644 --- a/src/libs/vtools/dialogs/tooldialogs.h +++ b/src/libs/vtools/dialogs/tooldialogs.h @@ -66,6 +66,7 @@ #include "tools/dialogflippingbyline.h" #include "tools/dialogflippingbyaxis.h" #include "tools/dialogmove.h" +#include "tools/dialogpiecepath.h" #include "support/dialogeditwrongformula.h" #include "support/dialogundo.h" diff --git a/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp b/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp index d863f15c6..fa119d6bf 100644 --- a/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp @@ -56,6 +56,8 @@ DialogPiecePath::DialogPiecePath(const VContainer *data, quint32 toolId, QWidget ui->comboBoxType->setDisabled(true); ui->comboBoxPiece->setDisabled(true); } + + show();//temporary } //---------------------------------------------------------------------------------------------------------------------