Refactoring undocommands. Fix deletion node.

--HG--
branch : develop
This commit is contained in:
dismine 2014-07-16 15:37:38 +03:00
parent d3624f7060
commit d7dfcb8898
33 changed files with 346 additions and 333 deletions

View File

@ -183,7 +183,7 @@ void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, cons
UpdateControlPoints(spl, newSplPath, indexSpline);
MoveSplinePath *moveSplPath = new MoveSplinePath(doc, oldSplPath, newSplPath, id, this->scene());
connect(moveSplPath, &MoveSplinePath::NeedLiteParsing, doc, &VPattern::LiteParseTree);
connect(moveSplPath, &VUndoCommand::NeedLiteParsing, doc, &VPattern::LiteParseTree);
qApp->getUndoStack()->push(moveSplPath);
}

View File

@ -31,9 +31,10 @@
//---------------------------------------------------------------------------------------------------------------------
AddDet::AddDet(const QDomElement &xml, VPattern *doc, QUndoCommand *parent)
: QObject(), QUndoCommand(parent), xml(xml), doc(doc), redoFlag(false)
: VUndoCommand(xml, doc, parent)
{
setText(tr("Add detail"));
nodeId = doc->GetParametrId(xml);
}
//---------------------------------------------------------------------------------------------------------------------
@ -47,7 +48,20 @@ void AddDet::undo()
QDomElement element;
if (doc->GetActivNodeElement(VPattern::TagDetails, element))
{
element.removeChild(xml);
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
if (domElement.isElement())
{
if (element.removeChild(domElement).isNull())
{
qDebug()<<"Can't delete node";
return;
}
}
else
{
qDebug()<<"Can't get node by id = "<<nodeId<<Q_FUNC_INFO;
return;
}
}
else
{
@ -71,9 +85,5 @@ void AddDet::redo()
qDebug()<<"Can't find tag"<<VPattern::TagDetails<< Q_FUNC_INFO;
return;
}
if (redoFlag)
{
emit NeedFullParsing();
}
redoFlag = true;
RedoFullParsing();
}

View File

@ -29,12 +29,11 @@
#ifndef ADDDET_H
#define ADDDET_H
#include <QDomElement>
#include <QUndoCommand>
#include "vundocommand.h"
class VPattern;
class AddDet : public QObject, public QUndoCommand
class AddDet : public VUndoCommand
{
Q_OBJECT
public:
@ -44,13 +43,8 @@ public:
virtual void undo();
// cppcheck-suppress unusedFunction
virtual void redo();
signals:
void NeedFullParsing();
private:
Q_DISABLE_COPY(AddDet)
const QDomElement xml;
VPattern *doc;
bool redoFlag;
};
#endif // ADDDET_H

View File

@ -31,9 +31,10 @@
//---------------------------------------------------------------------------------------------------------------------
AddDetNode::AddDetNode(const QDomElement &xml, VPattern *doc, QUndoCommand *parent)
: QUndoCommand(parent), xml(xml), doc(doc)
: VUndoCommand(xml, doc, parent)
{
setText(QObject::tr("Add node"));
nodeId = doc->GetParametrId(xml);
}
//---------------------------------------------------------------------------------------------------------------------
@ -46,7 +47,20 @@ void AddDetNode::undo()
QDomElement modelingElement;
if (doc->GetActivNodeElement(VPattern::TagModeling, modelingElement))
{
modelingElement.removeChild(xml);
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
if (domElement.isElement())
{
if (modelingElement.removeChild(domElement).isNull())
{
qDebug()<<"Can't delete node";
return;
}
}
else
{
qDebug()<<"Can't get node by id = "<<nodeId<<Q_FUNC_INFO;
return;
}
}
else
{

View File

@ -29,13 +29,11 @@
#ifndef ADDDETNODE_H
#define ADDDETNODE_H
#include <QDomElement>
#include <QUndoCommand>
#include "vundocommand.h"
class VPattern;
class AddDetNode : public QUndoCommand
class AddDetNode : public VUndoCommand
{
Q_OBJECT
public:
AddDetNode(const QDomElement &xml, VPattern *doc, QUndoCommand *parent = 0);
virtual ~AddDetNode();
@ -43,8 +41,6 @@ public:
virtual void redo();
private:
Q_DISABLE_COPY(AddDetNode)
const QDomElement xml;
VPattern *doc;
};
#endif // ADDDETNODE_H

View File

@ -32,9 +32,8 @@
//---------------------------------------------------------------------------------------------------------------------
AddPatternPiece::AddPatternPiece(const QDomElement &xml, VPattern *doc, const QString &namePP, const QString &mPath,
QUndoCommand *parent)
: QObject(), QUndoCommand(parent), xml(xml), doc(doc), namePP(namePP), redoFlag(false), mPath(mPath)
: VUndoCommand(xml, doc, parent), namePP(namePP), mPath(mPath)
{
SCASSERT(xml.isNull() == false);
SCASSERT(namePP.isEmpty() == false);
SCASSERT(mPath.isEmpty() == false);
setText(tr("Add pattern piece %1").arg(namePP));
@ -72,9 +71,5 @@ void AddPatternPiece::redo()
rootElement.appendChild(xml);
if (redoFlag)
{
emit NeedFullParsing();
}
redoFlag = true;
RedoFullParsing();
}

View File

@ -29,12 +29,9 @@
#ifndef ADDPATTERNPIECE_H
#define ADDPATTERNPIECE_H
#include <QDomElement>
#include <QUndoCommand>
#include "vundocommand.h"
class VPattern;
class AddPatternPiece : public QObject, public QUndoCommand
class AddPatternPiece : public VUndoCommand
{
Q_OBJECT
public:
@ -43,15 +40,9 @@ public:
virtual ~AddPatternPiece();
virtual void undo();
virtual void redo();
signals:
void ClearScene();
void NeedFullParsing();
private:
Q_DISABLE_COPY(AddPatternPiece)
const QDomElement xml;
VPattern *doc;
QString namePP;
bool redoFlag;
QString mPath;
};

View File

@ -31,10 +31,10 @@
//---------------------------------------------------------------------------------------------------------------------
AddToCalc::AddToCalc(const QDomElement &xml, VPattern *doc, QUndoCommand *parent)
: QObject(), QUndoCommand(parent), xml(xml), doc(doc), nameActivDraw(doc->GetNameActivDraw()),
cursor(doc->getCursor()), redoFlag(false)
: VUndoCommand(xml, doc, parent), nameActivDraw(doc->GetNameActivDraw()), cursor(doc->getCursor())
{
setText(tr("Add object"));
nodeId = doc->GetParametrId(xml);
}
//---------------------------------------------------------------------------------------------------------------------
@ -50,10 +50,19 @@ void AddToCalc::undo()
QDomElement calcElement;
if (doc->GetActivNodeElement(VPattern::TagCalculation, calcElement))
{
calcElement.removeChild(xml);
if (cursor > 0)
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
if (domElement.isElement())
{
doc->setCursor(0);
if (calcElement.removeChild(domElement).isNull())
{
qDebug()<<"Can't delete node";
return;
}
}
else
{
qDebug()<<"Can't get tool by id = "<<nodeId<<Q_FUNC_INFO;
return;
}
}
else
@ -61,6 +70,10 @@ void AddToCalc::undo()
qDebug()<<"Can't find tag Calculation"<< Q_FUNC_INFO;
return;
}
if (cursor > 0)
{
doc->setCursor(0);
}
emit NeedFullParsing();
}
@ -97,9 +110,5 @@ void AddToCalc::redo()
qDebug()<<"Can't find tag Calculation"<< Q_FUNC_INFO;
return;
}
if (redoFlag)
{
emit NeedFullParsing();
}
redoFlag = true;
RedoFullParsing();
}

