From 9b54b0c069d4d7af8c8c1ba519b1aef0f3fcd69d Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 25 Oct 2017 17:49:04 +0300 Subject: [PATCH] Dialog Duplicate Detail. --HG-- branch : feature --- .../core/vtooloptionspropertybrowser.cpp | 6 +- src/app/valentina/dialogs/dialoghistory.cpp | 3 +- src/app/valentina/mainwindow.cpp | 47 ++++- src/app/valentina/mainwindow.h | 2 + src/app/valentina/mainwindow.ui | 28 ++- src/app/valentina/share/resources/cursor.qrc | 2 + .../cursor/duplicate_detail_cursor.png | Bin 0 -> 902 bytes .../cursor/duplicate_detail_cursor@2x.png | Bin 0 -> 1939 bytes .../valentina/share/resources/toolicon.qrc | 2 + .../toolicon/32x32/duplicate_detail.png | Bin 0 -> 1462 bytes .../toolicon/32x32/duplicate_detail@2x.png | Bin 0 -> 2940 bytes .../toolicon/svg/duplicate_detail.svg | 194 ++++++++++++++++++ src/app/valentina/xml/vpattern.cpp | 3 +- src/libs/ifc/xml/vabstractpattern.cpp | 16 +- src/libs/vmisc/def.h | 2 + src/libs/vtools/dialogs/dialogs.pri | 9 +- src/libs/vtools/dialogs/tooldialogs.h | 1 + .../tools/piece/dialogduplicatedetail.cpp | 93 +++++++++ .../tools/piece/dialogduplicatedetail.h | 80 ++++++++ .../tools/piece/dialogduplicatedetail.ui | 80 ++++++++ src/libs/vtools/tools/vtoolseamallowance.cpp | 35 +++- src/libs/vtools/tools/vtoolseamallowance.h | 3 + .../path/vistoolduplicatedetail.cpp | 69 +++++++ .../path/vistoolduplicatedetail.h | 68 ++++++ .../vtools/visualization/visualization.pri | 6 +- 25 files changed, 718 insertions(+), 31 deletions(-) create mode 100644 src/app/valentina/share/resources/cursor/duplicate_detail_cursor.png create mode 100644 src/app/valentina/share/resources/cursor/duplicate_detail_cursor@2x.png create mode 100644 src/app/valentina/share/resources/toolicon/32x32/duplicate_detail.png create mode 100644 src/app/valentina/share/resources/toolicon/32x32/duplicate_detail@2x.png create mode 100644 src/app/valentina/share/resources/toolicon/svg/duplicate_detail.svg create mode 100644 src/libs/vtools/dialogs/tools/piece/dialogduplicatedetail.cpp create mode 100644 src/libs/vtools/dialogs/tools/piece/dialogduplicatedetail.h create mode 100644 src/libs/vtools/dialogs/tools/piece/dialogduplicatedetail.ui create mode 100644 src/libs/vtools/visualization/path/vistoolduplicatedetail.cpp create mode 100644 src/libs/vtools/visualization/path/vistoolduplicatedetail.h diff --git a/src/app/valentina/core/vtooloptionspropertybrowser.cpp b/src/app/valentina/core/vtooloptionspropertybrowser.cpp index 0e6bfe0c7..f4bfc1d12 100644 --- a/src/app/valentina/core/vtooloptionspropertybrowser.cpp +++ b/src/app/valentina/core/vtooloptionspropertybrowser.cpp @@ -78,7 +78,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) == 54, "Not all tools were used in switch."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 55, "Not all tools were used in switch."); switch (item->type()) { @@ -205,7 +205,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) == 54, "Not all tools were used in switch."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 55, "Not all tools were used in switch."); switch (currentItem->type()) { @@ -350,7 +350,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) == 54, "Not all tools were used in switch."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 55, "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 aa01d7f64..3a767a7cf 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) == 54, "Not all tools were used in history."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 55, "Not all tools were used in history."); const QDomElement domElem = doc->elementById(tool.getId()); if (domElem.isElement() == false) @@ -408,6 +408,7 @@ QString DialogHistory::Record(const VToolRecord &tool) case Tool::Pin: case Tool::PlaceLabel: case Tool::InsertNode: + case Tool::DuplicateDetail: return QString(); } } diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index ba1faff63..a15642ffa 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -613,7 +613,7 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons dialogTool = QSharedPointer(new Dialog(pattern, 0, this)); // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 54, "Check if need to extend."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 55, "Check if need to extend."); switch(t) { @@ -1107,8 +1107,32 @@ void MainWindow::ToolUnionDetails(bool checked) */ void MainWindow::ClosedDialogUnionDetails(int result) { - ClosedDialog(result); - doc->LiteParseTree(Document::LiteParse); + ClosedDialog(result);// Avoid error: Template function as signal or slot +} + +//--------------------------------------------------------------------------------------------------------------------- +void MainWindow::ToolDuplicateDetail(bool checked) +{ + ToolSelectDetail(); + SetToolButton(checked, Tool::DuplicateDetail, ":/cursor/duplicate_detail_cursor.png", + tr("Select detail"), &MainWindow::ClosedDialogDuplicateDetail); +} + +//--------------------------------------------------------------------------------------------------------------------- +void MainWindow::ClosedDialogDuplicateDetail(int result) +{ + SCASSERT(not dialogTool.isNull()) + if (result == QDialog::Accepted) + { + VMainGraphicsScene *scene = qobject_cast(currentScene); + SCASSERT(scene != nullptr) + + QGraphicsItem *tool = dynamic_cast(VToolSeamAllowance::Duplicate(dialogTool, scene, doc, + pattern)); + // Do not check for nullptr! See issue #719. + ui->view->itemClicked(tool); + } + ArrowTool(); } //--------------------------------------------------------------------------------------------------------------------- @@ -1985,7 +2009,7 @@ void MainWindow::InitToolButtons() } // This check helps to find missed tools - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 54, "Check if all tools were connected."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 55, "Check if all tools were connected."); connect(ui->toolButtonEndLine, &QToolButton::clicked, this, &MainWindow::ToolEndLine); connect(ui->toolButtonLine, &QToolButton::clicked, this, &MainWindow::ToolLine); @@ -2008,6 +2032,7 @@ void MainWindow::InitToolButtons() connect(ui->toolButtonSplineCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutSpline); connect(ui->toolButtonSplinePathCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutSplinePath); connect(ui->toolButtonUnionDetails, &QToolButton::clicked, this, &MainWindow::ToolUnionDetails); + connect(ui->toolButtonDuplicateDetail, &QToolButton::clicked, this, &MainWindow::ToolDuplicateDetail); connect(ui->toolButtonArcCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutArc); connect(ui->toolButtonLineIntersectAxis, &QToolButton::clicked, this, &MainWindow::ToolLineIntersectAxis); connect(ui->toolButtonCurveIntersectAxis, &QToolButton::clicked, this, &MainWindow::ToolCurveIntersectAxis); @@ -2062,7 +2087,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) == 54, "Not all tools were handled."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 55, "Not all tools were handled."); qCDebug(vMainWindow, "Canceling tool."); dialogTool.clear(); @@ -2172,6 +2197,9 @@ void MainWindow::CancelTool() case Tool::UnionDetails: ui->toolButtonUnionDetails->setChecked(false); break; + case Tool::DuplicateDetail: + ui->toolButtonDuplicateDetail->setChecked(false); + break; case Tool::CutArc: ui->toolButtonArcCutPoint->setChecked(false); break; @@ -3424,7 +3452,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default") QT_WARNING_POP // This check helps to find missed tools - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 54, "Not all tools were handled."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 55, "Not all tools were handled."); //Drawing Tools ui->toolButtonEndLine->setEnabled(drawTools); @@ -3480,6 +3508,7 @@ QT_WARNING_POP //Modeling Tools ui->toolButtonUnionDetails->setEnabled(modelingTools); ui->toolButtonDetailExportAs->setEnabled(modelingTools); + ui->toolButtonDuplicateDetail->setEnabled(modelingTools); //Layout tools ui->toolButtonLayoutSettings->setEnabled(layoutTools); @@ -3752,7 +3781,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) == 54, "Not all tools were handled."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 55, "Not all tools were handled."); if (currentTool == lastUsedTool) { @@ -3875,6 +3904,10 @@ void MainWindow::LastUsedTool() ui->toolButtonUnionDetails->setChecked(true); ToolUnionDetails(true); break; + case Tool::DuplicateDetail: + ui->toolButtonDuplicateDetail->setChecked(true); + ToolDuplicateDetail(true); + break; case Tool::CutArc: ui->toolButtonArcCutPoint->setChecked(true); ToolCutArc(true); diff --git a/src/app/valentina/mainwindow.h b/src/app/valentina/mainwindow.h index 47e6a76a0..386f04058 100644 --- a/src/app/valentina/mainwindow.h +++ b/src/app/valentina/mainwindow.h @@ -150,6 +150,7 @@ private slots: void ToolTriangle(bool checked); void ToolPointOfIntersection(bool checked); void ToolUnionDetails(bool checked); + void ToolDuplicateDetail(bool checked); void ToolGroup(bool checked); void ToolRotation(bool checked); void ToolFlippingByLine(bool checked); @@ -178,6 +179,7 @@ private slots: void Open(); void ClosedDialogUnionDetails(int result); + void ClosedDialogDuplicateDetail(int result); void ClosedDialogGroup(int result); void ClosedDialogPiecePath(int result); void ClosedDialogPin(int result); diff --git a/src/app/valentina/mainwindow.ui b/src/app/valentina/mainwindow.ui index b81b324b6..f2ae0f667 100644 --- a/src/app/valentina/mainwindow.ui +++ b/src/app/valentina/mainwindow.ui @@ -48,7 +48,7 @@ Export details skiping the Layout stage - 7 + 6 @@ -1550,6 +1550,32 @@ + + + + false + + + Duplicate detail tool + + + ... + + + + :/toolicon/32x32/duplicate_detail.png:/toolicon/32x32/duplicate_detail.png + + + + 32 + 32 + + + + true + + + diff --git a/src/app/valentina/share/resources/cursor.qrc b/src/app/valentina/share/resources/cursor.qrc index 1ef61e19d..52afe1836 100644 --- a/src/app/valentina/share/resources/cursor.qrc +++ b/src/app/valentina/share/resources/cursor.qrc @@ -86,5 +86,7 @@ cursor/insert_node_cursor@2x.png cursor/place_label_cursor@2x.png cursor/place_label_cursor.png + cursor/duplicate_detail_cursor.png + cursor/duplicate_detail_cursor@2x.png diff --git a/src/app/valentina/share/resources/cursor/duplicate_detail_cursor.png b/src/app/valentina/share/resources/cursor/duplicate_detail_cursor.png new file mode 100644 index 0000000000000000000000000000000000000000..9ce8097ec137759e752004c5f45d04db22006c42 GIT binary patch literal 902 zcmV;119|+3P)bZ!Y(XgRMN0!8I~W-rXG*;+jHJ7obELI z+@{|22f+v4^FBY`=bWR!|Li6R;BqGc9Drme5gY)rgSgU3K*tb#Kt~Yl9zfd>l>lu; zR0FgPQK$iE3!)yN<%mWAEk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NRkAn(}~Q?Or)l!M)bw<0bFeT0lfpABaRrfG*TI>?AWma_yoX*n5L?1 zu~@1O9z6J~*=$x=tyZmCt&V8pa5!Kz8bMJM3JVL7o*uEO0|0dN{)@hWF4U~t3yM+# zAZWVzGuk??$+n-U28aOa0346Yqc~+UnU>h?cAY{o{;I6eXs~kS$_e`tMFHN&_t1R% z6oymizfKnTOgb*g(9?pp$O5Xq)__Q(Uf2q7K8mkfEo>pAj1TJBmtmMC?dCX zW90MsuypBCS=+wt^|*1zfq{Vm>Ed4vXM&`cO`{FF@(LEKhIi7P9X(Jm={+9ry>HbT z1p^8MM7jzj2>_a=b0FS8t@8eRrD zj)j#j>i+6*<6(r}evc?A05mi-9PjGtDz;cGFBpx+%>4ZPl(9MQ^Z5b}hr>nFbWToA zPP)ltir6(doz7N|$8&elBEigYELffyd78lSEF@8s9Xlxi)YsR)Z?oC71qB6kZf>r{ zY&KVAXJ?lb6&0;DnN0aTJv}!M960b&d3m`ZD=Vv1qtU!rQ&aPn(P-2d3!AF02~KtoTW4=004l?~?#K)oM*?Yil#O-EP0z z?e+uk6crUYd_LbDLWq`O7?o0~)O)?&9|3?B(TTpnz6ZAjEg>NU93yZK2ivb9^ktoolicon/32x32/insert_node@2x.png toolicon/32x32/place_label@2x.png toolicon/32x32/place_label.png + toolicon/32x32/duplicate_detail.png + toolicon/32x32/duplicate_detail@2x.png diff --git a/src/app/valentina/share/resources/toolicon/32x32/duplicate_detail.png b/src/app/valentina/share/resources/toolicon/32x32/duplicate_detail.png new file mode 100644 index 0000000000000000000000000000000000000000..ac021c364730bb6981075783ab6be5c991790a79 GIT binary patch literal 1462 zcmV;n1xfmeP))7q4_oHIT^ReJ>p($aB1PFnXT?ih@yGsb;1mZ$C7qwkJ7pMfUtU=l$Nx^IrJgkHQO}q@-kJM@PqJJ9g~&dUkg9?%3Gah@4(^ zb+vu__U)Y>k7sQ(8jZe43|Z9G)j4V_Df05t-U^svN{JmU(GdOeR49T=3ANu?IM_O81{JDZrGBTmDu`y6xUG2`ta%yS{ z<>lpy**Kj}v)yhFXfzsCG#b4MfG8U6+qds4rOYCc2oXh5u>u(|3`06QJG&RhQp*vz ze*O9_Ns{uCbi3Uc9UWCnCIg*L2ZzIvWfB)~}7jR4<1B0DgXcKDlh~%OC(0GOaI@fLg8A{ci+ZE?0R)MTJetn2_ZcNtQr! zbMu=nm&+h`mO&zsfZ1%$r}EzjxLht%AP{&*$#8IR5I&!8*#u|+DgY}1kd~H~<}F*c ze6)4z*1B84E%4wr^cL9cm2l0d@jd;%IGELncE&1PGz6g-tm!DKQO z6dV9}jzgNAhaj@gWGu_c>e4owZIzP42M->gq@<)^0)ilbuzdQN?31?-p~$e>48WYx+5f|b>u96V zs7N5+)=Q`75E}djdTsXJl8A`8^z*wc{MRwiRQ5SQK=AOCa` zno{f5x*aRk3tBfBPvG&~V^)y(xr~hC_(uh`fMwatjk*N8wjIN*@geX$hZCod{4|!h z_`RB}UmUxz(4Ow@?*7v2^?EE8OQpqP@%a6I z>*9SdJUl!qisH1*W~;2Ntz9E`D~7}2sZc2N8vw8Z2aaPPE~tRO^8k^#hz=h2yLenKbnD^mvoWWO#v}E3tp>)zOsJsHW5^LI8*=?)K=!&|(7r0`E`A2P@cY QPXGV_07*qoM6N<$g7(F*cK`qY literal 0 HcmV?d00001 diff --git a/src/app/valentina/share/resources/toolicon/32x32/duplicate_detail@2x.png b/src/app/valentina/share/resources/toolicon/32x32/duplicate_detail@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..a4fc05ae0fe4e8e7664e511eba0474ce82363e39 GIT binary patch literal 2940 zcmV-?3xo8DP);I#;&%t+U;sm>$)mzS_`QUqCC1H z!gRoKa0gHaX6BxA_K!ge$UN@c3uO0`K*;5s?>Xmp&+pvd`JDqy4TiF^vVAL8uDofn zSYDJWW;UCjEh#B^PmYdFDr&X*XH`{Ihj#AVdCTkdGQZ!?91cfaf^tc-XU|^0bm`LX z4jeczxN+mgYjX6FmqTP6oW){UJ8Rag->zA+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CTvk?Q?CR=joS=TM+wK0;?RI|(01k&^?;CHt@%!fHW*j|w6roTE zBhRsT@nRSZ1{^+oIN03W{Fm`Uf*^oP=0=jDkq1Z#L9FA$(TKgKB>=eE(a~|WqoV^C zFJ1%yl~$`=I5049C01p(+kJe;jvddb)#^ug?kS~QQ&Uq~U0t0vEiFyi*Vi`$!2MWd z4!s=1+&*_dQWO(+n=v31ph!vLaepv!)@ZEk{|FW9RL?Pv` + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 4f6387df2..1a224c2e6 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -4166,7 +4166,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) == 54, "Not all tools were used."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 55, "Not all tools were used."); QRectF rec; @@ -4247,6 +4247,7 @@ QRectF VPattern::ActiveDrawBoundingRect() const case Tool::Pin: case Tool::InsertNode: case Tool::PlaceLabel: + case Tool::DuplicateDetail: break; } } diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index 170fdf218..c17775469 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -1771,7 +1771,7 @@ QVector 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) == 54); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 55); QVector expressions; const QDomNodeList list = elementsByTagName(TagPoint); @@ -1799,7 +1799,7 @@ QVector 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) == 54); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 55); QVector expressions; const QDomNodeList list = elementsByTagName(TagArc); @@ -1823,7 +1823,7 @@ QVector 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) == 54); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 55); QVector expressions; const QDomNodeList list = elementsByTagName(TagElArc); @@ -1856,7 +1856,7 @@ QVector 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) == 54); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 55); QVector expressions; const QDomNodeList list = elementsByTagName(AttrPathPoint); @@ -1894,7 +1894,7 @@ QVector 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) == 54); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 55); QVector expressions; const QDomNodeList list = elementsByTagName(TagOperation); @@ -1916,7 +1916,7 @@ QVector VAbstractPattern::ListNodesExpressions(const QDomElement // 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) == 54); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 55); QVector expressions; @@ -1939,7 +1939,7 @@ QVector VAbstractPattern::ListPathExpressions() 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) == 54); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 55); QVector expressions; const QDomNodeList list = elementsByTagName(TagPath); @@ -1977,7 +1977,7 @@ QVector VAbstractPattern::ListPieceExpressions() 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) == 54); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 55); QVector expressions; const QDomNodeList list = elementsByTagName(TagDetail); diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index 4f67cd982..899ae9f63 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -171,6 +171,7 @@ enum class Tool : ToolVisHolderType Pin, InsertNode, PlaceLabel, + DuplicateDetail, LAST_ONE_DO_NOT_USE //add new stuffs above this, this constant must be last and never used }; @@ -222,6 +223,7 @@ enum class Vis : ToolVisHolderType ToolPiecePath, ToolSpecialPoint, ToolPlaceLabel, + ToolDuplicateDetail, PieceSpecialPoints, NoBrush, CurvePathItem, diff --git a/src/libs/vtools/dialogs/dialogs.pri b/src/libs/vtools/dialogs/dialogs.pri index 9df554fc8..ddba6edce 100644 --- a/src/libs/vtools/dialogs/dialogs.pri +++ b/src/libs/vtools/dialogs/dialogs.pri @@ -47,7 +47,8 @@ HEADERS += \ $$PWD/tools/piece/dialogpin.h \ $$PWD/tools/piece/dialoginsertnode.h \ $$PWD/support/dialogeditlabel.h \ - $$PWD/tools/piece/dialogplacelabel.h + $$PWD/tools/piece/dialogplacelabel.h \ + $$PWD/tools/piece/dialogduplicatedetail.h SOURCES += \ $$PWD/tools/dialogalongline.cpp \ @@ -94,7 +95,8 @@ SOURCES += \ $$PWD/tools/piece/dialogpin.cpp \ $$PWD/tools/piece/dialoginsertnode.cpp \ $$PWD/support/dialogeditlabel.cpp \ - $$PWD/tools/piece/dialogplacelabel.cpp + $$PWD/tools/piece/dialogplacelabel.cpp \ + $$PWD/tools/piece/dialogduplicatedetail.cpp FORMS += \ $$PWD/tools/dialogalongline.ui \ @@ -146,4 +148,5 @@ FORMS += \ $$PWD/tools/piece/tabs/tabpassmarks.ui \ $$PWD/support/dialogeditlabel.ui \ $$PWD/tools/piece/dialogplacelabel.ui \ - $$PWD/tools/piece/tabs/tabplacelabels.ui + $$PWD/tools/piece/tabs/tabplacelabels.ui \ + $$PWD/tools/piece/dialogduplicatedetail.ui diff --git a/src/libs/vtools/dialogs/tooldialogs.h b/src/libs/vtools/dialogs/tooldialogs.h index 0db5a3721..58d46f9e5 100644 --- a/src/libs/vtools/dialogs/tooldialogs.h +++ b/src/libs/vtools/dialogs/tooldialogs.h @@ -70,6 +70,7 @@ #include "tools/piece/dialogpin.h" #include "tools/piece/dialoginsertnode.h" #include "tools/piece/dialogplacelabel.h" +#include "tools/piece/dialogduplicatedetail.h" #include "support/dialogeditwrongformula.h" #include "support/dialogundo.h" diff --git a/src/libs/vtools/dialogs/tools/piece/dialogduplicatedetail.cpp b/src/libs/vtools/dialogs/tools/piece/dialogduplicatedetail.cpp new file mode 100644 index 000000000..9a75421cb --- /dev/null +++ b/src/libs/vtools/dialogs/tools/piece/dialogduplicatedetail.cpp @@ -0,0 +1,93 @@ +/************************************************************************ + ** + ** @file dialogduplicatedetail.cpp + ** @author Roman Telezhynskyi + ** @date 25 10, 2017 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentina project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2017 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 "dialogduplicatedetail.h" +#include "ui_dialogduplicatedetail.h" +#include "../vwidgets/vabstractmainwindow.h" +#include "../../../visualization/path/vistoolduplicatedetail.h" + +//--------------------------------------------------------------------------------------------------------------------- +DialogDuplicateDetail::DialogDuplicateDetail(const VContainer *data, const quint32 &toolId, QWidget *parent) + : DialogTool(data, toolId, parent), + ui(new Ui::DialogDuplicateDetail), + m_idDetail(NULL_ID), + m_mx(0), + m_my(0), + m_firstRelease(false) +{ + ui->setupUi(this); + InitOkCancel(ui); + + vis = new VisToolDuplicateDetail(data); +} + +//--------------------------------------------------------------------------------------------------------------------- +DialogDuplicateDetail::~DialogDuplicateDetail() +{ + delete ui; +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogDuplicateDetail::ShowDialog(bool click) +{ + if (prepare) + { + if (click) + { + // The check need to ignore first release of mouse button. + // User should have chance to place piece. + if (not m_firstRelease) + { + m_firstRelease = true; + return; + } + + VisToolDuplicateDetail *piece = qobject_cast(vis); + SCASSERT(piece != nullptr) + + m_mx = piece->Mx(); + m_my = piece->My(); + emit ToolTip(""); + DialogAccepted(); + } + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogDuplicateDetail::ChosenObject(quint32 id, const SceneObject &type) +{ + if (prepare == false)// After first choose we ignore all objects + { + if (type == SceneObject::Detail && id > NULL_ID) + { + m_idDetail = id; + emit ToolTip(tr("Click to place duplicate")); + vis->VisualMode(id); + prepare = true; + } + } +} diff --git a/src/libs/vtools/dialogs/tools/piece/dialogduplicatedetail.h b/src/libs/vtools/dialogs/tools/piece/dialogduplicatedetail.h new file mode 100644 index 000000000..d36a0186b --- /dev/null +++ b/src/libs/vtools/dialogs/tools/piece/dialogduplicatedetail.h @@ -0,0 +1,80 @@ +/************************************************************************ + ** + ** @file dialogduplicatedetail.h + ** @author Roman Telezhynskyi + ** @date 25 10, 2017 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentina project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2017 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 DIALOGDUPLICATEDETAIL_H +#define DIALOGDUPLICATEDETAIL_H + +#include "../dialogtool.h" + +namespace Ui +{ + class DialogDuplicateDetail; +} + +class DialogDuplicateDetail : public DialogTool +{ + Q_OBJECT + +public: + explicit DialogDuplicateDetail(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); + virtual ~DialogDuplicateDetail(); + + quint32 Duplicate() const; + qreal MoveDuplicateX() const; + qreal MoveDuplicateY() const; + + virtual void ShowDialog(bool click) Q_DECL_OVERRIDE; +public slots: + virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE; +private: + Q_DISABLE_COPY(DialogDuplicateDetail) + Ui::DialogDuplicateDetail *ui; + quint32 m_idDetail; + qreal m_mx; + qreal m_my; + bool m_firstRelease; +}; + +//--------------------------------------------------------------------------------------------------------------------- +inline quint32 DialogDuplicateDetail::Duplicate() const +{ + return m_idDetail; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline qreal DialogDuplicateDetail::MoveDuplicateX() const +{ + return m_mx; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline qreal DialogDuplicateDetail::MoveDuplicateY() const +{ + return m_my; +} + +#endif // DIALOGDUPLICATEDETAIL_H diff --git a/src/libs/vtools/dialogs/tools/piece/dialogduplicatedetail.ui b/src/libs/vtools/dialogs/tools/piece/dialogduplicatedetail.ui new file mode 100644 index 000000000..fa187e416 --- /dev/null +++ b/src/libs/vtools/dialogs/tools/piece/dialogduplicatedetail.ui @@ -0,0 +1,80 @@ + + + DialogDuplicateDetail + + + + 0 + 0 + 184 + 66 + + + + Dialog duplicate detail + + + + :/icon/64x64/icon64x64.png:/icon/64x64/icon64x64.png + + + + + + The dialog is never shown. + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + + buttonBox + accepted() + DialogDuplicateDetail + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogDuplicateDetail + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index 6791982e6..c9009fecf 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -28,6 +28,7 @@ #include "vtoolseamallowance.h" #include "../dialogs/tools/piece/dialogseamallowance.h" +#include "../dialogs/tools/piece/dialogduplicatedetail.h" #include "../vpatterndb/vpiecenode.h" #include "../vpatterndb/vpiecepath.h" #include "../vpatterndb/calculator.h" @@ -151,6 +152,35 @@ VToolSeamAllowance *VToolSeamAllowance::Create(VToolSeamAllowanceInitData &initD return piece; } +//--------------------------------------------------------------------------------------------------------------------- +VToolSeamAllowance *VToolSeamAllowance::Duplicate(QSharedPointer dialog, VMainGraphicsScene *scene, + VAbstractPattern *doc, VContainer *data) +{ + SCASSERT(not dialog.isNull()); + QSharedPointer dialogTool = dialog.objectCast(); + SCASSERT(not dialogTool.isNull()) + + VToolSeamAllowanceInitData initData; + initData.scene = scene; + initData.doc = doc; + initData.data = data; + initData.parse = Document::FullParse; + initData.typeCreation = Source::FromGui; + +// initData.detail = dialogTool->GetPiece(); + initData.width = initData.detail.GetFormulaSAWidth(); + +// initData.detail.GetPath().SetNodes(PrepareNodes(initData.detail.GetPath(), scene, doc, data)); + + return Duplicate(initData); +} + +//--------------------------------------------------------------------------------------------------------------------- +VToolSeamAllowance *VToolSeamAllowance::Duplicate(VToolSeamAllowanceInitData &initData) +{ + return nullptr; +} + //--------------------------------------------------------------------------------------------------------------------- void VToolSeamAllowance::RemoveWithConfirm(bool ask) { @@ -1005,11 +1035,6 @@ QVariant VToolSeamAllowance::itemChange(QGraphicsItem::GraphicsItemChange change } } } - // Don't forget to update geometry, because first change never call full parse - VPiece detail = VAbstractTool::data.GetPiece(m_id); - detail.SetMx(newPos.x()); - detail.SetMy(newPos.y()); - VAbstractTool::data.UpdatePiece(m_id, detail); changeFinished = true; } diff --git a/src/libs/vtools/tools/vtoolseamallowance.h b/src/libs/vtools/tools/vtoolseamallowance.h index 401c2971e..c13742e52 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.h +++ b/src/libs/vtools/tools/vtoolseamallowance.h @@ -64,6 +64,9 @@ public: static VToolSeamAllowance* Create(QSharedPointer dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolSeamAllowance* Create(VToolSeamAllowanceInitData &initData); + static VToolSeamAllowance* Duplicate(QSharedPointer dialog, VMainGraphicsScene *scene, + VAbstractPattern *doc, VContainer *data); + static VToolSeamAllowance* Duplicate(VToolSeamAllowanceInitData &initData); static const quint8 pieceVersion; diff --git a/src/libs/vtools/visualization/path/vistoolduplicatedetail.cpp b/src/libs/vtools/visualization/path/vistoolduplicatedetail.cpp new file mode 100644 index 000000000..971eeaf90 --- /dev/null +++ b/src/libs/vtools/visualization/path/vistoolduplicatedetail.cpp @@ -0,0 +1,69 @@ +/************************************************************************ + ** + ** @file vistoolduplicatedetail.cpp + ** @author Roman Telezhynskyi + ** @date 25 10, 2017 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentina project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2017 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 "vistoolduplicatedetail.h" +#include "../vpatterndb/vcontainer.h" + +//--------------------------------------------------------------------------------------------------------------------- +VisToolDuplicateDetail::VisToolDuplicateDetail(const VContainer *data, QGraphicsItem *parent) + : VisPath(data, parent), + m_start(), + m_started(false), + m_diff() +{} + +//--------------------------------------------------------------------------------------------------------------------- +void VisToolDuplicateDetail::RefreshGeometry() +{ + const VPiece piece = Visualization::data->GetPiece(object1Id); + + if (not m_started) + { + m_start = Visualization::scenePos; + m_started = true; + } + else + { + m_diff = Visualization::scenePos - m_start; + setPos(m_diff); + } + + DrawPath(this, PiecePath(piece), mainColor, Qt::SolidLine, Qt::RoundCap); +} + +//--------------------------------------------------------------------------------------------------------------------- +QPainterPath VisToolDuplicateDetail::PiecePath(const VPiece &piece) const +{ + if (not piece.IsHideMainPath() || not piece.IsSeamAllowance() || piece.IsSeamAllowanceBuiltIn()) + { + return piece.MainPathPath(Visualization::data); + } + else + { + return piece.SeamAllowancePath(Visualization::data); + } +} diff --git a/src/libs/vtools/visualization/path/vistoolduplicatedetail.h b/src/libs/vtools/visualization/path/vistoolduplicatedetail.h new file mode 100644 index 000000000..a306211c5 --- /dev/null +++ b/src/libs/vtools/visualization/path/vistoolduplicatedetail.h @@ -0,0 +1,68 @@ +/************************************************************************ + ** + ** @file vistoolduplicatedetail.h + ** @author Roman Telezhynskyi + ** @date 25 10, 2017 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentina project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2017 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 VISTOOLDUPLICATEDETAIL_H +#define VISTOOLDUPLICATEDETAIL_H + +#include "vispath.h" +#include "../vpatterndb/vpiece.h" + +class VisToolDuplicateDetail : public VisPath +{ + Q_OBJECT +public: + VisToolDuplicateDetail(const VContainer *data, QGraphicsItem *parent = nullptr); + virtual ~VisToolDuplicateDetail() = default; + + qreal Mx() const; + qreal My() const; + + virtual void RefreshGeometry() Q_DECL_OVERRIDE; + virtual int type() const Q_DECL_OVERRIDE {return Type;} + enum { Type = UserType + static_cast(Vis::ToolDuplicateDetail)}; +private: + Q_DISABLE_COPY(VisToolDuplicateDetail) + QPointF m_start; + bool m_started; + QPointF m_diff; + + QPainterPath PiecePath(const VPiece &piece) const; +}; + +//--------------------------------------------------------------------------------------------------------------------- +inline qreal VisToolDuplicateDetail::Mx() const +{ + return m_diff.x(); +} + +//--------------------------------------------------------------------------------------------------------------------- +inline qreal VisToolDuplicateDetail::My() const +{ + return m_diff.y(); +} + +#endif // VISTOOLDUPLICATEDETAIL_H diff --git a/src/libs/vtools/visualization/visualization.pri b/src/libs/vtools/visualization/visualization.pri index 5f9aac564..2eef73604 100644 --- a/src/libs/vtools/visualization/visualization.pri +++ b/src/libs/vtools/visualization/visualization.pri @@ -42,7 +42,8 @@ HEADERS += \ $$PWD/path/vistoolpiece.h \ $$PWD/path/vistoolpiecepath.h \ $$PWD/path/vispiecespecialpoints.h \ - $$PWD/line/vistoolspecialpoint.h + $$PWD/line/vistoolspecialpoint.h \ + $$PWD/path/vistoolduplicatedetail.h SOURCES += \ $$PWD/visualization.cpp \ @@ -85,4 +86,5 @@ SOURCES += \ $$PWD/path/vistoolpiece.cpp \ $$PWD/path/vistoolpiecepath.cpp \ $$PWD/path/vispiecespecialpoints.cpp \ - $$PWD/line/vistoolspecialpoint.cpp + $$PWD/line/vistoolspecialpoint.cpp \ + $$PWD/path/vistoolduplicatedetail.cpp