Dialog Duplicate Detail.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-10-25 17:49:04 +03:00
parent 3362e8a4dc
commit 9b54b0c069
25 changed files with 718 additions and 31 deletions

View File

@ -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<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "Not all tools were used in switch.");
Q_STATIC_ASSERT_X(static_cast<int>(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<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "Not all tools were used in switch.");
Q_STATIC_ASSERT_X(static_cast<int>(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<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "Not all tools were used in switch.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55, "Not all tools were used in switch.");
switch (currentItem->type())
{

View File

@ -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<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "Not all tools were used in history.");
Q_STATIC_ASSERT_X(static_cast<int>(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();
}
}

View File

@ -613,7 +613,7 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
dialogTool = QSharedPointer<Dialog>(new Dialog(pattern, 0, this));
// This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "Check if need to extend.");
Q_STATIC_ASSERT_X(static_cast<int>(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<VToolUnionDetails>(result);
doc->LiteParseTree(Document::LiteParse);
ClosedDialog<VToolUnionDetails>(result);// Avoid error: Template function as signal or slot
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolDuplicateDetail(bool checked)
{
ToolSelectDetail();
SetToolButton<DialogDuplicateDetail>(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<VMainGraphicsScene *>(currentScene);
SCASSERT(scene != nullptr)
QGraphicsItem *tool = dynamic_cast<QGraphicsItem *>(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<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "Check if all tools were connected.");
Q_STATIC_ASSERT_X(static_cast<int>(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<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "Not all tools were handled.");
Q_STATIC_ASSERT_X(static_cast<int>(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<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "Not all tools were handled.");
Q_STATIC_ASSERT_X(static_cast<int>(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<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "Not all tools were handled.");
Q_STATIC_ASSERT_X(static_cast<int>(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);

View File

@ -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);

View File

@ -48,7 +48,7 @@
<string>Export details skiping the Layout stage</string>
</property>
<property name="currentIndex">
<number>7</number>
<number>6</number>
</property>
<widget class="QWidget" name="page">
<property name="geometry">
@ -1550,6 +1550,32 @@
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QToolButton" name="toolButtonDuplicateDetail">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Duplicate detail tool</string>
</property>
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/duplicate_detail.png</normaloff>:/toolicon/32x32/duplicate_detail.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutPage">

View File

@ -86,5 +86,7 @@
<file>cursor/insert_node_cursor@2x.png</file>
<file>cursor/place_label_cursor@2x.png</file>
<file>cursor/place_label_cursor.png</file>
<file>cursor/duplicate_detail_cursor.png</file>
<file>cursor/duplicate_detail_cursor@2x.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 902 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -84,5 +84,7 @@
<file>toolicon/32x32/insert_node@2x.png</file>
<file>toolicon/32x32/place_label@2x.png</file>
<file>toolicon/32x32/place_label.png</file>
<file>toolicon/32x32/duplicate_detail.png</file>
<file>toolicon/32x32/duplicate_detail@2x.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -0,0 +1,194 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="32"
height="32"
viewBox="0 0 32 32.000001"
id="svg8396"
version="1.1"
inkscape:version="0.92.2 (unknown)"
sodipodi:docname="duplicate_detail.svg"
inkscape:export-filename="/home/dismine/CAD/Valentina_0.6.x/valentina/src/app/valentina/share/resources/toolicon/32x32/duplicate_detail.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<defs
id="defs8398">
<linearGradient
id="linearGradient2464"
osb:paint="solid">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop2462" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient9078">
<stop
style="stop-color:#84ab5a;stop-opacity:1"
offset="0"
id="stop9080" />
<stop
style="stop-color:#3b560b;stop-opacity:0.96078432"
offset="1"
id="stop9082" />
</linearGradient>
<linearGradient
id="linearGradient9060"
inkscape:collect="always">
<stop
id="stop9070"
offset="0"
style="stop-color:#bfd190;stop-opacity:1" />
<stop
id="stop9072"
offset="1"
style="stop-color:#648e2c;stop-opacity:1" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient9060"
id="linearGradient9066"
x1="24.510012"
y1="1037.5343"
x2="24.510012"
y2="1050.8309"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-9.5,-0.5)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient9060"
id="linearGradient9076"
gradientUnits="userSpaceOnUse"
x1="24.189611"
y1="17.372341"
x2="24.189611"
y2="30.428661"
gradientTransform="translate(-9.5,-0.5)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient9078"
id="linearGradient9084"
x1="27.273466"
y1="16.050688"
x2="27.453691"
y2="30.668961"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-9.5,-0.5)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient9060"
id="linearGradient9086"
gradientUnits="userSpaceOnUse"
x1="24.510012"
y1="1037.5343"
x2="24.510012"
y2="1050.8309"
gradientTransform="translate(-9.5,-0.5)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient9060"
id="linearGradient9088"
gradientUnits="userSpaceOnUse"
x1="24.510012"
y1="1037.5343"
x2="24.510012"
y2="1050.8309"
gradientTransform="translate(-9.5,-0.5)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient9060"
id="linearGradient9090"
gradientUnits="userSpaceOnUse"
x1="24.510012"
y1="1037.5343"
x2="24.510012"
y2="1050.8309"
gradientTransform="translate(-9.5,-0.5)" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="8.8277862"
inkscape:cx="-30.633024"
inkscape:cy="14.30082"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
units="px"
inkscape:window-width="1855"
inkscape:window-height="1056"
inkscape:window-x="65"
inkscape:window-y="24"
inkscape:window-maximized="1" />
<metadata
id="metadata8401">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-1020.3622)">
<path
style="fill:#ffffff;fill-rule:evenodd;stroke:#000000;stroke-width:0.25;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
d="m 18.253934,1026.4091 c -2.709075,-1.0524 -3.884497,-2.8171 -4.25,-6 l -8.9999995,4 c 1.6204375,5.4081 2.7946849,13.9946 -4,13 l -1.00000002,12.097 9.00000002,1.903 2.9999995,-10 2,10.25 h 4.25 z"
id="path8501"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccccc" />
<path
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.25;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 27.503934,1026.6591 c -2.709075,-1.0524 -3.884497,-2.8171 -4.25,-6 l -9,4 c 1.620438,5.4081 2.794685,13.9946 -4,13 l -1,12.097 9,1.903 3,-10 2,10.25 h 4.25 z"
id="path8501-3"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccccc" />
<g
id="g9054"
style="fill:url(#linearGradient9066);fill-opacity:1;fill-rule:nonzero"
transform="translate(-0.42188663,0.7488442)">
<path
id="rect9043"
transform="translate(0,1020.3622)"
d="M 22.761719,16 C 22.340152,16 22,16.340152 22,16.761719 V 21 H 17.761719 C 17.340152,21 17,21.340152 17,21.761719 v 3.476562 C 17,25.659848 17.340152,26 17.761719,26 H 22 v 4.238281 C 22,30.659848 22.340152,31 22.761719,31 h 3.476562 C 26.659848,31 27,30.659848 27,30.238281 V 26 h 4.238281 C 31.659848,26 32,25.659848 32,25.238281 V 21.761719 C 32,21.340152 31.659848,21 31.238281,21 H 27 V 16.761719 C 27,16.340152 26.659848,16 26.238281,16 Z"
style="fill:url(#linearGradient9076);fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient9084);stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
id="path9048"
d="m 17.902378,1042.2696 h 4.165206"
style="fill:url(#linearGradient9086);fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:url(#linearGradient9088);fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
d="m 26.953692,1042.2696 h 4.165206"
id="path9050"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
id="path9052"
d="m 22.922949,1037.1832 h 3.175378"
style="fill:url(#linearGradient9090);fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@ -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<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "Not all tools were used.");
Q_STATIC_ASSERT_X(static_cast<int>(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;
}
}

View File

@ -1771,7 +1771,7 @@ QVector<VFormulaField> 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<int>(Tool::LAST_ONE_DO_NOT_USE) == 54);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55);
QVector<VFormulaField> expressions;
const QDomNodeList list = elementsByTagName(TagPoint);
@ -1799,7 +1799,7 @@ QVector<VFormulaField> 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<int>(Tool::LAST_ONE_DO_NOT_USE) == 54);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55);
QVector<VFormulaField> expressions;
const QDomNodeList list = elementsByTagName(TagArc);
@ -1823,7 +1823,7 @@ QVector<VFormulaField> 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<int>(Tool::LAST_ONE_DO_NOT_USE) == 54);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55);
QVector<VFormulaField> expressions;
const QDomNodeList list = elementsByTagName(TagElArc);
@ -1856,7 +1856,7 @@ QVector<VFormulaField> 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<int>(Tool::LAST_ONE_DO_NOT_USE) == 54);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55);
QVector<VFormulaField> expressions;
const QDomNodeList list = elementsByTagName(AttrPathPoint);
@ -1894,7 +1894,7 @@ QVector<VFormulaField> 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<int>(Tool::LAST_ONE_DO_NOT_USE) == 54);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55);
QVector<VFormulaField> expressions;
const QDomNodeList list = elementsByTagName(TagOperation);
@ -1916,7 +1916,7 @@ QVector<VFormulaField> 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<int>(Tool::LAST_ONE_DO_NOT_USE) == 54);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55);
QVector<VFormulaField> expressions;
@ -1939,7 +1939,7 @@ QVector<VFormulaField> 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<int>(Tool::LAST_ONE_DO_NOT_USE) == 54);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55);
QVector<VFormulaField> expressions;
const QDomNodeList list = elementsByTagName(TagPath);
@ -1977,7 +1977,7 @@ QVector<VFormulaField> 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<int>(Tool::LAST_ONE_DO_NOT_USE) == 54);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55);
QVector<VFormulaField> expressions;
const QDomNodeList list = elementsByTagName(TagDetail);