View File

@ -29,12 +29,9 @@
#ifndef ADDTOCALC_H
#define ADDTOCALC_H
#include <QDomElement>
#include <QUndoCommand>
#include "vundocommand.h"
class VPattern;
class AddToCalc : public QObject, public QUndoCommand
class AddToCalc : public VUndoCommand
{
Q_OBJECT
public:
@ -42,15 +39,10 @@ public:
virtual ~AddToCalc();
virtual void undo();
virtual void redo();
signals:
void NeedFullParsing();
private:
Q_DISABLE_COPY(AddToCalc)
const QDomElement xml;
VPattern *doc;
const QString nameActivDraw;
quint32 cursor;
bool redoFlag;
};
#endif // ADDTOCALC_H

View File

@ -31,9 +31,10 @@
//---------------------------------------------------------------------------------------------------------------------
AddUnionDetails::AddUnionDetails(const QDomElement &xml, VPattern *doc, QUndoCommand *parent)
: QObject(), QUndoCommand(parent), xml(xml), doc(doc), redoFlag(false)
: VUndoCommand(xml, doc, parent)
{
setText(tr("Add union details"));
nodeId = doc->GetParametrId(xml);
}
//---------------------------------------------------------------------------------------------------------------------
@ -46,7 +47,20 @@ void AddUnionDetails::undo()
QDomElement modelingElement;
if (doc->GetActivNodeElement(VPattern::TagModeling, modelingElement))
{
modelingElement.removeChild(xml);
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
if (domElement.isElement())
{
if (modelingElement.removeChild(domElement).isNull())
{
qDebug()<<"Can't delete node";
return;
}
}
else
{
qDebug()<<"Can't get node by id = "<<nodeId<<Q_FUNC_INFO;
return;
}
}
else
{
@ -69,9 +83,5 @@ void AddUnionDetails::redo()
qDebug()<<"Can't find tag"<<VPattern::TagModeling<< Q_FUNC_INFO;
return;
}
if (redoFlag)
{
emit NeedFullParsing();
}
redoFlag = true;
RedoFullParsing();
}

View File

@ -29,12 +29,9 @@
#ifndef ADDUNIONDETAILS_H
#define ADDUNIONDETAILS_H
#include <QDomElement>
#include <QUndoCommand>
#include "vundocommand.h"
class VPattern;
class AddUnionDetails : public QObject, public QUndoCommand
class AddUnionDetails : public VUndoCommand
{
Q_OBJECT
public:
@ -42,13 +39,8 @@ public:
virtual ~AddUnionDetails();
virtual void undo();
virtual void redo();
signals:
void NeedFullParsing();
private:
Q_DISABLE_COPY(AddUnionDetails)
const QDomElement xml;
VPattern *doc;
bool redoFlag;
};
#endif // ADDUNIONDETAILS_H

View File

@ -32,9 +32,10 @@
//---------------------------------------------------------------------------------------------------------------------
DeleteDetail::DeleteDetail(VPattern *doc, quint32 id, QUndoCommand *parent)
: QObject(), QUndoCommand(parent), xml(QDomElement()), doc(doc), detId(id), parentNode(QDomNode())
: VUndoCommand(xml, doc, parent), parentNode(QDomNode())
{
setText(tr("Delete tool"));
nodeId = id;
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
@ -43,7 +44,7 @@ DeleteDetail::DeleteDetail(VPattern *doc, quint32 id, QUndoCommand *parent)
}
else
{
qDebug()<<"Can't get detail by id = "<<detId<<Q_FUNC_INFO;
qDebug()<<"Can't get detail by id = "<<nodeId<<Q_FUNC_INFO;
return;
}
}
@ -62,7 +63,7 @@ void DeleteDetail::undo()
//---------------------------------------------------------------------------------------------------------------------
void DeleteDetail::redo()
{
QDomElement domElement = doc->elementById(QString().setNum(detId));
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
if (domElement.isElement())
{
parentNode.removeChild(domElement);
@ -70,7 +71,7 @@ void DeleteDetail::redo()
//When UnionDetail delete detail we can't use FullParsing. So we hide detail on scene directly.
QHash<quint32, VDataTool*>* tools = doc->getTools();
SCASSERT(tools != nullptr);
VToolDetail *toolDet = qobject_cast<VToolDetail*>(tools->value(detId));
VToolDetail *toolDet = qobject_cast<VToolDetail*>(tools->value(nodeId));
SCASSERT(toolDet != nullptr);
toolDet->hide();
@ -78,7 +79,7 @@ void DeleteDetail::redo()
}
else
{
qDebug()<<"Can't get detail by id = "<<detId<<Q_FUNC_INFO;
qDebug()<<"Can't get detail by id = "<<nodeId<<Q_FUNC_INFO;
return;
}
}

