Fixed issue #307. Valentina enables wrong pattern piece after deleting curve.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-05-25 09:24:16 +03:00
parent 8e3ef70859
commit 8980db725d
15 changed files with 41 additions and 25 deletions

View File

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

View File

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

View File

@ -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:
/**

View File

@ -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()
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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