From b701e0f03b37df84d2dbc7db225000af0acf078b Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 25 Jun 2024 13:08:04 +0300 Subject: [PATCH] Hide fold line when piece in full show and user doesn't want to see a mirror line. --- src/app/puzzle/scene/vpgraphicspiece.cpp | 7 ++++++- src/libs/vdxf/vdxfengine.cpp | 10 ++++++++++ src/libs/vhpgl/vhpglengine.cpp | 5 +++++ src/libs/vlayout/vlayoutpiece.cpp | 2 +- src/libs/vtools/tools/vtoolseamallowance.cpp | 16 ++++++++++------ 5 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/app/puzzle/scene/vpgraphicspiece.cpp b/src/app/puzzle/scene/vpgraphicspiece.cpp index ab96c357d..8a21b0325 100644 --- a/src/app/puzzle/scene/vpgraphicspiece.cpp +++ b/src/app/puzzle/scene/vpgraphicspiece.cpp @@ -953,8 +953,13 @@ void VPGraphicsPiece::PaintMirrorLine(QPainter *painter, const VPPiecePtr &piece //--------------------------------------------------------------------------------------------------------------------- void VPGraphicsPiece::PaintFoldLine(QPainter *painter, const VPPiecePtr &piece) { - if (piece->GetFoldLineType() == FoldLineType::None) + if (piece->GetFoldLineType() == FoldLineType::None || (piece->IsShowFullPiece() && !piece->IsShowMirrorLine())) { + if (m_foldLineLabelText != nullptr) + { + m_foldLineLabelText->setVisible(false); + } + return; } diff --git a/src/libs/vdxf/vdxfengine.cpp b/src/libs/vdxf/vdxfengine.cpp index a14c98027..6c18a972f 100644 --- a/src/libs/vdxf/vdxfengine.cpp +++ b/src/libs/vdxf/vdxfengine.cpp @@ -1266,6 +1266,11 @@ void VDxfEngine::ExportAAMADrill(const QSharedPointer &detailBloc //--------------------------------------------------------------------------------------------------------------------- void VDxfEngine::ExportAAMADrawFoldLine(const QSharedPointer &detailBlock, const VLayoutPiece &detail) { + if (detail.IsShowFullPiece() && !detail.IsShowMirrorLine()) + { + return; + } + VFoldLine const fLine = detail.FoldLine(); QVector> points = fLine.FoldLineMarkPoints(); if (points.isEmpty()) @@ -1728,6 +1733,11 @@ void VDxfEngine::ExportASTMMirrorLine(const QSharedPointer &detai //--------------------------------------------------------------------------------------------------------------------- void VDxfEngine::ExportASTMDrawFoldLine(const QSharedPointer &detailBlock, const VLayoutPiece &detail) { + if (detail.IsShowFullPiece() && !detail.IsShowMirrorLine()) + { + return; + } + VFoldLine const fLine = detail.FoldLine(); QVector> points = fLine.FoldLineMarkPoints(); if (points.isEmpty()) diff --git a/src/libs/vhpgl/vhpglengine.cpp b/src/libs/vhpgl/vhpglengine.cpp index ae2c8ebb5..2dd5bc46d 100644 --- a/src/libs/vhpgl/vhpglengine.cpp +++ b/src/libs/vhpgl/vhpglengine.cpp @@ -577,6 +577,11 @@ void VHPGLEngine::PlotMirrorLine(QTextStream &out, const VLayoutPiece &detail) //--------------------------------------------------------------------------------------------------------------------- void VHPGLEngine::PlotFoldLine(QTextStream &out, const VLayoutPiece &detail) { + if (detail.IsShowFullPiece() && !detail.IsShowMirrorLine()) + { + return; + } + VFoldLine const fLine = detail.FoldLine(); switch (detail.GetFoldLineType()) diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index b2fc869c5..cb5187a60 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -2187,7 +2187,7 @@ void VLayoutPiece::CreateFoldLineItem(QGraphicsItem *parent, bool textAsPaths) c { SCASSERT(parent != nullptr) - if (GetFoldLineType() == FoldLineType::None) + if (GetFoldLineType() == FoldLineType::None || (IsShowFullPiece() && !IsShowMirrorLine())) { return; } diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index d33728fe8..0b7df7726 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -2809,9 +2809,18 @@ auto VToolSeamAllowance::DuplicatePlaceLabels(const QVector &placeLabel //--------------------------------------------------------------------------------------------------------------------- void VToolSeamAllowance::UpdateFoldLine(const VFoldLine &foldLine) { - VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings(); const VPiece detail = VAbstractTool::data.GetPiece(m_id); + if (detail.GetFoldLineType() == FoldLineType::None || (detail.IsShowFullPiece() && !detail.IsShowMirrorLine())) + { + m_foldLineLabelText->setVisible(false); + m_foldLineMark->setPath(QPainterPath()); + m_foldLineLabel->setPath(QPainterPath()); + return; + } + + VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings(); + if (settings->GetSingleStrokeOutlineFont() || settings->GetSingleLineFonts()) { m_foldLineLabelText->setVisible(false); @@ -2841,11 +2850,6 @@ void VToolSeamAllowance::UpdateFoldLine(const VFoldLine &foldLine) m_foldLineLabel->setPath(QPainterPath()); } } - else if (detail.GetFoldLineType() == FoldLineType::None) - { - m_foldLineMark->setPath(QPainterPath()); - m_foldLineLabel->setPath(QPainterPath()); - } else { m_foldLineMark->setPath(!shape.isEmpty() ? shape.constFirst() : QPainterPath());