View File

@ -29,13 +29,10 @@
#ifndef DELETEDETAIL_H
#define DELETEDETAIL_H
#include <QDomElement>
#include <QUndoCommand>
class VPattern;
#include "vundocommand.h"
class QGraphicsItem;
class DeleteDetail : public QObject, public QUndoCommand
class DeleteDetail : public VUndoCommand
{
Q_OBJECT
public:
@ -43,13 +40,8 @@ public:
virtual ~DeleteDetail();
virtual void undo();
virtual void redo();
signals:
void NeedFullParsing();
private:
Q_DISABLE_COPY(DeleteDetail)
QDomElement xml;
VPattern *doc;
quint32 detId;
QDomNode parentNode;
};

View File

@ -32,15 +32,16 @@
//---------------------------------------------------------------------------------------------------------------------
DeletePatternPiece::DeletePatternPiece(VPattern *doc, const QString &namePP, QUndoCommand *parent)
: QObject(), QUndoCommand(parent), doc(doc), namePP(namePP), patternPiece(QDomElement()), mPath(QString()),
previousNode(QDomNode())
: VUndoCommand(QDomElement(), doc, parent), namePP(namePP), patternPiece(QDomElement()), mPath(QString()),
previousPPName(QString())
{
setText(tr("Delete pattern piece %1").arg(namePP));
QDomElement patternP= doc->GetPPElement(namePP);
QDomElement patternP = doc->GetPPElement(namePP);
patternPiece = patternP.cloneNode().toElement();
mPath = doc->MPath();
previousNode = patternP.previousSibling();//find previous pattern piece
QDomNode previousPP = patternP.previousSibling();//find previous pattern piece
previousPPName = doc->GetParametrString(previousPP.toElement(), VPattern::AttrName, "");
}
//---------------------------------------------------------------------------------------------------------------------
@ -51,7 +52,8 @@ DeletePatternPiece::~DeletePatternPiece()
void DeletePatternPiece::undo()
{
QDomElement rootElement = doc->documentElement();
rootElement.insertAfter(patternPiece, previousNode);
QDomNode previousPP = doc->GetPPElement(previousPPName);
rootElement.insertAfter(patternPiece, previousPP);
emit NeedFullParsing();
doc->ChangedActivPP(namePP);

View File

@ -29,12 +29,9 @@
#ifndef DELETEPATTERNPIECE_H
#define DELETEPATTERNPIECE_H
#include <QDomElement>
#include <QUndoCommand>
#include "vundocommand.h"
class VPattern;
class DeletePatternPiece : public QObject, public QUndoCommand
class DeletePatternPiece : public VUndoCommand
{
Q_OBJECT
public:
@ -42,15 +39,12 @@ public:
virtual ~DeletePatternPiece();
virtual void undo();
virtual void redo();
signals:
void NeedFullParsing();
private:
Q_DISABLE_COPY(DeletePatternPiece)
VPattern *doc;
QString namePP;
QDomElement patternPiece;
QString mPath;
QDomNode previousNode;
QString previousPPName;
};
#endif // DELETEPATTERNPIECE_H

View File

@ -33,10 +33,10 @@
//---------------------------------------------------------------------------------------------------------------------
DelTool::DelTool(VPattern *doc, quint32 id, QUndoCommand *parent)
: QObject(), QUndoCommand(parent), xml(QDomElement()), parentNode(QDomNode()), doc(doc), toolId(id),
cursor(doc->getCursor())
: VUndoCommand(QDomElement(), doc, parent), parentNode(QDomNode()), cursor(doc->getCursor())
{
setText(tr("Delete tool"));
nodeId = id;
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
@ -45,7 +45,7 @@ DelTool::DelTool(VPattern *doc, quint32 id, QUndoCommand *parent)
}
else
{
qDebug()<<"Can't get tool by id = "<<toolId<<Q_FUNC_INFO;
qDebug()<<"Can't get tool by id = "<<nodeId<<Q_FUNC_INFO;
return;
}
}
@ -75,7 +75,7 @@ void DelTool::undo()
//---------------------------------------------------------------------------------------------------------------------
void DelTool::redo()
{
QDomElement domElement = doc->elementById(QString().setNum(toolId));
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
if (domElement.isElement())
{
parentNode.removeChild(domElement);
@ -83,7 +83,7 @@ void DelTool::redo()
}
else
{
qDebug()<<"Can't get tool by id = "<<toolId<<Q_FUNC_INFO;
qDebug()<<"Can't get tool by id = "<<nodeId<<Q_FUNC_INFO;
return;
}
}

View File

@ -29,13 +29,10 @@
#ifndef DELTOOL_H
#define DELTOOL_H
#include <QDomElement>
#include <QUndoCommand>
class VPattern;
#include "vundocommand.h"
class QGraphicsItem;
class DelTool : public QObject, public QUndoCommand
class DelTool : public VUndoCommand
{
Q_OBJECT
public:
@ -43,14 +40,9 @@ public:
virtual ~DelTool();
virtual void undo();
virtual void redo();
signals:
void NeedFullParsing();
private:
Q_DISABLE_COPY(DelTool)
QDomElement xml;
QDomNode parentNode;
VPattern *doc;
quint32 toolId;
quint32 cursor;
};

View File

