diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp index 788004b4b..e38a66335 100644 --- a/src/app/mainwindow.cpp +++ b/src/app/mainwindow.cpp @@ -1798,8 +1798,8 @@ void MainWindow::SetEnableWidgets(bool enable) ui->actionLayout->setEnabled(enable); } - //Now we want allow user call context menu - sceneDraw->SetDisable(!enable); + //Now we don't want allow user call context menu + sceneDraw->SetDisableTools(!enable, doc->GetNameActivPP()); ui->view->setEnabled(enable); } diff --git a/src/app/tools/drawTools/vabstractspline.cpp b/src/app/tools/drawTools/vabstractspline.cpp index 7c3fdea87..ab0845301 100644 --- a/src/app/tools/drawTools/vabstractspline.cpp +++ b/src/app/tools/drawTools/vabstractspline.cpp @@ -71,9 +71,9 @@ void VAbstractSpline::FullUpdateFromFile() } //--------------------------------------------------------------------------------------------------------------------- -void VAbstractSpline::Disable(bool disable) +void VAbstractSpline::Disable(bool disable, const QString &namePP) { - enabled = !disable; + enabled = !CorrectDisable(disable, namePP); this->setEnabled(enabled); this->setPen(QPen(CorrectColor(lineColor), qApp->toPixel(qApp->widthHairLine())/factor, Qt::SolidLine, Qt::RoundCap)); diff --git a/src/app/tools/drawTools/vabstractspline.h b/src/app/tools/drawTools/vabstractspline.h index 47a2d3cd9..9dfa79d57 100644 --- a/src/app/tools/drawTools/vabstractspline.h +++ b/src/app/tools/drawTools/vabstractspline.h @@ -51,7 +51,7 @@ public: public slots: virtual void FullUpdateFromFile (); - virtual void Disable(bool disable); + virtual void Disable(bool disable, const QString &namePP); void DetailsMode(bool mode); signals: /** diff --git a/src/app/tools/drawTools/vdrawtool.cpp b/src/app/tools/drawTools/vdrawtool.cpp index 105deb80a..04fc9aa99 100644 --- a/src/app/tools/drawTools/vdrawtool.cpp +++ b/src/app/tools/drawTools/vdrawtool.cpp @@ -79,7 +79,7 @@ void VDrawTool::ShowTool(quint32 id, bool enable) */ void VDrawTool::ChangedActivDraw(const QString &newName) { - Disable(!(nameActivDraw == newName)); + Disable(!(nameActivDraw == newName), newName); } //--------------------------------------------------------------------------------------------------------------------- @@ -183,6 +183,19 @@ QColor VDrawTool::CorrectColor(const QColor &color) const } } +//--------------------------------------------------------------------------------------------------------------------- +bool VDrawTool::CorrectDisable(bool disable, const QString &namePP) const +{ + if (disable) + { + return disable; + } + else + { + return !(nameActivDraw == namePP); + } +} + //--------------------------------------------------------------------------------------------------------------------- void VDrawTool::ReadAttributes() { diff --git a/src/app/tools/drawTools/vdrawtool.h b/src/app/tools/drawTools/vdrawtool.h index 0cba1d09d..819f9c0f0 100644 --- a/src/app/tools/drawTools/vdrawtool.h +++ b/src/app/tools/drawTools/vdrawtool.h @@ -70,7 +70,7 @@ public slots: virtual void FullUpdateFromGuiApply(); virtual void SetFactor(qreal factor); virtual void EnableToolMove(bool move); - virtual void Disable(bool disable)=0; + virtual void Disable(bool disable, const QString &namePP)=0; protected: /** @brief nameActivDraw name of tool's pattern peace. */ @@ -94,7 +94,9 @@ protected: void SaveDialogChange(); virtual void AddToFile(); virtual void RefreshDataInFile(); + QColor CorrectColor(const QColor &color) const; + bool CorrectDisable(bool disable, const QString &namePP) const; void ReadAttributes(); virtual void ReadToolAttributes(const QDomElement &domElement)=0; diff --git a/src/app/tools/drawTools/vtoolcut.cpp b/src/app/tools/drawTools/vtoolcut.cpp index e5244e38e..b34a3bc10 100644 --- a/src/app/tools/drawTools/vtoolcut.cpp +++ b/src/app/tools/drawTools/vtoolcut.cpp @@ -68,9 +68,9 @@ void VToolCut::HoverPath(quint32 id, SimpleCurvePoint curvePosition, PathDirecti } //--------------------------------------------------------------------------------------------------------------------- -void VToolCut::Disable(bool disable) +void VToolCut::Disable(bool disable, const QString &namePP) { - VToolPoint::Disable(disable); + VToolPoint::Disable(disable, namePP); firstCurve->ChangedActivDraw(enabled); secondCurve->ChangedActivDraw(enabled); } diff --git a/src/app/tools/drawTools/vtoolcut.h b/src/app/tools/drawTools/vtoolcut.h index 6952a33bb..5eeec0dbd 100644 --- a/src/app/tools/drawTools/vtoolcut.h +++ b/src/app/tools/drawTools/vtoolcut.h @@ -53,7 +53,7 @@ public: public slots: virtual void CurveChoosed(quint32 id)=0; void HoverPath(quint32 id, SimpleCurvePoint curvePosition, PathDirection direction); - virtual void Disable(bool disable); + virtual void Disable(bool disable, const QString &namePP); void DetailsMode(bool mode); protected: /** @brief formula keep formula of length */ diff --git a/src/app/tools/drawTools/vtoolline.cpp b/src/app/tools/drawTools/vtoolline.cpp index 6a189a715..cdc174e31 100644 --- a/src/app/tools/drawTools/vtoolline.cpp +++ b/src/app/tools/drawTools/vtoolline.cpp @@ -221,11 +221,12 @@ void VToolLine::SetFactor(qreal factor) } //--------------------------------------------------------------------------------------------------------------------- -void VToolLine::Disable(bool disable) +void VToolLine::Disable(bool disable, const QString &namePP) { - enabled = !disable; + enabled = !CorrectDisable(disable, namePP); this->setEnabled(enabled); - this->setPen(QPen(QColor(baseColor), qApp->toPixel(qApp->widthHairLine())/factor, LineStyleToPenStyle(typeLine))); + this->setPen(QPen(CorrectColor(baseColor), qApp->toPixel(qApp->widthHairLine())/factor, + LineStyleToPenStyle(typeLine))); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/tools/drawTools/vtoolline.h b/src/app/tools/drawTools/vtoolline.h index 8092d3c83..733995acf 100644 --- a/src/app/tools/drawTools/vtoolline.h +++ b/src/app/tools/drawTools/vtoolline.h @@ -66,7 +66,7 @@ public slots: virtual void FullUpdateFromFile(); virtual void ShowTool(quint32 id, bool enable); virtual void SetFactor(qreal factor); - virtual void Disable(bool disable); + virtual void Disable(bool disable, const QString &namePP); protected: virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void AddToFile(); diff --git a/src/app/tools/drawTools/vtoollinepoint.cpp b/src/app/tools/drawTools/vtoollinepoint.cpp index 282783ead..32423b392 100644 --- a/src/app/tools/drawTools/vtoollinepoint.cpp +++ b/src/app/tools/drawTools/vtoollinepoint.cpp @@ -99,10 +99,10 @@ void VToolLinePoint::SetFactor(qreal factor) } //--------------------------------------------------------------------------------------------------------------------- -void VToolLinePoint::Disable(bool disable) +void VToolLinePoint::Disable(bool disable, const QString &namePP) { - VToolPoint::Disable(disable); - mainLine->setPen(QPen(QColor(lineColor), qApp->toPixel(qApp->widthHairLine())/factor, + VToolPoint::Disable(disable, namePP); + mainLine->setPen(QPen(CorrectColor(lineColor), qApp->toPixel(qApp->widthHairLine())/factor, LineStyleToPenStyle(typeLine))); mainLine->setEnabled(enabled); } diff --git a/src/app/tools/drawTools/vtoollinepoint.h b/src/app/tools/drawTools/vtoollinepoint.h index b48a056bb..12b7c260e 100644 --- a/src/app/tools/drawTools/vtoollinepoint.h +++ b/src/app/tools/drawTools/vtoollinepoint.h @@ -56,7 +56,7 @@ public: public slots: virtual void SetFactor(qreal factor); - virtual void Disable(bool disable); + virtual void Disable(bool disable, const QString &namePP); protected: /** @brief formula string with length formula. */ QString formulaLength; diff --git a/src/app/tools/drawTools/vtoolpoint.cpp b/src/app/tools/drawTools/vtoolpoint.cpp index 635bceb89..30644692e 100644 --- a/src/app/tools/drawTools/vtoolpoint.cpp +++ b/src/app/tools/drawTools/vtoolpoint.cpp @@ -163,9 +163,9 @@ void VToolPoint::SetFactor(qreal factor) } //--------------------------------------------------------------------------------------------------------------------- -void VToolPoint::Disable(bool disable) +void VToolPoint::Disable(bool disable, const QString &namePP) { - enabled = !disable; + enabled = !CorrectDisable(disable, namePP); this->setEnabled(enabled); namePoint->setEnabled(enabled); } diff --git a/src/app/tools/drawTools/vtoolpoint.h b/src/app/tools/drawTools/vtoolpoint.h index 092fd243d..a3e00f345 100644 --- a/src/app/tools/drawTools/vtoolpoint.h +++ b/src/app/tools/drawTools/vtoolpoint.h @@ -55,7 +55,7 @@ public slots: void NameChangePosition(const QPointF &pos); virtual void ShowTool(quint32 id, bool enable); virtual void SetFactor(qreal factor); - virtual void Disable(bool disable); + virtual void Disable(bool disable, const QString &namePP); void DeleteFromLabel(); virtual void EnableToolMove(bool move); void PointChoosed(); diff --git a/src/app/widgets/vmaingraphicsscene.cpp b/src/app/widgets/vmaingraphicsscene.cpp index 464805c76..ad84b48ec 100644 --- a/src/app/widgets/vmaingraphicsscene.cpp +++ b/src/app/widgets/vmaingraphicsscene.cpp @@ -100,9 +100,9 @@ void VMainGraphicsScene::setTransform(const QTransform &transform) } //--------------------------------------------------------------------------------------------------------------------- -void VMainGraphicsScene::SetDisable(bool disable) +void VMainGraphicsScene::SetDisableTools(bool disable, const QString &namePP) { - emit DisableItem(disable); + emit DisableItem(disable, namePP); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/widgets/vmaingraphicsscene.h b/src/app/widgets/vmaingraphicsscene.h index 3d9295384..111e88755 100644 --- a/src/app/widgets/vmaingraphicsscene.h +++ b/src/app/widgets/vmaingraphicsscene.h @@ -47,7 +47,7 @@ public: void setVerScrollBar(const qint32 &value); QTransform transform() const; void setTransform(const QTransform &transform); - void SetDisable(bool enabled); + void SetDisableTools(bool enabled, const QString &namePP); QPointF getScenePos() const; public slots: void ChoosedItem(quint32 id, const SceneObject &type); @@ -79,7 +79,7 @@ signals: * @param factor scene scale factor. */ void NewFactor(qreal factor); - void DisableItem(bool disable); + void DisableItem(bool disable, const QString &namePP); void EnableToolMove(bool move); void CurveDetailsMode(bool mode); private: