Use VAbstractPattern in tools.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-06-16 18:01:17 +03:00
parent 67dbe7409f
commit fab30e999f
10 changed files with 23 additions and 22 deletions

View File

@ -131,7 +131,7 @@ void VDrawTool::SaveDialogChange()
SaveDialog(newDomElement);
SaveToolOptions *saveOptions = new SaveToolOptions(oldDomElement, newDomElement, doc, id);
connect(saveOptions, &SaveToolOptions::NeedLiteParsing, doc, &VPattern::LiteParseTree);
connect(saveOptions, &SaveToolOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(saveOptions);
}
else
@ -182,7 +182,7 @@ void VDrawTool::SaveOption(QSharedPointer<VGObject> &obj)
SaveOptions(newDomElement, obj);
SaveToolOptions *saveOptions = new SaveToolOptions(oldDomElement, newDomElement, doc, id);
connect(saveOptions, &SaveToolOptions::NeedLiteParsing, doc, &VPattern::LiteParseTree);
connect(saveOptions, &SaveToolOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(saveOptions);
}
else

View File

@ -136,7 +136,7 @@ void VToolPoint::NameChangePosition(const QPointF &pos)
void VToolPoint::UpdateNamePosition(qreal mx, qreal my)
{
MoveLabel *moveLabel = new MoveLabel(doc, mx, my, id, this->scene());
connect(moveLabel, &MoveLabel::NeedLiteParsing, doc, &VPattern::LiteParseTree);
connect(moveLabel, &MoveLabel::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(moveLabel);
}

View File

@ -146,7 +146,7 @@ QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change,
QPointF newPos = value.toPointF();
MoveSPoint *moveSP = new MoveSPoint(doc, newPos.x(), newPos.y(), id, this->scene());
connect(moveSP, &MoveSPoint::NeedLiteParsing, doc, &VPattern::LiteParseTree);
connect(moveSP, &MoveSPoint::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(moveSP);
}
return QGraphicsItem::itemChange(change, value);

View File

@ -253,7 +253,7 @@ void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, const Sp
}
MoveSpline *moveSpl = new MoveSpline(doc, spline.data(), spl, id, this->scene());
connect(moveSpl, &MoveSpline::NeedLiteParsing, doc, &VPattern::LiteParseTree);
connect(moveSpl, &MoveSpline::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(moveSpl);
}
@ -416,7 +416,7 @@ void VToolSpline::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
VSpline spl = VSpline(spline->GetP1(), p2, p3, spline->GetP4(), spline->GetKcurve());
MoveSpline *moveSpl = new MoveSpline(doc, spline.data(), spl, id, this->scene());
connect(moveSpl, &MoveSpline::NeedLiteParsing, doc, &VPattern::LiteParseTree);
connect(moveSpl, &MoveSpline::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(moveSpl);
}

View File

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

View File