@ -32,15 +32,14 @@
#include "../xml/vpattern.h"
#include "../tools/vabstracttool.h"
#include "../widgets/vapplication.h"
#include "undocommands.h"
//---------------------------------------------------------------------------------------------------------------------
MoveDetail::MoveDetail(VPattern *doc, const double &x, const double &y, const quint32 &id, QGraphicsScene *scene,
QUndoCommand *parent)
: QObject(), QUndoCommand(parent), doc(doc), oldX(0.0), oldY(0.0), newX(x), newY(y), detId(id), scene(scene),
redoFlag(false)
: VUndoCommand(QDomElement(), doc, parent), oldX(0.0), oldY(0.0), newX(x), newY(y), scene(scene)
{
setText(QObject::tr("Move detail"));
nodeId = id;
SCASSERT(scene != nullptr);
QDomElement domElement = doc->elementById(QString().setNum(id));
@ -51,7 +50,7 @@ MoveDetail::MoveDetail(VPattern *doc, const double &x, const double &y, const qu
}
else
{
qDebug()<<"Can't find detail with id ="<< detId << Q_FUNC_INFO;
qDebug()<<"Can't find detail with id ="<< nodeId << Q_FUNC_INFO;
return;
}
}
@ -63,11 +62,10 @@ MoveDetail::~MoveDetail()
//---------------------------------------------------------------------------------------------------------------------
void MoveDetail::undo()
{
QDomElement domElement = doc->elementById(QString().setNum(detId));
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
if (domElement.isElement())
{
doc->SetAttribute(domElement, VAbstractTool::AttrMx, QString().setNum(qApp->fromPixel(oldX)));
doc->SetAttribute(domElement, VAbstractTool::AttrMy, QString().setNum(qApp->fromPixel(oldY)));
SaveCoordinates(domElement, oldX, oldY);
emit NeedLiteParsing();
@ -76,7 +74,7 @@ void MoveDetail::undo()
}
else
{
qDebug()<<"Can't find detail with id ="<< detId << Q_FUNC_INFO;
qDebug()<<"Can't find detail with id ="<< nodeId << Q_FUNC_INFO;
return;
}
}
@ -84,11 +82,10 @@ void MoveDetail::undo()
//---------------------------------------------------------------------------------------------------------------------
void MoveDetail::redo()
{
QDomElement domElement = doc->elementById(QString().setNum(detId));
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
if (domElement.isElement())
{
doc->SetAttribute(domElement, VAbstractTool::AttrMx, QString().setNum(qApp->fromPixel(newX)));
doc->SetAttribute(domElement, VAbstractTool::AttrMy, QString().setNum(qApp->fromPixel(newY)));
SaveCoordinates(domElement, newX, newY);
if (redoFlag)
{
@ -101,7 +98,7 @@ void MoveDetail::redo()
}
else
{
qDebug()<<"Can't find detail with id ="<< detId << Q_FUNC_INFO;
qDebug()<<"Can't find detail with id ="<< nodeId << Q_FUNC_INFO;
return;
}
}
@ -114,7 +111,7 @@ bool MoveDetail::mergeWith(const QUndoCommand *command)
SCASSERT(moveCommand != nullptr);
const quint32 id = moveCommand->getDetId();
if (id != detId)
if (id != nodeId)
{
return false;
}
@ -129,3 +126,10 @@ int MoveDetail::id() const
{
return static_cast<int>(UndoCommand::MoveDetail);
}
//---------------------------------------------------------------------------------------------------------------------
void MoveDetail::SaveCoordinates(QDomElement &domElement, double x, double y)
{
doc->SetAttribute(domElement, VAbstractTool::AttrMx, QString().setNum(qApp->fromPixel(x)));
doc->SetAttribute(domElement, VAbstractTool::AttrMy, QString().setNum(qApp->fromPixel(y)));
}

View File

@ -29,12 +29,11 @@
#ifndef MOVEDETAIL_H
#define MOVEDETAIL_H
#include <QUndoCommand>
#include "vundocommand.h"
class VPattern;
class QGraphicsScene;
class MoveDetail : public QObject, public QUndoCommand
class MoveDetail : public VUndoCommand
{
Q_OBJECT
public:
@ -49,24 +48,20 @@ public:
quint32 getDetId() const;
double getNewX() const;
double getNewY() const;
signals:
void NeedLiteParsing();
private:
Q_DISABLE_COPY(MoveDetail)
VPattern *doc;
double oldX;
double oldY;
double newX;
double newY;
quint32 detId;
QGraphicsScene *scene;
bool redoFlag;
void SaveCoordinates(QDomElement &domElement, double x, double y);
};
//---------------------------------------------------------------------------------------------------------------------
inline quint32 MoveDetail::getDetId() const
{
return detId;
return nodeId;
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -31,14 +31,14 @@
#include <QDomElement>
#include <QGraphicsView>
#include "../xml/vpattern.h"
#include "undocommands.h"
//---------------------------------------------------------------------------------------------------------------------
MoveSpline::MoveSpline(VPattern *doc, const VSpline *oldSpl, const VSpline &newSpl, const quint32 &id,
QGraphicsScene *scene, QUndoCommand *parent)
: QObject(), QUndoCommand(parent), doc(doc), oldSpline(*oldSpl), newSpline(newSpl), splineId(id), scene(scene)
: VUndoCommand(QDomElement(), doc, parent), oldSpline(*oldSpl), newSpline(newSpl), scene(scene)
{
setText(tr("Move spline"));
nodeId = id;
SCASSERT(scene != nullptr);
}
@ -50,49 +50,13 @@ MoveSpline::~MoveSpline()
//---------------------------------------------------------------------------------------------------------------------
void MoveSpline::undo()
{
QDomElement domElement = doc->elementById(QString().setNum(splineId));
if (domElement.isElement())
{
doc->SetAttribute(domElement, VAbstractTool::AttrAngle1, QString().setNum(oldSpline.GetAngle1()));
doc->SetAttribute(domElement, VAbstractTool::AttrAngle2, QString().setNum(oldSpline.GetAngle2()));
doc->SetAttribute(domElement, VAbstractTool::AttrKAsm1, QString().setNum(oldSpline.GetKasm1()));
doc->SetAttribute(domElement, VAbstractTool::AttrKAsm2, QString().setNum(oldSpline.GetKasm2()));
doc->SetAttribute(domElement, VAbstractTool::AttrKCurve, QString().setNum(oldSpline.GetKcurve()));
emit NeedLiteParsing();
QList<QGraphicsView*> list = scene->views();
VAbstractTool::NewSceneRect(scene, list[0]);
}
else
{
qDebug()<<"Can't find spline with id ="<< splineId << Q_FUNC_INFO;
return;
}
Do(oldSpline);
}
//---------------------------------------------------------------------------------------------------------------------
void MoveSpline::redo()
{
QDomElement domElement = doc->elementById(QString().setNum(splineId));
if (domElement.isElement())
{
doc->SetAttribute(domElement, VAbstractTool::AttrAngle1, QString().setNum(newSpline.GetAngle1()));
doc->SetAttribute(domElement, VAbstractTool::AttrAngle2, QString().setNum(newSpline.GetAngle2()));
doc->SetAttribute(domElement, VAbstractTool::AttrKAsm1, QString().setNum(newSpline.GetKasm1()));
doc->SetAttribute(domElement, VAbstractTool::AttrKAsm2, QString().setNum(newSpline.GetKasm2()));
doc->SetAttribute(domElement, VAbstractTool::AttrKCurve, QString().setNum(newSpline.GetKcurve()));
emit NeedLiteParsing();
QList<QGraphicsView*> list = scene->views();
VAbstractTool::NewSceneRect(scene, list[0]);
}
else
{
qDebug()<<"Can't find spline with id ="<< splineId << Q_FUNC_INFO;
return;
}
Do(newSpline);
}
//---------------------------------------------------------------------------------------------------------------------
@ -102,7 +66,7 @@ bool MoveSpline::mergeWith(const QUndoCommand *command)
SCASSERT(moveCommand != nullptr);
const quint32 id = moveCommand->getSplineId();
if (id != splineId)
if (id != nodeId)
{
return false;
}
@ -116,3 +80,27 @@ int MoveSpline::id() const
{
return static_cast<int>(UndoCommand::MoveSpline);
}
//---------------------------------------------------------------------------------------------------------------------
void MoveSpline::Do(const VSpline &spl)
{
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
if (domElement.isElement())
{
doc->SetAttribute(domElement, VAbstractTool::AttrAngle1, QString().setNum(spl.GetAngle1()));
doc->SetAttribute(domElement, VAbstractTool::AttrAngle2, QString().setNum(spl.GetAngle2()));
doc->SetAttribute(domElement, VAbstractTool::AttrKAsm1, QString().setNum(spl.GetKasm1()));
doc->SetAttribute(domElement, VAbstractTool::AttrKAsm2, QString().setNum(spl.GetKasm2()));
doc->SetAttribute(domElement, VAbstractTool::AttrKCurve, QString().setNum(spl.GetKcurve()));
emit NeedLiteParsing();
QList<QGraphicsView*> list = scene->views();
VAbstractTool::NewSceneRect(scene, list[0]);
}
else
{
qDebug()<<"Can't find spline with id ="<< nodeId << Q_FUNC_INFO;
return;
}
}

View File

@ -29,13 +29,12 @@
#ifndef MOVESPLINE_H
#define MOVESPLINE_H
#include <QUndoCommand>
#include "vundocommand.h"
#include "../geometry/vspline.h"
class VPattern;
class QGraphicsScene;
class MoveSpline : public QObject, public QUndoCommand
class MoveSpline : public VUndoCommand
{
Q_OBJECT
public:
@ -48,21 +47,18 @@ public:
virtual int id() const;
quint32 getSplineId() const;
VSpline getNewSpline() const;
signals:
void NeedLiteParsing();
private:
Q_DISABLE_COPY(MoveSpline)
VPattern *doc;
VSpline oldSpline;
VSpline newSpline;
quint32 splineId;
QGraphicsScene *scene;
void Do(const VSpline &spl);
};
//---------------------------------------------------------------------------------------------------------------------
inline quint32 MoveSpline::getSplineId() const
{
return splineId;
return nodeId;
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -29,15 +29,14 @@
#include "movesplinepath.h"
#include <QDomElement>
#include "../tools/drawTools/vtoolsplinepath.h"
#include "undocommands.h"
//---------------------------------------------------------------------------------------------------------------------
MoveSplinePath::MoveSplinePath(VPattern *doc, const VSplinePath &oldSplPath, const VSplinePath &newSplPath,
const quint32 &id, QGraphicsScene *scene, QUndoCommand *parent)
: QObject(), QUndoCommand(parent), doc(doc), oldSplinePath(oldSplPath), newSplinePath(newSplPath), splinePathId(id),
scene(scene)
: VUndoCommand(QDomElement(), doc, parent), oldSplinePath(oldSplPath), newSplinePath(newSplPath), scene(scene)
{
setText(tr("Move spline path"));
nodeId = id;
SCASSERT(scene != nullptr);
}
@ -49,43 +48,13 @@ MoveSplinePath::~MoveSplinePath()
//---------------------------------------------------------------------------------------------------------------------
void MoveSplinePath::undo()
{
QDomElement domElement = doc->elementById(QString().setNum(splinePathId));
if (domElement.isElement())
{
doc->SetAttribute(domElement, VToolSplinePath::AttrKCurve, QString().setNum(oldSplinePath.getKCurve()));
VToolSplinePath::UpdatePathPoint(doc, domElement, oldSplinePath);
emit NeedLiteParsing();
QList<QGraphicsView*> list = scene->views();
VAbstractTool::NewSceneRect(scene, list[0]);
}
else
{
qDebug()<<"Can't find spline path with id ="<< splinePathId << Q_FUNC_INFO;
return;
}
Do(oldSplinePath);
}
//---------------------------------------------------------------------------------------------------------------------
void MoveSplinePath::redo()
{
QDomElement domElement = doc->elementById(QString().setNum(splinePathId));
if (domElement.isElement())
{
doc->SetAttribute(domElement, VToolSplinePath::AttrKCurve, QString().setNum(newSplinePath.getKCurve()));
VToolSplinePath::UpdatePathPoint(doc, domElement, newSplinePath);
emit NeedLiteParsing();
QList<QGraphicsView*> list = scene->views();
VAbstractTool::NewSceneRect(scene, list[0]);
}
else
{
qDebug()<<"Can't find spline path with id ="<< splinePathId << Q_FUNC_INFO;
return;
}
Do(newSplinePath);
}
//---------------------------------------------------------------------------------------------------------------------
@ -95,7 +64,7 @@ bool MoveSplinePath::mergeWith(const QUndoCommand *command)
SCASSERT(moveCommand != nullptr);
const quint32 id = moveCommand->getSplinePathId();
if (id != splinePathId)
if (id != nodeId)
{
return false;
}
@ -109,3 +78,24 @@ int MoveSplinePath::id() const
{
return static_cast<int>(UndoCommand::MoveSplinePath);
}
//---------------------------------------------------------------------------------------------------------------------
void MoveSplinePath::Do(const VSplinePath &splPath)
{
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
if (domElement.isElement())
{
doc->SetAttribute(domElement, VToolSplinePath::AttrKCurve, QString().setNum(splPath.getKCurve()));
VToolSplinePath::UpdatePathPoint(doc, domElement, splPath);
emit NeedLiteParsing();
QList<QGraphicsView*> list = scene->views();
VAbstractTool::NewSceneRect(scene, list[0]);
}
else
{
qDebug()<<"Can't find spline path with id ="<< nodeId << Q_FUNC_INFO;
return;
}
}

View File

@ -29,13 +29,12 @@
#ifndef MOVESPLINEPATH_H
#define MOVESPLINEPATH_H
#include <QUndoCommand>
#include "vundocommand.h"
#include "../geometry/vsplinepath.h"
class VPattern;
class QGraphicsScene;
class MoveSplinePath : public QObject, public QUndoCommand
class MoveSplinePath : public VUndoCommand
{
Q_OBJECT
public:
@ -48,21 +47,18 @@ public:
virtual int id() const;
quint32 getSplinePathId() const;
VSplinePath getNewSplinePath() const;
signals:
void NeedLiteParsing();
private:
Q_DISABLE_COPY(MoveSplinePath)
VPattern *doc;
VSplinePath oldSplinePath;
VSplinePath newSplinePath;
quint32 splinePathId;
QGraphicsScene *scene;
void Do(const VSplinePath &splPath);
};
//---------------------------------------------------------------------------------------------------------------------
inline quint32 MoveSplinePath::getSplinePathId() const
{
return splinePathId;
return nodeId;
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -32,14 +32,14 @@
#include "../xml/vpattern.h"
#include "../tools/vabstracttool.h"
#include "../widgets/vapplication.h"
#include "undocommands.h"
//---------------------------------------------------------------------------------------------------------------------
MoveSPoint::MoveSPoint(VPattern *doc, const double &x, const double &y, const quint32 &id, QGraphicsScene *scene,
QUndoCommand *parent)
: QObject(), QUndoCommand(parent), doc(doc), oldX(0.0), oldY(0.0), newX(x), newY(y), sPointId(id), scene(scene)
: VUndoCommand(QDomElement(), doc, parent), oldX(0.0), oldY(0.0), newX(x), newY(y), scene(scene)
{
setText(tr("Move single point"));
nodeId = id;
SCASSERT(scene != nullptr);
QDomElement domElement = doc->elementById(QString().setNum(id));
@ -50,7 +50,7 @@ MoveSPoint::MoveSPoint(VPattern *doc, const double &x, const double &y, const qu
}
else
{
qDebug()<<"Can't find spoint with id ="<< sPointId << Q_FUNC_INFO;
qDebug()<<"Can't find spoint with id ="<< nodeId << Q_FUNC_INFO;
return;
}
}
@ -62,43 +62,13 @@ MoveSPoint::~MoveSPoint()
//---------------------------------------------------------------------------------------------------------------------
void MoveSPoint::undo()
{
QDomElement domElement = doc->elementById(QString().setNum(sPointId));
if (domElement.isElement())
{
doc->SetAttribute(domElement, VAbstractTool::AttrX, QString().setNum(qApp->fromPixel(oldX)));
doc->SetAttribute(domElement, VAbstractTool::AttrY, QString().setNum(qApp->fromPixel(oldY)));
emit NeedLiteParsing();
QList<QGraphicsView*> list = scene->views();
VAbstractTool::NewSceneRect(scene, list[0]);
}
else
{
qDebug()<<"Can't find spoint with id ="<< sPointId << Q_FUNC_INFO;
return;
}
Do(oldX, oldY);
}
//---------------------------------------------------------------------------------------------------------------------
void MoveSPoint::redo()
{
QDomElement domElement = doc->elementById(QString().setNum(sPointId));
if (domElement.isElement())
{
doc->SetAttribute(domElement, VAbstractTool::AttrX, QString().setNum(qApp->fromPixel(newX)));
doc->SetAttribute(domElement, VAbstractTool::AttrY, QString().setNum(qApp->fromPixel(newY)));
emit NeedLiteParsing();
QList<QGraphicsView*> list = scene->views();
VAbstractTool::NewSceneRect(scene, list[0]);
}
else
{
qDebug()<<"Can't find spoint with id ="<< sPointId << Q_FUNC_INFO;
return;
}
Do(newX, newY);
}
//---------------------------------------------------------------------------------------------------------------------
@ -108,7 +78,7 @@ bool MoveSPoint::mergeWith(const QUndoCommand *command)
SCASSERT(moveCommand != nullptr);
const quint32 id = moveCommand->getSPointId();
if (id != sPointId)
if (id != nodeId)
{
return false;
}
@ -123,3 +93,24 @@ int MoveSPoint::id() const
{
return static_cast<int>(UndoCommand::MoveSPoint);
}
//---------------------------------------------------------------------------------------------------------------------
void MoveSPoint::Do(double x, double y)
{
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
if (domElement.isElement())
{
doc->SetAttribute(domElement, VAbstractTool::AttrX, QString().setNum(qApp->fromPixel(x)));
doc->SetAttribute(domElement, VAbstractTool::AttrY, QString().setNum(qApp->fromPixel(y)));
emit NeedLiteParsing();
QList<QGraphicsView*> list = scene->views();
VAbstractTool::NewSceneRect(scene, list[0]);
}
else
{
qDebug()<<"Can't find spoint with id ="<< nodeId << Q_FUNC_INFO;
return;
}
}

View File

@ -29,12 +29,11 @@
#ifndef MOVESPOINT_H
#define MOVESPOINT_H
#include <QUndoCommand>
#include "vundocommand.h"
class VPattern;
class QGraphicsScene;
class MoveSPoint : public QObject, public QUndoCommand
class MoveSPoint : public VUndoCommand
{
Q_OBJECT
public:
@ -48,23 +47,20 @@ public:
quint32 getSPointId() const;
double getNewX() const;
double getNewY() const;
signals:
void NeedLiteParsing();
void Do(double x, double y);
private:
Q_DISABLE_COPY(MoveSPoint)
VPattern *doc;
double oldX;
double oldY;
double newX;
double newY;
quint32 sPointId;
QGraphicsScene *scene;
};
//---------------------------------------------------------------------------------------------------------------------
inline quint32 MoveSPoint::getSPointId() const
{
return sPointId;
return nodeId;
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -27,15 +27,15 @@
*************************************************************************/
#include "savedetailoptions.h"
#include "undocommands.h"
#include "../tools/nodeDetails/vabstractnode.h"
#include <QGraphicsView>
SaveDetailOptions::SaveDetailOptions(const VDetail &oldDet, const VDetail &newDet, VPattern *doc, const quint32 &id,
QGraphicsScene *scene, QUndoCommand *parent)
: QObject(), QUndoCommand(parent), oldDet(oldDet), newDet(newDet), doc(doc), detId(id), scene(scene)
: VUndoCommand(QDomElement(), doc, parent), oldDet(oldDet), newDet(newDet), scene(scene)
{
setText(tr("Save detail option"));
nodeId = id;
}
//---------------------------------------------------------------------------------------------------------------------
@ -45,13 +45,10 @@ SaveDetailOptions::~SaveDetailOptions()
//---------------------------------------------------------------------------------------------------------------------
void SaveDetailOptions::undo()
{
QDomElement domElement = doc->elementById(QString().setNum(detId));
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
if (domElement.isElement())
{
doc->SetAttribute(domElement, VAbstractTool::AttrName, oldDet.getName());
doc->SetAttribute(domElement, VToolDetail::AttrSupplement, QString().setNum(oldDet.getSeamAllowance()));
doc->SetAttribute(domElement, VToolDetail::AttrClosed, QString().setNum(oldDet.getClosed()));
doc->SetAttribute(domElement, VToolDetail::AttrWidth, QString().setNum(oldDet.getWidth()));
SaveDet(domElement, oldDet);
doc->RemoveAllChild(domElement);
for (ptrdiff_t i = 0; i < oldDet.CountNode(); ++i)
{
@ -75,7 +72,7 @@ void SaveDetailOptions::undo()
}
else
{
qDebug()<<"Can't find detail with id ="<< detId << Q_FUNC_INFO;
qDebug()<<"Can't find detail with id ="<< nodeId << Q_FUNC_INFO;
return;
}
}
@ -83,13 +80,10 @@ void SaveDetailOptions::undo()
//---------------------------------------------------------------------------------------------------------------------
void SaveDetailOptions::redo()
{
QDomElement domElement = doc->elementById(QString().setNum(detId));
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
if (domElement.isElement())
{
doc->SetAttribute(domElement, VAbstractTool::AttrName, newDet.getName());
doc->SetAttribute(domElement, VToolDetail::AttrSupplement, QString().setNum(newDet.getSeamAllowance()));
doc->SetAttribute(domElement, VToolDetail::AttrClosed, QString().setNum(newDet.getClosed()));
doc->SetAttribute(domElement, VToolDetail::AttrWidth, QString().setNum(newDet.getWidth()));
SaveDet(domElement, newDet);
doc->RemoveAllChild(domElement);
for (ptrdiff_t i = 0; i < newDet.CountNode(); ++i)
{
@ -113,7 +107,7 @@ void SaveDetailOptions::redo()
}
else
{
qDebug()<<"Can't find detail with id ="<< detId << Q_FUNC_INFO;
qDebug()<<"Can't find detail with id ="<< nodeId << Q_FUNC_INFO;
return;
}
}
@ -125,7 +119,7 @@ bool SaveDetailOptions::mergeWith(const QUndoCommand *command)
SCASSERT(saveCommand != nullptr);
const quint32 id = saveCommand->getDetId();
if (id != detId)
if (id != nodeId)
{
return false;
}
@ -139,3 +133,12 @@ int SaveDetailOptions::id() const
{
return static_cast<int>(UndoCommand::SaveDetailOptions);
}
//---------------------------------------------------------------------------------------------------------------------
void SaveDetailOptions::SaveDet(QDomElement &domElement, const VDetail &det)
{
doc->SetAttribute(domElement, VAbstractTool::AttrName, det.getName());
doc->SetAttribute(domElement, VToolDetail::AttrSupplement, QString().setNum(det.getSeamAllowance()));
doc->SetAttribute(domElement, VToolDetail::AttrClosed, QString().setNum(det.getClosed()));
doc->SetAttribute(domElement, VToolDetail::AttrWidth, QString().setNum(det.getWidth()));
}

View File

@ -29,14 +29,12 @@
#ifndef SAVEDETAILOPTIONS_H
#define SAVEDETAILOPTIONS_H
#include <QUndoCommand>
#include <QDomElement>
#include "vundocommand.h"
#include "../tools/vtooldetail.h"
class VPattern;
class QGraphicsScene;
class SaveDetailOptions : public QObject, public QUndoCommand
class SaveDetailOptions : public VUndoCommand
{
Q_OBJECT
public:
@ -49,21 +47,18 @@ public:
virtual int id() const;
quint32 getDetId() const;
VDetail getNewDet() const;
signals:
void NeedLiteParsing();
private:
Q_DISABLE_COPY(SaveDetailOptions)
const VDetail oldDet;
VDetail newDet;
VPattern *doc;
const quint32 detId;
QGraphicsScene *scene;
void SaveDet(QDomElement &domElement, const VDetail &det);
};
//---------------------------------------------------------------------------------------------------------------------
inline quint32 SaveDetailOptions::getDetId() const
{
return detId;
return nodeId;
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -29,14 +29,14 @@
#include "savetooloptions.h"
#include "../options.h"
#include "../xml/vpattern.h"
#include "undocommands.h"
//---------------------------------------------------------------------------------------------------------------------
SaveToolOptions::SaveToolOptions(const QDomElement &oldXml, const QDomElement &newXml, VPattern *doc, const quint32 &id,
QUndoCommand *parent)
: QObject(), QUndoCommand(parent), oldXml(oldXml), newXml(newXml), doc(doc), toolId(id)
: VUndoCommand(QDomElement(), doc, parent), oldXml(oldXml), newXml(newXml)
{
setText(tr("Save tool option"));
nodeId = id;
}
//---------------------------------------------------------------------------------------------------------------------
@ -46,7 +46,7 @@ SaveToolOptions::~SaveToolOptions()
//---------------------------------------------------------------------------------------------------------------------
void SaveToolOptions::undo()
{
QDomElement domElement = doc->elementById(QString().setNum(toolId));
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
if (domElement.isElement())
{
domElement.parentNode().replaceChild(oldXml, domElement);
@ -55,7 +55,7 @@ void SaveToolOptions::undo()
}
else
{
qDebug()<<"Can't find tool with id ="<< toolId << Q_FUNC_INFO;
qDebug()<<"Can't find tool with id ="<< nodeId << Q_FUNC_INFO;
return;
}
}
@ -63,7 +63,7 @@ void SaveToolOptions::undo()
//---------------------------------------------------------------------------------------------------------------------
void SaveToolOptions::redo()
{
QDomElement domElement = doc->elementById(QString().setNum(toolId));
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
if (domElement.isElement())
{
domElement.parentNode().replaceChild(newXml, domElement);
@ -72,7 +72,7 @@ void SaveToolOptions::redo()
}
else
{
qDebug()<<"Can't find tool with id ="<< toolId << Q_FUNC_INFO;
qDebug()<<"Can't find tool with id ="<< nodeId << Q_FUNC_INFO;
return;
}
}
@ -84,7 +84,7 @@ bool SaveToolOptions::mergeWith(const QUndoCommand *command)
SCASSERT(saveCommand != nullptr);
const quint32 id = saveCommand->getToolId();
if (id != toolId)
if (id != nodeId)
{
return false;
}

View File

@ -29,12 +29,9 @@
#ifndef SAVETOOLOPTIONS_H
#define SAVETOOLOPTIONS_H
#include <QUndoCommand>
#include <QDomElement>
#include "vundocommand.h"
class VPattern;
class SaveToolOptions : public QObject, public QUndoCommand
class SaveToolOptions : public VUndoCommand
{
Q_OBJECT
public:
@ -53,8 +50,6 @@ private:
Q_DISABLE_COPY(SaveToolOptions)
const QDomElement oldXml;
QDomElement newXml;
VPattern *doc;
const quint32 toolId;
};
//---------------------------------------------------------------------------------------------------------------------
@ -66,7 +61,7 @@ inline QDomElement SaveToolOptions::getNewXml() const
//---------------------------------------------------------------------------------------------------------------------
inline quint32 SaveToolOptions::getToolId() const
{
return toolId;
return nodeId;
}
#endif // SAVETOOLOPTIONS_H

View File

@ -5,7 +5,6 @@ HEADERS += \
undocommands/movespline.h \
undocommands/movesplinepath.h \
undocommands/savetooloptions.h \
undocommands/undocommands.h \
undocommands/savedetailoptions.h \
undocommands/movedetail.h \
undocommands/deltool.h \
@ -13,7 +12,8 @@ HEADERS += \
undocommands/adddetnode.h \
undocommands/adddet.h \
undocommands/adduniondetails.h \
undocommands/deletedetail.h
undocommands/deletedetail.h \
undocommands/vundocommand.h
SOURCES += \
@ -30,5 +30,6 @@ SOURCES += \
undocommands/adddetnode.cpp \
undocommands/adddet.cpp \
undocommands/adduniondetails.cpp \
undocommands/deletedetail.cpp
undocommands/deletedetail.cpp \
undocommands/vundocommand.cpp

View File

@ -0,0 +1,54 @@
/************************************************************************
**
** @file vundocommand.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 16 7, 2014
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 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 "vundocommand.h"
#include "../xml/vpattern.h"
//---------------------------------------------------------------------------------------------------------------------
VUndoCommand::VUndoCommand(const QDomElement &xml, VPattern *doc, QUndoCommand *parent)
:QObject(), QUndoCommand(parent), xml(xml), doc(doc), nodeId(0), redoFlag(false)
{
SCASSERT(xml.isNull() == false);
SCASSERT(doc != nullptr);
}
//---------------------------------------------------------------------------------------------------------------------
VUndoCommand::~VUndoCommand()
{
}
//---------------------------------------------------------------------------------------------------------------------
void VUndoCommand::RedoFullParsing()
{
if (redoFlag)
{
emit NeedFullParsing();
}
redoFlag = true;
}

View File

@ -1,8 +1,8 @@
/************************************************************************
**
** @file undocommands.h
** @file vundocommand.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 11 6, 2014
** @date 16 7, 2014
**
** @brief
** @copyright
@ -26,8 +26,11 @@
**
*************************************************************************/
#ifndef UNDOCOMMANDS_H
#define UNDOCOMMANDS_H
#ifndef VUNDOCOMMAND_H
#define VUNDOCOMMAND_H
#include <QUndoCommand>
#include <QDomElement>
enum class UndoCommand: char { AddPatternPiece,
AddToCalc,
@ -41,4 +44,26 @@ enum class UndoCommand: char { AddPatternPiece,
DeletePatternPiece
};
#endif // UNDOCOMMANDS_H
class VPattern;
class VUndoCommand : public QObject, public QUndoCommand
{
Q_OBJECT
public:
VUndoCommand(const QDomElement &xml, VPattern *doc, QUndoCommand *parent = 0);
virtual ~VUndoCommand();
signals:
void ClearScene();
void NeedFullParsing();
void NeedLiteParsing();
protected:
QDomElement xml;
VPattern *doc;
quint32 nodeId;
bool redoFlag;
void RedoFullParsing();
private:
Q_DISABLE_COPY(VUndoCommand)
};
#endif // VUNDOCOMMAND_H

View File

@ -112,6 +112,7 @@ public:
bool CheckNamePP(const QString& name) const;
int CountPP() const;
QRectF ActiveDrawBoundingRect() const;
quint32 GetParametrId(const QDomElement& domElement) const;
signals:
/**
* @brief ChangedActivDraw change active pattern peace.
@ -198,7 +199,6 @@ private:
void ParseToolsElement(VMainGraphicsScene *scene, const QDomElement& domElement,
const Document &parse, const QString& type);
void ParseIncrementsElement(const QDomNode& node);
quint32 GetParametrId(const QDomElement& domElement) const;
void CollectId(const QDomElement &node, QVector<quint32> &vector)const;
void PrepareForParse(const Document &parse);
void UpdateMeasurements();