View File

@ -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,

View File

@ -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

View File

@ -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"

View File

@ -0,0 +1,93 @@
/************************************************************************
**
** @file dialogduplicatedetail.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @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
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#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<VisToolDuplicateDetail *>(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;
}
}
}

View File

@ -0,0 +1,80 @@
/************************************************************************
**
** @file dialogduplicatedetail.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @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
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#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

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogDuplicateDetail</class>
<widget class="QDialog" name="DialogDuplicateDetail">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>184</width>
<height>66</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog duplicate detail</string>
</property>
<property name="windowIcon">
<iconset resource="../../../../vmisc/share/resources/icon.qrc">
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string notr="true">The dialog is never shown.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../../../vmisc/share/resources/icon.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogDuplicateDetail</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>DialogDuplicateDetail</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -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<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(not dialog.isNull());
QSharedPointer<DialogDuplicateDetail> dialogTool = dialog.objectCast<DialogDuplicateDetail>();
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;
}

View File

@ -64,6 +64,9 @@ public:
static VToolSeamAllowance* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolSeamAllowance* Create(VToolSeamAllowanceInitData &initData);
static VToolSeamAllowance* Duplicate(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolSeamAllowance* Duplicate(VToolSeamAllowanceInitData &initData);
static const quint8 pieceVersion;

View File

@ -0,0 +1,69 @@
/************************************************************************
**
** @file vistoolduplicatedetail.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @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
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#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);
}
}

View File

@ -0,0 +1,68 @@
/************************************************************************
**
** @file vistoolduplicatedetail.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @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
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#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<int>(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

View File

@ -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