@ -111,13 +111,13 @@ const QString VAbstractTool::ColorYellow = QStringLiteral("yellow");
* @param id object id in container.
* @param parent parent object.
*/
VAbstractTool::VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent)
VAbstractTool::VAbstractTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent)
:VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), vis(nullptr)
{
SCASSERT(doc != nullptr);
connect(this, &VAbstractTool::toolhaveChange, this->doc, &VPattern::haveLiteChange);
connect(this->doc, &VPattern::FullUpdateFromFile, this, &VAbstractTool::FullUpdateFromFile);
connect(this, &VAbstractTool::LiteUpdateTree, this->doc, &VPattern::LiteParseTree);
connect(this, &VAbstractTool::toolhaveChange, this->doc, &VAbstractPattern::haveLiteChange);
connect(this->doc, &VAbstractPattern::FullUpdateFromFile, this, &VAbstractTool::FullUpdateFromFile);
connect(this, &VAbstractTool::LiteUpdateTree, this->doc, &VAbstractPattern::LiteParseTree);
}
//---------------------------------------------------------------------------------------------------------------------
@ -141,7 +141,7 @@ void VAbstractTool::DeleteTool(bool ask)
}
}
DelTool *delTool = new DelTool(doc, id);
connect(delTool, &DelTool::NeedFullParsing, doc, &VPattern::NeedFullParsing);
connect(delTool, &DelTool::NeedFullParsing, doc, &VAbstractPattern::NeedFullParsing);
qApp->getUndoStack()->push(delTool);
}
}
@ -333,7 +333,7 @@ const QStringList VAbstractTool::StylesList()
* @param toolType tool type
* @param doc dom document container
*/
void VAbstractTool::AddRecord(const quint32 id, const Tool &toolType, VPattern *doc)
void VAbstractTool::AddRecord(const quint32 id, const Tool &toolType, VAbstractPattern *doc)
{
QVector<VToolRecord> *history = doc->getHistory();
VToolRecord record = VToolRecord(id, toolType, doc->GetNameActivPP());

View File

@ -30,7 +30,7 @@
#define VABSTRACTTOOL_H
#include "vdatatool.h"
#include "../xml/vpattern.h"
#include "../../libs/ifc/xml/vabstractpattern.h"
#include "../core/vapplication.h"
#include "../libs/vwidgets/vmaingraphicsscene.h"
#include "../visualization/visualization.h"
@ -51,7 +51,7 @@ class VAbstractTool: public VDataTool
{
Q_OBJECT
public:
VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent = nullptr);
VAbstractTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent = nullptr);
virtual ~VAbstractTool();
quint32 getId() const;
static const QString AttrType;
@ -124,7 +124,7 @@ public:
static const QStringList Colors();
static QMap<QString, QString> ColorsList();
static void AddRecord(const quint32 id, const Tool &toolType, VPattern *doc);
static void AddRecord(const quint32 id, const Tool &toolType, VAbstractPattern *doc);
const VContainer *getData() const;
@ -153,7 +153,7 @@ signals:
void LiteUpdateTree(const Document &parse);
protected:
/** @brief doc dom document container */
VPattern *doc;
VAbstractPattern *doc;
/** @brief id object id. */
const quint32 id;

View File

@ -264,7 +264,7 @@ void VToolDetail::FullUpdateFromGuiOk(int result)
VDetail oldDet = VAbstractTool::data.GetDetail(id);
SaveDetailOptions *saveCommand = new SaveDetailOptions(oldDet, newDet, doc, id, this->scene());
connect(saveCommand, &SaveDetailOptions::NeedLiteParsing, doc, &VPattern::LiteParseTree);
connect(saveCommand, &SaveDetailOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(saveCommand);
}
delete dialog;
@ -335,7 +335,7 @@ QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const
QPointF newPos = value.toPointF();
MoveDetail *moveDet = new MoveDetail(doc, newPos.x(), newPos.y(), id, this->scene());
connect(moveDet, &MoveDetail::NeedLiteParsing, doc, &VPattern::LiteParseTree);
connect(moveDet, &MoveDetail::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(moveDet);
}

View File

@ -53,7 +53,7 @@ void AddToCalc::undo()
doc->setCursor(cursor);
QDomElement calcElement;
if (doc->GetActivNodeElement(VPattern::TagCalculation, calcElement))
if (doc->GetActivNodeElement(VAbstractPattern::TagCalculation, calcElement))
{
QDomElement domElement = doc->elementById(nodeId);
if (domElement.isElement())
@ -93,7 +93,7 @@ void AddToCalc::redo()
doc->setCursor(cursor);
QDomElement calcElement;
if (doc->GetActivNodeElement(VPattern::TagCalculation, calcElement))
if (doc->GetActivNodeElement(VAbstractPattern::TagCalculation, calcElement))
{
if (cursor <= 0)
{

View File

@ -205,6 +205,7 @@ signals:
void SetCurrentPP(const QString &patterPiece);
public slots:
virtual void LiteParseTree(const Document &parse)=0;
void haveLiteChange();
void ShowHistoryTool(quint32 id, bool enable);
void NeedFullParsing();